@coveo/quantic 3.42.0 → 3.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,35 +14,35 @@ function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){
14
14
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
- */(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessCaseAssist",["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["CoveoHeadlessCaseAssist"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var HA=Object.create;var Po=Object.defineProperty;var zA=Object.getOwnPropertyDescriptor;var WA=Object.getOwnPropertyNames;var KA=Object.getPrototypeOf,YA=Object.prototype.hasOwnProperty;var XA=(e,t,r)=>t in e?Po(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Tn=(e,t)=>()=>(e&&(t=e(e=0)),t);var We=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),zi=(e,t)=>{for(var r in t)Po(e,r,{get:t[r],enumerable:!0})},Gp=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of WA(t))!YA.call(e,o)&&o!==r&&Po(e,o,{get:()=>t[o],enumerable:!(n=zA(t,o))||n.enumerable});return e};var kt=(e,t,r)=>(r=e!=null?HA(KA(e)):{},Gp(t||!e||!e.__esModule?Po(r,"default",{value:e,enumerable:!0}):r,e)),ZA=e=>Gp(Po({},"__esModule",{value:!0}),e);var oe=(e,t,r)=>XA(e,typeof t!="symbol"?t+"":t,r);var A,d=Tn(()=>{"use strict";A=typeof globalThis<"u"?globalThis:window});function Wi(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Wi=function(t){return typeof t}:Wi=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wi(e)}function tb(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=rb.bind(this))}function rb(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","*/*"),JA(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):eb(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var JA,eb,p=Tn(()=>{"use strict";JA=function(t){return typeof t=="string"},eb=function(t){return t instanceof Blob};tb.call((typeof window>"u"?"undefined":Wi(window))==="object"?window:{})});var xu=We(No=>{"use strict";m();d();f();p();Object.defineProperty(No,"__esModule",{value:!0});function Bp(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 nb(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ob(e,t,r){return t=_n(t),sb(e,zp()?Reflect.construct(t,r||[],_n(e).constructor):t.apply(e,r))}function bu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $p(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,lb(n.key),n)}}function wu(e,t,r){return t&&$p(e.prototype,t),r&&$p(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Qp(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=db(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(u){throw u},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
18
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return s=u.done,u},e:function(u){a=!0,i=u},f:function(){try{s||r.return==null||r.return()}finally{if(a)throw i}}}}function Su(){return Su=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=ab(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Su.apply(null,arguments)}function _n(e){return _n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_n(e)}function ib(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&&Au(e,t)}function zp(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zp=function(){return!!e})()}function sb(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 nb(e)}function Au(e,t){return Au=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Au(e,t)}function ab(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=_n(e))!==null;);return e}function cb(e,t,r,n){var o=Su(_n(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function ub(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 lb(e){var t=ub(e,"string");return typeof t=="symbol"?t:t+""}function db(e,t){if(e){if(typeof e=="string")return Bp(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)?Bp(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function pb(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 fb(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 Hp=function(){function e(){bu(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return wu(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],i=0,s=o.length;i<s;i++)if(o[i].callback===n){o.splice(i,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var o=this.listeners[r.type],i=o.slice(),s=function(){var g=i[a];try{g.callback.call(n,r)}catch(v){Promise.resolve().then(function(){throw v})}g.options&&g.options.once&&n.removeEventListener(r.type,g.callback)},a=0,u=i.length;a<u;a++)s();return!r.defaultPrevented}}}])}(),Cu=function(e){function t(){var r;return bu(this,t),r=ob(this,t),r.listeners||Hp.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 ib(t,e),wu(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)),cb(t,"dispatchEvent",this,3)([n])}},{key:"throwIfAborted",value:function(){var n=this.aborted,o=this.reason,i=o===void 0?"Aborted":o;if(n)throw i}}],[{key:"timeout",value:function(n){var o=new Ki;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 Ki;function i(){o.abort(this.reason),s()}function s(){var g=Qp(n),v;try{for(g.s();!(v=g.n()).done;){var E=v.value;E.removeEventListener("abort",i)}}catch(h){g.e(h)}finally{g.f()}}var a=Qp(n),u;try{for(a.s();!(u=a.n()).done;){var c=u.value;if(c.aborted){o.abort(c.reason);break}else c.addEventListener("abort",i)}}catch(g){a.e(g)}finally{a.f()}return o.signal}}])}(Hp),Ki=function(){function e(){bu(this,e),Object.defineProperty(this,"signal",{value:new Cu,writable:!0,configurable:!0})}return wu(e,[{key:"abort",value:function(r){var n=fb(r),o=pb(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Ki.prototype[Symbol.toStringTag]="AbortController",Cu.prototype[Symbol.toStringTag]="AbortSignal");function mb(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 gb(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,o=n===void 0?r.Request:n,i=t.AbortController,s=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,a=s===void 0?!1:s;if(!mb({fetch:r,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a}))return{fetch:r,Request:u};var u=o;(u&&!u.prototype.hasOwnProperty("signal")||a)&&(u=function(E,h){var y;h&&h.signal&&(y=h.signal,delete h.signal);var S=new o(E,h);return y&&Object.defineProperty(S,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),S},u.prototype=o.prototype);var c=r,g=function(E,h){var y=u&&u.prototype.isPrototypeOf(E)?E.signal:h?h.signal:void 0;if(y){var S;try{S=new DOMException("Aborted","AbortError")}catch{S=new Error("Aborted"),S.name="AbortError"}if(y.aborted)return Promise.reject(S);var x=new Promise(function(I,T){y.addEventListener("abort",function(){return T(S)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([x,c(E,h)])}return c(E,h)};return{fetch:g,Request:u}}No.AbortController=Ki;No.AbortSignal=Cu;No.abortableFetch=gb});var Wp,l,w,f=Tn(()=>{"use strict";Wp=kt(xu(),1),l=kt(xu(),1),{fetch:w}=(0,Wp.abortableFetch)({fetch})});function Eu(e){return typeof e!="string"||e in{}}function Iu(){return Object.create(null)}function Kp(e){return typeof e=="string"&&!!e.trim()}function Ru(e,t){var r=e.split(";").filter(Kp),n=r.shift(),o=hb(n),i=o.name,s=o.value;if(t=t?Object.assign({},Yi,t):Yi,Eu(i))return null;try{s=t.decodeValues?decodeURIComponent(s):s}catch(u){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",u)}var a=Iu();return a.name=i,a.value=s,r.forEach(function(u){var c=u.split("="),g=c.shift().trimLeft().toLowerCase();if(!Eu(g)){var v=c.join("=");if(g==="expires")a.expires=new Date(v);else if(g==="max-age"){var E=parseInt(v,10);Number.isNaN(E)||(a.maxAge=E)}else g==="secure"?a.secure=!0:g==="httponly"?a.httpOnly=!0:g==="samesite"?a.sameSite=v:g==="partitioned"?a.partitioned=!0:g&&(a[g]=v)}}),a}function hb(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function kn(e,t){if(t=t?Object.assign({},Yi,t):Yi,!e)return t.map?Iu():[];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(s){return s.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(Kp),n&&(e=e.map(Xi).flat()),t.map){var i=Iu();return e.reduce(function(s,a){var u=Ru(a,t);return u&&!Eu(u.name)&&(s[u.name]=u),s},i)}else return e.map(function(s){return Ru(s,t)}).filter(Boolean)}function Xi(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,i,s,a;function u(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function c(){return o=e.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<e.length;){for(n=r,a=!1;u();)if(o=e.charAt(r),o===","){for(i=r,r+=1,u(),s=r;r<e.length&&c();)r+=1;r<e.length&&e.charAt(r)==="="?(a=!0,r=s,t.push(e.substring(n,i)),n=r):r=i+1}else r+=1;(!a||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var Yi,Yp=Tn(()=>{"use strict";m();d();f();p();Yi={decodeValues:!0,map:!1,silent:!1,split:"auto"};kn.parseSetCookie=kn;kn.parse=kn;kn.parseString=Ru;kn.splitCookiesString=Xi});function Fo(e){if(yb.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Tu(e){return e.replace(vb,"")}function Do(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||!Sb(r))return!1}return!0}function Sb(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function Zp(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 yb,Xp,vb,Jp,On,_u,ef,C,rf=Tn(()=>{"use strict";m();d();f();p();Yp();yb=/[^a-z0-9\-#$%&'*+.^_`|~]/i;Xp=[`
19
- `,"\r","\t"," "],vb=new RegExp(`(^[${Xp.join("")}]|$[${Xp.join("")}])`,"g");On=Symbol("normalizedHeaders"),_u=Symbol("rawHeaderNames"),ef=", ",C=class tf{constructor(t){this[On]={},this[_u]=new Map,this[Jp]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof tf||typeof A.Headers<"u"&&t instanceof A.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(ef):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(ef):n)})}[(Jp=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[On]).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(!Do(t))throw new TypeError(`Invalid header name "${t}"`);return this[On].hasOwnProperty(Fo(t))}get(t){if(!Do(t))throw TypeError(`Invalid header name "${t}"`);return this[On][Fo(t)]??null}set(t,r){if(!Do(t)||!Zp(r))return;let n=Fo(t),o=Tu(r);this[On][n]=Tu(o),this[_u].set(n,t)}append(t,r){if(!Do(t)||!Zp(r))return;let n=Fo(t),o=Tu(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!Do(t)||!this.has(t))return;let r=Fo(t);delete this[On][r],this[_u].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===""?[""]:Xi(t)}}});var m=Tn(()=>{"use strict";rf()});var nf=We(Mo=>{"use strict";m();d();f();p();var Zi=Mo&&Mo.__assign||function(){return Zi=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},Zi.apply(this,arguments)};Object.defineProperty(Mo,"__esModule",{value:!0});var Ab={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function bb(e){var t=Zi(Zi({},Ab),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Mo.getSanitizedOptions=bb});var of=We(ku=>{"use strict";m();d();f();p();Object.defineProperty(ku,"__esModule",{value:!0});function wb(e){var t=Math.random()*e;return Math.round(t)}ku.fullJitter=wb});var sf=We(Ou=>{"use strict";m();d();f();p();Object.defineProperty(Ou,"__esModule",{value:!0});function Cb(e){return e}Ou.noJitter=Cb});var af=We(Pu=>{"use strict";m();d();f();p();Object.defineProperty(Pu,"__esModule",{value:!0});var xb=of(),Eb=sf();function Ib(e){return e.jitter==="full"?xb.fullJitter:Eb.noJitter}Pu.JitterFactory=Ib});var Fu=We(Nu=>{"use strict";m();d();f();p();Object.defineProperty(Nu,"__esModule",{value:!0});var Rb=af(),Tb=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=Rb.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}();Nu.Delay=Tb});var cf=We(tr=>{"use strict";m();d();f();p();var _b=tr&&tr.__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 i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},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)}}(),kb=tr&&tr.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(g){try{c(n.next(g))}catch(v){s(v)}}function u(g){try{c(n.throw(g))}catch(v){s(v)}}function c(g){g.done?i(g.value):o(g.value).then(a,u)}c((n=n.apply(e,t||[])).next())})},Ob=tr&&tr.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(tr,"__esModule",{value:!0});var Pb=Fu(),Nb=function(e){_b(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return kb(this,void 0,void 0,function(){return Ob(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}(Pb.Delay);tr.SkipFirstDelay=Nb});var uf=We(Lo=>{"use strict";m();d();f();p();var Fb=Lo&&Lo.__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 i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},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(Lo,"__esModule",{value:!0});var Db=Fu(),Mb=function(e){Fb(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Db.Delay);Lo.AlwaysDelay=Mb});var lf=We(Du=>{"use strict";m();d();f();p();Object.defineProperty(Du,"__esModule",{value:!0});var Lb=cf(),jb=uf();function qb(e,t){var r=Ub(e);return r.setAttemptNumber(t),r}Du.DelayFactory=qb;function Ub(e){return e.delayFirstAttempt?new jb.AlwaysDelay(e):new Lb.SkipFirstDelay(e)}});var df=We(Lr=>{"use strict";m();d();f();p();var Mu=Lr&&Lr.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(g){try{c(n.next(g))}catch(v){s(v)}}function u(g){try{c(n.throw(g))}catch(v){s(v)}}function c(g){g.done?i(g.value):o(g.value).then(a,u)}c((n=n.apply(e,t||[])).next())})},Lu=Lr&&Lr.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(Lr,"__esModule",{value:!0});var Vb=nf(),Gb=lf();function Bb(e,t){return t===void 0&&(t={}),Mu(this,void 0,void 0,function(){var r,n;return Lu(this,function(o){switch(o.label){case 0:return r=Vb.getSanitizedOptions(t),n=new $b(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}Lr.backOff=Bb;var $b=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return Mu(this,void 0,void 0,function(){var t,r;return Lu(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 Mu(this,void 0,void 0,function(){var t;return Lu(this,function(r){switch(r.label){case 0:return t=Gb.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var va=We((dd,pd)=>{"use strict";m();d();f();p();(function(e,t){typeof dd=="object"&&typeof pd<"u"?pd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs=t()})(dd,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",s="hour",a="day",u="week",c="month",g="quarter",v="year",E="date",h="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,S=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,x={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(O){var P=["th","st","nd","rd"],N=O%100;return"["+O+(P[(N-20)%10]||P[N]||P[0])+"]"}},I=function(O,P,N){var Q=String(O);return!Q||Q.length>=P?O:""+Array(P+1-Q.length).join(N)+O},T={s:I,z:function(O){var P=-O.utcOffset(),N=Math.abs(P),Q=Math.floor(N/60),$=N%60;return(P<=0?"+":"-")+I(Q,2,"0")+":"+I($,2,"0")},m:function O(P,N){if(P.date()<N.date())return-O(N,P);var Q=12*(N.year()-P.year())+(N.month()-P.month()),$=P.clone().add(Q,c),Y=N-$<0,K=P.clone().add(Q+(Y?-1:1),c);return+(-(Q+(N-$)/(Y?$-K:K-$))||0)},a:function(O){return O<0?Math.ceil(O)||0:Math.floor(O)},p:function(O){return{M:c,y:v,w:u,d:a,D:E,h:s,m:i,s:o,ms:n,Q:g}[O]||String(O||"").toLowerCase().replace(/s$/,"")},u:function(O){return O===void 0}},R="en",k={};k[R]=x;var _="$isDayjsObject",F=function(O){return O instanceof U||!(!O||!O[_])},V=function O(P,N,Q){var $;if(!P)return R;if(typeof P=="string"){var Y=P.toLowerCase();k[Y]&&($=Y),N&&(k[Y]=N,$=Y);var K=P.split("-");if(!$&&K.length>1)return O(K[0])}else{var H=P.name;k[H]=P,$=H}return!Q&&$&&(R=$),$||!Q&&R},j=function(O,P){if(F(O))return O.clone();var N=typeof P=="object"?P:{};return N.date=O,N.args=arguments,new U(N)},L=T;L.l=V,L.i=F,L.w=function(O,P){return j(O,{locale:P.$L,utc:P.$u,x:P.$x,$offset:P.$offset})};var U=function(){function O(N){this.$L=V(N.locale,null,!0),this.parse(N),this.$x=this.$x||N.x||{},this[_]=!0}var P=O.prototype;return P.parse=function(N){this.$d=function(Q){var $=Q.date,Y=Q.utc;if($===null)return new Date(NaN);if(L.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var K=$.match(y);if(K){var H=K[2]-1||0,J=(K[7]||"0").substring(0,3);return Y?new Date(Date.UTC(K[1],H,K[3]||1,K[4]||0,K[5]||0,K[6]||0,J)):new Date(K[1],H,K[3]||1,K[4]||0,K[5]||0,K[6]||0,J)}}return new Date($)}(N),this.init()},P.init=function(){var N=this.$d;this.$y=N.getFullYear(),this.$M=N.getMonth(),this.$D=N.getDate(),this.$W=N.getDay(),this.$H=N.getHours(),this.$m=N.getMinutes(),this.$s=N.getSeconds(),this.$ms=N.getMilliseconds()},P.$utils=function(){return L},P.isValid=function(){return this.$d.toString()!==h},P.isSame=function(N,Q){var $=j(N);return this.startOf(Q)<=$&&$<=this.endOf(Q)},P.isAfter=function(N,Q){return j(N)<this.startOf(Q)},P.isBefore=function(N,Q){return this.endOf(Q)<j(N)},P.$g=function(N,Q,$){return L.u(N)?this[Q]:this.set($,N)},P.unix=function(){return Math.floor(this.valueOf()/1e3)},P.valueOf=function(){return this.$d.getTime()},P.startOf=function(N,Q){var $=this,Y=!!L.u(Q)||Q,K=L.p(N),H=function(pe,de){var ge=L.w($.$u?Date.UTC($.$y,de,pe):new Date($.$y,de,pe),$);return Y?ge:ge.endOf(a)},J=function(pe,de){return L.w($.toDate()[pe].apply($.toDate("s"),(Y?[0,0,0,0]:[23,59,59,999]).slice(de)),$)},ie=this.$W,be=this.$M,Oe=this.$D,Ie="set"+(this.$u?"UTC":"");switch(K){case v:return Y?H(1,0):H(31,11);case c:return Y?H(1,be):H(0,be+1);case u:var Te=this.$locale().weekStart||0,_e=(ie<Te?ie+7:ie)-Te;return H(Y?Oe-_e:Oe+(6-_e),be);case a:case E:return J(Ie+"Hours",0);case s:return J(Ie+"Minutes",1);case i:return J(Ie+"Seconds",2);case o:return J(Ie+"Milliseconds",3);default:return this.clone()}},P.endOf=function(N){return this.startOf(N,!1)},P.$set=function(N,Q){var $,Y=L.p(N),K="set"+(this.$u?"UTC":""),H=($={},$[a]=K+"Date",$[E]=K+"Date",$[c]=K+"Month",$[v]=K+"FullYear",$[s]=K+"Hours",$[i]=K+"Minutes",$[o]=K+"Seconds",$[n]=K+"Milliseconds",$)[Y],J=Y===a?this.$D+(Q-this.$W):Q;if(Y===c||Y===v){var ie=this.clone().set(E,1);ie.$d[H](J),ie.init(),this.$d=ie.set(E,Math.min(this.$D,ie.daysInMonth())).$d}else H&&this.$d[H](J);return this.init(),this},P.set=function(N,Q){return this.clone().$set(N,Q)},P.get=function(N){return this[L.p(N)]()},P.add=function(N,Q){var $,Y=this;N=Number(N);var K=L.p(Q),H=function(be){var Oe=j(Y);return L.w(Oe.date(Oe.date()+Math.round(be*N)),Y)};if(K===c)return this.set(c,this.$M+N);if(K===v)return this.set(v,this.$y+N);if(K===a)return H(1);if(K===u)return H(7);var J=($={},$[i]=t,$[s]=r,$[o]=e,$)[K]||1,ie=this.$d.getTime()+N*J;return L.w(ie,this)},P.subtract=function(N,Q){return this.add(-1*N,Q)},P.format=function(N){var Q=this,$=this.$locale();if(!this.isValid())return $.invalidDate||h;var Y=N||"YYYY-MM-DDTHH:mm:ssZ",K=L.z(this),H=this.$H,J=this.$m,ie=this.$M,be=$.weekdays,Oe=$.months,Ie=$.meridiem,Te=function(de,ge,fe,Ue){return de&&(de[ge]||de(Q,Y))||fe[ge].slice(0,Ue)},_e=function(de){return L.s(H%12||12,de,"0")},pe=Ie||function(de,ge,fe){var Ue=de<12?"AM":"PM";return fe?Ue.toLowerCase():Ue};return Y.replace(S,function(de,ge){return ge||function(fe){switch(fe){case"YY":return String(Q.$y).slice(-2);case"YYYY":return L.s(Q.$y,4,"0");case"M":return ie+1;case"MM":return L.s(ie+1,2,"0");case"MMM":return Te($.monthsShort,ie,Oe,3);case"MMMM":return Te(Oe,ie);case"D":return Q.$D;case"DD":return L.s(Q.$D,2,"0");case"d":return String(Q.$W);case"dd":return Te($.weekdaysMin,Q.$W,be,2);case"ddd":return Te($.weekdaysShort,Q.$W,be,3);case"dddd":return be[Q.$W];case"H":return String(H);case"HH":return L.s(H,2,"0");case"h":return _e(1);case"hh":return _e(2);case"a":return pe(H,J,!0);case"A":return pe(H,J,!1);case"m":return String(J);case"mm":return L.s(J,2,"0");case"s":return String(Q.$s);case"ss":return L.s(Q.$s,2,"0");case"SSS":return L.s(Q.$ms,3,"0");case"Z":return K}return null}(de)||K.replace(":","")})},P.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},P.diff=function(N,Q,$){var Y,K=this,H=L.p(Q),J=j(N),ie=(J.utcOffset()-this.utcOffset())*t,be=this-J,Oe=function(){return L.m(K,J)};switch(H){case v:Y=Oe()/12;break;case c:Y=Oe();break;case g:Y=Oe()/3;break;case u:Y=(be-ie)/6048e5;break;case a:Y=(be-ie)/864e5;break;case s:Y=be/r;break;case i:Y=be/t;break;case o:Y=be/e;break;default:Y=be}return $?Y:L.a(Y)},P.daysInMonth=function(){return this.endOf(c).$D},P.$locale=function(){return k[this.$L]},P.locale=function(N,Q){if(!N)return this.$L;var $=this.clone(),Y=V(N,Q,!0);return Y&&($.$L=Y),$},P.clone=function(){return L.w(this.$d,this)},P.toDate=function(){return new Date(this.valueOf())},P.toJSON=function(){return this.isValid()?this.toISOString():null},P.toISOString=function(){return this.$d.toISOString()},P.toString=function(){return this.$d.toUTCString()},O}(),M=U.prototype;return j.prototype=M,[["$ms",n],["$s",o],["$m",i],["$H",s],["$W",a],["$M",c],["$y",v],["$D",E]].forEach(function(O){M[O[1]]=function(P){return this.$g(P,O[0],O[1])}}),j.extend=function(O,P){return O.$i||(O(P,U,j),O.$i=!0),j},j.locale=V,j.isDayjs=F,j.unix=function(O){return j(1e3*O)},j.en=k[R],j.Ls=k,j.p={},j})});var Eh=We((fd,md)=>{"use strict";m();d();f();p();(function(e,t){typeof fd=="object"&&typeof md<"u"?md.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_quarterOfYear=t()})(fd,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(a){return this.$utils().u(a)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(a-1))};var i=o.add;o.add=function(a,u){return a=Number(a),this.$utils().p(u)===t?this.add(3*a,e):i.bind(this)(a,u)};var s=o.startOf;o.startOf=function(a,u){var c=this.$utils(),g=!!c.u(u)||u;if(c.p(a)===t){var v=this.quarter()-1;return g?this.month(3*v).startOf(e).startOf("day"):this.month(3*v+2).endOf(e).endOf("day")}return s.bind(this)(a,u)}}})});var Ih=We((gd,hd)=>{"use strict";m();d();f();p();(function(e,t){typeof gd=="object"&&typeof hd<"u"?hd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_customParseFormat=t()})(gd,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?/,i=/\d*[^-_:/,()\s\d]+/,s={},a=function(y){return(y=+y)+(y>68?1900:2e3)},u=function(y){return function(S){this[y]=+S}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(S){if(!S||S==="Z")return 0;var x=S.match(/([+-]|\d\d)/g),I=60*x[1]+(+x[2]||0);return I===0?0:x[0]==="+"?-I:I}(y)}],g=function(y){var S=s[y];return S&&(S.indexOf?S:S.s.concat(S.f))},v=function(y,S){var x,I=s.meridiem;if(I){for(var T=1;T<=24;T+=1)if(y.indexOf(I(T,0,S))>-1){x=T>12;break}}else x=y===(S?"pm":"PM");return x},E={A:[i,function(y){this.afternoon=v(y,!1)}],a:[i,function(y){this.afternoon=v(y,!0)}],Q:[r,function(y){this.month=3*(y-1)+1}],S:[r,function(y){this.milliseconds=100*+y}],SS:[n,function(y){this.milliseconds=10*+y}],SSS:[/\d{3}/,function(y){this.milliseconds=+y}],s:[o,u("seconds")],ss:[o,u("seconds")],m:[o,u("minutes")],mm:[o,u("minutes")],H:[o,u("hours")],h:[o,u("hours")],HH:[o,u("hours")],hh:[o,u("hours")],D:[o,u("day")],DD:[n,u("day")],Do:[i,function(y){var S=s.ordinal,x=y.match(/\d+/);if(this.day=x[0],S)for(var I=1;I<=31;I+=1)S(I).replace(/\[|\]/g,"")===y&&(this.day=I)}],w:[o,u("week")],ww:[n,u("week")],M:[o,u("month")],MM:[n,u("month")],MMM:[i,function(y){var S=g("months"),x=(g("monthsShort")||S.map(function(I){return I.slice(0,3)})).indexOf(y)+1;if(x<1)throw new Error;this.month=x%12||x}],MMMM:[i,function(y){var S=g("months").indexOf(y)+1;if(S<1)throw new Error;this.month=S%12||S}],Y:[/[+-]?\d+/,u("year")],YY:[n,function(y){this.year=a(y)}],YYYY:[/\d{4}/,u("year")],Z:c,ZZ:c};function h(y){var S,x;S=y,x=s&&s.formats;for(var I=(y=S.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(j,L,U){var M=U&&U.toUpperCase();return L||x[U]||e[U]||x[M].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(O,P,N){return P||N.slice(1)})})).match(t),T=I.length,R=0;R<T;R+=1){var k=I[R],_=E[k],F=_&&_[0],V=_&&_[1];I[R]=V?{regex:F,parser:V}:k.replace(/^\[|\]$/g,"")}return function(j){for(var L={},U=0,M=0;U<T;U+=1){var O=I[U];if(typeof O=="string")M+=O.length;else{var P=O.regex,N=O.parser,Q=j.slice(M),$=P.exec(Q)[0];N.call(L,$),j=j.replace($,"")}}return function(Y){var K=Y.afternoon;if(K!==void 0){var H=Y.hours;K?H<12&&(Y.hours+=12):H===12&&(Y.hours=0),delete Y.afternoon}}(L),L}}return function(y,S,x){x.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(a=y.parseTwoDigitYear);var I=S.prototype,T=I.parse;I.parse=function(R){var k=R.date,_=R.utc,F=R.args;this.$u=_;var V=F[1];if(typeof V=="string"){var j=F[2]===!0,L=F[3]===!0,U=j||L,M=F[2];L&&(M=F[2]),s=this.$locale(),!j&&M&&(s=x.Ls[M]),this.$d=function(Q,$,Y,K){try{if(["x","X"].indexOf($)>-1)return new Date(($==="X"?1e3:1)*Q);var H=h($)(Q),J=H.year,ie=H.month,be=H.day,Oe=H.hours,Ie=H.minutes,Te=H.seconds,_e=H.milliseconds,pe=H.zone,de=H.week,ge=new Date,fe=be||(J||ie?1:ge.getDate()),Ue=J||ge.getFullYear(),$e=0;J&&!ie||($e=ie>0?ie-1:ge.getMonth());var Tt,mt=Oe||0,jt=Ie||0,St=Te||0,_t=_e||0;return pe?new Date(Date.UTC(Ue,$e,fe,mt,jt,St,_t+60*pe.offset*1e3)):Y?new Date(Date.UTC(Ue,$e,fe,mt,jt,St,_t)):(Tt=new Date(Ue,$e,fe,mt,jt,St,_t),de&&(Tt=K(Tt).week(de).toDate()),Tt)}catch{return new Date("")}}(k,V,_,x),this.init(),M&&M!==!0&&(this.$L=this.locale(M).$L),U&&k!=this.format(V)&&(this.$d=new Date("")),s={}}else if(V instanceof Array)for(var O=V.length,P=1;P<=O;P+=1){F[1]=V[P-1];var N=x.apply(this,F);if(N.isValid()){this.$d=N.$d,this.$L=N.$L,this.init();break}P===O&&(this.$d=new Date(""))}else T.call(this,R)}}})});var vy=We((Od,Pd)=>{"use strict";m();d();f();p();(function(e,t){typeof Od=="object"&&typeof Pd<"u"?Pd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_timezone=t()})(Od,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,o){var i,s=function(g,v,E){E===void 0&&(E={});var h=new Date(g),y=function(S,x){x===void 0&&(x={});var I=x.timeZoneName||"short",T=S+"|"+I,R=t[T];return R||(R=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:S,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:I}),t[T]=R),R}(v,E);return y.formatToParts(h)},a=function(g,v){for(var E=s(g,v),h=[],y=0;y<E.length;y+=1){var S=E[y],x=S.type,I=S.value,T=e[x];T>=0&&(h[T]=parseInt(I,10))}var R=h[3],k=R===24?0:R,_=h[0]+"-"+h[1]+"-"+h[2]+" "+k+":"+h[4]+":"+h[5]+":000",F=+g;return(o.utc(_).valueOf()-(F-=F%1e3))/6e4},u=n.prototype;u.tz=function(g,v){g===void 0&&(g=i);var E,h=this.utcOffset(),y=this.toDate(),S=y.toLocaleString("en-US",{timeZone:g}),x=Math.round((y-new Date(S))/1e3/60),I=15*-Math.round(y.getTimezoneOffset()/15)-x;if(!Number(I))E=this.utcOffset(0,v);else if(E=o(S,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(I,!0),v){var T=E.utcOffset();E=E.add(h-T,"minute")}return E.$x.$timezone=g,E},u.offsetName=function(g){var v=this.$x.$timezone||o.tz.guess(),E=s(this.valueOf(),v,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return E&&E.value};var c=u.startOf;u.startOf=function(g,v){if(!this.$x||!this.$x.$timezone)return c.call(this,g,v);var E=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return c.call(E,g,v).tz(this.$x.$timezone,!0)},o.tz=function(g,v,E){var h=E&&v,y=E||v||i,S=a(+o(),y);if(typeof g!="string")return o(g).tz(y);var x=function(k,_,F){var V=k-60*_*1e3,j=a(V,F);if(_===j)return[V,_];var L=a(V-=60*(j-_)*1e3,F);return j===L?[V,j]:[k-60*Math.min(j,L)*1e3,Math.max(j,L)]}(o.utc(g,h).valueOf(),S,y),I=x[0],T=x[1],R=o(I).utcOffset(T);return R.$x.$timezone=y,R},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var Sy=We((Nd,Fd)=>{"use strict";m();d();f();p();(function(e,t){typeof Nd=="object"&&typeof Fd<"u"?Fd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_utc=t()})(Nd,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,i){var s=o.prototype;i.utc=function(h){var y={date:h,utc:!0,args:arguments};return new o(y)},s.utc=function(h){var y=i(this.toDate(),{locale:this.$L,utc:!0});return h?y.add(this.utcOffset(),e):y},s.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var a=s.parse;s.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),a.call(this,h)};var u=s.init;s.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 u.call(this)};var c=s.utcOffset;s.utcOffset=function(h,y){var S=this.$utils().u;if(S(h))return this.$u?0:S(this.$offset)?c.call(this):this.$offset;if(typeof h=="string"&&(h=function(R){R===void 0&&(R="");var k=R.match(t);if(!k)return null;var _=(""+k[0]).match(r)||["-",0,0],F=_[0],V=60*+_[1]+ +_[2];return V===0?0:F==="+"?V:-V}(h),h===null))return this;var x=Math.abs(h)<=16?60*h:h;if(x===0)return this.utc(y);var I=this.clone();if(y)return I.$offset=x,I.$u=!1,I;var T=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(I=this.local().add(x+T,e)).$offset=x,I.$x.$localOffset=T,I};var g=s.format;s.format=function(h){var y=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,y)},s.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},s.isUTC=function(){return!!this.$u},s.toISOString=function(){return this.toDate().toISOString()},s.toString=function(){return this.toDate().toUTCString()};var v=s.toDate;s.toDate=function(h){return h==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var E=s.diff;s.diff=function(h,y,S){if(h&&this.$u===h.$u)return E.call(this,h,y,S);var x=this.local(),I=i(h).local();return E.call(x,I,y,S)}}})});var iA=We((Sae,oA)=>{"use strict";m();d();f();p();function $0(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}oA.exports=Q0;function Q0(e,t,r){var n=r&&r.stringify||$0,o=1;if(typeof e=="object"&&e!==null){var i=t.length+o;if(i===1)return e;var s=new Array(i);s[0]=n(e);for(var a=1;a<i;a++)s[a]=n(t[a]);return s.join(" ")}if(typeof e!="string")return e;var u=t.length;if(u===0)return e;for(var c="",g=1-o,v=-1,E=e&&e.length||0,h=0;h<E;){if(e.charCodeAt(h)===37&&h+1<E){switch(v=v>-1?v:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=u||t[g]==null)break;v<h&&(c+=e.slice(v,h)),c+=Number(t[g]),v=h+2,h++;break;case 105:if(g>=u||t[g]==null)break;v<h&&(c+=e.slice(v,h)),c+=Math.floor(Number(t[g])),v=h+2,h++;break;case 79:case 111:case 106:if(g>=u||t[g]===void 0)break;v<h&&(c+=e.slice(v,h));var y=typeof t[g];if(y==="string"){c+="'"+t[g]+"'",v=h+2,h++;break}if(y==="function"){c+=t[g].name||"<anonymous>",v=h+2,h++;break}c+=n(t[g]),v=h+2,h++;break;case 115:if(g>=u)break;v<h&&(c+=e.slice(v,h)),c+=String(t[g]),v=h+2,h++;break;case 37:v<h&&(c+=e.slice(v,h)),c+="%",v=h+2,h++,g--;break}++g}++h}return v===-1?e:(v<E&&(c+=e.slice(v)),c)}});var pA=We((xae,du)=>{"use strict";m();d();f();p();var sA=iA();du.exports=mr;var $i=sO().console||{},H0={mapHttpRequest:lu,mapHttpResponse:lu,wrapRequestSerializer:kp,wrapResponseSerializer:kp,wrapErrorSerializer:kp,req:lu,res:lu,err:cA,errWithCause:cA};function Fr(e,t){return e==="silent"?1/0:t.levels.values[e]}var Np=Symbol("pino.logFuncs"),Op=Symbol("pino.hierarchy"),z0={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function aA(e,t){let r={logger:t,parent:e[Op]};t[Op]=r}function W0(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:$i[o]||$i[z0[o]||"log"]||Ro}),e[Np]=n}function K0(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function mr(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||$i;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=K0(e.browser.serialize,n),i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);let s=Object.keys(e.customLevels||{}),a=["error","fatal","warn","info","debug","trace"].concat(s);typeof r=="function"&&a.forEach(function(S){r[S]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let u=e.level||"info",c=Object.create(r);c.log||(c.log=Ro),W0(c,a,r),aA({},c),Object.defineProperty(c,"levelVal",{get:v}),Object.defineProperty(c,"level",{get:E,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:a,timestamp:nO(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Ro};c.levels=Y0(e),c.level=u,c.isLevelEnabled=function(S){return this.levels.values[S]?this.levels.values[S]>=this.levels.values[this.level]:!1},c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=Ro,c.serializers=n,c._serialize=o,c._stdErrSerialize=i,c.child=function(...S){return y.call(this,g,...S)},t&&(c._logEvent=Pp());function v(){return Fr(this.level,this)}function E(){return this._level}function h(S){if(S!=="silent"&&!this.levels.values[S])throw Error("unknown level "+S);this._level=S,In(this,g,c,"error"),In(this,g,c,"fatal"),In(this,g,c,"warn"),In(this,g,c,"info"),In(this,g,c,"debug"),In(this,g,c,"trace"),s.forEach(x=>{In(this,g,c,x)})}function y(S,x,I){if(!x)throw new Error("missing bindings for child Pino");I=I||{},o&&x.serializers&&(I.serializers=x.serializers);let T=I.serializers;if(o&&T){var R=Object.assign({},n,T),k=e.browser.serialize===!0?Object.keys(R):o;delete x.serializers,Fp([x],k,R,this._stdErrSerialize)}function _(V){this._childLevel=(V._childLevel|0)+1,this.bindings=x,R&&(this.serializers=R,this._serialize=k),t&&(this._logEvent=Pp([].concat(V._logEvent.bindings,x)))}_.prototype=this;let F=new _(this);return aA(this,F),F.child=function(...V){return y.call(this,S,...V)},F.level=I.level||this.level,S.onChild(F),F}return c}function Y0(e){let t=e.customLevels||{},r=Object.assign({},mr.levels.values,t),n=Object.assign({},mr.levels.labels,X0(t));return{values:r,labels:n}}function X0(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}mr.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"}};mr.stdSerializers=H0;mr.stdTimeFunctions=Object.assign({},{nullTime:lA,epochTime:dA,unixTime:oO,isoTime:iO});function Z0(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[Op];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function In(e,t,r,n){if(Object.defineProperty(e,n,{value:Fr(e.level,r)>Fr(n,r)?Ro:r[Np][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===Ro){if(!t.transmit)return;let i=t.transmit.level||e.level,s=Fr(i,r);if(Fr(n,r)<s)return}e[n]=eO(e,t,r,n);let o=Z0(e);o.length!==0&&(e[n]=J0(o,e[n]))}function J0(e,t){return function(){return t.apply(this,[...e,...arguments])}}function eO(e,t,r,n){return function(o){return function(){let s=t.timestamp(),a=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===$i?$i:this;for(var c=0;c<a.length;c++)a[c]=arguments[c];var g=!1;if(t.serialize&&(Fp(a,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let v=tO(this,n,a,s,t);if(t.reportCaller&&v&&v.length>0&&v[0]&&typeof v[0]=="object")try{let E=uA();E&&(v[0].caller=E)}catch{}o.call(u,...v)}else{if(t.reportCaller)try{let v=uA();v&&a.push(v)}catch{}o.apply(u,a)}if(t.transmit){let v=t.transmit.level||e._level,E=Fr(v,r),h=Fr(n,r);if(h<E)return;rO(this,{ts:s,methodLevel:n,methodValue:h,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Fr(e._level,r)},a,g)}}}(e[Np][n])}function tO(e,t,r,n,o){let{level:i,log:s=v=>v}=o.formatters||{},a=r.slice(),u=a[0],c={},g=(e._childLevel|0)+1;if(g<1&&(g=1),n&&(c.time=n),i){let v=i(t,e.levels.values[t]);Object.assign(c,v)}else c.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(u!==null&&typeof u=="object")for(;g--&&typeof a[0]=="object";)Object.assign(c,a.shift());return[s(c),...a]}else{if(u!==null&&typeof u=="object"){for(;g--&&typeof a[0]=="object";)Object.assign(c,a.shift());u=a.length?sA(a.shift(),a):void 0}else typeof u=="string"&&(u=sA(a.shift(),a));return u!==void 0&&(c[o.messageKey]=u),[s(c)]}}function Fp(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=mr.stdSerializers.err(e[o]);else if(typeof e[o]=="object"&&!Array.isArray(e[o])&&t)for(let i in e[o])t.indexOf(i)>-1&&i in r&&(e[o][i]=r[i](e[o][i]))}function rO(e,t,r,n=!1){let o=t.send,i=t.ts,s=t.methodLevel,a=t.methodValue,u=t.val,c=e._logEvent.bindings;n||Fp(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter(function(g){return c.indexOf(g)===-1}),e._logEvent.level.label=s,e._logEvent.level.value=a,o(s,e._logEvent,u),e._logEvent=Pp(c)}function Pp(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function cA(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 nO(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?lA:dA}function lu(){return{}}function kp(e){return e}function Ro(){}function lA(){return!1}function dA(){return Date.now()}function oO(){return Math.round(Date.now()/1e3)}function iO(){return new Date(Date.now()).toISOString()}function sO(){function e(t){return typeof t<"u"&&t}try{return typeof A<"u"?A:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),A)}catch{return e(self)||e(window)||e(this)||{}}}du.exports.default=mr;du.exports.pino=mr;function uA(){let e=new Error().stack;if(!e)return null;let t=e.split(`
20
- `);for(let r=1;r<t.length;r++){let n=t[r].trim();if(/(^at\s+)?(createWrap|LOG|set\s*\(|asObject|Object\.apply|Function\.apply)/.test(n)||n.indexOf("browser.js")!==-1||n.indexOf("node:internal")!==-1||n.indexOf("node_modules")!==-1)continue;let o=n.match(/\((.*?):(\d+):(\d+)\)/);if(o||(o=n.match(/at\s+(.*?):(\d+):(\d+)/)),o){let i=o[1],s=o[2],a=o[3];return i+":"+s+":"+a}}return null}});var OO={};zi(OO,{ResultTemplatesHelpers:()=>Uh,buildCaseAssistEngine:()=>vA,buildCaseField:()=>NA,buildCaseInput:()=>FA,buildController:()=>er,buildDocumentSuggestion:()=>Mp,buildDocumentSuggestionList:()=>Mp,buildInteractiveResult:()=>MA,buildQuickview:()=>UA,getAnalyticsNextApiBaseUrl:()=>es,getOrganizationEndpoint:()=>rt,loadCaseAssistAnalyticsActions:()=>RO,loadCaseFieldActions:()=>TO,loadCaseInputActions:()=>_O,loadDocumentSuggestionActions:()=>kO,loadGenericAnalyticsActions:()=>IO});module.exports=ZA(OO);m();d();f();p();m();d();f();p();var Sf=kt(df(),1);m();d();f();p();var At=new Error("Failed to load reducers."),Pn=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."}},jr=class extends Error{constructor(r,n){super();oe(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};m();d();f();p();function pf(e){return Array.isArray(e)}function ff(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}var Qb=new Set(["1",1,"yes",!0]);function mf(){if(typeof navigator>"u"||typeof window>"u")return!1;let e=navigator,t=window;return[e.globalPrivacyControl,e.doNotTrack,e.msDoNotTrack,t.doNotTrack].some(r=>Qb.has(r))}function gf(e){let t={};for(let[r,n]of e)t[r]=n;return t}function jo(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Ji(e,t,r={}){let n;return(...o)=>{let i=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,o)},t),i)return e.apply(void 0,o)}}m();d();f();p();function hf(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function yf(e){return typeof e!="object"||!e?!1:Object.values(e).every(Hb)}function Hb(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function vf(e){return e===429}var hr=class e{static call(t){return _asyncToGenerator(function*(){let r=zb(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:i,...s}=o,a=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let u=yield w(i,s);if(vf(u.status))throw u;return u});return function a(){return _ref.apply(this,arguments)}}();try{let u=yield(0,Sf.backOff)(a,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(c){let g=c&&vf(c.status);return g&&(n.info("Platform retrying request"),yield new Promise(v=>setTimeout(v,1e3))),g});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(u.status){case 419:case 401:throw n.info("Platform renewing token"),new Pn;case 404:throw new jr(i,u.status);default:return n.info({response:u,requestInfo:o},"Platform response"),u}}catch(u){return u.message==="Failed to fetch"?new jr(i):u}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:s}=r,{signal:a,...u}=t,c=jo(u);try{let g=yield o(t,n,s);return{...t,...g}}catch(g){i.error(g,"Platform request preprocessing failed. Returning default request options.")}return c})()}};function rt(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Nn(e,t,r="prod"){return e??rt(t,r)}function Fn(e,t="prod"){return`${rt(e,t)}/rest/search/v2`}function es(e,t="prod"){return`${rt(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function zb(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:s}=e,a=e.method==="POST"||e.method==="PUT",u=Wb(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(a&&{body:u}),signal:s}}function Wb(e,t){return t==="application/x-www-form-urlencoded"?yf(e)?hf(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();function Kb(e,t){let r=`
17
+ */(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessCaseAssist",["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["CoveoHeadlessCaseAssist"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var YA=Object.create;var Po=Object.defineProperty;var XA=Object.getOwnPropertyDescriptor;var ZA=Object.getOwnPropertyNames;var JA=Object.getPrototypeOf,eb=Object.prototype.hasOwnProperty;var tb=(e,t,r)=>t in e?Po(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Tn=(e,t)=>()=>(e&&(t=e(e=0)),t);var We=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),zi=(e,t)=>{for(var r in t)Po(e,r,{get:t[r],enumerable:!0})},Bp=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ZA(t))!eb.call(e,o)&&o!==r&&Po(e,o,{get:()=>t[o],enumerable:!(n=XA(t,o))||n.enumerable});return e};var kt=(e,t,r)=>(r=e!=null?YA(JA(e)):{},Bp(t||!e||!e.__esModule?Po(r,"default",{value:e,enumerable:!0}):r,e)),rb=e=>Bp(Po({},"__esModule",{value:!0}),e);var oe=(e,t,r)=>tb(e,typeof t!="symbol"?t+"":t,r);var b,d=Tn(()=>{"use strict";b=typeof globalThis<"u"?globalThis:window});function Wi(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Wi=function(t){return typeof t}:Wi=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wi(e)}function ib(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=sb.bind(this))}function sb(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","*/*"),nb(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):ob(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var nb,ob,p=Tn(()=>{"use strict";nb=function(t){return typeof t=="string"},ob=function(t){return t instanceof Blob};ib.call((typeof window>"u"?"undefined":Wi(window))==="object"?window:{})});var Eu=We(No=>{"use strict";m();d();f();p();Object.defineProperty(No,"__esModule",{value:!0});function $p(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 ab(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cb(e,t,r){return t=_n(t),lb(e,Wp()?Reflect.construct(t,r||[],_n(e).constructor):t.apply(e,r))}function wu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qp(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,mb(n.key),n)}}function Cu(e,t,r){return t&&Qp(e.prototype,t),r&&Qp(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Hp(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=gb(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(u){throw u},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
18
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return s=u.done,u},e:function(u){a=!0,i=u},f:function(){try{s||r.return==null||r.return()}finally{if(a)throw i}}}}function Au(){return Au=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=db(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Au.apply(null,arguments)}function _n(e){return _n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_n(e)}function ub(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&&bu(e,t)}function Wp(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Wp=function(){return!!e})()}function lb(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 ab(e)}function bu(e,t){return bu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},bu(e,t)}function db(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=_n(e))!==null;);return e}function pb(e,t,r,n){var o=Au(_n(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function fb(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 mb(e){var t=fb(e,"string");return typeof t=="symbol"?t:t+""}function gb(e,t){if(e){if(typeof e=="string")return $p(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)?$p(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function hb(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 yb(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 zp=function(){function e(){wu(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Cu(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],i=0,s=o.length;i<s;i++)if(o[i].callback===n){o.splice(i,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var o=this.listeners[r.type],i=o.slice(),s=function(){var g=i[a];try{g.callback.call(n,r)}catch(v){Promise.resolve().then(function(){throw v})}g.options&&g.options.once&&n.removeEventListener(r.type,g.callback)},a=0,u=i.length;a<u;a++)s();return!r.defaultPrevented}}}])}(),xu=function(e){function t(){var r;return wu(this,t),r=cb(this,t),r.listeners||zp.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 ub(t,e),Cu(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)),pb(t,"dispatchEvent",this,3)([n])}},{key:"throwIfAborted",value:function(){var n=this.aborted,o=this.reason,i=o===void 0?"Aborted":o;if(n)throw i}}],[{key:"timeout",value:function(n){var o=new Ki;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 Ki;function i(){o.abort(this.reason),s()}function s(){var g=Hp(n),v;try{for(g.s();!(v=g.n()).done;){var E=v.value;E.removeEventListener("abort",i)}}catch(h){g.e(h)}finally{g.f()}}var a=Hp(n),u;try{for(a.s();!(u=a.n()).done;){var c=u.value;if(c.aborted){o.abort(c.reason);break}else c.addEventListener("abort",i)}}catch(g){a.e(g)}finally{a.f()}return o.signal}}])}(zp),Ki=function(){function e(){wu(this,e),Object.defineProperty(this,"signal",{value:new xu,writable:!0,configurable:!0})}return Cu(e,[{key:"abort",value:function(r){var n=yb(r),o=hb(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Ki.prototype[Symbol.toStringTag]="AbortController",xu.prototype[Symbol.toStringTag]="AbortSignal");function vb(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 Sb(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,o=n===void 0?r.Request:n,i=t.AbortController,s=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,a=s===void 0?!1:s;if(!vb({fetch:r,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a}))return{fetch:r,Request:u};var u=o;(u&&!u.prototype.hasOwnProperty("signal")||a)&&(u=function(E,h){var y;h&&h.signal&&(y=h.signal,delete h.signal);var S=new o(E,h);return y&&Object.defineProperty(S,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),S},u.prototype=o.prototype);var c=r,g=function(E,h){var y=u&&u.prototype.isPrototypeOf(E)?E.signal:h?h.signal:void 0;if(y){var S;try{S=new DOMException("Aborted","AbortError")}catch{S=new Error("Aborted"),S.name="AbortError"}if(y.aborted)return Promise.reject(S);var x=new Promise(function(I,T){y.addEventListener("abort",function(){return T(S)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([x,c(E,h)])}return c(E,h)};return{fetch:g,Request:u}}No.AbortController=Ki;No.AbortSignal=xu;No.abortableFetch=Sb});var Kp,l,w,f=Tn(()=>{"use strict";Kp=kt(Eu(),1),l=kt(Eu(),1),{fetch:w}=(0,Kp.abortableFetch)({fetch})});function Iu(e){return typeof e!="string"||e in{}}function Ru(){return Object.create(null)}function Yp(e){return typeof e=="string"&&!!e.trim()}function Tu(e,t){var r=e.split(";").filter(Yp),n=r.shift(),o=Ab(n),i=o.name,s=o.value;if(t=t?Object.assign({},Yi,t):Yi,Iu(i))return null;try{s=t.decodeValues?decodeURIComponent(s):s}catch(u){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",u)}var a=Ru();return a.name=i,a.value=s,r.forEach(function(u){var c=u.split("="),g=c.shift().trimLeft().toLowerCase();if(!Iu(g)){var v=c.join("=");if(g==="expires")a.expires=new Date(v);else if(g==="max-age"){var E=parseInt(v,10);Number.isNaN(E)||(a.maxAge=E)}else g==="secure"?a.secure=!0:g==="httponly"?a.httpOnly=!0:g==="samesite"?a.sameSite=v:g==="partitioned"?a.partitioned=!0:g&&(a[g]=v)}}),a}function Ab(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function kn(e,t){if(t=t?Object.assign({},Yi,t):Yi,!e)return t.map?Ru():[];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(s){return s.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(Yp),n&&(e=e.map(Xi).flat()),t.map){var i=Ru();return e.reduce(function(s,a){var u=Tu(a,t);return u&&!Iu(u.name)&&(s[u.name]=u),s},i)}else return e.map(function(s){return Tu(s,t)}).filter(Boolean)}function Xi(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,i,s,a;function u(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function c(){return o=e.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<e.length;){for(n=r,a=!1;u();)if(o=e.charAt(r),o===","){for(i=r,r+=1,u(),s=r;r<e.length&&c();)r+=1;r<e.length&&e.charAt(r)==="="?(a=!0,r=s,t.push(e.substring(n,i)),n=r):r=i+1}else r+=1;(!a||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var Yi,Xp=Tn(()=>{"use strict";m();d();f();p();Yi={decodeValues:!0,map:!1,silent:!1,split:"auto"};kn.parseSetCookie=kn;kn.parse=kn;kn.parseString=Tu;kn.splitCookiesString=Xi});function Fo(e){if(bb.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function _u(e){return e.replace(wb,"")}function Do(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||!Cb(r))return!1}return!0}function Cb(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function Jp(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 bb,Zp,wb,ef,On,ku,tf,C,nf=Tn(()=>{"use strict";m();d();f();p();Xp();bb=/[^a-z0-9\-#$%&'*+.^_`|~]/i;Zp=[`
19
+ `,"\r","\t"," "],wb=new RegExp(`(^[${Zp.join("")}]|$[${Zp.join("")}])`,"g");On=Symbol("normalizedHeaders"),ku=Symbol("rawHeaderNames"),tf=", ",C=class rf{constructor(t){this[On]={},this[ku]=new Map,this[ef]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof rf||typeof b.Headers<"u"&&t instanceof b.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(tf):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(tf):n)})}[(ef=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[On]).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(!Do(t))throw new TypeError(`Invalid header name "${t}"`);return this[On].hasOwnProperty(Fo(t))}get(t){if(!Do(t))throw TypeError(`Invalid header name "${t}"`);return this[On][Fo(t)]??null}set(t,r){if(!Do(t)||!Jp(r))return;let n=Fo(t),o=_u(r);this[On][n]=_u(o),this[ku].set(n,t)}append(t,r){if(!Do(t)||!Jp(r))return;let n=Fo(t),o=_u(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!Do(t)||!this.has(t))return;let r=Fo(t);delete this[On][r],this[ku].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===""?[""]:Xi(t)}}});var m=Tn(()=>{"use strict";nf()});var of=We(Mo=>{"use strict";m();d();f();p();var Zi=Mo&&Mo.__assign||function(){return Zi=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},Zi.apply(this,arguments)};Object.defineProperty(Mo,"__esModule",{value:!0});var xb={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function Eb(e){var t=Zi(Zi({},xb),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Mo.getSanitizedOptions=Eb});var sf=We(Ou=>{"use strict";m();d();f();p();Object.defineProperty(Ou,"__esModule",{value:!0});function Ib(e){var t=Math.random()*e;return Math.round(t)}Ou.fullJitter=Ib});var af=We(Pu=>{"use strict";m();d();f();p();Object.defineProperty(Pu,"__esModule",{value:!0});function Rb(e){return e}Pu.noJitter=Rb});var cf=We(Nu=>{"use strict";m();d();f();p();Object.defineProperty(Nu,"__esModule",{value:!0});var Tb=sf(),_b=af();function kb(e){return e.jitter==="full"?Tb.fullJitter:_b.noJitter}Nu.JitterFactory=kb});var Du=We(Fu=>{"use strict";m();d();f();p();Object.defineProperty(Fu,"__esModule",{value:!0});var Ob=cf(),Pb=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=Ob.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}();Fu.Delay=Pb});var uf=We(tr=>{"use strict";m();d();f();p();var Nb=tr&&tr.__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 i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},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)}}(),Fb=tr&&tr.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(g){try{c(n.next(g))}catch(v){s(v)}}function u(g){try{c(n.throw(g))}catch(v){s(v)}}function c(g){g.done?i(g.value):o(g.value).then(a,u)}c((n=n.apply(e,t||[])).next())})},Db=tr&&tr.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(tr,"__esModule",{value:!0});var Mb=Du(),Lb=function(e){Nb(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return Fb(this,void 0,void 0,function(){return Db(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}(Mb.Delay);tr.SkipFirstDelay=Lb});var lf=We(Lo=>{"use strict";m();d();f();p();var jb=Lo&&Lo.__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 i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},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(Lo,"__esModule",{value:!0});var qb=Du(),Ub=function(e){jb(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(qb.Delay);Lo.AlwaysDelay=Ub});var df=We(Mu=>{"use strict";m();d();f();p();Object.defineProperty(Mu,"__esModule",{value:!0});var Vb=uf(),Gb=lf();function Bb(e,t){var r=$b(e);return r.setAttemptNumber(t),r}Mu.DelayFactory=Bb;function $b(e){return e.delayFirstAttempt?new Gb.AlwaysDelay(e):new Vb.SkipFirstDelay(e)}});var pf=We(Lr=>{"use strict";m();d();f();p();var Lu=Lr&&Lr.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(g){try{c(n.next(g))}catch(v){s(v)}}function u(g){try{c(n.throw(g))}catch(v){s(v)}}function c(g){g.done?i(g.value):o(g.value).then(a,u)}c((n=n.apply(e,t||[])).next())})},ju=Lr&&Lr.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(Lr,"__esModule",{value:!0});var Qb=of(),Hb=df();function zb(e,t){return t===void 0&&(t={}),Lu(this,void 0,void 0,function(){var r,n;return ju(this,function(o){switch(o.label){case 0:return r=Qb.getSanitizedOptions(t),n=new Wb(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}Lr.backOff=zb;var Wb=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return Lu(this,void 0,void 0,function(){var t,r;return ju(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 Lu(this,void 0,void 0,function(){var t;return ju(this,function(r){switch(r.label){case 0:return t=Hb.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var va=We((pd,fd)=>{"use strict";m();d();f();p();(function(e,t){typeof pd=="object"&&typeof fd<"u"?fd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs=t()})(pd,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",s="hour",a="day",u="week",c="month",g="quarter",v="year",E="date",h="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,S=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,x={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(O){var P=["th","st","nd","rd"],N=O%100;return"["+O+(P[(N-20)%10]||P[N]||P[0])+"]"}},I=function(O,P,N){var Q=String(O);return!Q||Q.length>=P?O:""+Array(P+1-Q.length).join(N)+O},T={s:I,z:function(O){var P=-O.utcOffset(),N=Math.abs(P),Q=Math.floor(N/60),$=N%60;return(P<=0?"+":"-")+I(Q,2,"0")+":"+I($,2,"0")},m:function O(P,N){if(P.date()<N.date())return-O(N,P);var Q=12*(N.year()-P.year())+(N.month()-P.month()),$=P.clone().add(Q,c),Y=N-$<0,K=P.clone().add(Q+(Y?-1:1),c);return+(-(Q+(N-$)/(Y?$-K:K-$))||0)},a:function(O){return O<0?Math.ceil(O)||0:Math.floor(O)},p:function(O){return{M:c,y:v,w:u,d:a,D:E,h:s,m:i,s:o,ms:n,Q:g}[O]||String(O||"").toLowerCase().replace(/s$/,"")},u:function(O){return O===void 0}},R="en",k={};k[R]=x;var _="$isDayjsObject",F=function(O){return O instanceof U||!(!O||!O[_])},V=function O(P,N,Q){var $;if(!P)return R;if(typeof P=="string"){var Y=P.toLowerCase();k[Y]&&($=Y),N&&(k[Y]=N,$=Y);var K=P.split("-");if(!$&&K.length>1)return O(K[0])}else{var H=P.name;k[H]=P,$=H}return!Q&&$&&(R=$),$||!Q&&R},j=function(O,P){if(F(O))return O.clone();var N=typeof P=="object"?P:{};return N.date=O,N.args=arguments,new U(N)},L=T;L.l=V,L.i=F,L.w=function(O,P){return j(O,{locale:P.$L,utc:P.$u,x:P.$x,$offset:P.$offset})};var U=function(){function O(N){this.$L=V(N.locale,null,!0),this.parse(N),this.$x=this.$x||N.x||{},this[_]=!0}var P=O.prototype;return P.parse=function(N){this.$d=function(Q){var $=Q.date,Y=Q.utc;if($===null)return new Date(NaN);if(L.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var K=$.match(y);if(K){var H=K[2]-1||0,J=(K[7]||"0").substring(0,3);return Y?new Date(Date.UTC(K[1],H,K[3]||1,K[4]||0,K[5]||0,K[6]||0,J)):new Date(K[1],H,K[3]||1,K[4]||0,K[5]||0,K[6]||0,J)}}return new Date($)}(N),this.init()},P.init=function(){var N=this.$d;this.$y=N.getFullYear(),this.$M=N.getMonth(),this.$D=N.getDate(),this.$W=N.getDay(),this.$H=N.getHours(),this.$m=N.getMinutes(),this.$s=N.getSeconds(),this.$ms=N.getMilliseconds()},P.$utils=function(){return L},P.isValid=function(){return this.$d.toString()!==h},P.isSame=function(N,Q){var $=j(N);return this.startOf(Q)<=$&&$<=this.endOf(Q)},P.isAfter=function(N,Q){return j(N)<this.startOf(Q)},P.isBefore=function(N,Q){return this.endOf(Q)<j(N)},P.$g=function(N,Q,$){return L.u(N)?this[Q]:this.set($,N)},P.unix=function(){return Math.floor(this.valueOf()/1e3)},P.valueOf=function(){return this.$d.getTime()},P.startOf=function(N,Q){var $=this,Y=!!L.u(Q)||Q,K=L.p(N),H=function(pe,de){var he=L.w($.$u?Date.UTC($.$y,de,pe):new Date($.$y,de,pe),$);return Y?he:he.endOf(a)},J=function(pe,de){return L.w($.toDate()[pe].apply($.toDate("s"),(Y?[0,0,0,0]:[23,59,59,999]).slice(de)),$)},se=this.$W,be=this.$M,Oe=this.$D,Ie="set"+(this.$u?"UTC":"");switch(K){case v:return Y?H(1,0):H(31,11);case c:return Y?H(1,be):H(0,be+1);case u:var Te=this.$locale().weekStart||0,_e=(se<Te?se+7:se)-Te;return H(Y?Oe-_e:Oe+(6-_e),be);case a:case E:return J(Ie+"Hours",0);case s:return J(Ie+"Minutes",1);case i:return J(Ie+"Seconds",2);case o:return J(Ie+"Milliseconds",3);default:return this.clone()}},P.endOf=function(N){return this.startOf(N,!1)},P.$set=function(N,Q){var $,Y=L.p(N),K="set"+(this.$u?"UTC":""),H=($={},$[a]=K+"Date",$[E]=K+"Date",$[c]=K+"Month",$[v]=K+"FullYear",$[s]=K+"Hours",$[i]=K+"Minutes",$[o]=K+"Seconds",$[n]=K+"Milliseconds",$)[Y],J=Y===a?this.$D+(Q-this.$W):Q;if(Y===c||Y===v){var se=this.clone().set(E,1);se.$d[H](J),se.init(),this.$d=se.set(E,Math.min(this.$D,se.daysInMonth())).$d}else H&&this.$d[H](J);return this.init(),this},P.set=function(N,Q){return this.clone().$set(N,Q)},P.get=function(N){return this[L.p(N)]()},P.add=function(N,Q){var $,Y=this;N=Number(N);var K=L.p(Q),H=function(be){var Oe=j(Y);return L.w(Oe.date(Oe.date()+Math.round(be*N)),Y)};if(K===c)return this.set(c,this.$M+N);if(K===v)return this.set(v,this.$y+N);if(K===a)return H(1);if(K===u)return H(7);var J=($={},$[i]=t,$[s]=r,$[o]=e,$)[K]||1,se=this.$d.getTime()+N*J;return L.w(se,this)},P.subtract=function(N,Q){return this.add(-1*N,Q)},P.format=function(N){var Q=this,$=this.$locale();if(!this.isValid())return $.invalidDate||h;var Y=N||"YYYY-MM-DDTHH:mm:ssZ",K=L.z(this),H=this.$H,J=this.$m,se=this.$M,be=$.weekdays,Oe=$.months,Ie=$.meridiem,Te=function(de,he,fe,Ue){return de&&(de[he]||de(Q,Y))||fe[he].slice(0,Ue)},_e=function(de){return L.s(H%12||12,de,"0")},pe=Ie||function(de,he,fe){var Ue=de<12?"AM":"PM";return fe?Ue.toLowerCase():Ue};return Y.replace(S,function(de,he){return he||function(fe){switch(fe){case"YY":return String(Q.$y).slice(-2);case"YYYY":return L.s(Q.$y,4,"0");case"M":return se+1;case"MM":return L.s(se+1,2,"0");case"MMM":return Te($.monthsShort,se,Oe,3);case"MMMM":return Te(Oe,se);case"D":return Q.$D;case"DD":return L.s(Q.$D,2,"0");case"d":return String(Q.$W);case"dd":return Te($.weekdaysMin,Q.$W,be,2);case"ddd":return Te($.weekdaysShort,Q.$W,be,3);case"dddd":return be[Q.$W];case"H":return String(H);case"HH":return L.s(H,2,"0");case"h":return _e(1);case"hh":return _e(2);case"a":return pe(H,J,!0);case"A":return pe(H,J,!1);case"m":return String(J);case"mm":return L.s(J,2,"0");case"s":return String(Q.$s);case"ss":return L.s(Q.$s,2,"0");case"SSS":return L.s(Q.$ms,3,"0");case"Z":return K}return null}(de)||K.replace(":","")})},P.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},P.diff=function(N,Q,$){var Y,K=this,H=L.p(Q),J=j(N),se=(J.utcOffset()-this.utcOffset())*t,be=this-J,Oe=function(){return L.m(K,J)};switch(H){case v:Y=Oe()/12;break;case c:Y=Oe();break;case g:Y=Oe()/3;break;case u:Y=(be-se)/6048e5;break;case a:Y=(be-se)/864e5;break;case s:Y=be/r;break;case i:Y=be/t;break;case o:Y=be/e;break;default:Y=be}return $?Y:L.a(Y)},P.daysInMonth=function(){return this.endOf(c).$D},P.$locale=function(){return k[this.$L]},P.locale=function(N,Q){if(!N)return this.$L;var $=this.clone(),Y=V(N,Q,!0);return Y&&($.$L=Y),$},P.clone=function(){return L.w(this.$d,this)},P.toDate=function(){return new Date(this.valueOf())},P.toJSON=function(){return this.isValid()?this.toISOString():null},P.toISOString=function(){return this.$d.toISOString()},P.toString=function(){return this.$d.toUTCString()},O}(),M=U.prototype;return j.prototype=M,[["$ms",n],["$s",o],["$m",i],["$H",s],["$W",a],["$M",c],["$y",v],["$D",E]].forEach(function(O){M[O[1]]=function(P){return this.$g(P,O[0],O[1])}}),j.extend=function(O,P){return O.$i||(O(P,U,j),O.$i=!0),j},j.locale=V,j.isDayjs=F,j.unix=function(O){return j(1e3*O)},j.en=k[R],j.Ls=k,j.p={},j})});var Ih=We((md,gd)=>{"use strict";m();d();f();p();(function(e,t){typeof md=="object"&&typeof gd<"u"?gd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_quarterOfYear=t()})(md,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(a){return this.$utils().u(a)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(a-1))};var i=o.add;o.add=function(a,u){return a=Number(a),this.$utils().p(u)===t?this.add(3*a,e):i.bind(this)(a,u)};var s=o.startOf;o.startOf=function(a,u){var c=this.$utils(),g=!!c.u(u)||u;if(c.p(a)===t){var v=this.quarter()-1;return g?this.month(3*v).startOf(e).startOf("day"):this.month(3*v+2).endOf(e).endOf("day")}return s.bind(this)(a,u)}}})});var Rh=We((hd,yd)=>{"use strict";m();d();f();p();(function(e,t){typeof hd=="object"&&typeof yd<"u"?yd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_customParseFormat=t()})(hd,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?/,i=/\d*[^-_:/,()\s\d]+/,s={},a=function(y){return(y=+y)+(y>68?1900:2e3)},u=function(y){return function(S){this[y]=+S}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(S){if(!S||S==="Z")return 0;var x=S.match(/([+-]|\d\d)/g),I=60*x[1]+(+x[2]||0);return I===0?0:x[0]==="+"?-I:I}(y)}],g=function(y){var S=s[y];return S&&(S.indexOf?S:S.s.concat(S.f))},v=function(y,S){var x,I=s.meridiem;if(I){for(var T=1;T<=24;T+=1)if(y.indexOf(I(T,0,S))>-1){x=T>12;break}}else x=y===(S?"pm":"PM");return x},E={A:[i,function(y){this.afternoon=v(y,!1)}],a:[i,function(y){this.afternoon=v(y,!0)}],Q:[r,function(y){this.month=3*(y-1)+1}],S:[r,function(y){this.milliseconds=100*+y}],SS:[n,function(y){this.milliseconds=10*+y}],SSS:[/\d{3}/,function(y){this.milliseconds=+y}],s:[o,u("seconds")],ss:[o,u("seconds")],m:[o,u("minutes")],mm:[o,u("minutes")],H:[o,u("hours")],h:[o,u("hours")],HH:[o,u("hours")],hh:[o,u("hours")],D:[o,u("day")],DD:[n,u("day")],Do:[i,function(y){var S=s.ordinal,x=y.match(/\d+/);if(this.day=x[0],S)for(var I=1;I<=31;I+=1)S(I).replace(/\[|\]/g,"")===y&&(this.day=I)}],w:[o,u("week")],ww:[n,u("week")],M:[o,u("month")],MM:[n,u("month")],MMM:[i,function(y){var S=g("months"),x=(g("monthsShort")||S.map(function(I){return I.slice(0,3)})).indexOf(y)+1;if(x<1)throw new Error;this.month=x%12||x}],MMMM:[i,function(y){var S=g("months").indexOf(y)+1;if(S<1)throw new Error;this.month=S%12||S}],Y:[/[+-]?\d+/,u("year")],YY:[n,function(y){this.year=a(y)}],YYYY:[/\d{4}/,u("year")],Z:c,ZZ:c};function h(y){var S,x;S=y,x=s&&s.formats;for(var I=(y=S.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(j,L,U){var M=U&&U.toUpperCase();return L||x[U]||e[U]||x[M].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(O,P,N){return P||N.slice(1)})})).match(t),T=I.length,R=0;R<T;R+=1){var k=I[R],_=E[k],F=_&&_[0],V=_&&_[1];I[R]=V?{regex:F,parser:V}:k.replace(/^\[|\]$/g,"")}return function(j){for(var L={},U=0,M=0;U<T;U+=1){var O=I[U];if(typeof O=="string")M+=O.length;else{var P=O.regex,N=O.parser,Q=j.slice(M),$=P.exec(Q)[0];N.call(L,$),j=j.replace($,"")}}return function(Y){var K=Y.afternoon;if(K!==void 0){var H=Y.hours;K?H<12&&(Y.hours+=12):H===12&&(Y.hours=0),delete Y.afternoon}}(L),L}}return function(y,S,x){x.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(a=y.parseTwoDigitYear);var I=S.prototype,T=I.parse;I.parse=function(R){var k=R.date,_=R.utc,F=R.args;this.$u=_;var V=F[1];if(typeof V=="string"){var j=F[2]===!0,L=F[3]===!0,U=j||L,M=F[2];L&&(M=F[2]),s=this.$locale(),!j&&M&&(s=x.Ls[M]),this.$d=function(Q,$,Y,K){try{if(["x","X"].indexOf($)>-1)return new Date(($==="X"?1e3:1)*Q);var H=h($)(Q),J=H.year,se=H.month,be=H.day,Oe=H.hours,Ie=H.minutes,Te=H.seconds,_e=H.milliseconds,pe=H.zone,de=H.week,he=new Date,fe=be||(J||se?1:he.getDate()),Ue=J||he.getFullYear(),$e=0;J&&!se||($e=se>0?se-1:he.getMonth());var Tt,mt=Oe||0,jt=Ie||0,St=Te||0,_t=_e||0;return pe?new Date(Date.UTC(Ue,$e,fe,mt,jt,St,_t+60*pe.offset*1e3)):Y?new Date(Date.UTC(Ue,$e,fe,mt,jt,St,_t)):(Tt=new Date(Ue,$e,fe,mt,jt,St,_t),de&&(Tt=K(Tt).week(de).toDate()),Tt)}catch{return new Date("")}}(k,V,_,x),this.init(),M&&M!==!0&&(this.$L=this.locale(M).$L),U&&k!=this.format(V)&&(this.$d=new Date("")),s={}}else if(V instanceof Array)for(var O=V.length,P=1;P<=O;P+=1){F[1]=V[P-1];var N=x.apply(this,F);if(N.isValid()){this.$d=N.$d,this.$L=N.$L,this.init();break}P===O&&(this.$d=new Date(""))}else T.call(this,R)}}})});var Sy=We((Pd,Nd)=>{"use strict";m();d();f();p();(function(e,t){typeof Pd=="object"&&typeof Nd<"u"?Nd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_timezone=t()})(Pd,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,o){var i,s=function(g,v,E){E===void 0&&(E={});var h=new Date(g),y=function(S,x){x===void 0&&(x={});var I=x.timeZoneName||"short",T=S+"|"+I,R=t[T];return R||(R=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:S,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:I}),t[T]=R),R}(v,E);return y.formatToParts(h)},a=function(g,v){for(var E=s(g,v),h=[],y=0;y<E.length;y+=1){var S=E[y],x=S.type,I=S.value,T=e[x];T>=0&&(h[T]=parseInt(I,10))}var R=h[3],k=R===24?0:R,_=h[0]+"-"+h[1]+"-"+h[2]+" "+k+":"+h[4]+":"+h[5]+":000",F=+g;return(o.utc(_).valueOf()-(F-=F%1e3))/6e4},u=n.prototype;u.tz=function(g,v){g===void 0&&(g=i);var E,h=this.utcOffset(),y=this.toDate(),S=y.toLocaleString("en-US",{timeZone:g}),x=Math.round((y-new Date(S))/1e3/60),I=15*-Math.round(y.getTimezoneOffset()/15)-x;if(!Number(I))E=this.utcOffset(0,v);else if(E=o(S,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(I,!0),v){var T=E.utcOffset();E=E.add(h-T,"minute")}return E.$x.$timezone=g,E},u.offsetName=function(g){var v=this.$x.$timezone||o.tz.guess(),E=s(this.valueOf(),v,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return E&&E.value};var c=u.startOf;u.startOf=function(g,v){if(!this.$x||!this.$x.$timezone)return c.call(this,g,v);var E=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return c.call(E,g,v).tz(this.$x.$timezone,!0)},o.tz=function(g,v,E){var h=E&&v,y=E||v||i,S=a(+o(),y);if(typeof g!="string")return o(g).tz(y);var x=function(k,_,F){var V=k-60*_*1e3,j=a(V,F);if(_===j)return[V,_];var L=a(V-=60*(j-_)*1e3,F);return j===L?[V,j]:[k-60*Math.min(j,L)*1e3,Math.max(j,L)]}(o.utc(g,h).valueOf(),S,y),I=x[0],T=x[1],R=o(I).utcOffset(T);return R.$x.$timezone=y,R},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var Ay=We((Fd,Dd)=>{"use strict";m();d();f();p();(function(e,t){typeof Fd=="object"&&typeof Dd<"u"?Dd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_utc=t()})(Fd,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,i){var s=o.prototype;i.utc=function(h){var y={date:h,utc:!0,args:arguments};return new o(y)},s.utc=function(h){var y=i(this.toDate(),{locale:this.$L,utc:!0});return h?y.add(this.utcOffset(),e):y},s.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var a=s.parse;s.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),a.call(this,h)};var u=s.init;s.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 u.call(this)};var c=s.utcOffset;s.utcOffset=function(h,y){var S=this.$utils().u;if(S(h))return this.$u?0:S(this.$offset)?c.call(this):this.$offset;if(typeof h=="string"&&(h=function(R){R===void 0&&(R="");var k=R.match(t);if(!k)return null;var _=(""+k[0]).match(r)||["-",0,0],F=_[0],V=60*+_[1]+ +_[2];return V===0?0:F==="+"?V:-V}(h),h===null))return this;var x=Math.abs(h)<=16?60*h:h;if(x===0)return this.utc(y);var I=this.clone();if(y)return I.$offset=x,I.$u=!1,I;var T=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(I=this.local().add(x+T,e)).$offset=x,I.$x.$localOffset=T,I};var g=s.format;s.format=function(h){var y=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,y)},s.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},s.isUTC=function(){return!!this.$u},s.toISOString=function(){return this.toDate().toISOString()},s.toString=function(){return this.toDate().toUTCString()};var v=s.toDate;s.toDate=function(h){return h==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var E=s.diff;s.diff=function(h,y,S){if(h&&this.$u===h.$u)return E.call(this,h,y,S);var x=this.local(),I=i(h).local();return E.call(x,I,y,S)}}})});var uA=We((_ae,cA)=>{"use strict";m();d();f();p();function eO(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}cA.exports=tO;function tO(e,t,r){var n=r&&r.stringify||eO,o=1;if(typeof e=="object"&&e!==null){var i=t.length+o;if(i===1)return e;var s=new Array(i);s[0]=n(e);for(var a=1;a<i;a++)s[a]=n(t[a]);return s.join(" ")}if(typeof e!="string")return e;var u=t.length;if(u===0)return e;for(var c="",g=1-o,v=-1,E=e&&e.length||0,h=0;h<E;){if(e.charCodeAt(h)===37&&h+1<E){switch(v=v>-1?v:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=u||t[g]==null)break;v<h&&(c+=e.slice(v,h)),c+=Number(t[g]),v=h+2,h++;break;case 105:if(g>=u||t[g]==null)break;v<h&&(c+=e.slice(v,h)),c+=Math.floor(Number(t[g])),v=h+2,h++;break;case 79:case 111:case 106:if(g>=u||t[g]===void 0)break;v<h&&(c+=e.slice(v,h));var y=typeof t[g];if(y==="string"){c+="'"+t[g]+"'",v=h+2,h++;break}if(y==="function"){c+=t[g].name||"<anonymous>",v=h+2,h++;break}c+=n(t[g]),v=h+2,h++;break;case 115:if(g>=u)break;v<h&&(c+=e.slice(v,h)),c+=String(t[g]),v=h+2,h++;break;case 37:v<h&&(c+=e.slice(v,h)),c+="%",v=h+2,h++,g--;break}++g}++h}return v===-1?e:(v<E&&(c+=e.slice(v)),c)}});var hA=We((Fae,pu)=>{"use strict";m();d();f();p();var lA=uA();pu.exports=mr;var $i=hO().console||{},rO={mapHttpRequest:du,mapHttpResponse:du,wrapRequestSerializer:Op,wrapResponseSerializer:Op,wrapErrorSerializer:Op,req:du,res:du,err:pA,errWithCause:pA};function Fr(e,t){return e==="silent"?1/0:t.levels.values[e]}var Fp=Symbol("pino.logFuncs"),Pp=Symbol("pino.hierarchy"),nO={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function dA(e,t){let r={logger:t,parent:e[Pp]};t[Pp]=r}function oO(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:$i[o]||$i[nO[o]||"log"]||Ro}),e[Fp]=n}function iO(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function mr(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||$i;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=iO(e.browser.serialize,n),i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);let s=Object.keys(e.customLevels||{}),a=["error","fatal","warn","info","debug","trace"].concat(s);typeof r=="function"&&a.forEach(function(S){r[S]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let u=e.level||"info",c=Object.create(r);c.log||(c.log=Ro),oO(c,a,r),dA({},c),Object.defineProperty(c,"levelVal",{get:v}),Object.defineProperty(c,"level",{get:E,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:a,timestamp:fO(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Ro};c.levels=sO(e),c.level=u,c.isLevelEnabled=function(S){return this.levels.values[S]?this.levels.values[S]>=this.levels.values[this.level]:!1},c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=Ro,c.serializers=n,c._serialize=o,c._stdErrSerialize=i,c.child=function(...S){return y.call(this,g,...S)},t&&(c._logEvent=Np());function v(){return Fr(this.level,this)}function E(){return this._level}function h(S){if(S!=="silent"&&!this.levels.values[S])throw Error("unknown level "+S);this._level=S,In(this,g,c,"error"),In(this,g,c,"fatal"),In(this,g,c,"warn"),In(this,g,c,"info"),In(this,g,c,"debug"),In(this,g,c,"trace"),s.forEach(x=>{In(this,g,c,x)})}function y(S,x,I){if(!x)throw new Error("missing bindings for child Pino");I=I||{},o&&x.serializers&&(I.serializers=x.serializers);let T=I.serializers;if(o&&T){var R=Object.assign({},n,T),k=e.browser.serialize===!0?Object.keys(R):o;delete x.serializers,Dp([x],k,R,this._stdErrSerialize)}function _(V){this._childLevel=(V._childLevel|0)+1,this.bindings=x,R&&(this.serializers=R,this._serialize=k),t&&(this._logEvent=Np([].concat(V._logEvent.bindings,x)))}_.prototype=this;let F=new _(this);return dA(this,F),F.child=function(...V){return y.call(this,S,...V)},F.level=I.level||this.level,S.onChild(F),F}return c}function sO(e){let t=e.customLevels||{},r=Object.assign({},mr.levels.values,t),n=Object.assign({},mr.levels.labels,aO(t));return{values:r,labels:n}}function aO(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}mr.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"}};mr.stdSerializers=rO;mr.stdTimeFunctions=Object.assign({},{nullTime:mA,epochTime:gA,unixTime:mO,isoTime:gO});function cO(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[Pp];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function In(e,t,r,n){if(Object.defineProperty(e,n,{value:Fr(e.level,r)>Fr(n,r)?Ro:r[Fp][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===Ro){if(!t.transmit)return;let i=t.transmit.level||e.level,s=Fr(i,r);if(Fr(n,r)<s)return}e[n]=lO(e,t,r,n);let o=cO(e);o.length!==0&&(e[n]=uO(o,e[n]))}function uO(e,t){return function(){return t.apply(this,[...e,...arguments])}}function lO(e,t,r,n){return function(o){return function(){let s=t.timestamp(),a=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===$i?$i:this;for(var c=0;c<a.length;c++)a[c]=arguments[c];var g=!1;if(t.serialize&&(Dp(a,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let v=dO(this,n,a,s,t);if(t.reportCaller&&v&&v.length>0&&v[0]&&typeof v[0]=="object")try{let E=fA();E&&(v[0].caller=E)}catch{}o.call(u,...v)}else{if(t.reportCaller)try{let v=fA();v&&a.push(v)}catch{}o.apply(u,a)}if(t.transmit){let v=t.transmit.level||e._level,E=Fr(v,r),h=Fr(n,r);if(h<E)return;pO(this,{ts:s,methodLevel:n,methodValue:h,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Fr(e._level,r)},a,g)}}}(e[Fp][n])}function dO(e,t,r,n,o){let{level:i,log:s=v=>v}=o.formatters||{},a=r.slice(),u=a[0],c={},g=(e._childLevel|0)+1;if(g<1&&(g=1),n&&(c.time=n),i){let v=i(t,e.levels.values[t]);Object.assign(c,v)}else c.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(u!==null&&typeof u=="object")for(;g--&&typeof a[0]=="object";)Object.assign(c,a.shift());return[s(c),...a]}else{if(u!==null&&typeof u=="object"){for(;g--&&typeof a[0]=="object";)Object.assign(c,a.shift());u=a.length?lA(a.shift(),a):void 0}else typeof u=="string"&&(u=lA(a.shift(),a));return u!==void 0&&(c[o.messageKey]=u),[s(c)]}}function Dp(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=mr.stdSerializers.err(e[o]);else if(typeof e[o]=="object"&&!Array.isArray(e[o])&&t)for(let i in e[o])t.indexOf(i)>-1&&i in r&&(e[o][i]=r[i](e[o][i]))}function pO(e,t,r,n=!1){let o=t.send,i=t.ts,s=t.methodLevel,a=t.methodValue,u=t.val,c=e._logEvent.bindings;n||Dp(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter(function(g){return c.indexOf(g)===-1}),e._logEvent.level.label=s,e._logEvent.level.value=a,o(s,e._logEvent,u),e._logEvent=Np(c)}function Np(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function pA(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 fO(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?mA:gA}function du(){return{}}function Op(e){return e}function Ro(){}function mA(){return!1}function gA(){return Date.now()}function mO(){return Math.round(Date.now()/1e3)}function gO(){return new Date(Date.now()).toISOString()}function hO(){function e(t){return typeof t<"u"&&t}try{return typeof b<"u"?b:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),b)}catch{return e(self)||e(window)||e(this)||{}}}pu.exports.default=mr;pu.exports.pino=mr;function fA(){let e=new Error().stack;if(!e)return null;let t=e.split(`
20
+ `);for(let r=1;r<t.length;r++){let n=t[r].trim();if(/(^at\s+)?(createWrap|LOG|set\s*\(|asObject|Object\.apply|Function\.apply)/.test(n)||n.indexOf("browser.js")!==-1||n.indexOf("node:internal")!==-1||n.indexOf("node_modules")!==-1)continue;let o=n.match(/\((.*?):(\d+):(\d+)\)/);if(o||(o=n.match(/at\s+(.*?):(\d+):(\d+)/)),o){let i=o[1],s=o[2],a=o[3];return i+":"+s+":"+a}}return null}});var VO={};zi(VO,{ResultTemplatesHelpers:()=>Vh,buildCaseAssistEngine:()=>wA,buildCaseField:()=>LA,buildCaseInput:()=>jA,buildController:()=>er,buildDocumentSuggestion:()=>Lp,buildDocumentSuggestionList:()=>Lp,buildInteractiveResult:()=>UA,buildQuickview:()=>$A,getAnalyticsNextApiBaseUrl:()=>es,getOrganizationEndpoint:()=>rt,loadCaseAssistAnalyticsActions:()=>LO,loadCaseFieldActions:()=>jO,loadCaseInputActions:()=>qO,loadDocumentSuggestionActions:()=>UO,loadGenericAnalyticsActions:()=>MO});module.exports=rb(VO);m();d();f();p();m();d();f();p();var Af=kt(pf(),1);m();d();f();p();var At=new Error("Failed to load reducers."),Pn=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."}},jr=class extends Error{constructor(r,n){super();oe(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};m();d();f();p();function ff(e){return Array.isArray(e)}function mf(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}var Kb=new Set(["1",1,"yes",!0]);function gf(){if(typeof navigator>"u"||typeof window>"u")return!1;let e=navigator,t=window;return[e.globalPrivacyControl,e.doNotTrack,e.msDoNotTrack,t.doNotTrack].some(r=>Kb.has(r))}function hf(e){let t={};for(let[r,n]of e)t[r]=n;return t}function jo(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Ji(e,t,r={}){let n;return(...o)=>{let i=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,o)},t),i)return e.apply(void 0,o)}}m();d();f();p();function yf(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function vf(e){return typeof e!="object"||!e?!1:Object.values(e).every(Yb)}function Yb(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Sf(e){return e===429}var hr=class e{static call(t){return _asyncToGenerator(function*(){let r=Xb(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:i,...s}=o,a=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let u=yield w(i,s);if(Sf(u.status))throw u;return u});return function a(){return _ref.apply(this,arguments)}}();try{let u=yield(0,Af.backOff)(a,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(c){let g=c&&Sf(c.status);return g&&(n.info("Platform retrying request"),yield new Promise(v=>setTimeout(v,1e3))),g});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(u.status){case 419:case 401:throw n.info("Platform renewing token"),new Pn;case 404:throw new jr(i,u.status);default:return n.info({response:u,requestInfo:o},"Platform response"),u}}catch(u){return u.message==="Failed to fetch"?new jr(i):u}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:s}=r,{signal:a,...u}=t,c=jo(u);try{let g=yield o(t,n,s);return{...t,...g}}catch(g){i.error(g,"Platform request preprocessing failed. Returning default request options.")}return c})()}};function rt(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Nn(e,t,r="prod"){return e??rt(t,r)}function Fn(e,t="prod"){return`${rt(e,t)}/rest/search/v2`}function es(e,t="prod"){return`${rt(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function Xb(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:s}=e,a=e.method==="POST"||e.method==="PUT",u=Zb(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(a&&{body:u}),signal:s}}function Zb(e,t){return t==="application/x-www-form-urlencoded"?vf(e)?yf(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();function Jb(e,t){let r=`
21
21
  The following properties are invalid:
22
22
 
23
23
  ${e.join(`
24
24
  `)}
25
25
 
26
26
  ${t}
27
- `;return new ju(r)}var ju=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Ot=class{constructor(e){oe(this,"definition");this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let i=this.definition[o].validate(r[o]);i&&n.push(`${o}: ${i}`)}if(n.length)throw Kb(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}},qr=class{constructor(e={}){oe(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&ae(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 Dn(e){return e===void 0}function Yb(e){return e===null}function ae(e){return Dn(e)||Yb(e)}var Le=class{constructor(e={}){oe(this,"value");this.value=new qr(e)}validate(e){let t=this.value.validate(e);return t||(Xb(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function Xb(e){return Dn(e)||Af(e)}function Af(e){return typeof e=="boolean"}var Fe=class{constructor(e={}){oe(this,"config");oe(this,"value");this.config=e,this.value=new qr(e)}validate(e){let t=this.value.validate(e);return t||(Zb(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 Zb(e){return Dn(e)||bf(e)}function bf(e){return typeof e=="number"&&!Number.isNaN(e)}var Jb=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,re=class{constructor(e={}){oe(this,"value");oe(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new qr(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:i}=this.config,s=this.value.validate(e);if(s)return s;if(Dn(e))return null;if(!wf(e))return"value is not a string.";if(!t&&!e.length)return"value is an empty string.";if(r)try{new URL(e)}catch{return"value is not a valid URL."}return n&&!n.test(e)?`value did not match provided regex ${n}`:o&&!o.includes(e)?`value should be one of: ${o.join(", ")}.`:i&&!(Jb.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 wf(e){return Object.prototype.toString.call(e)==="[object String]"}var Ce=class{constructor(e={}){oe(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Dn(e))return this.config.options.required?"value is required and is currently undefined":null;if(!Cf(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ae(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],i=n.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function Cf(e){return e!==void 0&&typeof e=="object"}var Pt=class{constructor(e={}){oe(this,"config");oe(this,"value");this.config=e,this.value=new qr(this.config)}validate(e){if(!ae(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ae(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&&ae(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 Af(e)||wf(e)||bf(e)||Cf(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function xf(e){return Array.isArray(e)}var qu=class{constructor(e){oe(this,"config");oe(this,"value");this.config=e,this.value=new qr(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Dn(e)||Object.values(this.config.enum).find(n=>n===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();f();p();var ts=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();var Mn=class{constructor(t){oe(this,"_basePath");oe(this,"_params",{});this._basePath=t}addParam(t,r){this._params={...this.params,[t]:r}}get basePath(){return this._basePath}get params(){return this._params}get hasParams(){return Object.entries(this._params).length}get href(){return this.hasParams?`${this.basePath}?${Object.entries(this.params).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}`:this.basePath}};m();d();f();p();function Uu(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Vu=e=>{let{response:t}=e;return t.body?ew(e):tw(t)},ew=e=>nw(e)?ow(e):rw(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},tw=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function rw(e){return e.body.statusCode!==void 0}function nw(e){return e.body.exception!==void 0}var ow=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();function Ef(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var Gu=(e,t,r,n)=>{let o=new Mn(`${e.url}${n}`);return o.addParam("organizationId",e.organizationId),e.authentication&&o.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:o.href,origin:"searchApiFetch"}};var If=(e,t)=>{let r=new Mn(`${e.url}${t}`);return r.addParam("access_token",e.accessToken),r.addParam("organizationId",e.organizationId),r.addParam("uniqueId",e.uniqueId),e.authentication&&r.addParam("authentication",e.authentication),e.q!==void 0&&r.addParam("q",e.q),e.enableNavigation!==void 0&&r.addParam("enableNavigation",`${e.enableNavigation}`),e.requestedOutputSize!==void 0&&r.addParam("requestedOutputSize",`${e.requestedOutputSize}`),r.href},Bu=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield hr.call({...Gu(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Uu(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Ef(r),o=yield r.arrayBuffer(),s=new TextDecoder(n).decode(o);return iw(s)?{success:s}:{error:Vu({response:r,body:s})}});return function Bu(_x3,_x4){return _ref3.apply(this,arguments)}}();function iw(e){return typeof e=="string"}m();d();f();p();function sw(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function aw(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function rs(e,t){if(t&&e.name==="AbortError")return{error:aw(e)};if(e instanceof jr)return{error:sw(e)};throw e}m();d();f();p();m();d();f();p();var ns=(e,t,r,n,o={})=>{cw(e);let i=`${e.url}/rest/organizations/${e.organizationId}/caseassists/${e.caseAssistId}${n}`,s=uw(o),a=s?`${i}?${s}`:i;return{accessToken:e.accessToken,method:t,contentType:r,url:a,origin:"caseAssistApiFetch"}},os=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r],t),{}),is=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r].value,t),{}),cw=e=>{if(!e.url)throw new Error("The 'url' attribute must contain a valid platform URL.");if(!e.organizationId)throw new Error("The 'organizationId' attribute must contain a valid organization ID.");if(!e.accessToken)throw new Error("The 'accessToken' attribute must contain a valid platform access token.");if(!e.caseAssistId)throw new Error("The 'caseAssistId' attribute must contain a valid Case Assist configuration ID.")},uw=e=>Object.keys(e).map(t=>`${t}=${encodeURIComponent(e[t])}`).join("&");var Rf=e=>{let t=e.debug?{debug:"1"}:{};return{...ns(e,"POST","application/json","/classify",t),requestParams:lw(e)}},lw=e=>({clientId:e.clientId,locale:e.locale,fields:os(e.fields)});m();d();f();p();var Tf=e=>{let t={};return e.debug&&(t.debug="1"),e.numberOfResults&&(t.numberOfResults=e.numberOfResults.toString()),{...ns(e,"POST","application/json","/documents/suggest",t),requestParams:dw(e)}},dw=e=>({clientId:e.clientId,locale:e.locale,fields:os(e.fields),context:e.context,analytics:e.analytics});var ss=class{constructor(t){oe(this,"options",t)}getCaseClassifications(t){var _this=this;return _asyncToGenerator(function*(){let r=yield hr.call({...Rf(t),..._this.options});if(r instanceof Error)return rs(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}getDocumentSuggestions(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield hr.call({...Tf(t),..._this2.options});if(r instanceof Error)return rs(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this3=this;return _asyncToGenerator(function*(){return Bu(t,_this3.options)})()}};m();d();f();p();m();d();f();p();m();d();f();p();function Ke(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 pw=typeof Symbol=="function"&&Symbol.observable||"@@observable",_f=pw,$u=()=>Math.random().toString(36).substring(7).split("").join("."),fw={INIT:`@@redux/INIT${$u()}`,REPLACE:`@@redux/REPLACE${$u()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${$u()}`},as=fw;function qt(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 Qu(e,t,r){if(typeof e!="function")throw new Error(Ke(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ke(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ke(1));return r(Qu)(e,t)}let n=e,o=t,i=new Map,s=i,a=0,u=!1;function c(){s===i&&(s=new Map,i.forEach((x,I)=>{s.set(I,x)}))}function g(){if(u)throw new Error(Ke(3));return o}function v(x){if(typeof x!="function")throw new Error(Ke(4));if(u)throw new Error(Ke(5));let I=!0;c();let T=a++;return s.set(T,x),function(){if(I){if(u)throw new Error(Ke(6));I=!1,c(),s.delete(T),i=null}}}function E(x){if(!qt(x))throw new Error(Ke(7));if(typeof x.type>"u")throw new Error(Ke(8));if(typeof x.type!="string")throw new Error(Ke(17));if(u)throw new Error(Ke(9));try{u=!0,o=n(o,x)}finally{u=!1}return(i=s).forEach(T=>{T()}),x}function h(x){if(typeof x!="function")throw new Error(Ke(10));n=x,E({type:as.REPLACE})}function y(){let x=v;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(Ke(11));function T(){let k=I;k.next&&k.next(g())}return T(),{unsubscribe:x(T)}},[_f](){return this}}}return E({type:as.INIT}),{dispatch:E,subscribe:v,getState:g,replaceReducer:h,[_f]:y}}function mw(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:as.INIT})>"u")throw new Error(Ke(12));if(typeof r(void 0,{type:as.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ke(13))})}function Ln(e){let t=Object.keys(e),r={};for(let s=0;s<t.length;s++){let a=t[s];typeof e[a]=="function"&&(r[a]=e[a])}let n=Object.keys(r),o,i;try{mw(r)}catch(s){i=s}return function(a={},u){if(i)throw i;let c=!1,g={};for(let v=0;v<n.length;v++){let E=n[v],h=r[E],y=a[E],S=h(y,u);if(typeof S>"u"){let x=u&&u.type;throw new Error(Ke(14))}g[E]=S,c=c||S!==y}return c=c||n.length!==Object.keys(a).length,c?g:a}}function qo(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function kf(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(Ke(15))},s={getState:o.getState,dispatch:(u,...c)=>i(u,...c)},a=e.map(u=>u(s));return i=qo(...a)(o.dispatch),{...o,dispatch:i}}}function Uo(e){return qt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var el=Symbol.for("immer-nothing"),Vo=Symbol.for("immer-draftable"),Qe=Symbol.for("immer-state");function Ye(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var gt=Object,Vr=gt.getPrototypeOf,Bo="constructor",Wo="prototype",Wu="configurable",ds="enumerable",us="writable",$o="value",st=e=>!!e&&!!e[Qe];function at(e){return e?jf(e)||Yo(e)||!!e[Vo]||!!e[Bo]?.[Vo]||Xo(e)||Zo(e):!1}var gw=gt[Wo][Bo].toString(),Of=new WeakMap;function jf(e){if(!e||!jn(e))return!1;let t=Vr(e);if(t===null||t===gt[Wo])return!0;let r=gt.hasOwnProperty.call(t,Bo)&&t[Bo];if(r===Object)return!0;if(!Ur(r))return!1;let n=Of.get(r);return n===void 0&&(n=Function.toString.call(r),Of.set(r,n)),n===gw}function qf(e){return st(e)||Ye(15,e),e[Qe].base_}function Ko(e,t,r=!0){Gr(e)===0?(r?Reflect.ownKeys(e):gt.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function Gr(e){let t=e[Qe];return t?t.type_:Yo(e)?1:Xo(e)?2:Zo(e)?3:0}var Go=(e,t,r=Gr(e))=>r===2?e.has(t):gt[Wo].hasOwnProperty.call(e,t),rr=(e,t,r=Gr(e))=>r===2?e.get(t):e[t],ps=(e,t,r,n=Gr(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function hw(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Yo=Array.isArray,Xo=e=>e instanceof Map,Zo=e=>e instanceof Set,jn=e=>typeof e=="object",Ur=e=>typeof e=="function",Hu=e=>typeof e=="boolean";function yw(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var vw=e=>jn(e)?e?.[Qe]:null,nr=e=>e.copy_||e.base_;var tl=e=>e.modified_?e.copy_:e.base_;function Ku(e,t){if(Xo(e))return new Map(e);if(Zo(e))return new Set(e);if(Yo(e))return Array[Wo].slice.call(e);let r=jf(e);if(t===!0||t==="class_only"&&!r){let n=gt.getOwnPropertyDescriptors(e);delete n[Qe];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let s=o[i],a=n[s];a[us]===!1&&(a[us]=!0,a[Wu]=!0),(a.get||a.set)&&(n[s]={[Wu]:!0,[us]:!0,[ds]:a[ds],[$o]:e[s]})}return gt.create(Vr(e),n)}else{let n=Vr(e);if(n!==null&&r)return{...e};let o=gt.create(n);return gt.assign(o,e)}}function rl(e,t=!1){return vs(e)||st(e)||!at(e)||(Gr(e)>1&&gt.defineProperties(e,{set:cs,add:cs,clear:cs,delete:cs}),gt.freeze(e),t&&Ko(e,(r,n)=>{rl(n,!0)},!1)),e}function Sw(){Ye(2)}var cs={[$o]:Sw};function vs(e){return e===null||!jn(e)?!0:gt.isFrozen(e)}var fs="MapSet",ms="Patches",Pf="ArrayMethods",gs={};function Br(e){let t=gs[e];return t||Ye(0,e),t}var Nf=e=>!!gs[e];function Aw(e,t){gs[e]||(gs[e]=t)}var Qo,Uf=()=>Qo,bw=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Nf(fs)?Br(fs):void 0,arrayMethodsPlugin_:Nf(Pf)?Br(Pf):void 0});function Ff(e,t){t&&(e.patchPlugin_=Br(ms),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Yu(e){Xu(e),e.drafts_.forEach(ww),e.drafts_=null}function Xu(e){e===Qo&&(Qo=e.parent_)}var Df=e=>Qo=bw(Qo,e);function ww(e){let t=e[Qe];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Mf(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[Qe].modified_&&(Yu(t),Ye(4)),at(e)&&(e=Lf(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[Qe].base_,e,t)}else e=Lf(t,r);return Cw(t,e,!0),Yu(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==el?e:void 0}function Lf(e,t){if(vs(t))return t;let r=t[Qe];if(!r)return hs(t,e.handledSet_,e);if(!Ss(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);Bf(r,e)}return r.copy_}function Cw(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&rl(t,r)}function Vf(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ss=(e,t)=>e.scope_===t,xw=[];function Gf(e,t,r,n){let o=nr(e),i=e.type_;if(n!==void 0&&rr(o,n,i)===t){ps(o,n,r,i);return}if(!e.draftLocations_){let a=e.draftLocations_=new Map;Ko(o,(u,c)=>{if(st(c)){let g=a.get(c)||[];g.push(u),a.set(c,g)}})}let s=e.draftLocations_.get(t)??xw;for(let a of s)ps(o,a,r,i)}function Ew(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!Ss(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let s=tl(i);Gf(e,i.draft_??i,s,r),Bf(i,o)})}function Bf(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)}Vf(e)}}function Iw(e,t,r){let{scope_:n}=e;if(st(r)){let o=r[Qe];Ss(o,n)&&o.callbacks_.push(function(){ls(e);let s=tl(o);Gf(e,r,s,t)})}else at(r)&&e.callbacks_.push(function(){let i=nr(e);e.type_===3?i.has(r)&&hs(r,n.handledSet_,n):rr(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&hs(rr(e.copy_,t,e.type_),n.handledSet_,n)})}function hs(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||st(e)||t.has(e)||!at(e)||vs(e)||(t.add(e),Ko(e,(n,o)=>{if(st(o)){let i=o[Qe];if(Ss(i,r)){let s=tl(i);ps(e,n,s,e.type_),Vf(i)}}else at(o)&&hs(o,t,r)})),e}function Rw(e,t){let r=Yo(e),n={type_:r?1:0,scope_:t?t.scope_:Uf(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=n,i=ys;r&&(o=[n],i=Ho);let{revoke:s,proxy:a}=Proxy.revocable(o,i);return n.draft_=a,n.revoke_=s,[a,n]}var ys={get(e,t){if(t===Qe)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=nr(e);if(!Go(o,t,e.type_))return Tw(e,o,t);let i=o[t];if(e.finalized_||!at(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&yw(t))return i;if(i===zu(e.base_,t)){ls(e);let s=e.type_===1?+t:t,a=Ju(e.scope_,i,e,s);return e.copy_[s]=a}return i},has(e,t){return t in nr(e)},ownKeys(e){return Reflect.ownKeys(nr(e))},set(e,t,r){let n=$f(nr(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=zu(nr(e),t),i=o?.[Qe];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(hw(r,o)&&(r!==void 0||Go(e.base_,t,e.type_)))return!0;ls(e),Zu(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Iw(e,t,r)),!0},deleteProperty(e,t){return ls(e),zu(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Zu(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=nr(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[us]:!0,[Wu]:e.type_!==1||t!=="length",[ds]:n[ds],[$o]:r[t]}},defineProperty(){Ye(11)},getPrototypeOf(e){return Vr(e.base_)},setPrototypeOf(){Ye(12)}},Ho={};for(let e in ys){let t=ys[e];Ho[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Ho.deleteProperty=function(e,t){return Ho.set.call(this,e,t,void 0)};Ho.set=function(e,t,r){return ys.set.call(this,e[0],t,r,e[0])};function zu(e,t){let r=e[Qe];return(r?nr(r):e)[t]}function Tw(e,t,r){let n=$f(t,r);return n?$o in n?n[$o]:n.get?.call(e.draft_):void 0}function $f(e,t){if(!(t in e))return;let r=Vr(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Vr(r)}}function Zu(e){e.modified_||(e.modified_=!0,e.parent_&&Zu(e.parent_))}function ls(e){e.copy_||(e.assigned_=new Map,e.copy_=Ku(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var _w=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Ur(t)&&!Ur(r)){let i=r;r=t;let s=this;return function(u=i,...c){return s.produce(u,g=>r.call(this,g,...c))}}Ur(r)||Ye(6),n!==void 0&&!Ur(n)&&Ye(7);let o;if(at(t)){let i=Df(this),s=Ju(i,t,void 0),a=!0;try{o=r(s),a=!1}finally{a?Yu(i):Xu(i)}return Ff(i,n),Mf(o,i)}else if(!t||!jn(t)){if(o=r(t),o===void 0&&(o=t),o===el&&(o=void 0),this.autoFreeze_&&rl(o,!0),n){let i=[],s=[];Br(ms).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:s}),n(i,s)}return o}else Ye(1,t)},this.produceWithPatches=(t,r)=>{if(Ur(t))return(s,...a)=>this.produceWithPatches(s,u=>t(u,...a));let n,o;return[this.produce(t,r,(s,a)=>{n=s,o=a}),n,o]},Hu(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Hu(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Hu(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){at(e)||Ye(8),st(e)&&(e=As(e));let t=Df(this),r=Ju(t,e,void 0);return r[Qe].isManual_=!0,Xu(t),r}finishDraft(e,t){let r=e&&e[Qe];(!r||!r.isManual_)&&Ye(9);let{scope_:n}=r;return Ff(n,t),Mf(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=Br(ms).applyPatches_;return st(e)?n(e,t):this.produce(e,o=>n(o,t))}};function Ju(e,t,r,n){let[o,i]=Xo(t)?Br(fs).proxyMap_(t,r):Zo(t)?Br(fs).proxySet_(t,r):Rw(t,r);return(r?.scope_??Uf()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?Ew(r,i,n):i.callbacks_.push(function(u){u.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:c}=u;i.modified_&&c&&c.generatePatches_(i,[],u)}),o}function As(e){return st(e)||Ye(10,e),Qf(e)}function Qf(e){if(!at(e)||vs(e))return e;let t=e[Qe],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Ku(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Ku(e,!0);return Ko(r,(o,i)=>{ps(r,o,Qf(i))},n),t&&(t.finalized_=!1),r}function Hf(){function t(y,S=[]){if(y.key_!==void 0){let x=y.parent_.copy_??y.parent_.base_,I=vw(rr(x,y.key_)),T=rr(x,y.key_);if(T===void 0||T!==y.draft_&&T!==y.base_&&T!==y.copy_||I!=null&&I.base_!==y.base_)return null;let R=y.parent_.type_===3,k;if(R){let _=y.parent_;k=Array.from(_.drafts_.keys()).indexOf(y.key_)}else k=y.key_;if(!(R&&x.size>k||Go(x,k)))return null;S.push(k)}if(y.parent_)return t(y.parent_,S);S.reverse();try{r(y.copy_,S)}catch{return null}return S}function r(y,S){let x=y;for(let I=0;I<S.length-1;I++){let T=S[I];if(x=rr(x,T),!jn(x)||x===null)throw new Error(`Cannot resolve path at '${S.join("/")}'`)}return x}let n="replace",o="add",i="remove";function s(y,S,x){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:I,inversePatches_:T}=x;switch(y.type_){case 0:case 2:return u(y,S,I,T);case 1:return a(y,S,I,T);case 3:return c(y,S,I,T)}}function a(y,S,x,I){let{base_:T,assigned_:R}=y,k=y.copy_;k.length<T.length&&([T,k]=[k,T],[x,I]=[I,x]);let _=y.allIndicesReassigned_===!0;for(let F=0;F<T.length;F++){let V=k[F],j=T[F];if((_||R?.get(F.toString()))&&V!==j){let U=V?.[Qe];if(U&&U.modified_)continue;let M=S.concat([F]);x.push({op:n,path:M,value:h(V)}),I.push({op:n,path:M,value:h(j)})}}for(let F=T.length;F<k.length;F++){let V=S.concat([F]);x.push({op:o,path:V,value:h(k[F])})}for(let F=k.length-1;T.length<=F;--F){let V=S.concat([F]);I.push({op:i,path:V})}}function u(y,S,x,I){let{base_:T,copy_:R,type_:k}=y;Ko(y.assigned_,(_,F)=>{let V=rr(T,_,k),j=rr(R,_,k),L=F?Go(T,_)?n:o:i;if(V===j&&L===n)return;let U=S.concat(_);x.push(L===i?{op:L,path:U}:{op:L,path:U,value:h(j)}),I.push(L===o?{op:i,path:U}:L===i?{op:o,path:U,value:h(V)}:{op:n,path:U,value:h(V)})})}function c(y,S,x,I){let{base_:T,copy_:R}=y,k=0;T.forEach(_=>{if(!R.has(_)){let F=S.concat([k]);x.push({op:i,path:F,value:_}),I.unshift({op:o,path:F,value:_})}k++}),k=0,R.forEach(_=>{if(!T.has(_)){let F=S.concat([k]);x.push({op:o,path:F,value:_}),I.unshift({op:i,path:F,value:_})}k++})}function g(y,S,x){let{patches_:I,inversePatches_:T}=x;I.push({op:n,path:[],value:S===el?void 0:S}),T.push({op:n,path:[],value:y})}function v(y,S){return S.forEach(x=>{let{path:I,op:T}=x,R=y;for(let V=0;V<I.length-1;V++){let j=Gr(R),L=I[V];typeof L!="string"&&typeof L!="number"&&(L=""+L),(j===0||j===1)&&(L==="__proto__"||L===Bo)&&Ye(19),Ur(R)&&L===Wo&&Ye(19),R=rr(R,L),jn(R)||Ye(18,I.join("/"))}let k=Gr(R),_=E(x.value),F=I[I.length-1];switch(T){case n:switch(k){case 2:return R.set(F,_);case 3:Ye(16);default:return R[F]=_}case o:switch(k){case 1:return F==="-"?R.push(_):R.splice(F,0,_);case 2:return R.set(F,_);case 3:return R.add(_);default:return R[F]=_}case i:switch(k){case 1:return R.splice(F,1);case 2:return R.delete(F);case 3:return R.delete(x.value);default:return delete R[F]}default:Ye(17,T)}}),y}function E(y){if(!at(y))return y;if(Yo(y))return y.map(E);if(Xo(y))return new Map(Array.from(y.entries()).map(([x,I])=>[x,E(I)]));if(Zo(y))return new Set(Array.from(y).map(E));let S=Object.create(Vr(y));for(let x in y)S[x]=E(y[x]);return Go(y,Vo)&&(S[Vo]=y[Vo]),S}function h(y){return st(y)?E(y):y}Aw(ms,{applyPatches_:v,generatePatches_:s,generateReplacementPatches_:g,getPath:t})}var zo=new _w,$r=zo.produce,nl=zo.produceWithPatches.bind(zo);var ol=zo.applyPatches.bind(zo);m();d();f();p();function kw(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Ow(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 zf=e=>Array.isArray(e)?e:[e];function Pw(e){let t=Array.isArray(e[0])?e[0]:e;return Ow(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Nw(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var Fw=class{constructor(e){this.value=e}deref(){return this.value}},Dw=()=>typeof WeakRef>"u"?Fw:WeakRef,Kf=Dw(),Mw=0,Wf=1;function bs(){return{s:Mw,v:void 0,o:null,p:null}}function Lw(e){return e instanceof Kf?e.deref():e}function Jo(e,t={}){let r=bs(),{resultEqualityCheck:n}=t,o,i=0;function s(){let a=r,{length:u}=arguments;for(let v=0,E=u;v<E;v++){let h=arguments[v];if(typeof h=="function"||typeof h=="object"&&h!==null){let y=a.o;y===null&&(a.o=y=new WeakMap);let S=y.get(h);S===void 0?(a=bs(),y.set(h,a)):a=S}else{let y=a.p;y===null&&(a.p=y=new Map);let S=y.get(h);S===void 0?(a=bs(),y.set(h,a)):a=S}}let c=a,g;if(a.s===Wf)g=a.v;else if(g=e.apply(null,arguments),i++,n){let v=Lw(o);v!=null&&n(v,g)&&(g=v,i!==0&&i--),o=typeof g=="object"&&g!==null||typeof g=="function"?new Kf(g):g}return c.s=Wf,c.v=g,g}return s.clearCache=()=>{r=bs(),s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function jw(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,s=0,a,u={},c=o.pop();typeof c=="object"&&(u=c,c=o.pop()),kw(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);let g={...r,...u},{memoize:v,memoizeOptions:E=[],argsMemoize:h=Jo,argsMemoizeOptions:y=[]}=g,S=zf(E),x=zf(y),I=Pw(o),T=v(function(){return i++,c.apply(null,arguments)},...S),R=!0,k=h(function(){s++;let F=Nw(I,arguments);return a=T.apply(null,F),a},...x);return Object.assign(k,{resultFunc:c,memoizedResultFunc:T,dependencies:I,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>a,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var je=jw(Jo);m();d();f();p();function Yf(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var Xf=Yf(),Zf=Yf;var qw=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?qo:qo.apply(null,arguments)},AD=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},Uw=e=>e&&typeof e.match=="function";function G(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(ct(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=>Uo(n)&&n.type===e,r}var sm=class ei extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,ei.prototype)}static get[Symbol.species](){return ei}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new ei(...t[0].concat(this)):new ei(...t.concat(this))}};function Jf(e){return at(e)?$r(e,()=>{}):e}function ws(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function Vw(e){return typeof e=="boolean"}var Gw=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},s=new sm;return r&&(Vw(r)?s.push(Xf):s.push(Zf(r.extraArgument))),s},ti="RTK_autoBatch",Vn=()=>e=>({payload:e,meta:{[ti]:!0}}),em=e=>t=>{setTimeout(t,e)},Bw=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(i),clearTimeout(s),r())},i=e(o),s=setTimeout(o,t)},$w=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,s=!1,a=new Set,u=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?Bw(window.requestAnimationFrame,100):em(10):e.type==="callback"?e.queueNotification:em(e.timeout),c=()=>{s=!1,i&&(i=!1,a.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let v=()=>o&&g(),E=n.subscribe(v);return a.add(g),()=>{E(),a.delete(g)}},dispatch(g){try{return o=!g?.meta?.[ti],i=!o,i&&(s||(s=!0,u(c))),n.dispatch(g)}finally{o=!0}}})},Qw=e=>function(r){let{autoBatch:n=!0}=r??{},o=new sm(e);return n&&o.push($w(typeof n=="object"?n:void 0)),o};function am(e){let t=Gw(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:s=void 0,enhancers:a=void 0}=e||{},u;if(typeof r=="function")u=r;else if(qt(r))u=Ln(r);else throw new Error(ct(1));let c;typeof n=="function"?c=n(t):c=t();let g=qo;o&&(g=qw({trace:!1,...(typeof o=="object"&&o)}));let v=kf(...c),E=Qw(v),h=typeof a=="function"?a(E):E(),y=g(...h);return Qu(u,s,y)}function cm(e){let t={},r=[],n,o={addCase(i,s){let a=typeof i=="string"?i:i.type;if(!a)throw new Error(ct(28));if(a in t)throw new Error(ct(29));return t[a]=s,o},addAsyncThunk(i,s){return s.pending&&(t[i.pending.type]=s.pending),s.rejected&&(t[i.rejected.type]=s.rejected),s.fulfilled&&(t[i.fulfilled.type]=s.fulfilled),s.settled&&r.push({matcher:i.settled,reducer:s.settled}),o},addMatcher(i,s){return r.push({matcher:i,reducer:s}),o},addDefaultCase(i){return n=i,o}};return e(o),[t,r,n]}function Hw(e){return typeof e=="function"}function Ge(e,t){let[r,n,o]=cm(t),i;if(Hw(e))i=()=>Jf(e());else{let a=Jf(e);i=()=>a}function s(a=i(),u){let c=[r[u.type],...n.filter(({matcher:g})=>g(u)).map(({reducer:g})=>g)];return c.filter(g=>!!g).length===0&&(c=[o]),c.reduce((g,v)=>{if(v)if(st(g)){let h=v(g,u);return h===void 0?g:h}else{if(at(g))return $r(g,E=>v(E,u));{let E=v(g,u);if(E===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return E}}return g},a)}return s.getInitialState=i,s}var um=(e,t)=>Uw(e)?e.match(t):e(t);function Ut(...e){return t=>e.some(r=>um(r,t))}function Un(...e){return t=>e.every(r=>um(r,t))}function Is(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 ri(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Rs(...e){return e.length===0?t=>Is(t,["pending"]):ri(e)?Ut(...e.map(t=>t.pending)):Rs()(e[0])}function Hr(...e){return e.length===0?t=>Is(t,["rejected"]):ri(e)?Ut(...e.map(t=>t.rejected)):Hr()(e[0])}function ni(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Un(Hr(...e),t):ri(e)?Un(Hr(...e),t):ni()(e[0])}function or(...e){return e.length===0?t=>Is(t,["fulfilled"]):ri(e)?Ut(...e.map(t=>t.fulfilled)):or()(e[0])}function Ts(...e){return e.length===0?t=>Is(t,["pending","fulfilled","rejected"]):ri(e)?Ut(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Ts()(e[0])}var zw="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",oi=(e=21)=>{let t="",r=e;for(;r--;)t+=zw[Math.random()*64|0];return t},Ww=["name","message","stack","code"],il=class{constructor(e,t){oe(this,"payload");oe(this,"meta");oe(this,"_type");this.payload=e,this.meta=t}},tm=class{constructor(e,t){oe(this,"payload");oe(this,"meta");oe(this,"_type");this.payload=e,this.meta=t}},Kw=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of Ww)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},rm="External signal was aborted",we=(()=>{function e(t,r,n){let o=G(t+"/fulfilled",(u,c,g,v)=>({payload:u,meta:{...(v||{}),arg:g,requestId:c,requestStatus:"fulfilled"}})),i=G(t+"/pending",(u,c,g)=>({payload:void 0,meta:{...(g||{}),arg:c,requestId:u,requestStatus:"pending"}})),s=G(t+"/rejected",(u,c,g,v,E)=>({payload:v,error:(n&&n.serializeError||Kw)(u||"Rejected"),meta:{...(E||{}),arg:g,requestId:c,rejectedWithValue:!!v,requestStatus:"rejected",aborted:u?.name==="AbortError",condition:u?.name==="ConditionError"}}));function a(u,{signal:c}={}){return(g,v,E)=>{let h=n?.idGenerator?n.idGenerator(u):oi(),y=new l.AbortController,S,x;function I(R){x=R,y.abort()}c&&(c.aborted?I(rm):c.addEventListener("abort",()=>I(rm),{once:!0}));let T=_asyncToGenerator(function*(){let R;try{let _=n?.condition?.(u,{getState:v,extra:E});if(Xw(_)&&(_=yield _),_===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let F=new Promise((V,j)=>{S=()=>{j({name:"AbortError",message:x||"Aborted"})},y.signal.addEventListener("abort",S,{once:!0})});g(i(h,u,n?.getPendingMeta?.({requestId:h,arg:u},{getState:v,extra:E}))),R=yield Promise.race([F,Promise.resolve(r(u,{dispatch:g,getState:v,extra:E,requestId:h,signal:y.signal,abort:I,rejectWithValue:(V,j)=>new il(V,j),fulfillWithValue:(V,j)=>new tm(V,j)})).then(V=>{if(V instanceof il)throw V;return V instanceof tm?o(V.payload,h,u,V.meta):o(V,h,u)})])}catch(_){R=_ instanceof il?s(null,h,u,_.payload,_.meta):s(_,h,u)}finally{S&&y.signal.removeEventListener("abort",S)}return n&&!n.dispatchConditionRejection&&s.match(R)&&R.meta.condition||g(R),R})();return Object.assign(T,{abort:I,requestId:h,arg:u,unwrap(){return T.then(Yw)}})}}return Object.assign(a,{pending:i,rejected:s,fulfilled:o,settled:Ut(s,o),typePrefix:t})}return e.withTypes=()=>e,e})();function Yw(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Xw(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var lm=Symbol.for("rtk-slice-createasyncthunk"),wD={[lm]:we};function Zw(e,t){return`${e}/${t}`}function Jw({creators:e}={}){let t=e?.asyncThunk?.[lm];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(ct(11));typeof process<"u";let s=(typeof n.reducers=="function"?n.reducers(tC()):n.reducers)||{},a=Object.keys(s),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(R,k){let _=typeof R=="string"?R:R.type;if(!_)throw new Error(ct(12));if(_ in u.sliceCaseReducersByType)throw new Error(ct(13));return u.sliceCaseReducersByType[_]=k,c},addMatcher(R,k){return u.sliceMatchers.push({matcher:R,reducer:k}),c},exposeAction(R,k){return u.actionCreators[R]=k,c},exposeCaseReducer(R,k){return u.sliceCaseReducersByName[R]=k,c}};a.forEach(R=>{let k=s[R],_={reducerName:R,type:Zw(o,R),createNotation:typeof n.reducers=="function"};nC(k)?iC(_,k,c,t):rC(_,k,c)});function g(){let[R={},k=[],_=void 0]=typeof n.extraReducers=="function"?cm(n.extraReducers):[n.extraReducers],F={...R,...u.sliceCaseReducersByType};return Ge(n.initialState,V=>{for(let j in F)V.addCase(j,F[j]);for(let j of u.sliceMatchers)V.addMatcher(j.matcher,j.reducer);for(let j of k)V.addMatcher(j.matcher,j.reducer);_&&V.addDefaultCase(_)})}let v=R=>R,E=new Map,h=new WeakMap,y;function S(R,k){return y||(y=g()),y(R,k)}function x(){return y||(y=g()),y.getInitialState()}function I(R,k=!1){function _(V){let j=V[R];return typeof j>"u"&&k&&(j=ws(h,_,x)),j}function F(V=v){let j=ws(E,k,()=>new WeakMap);return ws(j,V,()=>{let L={};for(let[U,M]of Object.entries(n.selectors??{}))L[U]=eC(M,V,()=>ws(h,V,x),k);return L})}return{reducerPath:R,getSelectors:F,get selectors(){return F(_)},selectSlice:_}}let T={name:o,reducer:S,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:x,...I(i),injectInto(R,{reducerPath:k,..._}={}){let F=k??i;return R.inject({reducerPath:F,reducer:S},_),{...T,...I(F,!0)}}};return T}}function eC(e,t,r,n){function o(i,...s){let a=t(i);return typeof a>"u"&&n&&(a=r()),e(a,...s)}return o.unwrapped=e,o}var zr=Jw();function tC(){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 rC({type:e,reducerName:t,createNotation:r},n,o){let i,s;if("reducer"in n){if(r&&!oC(n))throw new Error(ct(17));i=n.reducer,s=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?G(e,s):G(e))}function nC(e){return e._reducerDefinitionType==="asyncThunk"}function oC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function iC({type:e,reducerName:t},r,n,o){if(!o)throw new Error(ct(18));let{payloadCreator:i,fulfilled:s,pending:a,rejected:u,settled:c,options:g}=r,v=o(e,i,g);n.exposeAction(t,v),s&&n.addCase(v.fulfilled,s),a&&n.addCase(v.pending,a),u&&n.addCase(v.rejected,u),c&&n.addMatcher(v.settled,c),n.exposeCaseReducer(t,{fulfilled:s||Cs,pending:a||Cs,rejected:u||Cs,settled:c||Cs})}function Cs(){}var sC="task",dm="listener",pm="completed",cl="cancelled",aC=`task-${cl}`,cC=`task-${pm}`,sl=`${dm}-${cl}`,uC=`${dm}-${pm}`,_s=class{constructor(e){oe(this,"code");oe(this,"name","TaskAbortError");oe(this,"message");this.code=e,this.message=`${sC} ${cl} (reason: ${e})`}},ul=(e,t)=>{if(typeof e!="function")throw new TypeError(ct(32))},xs=()=>{},fm=(e,t=xs)=>(e.catch(t),e),mm=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Qr=e=>{if(e.aborted)throw new _s(e.reason)};function gm(e,t){let r=xs;return new Promise((n,o)=>{let i=()=>o(new _s(e.reason));if(e.aborted){i();return}r=mm(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=xs})}var lC=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof _s?"cancelled":"rejected",error:r}}finally{t?.()}});return function lC(_x5,_x6){return _ref5.apply(this,arguments)}}(),Es=e=>t=>fm(gm(e,t).then(r=>(Qr(e),r))),hm=e=>{let t=Es(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:qn}=Object,nm={},ks="listenerMiddleware",dC=(e,t)=>{let r=n=>mm(e,()=>n.abort(e.reason));return(n,o)=>{ul(n,"taskExecutor");let i=new l.AbortController;r(i);let s=lC(/*#__PURE__*/_asyncToGenerator(function*(){Qr(e),Qr(i.signal);let a=yield n({pause:Es(i.signal),delay:hm(i.signal),signal:i.signal});return Qr(i.signal),a}),()=>i.abort(cC));return o?.autoJoin&&t.push(s.catch(xs)),{result:Es(e)(s),cancel(){i.abort(aC)}}}},pC=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){Qr(t);let i=()=>{},a=[new Promise((u,c)=>{let g=e({predicate:n,effect:(v,E)=>{E.unsubscribe(),u([v,E.getState(),E.getOriginalState()])}});i=()=>{g(),c()}})];o!=null&&a.push(new Promise(u=>setTimeout(u,o,null)));try{let u=yield gm(t,Promise.race(a));return Qr(t),u}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>fm(r(n,o))},ym=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=G(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(ct(21));return ul(i,"options.listener"),{predicate:o,type:t,effect:i}},vm=qn(e=>{let{type:t,predicate:r,effect:n}=ym(e);return{id:oi(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(ct(22))}}},{withTypes:()=>vm}),om=(e,t)=>{let{type:r,effect:n,predicate:o}=ym(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},al=e=>{e.pending.forEach(t=>{t.abort(sl)})},fC=(e,t)=>()=>{for(let r of t.keys())al(r);e.clear()},im=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Sm=qn(G(`${ks}/add`),{withTypes:()=>Sm}),mC=G(`${ks}/removeAll`),Am=qn(G(`${ks}/remove`),{withTypes:()=>Am}),gC=(...e)=>{console.error(`${ks}/error`,...e)},bm=(e={})=>{let t=new Map,r=new Map,n=h=>{let y=r.get(h)??0;r.set(h,y+1)},o=h=>{let y=r.get(h)??1;y===1?r.delete(h):r.set(h,y-1)},{extra:i,onError:s=gC}=e;ul(s,"onError");let a=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&al(h)}),u=h=>{let y=om(t,h)??vm(h);return a(y)};qn(u,{withTypes:()=>u});let c=h=>{let y=om(t,h);return y&&(y.unsubscribe(),h.cancelActive&&al(y)),!!y};qn(c,{withTypes:()=>c});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,S,x){let I=new l.AbortController,T=pC(u,I.signal),R=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(y,qn({},S,{getOriginalState:x,condition:(k,_)=>T(k,_).then(Boolean),take:T,delay:hm(I.signal),pause:Es(I.signal),extra:i,signal:I.signal,fork:dC(I.signal,R),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((k,_,F)=>{k!==I&&(k.abort(sl),F.delete(k))})},cancel:()=>{I.abort(sl),h.pending.delete(I)},throwIfCancelled:()=>{Qr(I.signal)}})))}catch(k){k instanceof _s||im(s,k,{raisedBy:"effect"})}finally{yield Promise.all(R),I.abort(uC),o(h),h.pending.delete(I)}});return function g(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),v=fC(t,r);return{middleware:h=>y=>S=>{if(!Uo(S))return y(S);if(Sm.match(S))return u(S.payload);if(mC.match(S)){v();return}if(Am.match(S))return c(S.payload);let x=h.getState(),I=()=>{if(x===nm)throw new Error(ct(23));return x},T;try{if(T=y(S),t.size>0){let R=h.getState(),k=Array.from(t.values());for(let _ of k){let F=!1;try{F=_.predicate(S,R,x)}catch(V){F=!1,im(s,V,{raisedBy:"predicate"})}F&&g(_,S,h,I)}}}finally{x=nm}return T},startListening:u,stopListening:c,clearListeners:v}};function ct(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}m();d();f();p();var ee=new re({required:!0,emptyAllowed:!1}),Be=new re({required:!1,emptyAllowed:!1}),Nt=new re({required:!0,emptyAllowed:!0}),FD=new re({required:!1,emptyAllowed:!0}),wm=new Pt({each:ee,required:!0}),Cm=new re({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),xm=new re({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),DD=new re({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),hC=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),ll=(e,t)=>{if("required"in t)return{payload:new Ot({value:t}).validate({value:e}).value};let o=new Ce({options:{required:!0},values:t}).validate(e);if(o)throw new ju(o);return{payload:e}},W=(e,t)=>{try{return ll(e,t)}catch(r){return{payload:e,error:hC(r)}}};var Os=(e,t,r,n)=>{let o=`Check the options of ${n}`;return yC(e,t,r,o,"Controller initialization error")},yC=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};var Ps=G("caseAssistConfiguration/set",e=>W(e,{caseAssistId:ee,locale:Be,proxyBaseUrl:new re({required:!1,url:!0})}));m();d();f();p();m();d();f();p();var Em=()=>({caseAssistId:"",locale:"en-US"});var yr=Ge(Em(),e=>{e.addCase(Ps,(t,r)=>{t.caseAssistId=r.payload.caseAssistId,t.locale=r.payload.locale,t.apiBaseUrl=r.payload.proxyBaseUrl})});m();d();f();p();m();d();f();p();m();d();f();p();var Im={q:new re,enableQuerySyntax:new Le,aq:new re,cq:new re,firstResult:new Fe({min:0}),numberOfResults:new Fe({min:0}),sortCriteria:new re,f:new Ce,fExcluded:new Ce,cf:new Ce,nf:new Ce,mnf:new Ce,df:new Ce,debug:new Le,sf:new Ce,tab:new re,af:new Ce};var Ns=G("searchParameters/restore",e=>W(e,Im)),Rm=G("searchParameters/restoreTab",e=>W(e,ee));m();d();f();p();var Tm=G("debug/enable"),_m=G("debug/disable");m();d();f();p();var Fs=()=>!1;var km=Ge(Fs(),e=>{e.addCase(Tm,()=>!0).addCase(_m,()=>!1).addCase(Ns,(t,r)=>r.payload.debug??t)});m();d();f();p();var Ds=G("searchHub/set",e=>W(e,new re({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var Gn="3.52.0",Om=["@coveo/atomic","@coveo/quantic"];var dl=()=>Be,Pm=()=>ee,Bn=G("configuration/updateBasicConfiguration",e=>W(e,{accessToken:Be,environment:new re({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:Be})),Ms=G("configuration/updateSearchConfiguration",e=>W(e,{proxyBaseUrl:new re({required:!1,url:!0}),pipeline:new re({required:!1,emptyAllowed:!0}),searchHub:Be,timezone:Be,locale:Be,authenticationProviders:new Pt({required:!1,each:ee})})),vC={enabled:new Le({default:!0}),originContext:dl(),originLevel2:dl(),originLevel3:dl(),proxyBaseUrl:new re({required:!1,url:!0}),runtimeEnvironment:new qr,anonymous:new Le({default:!1}),deviceId:Be,userDisplayName:Be,documentLocation:Be,trackingId:xm,analyticsMode:new re({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new Ce({options:{required:!1},values:Om.reduce((e,t)=>(e[t]=Cm,e),{})})},Ls=G("configuration/updateAnalyticsConfiguration",e=>W(e,vC)),js=G("configuration/analytics/disable"),qs=G("configuration/analytics/enable"),Nm=G("configuration/analytics/originlevel2",e=>W(e,{originLevel2:Pm()})),Fm=G("configuration/analytics/originlevel3",e=>W(e,{originLevel3:Pm()})),Dm=G("knowledge/setAgentId",e=>W(e,new re({required:!0})));m();d();f();p();var SC=G("history/undo"),AC=G("history/redo"),Vt=G("history/snapshot"),dL=we("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(SC()),yield t(Us())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),pL=we("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(AC()),yield t(Us())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),Us=we("history/change",/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x15,_x16){return _ref1.apply(this,arguments)}}());m();d();f();p();var $n=()=>"default";var Mm=Ge($n(),e=>{e.addCase(Ds,(t,r)=>r.payload).addCase(Us.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Ms,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function Lm(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}m();d();f();p();m();d();f();p();m();d();f();p();var jm=/^(?:[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 bC(e){return typeof e=="string"&&jm.test(e)}var pl=bC;m();d();f();p();var Xe=[];for(let e=0;e<256;++e)Xe.push((e+256).toString(16).slice(1));function qm(e,t=0){return(Xe[e[t+0]]+Xe[e[t+1]]+Xe[e[t+2]]+Xe[e[t+3]]+"-"+Xe[e[t+4]]+Xe[e[t+5]]+"-"+Xe[e[t+6]]+Xe[e[t+7]]+"-"+Xe[e[t+8]]+Xe[e[t+9]]+"-"+Xe[e[t+10]]+Xe[e[t+11]]+Xe[e[t+12]]+Xe[e[t+13]]+Xe[e[t+14]]+Xe[e[t+15]]).toLowerCase()}m();d();f();p();var fl,wC=new Uint8Array(16);function ml(){if(!fl){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");fl=crypto.getRandomValues.bind(crypto)}return fl(wC)}m();d();f();p();m();d();f();p();var CC=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),gl={randomUUID:CC};function xC(e,t,r){e=e||{};let n=e.random??e.rng?.()??ml();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 qm(n)}function EC(e,t,r){return gl.randomUUID&&!t&&!e?gl.randomUUID():xC(e,t,r)}var hl=EC;function IC(_x17){return _IC.apply(this,arguments)}function _IC(){_IC=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:i,mode:s}=e;if(s!=="disabled")return n.call(r),t.send(o,i,r)});return _IC.apply(this,arguments)}var Qm="2.1.1",yl=128,Hm=192,Um=224,Vm=240,RC=248;function TC(e){return(e&RC)===Vm?4:(e&Vm)===Um?3:(e&Um)===Hm?2:1}function _C(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&yl)!=yl)break;if(r-=3,(n&Hm)!=yl){t-r>=TC(n)*3&&(r=t);break}}return e.substring(0,r)}function kC(e){let{trackingId:t}=e;return{trackingId:t}}function OC(e){return(e.source||[]).concat([`relay@${Qm}`])}function zm(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,s=kC(t),a=r.getClientId();return Object.freeze({type:e,config:s,ts:Date.now(),source:OC(t),clientId:a,userAgent:i(),referrer:Gm(n()),location:Gm(o())})}function Gm(e){return e!==null?_C(e,1024):null}function PC(e,t,r,n){return{...t,meta:zm(e,r,n)}}var NC="*";function FC(){let e=[];function t({type:u,callback:c}){return e.findIndex(g=>g.type===u&&g.callback===c)}function r(u,c){return u.type==="*"||c===u.type}function n(u){return t(u)<0&&e.push(u),()=>a(u.type,u.callback)}function o(u){e.forEach(c=>{if(r(c,u.meta.type))try{c.callback(u)}catch(g){console.error(g)}})}function i(u){if(u===NC)e.length=0;else for(let c=e.length-1;c>=0;c--)e[c].type===u&&e.splice(c,1)}function s(u){let c=t(u);c>=0&&e.splice(c,1)}function a(u,c){c?s({type:u,callback:c}):i(u)}return{add:n,call:o,remove:a}}function Bm({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 DC(e){let t=Bm(e);return{get:()=>t,update:r=>{t=Bm({...t,...r})}}}var vl=MC();function MC(){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 i of o){let s=i.replace(/^\s+/,"");if(s.lastIndexOf(n,0)===0)return s.substring(n.length,s.length)}return null},setItem(r,n,o){let i=t(window.location.hostname),s=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,a=i?`;domain=${i}`:"";document.cookie=`${e}${r}=${n}${s}${a};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function LC(){return{getItem(e){return vl.getItem(e)||localStorage.getItem(e)},removeItem(e){vl.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),vl.setItem(e,t,31556952e3)}}}var $m="visitorId";function jC(){let e=document.referrer;return e===""?null:e}function Sl(){let e=LC();return{runtime:"browser",send:function(){var _ref10=_asyncToGenerator(function*(t,r,n){let o=w(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});Lm().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let s=yield o;if(s?.ok){let a;try{a=yield s.json()}catch{return}for(let u of a.events)if(!u.accepted)throw new Error(`Received event was rejected for processing: ${u.errorMessage}`)}else throw new Error(`Error ${s.status}: Failed to send the event(s).`)});return function send(_x18,_x19,_x20){return _ref10.apply(this,arguments)}}(),getReferrer:()=>jC(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem($m);if(t&&pl(t))return t;let r=hl();return e.setItem($m,r),r}}}function qC(){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 UC(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function VC(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=UC();return t&&r?{...r,runtime:"custom"}:t&&GC()&&qC()?Sl():n}function GC(){try{return typeof window=="object"}catch{return!1}}function BC(e){return{get:()=>Object.freeze(VC(e))}}function Wm(e){let t=DC(e),r=FC(),n=BC(t);return{emit:function(){var _ref11=_asyncToGenerator(function*(o,i){let s=t.get(),a=n.get(),u=PC(o,i,s,a);return IC({config:s,environment:a,event:u,listenerManager:r})});return function emit(_x21,_x22){return _ref11.apply(this,arguments)}}(),getMeta:o=>zm(o,t.get(),n.get()),on:(o,i)=>r.add({type:o,callback:i}),off:(o,i)=>r.remove(o,i),updateConfig:o=>t.update(o),version:Qm}}m();d();f();p();function Km(){return typeof window<"u"&&typeof document<"u"}m();d();f();p();var Qn=je(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Gn}`));var ii=je(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Qn(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},s,a)=>{let u=QC(a);return Wm({mode:i?"emit":"disabled",url:o??es(e,t),token:r,trackingId:n??null,source:s,environment:u})}),$C={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref12=_asyncToGenerator(function*(){});return function send(){return _ref12.apply(this,arguments)}}()},QC=e=>{if(!e)return;let t=e();return{...(Km()?Sl():$C),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();m();d();f();p();m();d();f();p();var Ym=class extends Error{constructor(t){super(t[0].message);oe(this,"issues");this.name="SchemaError",this.issues=t}};var sr="uninitialized",wl="pending",ai="fulfilled",ci="rejected";function Xm(e){return{status:e,isUninitialized:e===sr,isLoading:e===wl,isSuccess:e===ai,isError:e===ci}}var Zm=qt;function pg(e,t){if(e===t||!(Zm(e)&&Zm(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),o=r.length===n.length,i=Array.isArray(t)?[]:{};for(let s of r)i[s]=pg(e[s],t[s]),o&&(o=e[s]===i[s]);return o?e:i}function Cl(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function HC(e){return new RegExp("(^|:)//").test(e)}function zC(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Rl(e){return e!=null}function Jm(e){return[...(e?.values()??[])].filter(Rl)}function WC(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var KC=e=>e.replace(/\/$/,""),YC=e=>e.replace(/^\//,"");function XC(e,t){if(!e)return t;if(!t)return e;if(HC(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=KC(e),t=YC(t),`${e}${r}${t}`}function Bs(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var xl=()=>new Map,ZC=e=>{let t=new l.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},JC=(...e)=>{for(let r of e)if(r.aborted)return l.AbortSignal.abort(r.reason);let t=new l.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},eg=(...e)=>w(...e),ex=e=>e.status>=200&&e.status<=299,tx=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function tg(e){if(!qt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var rx=e=>typeof e=="object"&&(qt(e)||Array.isArray(e)||typeof e.toJSON=="function");function fg({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=eg,paramsSerializer:n,isJsonContentType:o=tx,jsonContentType:i="application/json",jsonReplacer:s,timeout:a,responseHandler:u,validateStatus:c,...g}={}){return typeof w>"u"&&r===eg&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*(E,h,y){let{getState:S,extra:x,endpoint:I,forced:T,type:R}=h,k,{url:_,headers:F=new C(g.headers),params:V=void 0,responseHandler:j=u??"json",validateStatus:L=c??ex,timeout:U=a,...M}=typeof E=="string"?{url:E}:E,O={...g,signal:U?JC(h.signal,ZC(U)):h.signal,...M};F=new C(tg(F)),O.headers=(yield t(F,{getState:S,arg:E,extra:x,endpoint:I,forced:T,type:R,extraOptions:y}))||F;let P=rx(O.body);if(O.body!=null&&!P&&typeof O.body!="string"&&O.headers.delete("content-type"),!O.headers.has("content-type")&&P&&O.headers.set("content-type",i),P&&o(O.headers)&&(O.body=JSON.stringify(O.body,s)),O.headers.has("accept")||(j==="json"?O.headers.set("accept","application/json"):j==="text"&&O.headers.set("accept","text/plain, text/html, */*")),V){let J=~_.indexOf("?")?"&":"?",ie=n?n(V):new URLSearchParams(tg(V));_+=J+ie}_=XC(e,_);let N=new Request(_,O);k={request:new Request(_,O)};let $;try{$=yield r(N)}catch(J){return{error:{status:(J instanceof Error||typeof DOMException<"u"&&J instanceof DOMException)&&J.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(J)},meta:k}}let Y=$.clone();k.response=Y;let K,H="";try{let J;if(yield Promise.all([v($,j).then(ie=>K=ie,ie=>J=ie),Y.text().then(ie=>H=ie,()=>{})]),J)throw J}catch(J){return{error:{status:"PARSING_ERROR",originalStatus:$.status,data:H,error:String(J)},meta:k}}return L($,K)?{data:K,meta:k}:{error:{status:$.status,data:K},meta:k}});return function(_x23,_x24,_x25){return _ref13.apply(this,arguments)}}());function v(_x26,_x27){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(E,h){if(typeof h=="function")return h(E);if(h==="content-type"&&(h=o(E.headers)?"json":"text"),h==="json"){let y=yield E.text();return y.length?JSON.parse(y):null}return E.text()});return _v2.apply(this,arguments)}}var Hn=class{constructor(e,t=void 0){oe(this,"value");oe(this,"meta");this.value=e,this.meta=t}};function nx(){return _nx.apply(this,arguments)}function _nx(){_nx=_asyncToGenerator(function*(e=0,t=5,r){let n=Math.min(e,t),o=~~((Math.random()+.4)*(300<<n));yield new Promise((i,s)=>{let a=setTimeout(()=>i(),o);if(r){let u=()=>{clearTimeout(a),s(new Error("Aborted"))};r.aborted?(clearTimeout(a),s(new Error("Aborted"))):r.addEventListener("abort",u,{once:!0})}})});return _nx.apply(this,arguments)}function mg(e,t){throw Object.assign(new Hn({error:e,meta:t}),{throwImmediately:!0})}function Al(e){e.aborted&&mg({status:"CUSTOM_ERROR",error:"Aborted"})}var rg={},ox=(e,t)=>(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(r,n,o){let i=[5,(t||rg).maxRetries,(o||rg).maxRetries].filter(g=>g!==void 0),[s]=i.slice(-1),u={maxRetries:s,backoff:nx,retryCondition:(g,v,{attempt:E})=>E<=s,...t,...o},c=0;for(;;){Al(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Hn(g);return g}catch(g){if(c++,g.throwImmediately){if(g instanceof Hn)return g.value;throw g}if(g instanceof Hn){if(!u.retryCondition(g.value.error,r,{attempt:c,baseQueryApi:n,extraOptions:o}))return g.value}else if(c>u.maxRetries)return{error:g};Al(n.signal);try{yield u.backoff(c,u.maxRetries,n.signal)}catch(v){throw Al(n.signal),v}}}});return function(_x28,_x29,_x30){return _ref14.apply(this,arguments)}}()),gg=Object.assign(ox,{fail:mg}),Qs="__rtkq/",ix="online",sx="offline";var hg="focused";var Tl=G(`${Qs}${hg}`),yg=G(`${Qs}un${hg}`),_l=G(`${Qs}${ix}`),vg=G(`${Qs}${sx}`);var di="query",Sg="mutation",Ag="infinitequery";function Hs(e){return e.type===di}function ax(e){return e.type===Sg}function zs(e){return e.type===Ag}function $s(e){return Hs(e)||zs(e)}function kl(e,t,r,n,o,i){let s=cx(e)?e(t,r,n,o):e;return s?Cl(s,Rl,a=>i(bg(a))):[]}function cx(e){return typeof e=="function"}function bg(e){return typeof e=="string"?{type:e}:e}function ux(e,t){return e.catch(t)}var zn=(e,t)=>e.endpointDefinitions[t],ui=Symbol("forceQueryFn"),El=e=>typeof e[ui]=="function";function lx({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:s}){let a=_=>s(_)?.runningQueries,u=_=>s(_)?.runningMutations,{unsubscribeQueryResult:c,removeMutationResult:g,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:T,buildInitiateInfiniteQuery:R,buildInitiateMutation:k,getRunningQueryThunk:E,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:S};function E(_,F){return V=>{let j=zn(i,_),L=e({queryArgs:F,endpointDefinition:j,endpointName:_});return a(V)?.get(L)}}function h(_,F){return V=>u(V)?.get(F)}function y(){return _=>Jm(a(_))}function S(){return _=>Jm(u(_))}function x(_){}function I(_,F){let V=(j,{subscribe:L=!0,forceRefetch:U,subscriptionOptions:M,[ui]:O,...P}={})=>(N,Q)=>{let $=e({queryArgs:j,endpointDefinition:F,endpointName:_}),Y,K={...P,type:di,subscribe:L,forceRefetch:U,subscriptionOptions:M,endpointName:_,originalArgs:j,queryCacheKey:$,[ui]:O};if(Hs(F))Y=t(K);else{let{direction:de,initialPageParam:ge,refetchCachedPages:fe}=P;Y=r({...K,direction:de,initialPageParam:ge,refetchCachedPages:fe})}let H=o.endpoints[_].select(j),J=N(Y),ie=H(Q());let{requestId:be,abort:Oe}=J,Ie=ie.requestId!==be,Te=a(N)?.get($),_e=()=>H(Q()),pe=Object.assign(O?J.then(_e):Ie&&!Te?Promise.resolve(ie):Promise.all([Te,J]).then(_e),{arg:j,requestId:be,subscriptionOptions:M,queryCacheKey:$,abort:Oe,unwrap(){return _asyncToGenerator(function*(){let de=yield pe;if(de.isError)throw de.error;return de.data})()},refetch:de=>N(V(j,{subscribe:!1,forceRefetch:!0,...de})),unsubscribe(){L&&N(c({queryCacheKey:$,requestId:be}))},updateSubscriptionOptions(de){pe.subscriptionOptions=de,N(v({endpointName:_,requestId:be,queryCacheKey:$,options:de}))}});if(!Te&&!Ie&&!O){let de=a(N);de.set($,pe),pe.then(()=>{de.delete($)})}return pe};return V}function T(_,F){return I(_,F)}function R(_,F){return I(_,F)}function k(_){return(F,{track:V=!0,fixedCacheKey:j}={})=>(L,U)=>{let M=n({type:"mutation",endpointName:_,originalArgs:F,track:V,fixedCacheKey:j}),O=L(M);let{requestId:P,abort:N,unwrap:Q}=O,$=ux(O.unwrap().then(J=>({data:J})),J=>({error:J})),Y=()=>{L(g({requestId:P,fixedCacheKey:j}))},K=Object.assign($,{arg:O.arg,requestId:P,abort:N,unwrap:Q,reset:Y}),H=u(L);return H.set(P,K),K.then(()=>{H.delete(P)}),j&&(H.set(j,K),K.then(()=>{H.get(j)===K&&H.delete(j)})),K}}}var wg=class extends Ym{constructor(t,r,n,o){super(t);oe(this,"value");oe(this,"schemaName");oe(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},Wr=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function Kr(_x31,_x32,_x33,_x34){return _Kr.apply(this,arguments)}function _Kr(){_Kr=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new wg(o.issues,t,r,n);return o.value});return _Kr.apply(this,arguments)}function ng(e){return e}var si=(e={})=>({...e,[ti]:!0});function dx({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:s,onSchemaFailure:a,catchSchemaFailure:u,skipSchemaValidation:c}){let g=(M,O,P,N)=>(Q,$)=>{let Y=r[M],K=n({queryArgs:O,endpointDefinition:Y,endpointName:M});if(Q(o.internalActions.queryResultPatched({queryCacheKey:K,patches:P})),!N)return;let H=o.endpoints[M].select(O)($()),J=kl(Y.providesTags,H.data,void 0,O,{},i);Q(o.internalActions.updateProvidedBy([{queryCacheKey:K,providedTags:J}]))};function v(M,O,P=0){let N=[O,...M];return P&&N.length>P?N.slice(0,-1):N}function E(M,O,P=0){let N=[...M,O];return P&&N.length>P?N.slice(1):N}let h=(M,O,P,N=!0)=>(Q,$)=>{let K=o.endpoints[M].select(O)($()),H={patches:[],inversePatches:[],undo:()=>Q(o.util.patchQueryData(M,O,H.inversePatches,N))};if(K.status===sr)return H;let J;if("data"in K)if(at(K.data)){let[ie,be,Oe]=nl(K.data,P);H.patches.push(...be),H.inversePatches.push(...Oe),J=ie}else J=P(K.data),H.patches.push({op:"replace",path:[],value:J}),H.inversePatches.push({op:"replace",path:[],value:K.data});return H.patches.length===0||Q(o.util.patchQueryData(M,O,H.patches,N)),H},y=(M,O,P)=>N=>N(o.endpoints[M].initiate(O,{subscribe:!1,forceRefetch:!0,[ui]:()=>({data:P})})),S=(M,O)=>M.query&&M[O]?M[O]:ng,x=/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(M,{signal:O,abort:P,rejectWithValue:N,fulfillWithValue:Q,dispatch:$,getState:Y,extra:K}){let H=r[M.endpointName],{metaSchema:J,skipSchemaValidation:ie=c}=H,be=M.type===di;try{let Oe=ng,Ie={signal:O,abort:P,dispatch:$,getState:Y,extra:K,endpoint:M.endpointName,type:M.type,forced:be?I(M,Y()):void 0,queryCacheKey:be?M.queryCacheKey:void 0},Te=be?M[ui]:void 0,_e,pe=/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(ge,fe,Ue,$e){if(fe==null&&ge.pages.length)return Promise.resolve({data:ge});let Tt={queryArg:M.originalArgs,pageParam:fe},mt=yield de(Tt),jt=$e?v:E;return{data:{pages:jt(ge.pages,mt.data,Ue),pageParams:jt(ge.pageParams,fe,Ue)},meta:mt.meta}});return function pe(_x37,_x38,_x39,_x40){return _ref16.apply(this,arguments)}}();function de(_x41){return _de.apply(this,arguments)}function _de(){_de=_asyncToGenerator(function*(ge){let fe,{extraOptions:Ue,argSchema:$e,rawResponseSchema:Tt,responseSchema:mt}=H;if($e&&!Wr(ie,"arg")&&(ge=yield Kr($e,ge,"argSchema",{})),Te?fe=Te():H.query?(Oe=S(H,"transformResponse"),fe=yield t(H.query(ge),Ie,Ue)):fe=yield H.queryFn(ge,Ie,Ue,_t=>t(_t,Ie,Ue)),typeof process<"u",fe.error)throw new Hn(fe.error,fe.meta);let{data:jt}=fe;Tt&&!Wr(ie,"rawResponse")&&(jt=yield Kr(Tt,fe.data,"rawResponseSchema",fe.meta));let St=yield Oe(jt,fe.meta,ge);return mt&&!Wr(ie,"response")&&(St=yield Kr(mt,St,"responseSchema",fe.meta)),{...fe,data:St}});return _de.apply(this,arguments)}if(be&&"infiniteQueryOptions"in H){let{infiniteQueryOptions:ge}=H,{maxPages:fe=1/0}=ge,Ue=M.refetchCachedPages??ge.refetchCachedPages??!0,$e,Tt={pages:[],pageParams:[]},mt=s.selectQueryEntry(Y(),M.queryCacheKey)?.data,St=I(M,Y())&&!M.direction||!mt?Tt:mt;if("direction"in M&&M.direction&&St.pages.length){let _t=M.direction==="backward",Hi=(_t?Cg:Il)(ge,St,M.originalArgs);$e=yield pe(St,Hi,fe,_t)}else{let{initialPageParam:_t=ge.initialPageParam}=M,Oo=mt?.pageParams??[],Hi=Oo[0]??_t,$A=Oo.length;if($e=yield pe(St,Hi,fe),Te&&($e={data:$e.data.pages[0]}),Ue)for(let Vp=1;Vp<$A;Vp++){let QA=Il(ge,$e.data,M.originalArgs);$e=yield pe($e.data,QA,fe)}}_e=$e}else _e=yield de(M.originalArgs);return J&&!Wr(ie,"meta")&&_e.meta&&(_e.meta=yield Kr(J,_e.meta,"metaSchema",_e.meta)),Q(_e.data,si({fulfilledTimeStamp:Date.now(),baseQueryMeta:_e.meta}))}catch(Oe){let Ie=Oe;if(Ie instanceof Hn){let Te=S(H,"transformErrorResponse"),{rawErrorResponseSchema:_e,errorResponseSchema:pe}=H,{value:de,meta:ge}=Ie;try{_e&&!Wr(ie,"rawErrorResponse")&&(de=yield Kr(_e,de,"rawErrorResponseSchema",ge)),J&&!Wr(ie,"meta")&&(ge=yield Kr(J,ge,"metaSchema",ge));let fe=yield Te(de,ge,M.originalArgs);return pe&&!Wr(ie,"errorResponse")&&(fe=yield Kr(pe,fe,"errorResponseSchema",ge)),N(fe,si({baseQueryMeta:ge}))}catch(fe){Ie=fe}}try{if(Ie instanceof wg){let Te={endpoint:M.endpointName,arg:M.originalArgs,type:M.type,queryCacheKey:be?M.queryCacheKey:void 0};H.onSchemaFailure?.(Ie,Te),a?.(Ie,Te);let{catchSchemaFailure:_e=u}=H;if(_e)return N(_e(Ie,Te),si({baseQueryMeta:Ie._bqMeta}))}}catch(Te){Ie=Te}throw typeof process<"u",console.error(Ie),Ie}});return function x(_x35,_x36){return _ref15.apply(this,arguments)}}();function I(M,O){let P=s.selectQueryEntry(O,M.queryCacheKey),N=s.selectConfig(O).refetchOnMountOrArgChange,Q=P?.fulfilledTimeStamp,$=M.forceRefetch??(M.subscribe&&N);return $?$===!0||(Number(new Date)-Number(Q))/1e3>=$:!1}let T=()=>we(`${e}/executeQuery`,x,{getPendingMeta({arg:O}){let P=r[O.endpointName];return si({startedTimeStamp:Date.now(),...(zs(P)?{direction:O.direction}:{})})},condition(O,{getState:P}){let N=P(),Q=s.selectQueryEntry(N,O.queryCacheKey),$=Q?.fulfilledTimeStamp,Y=O.originalArgs,K=Q?.originalArgs,H=r[O.endpointName],J=O.direction;return El(O)?!0:Q?.status==="pending"?!1:I(O,N)||Hs(H)&&H?.forceRefetch?.({currentArg:Y,previousArg:K,endpointState:Q,state:N})?!0:!($&&!J)},dispatchConditionRejection:!0}),R=T(),k=T(),_=we(`${e}/executeMutation`,x,{getPendingMeta(){return si({startedTimeStamp:Date.now()})}}),F=M=>"force"in M,V=M=>"ifOlderThan"in M,j=(M,O,P={})=>(N,Q)=>{let $=F(P)&&P.force,Y=V(P)&&P.ifOlderThan,K=(J=!0)=>{let ie={forceRefetch:J,subscribe:!1};return o.endpoints[M].initiate(O,ie)},H=o.endpoints[M].select(O)(Q());if($)N(K());else if(Y){let J=H?.fulfilledTimeStamp;if(!J){N(K());return}(Number(new Date)-Number(new Date(J)))/1e3>=Y&&N(K())}else N(K(!1))};function L(M){return O=>O?.meta?.arg?.endpointName===M}function U(M,O){return{matchPending:Un(Rs(M),L(O)),matchFulfilled:Un(or(M),L(O)),matchRejected:Un(Hr(M),L(O))}}return{queryThunk:R,mutationThunk:_,infiniteQueryThunk:k,prefetch:j,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:U}}function Il(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function Cg(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function xg(e,t,r,n){return kl(r[e.meta.arg.endpointName][t],or(e)?e.payload:void 0,ni(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function og(e){return st(e)?As(e):e}function Vs(e,t,r){let n=e[t];n&&r(n)}function li(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function ig(e,t,r){let n=e[li(t)];n&&r(n)}var Gs={};function px({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:s,hasRehydrationInfo:a},assertTagType:u,config:c}){let g=G(`${e}/resetApiState`);function v(L,U,M,O){var P;L[P=U.queryCacheKey]??(L[P]={status:sr,endpointName:U.endpointName}),Vs(L,U.queryCacheKey,N=>{N.status=wl,N.requestId=M&&N.requestId?N.requestId:O.requestId,U.originalArgs!==void 0&&(N.originalArgs=U.originalArgs),N.startedTimeStamp=O.startedTimeStamp;let Q=o[O.arg.endpointName];zs(Q)&&"direction"in U&&(N.direction=U.direction)})}function E(L,U,M,O){Vs(L,U.arg.queryCacheKey,P=>{if(P.requestId!==U.requestId&&!O)return;let{merge:N}=o[U.arg.endpointName];if(P.status=ai,N){if(P.data!==void 0){let{fulfilledTimeStamp:Q,arg:$,baseQueryMeta:Y,requestId:K}=U,H=$r(P.data,J=>N(J,M,{arg:$.originalArgs,baseQueryMeta:Y,fulfilledTimeStamp:Q,requestId:K}));P.data=H}else P.data=M;}else P.data=o[U.arg.endpointName].structuralSharing??!0?pg(st(P.data)?qf(P.data):P.data,M):M;delete P.error,P.fulfilledTimeStamp=U.fulfilledTimeStamp})}let h=zr({name:`${e}/queries`,initialState:Gs,reducers:{removeQueryResult:{reducer(L,{payload:{queryCacheKey:U}}){delete L[U]},prepare:Vn()},cacheEntriesUpserted:{reducer(L,U){for(let M of U.payload){let{queryDescription:O,value:P}=M;v(L,O,!0,{arg:O,requestId:U.meta.requestId,startedTimeStamp:U.meta.timestamp}),E(L,{arg:O,requestId:U.meta.requestId,fulfilledTimeStamp:U.meta.timestamp,baseQueryMeta:{}},P,!0)}},prepare:L=>({payload:L.map(O=>{let{endpointName:P,arg:N,value:Q}=O,$=o[P];return{queryDescription:{type:di,endpointName:P,originalArgs:O.arg,queryCacheKey:n({queryArgs:N,endpointDefinition:$,endpointName:P})},value:Q}}),meta:{[ti]:!0,requestId:oi(),timestamp:Date.now()}})},queryResultPatched:{reducer(L,{payload:{queryCacheKey:U,patches:M}}){Vs(L,U,O=>{O.data=ol(O.data,M.concat())})},prepare:Vn()}},extraReducers(L){L.addCase(t.pending,(U,{meta:M,meta:{arg:O}})=>{let P=El(O);v(U,O,P,M)}).addCase(t.fulfilled,(U,{meta:M,payload:O})=>{let P=El(M.arg);E(U,M,O,P)}).addCase(t.rejected,(U,{meta:{condition:M,arg:O,requestId:P},error:N,payload:Q})=>{Vs(U,O.queryCacheKey,$=>{if(!M){if($.requestId!==P)return;$.status=ci,$.error=Q??N}})}).addMatcher(a,(U,M)=>{let{queries:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===ai||N?.status===ci)&&(U[P]=N)})}}),y=zr({name:`${e}/mutations`,initialState:Gs,reducers:{removeMutationResult:{reducer(L,{payload:U}){let M=li(U);M in L&&delete L[M]},prepare:Vn()}},extraReducers(L){L.addCase(r.pending,(U,{meta:M,meta:{requestId:O,arg:P,startedTimeStamp:N}})=>{P.track&&(U[li(M)]={requestId:O,status:wl,endpointName:P.endpointName,startedTimeStamp:N})}).addCase(r.fulfilled,(U,{payload:M,meta:O})=>{O.arg.track&&ig(U,O,P=>{P.requestId===O.requestId&&(P.status=ai,P.data=M,P.fulfilledTimeStamp=O.fulfilledTimeStamp)})}).addCase(r.rejected,(U,{payload:M,error:O,meta:P})=>{P.arg.track&&ig(U,P,N=>{N.requestId===P.requestId&&(N.status=ci,N.error=M??O)})}).addMatcher(a,(U,M)=>{let{mutations:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===ai||N?.status===ci)&&P!==N?.requestId&&(U[P]=N)})}}),S={tags:{},keys:{}},x=zr({name:`${e}/invalidation`,initialState:S,reducers:{updateProvidedBy:{reducer(L,U){var M,O,P;for(let{queryCacheKey:N,providedTags:Q}of U.payload){I(L,N);for(let{type:$,id:Y}of Q){let K=(O=(M=L.tags)[$]??(M[$]={}))[P=Y||"__internal_without_id"]??(O[P]=[]);K.includes(N)||K.push(N)}L.keys[N]=Q}},prepare:Vn()}},extraReducers(L){L.addCase(h.actions.removeQueryResult,(U,{payload:{queryCacheKey:M}})=>{I(U,M)}).addMatcher(a,(U,M)=>{var P,N,Q;let{provided:O}=s(M);for(let[$,Y]of Object.entries(O.tags??{}))for(let[K,H]of Object.entries(Y)){let J=(N=(P=U.tags)[$]??(P[$]={}))[Q=K||"__internal_without_id"]??(N[Q]=[]);for(let ie of H)J.includes(ie)||J.push(ie),U.keys[ie]=O.keys[ie]}}).addMatcher(Ut(or(t),ni(t)),(U,M)=>{T(U,[M])}).addMatcher(h.actions.cacheEntriesUpserted.match,(U,M)=>{let O=M.payload.map(({queryDescription:P,value:N})=>({type:"UNKNOWN",payload:N,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:P}}));T(U,O)})}});function I(L,U){let M=og(L.keys[U]??[]);for(let O of M){let P=O.type,N=O.id??"__internal_without_id",Q=L.tags[P]?.[N];Q&&(L.tags[P][N]=og(Q).filter($=>$!==U))}delete L.keys[U]}function T(L,U){let M=U.map(O=>{let P=xg(O,"providesTags",o,u),{queryCacheKey:N}=O.meta.arg;return{queryCacheKey:N,providedTags:P}});x.caseReducers.updateProvidedBy(L,x.actions.updateProvidedBy(M))}let R=zr({name:`${e}/subscriptions`,initialState:Gs,reducers:{updateSubscriptionOptions(L,U){},unsubscribeQueryResult(L,U){},internal_getRTKQSubscriptions(){}}}),k=zr({name:`${e}/internalSubscriptions`,initialState:Gs,reducers:{subscriptionsUpdated:{reducer(L,U){return ol(L,U.payload)},prepare:Vn()}}}),_=zr({name:`${e}/config`,initialState:{online:WC(),focused:zC(),middlewareRegistered:!1,...c},reducers:{middlewareRegistered(L,{payload:U}){L.middlewareRegistered=L.middlewareRegistered==="conflict"||i!==U?"conflict":!0}},extraReducers:L=>{L.addCase(_l,U=>{U.online=!0}).addCase(vg,U=>{U.online=!1}).addCase(Tl,U=>{U.focused=!0}).addCase(yg,U=>{U.focused=!1}).addMatcher(a,U=>({...U}))}}),F=Ln({queries:h.reducer,mutations:y.reducer,provided:x.reducer,subscriptions:k.reducer,config:_.reducer}),V=(L,U)=>F(g.match(U)?void 0:L,U),j={..._.actions,...h.actions,...R.actions,...k.actions,...y.actions,...x.actions,resetApiState:g};return{reducer:V,actions:j}}var bl=Symbol.for("RTKQ/skipToken"),Eg={status:sr},sg=$r(Eg,()=>{}),ag=$r(Eg,()=>{});function fx({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=R=>sg,o=R=>ag;return{buildQuerySelector:E,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:S,selectCachedArgsForQuery:x,selectApiState:s,selectQueries:a,selectMutations:c,selectQueryEntry:u,selectConfig:g};function i(R){return{...R,...Xm(R.status)}}function s(R){return R[t]}function a(R){return s(R)?.queries}function u(R,k){return a(R)?.[k]}function c(R){return s(R)?.mutations}function g(R){return s(R)?.config}function v(R,k,_){return F=>{if(F===bl)return r(n,_);let V=e({queryArgs:F,endpointDefinition:k,endpointName:R});return r(L=>u(L,V)??sg,_)}}function E(R,k){return v(R,k,i)}function h(R,k){let{infiniteQueryOptions:_}=k;function F(V){let j={...V,...Xm(V.status)},{isLoading:L,isError:U,direction:M}=j,O=M==="forward",P=M==="backward";return{...j,hasNextPage:I(_,j.data,j.originalArgs),hasPreviousPage:T(_,j.data,j.originalArgs),isFetchingNextPage:L&&O,isFetchingPreviousPage:L&&P,isFetchNextPageError:U&&O,isFetchPreviousPageError:U&&P}}return v(R,k,F)}function y(){return R=>{let k;return typeof R=="object"?k=li(R)??bl:k=R,r(k===bl?o:V=>s(V)?.mutations?.[k]??ag,i)}}function S(R,k){let _=R[t],F=new Set,V=Cl(k,Rl,bg);for(let j of V){let L=_.provided.tags[j.type];if(!L)continue;let U=(j.id!==void 0?L[j.id]:Object.values(L).flat())??[];for(let M of U)F.add(M)}return Array.from(F.values()).flatMap(j=>{let L=_.queries[j];return L?{queryCacheKey:j,endpointName:L.endpointName,originalArgs:L.originalArgs}:[]})}function x(R,k){return Cl(Object.values(a(R)),_=>_?.endpointName===k&&_.status!==sr,_=>_.originalArgs)}function I(R,k,_){return k?Il(R,k,_)!=null:!1}function T(R,k,_){return!k||!R.getPreviousPageParam?!1:Cg(R,k,_)!=null}}var cg=WeakMap?new WeakMap:void 0,ug=({endpointName:e,queryArgs:t})=>{let r="",n=cg?.get(t);if(typeof n=="string")r=n;else{let o=JSON.stringify(t,(i,s)=>(s=typeof s=="bigint"?{$bigint:s.toString()}:s,s=qt(s)?Object.keys(s).sort().reduce((a,u)=>(a[u]=s[u],a),{}):s,s));qt(t)&&cg?.set(t,o),r=o}return`${e}(${r})`};function mx(...e){return function(r){let n=Jo(c=>r.extractRehydrationInfo?.(c,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(c){let g=ug;if("serializeQueryArgs"in c.endpointDefinition){let v=c.endpointDefinition.serializeQueryArgs;g=E=>{let h=v(E);return typeof h=="string"?h:ug({...E,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(c)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(c){c()},apiUid:oi(),extractRehydrationInfo:n,hasRehydrationInfo:Jo(c=>n(c)!=null)},s={injectEndpoints:u,enhanceEndpoints({addTagTypes:c,endpoints:g}){if(c)for(let v of c)o.tagTypes.includes(v)||o.tagTypes.push(v);if(g)for(let[v,E]of Object.entries(g))typeof E=="function"?E(zn(i,v)):Object.assign(zn(i,v)||{},E);return s}},a=e.map(c=>c.init(s,o,i));function u(c){let g=c.endpoints({query:v=>({...v,type:di}),mutation:v=>({...v,type:Sg}),infiniteQuery:v=>({...v,type:Ag})});for(let[v,E]of Object.entries(g)){if(c.overrideExisting!==!0&&v in i.endpointDefinitions){if(c.overrideExisting==="throw")throw new Error(ct(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[v]=E;for(let h of a)h.injectEndpoint(v,E)}return s}return s.injectEndpoints({endpoints:r.endpoints})}}function ir(e,...t){return Object.assign(e,...t)}var gx=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,i=null,s=null,{updateSubscriptionOptions:a,unsubscribeQueryResult:u}=e.internalActions,c=(S,x)=>{if(a.match(x)){let{queryCacheKey:T,requestId:R,options:k}=x.payload,_=S.get(T);return _?.has(R)&&_.set(R,k),!0}if(u.match(x)){let{queryCacheKey:T,requestId:R}=x.payload,k=S.get(T);return k&&k.delete(R),!0}if(e.internalActions.removeQueryResult.match(x))return S.delete(x.payload.queryCacheKey),!0;if(t.pending.match(x)){let{meta:{arg:T,requestId:R}}=x,k=Bs(S,T.queryCacheKey,xl);return T.subscribe&&k.set(R,T.subscriptionOptions??k.get(R)??{}),!0}let I=!1;if(t.rejected.match(x)){let{meta:{condition:T,arg:R,requestId:k}}=x;if(T&&R.subscribe){let _=Bs(S,R.queryCacheKey,xl);_.set(k,R.subscriptionOptions??_.get(k)??{}),I=!0}}return I},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:S=>g().get(S)?.size??0,isRequestSubscribed:(S,x)=>!!g()?.get(S)?.get(x)};function y(S){return JSON.parse(JSON.stringify(Object.fromEntries([...S].map(([x,I])=>[x,Object.fromEntries(I)]))))}return(S,x)=>{if(i||(i=y(r.currentSubscriptions)),e.util.resetApiState.match(S))return i={},r.currentSubscriptions.clear(),s=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(S))return[!1,h];let I=c(r.currentSubscriptions,S),T=!0;if(I){s||(s=setTimeout(()=>{let _=y(r.currentSubscriptions),[,F]=nl(i,()=>_);x.next(e.internalActions.subscriptionsUpdated(F)),i=_,s=null},500));let R=typeof S.type=="string"&&!!S.type.startsWith(o),k=t.rejected.match(S)&&S.meta.condition&&!!S.meta.arg.subscribe;T=!R&&!k}return[T,!1]}},hx=2147483647/1e3-1,yx=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:s},getRunningQueryThunk:a,mwApi:u})=>{let{removeQueryResult:c,unsubscribeQueryResult:g,cacheEntriesUpserted:v}=t.internalActions,E=Ut(g.match,r.fulfilled,r.rejected,v.match);function h(R){let k=o.currentSubscriptions.get(R);return k?k.size>0:!1}let y={};function S(R){for(let k of R.values())k?.abort?.()}let x=(R,k)=>{let _=k.getState(),F=s(_);if(E(R)){let V;if(v.match(R))V=R.payload.map(j=>j.queryDescription.queryCacheKey);else{let{queryCacheKey:j}=g.match(R)?R.payload:R.meta.arg;V=[j]}I(V,k,F)}if(t.util.resetApiState.match(R)){for(let[V,j]of Object.entries(y))j&&clearTimeout(j),delete y[V];S(o.runningQueries),S(o.runningMutations)}if(n.hasRehydrationInfo(R)){let{queries:V}=n.extractRehydrationInfo(R);I(Object.keys(V),k,F)}};function I(R,k,_){let F=k.getState();for(let V of R){let j=i(F,V);j?.endpointName&&T(V,j.endpointName,k,_)}}function T(R,k,_,F){let j=zn(n,k)?.keepUnusedDataFor??F.keepUnusedDataFor;if(j===1/0)return;let L=Math.max(0,Math.min(j,hx));if(!h(R)){let U=y[R];U&&clearTimeout(U),y[R]=setTimeout(()=>{if(!h(R)){let M=i(_.getState(),R);M?.endpointName&&_.dispatch(a(M.endpointName,M.originalArgs))?.abort(),_.dispatch(c({queryCacheKey:R}))}delete y[R]},L*1e3)}}return x},lg=new Error("Promise never resolved before cacheEntryRemoved."),vx=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:s,selectApiState:a}})=>{let u=Ts(n),c=Ts(o),g=or(n,o),v={},{removeQueryResult:E,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function S(_,F,V){let j=v[_];j?.valueResolved&&(j.valueResolved({data:F,meta:V}),delete j.valueResolved)}function x(_){let F=v[_];F&&(delete v[_],F.cacheEntryRemoved())}function I(_){let{arg:F,requestId:V}=_.meta,{endpointName:j,originalArgs:L}=F;return[j,L,V]}let T=(_,F,V)=>{let j=R(_);function L(U,M,O,P){let N=s(V,M),Q=s(F.getState(),M);!N&&Q&&k(U,P,M,F,O)}if(n.pending.match(_)){let[U,M,O]=I(_);L(U,j,O,M)}else if(y.match(_))for(let{queryDescription:U,value:M}of _.payload){let{endpointName:O,originalArgs:P,queryCacheKey:N}=U;L(O,N,_.meta.requestId,P),S(N,M,{})}else if(o.pending.match(_)){if(F.getState()[t].mutations[j]){let[M,O,P]=I(_);k(M,O,j,F,P)}}else if(g(_))S(j,_.payload,_.meta.baseQueryMeta);else if(E.match(_)||h.match(_))x(j);else if(e.util.resetApiState.match(_))for(let U of Object.keys(v))x(U)};function R(_){return u(_)?_.meta.arg.queryCacheKey:c(_)?_.meta.arg.fixedCacheKey??_.meta.requestId:E.match(_)?_.payload.queryCacheKey:h.match(_)?li(_.payload):""}function k(_,F,V,j,L){let U=zn(r,_),M=U?.onCacheEntryAdded;if(!M)return;let O={},P=new Promise(H=>{O.cacheEntryRemoved=H}),N=Promise.race([new Promise(H=>{O.valueResolved=H}),P.then(()=>{throw lg})]);N.catch(()=>{}),v[V]=O;let Q=e.endpoints[_].select($s(U)?F:V),$=j.dispatch((H,J,ie)=>ie),Y={...j,getCacheEntry:()=>Q(j.getState()),requestId:L,extra:$,updateCachedData:$s(U)?H=>j.dispatch(e.util.updateQueryData(_,F,H)):void 0,cacheDataLoaded:N,cacheEntryRemoved:P},K=M(F,Y);Promise.resolve(K).catch(H=>{if(H!==lg)throw H})}return T},Sx=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},Ax=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:s,refetchQuery:a,internalState:u})=>{let{removeQueryResult:c}=i.internalActions,g=Ut(or(n),ni(n)),v=Ut(or(o,n),Hr(o,n)),E=[],h=0,y=(I,T)=>{(o.pending.match(I)||n.pending.match(I))&&h++,v(I)&&(h=Math.max(0,h-1)),g(I)?x(xg(I,"invalidatesTags",r,s),T):v(I)?x([],T):i.util.invalidateTags.match(I)&&x(kl(I.payload,void 0,void 0,void 0,void 0,s),T)};function S(){return h>0}function x(I,T){let R=T.getState(),k=R[e];if(E.push(...I),k.config.invalidationBehavior==="delayed"&&S())return;let _=E;if(E=[],_.length===0)return;let F=i.util.selectInvalidatedBy(R,_);t.batch(()=>{let V=Array.from(F.values());for(let{queryCacheKey:j}of V){let L=k.queries[j],U=Bs(u.currentSubscriptions,j,xl);L&&(U.size===0?T.dispatch(c({queryCacheKey:j})):L.status!==sr&&T.dispatch(a(L)))}})}return y},bx=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:s}=o,a=new Set,u=null,c=(x,I)=>{(r.internalActions.updateSubscriptionOptions.match(x)||r.internalActions.unsubscribeQueryResult.match(x))&&g(x.payload.queryCacheKey,I),(t.pending.match(x)||t.rejected.match(x)&&x.meta.condition)&&g(x.meta.arg.queryCacheKey,I),(t.fulfilled.match(x)||t.rejected.match(x)&&!x.meta.condition)&&v(x.meta.arg,I),r.util.resetApiState.match(x)&&(y(),u&&(clearTimeout(u),u=null),a.clear())};function g(x,I){a.add(x),u||(u=setTimeout(()=>{for(let T of a)E({queryCacheKey:T},I);a.clear(),u=null},0))}function v({queryCacheKey:x},I){let T=I.getState()[e],R=T.queries[x],k=s.get(x);if(!R||R.status===sr)return;let{lowestPollingInterval:_,skipPollingIfUnfocused:F}=S(k);if(!Number.isFinite(_))return;let V=i.get(x);V?.timeout&&(clearTimeout(V.timeout),V.timeout=void 0);let j=Date.now()+_;i.set(x,{nextPollTimestamp:j,pollingInterval:_,timeout:setTimeout(()=>{(T.config.focused||!F)&&I.dispatch(n(R)),v({queryCacheKey:x},I)},_)})}function E({queryCacheKey:x},I){let R=I.getState()[e].queries[x],k=s.get(x);if(!R||R.status===sr)return;let{lowestPollingInterval:_}=S(k);if(!Number.isFinite(_)){h(x);return}let F=i.get(x),V=Date.now()+_;(!F||V<F.nextPollTimestamp)&&v({queryCacheKey:x},I)}function h(x){let I=i.get(x);I?.timeout&&clearTimeout(I.timeout),i.delete(x)}function y(){for(let x of i.keys())h(x)}function S(x=new Map){let I=!1,T=Number.POSITIVE_INFINITY;for(let R of x.values())R.pollingInterval&&(T=Math.min(R.pollingInterval,T),I=R.skipPollingIfUnfocused||I);return{lowestPollingInterval:T,skipPollingIfUnfocused:I}}return c},wx=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=Rs(r,n),i=Hr(r,n),s=or(r,n),a={};return(c,g)=>{if(o(c)){let{requestId:v,arg:{endpointName:E,originalArgs:h}}=c.meta,y=zn(t,E),S=y?.onQueryStarted;if(S){let x={},I=new Promise((_,F)=>{x.resolve=_,x.reject=F});I.catch(()=>{}),a[v]=x;let T=e.endpoints[E].select($s(y)?h:v),R=g.dispatch((_,F,V)=>V),k={...g,getCacheEntry:()=>T(g.getState()),requestId:v,extra:R,updateCachedData:$s(y)?_=>g.dispatch(e.util.updateQueryData(E,h,_)):void 0,queryFulfilled:I};S(h,k)}}else if(s(c)){let{requestId:v,baseQueryMeta:E}=c.meta;a[v]?.resolve({data:c.payload,meta:E}),delete a[v]}else if(i(c)){let{requestId:v,rejectedWithValue:E,baseQueryMeta:h}=c.meta;a[v]?.reject({error:c.payload??c.error,isUnhandledError:!E,meta:h}),delete a[v]}}},Cx=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,s=(u,c)=>{Tl.match(u)&&a(c,"refetchOnFocus"),_l.match(u)&&a(c,"refetchOnReconnect")};function a(u,c){let g=u.getState()[e],v=g.queries,E=o.currentSubscriptions;t.batch(()=>{for(let h of E.keys()){let y=v[h],S=E.get(h);if(!S||!y)continue;let x=[...S.values()];(x.some(T=>T[c]===!0)||x.every(T=>T[c]===void 0)&&g.config[c])&&(S.size===0?u.dispatch(i({queryCacheKey:h})):y.status!==sr&&u.dispatch(n(y)))}})}return s};function xx(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:s}=o,a={invalidateTags:G(`${t}/invalidateTags`)},u=E=>E.type.startsWith(`${t}/`),c=[Sx,yx,Ax,bx,vx,wx];return{middleware:E=>{let h=!1,y=i(E.dispatch),S={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:u,mwApi:E},x=c.map(R=>R(S)),I=gx(S),T=Cx(S);return R=>k=>{if(!Uo(k))return R(k);h||(h=!0,E.dispatch(n.internalActions.middlewareRegistered(s)));let _={...E,next:R},F=E.getState(),[V,j]=I(k,_,F),L;if(V?L=R(k):L=j,E.getState()[t]&&(T(k,_,F),u(k)||o.hasRehydrationInfo(k)))for(let U of x)U(k,_,F);return L}},actions:a};function v(E){return e.api.endpoints[E.endpointName].initiate(E.originalArgs,{subscribe:!1,forceRefetch:!0})}}var dg=Symbol(),Ex=({createSelector:e=je}={})=>({name:dg,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:s,refetchOnMountOrArgChange:a,refetchOnFocus:u,refetchOnReconnect:c,invalidationBehavior:g,onSchemaFailure:v,catchSchemaFailure:E,skipSchemaValidation:h},y){Hf();let S=pe=>(typeof process<"u",pe);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:_l,onOffline:vg,onFocus:Tl,onFocusLost:yg},util:{}});let x=fx({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:T,buildQuerySelector:R,buildInfiniteQuerySelector:k,buildMutationSelector:_}=x;ir(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:T});let{queryThunk:F,infiniteQueryThunk:V,mutationThunk:j,patchQueryData:L,updateQueryData:U,upsertQueryData:M,prefetch:O,buildMatchThunkActions:P}=dx({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:S,selectors:x,onSchemaFailure:v,catchSchemaFailure:E,skipSchemaValidation:h}),{reducer:N,actions:Q}=px({context:y,queryThunk:F,infiniteQueryThunk:V,mutationThunk:j,serializeQueryArgs:i,reducerPath:o,assertTagType:S,config:{refetchOnFocus:u,refetchOnReconnect:c,refetchOnMountOrArgChange:a,keepUnusedDataFor:s,reducerPath:o,invalidationBehavior:g}});ir(t.util,{patchQueryData:L,updateQueryData:U,upsertQueryData:M,prefetch:O,resetApiState:Q.resetApiState,upsertQueryEntries:Q.cacheEntriesUpserted}),ir(t.internalActions,Q);let $=new WeakMap,Y=pe=>Bs($,pe,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:K,buildInitiateInfiniteQuery:H,buildInitiateMutation:J,getRunningMutationThunk:ie,getRunningMutationsThunk:be,getRunningQueriesThunk:Oe,getRunningQueryThunk:Ie}=lx({queryThunk:F,mutationThunk:j,infiniteQueryThunk:V,api:t,serializeQueryArgs:i,context:y,getInternalState:Y});ir(t.util,{getRunningMutationThunk:ie,getRunningMutationsThunk:be,getRunningQueryThunk:Ie,getRunningQueriesThunk:Oe});let{middleware:Te,actions:_e}=xx({reducerPath:o,context:y,queryThunk:F,mutationThunk:j,infiniteQueryThunk:V,api:t,assertTagType:S,selectors:x,getRunningQueryThunk:Ie,getInternalState:Y});return ir(t.util,_e),ir(t,{reducer:N,middleware:Te}),{name:dg,injectEndpoint(pe,de){var Ue;let fe=(Ue=t.endpoints)[pe]??(Ue[pe]={});Hs(de)&&ir(fe,{name:pe,select:R(pe,de),initiate:K(pe,de)},P(F,pe)),ax(de)&&ir(fe,{name:pe,select:_(),initiate:J(pe)},P(j,pe)),zs(de)&&ir(fe,{name:pe,select:k(pe,de),initiate:H(pe,de)},P(F,pe))}}}}),Ig=mx(Ex());m();d();f();p();m();d();f();p();var Yr=e=>e.query,Rg=e=>e.query?.enableQuerySyntax;var _q=je(e=>Yr(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})),Ix=je(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function ar(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function q(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(g){try{c(n.next(g))}catch(v){s(v)}}function u(g){try{c(n.throw(g))}catch(v){s(v)}}function c(g){g.done?i(g.value):o(g.value).then(a,u)}c((n=n.apply(e,t||[])).next())})}var ve;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(ve||(ve={}));function Nl(){return typeof window<"u"}function Hl(){return typeof navigator<"u"}function Wn(){return typeof document<"u"}function Fl(){try{return typeof localStorage<"u"}catch{return!1}}function Rx(){try{return typeof sessionStorage<"u"}catch{return!1}}function Vg(){return Hl()&&navigator.cookieEnabled}var Tx=[ve.click,ve.custom,ve.search,ve.view],_x=(e,t)=>Tx.indexOf(e)!==-1?Object.assign({language:Wn()?document.documentElement.lang:"unknown",userAgent:Hl()?navigator.userAgent:"unknown"},t):t,fi=class e{static set(t,r,n){var o,i,s,a;n&&(i=new Date,i.setTime(i.getTime()+n)),a=window.location.hostname,a.indexOf(".")===-1?Tg(t,r,i):(s=a.split("."),o=s[s.length-2]+"."+s[s.length-1],Tg(t,r,i,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function Tg(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function kx(){return Fl()?localStorage:Vg()?new mi:Rx()?sessionStorage:new Yn}var mi=class e{getItem(t){return fi.get(`${e.prefix}${t}`)}removeItem(t){fi.erase(`${e.prefix}${t}`)}setItem(t,r,n){fi.set(`${e.prefix}${t}`,r,n)}};mi.prefix="coveo_";var Dl=class{constructor(){this.cookieStorage=new mi}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)}},Yn=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Ws="__coveo.analytics.history",Ox=20,Px=1e3*60,Nx=75,Xs=class{constructor(t){this.store=t||kx()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){return q(this,void 0,void 0,function*(){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=yield this.getHistoryWithInternalTimeAsync();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])})}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){return q(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(Ws);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return q(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(Ws);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Ws,JSON.stringify(t.slice(0,Ox)))}catch{}}clear(){try{this.store.removeItem(Ws)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,Nx)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>Px:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var Fx=(e,t)=>q(void 0,void 0,void 0,function*(){return e===ve.view?(yield Dx(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),Dx=e=>q(void 0,void 0,void 0,function*(){let t=new Xs,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),Ks,Mx=new Uint8Array(16);function Lx(){if(!Ks&&(Ks=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ks))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ks(Mx)}var jx=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Zs(e){return typeof e=="string"&&jx.test(e)}var Ze=[];for(let e=0;e<256;++e)Ze.push((e+256).toString(16).slice(1));function Gg(e,t=0){return Ze[e[t+0]]+Ze[e[t+1]]+Ze[e[t+2]]+Ze[e[t+3]]+"-"+Ze[e[t+4]]+Ze[e[t+5]]+"-"+Ze[e[t+6]]+Ze[e[t+7]]+"-"+Ze[e[t+8]]+Ze[e[t+9]]+"-"+Ze[e[t+10]]+Ze[e[t+11]]+Ze[e[t+12]]+Ze[e[t+13]]+Ze[e[t+14]]+Ze[e[t+15]]}function qx(e){if(!Zs(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}function Ux(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var Vx="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Gx="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Bx(e,t,r){function n(o,i,s,a){var u;if(typeof o=="string"&&(o=Ux(o)),typeof i=="string"&&(i=qx(i)),((u=i)===null||u===void 0?void 0:u.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+o.length);if(c.set(i),c.set(o,i.length),c=r(c),c[6]=c[6]&15|t,c[8]=c[8]&63|128,s){a=a||0;for(let g=0;g<16;++g)s[a+g]=c[g];return s}return Gg(c)}try{n.name=e}catch{}return n.DNS=Vx,n.URL=Gx,n}var $x=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),_g={randomUUID:$x};function Xr(e,t,r){if(_g.randomUUID&&!t&&!e)return _g.randomUUID();e=e||{};let n=e.random||(e.rng||Lx)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let o=0;o<16;++o)t[r+o]=n[o];return t}return Gg(n)}function Qx(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 Ol(e,t){return e<<t|e>>>32-t}function Hx(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let s=unescape(encodeURIComponent(e));e=[];for(let a=0;a<s.length;++a)e.push(s.charCodeAt(a))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,o=Math.ceil(n/16),i=new Array(o);for(let s=0;s<o;++s){let a=new Uint32Array(16);for(let u=0;u<16;++u)a[u]=e[s*64+u*4]<<24|e[s*64+u*4+1]<<16|e[s*64+u*4+2]<<8|e[s*64+u*4+3];i[s]=a}i[o-1][14]=(e.length-1)*8/Math.pow(2,32),i[o-1][14]=Math.floor(i[o-1][14]),i[o-1][15]=(e.length-1)*8&4294967295;for(let s=0;s<o;++s){let a=new Uint32Array(80);for(let h=0;h<16;++h)a[h]=i[s][h];for(let h=16;h<80;++h)a[h]=Ol(a[h-3]^a[h-8]^a[h-14]^a[h-16],1);let u=r[0],c=r[1],g=r[2],v=r[3],E=r[4];for(let h=0;h<80;++h){let y=Math.floor(h/20),S=Ol(u,5)+Qx(y,c,g,v)+E+t[y]+a[h]>>>0;E=v,v=g,g=Ol(c,30)>>>0,c=u,u=S}r[0]=r[0]+u>>>0,r[1]=r[1]+c>>>0,r[2]=r[2]+g>>>0,r[3]=r[3]+v>>>0,r[4]=r[4]+E>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var zx=Bx("v5",80,Hx),kg=zx,Bg="2.30.56",Og=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,pi={pageview:"pageview",event:"event"},Js=class{constructor({client:t,uuidGenerator:r=Xr}){this.client=t,this.uuidGenerator=r}},Ml=class extends Js{constructor({client:t,uuidGenerator:r=Xr}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=Og(window.location),this.lastReferrer=Wn()?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:Wn()?document.title:"",encoding:Wn()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},i={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},i),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:i}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=i,t===pi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===pi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===pi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===pi.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=o=>o.replace(/^\/?(.*)$/,"/$1");return`${(o=>o.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return Og(window.location)}},vr=class e{constructor(t,r){if(!Zs(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(r/1e3)}toString(){return this.clientId.replace(/-/g,"")+"."+this.creationDate.toString()}get expired(){let t=Math.floor(Date.now()/1e3)-this.creationDate;return t<0||t>e.expirationTime}validate(t,r){return!this.expired&&this.matchReferrer(t,r)}matchReferrer(t,r){try{let n=new URL(t);return r.some(o=>new RegExp(o.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(n.host))}catch{return!1}}static fromString(t){let r=t.split(".");if(r.length!==2)return null;let[n,o]=r;if(n.length!==32||isNaN(parseInt(o)))return null;let i=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return Zs(i)?new e(i,Number.parseInt(o)*1e3):null}};vr.cvo_cid="cvo_cid";vr.expirationTime=120;var Ll=class extends Js{constructor({client:t,uuidGenerator:r=Xr}){super({client:t,uuidGenerator:r})}getApi(t){switch(t){case"decorate":return this.decorate;case"acceptFrom":return this.acceptFrom;default:return null}}decorate(t){return q(this,void 0,void 0,function*(){if(!this.client.getCurrentVisitorId)throw new Error("Could not retrieve current clientId");try{let r=new URL(t),n=yield this.client.getCurrentVisitorId();return r.searchParams.set(vr.cvo_cid,new vr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Ll.Id="link";var wt=Object.keys;function Ys(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Pl=128,$g=192,Pg=224,Ng=240;function Wx(e){return(e&248)===Ng?4:(e&Ng)===Pg?3:(e&Pg)===$g?2:1}function Kx(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&Pl)!=Pl)break;if(r-=3,(n&$g)!=Pl){t-r>=Wx(n)*3&&(r=t);break}}return e.substring(0,r)}var jl={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"},Yx=wt(jl).map(e=>jl[e]),Xx=[...Yx].join("|"),Zx=new RegExp(`^(${Xx}$)`),Jx={svcAction:"svc_action",svcActionData:"svc_action_data"},eE=e=>wt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=jl[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),tE=e=>Zx.test(e),rE=[tE],Fg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Dg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},nt={action:"pa",list:"pal",listSource:"pls"},ea={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},nE=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],ql={id:"quoteId",affiliation:"quoteAffiliation"},Ul={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},oE={add:nt,bookmark_add:nt,bookmark_remove:nt,click:nt,checkout:nt,checkout_option:nt,detail:nt,impression:nt,remove:nt,refund:Object.assign(Object.assign({},nt),ea),purchase:Object.assign(Object.assign({},nt),ea),quickview:nt,quote:Object.assign(Object.assign({},nt),ql),review:Object.assign(Object.assign({},nt),Ul)},iE=wt(Fg).map(e=>Fg[e]),sE=wt(Dg).map(e=>Dg[e]),aE=wt(nt).map(e=>nt[e]),cE=wt(ea).map(e=>ea[e]),uE=wt(Ul).map(e=>Ul[e]),lE=wt(ql).map(e=>ql[e]),dE=[...iE,"custom"].join("|"),pE=[...sE,"custom"].join("|"),Qg="(pr[0-9]+)",Hg="(il[0-9]+pi[0-9]+)",fE=new RegExp(`^${Qg}(${dE})$`),mE=new RegExp(`^(${Hg}(${pE}))|(il[0-9]+nm)$`),gE=new RegExp(`^(${aE.join("|")})$`),hE=new RegExp(`^(${cE.join("|")})$`),yE=new RegExp(`^${Qg}custom$`),vE=new RegExp(`^${Hg}custom$`),SE=new RegExp(`^(${[...nE,...uE,...lE].join("|")})$`),AE=e=>fE.test(e),bE=e=>mE.test(e),wE=e=>gE.test(e),CE=e=>hE.test(e),xE=e=>SE.test(e),EE=[bE,AE,wE,CE,xE],IE=[yE,vE],RE={anonymizeIp:"aip"},TE={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},_E={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},kE=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],OE=Object.assign(Object.assign(Object.assign(Object.assign({},RE),TE),_E),kE.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Vl=Object.assign(Object.assign({},OE),Jx),PE=e=>{let t=!!e.action&&oE[e.action]||{};return wt(e).reduce((r,n)=>{let o=t[n]||Vl[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},NE=wt(Vl).map(e=>Vl[e]),FE=e=>NE.indexOf(e)!==-1,DE=e=>e==="custom",ME=e=>[...EE,...rE,FE,DE].some(t=>t(e)),LE=e=>wt(e).reduce((t,r)=>{let n=jE(r);return n?Object.assign(Object.assign({},t),qE(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),jE=e=>{let t;return[...IE].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},qE=(e,t)=>wt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),Gl=class{constructor(t){this.opts=t}sendEvent(t,r){return q(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:o}=this.opts,i=yield this.getQueryParamsForEventType(t),{url:s,payload:a}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),u=this.encodeForEventType(t,a),c=new Blob([u],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(s,c)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return q(this,void 0,void 0,function*(){let o=t,i=r;if(n){let s=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:a,body:u}=s;o=a||t;try{i=JSON.parse(u)}catch(c){console.error("Unable to process the request body as a JSON string",c)}}return{payload:i,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return q(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(i=>!!i).join("&")})}isEventTypeLegacy(t){return[ve.click,ve.custom,ve.search,ve.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let o=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(o=`access_token=${encodeURIComponent(n)}&${o}`),o}},Bl=class{sendEvent(t,r){return q(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return q(this,void 0,void 0,function*(){return Promise.resolve()})}},Mg=A.fetch,ta=class{constructor(t){this.opts=t}sendEvent(t,r){return q(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:i}=this.opts,s=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",a={url:`${n}/analytics/${t}${s}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},u=Object.assign(Object.assign({},a),i?yield i(a,"analyticsFetch"):{}),{url:c}=u,g=ar(u,["url"]),v;try{v=yield Mg(c,g)}catch(E){console.error("An error has occured when sending the event.",E);return}if(v.ok){let E=yield v.json();return E.visitorId&&o.setCurrentVisitorId(E.visitorId),E}else{try{v.json()}catch{}throw console.error(`An error has occured when sending the "${t}" event.`,v,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return q(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield Mg(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[ve.click,ve.custom,ve.search,ve.view].indexOf(t)!==-1}getVisitorIdParam(){return q(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,r=yield t.getCurrentVisitorId();return r?`?visitor=${r}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},$l=class{constructor(t,r){Fl()&&Vg()?this.storage=new Dl:Fl()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Yn),this.client=new ta(t),this.beaconClient=new Gl(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:i}of n)this.beaconClient.sendEvent(o,i)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},Ql=class{constructor(t,r){this.storage=r||new Yn,this.client=new ta(t)}getClientDependingOnEventType(t){return this.client}},ra=class{constructor(){this.storage=new Yn,this.client=new Bl}getClientDependingOnEventType(t){return this.client}},UE="xx",VE=e=>e?.startsWith(UE)||!1,GE=`
27
+ `;return new qu(r)}var qu=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Ot=class{constructor(e){oe(this,"definition");this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let i=this.definition[o].validate(r[o]);i&&n.push(`${o}: ${i}`)}if(n.length)throw Jb(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}},qr=class{constructor(e={}){oe(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&ce(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 Dn(e){return e===void 0}function ew(e){return e===null}function ce(e){return Dn(e)||ew(e)}var Le=class{constructor(e={}){oe(this,"value");this.value=new qr(e)}validate(e){let t=this.value.validate(e);return t||(tw(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function tw(e){return Dn(e)||bf(e)}function bf(e){return typeof e=="boolean"}var De=class{constructor(e={}){oe(this,"config");oe(this,"value");this.config=e,this.value=new qr(e)}validate(e){let t=this.value.validate(e);return t||(rw(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 rw(e){return Dn(e)||wf(e)}function wf(e){return typeof e=="number"&&!Number.isNaN(e)}var nw=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,re=class{constructor(e={}){oe(this,"value");oe(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new qr(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:i}=this.config,s=this.value.validate(e);if(s)return s;if(Dn(e))return null;if(!Cf(e))return"value is not a string.";if(!t&&!e.length)return"value is an empty string.";if(r)try{new URL(e)}catch{return"value is not a valid URL."}return n&&!n.test(e)?`value did not match provided regex ${n}`:o&&!o.includes(e)?`value should be one of: ${o.join(", ")}.`:i&&!(nw.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 Cf(e){return Object.prototype.toString.call(e)==="[object String]"}var xe=class{constructor(e={}){oe(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Dn(e))return this.config.options.required?"value is required and is currently undefined":null;if(!xf(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ce(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],i=n.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function xf(e){return e!==void 0&&typeof e=="object"}var Pt=class{constructor(e={}){oe(this,"config");oe(this,"value");this.config=e,this.value=new qr(this.config)}validate(e){if(!ce(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ce(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&&ce(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 bf(e)||Cf(e)||wf(e)||xf(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Ef(e){return Array.isArray(e)}var Uu=class{constructor(e){oe(this,"config");oe(this,"value");this.config=e,this.value=new qr(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Dn(e)||Object.values(this.config.enum).find(n=>n===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();f();p();var ts=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();var Mn=class{constructor(t){oe(this,"_basePath");oe(this,"_params",{});this._basePath=t}addParam(t,r){this._params={...this.params,[t]:r}}get basePath(){return this._basePath}get params(){return this._params}get hasParams(){return Object.entries(this._params).length}get href(){return this.hasParams?`${this.basePath}?${Object.entries(this.params).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}`:this.basePath}};m();d();f();p();function Vu(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Gu=e=>{let{response:t}=e;return t.body?ow(e):iw(t)},ow=e=>aw(e)?cw(e):sw(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},iw=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function sw(e){return e.body.statusCode!==void 0}function aw(e){return e.body.exception!==void 0}var cw=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();function If(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var Bu=(e,t,r,n)=>{let o=new Mn(`${e.url}${n}`);return o.addParam("organizationId",e.organizationId),e.authentication&&o.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:o.href,origin:"searchApiFetch"}};var Rf=(e,t)=>{let r=new Mn(`${e.url}${t}`);return r.addParam("access_token",e.accessToken),r.addParam("organizationId",e.organizationId),r.addParam("uniqueId",e.uniqueId),e.authentication&&r.addParam("authentication",e.authentication),e.q!==void 0&&r.addParam("q",e.q),e.enableNavigation!==void 0&&r.addParam("enableNavigation",`${e.enableNavigation}`),e.requestedOutputSize!==void 0&&r.addParam("requestedOutputSize",`${e.requestedOutputSize}`),r.href},$u=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield hr.call({...Bu(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Vu(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=If(r),o=yield r.arrayBuffer(),s=new TextDecoder(n).decode(o);return uw(s)?{success:s}:{error:Gu({response:r,body:s})}});return function $u(_x3,_x4){return _ref3.apply(this,arguments)}}();function uw(e){return typeof e=="string"}m();d();f();p();function lw(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function dw(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function rs(e,t){if(t&&e.name==="AbortError")return{error:dw(e)};if(e instanceof jr)return{error:lw(e)};throw e}m();d();f();p();m();d();f();p();var ns=(e,t,r,n,o={})=>{pw(e);let i=`${e.url}/rest/organizations/${e.organizationId}/caseassists/${e.caseAssistId}${n}`,s=fw(o),a=s?`${i}?${s}`:i;return{accessToken:e.accessToken,method:t,contentType:r,url:a,origin:"caseAssistApiFetch"}},os=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r],t),{}),is=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r].value,t),{}),pw=e=>{if(!e.url)throw new Error("The 'url' attribute must contain a valid platform URL.");if(!e.organizationId)throw new Error("The 'organizationId' attribute must contain a valid organization ID.");if(!e.accessToken)throw new Error("The 'accessToken' attribute must contain a valid platform access token.");if(!e.caseAssistId)throw new Error("The 'caseAssistId' attribute must contain a valid Case Assist configuration ID.")},fw=e=>Object.keys(e).map(t=>`${t}=${encodeURIComponent(e[t])}`).join("&");var Tf=e=>{let t=e.debug?{debug:"1"}:{};return{...ns(e,"POST","application/json","/classify",t),requestParams:mw(e)}},mw=e=>({clientId:e.clientId,locale:e.locale,fields:os(e.fields)});m();d();f();p();var _f=e=>{let t={};return e.debug&&(t.debug="1"),e.numberOfResults&&(t.numberOfResults=e.numberOfResults.toString()),{...ns(e,"POST","application/json","/documents/suggest",t),requestParams:gw(e)}},gw=e=>({clientId:e.clientId,locale:e.locale,fields:os(e.fields),context:e.context,analytics:e.analytics});var ss=class{constructor(t){oe(this,"options",t)}getCaseClassifications(t){var _this=this;return _asyncToGenerator(function*(){let r=yield hr.call({...Tf(t),..._this.options});if(r instanceof Error)return rs(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}getDocumentSuggestions(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield hr.call({..._f(t),..._this2.options});if(r instanceof Error)return rs(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this3=this;return _asyncToGenerator(function*(){return $u(t,_this3.options)})()}};m();d();f();p();m();d();f();p();m();d();f();p();function Ke(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 hw=typeof Symbol=="function"&&Symbol.observable||"@@observable",kf=hw,Qu=()=>Math.random().toString(36).substring(7).split("").join("."),yw={INIT:`@@redux/INIT${Qu()}`,REPLACE:`@@redux/REPLACE${Qu()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Qu()}`},as=yw;function qt(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 Hu(e,t,r){if(typeof e!="function")throw new Error(Ke(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ke(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ke(1));return r(Hu)(e,t)}let n=e,o=t,i=new Map,s=i,a=0,u=!1;function c(){s===i&&(s=new Map,i.forEach((x,I)=>{s.set(I,x)}))}function g(){if(u)throw new Error(Ke(3));return o}function v(x){if(typeof x!="function")throw new Error(Ke(4));if(u)throw new Error(Ke(5));let I=!0;c();let T=a++;return s.set(T,x),function(){if(I){if(u)throw new Error(Ke(6));I=!1,c(),s.delete(T),i=null}}}function E(x){if(!qt(x))throw new Error(Ke(7));if(typeof x.type>"u")throw new Error(Ke(8));if(typeof x.type!="string")throw new Error(Ke(17));if(u)throw new Error(Ke(9));try{u=!0,o=n(o,x)}finally{u=!1}return(i=s).forEach(T=>{T()}),x}function h(x){if(typeof x!="function")throw new Error(Ke(10));n=x,E({type:as.REPLACE})}function y(){let x=v;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(Ke(11));function T(){let k=I;k.next&&k.next(g())}return T(),{unsubscribe:x(T)}},[kf](){return this}}}return E({type:as.INIT}),{dispatch:E,subscribe:v,getState:g,replaceReducer:h,[kf]:y}}function vw(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:as.INIT})>"u")throw new Error(Ke(12));if(typeof r(void 0,{type:as.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ke(13))})}function Ln(e){let t=Object.keys(e),r={};for(let s=0;s<t.length;s++){let a=t[s];typeof e[a]=="function"&&(r[a]=e[a])}let n=Object.keys(r),o,i;try{vw(r)}catch(s){i=s}return function(a={},u){if(i)throw i;let c=!1,g={};for(let v=0;v<n.length;v++){let E=n[v],h=r[E],y=a[E],S=h(y,u);if(typeof S>"u"){let x=u&&u.type;throw new Error(Ke(14))}g[E]=S,c=c||S!==y}return c=c||n.length!==Object.keys(a).length,c?g:a}}function qo(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Of(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(Ke(15))},s={getState:o.getState,dispatch:(u,...c)=>i(u,...c)},a=e.map(u=>u(s));return i=qo(...a)(o.dispatch),{...o,dispatch:i}}}function Uo(e){return qt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var tl=Symbol.for("immer-nothing"),Vo=Symbol.for("immer-draftable"),Qe=Symbol.for("immer-state");function Ye(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var gt=Object,Vr=gt.getPrototypeOf,Bo="constructor",Wo="prototype",Ku="configurable",ds="enumerable",us="writable",$o="value",st=e=>!!e&&!!e[Qe];function at(e){return e?qf(e)||Yo(e)||!!e[Vo]||!!e[Bo]?.[Vo]||Xo(e)||Zo(e):!1}var Sw=gt[Wo][Bo].toString(),Pf=new WeakMap;function qf(e){if(!e||!jn(e))return!1;let t=Vr(e);if(t===null||t===gt[Wo])return!0;let r=gt.hasOwnProperty.call(t,Bo)&&t[Bo];if(r===Object)return!0;if(!Ur(r))return!1;let n=Pf.get(r);return n===void 0&&(n=Function.toString.call(r),Pf.set(r,n)),n===Sw}function Uf(e){return st(e)||Ye(15,e),e[Qe].base_}function Ko(e,t,r=!0){Gr(e)===0?(r?Reflect.ownKeys(e):gt.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function Gr(e){let t=e[Qe];return t?t.type_:Yo(e)?1:Xo(e)?2:Zo(e)?3:0}var Go=(e,t,r=Gr(e))=>r===2?e.has(t):gt[Wo].hasOwnProperty.call(e,t),rr=(e,t,r=Gr(e))=>r===2?e.get(t):e[t],ps=(e,t,r,n=Gr(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function Aw(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Yo=Array.isArray,Xo=e=>e instanceof Map,Zo=e=>e instanceof Set,jn=e=>typeof e=="object",Ur=e=>typeof e=="function",zu=e=>typeof e=="boolean";function bw(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var ww=e=>jn(e)?e?.[Qe]:null,nr=e=>e.copy_||e.base_;var rl=e=>e.modified_?e.copy_:e.base_;function Yu(e,t){if(Xo(e))return new Map(e);if(Zo(e))return new Set(e);if(Yo(e))return Array[Wo].slice.call(e);let r=qf(e);if(t===!0||t==="class_only"&&!r){let n=gt.getOwnPropertyDescriptors(e);delete n[Qe];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let s=o[i],a=n[s];a[us]===!1&&(a[us]=!0,a[Ku]=!0),(a.get||a.set)&&(n[s]={[Ku]:!0,[us]:!0,[ds]:a[ds],[$o]:e[s]})}return gt.create(Vr(e),n)}else{let n=Vr(e);if(n!==null&&r)return{...e};let o=gt.create(n);return gt.assign(o,e)}}function nl(e,t=!1){return vs(e)||st(e)||!at(e)||(Gr(e)>1&&gt.defineProperties(e,{set:cs,add:cs,clear:cs,delete:cs}),gt.freeze(e),t&&Ko(e,(r,n)=>{nl(n,!0)},!1)),e}function Cw(){Ye(2)}var cs={[$o]:Cw};function vs(e){return e===null||!jn(e)?!0:gt.isFrozen(e)}var fs="MapSet",ms="Patches",Nf="ArrayMethods",gs={};function Br(e){let t=gs[e];return t||Ye(0,e),t}var Ff=e=>!!gs[e];function xw(e,t){gs[e]||(gs[e]=t)}var Qo,Vf=()=>Qo,Ew=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Ff(fs)?Br(fs):void 0,arrayMethodsPlugin_:Ff(Nf)?Br(Nf):void 0});function Df(e,t){t&&(e.patchPlugin_=Br(ms),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Xu(e){Zu(e),e.drafts_.forEach(Iw),e.drafts_=null}function Zu(e){e===Qo&&(Qo=e.parent_)}var Mf=e=>Qo=Ew(Qo,e);function Iw(e){let t=e[Qe];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Lf(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[Qe].modified_&&(Xu(t),Ye(4)),at(e)&&(e=jf(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[Qe].base_,e,t)}else e=jf(t,r);return Rw(t,e,!0),Xu(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==tl?e:void 0}function jf(e,t){if(vs(t))return t;let r=t[Qe];if(!r)return hs(t,e.handledSet_,e);if(!Ss(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);$f(r,e)}return r.copy_}function Rw(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&nl(t,r)}function Gf(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ss=(e,t)=>e.scope_===t,Tw=[];function Bf(e,t,r,n){let o=nr(e),i=e.type_;if(n!==void 0&&rr(o,n,i)===t){ps(o,n,r,i);return}if(!e.draftLocations_){let a=e.draftLocations_=new Map;Ko(o,(u,c)=>{if(st(c)){let g=a.get(c)||[];g.push(u),a.set(c,g)}})}let s=e.draftLocations_.get(t)??Tw;for(let a of s)ps(o,a,r,i)}function _w(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!Ss(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let s=rl(i);Bf(e,i.draft_??i,s,r),$f(i,o)})}function $f(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)}Gf(e)}}function kw(e,t,r){let{scope_:n}=e;if(st(r)){let o=r[Qe];Ss(o,n)&&o.callbacks_.push(function(){ls(e);let s=rl(o);Bf(e,r,s,t)})}else at(r)&&e.callbacks_.push(function(){let i=nr(e);e.type_===3?i.has(r)&&hs(r,n.handledSet_,n):rr(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&hs(rr(e.copy_,t,e.type_),n.handledSet_,n)})}function hs(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||st(e)||t.has(e)||!at(e)||vs(e)||(t.add(e),Ko(e,(n,o)=>{if(st(o)){let i=o[Qe];if(Ss(i,r)){let s=rl(i);ps(e,n,s,e.type_),Gf(i)}}else at(o)&&hs(o,t,r)})),e}function Ow(e,t){let r=Yo(e),n={type_:r?1:0,scope_:t?t.scope_:Vf(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=n,i=ys;r&&(o=[n],i=Ho);let{revoke:s,proxy:a}=Proxy.revocable(o,i);return n.draft_=a,n.revoke_=s,[a,n]}var ys={get(e,t){if(t===Qe)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=nr(e);if(!Go(o,t,e.type_))return Pw(e,o,t);let i=o[t];if(e.finalized_||!at(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&bw(t))return i;if(i===Wu(e.base_,t)){ls(e);let s=e.type_===1?+t:t,a=el(e.scope_,i,e,s);return e.copy_[s]=a}return i},has(e,t){return t in nr(e)},ownKeys(e){return Reflect.ownKeys(nr(e))},set(e,t,r){let n=Qf(nr(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Wu(nr(e),t),i=o?.[Qe];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(Aw(r,o)&&(r!==void 0||Go(e.base_,t,e.type_)))return!0;ls(e),Ju(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),kw(e,t,r)),!0},deleteProperty(e,t){return ls(e),Wu(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Ju(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=nr(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[us]:!0,[Ku]:e.type_!==1||t!=="length",[ds]:n[ds],[$o]:r[t]}},defineProperty(){Ye(11)},getPrototypeOf(e){return Vr(e.base_)},setPrototypeOf(){Ye(12)}},Ho={};for(let e in ys){let t=ys[e];Ho[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Ho.deleteProperty=function(e,t){return Ho.set.call(this,e,t,void 0)};Ho.set=function(e,t,r){return ys.set.call(this,e[0],t,r,e[0])};function Wu(e,t){let r=e[Qe];return(r?nr(r):e)[t]}function Pw(e,t,r){let n=Qf(t,r);return n?$o in n?n[$o]:n.get?.call(e.draft_):void 0}function Qf(e,t){if(!(t in e))return;let r=Vr(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Vr(r)}}function Ju(e){e.modified_||(e.modified_=!0,e.parent_&&Ju(e.parent_))}function ls(e){e.copy_||(e.assigned_=new Map,e.copy_=Yu(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Nw=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Ur(t)&&!Ur(r)){let i=r;r=t;let s=this;return function(u=i,...c){return s.produce(u,g=>r.call(this,g,...c))}}Ur(r)||Ye(6),n!==void 0&&!Ur(n)&&Ye(7);let o;if(at(t)){let i=Mf(this),s=el(i,t,void 0),a=!0;try{o=r(s),a=!1}finally{a?Xu(i):Zu(i)}return Df(i,n),Lf(o,i)}else if(!t||!jn(t)){if(o=r(t),o===void 0&&(o=t),o===tl&&(o=void 0),this.autoFreeze_&&nl(o,!0),n){let i=[],s=[];Br(ms).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:s}),n(i,s)}return o}else Ye(1,t)},this.produceWithPatches=(t,r)=>{if(Ur(t))return(s,...a)=>this.produceWithPatches(s,u=>t(u,...a));let n,o;return[this.produce(t,r,(s,a)=>{n=s,o=a}),n,o]},zu(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),zu(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),zu(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){at(e)||Ye(8),st(e)&&(e=As(e));let t=Mf(this),r=el(t,e,void 0);return r[Qe].isManual_=!0,Zu(t),r}finishDraft(e,t){let r=e&&e[Qe];(!r||!r.isManual_)&&Ye(9);let{scope_:n}=r;return Df(n,t),Lf(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=Br(ms).applyPatches_;return st(e)?n(e,t):this.produce(e,o=>n(o,t))}};function el(e,t,r,n){let[o,i]=Xo(t)?Br(fs).proxyMap_(t,r):Zo(t)?Br(fs).proxySet_(t,r):Ow(t,r);return(r?.scope_??Vf()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?_w(r,i,n):i.callbacks_.push(function(u){u.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:c}=u;i.modified_&&c&&c.generatePatches_(i,[],u)}),o}function As(e){return st(e)||Ye(10,e),Hf(e)}function Hf(e){if(!at(e)||vs(e))return e;let t=e[Qe],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Yu(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Yu(e,!0);return Ko(r,(o,i)=>{ps(r,o,Hf(i))},n),t&&(t.finalized_=!1),r}function zf(){function t(y,S=[]){if(y.key_!==void 0){let x=y.parent_.copy_??y.parent_.base_,I=ww(rr(x,y.key_)),T=rr(x,y.key_);if(T===void 0||T!==y.draft_&&T!==y.base_&&T!==y.copy_||I!=null&&I.base_!==y.base_)return null;let R=y.parent_.type_===3,k;if(R){let _=y.parent_;k=Array.from(_.drafts_.keys()).indexOf(y.key_)}else k=y.key_;if(!(R&&x.size>k||Go(x,k)))return null;S.push(k)}if(y.parent_)return t(y.parent_,S);S.reverse();try{r(y.copy_,S)}catch{return null}return S}function r(y,S){let x=y;for(let I=0;I<S.length-1;I++){let T=S[I];if(x=rr(x,T),!jn(x)||x===null)throw new Error(`Cannot resolve path at '${S.join("/")}'`)}return x}let n="replace",o="add",i="remove";function s(y,S,x){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:I,inversePatches_:T}=x;switch(y.type_){case 0:case 2:return u(y,S,I,T);case 1:return a(y,S,I,T);case 3:return c(y,S,I,T)}}function a(y,S,x,I){let{base_:T,assigned_:R}=y,k=y.copy_;k.length<T.length&&([T,k]=[k,T],[x,I]=[I,x]);let _=y.allIndicesReassigned_===!0;for(let F=0;F<T.length;F++){let V=k[F],j=T[F];if((_||R?.get(F.toString()))&&V!==j){let U=V?.[Qe];if(U&&U.modified_)continue;let M=S.concat([F]);x.push({op:n,path:M,value:h(V)}),I.push({op:n,path:M,value:h(j)})}}for(let F=T.length;F<k.length;F++){let V=S.concat([F]);x.push({op:o,path:V,value:h(k[F])})}for(let F=k.length-1;T.length<=F;--F){let V=S.concat([F]);I.push({op:i,path:V})}}function u(y,S,x,I){let{base_:T,copy_:R,type_:k}=y;Ko(y.assigned_,(_,F)=>{let V=rr(T,_,k),j=rr(R,_,k),L=F?Go(T,_)?n:o:i;if(V===j&&L===n)return;let U=S.concat(_);x.push(L===i?{op:L,path:U}:{op:L,path:U,value:h(j)}),I.push(L===o?{op:i,path:U}:L===i?{op:o,path:U,value:h(V)}:{op:n,path:U,value:h(V)})})}function c(y,S,x,I){let{base_:T,copy_:R}=y,k=0;T.forEach(_=>{if(!R.has(_)){let F=S.concat([k]);x.push({op:i,path:F,value:_}),I.unshift({op:o,path:F,value:_})}k++}),k=0,R.forEach(_=>{if(!T.has(_)){let F=S.concat([k]);x.push({op:o,path:F,value:_}),I.unshift({op:i,path:F,value:_})}k++})}function g(y,S,x){let{patches_:I,inversePatches_:T}=x;I.push({op:n,path:[],value:S===tl?void 0:S}),T.push({op:n,path:[],value:y})}function v(y,S){return S.forEach(x=>{let{path:I,op:T}=x,R=y;for(let V=0;V<I.length-1;V++){let j=Gr(R),L=I[V];typeof L!="string"&&typeof L!="number"&&(L=""+L),(j===0||j===1)&&(L==="__proto__"||L===Bo)&&Ye(19),Ur(R)&&L===Wo&&Ye(19),R=rr(R,L),jn(R)||Ye(18,I.join("/"))}let k=Gr(R),_=E(x.value),F=I[I.length-1];switch(T){case n:switch(k){case 2:return R.set(F,_);case 3:Ye(16);default:return R[F]=_}case o:switch(k){case 1:return F==="-"?R.push(_):R.splice(F,0,_);case 2:return R.set(F,_);case 3:return R.add(_);default:return R[F]=_}case i:switch(k){case 1:return R.splice(F,1);case 2:return R.delete(F);case 3:return R.delete(x.value);default:return delete R[F]}default:Ye(17,T)}}),y}function E(y){if(!at(y))return y;if(Yo(y))return y.map(E);if(Xo(y))return new Map(Array.from(y.entries()).map(([x,I])=>[x,E(I)]));if(Zo(y))return new Set(Array.from(y).map(E));let S=Object.create(Vr(y));for(let x in y)S[x]=E(y[x]);return Go(y,Vo)&&(S[Vo]=y[Vo]),S}function h(y){return st(y)?E(y):y}xw(ms,{applyPatches_:v,generatePatches_:s,generateReplacementPatches_:g,getPath:t})}var zo=new Nw,$r=zo.produce,ol=zo.produceWithPatches.bind(zo);var il=zo.applyPatches.bind(zo);m();d();f();p();function Fw(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Dw(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 Wf=e=>Array.isArray(e)?e:[e];function Mw(e){let t=Array.isArray(e[0])?e[0]:e;return Dw(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Lw(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var jw=class{constructor(e){this.value=e}deref(){return this.value}},qw=()=>typeof WeakRef>"u"?jw:WeakRef,Yf=qw(),Uw=0,Kf=1;function bs(){return{s:Uw,v:void 0,o:null,p:null}}function Vw(e){return e instanceof Yf?e.deref():e}function Jo(e,t={}){let r=bs(),{resultEqualityCheck:n}=t,o,i=0;function s(){let a=r,{length:u}=arguments;for(let v=0,E=u;v<E;v++){let h=arguments[v];if(typeof h=="function"||typeof h=="object"&&h!==null){let y=a.o;y===null&&(a.o=y=new WeakMap);let S=y.get(h);S===void 0?(a=bs(),y.set(h,a)):a=S}else{let y=a.p;y===null&&(a.p=y=new Map);let S=y.get(h);S===void 0?(a=bs(),y.set(h,a)):a=S}}let c=a,g;if(a.s===Kf)g=a.v;else if(g=e.apply(null,arguments),i++,n){let v=Vw(o);v!=null&&n(v,g)&&(g=v,i!==0&&i--),o=typeof g=="object"&&g!==null||typeof g=="function"?new Yf(g):g}return c.s=Kf,c.v=g,g}return s.clearCache=()=>{r=bs(),s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function Gw(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,s=0,a,u={},c=o.pop();typeof c=="object"&&(u=c,c=o.pop()),Fw(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);let g={...r,...u},{memoize:v,memoizeOptions:E=[],argsMemoize:h=Jo,argsMemoizeOptions:y=[]}=g,S=Wf(E),x=Wf(y),I=Mw(o),T=v(function(){return i++,c.apply(null,arguments)},...S),R=!0,k=h(function(){s++;let F=Lw(I,arguments);return a=T.apply(null,F),a},...x);return Object.assign(k,{resultFunc:c,memoizedResultFunc:T,dependencies:I,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>a,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var je=Gw(Jo);m();d();f();p();function Xf(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var Zf=Xf(),Jf=Xf;var Bw=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?qo:qo.apply(null,arguments)},kD=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},$w=e=>e&&typeof e.match=="function";function G(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(ct(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=>Uo(n)&&n.type===e,r}var am=class ei extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,ei.prototype)}static get[Symbol.species](){return ei}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new ei(...t[0].concat(this)):new ei(...t.concat(this))}};function em(e){return at(e)?$r(e,()=>{}):e}function ws(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function Qw(e){return typeof e=="boolean"}var Hw=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},s=new am;return r&&(Qw(r)?s.push(Zf):s.push(Jf(r.extraArgument))),s},ti="RTK_autoBatch",Vn=()=>e=>({payload:e,meta:{[ti]:!0}}),tm=e=>t=>{setTimeout(t,e)},zw=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(i),clearTimeout(s),r())},i=e(o),s=setTimeout(o,t)},Ww=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,s=!1,a=new Set,u=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?zw(window.requestAnimationFrame,100):tm(10):e.type==="callback"?e.queueNotification:tm(e.timeout),c=()=>{s=!1,i&&(i=!1,a.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let v=()=>o&&g(),E=n.subscribe(v);return a.add(g),()=>{E(),a.delete(g)}},dispatch(g){try{return o=!g?.meta?.[ti],i=!o,i&&(s||(s=!0,u(c))),n.dispatch(g)}finally{o=!0}}})},Kw=e=>function(r){let{autoBatch:n=!0}=r??{},o=new am(e);return n&&o.push(Ww(typeof n=="object"?n:void 0)),o};function cm(e){let t=Hw(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:s=void 0,enhancers:a=void 0}=e||{},u;if(typeof r=="function")u=r;else if(qt(r))u=Ln(r);else throw new Error(ct(1));let c;typeof n=="function"?c=n(t):c=t();let g=qo;o&&(g=Bw({trace:!1,...(typeof o=="object"&&o)}));let v=Of(...c),E=Kw(v),h=typeof a=="function"?a(E):E(),y=g(...h);return Hu(u,s,y)}function um(e){let t={},r=[],n,o={addCase(i,s){let a=typeof i=="string"?i:i.type;if(!a)throw new Error(ct(28));if(a in t)throw new Error(ct(29));return t[a]=s,o},addAsyncThunk(i,s){return s.pending&&(t[i.pending.type]=s.pending),s.rejected&&(t[i.rejected.type]=s.rejected),s.fulfilled&&(t[i.fulfilled.type]=s.fulfilled),s.settled&&r.push({matcher:i.settled,reducer:s.settled}),o},addMatcher(i,s){return r.push({matcher:i,reducer:s}),o},addDefaultCase(i){return n=i,o}};return e(o),[t,r,n]}function Yw(e){return typeof e=="function"}function Ge(e,t){let[r,n,o]=um(t),i;if(Yw(e))i=()=>em(e());else{let a=em(e);i=()=>a}function s(a=i(),u){let c=[r[u.type],...n.filter(({matcher:g})=>g(u)).map(({reducer:g})=>g)];return c.filter(g=>!!g).length===0&&(c=[o]),c.reduce((g,v)=>{if(v)if(st(g)){let h=v(g,u);return h===void 0?g:h}else{if(at(g))return $r(g,E=>v(E,u));{let E=v(g,u);if(E===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return E}}return g},a)}return s.getInitialState=i,s}var lm=(e,t)=>$w(e)?e.match(t):e(t);function Ut(...e){return t=>e.some(r=>lm(r,t))}function Un(...e){return t=>e.every(r=>lm(r,t))}function Is(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 ri(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Rs(...e){return e.length===0?t=>Is(t,["pending"]):ri(e)?Ut(...e.map(t=>t.pending)):Rs()(e[0])}function Hr(...e){return e.length===0?t=>Is(t,["rejected"]):ri(e)?Ut(...e.map(t=>t.rejected)):Hr()(e[0])}function ni(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Un(Hr(...e),t):ri(e)?Un(Hr(...e),t):ni()(e[0])}function or(...e){return e.length===0?t=>Is(t,["fulfilled"]):ri(e)?Ut(...e.map(t=>t.fulfilled)):or()(e[0])}function Ts(...e){return e.length===0?t=>Is(t,["pending","fulfilled","rejected"]):ri(e)?Ut(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Ts()(e[0])}var Xw="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",oi=(e=21)=>{let t="",r=e;for(;r--;)t+=Xw[Math.random()*64|0];return t},Zw=["name","message","stack","code"],sl=class{constructor(e,t){oe(this,"payload");oe(this,"meta");oe(this,"_type");this.payload=e,this.meta=t}},rm=class{constructor(e,t){oe(this,"payload");oe(this,"meta");oe(this,"_type");this.payload=e,this.meta=t}},Jw=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of Zw)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},nm="External signal was aborted",Ce=(()=>{function e(t,r,n){let o=G(t+"/fulfilled",(u,c,g,v)=>({payload:u,meta:{...(v||{}),arg:g,requestId:c,requestStatus:"fulfilled"}})),i=G(t+"/pending",(u,c,g)=>({payload:void 0,meta:{...(g||{}),arg:c,requestId:u,requestStatus:"pending"}})),s=G(t+"/rejected",(u,c,g,v,E)=>({payload:v,error:(n&&n.serializeError||Jw)(u||"Rejected"),meta:{...(E||{}),arg:g,requestId:c,rejectedWithValue:!!v,requestStatus:"rejected",aborted:u?.name==="AbortError",condition:u?.name==="ConditionError"}}));function a(u,{signal:c}={}){return(g,v,E)=>{let h=n?.idGenerator?n.idGenerator(u):oi(),y=new l.AbortController,S,x;function I(R){x=R,y.abort()}c&&(c.aborted?I(nm):c.addEventListener("abort",()=>I(nm),{once:!0}));let T=_asyncToGenerator(function*(){let R;try{let _=n?.condition?.(u,{getState:v,extra:E});if(tC(_)&&(_=yield _),_===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let F=new Promise((V,j)=>{S=()=>{j({name:"AbortError",message:x||"Aborted"})},y.signal.addEventListener("abort",S,{once:!0})});g(i(h,u,n?.getPendingMeta?.({requestId:h,arg:u},{getState:v,extra:E}))),R=yield Promise.race([F,Promise.resolve(r(u,{dispatch:g,getState:v,extra:E,requestId:h,signal:y.signal,abort:I,rejectWithValue:(V,j)=>new sl(V,j),fulfillWithValue:(V,j)=>new rm(V,j)})).then(V=>{if(V instanceof sl)throw V;return V instanceof rm?o(V.payload,h,u,V.meta):o(V,h,u)})])}catch(_){R=_ instanceof sl?s(null,h,u,_.payload,_.meta):s(_,h,u)}finally{S&&y.signal.removeEventListener("abort",S)}return n&&!n.dispatchConditionRejection&&s.match(R)&&R.meta.condition||g(R),R})();return Object.assign(T,{abort:I,requestId:h,arg:u,unwrap(){return T.then(eC)}})}}return Object.assign(a,{pending:i,rejected:s,fulfilled:o,settled:Ut(s,o),typePrefix:t})}return e.withTypes=()=>e,e})();function eC(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function tC(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var dm=Symbol.for("rtk-slice-createasyncthunk"),PD={[dm]:Ce};function rC(e,t){return`${e}/${t}`}function nC({creators:e}={}){let t=e?.asyncThunk?.[dm];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(ct(11));typeof process<"u";let s=(typeof n.reducers=="function"?n.reducers(iC()):n.reducers)||{},a=Object.keys(s),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(R,k){let _=typeof R=="string"?R:R.type;if(!_)throw new Error(ct(12));if(_ in u.sliceCaseReducersByType)throw new Error(ct(13));return u.sliceCaseReducersByType[_]=k,c},addMatcher(R,k){return u.sliceMatchers.push({matcher:R,reducer:k}),c},exposeAction(R,k){return u.actionCreators[R]=k,c},exposeCaseReducer(R,k){return u.sliceCaseReducersByName[R]=k,c}};a.forEach(R=>{let k=s[R],_={reducerName:R,type:rC(o,R),createNotation:typeof n.reducers=="function"};aC(k)?uC(_,k,c,t):sC(_,k,c)});function g(){let[R={},k=[],_=void 0]=typeof n.extraReducers=="function"?um(n.extraReducers):[n.extraReducers],F={...R,...u.sliceCaseReducersByType};return Ge(n.initialState,V=>{for(let j in F)V.addCase(j,F[j]);for(let j of u.sliceMatchers)V.addMatcher(j.matcher,j.reducer);for(let j of k)V.addMatcher(j.matcher,j.reducer);_&&V.addDefaultCase(_)})}let v=R=>R,E=new Map,h=new WeakMap,y;function S(R,k){return y||(y=g()),y(R,k)}function x(){return y||(y=g()),y.getInitialState()}function I(R,k=!1){function _(V){let j=V[R];return typeof j>"u"&&k&&(j=ws(h,_,x)),j}function F(V=v){let j=ws(E,k,()=>new WeakMap);return ws(j,V,()=>{let L={};for(let[U,M]of Object.entries(n.selectors??{}))L[U]=oC(M,V,()=>ws(h,V,x),k);return L})}return{reducerPath:R,getSelectors:F,get selectors(){return F(_)},selectSlice:_}}let T={name:o,reducer:S,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:x,...I(i),injectInto(R,{reducerPath:k,..._}={}){let F=k??i;return R.inject({reducerPath:F,reducer:S},_),{...T,...I(F,!0)}}};return T}}function oC(e,t,r,n){function o(i,...s){let a=t(i);return typeof a>"u"&&n&&(a=r()),e(a,...s)}return o.unwrapped=e,o}var zr=nC();function iC(){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 sC({type:e,reducerName:t,createNotation:r},n,o){let i,s;if("reducer"in n){if(r&&!cC(n))throw new Error(ct(17));i=n.reducer,s=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?G(e,s):G(e))}function aC(e){return e._reducerDefinitionType==="asyncThunk"}function cC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function uC({type:e,reducerName:t},r,n,o){if(!o)throw new Error(ct(18));let{payloadCreator:i,fulfilled:s,pending:a,rejected:u,settled:c,options:g}=r,v=o(e,i,g);n.exposeAction(t,v),s&&n.addCase(v.fulfilled,s),a&&n.addCase(v.pending,a),u&&n.addCase(v.rejected,u),c&&n.addMatcher(v.settled,c),n.exposeCaseReducer(t,{fulfilled:s||Cs,pending:a||Cs,rejected:u||Cs,settled:c||Cs})}function Cs(){}var lC="task",pm="listener",fm="completed",ul="cancelled",dC=`task-${ul}`,pC=`task-${fm}`,al=`${pm}-${ul}`,fC=`${pm}-${fm}`,_s=class{constructor(e){oe(this,"code");oe(this,"name","TaskAbortError");oe(this,"message");this.code=e,this.message=`${lC} ${ul} (reason: ${e})`}},ll=(e,t)=>{if(typeof e!="function")throw new TypeError(ct(32))},xs=()=>{},mm=(e,t=xs)=>(e.catch(t),e),gm=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Qr=e=>{if(e.aborted)throw new _s(e.reason)};function hm(e,t){let r=xs;return new Promise((n,o)=>{let i=()=>o(new _s(e.reason));if(e.aborted){i();return}r=gm(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=xs})}var mC=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof _s?"cancelled":"rejected",error:r}}finally{t?.()}});return function mC(_x5,_x6){return _ref5.apply(this,arguments)}}(),Es=e=>t=>mm(hm(e,t).then(r=>(Qr(e),r))),ym=e=>{let t=Es(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:qn}=Object,om={},ks="listenerMiddleware",gC=(e,t)=>{let r=n=>gm(e,()=>n.abort(e.reason));return(n,o)=>{ll(n,"taskExecutor");let i=new l.AbortController;r(i);let s=mC(/*#__PURE__*/_asyncToGenerator(function*(){Qr(e),Qr(i.signal);let a=yield n({pause:Es(i.signal),delay:ym(i.signal),signal:i.signal});return Qr(i.signal),a}),()=>i.abort(pC));return o?.autoJoin&&t.push(s.catch(xs)),{result:Es(e)(s),cancel(){i.abort(dC)}}}},hC=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){Qr(t);let i=()=>{},a=[new Promise((u,c)=>{let g=e({predicate:n,effect:(v,E)=>{E.unsubscribe(),u([v,E.getState(),E.getOriginalState()])}});i=()=>{g(),c()}})];o!=null&&a.push(new Promise(u=>setTimeout(u,o,null)));try{let u=yield hm(t,Promise.race(a));return Qr(t),u}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>mm(r(n,o))},vm=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=G(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(ct(21));return ll(i,"options.listener"),{predicate:o,type:t,effect:i}},Sm=qn(e=>{let{type:t,predicate:r,effect:n}=vm(e);return{id:oi(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(ct(22))}}},{withTypes:()=>Sm}),im=(e,t)=>{let{type:r,effect:n,predicate:o}=vm(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},cl=e=>{e.pending.forEach(t=>{t.abort(al)})},yC=(e,t)=>()=>{for(let r of t.keys())cl(r);e.clear()},sm=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Am=qn(G(`${ks}/add`),{withTypes:()=>Am}),vC=G(`${ks}/removeAll`),bm=qn(G(`${ks}/remove`),{withTypes:()=>bm}),SC=(...e)=>{console.error(`${ks}/error`,...e)},wm=(e={})=>{let t=new Map,r=new Map,n=h=>{let y=r.get(h)??0;r.set(h,y+1)},o=h=>{let y=r.get(h)??1;y===1?r.delete(h):r.set(h,y-1)},{extra:i,onError:s=SC}=e;ll(s,"onError");let a=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&cl(h)}),u=h=>{let y=im(t,h)??Sm(h);return a(y)};qn(u,{withTypes:()=>u});let c=h=>{let y=im(t,h);return y&&(y.unsubscribe(),h.cancelActive&&cl(y)),!!y};qn(c,{withTypes:()=>c});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,S,x){let I=new l.AbortController,T=hC(u,I.signal),R=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(y,qn({},S,{getOriginalState:x,condition:(k,_)=>T(k,_).then(Boolean),take:T,delay:ym(I.signal),pause:Es(I.signal),extra:i,signal:I.signal,fork:gC(I.signal,R),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((k,_,F)=>{k!==I&&(k.abort(al),F.delete(k))})},cancel:()=>{I.abort(al),h.pending.delete(I)},throwIfCancelled:()=>{Qr(I.signal)}})))}catch(k){k instanceof _s||sm(s,k,{raisedBy:"effect"})}finally{yield Promise.all(R),I.abort(fC),o(h),h.pending.delete(I)}});return function g(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),v=yC(t,r);return{middleware:h=>y=>S=>{if(!Uo(S))return y(S);if(Am.match(S))return u(S.payload);if(vC.match(S)){v();return}if(bm.match(S))return c(S.payload);let x=h.getState(),I=()=>{if(x===om)throw new Error(ct(23));return x},T;try{if(T=y(S),t.size>0){let R=h.getState(),k=Array.from(t.values());for(let _ of k){let F=!1;try{F=_.predicate(S,R,x)}catch(V){F=!1,sm(s,V,{raisedBy:"predicate"})}F&&g(_,S,h,I)}}}finally{x=om}return T},startListening:u,stopListening:c,clearListeners:v}};function ct(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}m();d();f();p();var ee=new re({required:!0,emptyAllowed:!1}),Be=new re({required:!1,emptyAllowed:!1}),Nt=new re({required:!0,emptyAllowed:!0}),$D=new re({required:!1,emptyAllowed:!0}),Cm=new Pt({each:ee,required:!0}),xm=new re({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Em=new re({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),QD=new re({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),AC=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),dl=(e,t)=>{if("required"in t)return{payload:new Ot({value:t}).validate({value:e}).value};let o=new xe({options:{required:!0},values:t}).validate(e);if(o)throw new qu(o);return{payload:e}},W=(e,t)=>{try{return dl(e,t)}catch(r){return{payload:e,error:AC(r)}}};var Os=(e,t,r,n)=>{let o=`Check the options of ${n}`;return bC(e,t,r,o,"Controller initialization error")},bC=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};var Ps=G("caseAssistConfiguration/set",e=>W(e,{caseAssistId:ee,locale:Be,proxyBaseUrl:new re({required:!1,url:!0})}));m();d();f();p();m();d();f();p();var Im=()=>({caseAssistId:"",locale:"en-US"});var yr=Ge(Im(),e=>{e.addCase(Ps,(t,r)=>{t.caseAssistId=r.payload.caseAssistId,t.locale=r.payload.locale,t.apiBaseUrl=r.payload.proxyBaseUrl})});m();d();f();p();m();d();f();p();m();d();f();p();var Rm={q:new re,enableQuerySyntax:new Le,aq:new re,cq:new re,firstResult:new De({min:0}),numberOfResults:new De({min:0}),sortCriteria:new re,f:new xe,fExcluded:new xe,cf:new xe,nf:new xe,mnf:new xe,df:new xe,debug:new Le,sf:new xe,tab:new re,af:new xe};var Ns=G("searchParameters/restore",e=>W(e,Rm)),Tm=G("searchParameters/restoreTab",e=>W(e,ee));m();d();f();p();var _m=G("debug/enable"),km=G("debug/disable");m();d();f();p();var Fs=()=>!1;var Om=Ge(Fs(),e=>{e.addCase(_m,()=>!0).addCase(km,()=>!1).addCase(Ns,(t,r)=>r.payload.debug??t)});m();d();f();p();var Ds=G("searchHub/set",e=>W(e,new re({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var Gn="3.53.0",Pm=["@coveo/atomic","@coveo/quantic"];var pl=()=>Be,Nm=()=>ee,Bn=G("configuration/updateBasicConfiguration",e=>W(e,{accessToken:Be,environment:new re({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:Be})),Ms=G("configuration/updateSearchConfiguration",e=>W(e,{proxyBaseUrl:new re({required:!1,url:!0}),pipeline:new re({required:!1,emptyAllowed:!0}),searchHub:Be,timezone:Be,locale:Be,authenticationProviders:new Pt({required:!1,each:ee})})),wC={enabled:new Le({default:!0}),originContext:pl(),originLevel2:pl(),originLevel3:pl(),proxyBaseUrl:new re({required:!1,url:!0}),runtimeEnvironment:new qr,anonymous:new Le({default:!1}),deviceId:Be,userDisplayName:Be,documentLocation:Be,trackingId:Em,analyticsMode:new re({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new xe({options:{required:!1},values:Pm.reduce((e,t)=>(e[t]=xm,e),{})})},Ls=G("configuration/updateAnalyticsConfiguration",e=>W(e,wC)),js=G("configuration/analytics/disable"),qs=G("configuration/analytics/enable"),Fm=G("configuration/analytics/originlevel2",e=>W(e,{originLevel2:Nm()})),Dm=G("configuration/analytics/originlevel3",e=>W(e,{originLevel3:Nm()})),Mm=G("knowledge/setAgentId",e=>W(e,new re({required:!0})));m();d();f();p();var CC=G("history/undo"),xC=G("history/redo"),Vt=G("history/snapshot"),bL=Ce("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(CC()),yield t(Us())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),wL=Ce("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(xC()),yield t(Us())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),Us=Ce("history/change",/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x15,_x16){return _ref1.apply(this,arguments)}}());m();d();f();p();var $n=()=>"default";var Lm=Ge($n(),e=>{e.addCase(Ds,(t,r)=>r.payload).addCase(Us.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Ms,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function jm(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}m();d();f();p();m();d();f();p();m();d();f();p();var qm=/^(?:[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 EC(e){return typeof e=="string"&&qm.test(e)}var fl=EC;m();d();f();p();var Xe=[];for(let e=0;e<256;++e)Xe.push((e+256).toString(16).slice(1));function Um(e,t=0){return(Xe[e[t+0]]+Xe[e[t+1]]+Xe[e[t+2]]+Xe[e[t+3]]+"-"+Xe[e[t+4]]+Xe[e[t+5]]+"-"+Xe[e[t+6]]+Xe[e[t+7]]+"-"+Xe[e[t+8]]+Xe[e[t+9]]+"-"+Xe[e[t+10]]+Xe[e[t+11]]+Xe[e[t+12]]+Xe[e[t+13]]+Xe[e[t+14]]+Xe[e[t+15]]).toLowerCase()}m();d();f();p();var ml,IC=new Uint8Array(16);function gl(){if(!ml){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ml=crypto.getRandomValues.bind(crypto)}return ml(IC)}m();d();f();p();m();d();f();p();var RC=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),hl={randomUUID:RC};function TC(e,t,r){e=e||{};let n=e.random??e.rng?.()??gl();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 Um(n)}function _C(e,t,r){return hl.randomUUID&&!t&&!e?hl.randomUUID():TC(e,t,r)}var yl=_C;function kC(_x17){return _kC.apply(this,arguments)}function _kC(){_kC=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:i,mode:s}=e;if(s!=="disabled")return n.call(r),t.send(o,i,r)});return _kC.apply(this,arguments)}var Hm="2.1.1",vl=128,zm=192,Vm=224,Gm=240,OC=248;function PC(e){return(e&OC)===Gm?4:(e&Gm)===Vm?3:(e&Vm)===zm?2:1}function NC(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&vl)!=vl)break;if(r-=3,(n&zm)!=vl){t-r>=PC(n)*3&&(r=t);break}}return e.substring(0,r)}function FC(e){let{trackingId:t}=e;return{trackingId:t}}function DC(e){return(e.source||[]).concat([`relay@${Hm}`])}function Wm(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,s=FC(t),a=r.getClientId();return Object.freeze({type:e,config:s,ts:Date.now(),source:DC(t),clientId:a,userAgent:i(),referrer:Bm(n()),location:Bm(o())})}function Bm(e){return e!==null?NC(e,1024):null}function MC(e,t,r,n){return{...t,meta:Wm(e,r,n)}}var LC="*";function jC(){let e=[];function t({type:u,callback:c}){return e.findIndex(g=>g.type===u&&g.callback===c)}function r(u,c){return u.type==="*"||c===u.type}function n(u){return t(u)<0&&e.push(u),()=>a(u.type,u.callback)}function o(u){e.forEach(c=>{if(r(c,u.meta.type))try{c.callback(u)}catch(g){console.error(g)}})}function i(u){if(u===LC)e.length=0;else for(let c=e.length-1;c>=0;c--)e[c].type===u&&e.splice(c,1)}function s(u){let c=t(u);c>=0&&e.splice(c,1)}function a(u,c){c?s({type:u,callback:c}):i(u)}return{add:n,call:o,remove:a}}function $m({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 qC(e){let t=$m(e);return{get:()=>t,update:r=>{t=$m({...t,...r})}}}var Sl=UC();function UC(){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 i of o){let s=i.replace(/^\s+/,"");if(s.lastIndexOf(n,0)===0)return s.substring(n.length,s.length)}return null},setItem(r,n,o){let i=t(window.location.hostname),s=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,a=i?`;domain=${i}`:"";document.cookie=`${e}${r}=${n}${s}${a};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function VC(){return{getItem(e){return Sl.getItem(e)||localStorage.getItem(e)},removeItem(e){Sl.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Sl.setItem(e,t,31556952e3)}}}var Qm="visitorId";function GC(){let e=document.referrer;return e===""?null:e}function Al(){let e=VC();return{runtime:"browser",send:function(){var _ref10=_asyncToGenerator(function*(t,r,n){let o=w(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});jm().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let s=yield o;if(s?.ok){let a;try{a=yield s.json()}catch{return}for(let u of a.events)if(!u.accepted)throw new Error(`Received event was rejected for processing: ${u.errorMessage}`)}else throw new Error(`Error ${s.status}: Failed to send the event(s).`)});return function send(_x18,_x19,_x20){return _ref10.apply(this,arguments)}}(),getReferrer:()=>GC(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(Qm);if(t&&fl(t))return t;let r=yl();return e.setItem(Qm,r),r}}}function BC(){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 $C(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function QC(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=$C();return t&&r?{...r,runtime:"custom"}:t&&HC()&&BC()?Al():n}function HC(){try{return typeof window=="object"}catch{return!1}}function zC(e){return{get:()=>Object.freeze(QC(e))}}function Km(e){let t=qC(e),r=jC(),n=zC(t);return{emit:function(){var _ref11=_asyncToGenerator(function*(o,i){let s=t.get(),a=n.get(),u=MC(o,i,s,a);return kC({config:s,environment:a,event:u,listenerManager:r})});return function emit(_x21,_x22){return _ref11.apply(this,arguments)}}(),getMeta:o=>Wm(o,t.get(),n.get()),on:(o,i)=>r.add({type:o,callback:i}),off:(o,i)=>r.remove(o,i),updateConfig:o=>t.update(o),version:Hm}}m();d();f();p();function Ym(){return typeof window<"u"&&typeof document<"u"}m();d();f();p();var Qn=je(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Gn}`));var ii=je(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Qn(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},s,a)=>{let u=KC(a);return Km({mode:i?"emit":"disabled",url:o??es(e,t),token:r,trackingId:n??null,source:s,environment:u})}),WC={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref12=_asyncToGenerator(function*(){});return function send(){return _ref12.apply(this,arguments)}}()},KC=e=>{if(!e)return;let t=e();return{...(Ym()?Al():WC),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();m();d();f();p();m();d();f();p();var Xm=class extends Error{constructor(t){super(t[0].message);oe(this,"issues");this.name="SchemaError",this.issues=t}};var sr="uninitialized",Cl="pending",ai="fulfilled",ci="rejected";function Zm(e){return{status:e,isUninitialized:e===sr,isLoading:e===Cl,isSuccess:e===ai,isError:e===ci}}var Jm=qt;function fg(e,t){if(e===t||!(Jm(e)&&Jm(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),o=r.length===n.length,i=Array.isArray(t)?[]:{};for(let s of r)i[s]=fg(e[s],t[s]),o&&(o=e[s]===i[s]);return o?e:i}function xl(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function YC(e){return new RegExp("(^|:)//").test(e)}function XC(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Tl(e){return e!=null}function eg(e){return[...(e?.values()??[])].filter(Tl)}function ZC(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var JC=e=>e.replace(/\/$/,""),ex=e=>e.replace(/^\//,"");function tx(e,t){if(!e)return t;if(!t)return e;if(YC(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=JC(e),t=ex(t),`${e}${r}${t}`}function Bs(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var El=()=>new Map,rx=e=>{let t=new l.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},nx=(...e)=>{for(let r of e)if(r.aborted)return l.AbortSignal.abort(r.reason);let t=new l.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},tg=(...e)=>w(...e),ox=e=>e.status>=200&&e.status<=299,ix=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function rg(e){if(!qt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var sx=e=>typeof e=="object"&&(qt(e)||Array.isArray(e)||typeof e.toJSON=="function");function mg({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=tg,paramsSerializer:n,isJsonContentType:o=ix,jsonContentType:i="application/json",jsonReplacer:s,timeout:a,responseHandler:u,validateStatus:c,...g}={}){return typeof w>"u"&&r===tg&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*(E,h,y){let{getState:S,extra:x,endpoint:I,forced:T,type:R}=h,k,{url:_,headers:F=new C(g.headers),params:V=void 0,responseHandler:j=u??"json",validateStatus:L=c??ox,timeout:U=a,...M}=typeof E=="string"?{url:E}:E,O={...g,signal:U?nx(h.signal,rx(U)):h.signal,...M};F=new C(rg(F)),O.headers=(yield t(F,{getState:S,arg:E,extra:x,endpoint:I,forced:T,type:R,extraOptions:y}))||F;let P=sx(O.body);if(O.body!=null&&!P&&typeof O.body!="string"&&O.headers.delete("content-type"),!O.headers.has("content-type")&&P&&O.headers.set("content-type",i),P&&o(O.headers)&&(O.body=JSON.stringify(O.body,s)),O.headers.has("accept")||(j==="json"?O.headers.set("accept","application/json"):j==="text"&&O.headers.set("accept","text/plain, text/html, */*")),V){let J=~_.indexOf("?")?"&":"?",se=n?n(V):new URLSearchParams(rg(V));_+=J+se}_=tx(e,_);let N=new Request(_,O);k={request:new Request(_,O)};let $;try{$=yield r(N)}catch(J){return{error:{status:(J instanceof Error||typeof DOMException<"u"&&J instanceof DOMException)&&J.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(J)},meta:k}}let Y=$.clone();k.response=Y;let K,H="";try{let J;if(yield Promise.all([v($,j).then(se=>K=se,se=>J=se),Y.text().then(se=>H=se,()=>{})]),J)throw J}catch(J){return{error:{status:"PARSING_ERROR",originalStatus:$.status,data:H,error:String(J)},meta:k}}return L($,K)?{data:K,meta:k}:{error:{status:$.status,data:K},meta:k}});return function(_x23,_x24,_x25){return _ref13.apply(this,arguments)}}());function v(_x26,_x27){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(E,h){if(typeof h=="function")return h(E);if(h==="content-type"&&(h=o(E.headers)?"json":"text"),h==="json"){let y=yield E.text();return y.length?JSON.parse(y):null}return E.text()});return _v2.apply(this,arguments)}}var Hn=class{constructor(e,t=void 0){oe(this,"value");oe(this,"meta");this.value=e,this.meta=t}};function ax(){return _ax.apply(this,arguments)}function _ax(){_ax=_asyncToGenerator(function*(e=0,t=5,r){let n=Math.min(e,t),o=~~((Math.random()+.4)*(300<<n));yield new Promise((i,s)=>{let a=setTimeout(()=>i(),o);if(r){let u=()=>{clearTimeout(a),s(new Error("Aborted"))};r.aborted?(clearTimeout(a),s(new Error("Aborted"))):r.addEventListener("abort",u,{once:!0})}})});return _ax.apply(this,arguments)}function gg(e,t){throw Object.assign(new Hn({error:e,meta:t}),{throwImmediately:!0})}function bl(e){e.aborted&&gg({status:"CUSTOM_ERROR",error:"Aborted"})}var ng={},cx=(e,t)=>(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(r,n,o){let i=[5,(t||ng).maxRetries,(o||ng).maxRetries].filter(g=>g!==void 0),[s]=i.slice(-1),u={maxRetries:s,backoff:ax,retryCondition:(g,v,{attempt:E})=>E<=s,...t,...o},c=0;for(;;){bl(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Hn(g);return g}catch(g){if(c++,g.throwImmediately){if(g instanceof Hn)return g.value;throw g}if(g instanceof Hn){if(!u.retryCondition(g.value.error,r,{attempt:c,baseQueryApi:n,extraOptions:o}))return g.value}else if(c>u.maxRetries)return{error:g};bl(n.signal);try{yield u.backoff(c,u.maxRetries,n.signal)}catch(v){throw bl(n.signal),v}}}});return function(_x28,_x29,_x30){return _ref14.apply(this,arguments)}}()),hg=Object.assign(cx,{fail:gg}),Qs="__rtkq/",ux="online",lx="offline";var yg="focused";var _l=G(`${Qs}${yg}`),vg=G(`${Qs}un${yg}`),kl=G(`${Qs}${ux}`),Sg=G(`${Qs}${lx}`);var di="query",Ag="mutation",bg="infinitequery";function Hs(e){return e.type===di}function dx(e){return e.type===Ag}function zs(e){return e.type===bg}function $s(e){return Hs(e)||zs(e)}function Ol(e,t,r,n,o,i){let s=px(e)?e(t,r,n,o):e;return s?xl(s,Tl,a=>i(wg(a))):[]}function px(e){return typeof e=="function"}function wg(e){return typeof e=="string"?{type:e}:e}function fx(e,t){return e.catch(t)}var zn=(e,t)=>e.endpointDefinitions[t],ui=Symbol("forceQueryFn"),Il=e=>typeof e[ui]=="function";function mx({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:s}){let a=_=>s(_)?.runningQueries,u=_=>s(_)?.runningMutations,{unsubscribeQueryResult:c,removeMutationResult:g,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:T,buildInitiateInfiniteQuery:R,buildInitiateMutation:k,getRunningQueryThunk:E,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:S};function E(_,F){return V=>{let j=zn(i,_),L=e({queryArgs:F,endpointDefinition:j,endpointName:_});return a(V)?.get(L)}}function h(_,F){return V=>u(V)?.get(F)}function y(){return _=>eg(a(_))}function S(){return _=>eg(u(_))}function x(_){}function I(_,F){let V=(j,{subscribe:L=!0,forceRefetch:U,subscriptionOptions:M,[ui]:O,...P}={})=>(N,Q)=>{let $=e({queryArgs:j,endpointDefinition:F,endpointName:_}),Y,K={...P,type:di,subscribe:L,forceRefetch:U,subscriptionOptions:M,endpointName:_,originalArgs:j,queryCacheKey:$,[ui]:O};if(Hs(F))Y=t(K);else{let{direction:de,initialPageParam:he,refetchCachedPages:fe}=P;Y=r({...K,direction:de,initialPageParam:he,refetchCachedPages:fe})}let H=o.endpoints[_].select(j),J=N(Y),se=H(Q());let{requestId:be,abort:Oe}=J,Ie=se.requestId!==be,Te=a(N)?.get($),_e=()=>H(Q()),pe=Object.assign(O?J.then(_e):Ie&&!Te?Promise.resolve(se):Promise.all([Te,J]).then(_e),{arg:j,requestId:be,subscriptionOptions:M,queryCacheKey:$,abort:Oe,unwrap(){return _asyncToGenerator(function*(){let de=yield pe;if(de.isError)throw de.error;return de.data})()},refetch:de=>N(V(j,{subscribe:!1,forceRefetch:!0,...de})),unsubscribe(){L&&N(c({queryCacheKey:$,requestId:be}))},updateSubscriptionOptions(de){pe.subscriptionOptions=de,N(v({endpointName:_,requestId:be,queryCacheKey:$,options:de}))}});if(!Te&&!Ie&&!O){let de=a(N);de.set($,pe),pe.then(()=>{de.delete($)})}return pe};return V}function T(_,F){return I(_,F)}function R(_,F){return I(_,F)}function k(_){return(F,{track:V=!0,fixedCacheKey:j}={})=>(L,U)=>{let M=n({type:"mutation",endpointName:_,originalArgs:F,track:V,fixedCacheKey:j}),O=L(M);let{requestId:P,abort:N,unwrap:Q}=O,$=fx(O.unwrap().then(J=>({data:J})),J=>({error:J})),Y=()=>{L(g({requestId:P,fixedCacheKey:j}))},K=Object.assign($,{arg:O.arg,requestId:P,abort:N,unwrap:Q,reset:Y}),H=u(L);return H.set(P,K),K.then(()=>{H.delete(P)}),j&&(H.set(j,K),K.then(()=>{H.get(j)===K&&H.delete(j)})),K}}}var Cg=class extends Xm{constructor(t,r,n,o){super(t);oe(this,"value");oe(this,"schemaName");oe(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},Wr=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function Kr(_x31,_x32,_x33,_x34){return _Kr.apply(this,arguments)}function _Kr(){_Kr=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new Cg(o.issues,t,r,n);return o.value});return _Kr.apply(this,arguments)}function og(e){return e}var si=(e={})=>({...e,[ti]:!0});function gx({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:s,onSchemaFailure:a,catchSchemaFailure:u,skipSchemaValidation:c}){let g=(M,O,P,N)=>(Q,$)=>{let Y=r[M],K=n({queryArgs:O,endpointDefinition:Y,endpointName:M});if(Q(o.internalActions.queryResultPatched({queryCacheKey:K,patches:P})),!N)return;let H=o.endpoints[M].select(O)($()),J=Ol(Y.providesTags,H.data,void 0,O,{},i);Q(o.internalActions.updateProvidedBy([{queryCacheKey:K,providedTags:J}]))};function v(M,O,P=0){let N=[O,...M];return P&&N.length>P?N.slice(0,-1):N}function E(M,O,P=0){let N=[...M,O];return P&&N.length>P?N.slice(1):N}let h=(M,O,P,N=!0)=>(Q,$)=>{let K=o.endpoints[M].select(O)($()),H={patches:[],inversePatches:[],undo:()=>Q(o.util.patchQueryData(M,O,H.inversePatches,N))};if(K.status===sr)return H;let J;if("data"in K)if(at(K.data)){let[se,be,Oe]=ol(K.data,P);H.patches.push(...be),H.inversePatches.push(...Oe),J=se}else J=P(K.data),H.patches.push({op:"replace",path:[],value:J}),H.inversePatches.push({op:"replace",path:[],value:K.data});return H.patches.length===0||Q(o.util.patchQueryData(M,O,H.patches,N)),H},y=(M,O,P)=>N=>N(o.endpoints[M].initiate(O,{subscribe:!1,forceRefetch:!0,[ui]:()=>({data:P})})),S=(M,O)=>M.query&&M[O]?M[O]:og,x=/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(M,{signal:O,abort:P,rejectWithValue:N,fulfillWithValue:Q,dispatch:$,getState:Y,extra:K}){let H=r[M.endpointName],{metaSchema:J,skipSchemaValidation:se=c}=H,be=M.type===di;try{let Oe=og,Ie={signal:O,abort:P,dispatch:$,getState:Y,extra:K,endpoint:M.endpointName,type:M.type,forced:be?I(M,Y()):void 0,queryCacheKey:be?M.queryCacheKey:void 0},Te=be?M[ui]:void 0,_e,pe=/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(he,fe,Ue,$e){if(fe==null&&he.pages.length)return Promise.resolve({data:he});let Tt={queryArg:M.originalArgs,pageParam:fe},mt=yield de(Tt),jt=$e?v:E;return{data:{pages:jt(he.pages,mt.data,Ue),pageParams:jt(he.pageParams,fe,Ue)},meta:mt.meta}});return function pe(_x37,_x38,_x39,_x40){return _ref16.apply(this,arguments)}}();function de(_x41){return _de.apply(this,arguments)}function _de(){_de=_asyncToGenerator(function*(he){let fe,{extraOptions:Ue,argSchema:$e,rawResponseSchema:Tt,responseSchema:mt}=H;if($e&&!Wr(se,"arg")&&(he=yield Kr($e,he,"argSchema",{})),Te?fe=Te():H.query?(Oe=S(H,"transformResponse"),fe=yield t(H.query(he),Ie,Ue)):fe=yield H.queryFn(he,Ie,Ue,_t=>t(_t,Ie,Ue)),typeof process<"u",fe.error)throw new Hn(fe.error,fe.meta);let{data:jt}=fe;Tt&&!Wr(se,"rawResponse")&&(jt=yield Kr(Tt,fe.data,"rawResponseSchema",fe.meta));let St=yield Oe(jt,fe.meta,he);return mt&&!Wr(se,"response")&&(St=yield Kr(mt,St,"responseSchema",fe.meta)),{...fe,data:St}});return _de.apply(this,arguments)}if(be&&"infiniteQueryOptions"in H){let{infiniteQueryOptions:he}=H,{maxPages:fe=1/0}=he,Ue=M.refetchCachedPages??he.refetchCachedPages??!0,$e,Tt={pages:[],pageParams:[]},mt=s.selectQueryEntry(Y(),M.queryCacheKey)?.data,St=I(M,Y())&&!M.direction||!mt?Tt:mt;if("direction"in M&&M.direction&&St.pages.length){let _t=M.direction==="backward",Hi=(_t?xg:Rl)(he,St,M.originalArgs);$e=yield pe(St,Hi,fe,_t)}else{let{initialPageParam:_t=he.initialPageParam}=M,Oo=mt?.pageParams??[],Hi=Oo[0]??_t,WA=Oo.length;if($e=yield pe(St,Hi,fe),Te&&($e={data:$e.data.pages[0]}),Ue)for(let Gp=1;Gp<WA;Gp++){let KA=Rl(he,$e.data,M.originalArgs);$e=yield pe($e.data,KA,fe)}}_e=$e}else _e=yield de(M.originalArgs);return J&&!Wr(se,"meta")&&_e.meta&&(_e.meta=yield Kr(J,_e.meta,"metaSchema",_e.meta)),Q(_e.data,si({fulfilledTimeStamp:Date.now(),baseQueryMeta:_e.meta}))}catch(Oe){let Ie=Oe;if(Ie instanceof Hn){let Te=S(H,"transformErrorResponse"),{rawErrorResponseSchema:_e,errorResponseSchema:pe}=H,{value:de,meta:he}=Ie;try{_e&&!Wr(se,"rawErrorResponse")&&(de=yield Kr(_e,de,"rawErrorResponseSchema",he)),J&&!Wr(se,"meta")&&(he=yield Kr(J,he,"metaSchema",he));let fe=yield Te(de,he,M.originalArgs);return pe&&!Wr(se,"errorResponse")&&(fe=yield Kr(pe,fe,"errorResponseSchema",he)),N(fe,si({baseQueryMeta:he}))}catch(fe){Ie=fe}}try{if(Ie instanceof Cg){let Te={endpoint:M.endpointName,arg:M.originalArgs,type:M.type,queryCacheKey:be?M.queryCacheKey:void 0};H.onSchemaFailure?.(Ie,Te),a?.(Ie,Te);let{catchSchemaFailure:_e=u}=H;if(_e)return N(_e(Ie,Te),si({baseQueryMeta:Ie._bqMeta}))}}catch(Te){Ie=Te}throw typeof process<"u",console.error(Ie),Ie}});return function x(_x35,_x36){return _ref15.apply(this,arguments)}}();function I(M,O){let P=s.selectQueryEntry(O,M.queryCacheKey),N=s.selectConfig(O).refetchOnMountOrArgChange,Q=P?.fulfilledTimeStamp,$=M.forceRefetch??(M.subscribe&&N);return $?$===!0||(Number(new Date)-Number(Q))/1e3>=$:!1}let T=()=>Ce(`${e}/executeQuery`,x,{getPendingMeta({arg:O}){let P=r[O.endpointName];return si({startedTimeStamp:Date.now(),...(zs(P)?{direction:O.direction}:{})})},condition(O,{getState:P}){let N=P(),Q=s.selectQueryEntry(N,O.queryCacheKey),$=Q?.fulfilledTimeStamp,Y=O.originalArgs,K=Q?.originalArgs,H=r[O.endpointName],J=O.direction;return Il(O)?!0:Q?.status==="pending"?!1:I(O,N)||Hs(H)&&H?.forceRefetch?.({currentArg:Y,previousArg:K,endpointState:Q,state:N})?!0:!($&&!J)},dispatchConditionRejection:!0}),R=T(),k=T(),_=Ce(`${e}/executeMutation`,x,{getPendingMeta(){return si({startedTimeStamp:Date.now()})}}),F=M=>"force"in M,V=M=>"ifOlderThan"in M,j=(M,O,P={})=>(N,Q)=>{let $=F(P)&&P.force,Y=V(P)&&P.ifOlderThan,K=(J=!0)=>{let se={forceRefetch:J,subscribe:!1};return o.endpoints[M].initiate(O,se)},H=o.endpoints[M].select(O)(Q());if($)N(K());else if(Y){let J=H?.fulfilledTimeStamp;if(!J){N(K());return}(Number(new Date)-Number(new Date(J)))/1e3>=Y&&N(K())}else N(K(!1))};function L(M){return O=>O?.meta?.arg?.endpointName===M}function U(M,O){return{matchPending:Un(Rs(M),L(O)),matchFulfilled:Un(or(M),L(O)),matchRejected:Un(Hr(M),L(O))}}return{queryThunk:R,mutationThunk:_,infiniteQueryThunk:k,prefetch:j,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:U}}function Rl(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function xg(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function Eg(e,t,r,n){return Ol(r[e.meta.arg.endpointName][t],or(e)?e.payload:void 0,ni(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function ig(e){return st(e)?As(e):e}function Vs(e,t,r){let n=e[t];n&&r(n)}function li(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function sg(e,t,r){let n=e[li(t)];n&&r(n)}var Gs={};function hx({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:s,hasRehydrationInfo:a},assertTagType:u,config:c}){let g=G(`${e}/resetApiState`);function v(L,U,M,O){var P;L[P=U.queryCacheKey]??(L[P]={status:sr,endpointName:U.endpointName}),Vs(L,U.queryCacheKey,N=>{N.status=Cl,N.requestId=M&&N.requestId?N.requestId:O.requestId,U.originalArgs!==void 0&&(N.originalArgs=U.originalArgs),N.startedTimeStamp=O.startedTimeStamp;let Q=o[O.arg.endpointName];zs(Q)&&"direction"in U&&(N.direction=U.direction)})}function E(L,U,M,O){Vs(L,U.arg.queryCacheKey,P=>{if(P.requestId!==U.requestId&&!O)return;let{merge:N}=o[U.arg.endpointName];if(P.status=ai,N){if(P.data!==void 0){let{fulfilledTimeStamp:Q,arg:$,baseQueryMeta:Y,requestId:K}=U,H=$r(P.data,J=>N(J,M,{arg:$.originalArgs,baseQueryMeta:Y,fulfilledTimeStamp:Q,requestId:K}));P.data=H}else P.data=M;}else P.data=o[U.arg.endpointName].structuralSharing??!0?fg(st(P.data)?Uf(P.data):P.data,M):M;delete P.error,P.fulfilledTimeStamp=U.fulfilledTimeStamp})}let h=zr({name:`${e}/queries`,initialState:Gs,reducers:{removeQueryResult:{reducer(L,{payload:{queryCacheKey:U}}){delete L[U]},prepare:Vn()},cacheEntriesUpserted:{reducer(L,U){for(let M of U.payload){let{queryDescription:O,value:P}=M;v(L,O,!0,{arg:O,requestId:U.meta.requestId,startedTimeStamp:U.meta.timestamp}),E(L,{arg:O,requestId:U.meta.requestId,fulfilledTimeStamp:U.meta.timestamp,baseQueryMeta:{}},P,!0)}},prepare:L=>({payload:L.map(O=>{let{endpointName:P,arg:N,value:Q}=O,$=o[P];return{queryDescription:{type:di,endpointName:P,originalArgs:O.arg,queryCacheKey:n({queryArgs:N,endpointDefinition:$,endpointName:P})},value:Q}}),meta:{[ti]:!0,requestId:oi(),timestamp:Date.now()}})},queryResultPatched:{reducer(L,{payload:{queryCacheKey:U,patches:M}}){Vs(L,U,O=>{O.data=il(O.data,M.concat())})},prepare:Vn()}},extraReducers(L){L.addCase(t.pending,(U,{meta:M,meta:{arg:O}})=>{let P=Il(O);v(U,O,P,M)}).addCase(t.fulfilled,(U,{meta:M,payload:O})=>{let P=Il(M.arg);E(U,M,O,P)}).addCase(t.rejected,(U,{meta:{condition:M,arg:O,requestId:P},error:N,payload:Q})=>{Vs(U,O.queryCacheKey,$=>{if(!M){if($.requestId!==P)return;$.status=ci,$.error=Q??N}})}).addMatcher(a,(U,M)=>{let{queries:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===ai||N?.status===ci)&&(U[P]=N)})}}),y=zr({name:`${e}/mutations`,initialState:Gs,reducers:{removeMutationResult:{reducer(L,{payload:U}){let M=li(U);M in L&&delete L[M]},prepare:Vn()}},extraReducers(L){L.addCase(r.pending,(U,{meta:M,meta:{requestId:O,arg:P,startedTimeStamp:N}})=>{P.track&&(U[li(M)]={requestId:O,status:Cl,endpointName:P.endpointName,startedTimeStamp:N})}).addCase(r.fulfilled,(U,{payload:M,meta:O})=>{O.arg.track&&sg(U,O,P=>{P.requestId===O.requestId&&(P.status=ai,P.data=M,P.fulfilledTimeStamp=O.fulfilledTimeStamp)})}).addCase(r.rejected,(U,{payload:M,error:O,meta:P})=>{P.arg.track&&sg(U,P,N=>{N.requestId===P.requestId&&(N.status=ci,N.error=M??O)})}).addMatcher(a,(U,M)=>{let{mutations:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===ai||N?.status===ci)&&P!==N?.requestId&&(U[P]=N)})}}),S={tags:{},keys:{}},x=zr({name:`${e}/invalidation`,initialState:S,reducers:{updateProvidedBy:{reducer(L,U){var M,O,P;for(let{queryCacheKey:N,providedTags:Q}of U.payload){I(L,N);for(let{type:$,id:Y}of Q){let K=(O=(M=L.tags)[$]??(M[$]={}))[P=Y||"__internal_without_id"]??(O[P]=[]);K.includes(N)||K.push(N)}L.keys[N]=Q}},prepare:Vn()}},extraReducers(L){L.addCase(h.actions.removeQueryResult,(U,{payload:{queryCacheKey:M}})=>{I(U,M)}).addMatcher(a,(U,M)=>{var P,N,Q;let{provided:O}=s(M);for(let[$,Y]of Object.entries(O.tags??{}))for(let[K,H]of Object.entries(Y)){let J=(N=(P=U.tags)[$]??(P[$]={}))[Q=K||"__internal_without_id"]??(N[Q]=[]);for(let se of H)J.includes(se)||J.push(se),U.keys[se]=O.keys[se]}}).addMatcher(Ut(or(t),ni(t)),(U,M)=>{T(U,[M])}).addMatcher(h.actions.cacheEntriesUpserted.match,(U,M)=>{let O=M.payload.map(({queryDescription:P,value:N})=>({type:"UNKNOWN",payload:N,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:P}}));T(U,O)})}});function I(L,U){let M=ig(L.keys[U]??[]);for(let O of M){let P=O.type,N=O.id??"__internal_without_id",Q=L.tags[P]?.[N];Q&&(L.tags[P][N]=ig(Q).filter($=>$!==U))}delete L.keys[U]}function T(L,U){let M=U.map(O=>{let P=Eg(O,"providesTags",o,u),{queryCacheKey:N}=O.meta.arg;return{queryCacheKey:N,providedTags:P}});x.caseReducers.updateProvidedBy(L,x.actions.updateProvidedBy(M))}let R=zr({name:`${e}/subscriptions`,initialState:Gs,reducers:{updateSubscriptionOptions(L,U){},unsubscribeQueryResult(L,U){},internal_getRTKQSubscriptions(){}}}),k=zr({name:`${e}/internalSubscriptions`,initialState:Gs,reducers:{subscriptionsUpdated:{reducer(L,U){return il(L,U.payload)},prepare:Vn()}}}),_=zr({name:`${e}/config`,initialState:{online:ZC(),focused:XC(),middlewareRegistered:!1,...c},reducers:{middlewareRegistered(L,{payload:U}){L.middlewareRegistered=L.middlewareRegistered==="conflict"||i!==U?"conflict":!0}},extraReducers:L=>{L.addCase(kl,U=>{U.online=!0}).addCase(Sg,U=>{U.online=!1}).addCase(_l,U=>{U.focused=!0}).addCase(vg,U=>{U.focused=!1}).addMatcher(a,U=>({...U}))}}),F=Ln({queries:h.reducer,mutations:y.reducer,provided:x.reducer,subscriptions:k.reducer,config:_.reducer}),V=(L,U)=>F(g.match(U)?void 0:L,U),j={..._.actions,...h.actions,...R.actions,...k.actions,...y.actions,...x.actions,resetApiState:g};return{reducer:V,actions:j}}var wl=Symbol.for("RTKQ/skipToken"),Ig={status:sr},ag=$r(Ig,()=>{}),cg=$r(Ig,()=>{});function yx({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=R=>ag,o=R=>cg;return{buildQuerySelector:E,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:S,selectCachedArgsForQuery:x,selectApiState:s,selectQueries:a,selectMutations:c,selectQueryEntry:u,selectConfig:g};function i(R){return{...R,...Zm(R.status)}}function s(R){return R[t]}function a(R){return s(R)?.queries}function u(R,k){return a(R)?.[k]}function c(R){return s(R)?.mutations}function g(R){return s(R)?.config}function v(R,k,_){return F=>{if(F===wl)return r(n,_);let V=e({queryArgs:F,endpointDefinition:k,endpointName:R});return r(L=>u(L,V)??ag,_)}}function E(R,k){return v(R,k,i)}function h(R,k){let{infiniteQueryOptions:_}=k;function F(V){let j={...V,...Zm(V.status)},{isLoading:L,isError:U,direction:M}=j,O=M==="forward",P=M==="backward";return{...j,hasNextPage:I(_,j.data,j.originalArgs),hasPreviousPage:T(_,j.data,j.originalArgs),isFetchingNextPage:L&&O,isFetchingPreviousPage:L&&P,isFetchNextPageError:U&&O,isFetchPreviousPageError:U&&P}}return v(R,k,F)}function y(){return R=>{let k;return typeof R=="object"?k=li(R)??wl:k=R,r(k===wl?o:V=>s(V)?.mutations?.[k]??cg,i)}}function S(R,k){let _=R[t],F=new Set,V=xl(k,Tl,wg);for(let j of V){let L=_.provided.tags[j.type];if(!L)continue;let U=(j.id!==void 0?L[j.id]:Object.values(L).flat())??[];for(let M of U)F.add(M)}return Array.from(F.values()).flatMap(j=>{let L=_.queries[j];return L?{queryCacheKey:j,endpointName:L.endpointName,originalArgs:L.originalArgs}:[]})}function x(R,k){return xl(Object.values(a(R)),_=>_?.endpointName===k&&_.status!==sr,_=>_.originalArgs)}function I(R,k,_){return k?Rl(R,k,_)!=null:!1}function T(R,k,_){return!k||!R.getPreviousPageParam?!1:xg(R,k,_)!=null}}var ug=WeakMap?new WeakMap:void 0,lg=({endpointName:e,queryArgs:t})=>{let r="",n=ug?.get(t);if(typeof n=="string")r=n;else{let o=JSON.stringify(t,(i,s)=>(s=typeof s=="bigint"?{$bigint:s.toString()}:s,s=qt(s)?Object.keys(s).sort().reduce((a,u)=>(a[u]=s[u],a),{}):s,s));qt(t)&&ug?.set(t,o),r=o}return`${e}(${r})`};function vx(...e){return function(r){let n=Jo(c=>r.extractRehydrationInfo?.(c,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(c){let g=lg;if("serializeQueryArgs"in c.endpointDefinition){let v=c.endpointDefinition.serializeQueryArgs;g=E=>{let h=v(E);return typeof h=="string"?h:lg({...E,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(c)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(c){c()},apiUid:oi(),extractRehydrationInfo:n,hasRehydrationInfo:Jo(c=>n(c)!=null)},s={injectEndpoints:u,enhanceEndpoints({addTagTypes:c,endpoints:g}){if(c)for(let v of c)o.tagTypes.includes(v)||o.tagTypes.push(v);if(g)for(let[v,E]of Object.entries(g))typeof E=="function"?E(zn(i,v)):Object.assign(zn(i,v)||{},E);return s}},a=e.map(c=>c.init(s,o,i));function u(c){let g=c.endpoints({query:v=>({...v,type:di}),mutation:v=>({...v,type:Ag}),infiniteQuery:v=>({...v,type:bg})});for(let[v,E]of Object.entries(g)){if(c.overrideExisting!==!0&&v in i.endpointDefinitions){if(c.overrideExisting==="throw")throw new Error(ct(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[v]=E;for(let h of a)h.injectEndpoint(v,E)}return s}return s.injectEndpoints({endpoints:r.endpoints})}}function ir(e,...t){return Object.assign(e,...t)}var Sx=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,i=null,s=null,{updateSubscriptionOptions:a,unsubscribeQueryResult:u}=e.internalActions,c=(S,x)=>{if(a.match(x)){let{queryCacheKey:T,requestId:R,options:k}=x.payload,_=S.get(T);return _?.has(R)&&_.set(R,k),!0}if(u.match(x)){let{queryCacheKey:T,requestId:R}=x.payload,k=S.get(T);return k&&k.delete(R),!0}if(e.internalActions.removeQueryResult.match(x))return S.delete(x.payload.queryCacheKey),!0;if(t.pending.match(x)){let{meta:{arg:T,requestId:R}}=x,k=Bs(S,T.queryCacheKey,El);return T.subscribe&&k.set(R,T.subscriptionOptions??k.get(R)??{}),!0}let I=!1;if(t.rejected.match(x)){let{meta:{condition:T,arg:R,requestId:k}}=x;if(T&&R.subscribe){let _=Bs(S,R.queryCacheKey,El);_.set(k,R.subscriptionOptions??_.get(k)??{}),I=!0}}return I},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:S=>g().get(S)?.size??0,isRequestSubscribed:(S,x)=>!!g()?.get(S)?.get(x)};function y(S){return JSON.parse(JSON.stringify(Object.fromEntries([...S].map(([x,I])=>[x,Object.fromEntries(I)]))))}return(S,x)=>{if(i||(i=y(r.currentSubscriptions)),e.util.resetApiState.match(S))return i={},r.currentSubscriptions.clear(),s=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(S))return[!1,h];let I=c(r.currentSubscriptions,S),T=!0;if(I){s||(s=setTimeout(()=>{let _=y(r.currentSubscriptions),[,F]=ol(i,()=>_);x.next(e.internalActions.subscriptionsUpdated(F)),i=_,s=null},500));let R=typeof S.type=="string"&&!!S.type.startsWith(o),k=t.rejected.match(S)&&S.meta.condition&&!!S.meta.arg.subscribe;T=!R&&!k}return[T,!1]}},Ax=2147483647/1e3-1,bx=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:s},getRunningQueryThunk:a,mwApi:u})=>{let{removeQueryResult:c,unsubscribeQueryResult:g,cacheEntriesUpserted:v}=t.internalActions,E=Ut(g.match,r.fulfilled,r.rejected,v.match);function h(R){let k=o.currentSubscriptions.get(R);return k?k.size>0:!1}let y={};function S(R){for(let k of R.values())k?.abort?.()}let x=(R,k)=>{let _=k.getState(),F=s(_);if(E(R)){let V;if(v.match(R))V=R.payload.map(j=>j.queryDescription.queryCacheKey);else{let{queryCacheKey:j}=g.match(R)?R.payload:R.meta.arg;V=[j]}I(V,k,F)}if(t.util.resetApiState.match(R)){for(let[V,j]of Object.entries(y))j&&clearTimeout(j),delete y[V];S(o.runningQueries),S(o.runningMutations)}if(n.hasRehydrationInfo(R)){let{queries:V}=n.extractRehydrationInfo(R);I(Object.keys(V),k,F)}};function I(R,k,_){let F=k.getState();for(let V of R){let j=i(F,V);j?.endpointName&&T(V,j.endpointName,k,_)}}function T(R,k,_,F){let j=zn(n,k)?.keepUnusedDataFor??F.keepUnusedDataFor;if(j===1/0)return;let L=Math.max(0,Math.min(j,Ax));if(!h(R)){let U=y[R];U&&clearTimeout(U),y[R]=setTimeout(()=>{if(!h(R)){let M=i(_.getState(),R);M?.endpointName&&_.dispatch(a(M.endpointName,M.originalArgs))?.abort(),_.dispatch(c({queryCacheKey:R}))}delete y[R]},L*1e3)}}return x},dg=new Error("Promise never resolved before cacheEntryRemoved."),wx=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:s,selectApiState:a}})=>{let u=Ts(n),c=Ts(o),g=or(n,o),v={},{removeQueryResult:E,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function S(_,F,V){let j=v[_];j?.valueResolved&&(j.valueResolved({data:F,meta:V}),delete j.valueResolved)}function x(_){let F=v[_];F&&(delete v[_],F.cacheEntryRemoved())}function I(_){let{arg:F,requestId:V}=_.meta,{endpointName:j,originalArgs:L}=F;return[j,L,V]}let T=(_,F,V)=>{let j=R(_);function L(U,M,O,P){let N=s(V,M),Q=s(F.getState(),M);!N&&Q&&k(U,P,M,F,O)}if(n.pending.match(_)){let[U,M,O]=I(_);L(U,j,O,M)}else if(y.match(_))for(let{queryDescription:U,value:M}of _.payload){let{endpointName:O,originalArgs:P,queryCacheKey:N}=U;L(O,N,_.meta.requestId,P),S(N,M,{})}else if(o.pending.match(_)){if(F.getState()[t].mutations[j]){let[M,O,P]=I(_);k(M,O,j,F,P)}}else if(g(_))S(j,_.payload,_.meta.baseQueryMeta);else if(E.match(_)||h.match(_))x(j);else if(e.util.resetApiState.match(_))for(let U of Object.keys(v))x(U)};function R(_){return u(_)?_.meta.arg.queryCacheKey:c(_)?_.meta.arg.fixedCacheKey??_.meta.requestId:E.match(_)?_.payload.queryCacheKey:h.match(_)?li(_.payload):""}function k(_,F,V,j,L){let U=zn(r,_),M=U?.onCacheEntryAdded;if(!M)return;let O={},P=new Promise(H=>{O.cacheEntryRemoved=H}),N=Promise.race([new Promise(H=>{O.valueResolved=H}),P.then(()=>{throw dg})]);N.catch(()=>{}),v[V]=O;let Q=e.endpoints[_].select($s(U)?F:V),$=j.dispatch((H,J,se)=>se),Y={...j,getCacheEntry:()=>Q(j.getState()),requestId:L,extra:$,updateCachedData:$s(U)?H=>j.dispatch(e.util.updateQueryData(_,F,H)):void 0,cacheDataLoaded:N,cacheEntryRemoved:P},K=M(F,Y);Promise.resolve(K).catch(H=>{if(H!==dg)throw H})}return T},Cx=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},xx=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:s,refetchQuery:a,internalState:u})=>{let{removeQueryResult:c}=i.internalActions,g=Ut(or(n),ni(n)),v=Ut(or(o,n),Hr(o,n)),E=[],h=0,y=(I,T)=>{(o.pending.match(I)||n.pending.match(I))&&h++,v(I)&&(h=Math.max(0,h-1)),g(I)?x(Eg(I,"invalidatesTags",r,s),T):v(I)?x([],T):i.util.invalidateTags.match(I)&&x(Ol(I.payload,void 0,void 0,void 0,void 0,s),T)};function S(){return h>0}function x(I,T){let R=T.getState(),k=R[e];if(E.push(...I),k.config.invalidationBehavior==="delayed"&&S())return;let _=E;if(E=[],_.length===0)return;let F=i.util.selectInvalidatedBy(R,_);t.batch(()=>{let V=Array.from(F.values());for(let{queryCacheKey:j}of V){let L=k.queries[j],U=Bs(u.currentSubscriptions,j,El);L&&(U.size===0?T.dispatch(c({queryCacheKey:j})):L.status!==sr&&T.dispatch(a(L)))}})}return y},Ex=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:s}=o,a=new Set,u=null,c=(x,I)=>{(r.internalActions.updateSubscriptionOptions.match(x)||r.internalActions.unsubscribeQueryResult.match(x))&&g(x.payload.queryCacheKey,I),(t.pending.match(x)||t.rejected.match(x)&&x.meta.condition)&&g(x.meta.arg.queryCacheKey,I),(t.fulfilled.match(x)||t.rejected.match(x)&&!x.meta.condition)&&v(x.meta.arg,I),r.util.resetApiState.match(x)&&(y(),u&&(clearTimeout(u),u=null),a.clear())};function g(x,I){a.add(x),u||(u=setTimeout(()=>{for(let T of a)E({queryCacheKey:T},I);a.clear(),u=null},0))}function v({queryCacheKey:x},I){let T=I.getState()[e],R=T.queries[x],k=s.get(x);if(!R||R.status===sr)return;let{lowestPollingInterval:_,skipPollingIfUnfocused:F}=S(k);if(!Number.isFinite(_))return;let V=i.get(x);V?.timeout&&(clearTimeout(V.timeout),V.timeout=void 0);let j=Date.now()+_;i.set(x,{nextPollTimestamp:j,pollingInterval:_,timeout:setTimeout(()=>{(T.config.focused||!F)&&I.dispatch(n(R)),v({queryCacheKey:x},I)},_)})}function E({queryCacheKey:x},I){let R=I.getState()[e].queries[x],k=s.get(x);if(!R||R.status===sr)return;let{lowestPollingInterval:_}=S(k);if(!Number.isFinite(_)){h(x);return}let F=i.get(x),V=Date.now()+_;(!F||V<F.nextPollTimestamp)&&v({queryCacheKey:x},I)}function h(x){let I=i.get(x);I?.timeout&&clearTimeout(I.timeout),i.delete(x)}function y(){for(let x of i.keys())h(x)}function S(x=new Map){let I=!1,T=Number.POSITIVE_INFINITY;for(let R of x.values())R.pollingInterval&&(T=Math.min(R.pollingInterval,T),I=R.skipPollingIfUnfocused||I);return{lowestPollingInterval:T,skipPollingIfUnfocused:I}}return c},Ix=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=Rs(r,n),i=Hr(r,n),s=or(r,n),a={};return(c,g)=>{if(o(c)){let{requestId:v,arg:{endpointName:E,originalArgs:h}}=c.meta,y=zn(t,E),S=y?.onQueryStarted;if(S){let x={},I=new Promise((_,F)=>{x.resolve=_,x.reject=F});I.catch(()=>{}),a[v]=x;let T=e.endpoints[E].select($s(y)?h:v),R=g.dispatch((_,F,V)=>V),k={...g,getCacheEntry:()=>T(g.getState()),requestId:v,extra:R,updateCachedData:$s(y)?_=>g.dispatch(e.util.updateQueryData(E,h,_)):void 0,queryFulfilled:I};S(h,k)}}else if(s(c)){let{requestId:v,baseQueryMeta:E}=c.meta;a[v]?.resolve({data:c.payload,meta:E}),delete a[v]}else if(i(c)){let{requestId:v,rejectedWithValue:E,baseQueryMeta:h}=c.meta;a[v]?.reject({error:c.payload??c.error,isUnhandledError:!E,meta:h}),delete a[v]}}},Rx=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,s=(u,c)=>{_l.match(u)&&a(c,"refetchOnFocus"),kl.match(u)&&a(c,"refetchOnReconnect")};function a(u,c){let g=u.getState()[e],v=g.queries,E=o.currentSubscriptions;t.batch(()=>{for(let h of E.keys()){let y=v[h],S=E.get(h);if(!S||!y)continue;let x=[...S.values()];(x.some(T=>T[c]===!0)||x.every(T=>T[c]===void 0)&&g.config[c])&&(S.size===0?u.dispatch(i({queryCacheKey:h})):y.status!==sr&&u.dispatch(n(y)))}})}return s};function Tx(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:s}=o,a={invalidateTags:G(`${t}/invalidateTags`)},u=E=>E.type.startsWith(`${t}/`),c=[Cx,bx,xx,Ex,wx,Ix];return{middleware:E=>{let h=!1,y=i(E.dispatch),S={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:u,mwApi:E},x=c.map(R=>R(S)),I=Sx(S),T=Rx(S);return R=>k=>{if(!Uo(k))return R(k);h||(h=!0,E.dispatch(n.internalActions.middlewareRegistered(s)));let _={...E,next:R},F=E.getState(),[V,j]=I(k,_,F),L;if(V?L=R(k):L=j,E.getState()[t]&&(T(k,_,F),u(k)||o.hasRehydrationInfo(k)))for(let U of x)U(k,_,F);return L}},actions:a};function v(E){return e.api.endpoints[E.endpointName].initiate(E.originalArgs,{subscribe:!1,forceRefetch:!0})}}var pg=Symbol(),_x=({createSelector:e=je}={})=>({name:pg,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:s,refetchOnMountOrArgChange:a,refetchOnFocus:u,refetchOnReconnect:c,invalidationBehavior:g,onSchemaFailure:v,catchSchemaFailure:E,skipSchemaValidation:h},y){zf();let S=pe=>(typeof process<"u",pe);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:kl,onOffline:Sg,onFocus:_l,onFocusLost:vg},util:{}});let x=yx({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:T,buildQuerySelector:R,buildInfiniteQuerySelector:k,buildMutationSelector:_}=x;ir(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:T});let{queryThunk:F,infiniteQueryThunk:V,mutationThunk:j,patchQueryData:L,updateQueryData:U,upsertQueryData:M,prefetch:O,buildMatchThunkActions:P}=gx({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:S,selectors:x,onSchemaFailure:v,catchSchemaFailure:E,skipSchemaValidation:h}),{reducer:N,actions:Q}=hx({context:y,queryThunk:F,infiniteQueryThunk:V,mutationThunk:j,serializeQueryArgs:i,reducerPath:o,assertTagType:S,config:{refetchOnFocus:u,refetchOnReconnect:c,refetchOnMountOrArgChange:a,keepUnusedDataFor:s,reducerPath:o,invalidationBehavior:g}});ir(t.util,{patchQueryData:L,updateQueryData:U,upsertQueryData:M,prefetch:O,resetApiState:Q.resetApiState,upsertQueryEntries:Q.cacheEntriesUpserted}),ir(t.internalActions,Q);let $=new WeakMap,Y=pe=>Bs($,pe,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:K,buildInitiateInfiniteQuery:H,buildInitiateMutation:J,getRunningMutationThunk:se,getRunningMutationsThunk:be,getRunningQueriesThunk:Oe,getRunningQueryThunk:Ie}=mx({queryThunk:F,mutationThunk:j,infiniteQueryThunk:V,api:t,serializeQueryArgs:i,context:y,getInternalState:Y});ir(t.util,{getRunningMutationThunk:se,getRunningMutationsThunk:be,getRunningQueryThunk:Ie,getRunningQueriesThunk:Oe});let{middleware:Te,actions:_e}=Tx({reducerPath:o,context:y,queryThunk:F,mutationThunk:j,infiniteQueryThunk:V,api:t,assertTagType:S,selectors:x,getRunningQueryThunk:Ie,getInternalState:Y});return ir(t.util,_e),ir(t,{reducer:N,middleware:Te}),{name:pg,injectEndpoint(pe,de){var Ue;let fe=(Ue=t.endpoints)[pe]??(Ue[pe]={});Hs(de)&&ir(fe,{name:pe,select:R(pe,de),initiate:K(pe,de)},P(F,pe)),dx(de)&&ir(fe,{name:pe,select:_(),initiate:J(pe)},P(j,pe)),zs(de)&&ir(fe,{name:pe,select:k(pe,de),initiate:H(pe,de)},P(F,pe))}}}}),Rg=vx(_x());m();d();f();p();m();d();f();p();var Yr=e=>e.query,Tg=e=>e.query?.enableQuerySyntax;var qq=je(e=>Yr(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})),kx=je(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function ar(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function q(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(g){try{c(n.next(g))}catch(v){s(v)}}function u(g){try{c(n.throw(g))}catch(v){s(v)}}function c(g){g.done?i(g.value):o(g.value).then(a,u)}c((n=n.apply(e,t||[])).next())})}var ve;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(ve||(ve={}));function Fl(){return typeof window<"u"}function zl(){return typeof navigator<"u"}function Wn(){return typeof document<"u"}function Dl(){try{return typeof localStorage<"u"}catch{return!1}}function Ox(){try{return typeof sessionStorage<"u"}catch{return!1}}function Gg(){return zl()&&navigator.cookieEnabled}var Px=[ve.click,ve.custom,ve.search,ve.view],Nx=(e,t)=>Px.indexOf(e)!==-1?Object.assign({language:Wn()?document.documentElement.lang:"unknown",userAgent:zl()?navigator.userAgent:"unknown"},t):t,fi=class e{static set(t,r,n){var o,i,s,a;n&&(i=new Date,i.setTime(i.getTime()+n)),a=window.location.hostname,a.indexOf(".")===-1?_g(t,r,i):(s=a.split("."),o=s[s.length-2]+"."+s[s.length-1],_g(t,r,i,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function _g(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function Fx(){return Dl()?localStorage:Gg()?new mi:Ox()?sessionStorage:new Yn}var mi=class e{getItem(t){return fi.get(`${e.prefix}${t}`)}removeItem(t){fi.erase(`${e.prefix}${t}`)}setItem(t,r,n){fi.set(`${e.prefix}${t}`,r,n)}};mi.prefix="coveo_";var Ml=class{constructor(){this.cookieStorage=new mi}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)}},Yn=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Ws="__coveo.analytics.history",Dx=20,Mx=1e3*60,Lx=75,Xs=class{constructor(t){this.store=t||Fx()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){return q(this,void 0,void 0,function*(){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=yield this.getHistoryWithInternalTimeAsync();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])})}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){return q(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(Ws);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return q(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(Ws);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Ws,JSON.stringify(t.slice(0,Dx)))}catch{}}clear(){try{this.store.removeItem(Ws)}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,Lx)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>Mx:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var jx=(e,t)=>q(void 0,void 0,void 0,function*(){return e===ve.view?(yield qx(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),qx=e=>q(void 0,void 0,void 0,function*(){let t=new Xs,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),Ks,Ux=new Uint8Array(16);function Vx(){if(!Ks&&(Ks=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ks))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ks(Ux)}var Gx=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Zs(e){return typeof e=="string"&&Gx.test(e)}var Ze=[];for(let e=0;e<256;++e)Ze.push((e+256).toString(16).slice(1));function Bg(e,t=0){return Ze[e[t+0]]+Ze[e[t+1]]+Ze[e[t+2]]+Ze[e[t+3]]+"-"+Ze[e[t+4]]+Ze[e[t+5]]+"-"+Ze[e[t+6]]+Ze[e[t+7]]+"-"+Ze[e[t+8]]+Ze[e[t+9]]+"-"+Ze[e[t+10]]+Ze[e[t+11]]+Ze[e[t+12]]+Ze[e[t+13]]+Ze[e[t+14]]+Ze[e[t+15]]}function Bx(e){if(!Zs(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}function $x(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var Qx="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Hx="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function zx(e,t,r){function n(o,i,s,a){var u;if(typeof o=="string"&&(o=$x(o)),typeof i=="string"&&(i=Bx(i)),((u=i)===null||u===void 0?void 0:u.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+o.length);if(c.set(i),c.set(o,i.length),c=r(c),c[6]=c[6]&15|t,c[8]=c[8]&63|128,s){a=a||0;for(let g=0;g<16;++g)s[a+g]=c[g];return s}return Bg(c)}try{n.name=e}catch{}return n.DNS=Qx,n.URL=Hx,n}var Wx=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),kg={randomUUID:Wx};function Xr(e,t,r){if(kg.randomUUID&&!t&&!e)return kg.randomUUID();e=e||{};let n=e.random||(e.rng||Vx)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let o=0;o<16;++o)t[r+o]=n[o];return t}return Bg(n)}function Kx(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 Pl(e,t){return e<<t|e>>>32-t}function Yx(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let s=unescape(encodeURIComponent(e));e=[];for(let a=0;a<s.length;++a)e.push(s.charCodeAt(a))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,o=Math.ceil(n/16),i=new Array(o);for(let s=0;s<o;++s){let a=new Uint32Array(16);for(let u=0;u<16;++u)a[u]=e[s*64+u*4]<<24|e[s*64+u*4+1]<<16|e[s*64+u*4+2]<<8|e[s*64+u*4+3];i[s]=a}i[o-1][14]=(e.length-1)*8/Math.pow(2,32),i[o-1][14]=Math.floor(i[o-1][14]),i[o-1][15]=(e.length-1)*8&4294967295;for(let s=0;s<o;++s){let a=new Uint32Array(80);for(let h=0;h<16;++h)a[h]=i[s][h];for(let h=16;h<80;++h)a[h]=Pl(a[h-3]^a[h-8]^a[h-14]^a[h-16],1);let u=r[0],c=r[1],g=r[2],v=r[3],E=r[4];for(let h=0;h<80;++h){let y=Math.floor(h/20),S=Pl(u,5)+Kx(y,c,g,v)+E+t[y]+a[h]>>>0;E=v,v=g,g=Pl(c,30)>>>0,c=u,u=S}r[0]=r[0]+u>>>0,r[1]=r[1]+c>>>0,r[2]=r[2]+g>>>0,r[3]=r[3]+v>>>0,r[4]=r[4]+E>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var Xx=zx("v5",80,Yx),Og=Xx,$g="2.30.56",Pg=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,pi={pageview:"pageview",event:"event"},Js=class{constructor({client:t,uuidGenerator:r=Xr}){this.client=t,this.uuidGenerator=r}},Ll=class extends Js{constructor({client:t,uuidGenerator:r=Xr}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=Pg(window.location),this.lastReferrer=Wn()?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:Wn()?document.title:"",encoding:Wn()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},i={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},i),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:i}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=i,t===pi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===pi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===pi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===pi.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 Pg(window.location)}},vr=class e{constructor(t,r){if(!Zs(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(r/1e3)}toString(){return this.clientId.replace(/-/g,"")+"."+this.creationDate.toString()}get expired(){let t=Math.floor(Date.now()/1e3)-this.creationDate;return t<0||t>e.expirationTime}validate(t,r){return!this.expired&&this.matchReferrer(t,r)}matchReferrer(t,r){try{let n=new URL(t);return r.some(o=>new RegExp(o.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(n.host))}catch{return!1}}static fromString(t){let r=t.split(".");if(r.length!==2)return null;let[n,o]=r;if(n.length!==32||isNaN(parseInt(o)))return null;let i=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return Zs(i)?new e(i,Number.parseInt(o)*1e3):null}};vr.cvo_cid="cvo_cid";vr.expirationTime=120;var jl=class extends Js{constructor({client:t,uuidGenerator:r=Xr}){super({client:t,uuidGenerator:r})}getApi(t){switch(t){case"decorate":return this.decorate;case"acceptFrom":return this.acceptFrom;default:return null}}decorate(t){return q(this,void 0,void 0,function*(){if(!this.client.getCurrentVisitorId)throw new Error("Could not retrieve current clientId");try{let r=new URL(t),n=yield this.client.getCurrentVisitorId();return r.searchParams.set(vr.cvo_cid,new vr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};jl.Id="link";var wt=Object.keys;function Ys(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Nl=128,Qg=192,Ng=224,Fg=240;function Zx(e){return(e&248)===Fg?4:(e&Fg)===Ng?3:(e&Ng)===Qg?2:1}function Jx(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&Nl)!=Nl)break;if(r-=3,(n&Qg)!=Nl){t-r>=Zx(n)*3&&(r=t);break}}return e.substring(0,r)}var ql={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"},eE=wt(ql).map(e=>ql[e]),tE=[...eE].join("|"),rE=new RegExp(`^(${tE}$)`),nE={svcAction:"svc_action",svcActionData:"svc_action_data"},oE=e=>wt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=ql[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),iE=e=>rE.test(e),sE=[iE],Dg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Mg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},nt={action:"pa",list:"pal",listSource:"pls"},ea={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},aE=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Ul={id:"quoteId",affiliation:"quoteAffiliation"},Vl={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},cE={add:nt,bookmark_add:nt,bookmark_remove:nt,click:nt,checkout:nt,checkout_option:nt,detail:nt,impression:nt,remove:nt,refund:Object.assign(Object.assign({},nt),ea),purchase:Object.assign(Object.assign({},nt),ea),quickview:nt,quote:Object.assign(Object.assign({},nt),Ul),review:Object.assign(Object.assign({},nt),Vl)},uE=wt(Dg).map(e=>Dg[e]),lE=wt(Mg).map(e=>Mg[e]),dE=wt(nt).map(e=>nt[e]),pE=wt(ea).map(e=>ea[e]),fE=wt(Vl).map(e=>Vl[e]),mE=wt(Ul).map(e=>Ul[e]),gE=[...uE,"custom"].join("|"),hE=[...lE,"custom"].join("|"),Hg="(pr[0-9]+)",zg="(il[0-9]+pi[0-9]+)",yE=new RegExp(`^${Hg}(${gE})$`),vE=new RegExp(`^(${zg}(${hE}))|(il[0-9]+nm)$`),SE=new RegExp(`^(${dE.join("|")})$`),AE=new RegExp(`^(${pE.join("|")})$`),bE=new RegExp(`^${Hg}custom$`),wE=new RegExp(`^${zg}custom$`),CE=new RegExp(`^(${[...aE,...fE,...mE].join("|")})$`),xE=e=>yE.test(e),EE=e=>vE.test(e),IE=e=>SE.test(e),RE=e=>AE.test(e),TE=e=>CE.test(e),_E=[EE,xE,IE,RE,TE],kE=[bE,wE],OE={anonymizeIp:"aip"},PE={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},NE={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},FE=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],DE=Object.assign(Object.assign(Object.assign(Object.assign({},OE),PE),NE),FE.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Gl=Object.assign(Object.assign({},DE),nE),ME=e=>{let t=!!e.action&&cE[e.action]||{};return wt(e).reduce((r,n)=>{let o=t[n]||Gl[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},LE=wt(Gl).map(e=>Gl[e]),jE=e=>LE.indexOf(e)!==-1,qE=e=>e==="custom",UE=e=>[..._E,...sE,jE,qE].some(t=>t(e)),VE=e=>wt(e).reduce((t,r)=>{let n=GE(r);return n?Object.assign(Object.assign({},t),BE(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),GE=e=>{let t;return[...kE].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},BE=(e,t)=>wt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),Bl=class{constructor(t){this.opts=t}sendEvent(t,r){return q(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:o}=this.opts,i=yield this.getQueryParamsForEventType(t),{url:s,payload:a}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),u=this.encodeForEventType(t,a),c=new Blob([u],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(s,c)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return q(this,void 0,void 0,function*(){let o=t,i=r;if(n){let s=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:a,body:u}=s;o=a||t;try{i=JSON.parse(u)}catch(c){console.error("Unable to process the request body as a JSON string",c)}}return{payload:i,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return q(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(i=>!!i).join("&")})}isEventTypeLegacy(t){return[ve.click,ve.custom,ve.search,ve.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let o=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(o=`access_token=${encodeURIComponent(n)}&${o}`),o}},$l=class{sendEvent(t,r){return q(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return q(this,void 0,void 0,function*(){return Promise.resolve()})}},Lg=b.fetch,ta=class{constructor(t){this.opts=t}sendEvent(t,r){return q(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:i}=this.opts,s=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",a={url:`${n}/analytics/${t}${s}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},u=Object.assign(Object.assign({},a),i?yield i(a,"analyticsFetch"):{}),{url:c}=u,g=ar(u,["url"]),v;try{v=yield Lg(c,g)}catch(E){console.error("An error has occured when sending the event.",E);return}if(v.ok){let E=yield v.json();return E.visitorId&&o.setCurrentVisitorId(E.visitorId),E}else{try{v.json()}catch{}throw console.error(`An error has occured when sending the "${t}" event.`,v,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return q(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield Lg(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[ve.click,ve.custom,ve.search,ve.view].indexOf(t)!==-1}getVisitorIdParam(){return q(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,r=yield t.getCurrentVisitorId();return r?`?visitor=${r}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},Ql=class{constructor(t,r){Dl()&&Gg()?this.storage=new Ml:Dl()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Yn),this.client=new ta(t),this.beaconClient=new Bl(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:i}of n)this.beaconClient.sendEvent(o,i)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},Hl=class{constructor(t,r){this.storage=r||new Yn,this.client=new ta(t)}getClientDependingOnEventType(t){return this.client}},ra=class{constructor(){this.storage=new Yn,this.client=new $l}getClientDependingOnEventType(t){return this.client}},$E="xx",QE=e=>e?.startsWith($E)||!1,HE=`
28
28
  We've detected you're using React Native but have not provided the corresponding runtime,
29
29
  for an optimal experience please use the "coveo.analytics/react-native" subpackage.
30
30
  Follow the Readme on how to set it up: https://github.com/coveo/coveo.analytics.js#using-react-native
31
- `;function BE(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var $E=["1",1,"yes",!0];function na(){let e=[];return Nl()&&e.push(window.doNotTrack),Hl()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>$E.indexOf(t)!==-1)}var zg="v15",Wg={default:"https://analytics.cloud.coveo.com/rest/ua",production:"https://analytics.cloud.coveo.com/rest/ua",hipaa:"https://analyticshipaa.cloud.coveo.com/rest/ua"};function QE(e=Wg.default,t=zg,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 HE="38824e1f-37f5-42d3-8372-a4b8fa9df946",Gt=class{get defaultOptions(){return{endpoint:Wg.default,isCustomEndpoint:!1,token:"",version:zg,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Bg}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=[Fx,_x].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};na()?this.runtime=new ra:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(ve.view,{newEventType:ve.view,addClientIdParameter:!0}),this.addEventTypeMapping(ve.click,{newEventType:ve.click,addClientIdParameter:!0}),this.addEventTypeMapping(ve.custom,{newEventType:ve.custom,addClientIdParameter:!0}),this.addEventTypeMapping(ve.search,{newEventType:ve.search,addClientIdParameter:!0})}initRuntime(t){return Nl()&&Wn()?new $l(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(BE()&&console.warn(GE),new Ql(t))}get storage(){return this.runtime.storage}determineVisitorId(){return q(this,void 0,void 0,function*(){try{return Nl()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Xr()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Xr()}})}getCurrentVisitorId(){return q(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return q(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return q(this,void 0,void 0,function*(){if(Zs(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(kg(t,kg(r,HE)))}})}getParameters(t,...r){return q(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return q(this,void 0,void 0,function*(){let n=yield this.resolveParameters(t,...r);return yield this.resolvePayloadForParameters(t,n)})}get currentVisitorId(){return typeof(this.visitorId||this.storage.getItem("visitorId"))!="string"&&this.setCurrentVisitorId(Xr()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(na())return null;try{let r=new URL(t).searchParams.get(vr.cvo_cid);if(r==null)return null;let n=vr.fromString(r);return!n||!Wn()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return q(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:i=!1,addClientIdParameter:s=!1}=this.eventTypeMapping[t]||{};return yield[h=>n.length>0?this.parseVariableArgumentsPayload(n,h):h[0],h=>q(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>q(this,void 0,void 0,function*(){return s?Object.assign(Object.assign({},h),{clientId:yield this.getCurrentVisitorId()}):h}),h=>i?this.ensureAnonymousUserWhenUsingApiKey(h):h,h=>this.beforeSendHooks.reduce((y,S)=>q(this,void 0,void 0,function*(){let x=yield y;return yield S(t,x)}),h)].reduce((h,y)=>q(this,void 0,void 0,function*(){let S=yield h;return yield y(S)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return q(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[v=>this.setTrackingIdIfTrackingIdNotPresent(v),v=>this.removeEmptyPayloadValues(v,t),v=>this.validateParams(v,t),v=>n?PE(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,E)=>q(this,void 0,void 0,function*(){let h=yield v;return yield E(h)}),Promise.resolve(r))})}makeEvent(t,...r){return q(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},o=yield this.resolveParameters(t,...r),i=yield this.resolvePayloadForParameters(t,o);return{eventType:n,payload:i,log:s=>q(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},i),s)}),yield Promise.all(this.afterSendHooks.map(a=>a(t,Object.assign(Object.assign({},o),s)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return q(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return q(this,void 0,void 0,function*(){let t=this.bufferedRequests.shift();if(t){let{eventType:r,payload:n}=t;return this.runtime.getClientDependingOnEventType(r).sendEvent(r,n)}})}clear(){this.storage.removeItem("visitorId"),new Xs().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ve.search,t)})}sendSearchEvent(t){return q(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=ar(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ve.click,t)})}sendClickEvent(t){return q(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=ar(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ve.custom,t)})}sendCustomEvent(t){return q(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=ar(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ve.view,t)})}sendViewEvent(t){return q(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return q(this,void 0,void 0,function*(){let r=yield(yield w(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return q(this,void 0,void 0,function*(){return yield(yield w(`${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,i=r.length;o<i;o++){let s=r[o];if(typeof s=="string")n[t[o]]=s;else if(typeof s=="object")return Object.assign(Object.assign({},n),s)}return n}isKeyAllowedEmpty(t,r){return({[ve.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,i)=>Object.assign(Object.assign({},o),{[i]:t[i]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(ME(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=ar(t,["custom"]),o={};r&&Ys(r)&&(o=this.lowercaseKeys(r));let i=LE(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=ar(t,["custom"]);if(r&&Ys(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=ar(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==ve.view||r==ve.click||r==ve.search||r==ve.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==ve.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=ar(t,["userId"]);return VE(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=ar(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Ys(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Ys(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"?Kx(t,r):t}get baseUrl(){return QE(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},cr;(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"})(cr||(cr={}));var B;(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"})(B||(B={}));var Lg={[B.triggerNotify]:"queryPipelineTriggers",[B.triggerExecute]:"queryPipelineTriggers",[B.triggerQuery]:"queryPipelineTriggers",[B.triggerRedirect]:"queryPipelineTriggers",[B.queryErrorBack]:"errors",[B.queryErrorClear]:"errors",[B.queryErrorRetry]:"errors",[B.pagerNext]:"getMoreResults",[B.pagerPrevious]:"getMoreResults",[B.pagerNumber]:"getMoreResults",[B.pagerResize]:"getMoreResults",[B.pagerScrolling]:"getMoreResults",[B.facetSearch]:"facet",[B.facetShowLess]:"facet",[B.facetShowMore]:"facet",[B.recommendation]:"recommendation",[B.likeSmartSnippet]:"smartSnippet",[B.dislikeSmartSnippet]:"smartSnippet",[B.expandSmartSnippet]:"smartSnippet",[B.collapseSmartSnippet]:"smartSnippet",[B.openSmartSnippetFeedbackModal]:"smartSnippet",[B.closeSmartSnippetFeedbackModal]:"smartSnippet",[B.sendSmartSnippetReason]:"smartSnippet",[B.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.clearRecentQueries]:"recentQueries",[B.recentResultClick]:"recentlyClickedDocuments",[B.clearRecentResults]:"recentlyClickedDocuments",[B.showLessFoldedResults]:"folding",[B.caseDetach]:"case",[B.likeGeneratedAnswer]:"generatedAnswer",[B.dislikeGeneratedAnswer]:"generatedAnswer",[B.openGeneratedAnswerSource]:"generatedAnswer",[B.generatedAnswerOpenInlineLink]:"generatedAnswer",[B.generatedAnswerFollowupOpenSource]:"generatedAnswer",[B.generatedAnswerStreamEnd]:"generatedAnswer",[B.generatedAnswerSourceHover]:"generatedAnswer",[B.generatedAnswerCopyToClipboard]:"generatedAnswer",[B.generatedAnswerHideAnswers]:"generatedAnswer",[B.generatedAnswerShowAnswers]:"generatedAnswer",[B.generatedAnswerExpand]:"generatedAnswer",[B.generatedAnswerCollapse]:"generatedAnswer",[B.generatedAnswerFeedbackSubmit]:"generatedAnswer",[B.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[cr.expandToFullUI]:"interface",[cr.openUserActions]:"User Actions",[cr.showPrecedingSessions]:"User Actions",[cr.showFollowingSessions]:"User Actions",[cr.clickViewedDocument]:"User Actions",[cr.clickPageView]:"User Actions",[cr.createArticle]:"createArticle"},Xn=class{constructor(){this.runtime=new ra,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(ve.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(ve.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(ve.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(ve.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return Bg}};function zE(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function WE(e){return e.map(t=>t.replace(/;/g,""))}function Kg(e){let r=e.join(";");return r.length<=256?r:Kg(e.slice(1))}var jg=e=>{let t=WE(e),r=zE(t);return Kg(r)};function qg(e){let t=typeof e.partialQueries=="string"?e.partialQueries:jg(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:jg(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var oa=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||na();this.coveoAnalyticsClient=n?new Xn:new Gt(t)}disable(){this.coveoAnalyticsClient=new Xn}enable(){this.coveoAnalyticsClient=new Gt(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(B.interfaceLoad)}logInterfaceLoad(){return q(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(B.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(B.recommendation)}logRecommendation(){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent(B.recommendationOpen,t,r)}logRecommendationOpen(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(B.staticFilterClearAll,t)}logStaticFilterClearAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent(B.staticFilterSelect,t)}logStaticFilterSelect(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent(B.staticFilterDeselect,t)}logStaticFilterDeselect(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(B.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return q(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent(B.interfaceChange,t)}logInterfaceChange(t){return q(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(B.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(B.didyoumeanClick)}logDidYouMeanClick(){return q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(B.resultsSort,t)}logResultsSort(t){return q(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(B.searchboxSubmit)}logSearchboxSubmit(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(B.searchboxClear)}logSearchboxClear(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(B.searchboxAsYouType)}logSearchboxAsYouType(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(B.breadcrumbFacet,t)}logBreadcrumbFacet(t){return q(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(B.breadcrumbResetAll)}logBreadcrumbResetAll(){return q(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent(B.documentQuickview,t,r)}logDocumentQuickview(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent(B.documentOpen,t,r)}logDocumentOpen(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(B.omniboxAnalytics,qg(t))}logOmniboxAnalytics(t){return q(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(B.omniboxFromLink,qg(t))}logOmniboxFromLink(t){return q(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(B.searchFromLink)}logSearchFromLink(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(B.triggerNotify,t)}logTriggerNotify(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(B.triggerExecute,t)}logTriggerExecute(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(B.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(B.undoTriggerQuery,t)}logUndoTriggerQuery(t){return q(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(B.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(B.pagerResize,t)}logPagerResize(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(B.pagerNumber,t)}logPagerNumber(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(B.pagerNext,t)}logPagerNext(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(B.pagerPrevious,t)}logPagerPrevious(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(B.pagerScrolling)}logPagerScrolling(){return q(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(B.facetClearAll,t)}logFacetClearAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(B.facetSearch,t)}logFacetSearch(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(B.facetSelect,t)}logFacetSelect(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(B.facetDeselect,t)}logFacetDeselect(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(B.facetExclude,t)}logFacetExclude(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(B.facetUnexclude,t)}logFacetUnexclude(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(B.facetSelectAll,t)}logFacetSelectAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(B.facetUpdateSort,t)}logFacetUpdateSort(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(B.facetShowMore,t)}logFacetShowMore(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(B.facetShowLess,t)}logFacetShowLess(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(B.queryError,t)}logQueryError(t){return q(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(B.queryErrorBack);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.queryErrorBack)})}})}logQueryErrorBack(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(B.queryErrorRetry);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.queryErrorRetry)})}})}logQueryErrorRetry(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(B.queryErrorClear);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.queryErrorClear)})}})}logQueryErrorClear(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(B.likeSmartSnippet)}logLikeSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(B.dislikeSmartSnippet)}logDislikeSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(B.expandSmartSnippet)}logExpandSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(B.collapseSmartSnippet)}logCollapseSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(B.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(B.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return q(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent(B.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(B.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent(B.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent(B.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent(B.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent(B.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent(B.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(B.copyToClipboard,t,r)}logCopyToClipboard(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent(B.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent(B.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(B.recentQueryClick)}logRecentQueryClick(){return q(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(B.clearRecentQueries)}logClearRecentQueries(){return q(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent(B.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(B.clearRecentResults)}logClearRecentResults(){return q(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(B.noResultsBack)}logNoResultsBack(){return q(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent(B.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(B.showLessFoldedResults)}logShowLessFoldedResults(){return q(this,void 0,void 0,function*(){return(yield this.makeShowLessFoldedResults()).log({searchUID:this.provider.getSearchUID()})})}makeEventDescription(t,r){var n;return{actionCause:r,customData:(n=t.payload)===null||n===void 0?void 0:n.customData}}makeCustomEvent(t,r){return q(this,arguments,void 0,function*(n,o,i=Lg[n]){this.coveoAnalyticsClient.getParameters;let s=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),a=Object.assign(Object.assign({},yield this.getBaseEventRequest(s)),{eventType:i,eventValue:n}),u=yield this.coveoAnalyticsClient.makeCustomEvent(a);return{description:this.makeEventDescription(u,n),log:({searchUID:c})=>u.log({lastSearchQueryUid:c})}})}logCustomEvent(t,r){return q(this,arguments,void 0,function*(n,o,i=Lg[n]){return(yield this.makeCustomEvent(n,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return q(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),i=Object.assign(Object.assign({},yield this.getBaseEventRequest(o)),{eventType:r,eventValue:t}),s=yield this.coveoAnalyticsClient.makeCustomEvent(i);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({lastSearchQueryUid:a})}})}logCustomEventWithType(t,r,n){return q(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return q(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),o=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(o,t),log:({searchUID:i})=>o.log({searchQueryUid:i})}})}makeClickEvent(t,r,n,o){return q(this,void 0,void 0,function*(){let i=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),s=yield this.coveoAnalyticsClient.makeClickEvent(i);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({searchQueryUid:a})}})}logClickEvent(t,r,n,o){return q(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return q(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return q(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.getOrigins()),this.getSplitTestRun()),{customData:r,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,r;return{originContext:(r=(t=this.provider).getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof Gt?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(B.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(B.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(B.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return q(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent(B.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(B.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent(B.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(B.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(B.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(B.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(B.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(B.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(B.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(B.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(B.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(B.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(B.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return q(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(B.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},ia=Object.assign({},pi),Ug=Object.keys(ia).map(e=>ia[e]),Kn=class extends Ml{constructor({client:t,uuidGenerator:r=Xr}){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])=>Ug.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Ug.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(ia.pageview,{newEventType:ve.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(ia.event,{newEventType:ve.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}:{}),i=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},i),o),r)}getTicketPayload(){return eE(this.ticket)}};Kn.Id="svc";var sa;(function(e){e.click="click",e.flowStart="flowStart"})(sa||(sa={}));var bt;(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"})(bt||(bt={}));var aa;(function(e){e.quit="Quit",e.solved="Solved"})(aa||(aa={}));var ca=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!na();this.coveoAnalyticsClient=o?new Gt(t):new Xn,this.svc=new Kn({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Xn,this.svc=new Kn({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Gt(this.options),this.svc=new Kn({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(bt.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(bt.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(bt.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(bt.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(bt.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(bt.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(bt.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(bt.caseCancelled,{reason:aa.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(bt.caseSolved,{reason:aa.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(bt.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",sa.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",sa.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return q(this,void 0,void 0,function*(){var r,n;let o=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:o,language:(r=this.provider)===null||r===void 0?void 0:r.getLanguage(),anonymous:(n=this.provider)===null||n===void 0?void 0:n.getIsAnonymous(),clientId:yield this.getClientId()})})}getClientId(){return this.coveoAnalyticsClient instanceof Gt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,o,i;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:(i=this.provider)===null||i===void 0?void 0:i.getOriginLevel3()}}logClickEvent(t,r,n,o){return q(this,void 0,void 0,function*(){var i,s;let a=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:(s=(i=this.provider)===null||i===void 0?void 0:i.getSearchUID())!==null&&s!==void 0?s:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(a)})}};m();d();f();p();var KE=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},Zr=class{constructor(t){oe(this,"getState",t);oe(this,"state");this.state=t()}getLanguage(){return KE(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[i,s]of Object.entries(n)){let a=`context_${i}`;o[a]=s}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=Gn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||$n()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};m();d();f();p();var Zn=e=>new Gt(e).getCurrentVisitorId(),gi=(e,t)=>typeof t=="function"?(...r)=>{let n=jo(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,hi=(e,t)=>(...r)=>{let n=jo(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var yi=class extends Zr{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Yg=({logger:e,getState:t,analyticsClientMiddleware:r=(i,s)=>s,preprocessRequest:n,provider:o=new yi(t)})=>{let i=t(),s=i.configuration.accessToken,a=i.configuration.analytics.apiBaseUrl??rt(i.configuration.organizationId,i.configuration.environment,"analytics"),u=i.configuration.analytics.runtimeEnvironment,c=i.configuration.analytics.enabled,g=new ca({enableAnalytics:c,token:s,endpoint:a,runtimeEnvironment:u,preprocessRequest:gi(e,n),beforeSendHooks:[hi(e,r),(v,E)=>(e.info({...E,type:v,endpoint:a,token:s},"Analytics request"),E)]},o);return c||g.disable(),g};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function ua(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function Xg(e){let{activeValue:t,ancestryMap:r}=ZE(e);return t?JE(t,r):[]}function ZE(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 JE(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var eI=(e,t)=>e.categoryFacetSet[t]?.request;var zl=(e,t)=>{let r=eI(e,t);return Xg(r?.currentValues??[])};m();d();f();p();function la(){return{}}m();d();f();p();function da(){return{}}m();d();f();p();function pa(){return{}}m();d();f();p();function fa(){return{}}function Wl(e){return{facetSet:e.facetSet??fa(),categoryFacetSet:e.categoryFacetSet??la(),dateFacetSet:e.dateFacetSet??da(),numericFacetSet:e.numericFacetSet??pa(),automaticFacetSet:e.automaticFacetSet??ua()}}var Kl=e=>{let t=[];return nI(e).forEach((r,n)=>{let o=dI(e,r.facetId),i=uI(r,n+1);if(rI(r)){if(!!!zl(e,r.facetId).length)return;t.push({...i,...aI(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((s,a)=>{if(s.state==="idle")return;let u=Zg(s,a+1,o),c=tI(r)?Jg(s):iI(s);t.push({...i,...u,...c})})}),oI(e).forEach((r,n)=>{let o=cI(r,n+1);r.values.forEach((i,s)=>{if(i.state==="idle")return;let a=Zg(i,s+1,"specific"),u=Jg(i);t.push({...o,...a,...u})})}),t},tI=e=>e.type==="specific",rI=e=>e.type==="hierarchical",nI=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),oI=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),Zg=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),iI=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),Jg=e=>({displayValue:e.value,value:e.value}),sI=(e,t)=>zl(e,t).map(n=>n.value).join(";"),aI=(e,t)=>{let n=sI(e,t);return{value:n,valuePosition:1,displayValue:n}},cI=(e,t)=>({title:eh(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),uI=(e,t)=>({title:eh(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),eh=(e,t)=>`${e}_${t}`,lI=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,dI=(e,t)=>{let r=lI(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var Yl=e=>e.configuration.search.locale,th=e=>e.configuration.search.timezone,rh=e=>e.configuration.accessToken,nh=e=>e.configuration.organizationId,oh=e=>e.configuration.environment,ma=e=>e.configuration?.knowledge?.agentId,ih=e=>e.configuration.knowledge.debugAgentSession;var Jr=e=>{if(pI(e)||Xl(e))return e.generatedAnswer?.answerId;if(fI(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},pI=e=>"answer"in e&&"generatedAnswer"in e&&!ae(e.generatedAnswer?.answerConfigurationId),Xl=e=>{let t=ma(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},fI=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Zl=e=>e.generatedAnswer?.fieldsToIncludeInCitations,sh=e=>e.followUpAnswers?.conversationId,mI=e=>e.generatedAnswer?.citations,gI=e=>e.followUpAnswers?.followUpAnswers,hI=je(gI,e=>e?.flatMap(t=>t.citations)),yI=(e,t)=>t,vI=je(mI,hI,yI,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));m();d();f();p();var Ft=()=>({q:"",enableQuerySyntax:!1});m();d();f();p();function Jl(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Bt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Jl(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Jl(),extendedResults:{},searchAction:void 0}}m();d();f();p();m();d();f();p();m();d();f();p();var ah=(r=>(r.Ascending="ascending",r.Descending="descending",r))(ah||{}),ch=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(ch||{}),ed=e=>{if(xf(e))return e.map(t=>ed(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""}},uh=()=>({by:"relevancy"});var eV=new Ce({values:{by:new qu({enum:ch,required:!0}),order:new qu({enum:ah}),field:new re}});function ga(){return ed(uh())}m();d();f();p();m();d();f();p();m();d();f();p();var Jn=class e{static set(t,r,n){let o,i,s;n&&(i=new Date,i.setTime(i.getTime()+n));let a=window.location.hostname,u=/^(\d{1,3}\.){3}\d{1,3}$/,c=/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/;u.test(a)||c.test(a)||a.indexOf(".")===-1?td(t,r,i):(s=a.split("."),o=s[s.length-2]+"."+s[s.length-1],td(t,r,i,o))}static get(t){let r=t+"=",n=document.cookie.split(";");for(let o=0;o<n.length;o++){let i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function td(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}m();d();f();p();function SI(){return typeof navigator<"u"}function lh(){try{return typeof localStorage<"u"}catch{return!1}}function dh(){try{return typeof sessionStorage<"u"}catch{return!1}}function ph(){return!!(SI()&&navigator.cookieEnabled)}var fh=null;function mh(){return fh||(lh()?localStorage:ph()?new rd:dh()?sessionStorage:new nd)}var eo=class eo{getItem(t){return Jn.get(`${eo.prefix}${t}`)}removeItem(t){Jn.erase(`${eo.prefix}${t}`)}setItem(t,r,n){Jn.set(`${eo.prefix}${t}`,r,n)}};oe(eo,"prefix","coveo_");var rd=eo;var nd=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var ha="__coveo.analytics.history",AI=20,bI=1e3*60,wI=75,en=class en{constructor(t){oe(this,"store");this.store=t||mh()}static getInstance(t){return en.instance||(en.instance=new en(t)),en.instance}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!==null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _this4=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this4.cropQueryElement(_this4.stripEmptyQuery(t));let r=yield _this4.getHistoryWithInternalTimeAsync();r!==null?_this4.isValidEntry(t)&&_this4.setHistory([t].concat(r)):_this4.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this5=this;return _asyncToGenerator(function*(){let t=yield _this5.getHistoryWithInternalTimeAsync();return _this5.stripEmptyQueries(_this5.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(ha);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this6=this;return _asyncToGenerator(function*(){try{let t=yield _this6.store.getItem(ha);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(ha,JSON.stringify(t.slice(0,AI)))}catch{}}clear(){try{this.store.removeItem(ha)}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,wI)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value===t.value?(t.internalTime||0)-(r.internalTime||0)>bI:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};oe(en,"instance",null);var od=en,$t=od;var vi=class vi extends Zr{constructor(){super(...arguments);oe(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 Kl(Wl(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||vi.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||Bt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||vi.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=Jr(r);return o&&(n.generativeQuestionAnsweringId=o),n}getFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetValue:n,facetTitle:`${i}_${r}`}}getFacetClearAllMetadata(r){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetTitle:`${o}_${r}`}}getFacetUpdateSortMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,criteria:n,facetTitle:`${i}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${i}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??ga()}}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 i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:i,categoryFacetPath:n,categoryFacetTitle:`${i}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let o=this.state.querySuggest?.[r],i=o.completions.map(c=>c.expression),s=o.partialQueries.length-1,a=o.partialQueries[s]||"",u=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(n),partialQuery:a,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:i.length>0?i:"",querySuggestResponseId:u}}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||Ft().q}get responseTime(){return this.state.search?.duration||Bt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Bt().response.totalCountFiltered}};oe(vi,"fallbackPipelineName","default");var Sr=vi,gh=({logger:e,getState:t,analyticsClientMiddleware:r=(i,s)=>s,preprocessRequest:n,provider:o})=>{let i=t(),s=i.configuration.accessToken,a=i.configuration.analytics.apiBaseUrl??rt(i.configuration.organizationId,i.configuration.environment,"analytics"),u=i.configuration.analytics.runtimeEnvironment,c=i.configuration.analytics.enabled,g=new oa({token:s,endpoint:a,runtimeEnvironment:u,preprocessRequest:gi(e,n),beforeSendHooks:[hi(e,r),(v,E)=>(e.info({...E,type:v,endpoint:a,token:s},"Analytics request"),E)]},o);return c||g.disable(),g},id=()=>{let t=$t.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};m();d();f();p();function hh(e){let t=yh(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return ff([e,...t,...r],o=>o.uniqueId)}function yh(e){return e.childResults?e.childResults.flatMap(t=>[t,...yh(t)]):[]}m();d();f();p();var ya=()=>"";function Sh(e,t){return{...new Sr(t).getBaseMetadata(),actionCause:e,type:e}}function CI(e){return Object.assign(e,{instantlyCallable:!0})}function xI(e,t){let r=i=>{let s=we(e,i);return CI(Object.assign(s,{type:s.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*(i,{getState:s,extra:a}){let{analyticsClientMiddleware:u,preprocessRequest:c,logger:g}=a;return yield(yield t({getState:s,analyticsClientMiddleware:u,preprocessRequest:c,logger:g})).log({state:s(),extra:a})});return function(_x42,_x43){return _ref17.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref18=_asyncToGenerator(function*({getState:i,analyticsClientMiddleware:s,preprocessRequest:a,logger:u}){let{description:c,log:g}=yield t({getState:i,analyticsClientMiddleware:s,preprocessRequest:a,logger:u});return{description:c,action:r(/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(v,{getState:E,extra:h}){return yield g({state:E(),extra:h})});return function(_x45,_x46){return _ref19.apply(this,arguments)}}())}});return function prepare(_x44){return _ref18.apply(this,arguments)}}()}),n}var Ah=(e,t,r)=>{function n(...o){let i=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 RI(i)}return n},EI=e=>e.configuration.analytics.analyticsMode==="legacy",II=e=>e.configuration.analytics.analyticsMode==="next",RI=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:s})=>(r??(r=a=>new s(a)),xI(e,/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*({getState:a,analyticsClientMiddleware:u,preprocessRequest:c,logger:g}){let v=[],E={log:function(){var _ref21=_asyncToGenerator(function*({state:I}){for(let T of v)yield T(I)});return function log(_x48){return _ref21.apply(this,arguments)}}()},h=a(),y=i({getState:a,logger:g,analyticsClientMiddleware:u,preprocessRequest:c,provider:r(a)}),S=yield t(y,a());E.description=S?.description,v.push(/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(I){EI(I)&&(yield TI(S,r,I,g,y.coveoAnalyticsClient))});return function(_x49){return _ref22.apply(this,arguments)}}());let{emit:x}=ii(h);return v.push(/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(I){if(II(I)&&o&&n){let T=n(I);yield MI(x,o,T)}});return function(_x50){return _ref23.apply(this,arguments)}}()),E});return function(_x47){return _ref20.apply(this,arguments)}}()));function TI(_x51,_x52,_x53,_x54,_x55){return _TI.apply(this,arguments)}function _TI(){_TI=_asyncToGenerator(function*(e,t,r,n,o){t(()=>r);let i=yield e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:o,response:i},"Analytics response")});return _TI.apply(this,arguments)}var _I=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref24=_asyncToGenerator(function*(i){r(n,o)});return function log(_x56){return _ref24.apply(this,arguments)}}()}),ot=Ah(e=>gh({...e,provider:e.provider||new Sr(e.getState)}),e=>e,Sr),ht=Ah(Yg,_I("caseAssist"),yi);var sd=(e,t)=>{let r=i=>i+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=Ch(e,o),n<0&&(n=DI(e,o)),n<0&&(n=0),kI(e,r(n),t)};function kI(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:NI(e),...(vh(e)?{documentCategory:vh(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:FI(e),queryPipeline:r.pipeline||ya()}}function vh(e){return e.raw?.objecttype||void 0}var ad=e=>(e.raw.permanentid||console.warn("Missing field permanentid on result. This might cause many issues with your Coveo deployment. See https://docs.coveo.com/en/1913 and https://docs.coveo.com/en/1640 for more information.",e),{contentIDKey:"permanentid",contentIDValue:e.raw.permanentid||""}),bh={urihash:new re,sourcetype:new re,permanentid:new re},wh={uniqueId:ee,raw:new Ce({values:bh}),title:ee,uri:ee,clickUri:ee,rankingModifier:new re({required:!1,emptyAllowed:!0})};function OI(e){return Object.assign({},...Object.keys(bh).map(t=>({[t]:e[t]})))}function PI(e){return Object.assign({},...Object.keys(wh).map(t=>({[t]:e[t]})),{raw:OI(e.raw)})}function NI(e){let t=e.raw.author;return ae(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function FI(e){let t=e.raw.source;return ae(t)?"unknown":t}var cd=e=>new Ot(wh).validate(PI(e));function DI(e,t){for(let[r,n]of t.entries()){let o=hh(n);if(Ch(e,o)!==-1)return r}return-1}function Ch(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function MI(_x57,_x58,_x59){return _MI.apply(this,arguments)}function _MI(){_MI=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _MI.apply(this,arguments)}m();d();f();p();var to=(e,t,r)=>ot({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let i=t??Jr(o);if(!i)return null;let s=sh(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:r,...(s&&{conversationId:s})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Jr(n)??"",answerGenerated:e??!1})}),ro=e=>ot({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Jr(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})});m();d();f();p();m();d();f();p();var xh=je(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})}});m();d();f();p();var tn=(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:Qn(e)}});m();d();f();p();var ud=e=>e.context;m();d();f();p();var ld=e=>e.pipeline;m();d();f();p();m();d();f();p();var Ai=kt(va(),1),kh=kt(Eh(),1);m();d();f();p();var Rh=kt(va(),1),Th=kt(Ih(),1);Rh.default.extend(Th.default);var LI="YYYY/MM/DD@HH:mm:ss";function _h(e){return e.format(LI)}Ai.default.extend(kh.default);var jI=["past","now","next"],qI=["minute","hour","day","week","month","quarter","year"];function UI(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Ai.default)().subtract(r,n);case"next":return(0,Ai.default)().add(r,n);case"now":return(0,Ai.default)()}}function yd(e){return _h(UI(VI(e)))}function Oh(e){return e.toLocaleLowerCase().split("-")}function vd(e){let[t,r,n]=Oh(e);if(t==="now")return!0;if(!jI.includes(t)||!qI.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function VI(e){let[t,r,n]=Oh(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function Ph(e){return e.type==="dateRange"}function Nh(e){return`start${e}`}function Fh(e){return`end${e}`}var Sd=()=>({dateFacetValueMap:{}});function GI(e,t,r){let n=e.start,o=e.end;return vd(n)&&(n=yd(n),r.dateFacetValueMap[t][Nh(n)]=e.start),vd(o)&&(o=yd(o),r.dateFacetValueMap[t][Fh(o)]=e.end),{...e,start:n,end:o}}function Ad(e,t){if(Ph(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>GI(o,r,t))}}return e}function Ar(e){let t=Sd();return{request:{...e,facets:e.facets?.map(n=>Ad(n,t))},mappings:t}}function BI(e,t,r){return{...e,start:r.dateFacetValueMap[t][Nh(e.start)]||e.start,end:r.dateFacetValueMap[t][Fh(e.end)]||e.end}}function $I(e,t){return e.facetId in t.dateFacetValueMap}function QI(e,t){return $I(e,t)?{...e,values:e.values.map(r=>BI(r,e.facetId,t))}:e}function Sa(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>QI(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function br(e){return Object.values(e).map(t=>t.request)}function bd(e,t){let r={};e.forEach(i=>{r[i.facetId]=i});let n=[];t.forEach(i=>{i in r&&(n.push(r[i]),delete r[i])});let o=Object.values(r);return[...n,...o]}function Dh(e){return br(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var wd={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function HI(e){return br(e).map(t=>{let r=wd[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function zI(e){return[...HI(e.facetSet??{}),...Dh(e.numericFacetSet??{}),...Dh(e.dateFacetSet??{}),...br(e.categoryFacetSet??{})]}function WI(e){return zI(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function Aa(e){return bd(WI(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();m();d();f();p();var Mh=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield Zn(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}),...(id()&&{pageId:id()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:Qn(e)})}}});return function Mh(_x60,_x61){return _ref25.apply(this,arguments)}}();var no=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Fn(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,...(e.configuration.analytics.enabled&&{actionsHistory:$t.getInstance().getHistory()}),...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&(yield Mh(e.configuration.analytics,t))),...(e.excerptLength&&!ae(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function no(_x62,_x63){return _ref26.apply(this,arguments)}}();m();d();f();p();var ba=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Fn(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&&tn(e.configuration.analytics,t,r)),...(e.excerptLength&&!ae(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});m();d();f();p();var Lh=je(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o}));var wr=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t,r){let n=xd(e),o=KI(e),i=YI(e),s=e.configuration.analytics.analyticsMode==="legacy"?yield no(e,r):ba(e,t,r);return Ar({...s,...(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:Cd(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:i}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function wr(_x64,_x65,_x66){return _ref27.apply(this,arguments)}}();function Cd(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function KI(e){return bd(ZI(e),e.facetOrder??[])}function YI(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(XI).filter(r=>r.currentValues.length>0):void 0}function XI(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function ZI(e){return JI(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function JI(e){return[...eR(e.facetSet??{}),...jh(e.numericFacetSet??{}),...jh(e.dateFacetSet??{}),...br(e.categoryFacetSet??{})]}function eR(e){return br(e).map(t=>{let r=wd[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function jh(e){return br(e).map(t=>{let r=t.currentValues,n=r.some(({state:i})=>i!=="idle"),o=r.some(i=>i.previousState);return t.generateAutomaticRanges&&!n&&!o?{...t,currentValues:[]}:t})}function xd(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=Lh(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();f();p();m();d();f();p();var wi=(e,t)=>{let r=e;return ae(r[t])?ae(e.raw[t])?null:e.raw[t]:r[t]},tR=e=>t=>e.every(r=>!ae(wi(t,r))),rR=e=>t=>e.every(r=>ae(wi(t,r))),nR=(e,t)=>r=>{let n=qh(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},oR=(e,t)=>r=>{let n=qh(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},qh=(e,t)=>{let r=wi(t,e);return pf(r)?r:[r]},Uh={getResultProperty:wi,fieldsMustBeDefined:tR,fieldsMustNotBeDefined:rR,fieldMustMatch:nR,fieldMustNotMatch:oR};var Ed=je(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var Id=e=>e.searchHub;m();d();f();p();var wa=je(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),v$=je(e=>e,e=>{let t=wa(e);return t&&e?e[t].expression:""});m();d();f();p();var Vh=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var Gh=e=>e.excerptLength?.length;m();d();f();p();var Bh=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var $h=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};m();d();f();p();var Qh=e=>e.sortCriteria;var Hh=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Nn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function Hh(_x67){return _ref28.apply(this,arguments)}}(),zh=(e,t)=>{let r=Yr(e)?.q,{aq:n,cq:o,dq:i,lq:s}=Yh(e),a=ud(e),u=tn(e.configuration.analytics,t,{actionCause:Ed(e)}),c=Id(e),g=ld(e),v=Zl(e)??[],E=Kh(e),h=wa(e.tabSet)||"default",y=Yl(e),S=th(e),x=t.referrer||"",I=Bh(e),T=Qh(e),R=iR(e),k=Gh(e),_=$h(e),F=Vh(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(s&&{lq:s}),...(e.query&&{enableQuerySyntax:Rg(e)}),...(a?.contextValues&&{context:a.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(c?.length&&{searchHub:c}),...(g?.length&&{pipeline:g}),...(E.length&&{facets:E}),...(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:Cd(e),firstResult:e.pagination.firstResult}),tab:h,locale:y,timezone:S,...(e.debug!==void 0&&{debug:e.debug}),referrer:x,...R,...(_??{}),...(k&&{excerptLength:k}),...(F&&{dictionaryFieldContext:F}),sortCriteria:T,...(I&&{facetOptions:I}),...u,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Wh=(e,t)=>{let r=Yr(e)?.q,n=Kh(e),o=tn(e.configuration.analytics,t,{actionCause:Ed(e)}),i=Yl(e),s=wa(e.tabSet)||"default",a=t.referrer,{aq:u,cq:c}=Yh(e),g=Id(e),v=ld(e),E=ud(e),h=Zl(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(v?.length&&{pipeline:v}),...(E?.contextValues&&{context:E.contextValues}),...(u&&{aq:u}),...(c&&{cq:c}),tab:s,referrer:a,...o,locale:i}},Kh=e=>Aa(e)?.map(t=>Ad(t,Sd())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),iR=e=>({actionsHistory:e.configuration.analytics.enabled?$t.getInstance().getHistory():[]}),Yh=e=>{let t=xh(e),r=xd(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var Ca=["searching","thinking","answering"];function xa(e){return e.toLowerCase()}var Ea=["search","generic"];m();d();f();p();var Xh=["text/plain","text/markdown"];var oo=new re({required:!0}),Zh=new re,io=new Le({required:!0}),Rd={id:oo,title:oo,uri:oo,permanentid:oo,clickUri:Zh},Ia=new re({required:!0,constrainTo:Xh}),Jh=new re({required:!0,constrainTo:Ca}),ey=e=>({...e,name:xa(e.name)}),j3=G("generatedAnswer/setIsVisible",e=>W(e,io)),Ra=G("generatedAnswer/setAnswerId",e=>W(e,ee)),q3=G("generatedAnswer/setAnswerGenerationMode",e=>W(e,new re({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),U3=G("generatedAnswer/setIsEnabled",e=>W(e,io)),xi=G("generatedAnswer/updateMessage",e=>W(e,{textDelta:oo})),Ei=G("generatedAnswer/updateCitations",e=>W(e,{citations:new Pt({required:!0,each:new Ce({values:Rd})})})),Ii=G("generatedAnswer/updateError",e=>W(e,{message:Zh,code:new Fe({min:0})})),Ta=G("generatedAnswer/resetAnswer"),V3=G("generatedAnswer/like"),G3=G("generatedAnswer/dislike"),B3=G("generatedAnswer/feedbackModal/open"),$3=G("generatedAnswer/expand"),Q3=G("generatedAnswer/collapse"),H3=G("generatedAnswer/setId",e=>W(e,{id:new re({required:!0})})),z3=G("generatedAnswer/feedbackModal/close"),W3=G("generatedAnswer/sendFeedback"),Cr=G("generatedAnswer/setIsLoading",e=>W(e,io)),Ci=G("generatedAnswer/setIsStreaming",e=>W(e,io)),Ri=G("generatedAnswer/setAnswerContentFormat",e=>W(e,Ia)),K3=G("generatedAnswer/updateResponseFormat",e=>W(e,{contentFormat:new Pt({each:Ia,default:["text/plain"]})})),Y3=G("knowledge/updateAnswerConfigurationId",e=>W(e,oo)),X3=G("generatedAnswer/registerFieldsToIncludeInCitations",e=>W(e,wm)),Td=G("generatedAnswer/setIsAnswerGenerated",e=>W(e,io)),Ti=G("generatedAnswer/setCannotAnswer",e=>W(e,io)),sR=G("generatedAnswer/setAnswerApiQueryParams",e=>W(e,new Ce({}))),ty=G("generatedAnswer/startStep",e=>W(ey(e),{name:Jh,startedAt:new Fe({min:0,required:!0})})),ry=G("generatedAnswer/finishStep",e=>W(ey(e),{name:Jh,finishedAt:new Fe({min:0,required:!0})})),ny=G("generatedAnswer/startToolCall",e=>W(e,{toolCallName:ee,startedAt:new Fe({min:0,required:!0}),toolCallId:ee})),oy=G("generatedAnswer/finishToolCall",e=>W(e,{finishedAt:new Fe({min:0,required:!0}),toolCallId:ee})),_a=G("generatedAnswer/toolCallArgs",e=>W(e,{toolCallId:ee,args:new Ce({options:{required:!0}}),type:new re({required:!0,constrainTo:Ea})})),Z3=we("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:i}=t,{search:s}=i(),{queryExecuted:a}=s,{setAbortControllerRef:u}=e,c=yield Hh(r),g=(h,y)=>{switch(h){case"genqa.headerMessageType":{let S=JSON.parse(y);n(Ri(S.contentFormat));break}case"genqa.messageType":n(xi(JSON.parse(y)));break;case"genqa.citationsType":n(Ei(JSON.parse(y)));break;case"genqa.endOfStreamType":{let S=JSON.parse(y).answerGenerated,{answerId:x,answer:I}=i().generatedAnswer,R=a.length!==0&&!S,k=!I?.trim();n(Ti(R)),n(Ci(!1)),n(Td(S)),n(to(S,x,S?k:void 0)),n(ro());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${h}"`)}};n(Cr(!0));let v=h=>h.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,E=o.streamingClient?.streamGeneratedAnswer(c,{write:h=>{v(c)&&(n(Cr(!1)),h.payload&&h.payloadType&&g(h.payloadType,h.payload))},abort:h=>{v(c)&&n(Ii(h))},close:()=>{v(c)&&n(Ci(!1))},resetAnswer:()=>{v(c)&&n(Ta())}});E?u(E):n(Cr(!1))});return function(_x68,_x69){return _ref29.apply(this,arguments)}}()),J3=we("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(Ta());let i=t();if(i.generatedAnswer.answerConfigurationId){let s=zh(i,n);r(sR(s)),yield r(iy(s))}else o.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.")});return function(_x70,_x71){return _ref30.apply(this,arguments)}}());m();d();f();p();m();d();f();p();function ay(_x72,_x73){return _ay.apply(this,arguments)}function _ay(){_ay=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _ay.apply(this,arguments)}function cy(e){let t,r,n,o=!1;return function(s){t===void 0?(t=s,r=0,n=-1):t=cR(t,s);let a=t.length,u=0;for(;r<a;){o&&(t[r]===10&&(u=++r),o=!1);let c=-1;for(;r<a&&c===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-u);break;case 13:o=!0,c=r;break;case 10:c=r;break}if(c===-1)break;e(t.subarray(u,c),n),u=r,n=-1}u===a?t=void 0:u!==0&&(t=t.subarray(u),r-=u)}}function uy(e,t,r){let n=sy(),o=new TextDecoder;return function(s,a){if(s.length===0)r?.(n),n=sy();else if(a>0){let u=o.decode(s.subarray(0,a)),c=a+(s[a+1]===32?2:1),g=o.decode(s.subarray(c));switch(u){case"data":n.data=n.data?`${n.data}
32
- ${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":aR(g,n,t);break}}}}function aR(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function cR(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function sy(){return{data:"",event:"",id:"",retry:void 0}}var _d="text/event-stream",uR=1e3,ly="last-event-id";function dy(){return typeof window<"u"}function py(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:s,openWhenHidden:a,fetch:u,...c}){return new Promise((g,v)=>{let E={...r};E.accept||(E.accept=_d);let h;function y(){h?.abort(),document.hidden||k()}!a&&dy()&&document.addEventListener("visibilitychange",y);let S=uR,x;function I(){dy()&&document.removeEventListener("visibilitychange",y),clearTimeout(x),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let T=u??w,R=n??lR;function k(){return _k2.apply(this,arguments)}function _k2(){_k2=_asyncToGenerator(function*(){h=l.AbortController?new l.AbortController:null;try{let _=yield T(e,{...c,headers:E,signal:h?.signal});yield R(_),yield ay(_.body,cy(uy(F=>{F?E[ly]=F:delete E[ly]},F=>{S=F},o))),i?.(),I(),g()}catch(_){if(!h?.signal?.aborted)try{let F=s?.(_)??S;clearTimeout(x),x=setTimeout(k,F)}catch(F){I(),v(F)}}});return _k2.apply(this,arguments)}k()})}function lR(e){let t=e.headers.get("content-type");if(!t?.startsWith(_d))throw new Error(`Expected content-type to be ${_d}, Actual: ${t}`)}m();d();f();p();var dR=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:i,organizationId:s}=n.configuration,a=n.generatedAnswer.answerConfigurationId,u={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let c=Nn(n.configuration.search?.apiBaseUrl,s,i);return fg({baseUrl:`${c}/rest/organizations/${s}/answer/v1/configs/${a}`,fetchFn:function(){var _ref32=_asyncToGenerator(function*(g){if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let v=g.url,E={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{E[h]=g[h]}),E.duplex="half",E.body=yield g.text(),w(v,E)});return function fetchFn(_x77){return _ref32.apply(this,arguments)}}()})(u,{...t,signal:null},r)}catch(c){return{error:c}}});return function dR(_x74,_x75,_x76){return _ref31.apply(this,arguments)}}(),fy=Ig({reducerPath:"answer",baseQuery:gg(dR,{maxRetries:3}),endpoints:()=>({})});var pR=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},fR=(e,t)=>{let{textDelta:r}=t;if(typeof r!="string")return;let n=e.answer;!n?.trim()&&!r.trim()||(e.answer=n?.trim()?n.concat(r):r)},mR=(e,t)=>{e.citations=t.citations},gR=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},hR=(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})`)},yR=(e,t,r)=>{let n=JSON.parse(e.data);n.finishReason==="ERROR"&&n.errorMessage&&hR(t,n);let o=n.payload.length?JSON.parse(n.payload):{};switch(n.payloadType){case"genqa.headerMessageType":o.contentFormat&&(pR(t,o),r(Ri(o.contentFormat)));break;case"genqa.messageType":typeof o.textDelta=="string"&&(fR(t,o),r(xi({textDelta:o.textDelta})));break;case"genqa.citationsType":o.citations&&(mR(t,o),r(Ei({citations:o.citations})));break;case"genqa.endOfStreamType":{gR(t,o);let i=t.answerId,s=o.answerGenerated??!1,a=s?!t.answer?.trim():void 0;r(to(s,i,a)),r(ro());break}}},vR=(e,t,r,n)=>{if(!e||!t||!r)throw new Error("Missing required parameters for answer endpoint");let o=`/rest/organizations/${t}`,i=n?`insight/v1/configs/${n}/answer`:"answer/v1/configs";return`${e}${o}/${i}/${r}/generate`},kd=fy.injectEndpoints({overrideExisting:!0,endpoints:e=>({getAnswer:e.query({queryFn:()=>({data:{contentFormat:void 0,answer:void 0,citations:void 0,error:void 0,generated:!1,isStreaming:!0,isLoading:!0}}),serializeQueryArgs:({endpointName:t,queryArgs:r})=>{let{analytics:n,...o}=r;return`${t}(${JSON.stringify(o)})`},onCacheEntryAdded(_x78,_x79){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:i}){yield n;let{configuration:s,generatedAnswer:a,insightConfiguration:u}=r(),{organizationId:c,environment:g,accessToken:v}=s,E=Nn(s.search.apiBaseUrl,c,g),h=vR(E,c,a.answerConfigurationId,u?.insightId);yield py(h,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${v}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:w,onopen:function(){var _ref33=_asyncToGenerator(function*(y){let S=y.headers.get("x-answer-id");S&&o(x=>{x.answerId=S,i(Ra(S))})});return function onopen(_x80){return _ref33.apply(this,arguments)}}(),onmessage:y=>{o(S=>{yR(y,S,i)})},onerror:y=>{throw y},onclose:()=>{o(y=>{i(Ti(!y.generated))})}})}).apply(this,arguments)}})})}),iy=e=>kd.endpoints.getAnswer.initiate(e);m();d();f();p();var my=Ge(Gn,e=>e);m();d();f();p();function SR(e){let t=e.payload?.analyticsAction;return gy(e)&&!ae(t)}function gy(e){return"type"in e}var hy=e=>t=>r=>{let n;SR(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return gy(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};m();d();f();p();m();d();f();p();m();d();f();p();var YQ=G("tab/register",e=>{let t=new Ce({values:{id:ee,expression:Nt}});return W(e,t)}),yy=G("tab/updateActiveTab",e=>W(e,ee));m();d();f();p();var ka=kt(va(),1),Ay=kt(vy(),1),by=kt(Sy(),1);ka.default.extend(by.default);ka.default.extend(Ay.default);var wy=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:ka.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"});m();d();f();p();var AR=/(^|; )Coveo-Pendragon=([^;]*)/,bR=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function Cy(){return typeof window>"u"?!1:AR.exec(document.cookie)?.pop()||null}function xy(){return typeof window>"u"?!1:bR.test(document.cookie)}var Ey=Ge(wy(),e=>e.addCase(Bn,(t,r)=>{wR(t,r.payload)}).addCase(Ms,(t,r)=>{CR(t,r.payload)}).addCase(Ls,(t,r)=>{xR(t,r.payload)}).addCase(js,t=>{t.analytics.enabled=!1}).addCase(qs,t=>{t.analytics.enabled=!0}).addCase(Nm,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(Fm,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(yy,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Rm,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Ns,(t,r)=>{ae(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Dm,(t,{payload:r})=>{ER(t,r)}));function wR(e,t){ae(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ae(t.organizationId)||(e.organizationId=t.organizationId)}function CR(e,t){ae(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),ae(t.locale)||(e.search.locale=t.locale),ae(t.timezone)||(e.search.timezone=t.timezone),ae(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function xR(e,t){ae(t.enabled)||(e.analytics.enabled=t.enabled),ae(t.originContext)||(e.analytics.originContext=t.originContext),ae(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),ae(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),ae(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),ae(t.trackingId)||(e.analytics.trackingId=t.trackingId),ae(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),ae(t.source)||(e.analytics.source=t.source);try{let r=Cy();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}ae(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),ae(t.anonymous)||(e.analytics.anonymous=t.anonymous),ae(t.deviceId)||(e.analytics.deviceId=t.deviceId),ae(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),ae(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function ER(e,t){e.knowledge.agentId=t;try{let r=xy();ae(r)||(e.knowledge.debugAgentSession=!0)}catch{}}var yt=Ey;m();d();f();p();function IR(e){return e.instantlyCallable}var Iy=()=>e=>t=>e(IR(t)?t():t);m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Je=[];for(let e=0;e<256;++e)Je.push((e+256).toString(16).slice(1));function Ry(e,t=0){return(Je[e[t+0]]+Je[e[t+1]]+Je[e[t+2]]+Je[e[t+3]]+"-"+Je[e[t+4]]+Je[e[t+5]]+"-"+Je[e[t+6]]+Je[e[t+7]]+"-"+Je[e[t+8]]+Je[e[t+9]]+"-"+Je[e[t+10]]+Je[e[t+11]]+Je[e[t+12]]+Je[e[t+13]]+Je[e[t+14]]+Je[e[t+15]]).toLowerCase()}m();d();f();p();var Dd,RR=new Uint8Array(16);function Md(){if(!Dd){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Dd=crypto.getRandomValues.bind(crypto)}return Dd(RR)}m();d();f();p();m();d();f();p();var TR=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ld={randomUUID:TR};function _R(e,t,r){if(Ld.randomUUID&&!t&&!e)return Ld.randomUUID();e=e||{};let n=e.random??e.rng?.()??Md();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 Ry(n)}var xr=_R;m();d();f();p();m();d();f();p();var b={};zi(b,{BRAND:()=>tT,DIRTY:()=>rn,EMPTY_PATH:()=>NR,INVALID:()=>ce,NEVER:()=>qT,OK:()=>it,ParseStatus:()=>et,Schema:()=>he,ZodAny:()=>Rr,ZodArray:()=>pr,ZodBigInt:()=>on,ZodBoolean:()=>sn,ZodBranded:()=>ki,ZodCatch:()=>yn,ZodDate:()=>an,ZodDefault:()=>hn,ZodDiscriminatedUnion:()=>Na,ZodEffects:()=>Et,ZodEnum:()=>mn,ZodError:()=>ut,ZodFirstPartyTypeKind:()=>ue,ZodFunction:()=>Da,ZodIntersection:()=>dn,ZodIssueCode:()=>z,ZodLazy:()=>pn,ZodLiteral:()=>fn,ZodMap:()=>po,ZodNaN:()=>mo,ZodNativeEnum:()=>gn,ZodNever:()=>Dt,ZodNull:()=>un,ZodNullable:()=>zt,ZodNumber:()=>nn,ZodObject:()=>lt,ZodOptional:()=>Ct,ZodParsedType:()=>te,ZodPipeline:()=>Oi,ZodPromise:()=>Tr,ZodReadonly:()=>vn,ZodRecord:()=>Fa,ZodSchema:()=>he,ZodSet:()=>fo,ZodString:()=>Ir,ZodSymbol:()=>uo,ZodTransformer:()=>Et,ZodTuple:()=>Ht,ZodType:()=>he,ZodUndefined:()=>cn,ZodUnion:()=>ln,ZodUnknown:()=>dr,ZodVoid:()=>lo,addIssueToContext:()=>Z,any:()=>lT,array:()=>mT,bigint:()=>iT,boolean:()=>jy,coerce:()=>jT,custom:()=>Dy,date:()=>sT,datetimeRegex:()=>Ny,defaultErrorMap:()=>ur,discriminatedUnion:()=>vT,effect:()=>kT,enum:()=>RT,function:()=>xT,getErrorMap:()=>so,getParsedType:()=>Qt,instanceof:()=>nT,intersection:()=>ST,isAborted:()=>Oa,isAsync:()=>ao,isDirty:()=>Pa,isValid:()=>Er,late:()=>rT,lazy:()=>ET,literal:()=>IT,makeIssue:()=>_i,map:()=>wT,nan:()=>oT,nativeEnum:()=>TT,never:()=>pT,null:()=>uT,nullable:()=>PT,number:()=>Ly,object:()=>gT,objectUtil:()=>jd,oboolean:()=>LT,onumber:()=>MT,optional:()=>OT,ostring:()=>DT,pipeline:()=>FT,preprocess:()=>NT,promise:()=>_T,quotelessJson:()=>kR,record:()=>bT,set:()=>CT,setErrorMap:()=>PR,strictObject:()=>hT,string:()=>My,symbol:()=>aT,transformer:()=>kT,tuple:()=>AT,undefined:()=>cT,union:()=>yT,unknown:()=>dT,util:()=>Ae,void:()=>fT});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Ae;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ae||(Ae={}));var jd;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(jd||(jd={}));var te=Ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qt=e=>{switch(typeof e){case"undefined":return te.undefined;case"string":return te.string;case"number":return Number.isNaN(e)?te.nan:te.number;case"boolean":return te.boolean;case"function":return te.function;case"bigint":return te.bigint;case"symbol":return te.symbol;case"object":return Array.isArray(e)?te.array:e===null?te.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?te.promise:typeof Map<"u"&&e instanceof Map?te.map:typeof Set<"u"&&e instanceof Set?te.set:typeof Date<"u"&&e instanceof Date?te.date:te.object;default:return te.unknown}};var z=Ae.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"]),kR=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ut=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(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,u=0;for(;u<s.path.length;){let c=s.path[u];u===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(s))):a[c]=a[c]||{_errors:[]},a=a[c],u++}}};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,Ae.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 i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ut.create=e=>new ut(e);var OR=(e,t)=>{let r;switch(e.code){case z.invalid_type:e.received===te.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ae.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ae.joinValues(e.keys,", ")}`;break;case z.invalid_union:r="Invalid input";break;case z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ae.joinValues(e.options)}`;break;case z.invalid_enum_value:r=`Invalid enum value. Expected ${Ae.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}"`:Ae.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,Ae.assertNever(e)}return{message:r}},ur=OR;var Ty=ur;function PR(e){Ty=e}function so(){return Ty}m();d();f();p();var _i=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...(o.path||[])],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",u=n.filter(c=>!!c).slice().reverse();for(let c of u)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},NR=[];function Z(e,t){let r=so(),n=_i({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===ur?void 0:ur].filter(o=>!!o)});e.common.issues.push(n)}var et=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return ce;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let o of r){let i=yield o.key,s=yield o.value;n.push({key:i,value:s})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return ce;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},ce=Object.freeze({status:"aborted"}),rn=e=>({status:"dirty",value:e}),it=e=>({status:"valid",value:e}),Oa=e=>e.status==="aborted",Pa=e=>e.status==="dirty",Er=e=>e.status==="valid",ao=e=>typeof Promise<"u"&&e instanceof Promise;m();d();f();p();m();d();f();p();var ne;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ne||(ne={}));var xt=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}},_y=(e,t)=>{if(Er(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 ut(e.common.issues);return this._error=r,this._error}}};function me(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:(s,a)=>{let{message:u}=e;return s.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:u??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:u??r??a.defaultError}},description:o}}var he=class{get description(){return this._def.description}_getType(t){return Qt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Qt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new et,ctx:{common:t.parent.common,data:t.data,parsedType:Qt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(ao(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:Qt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return _y(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Qt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Er(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=>Er(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this7=this;return _asyncToGenerator(function*(){let n=yield _this7.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this8=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this8._def.errorMap,parent:null,data:t,parsedType:Qt(t)},o=_this8._parse({data:t,path:n.path,parent:n}),i=yield ao(o)?o:Promise.resolve(o);return _y(n,i)})()}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=t(o),a=()=>i.addIssue({code:z.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(a(),!1)):s?!0:(a(),!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 Et({schema:this,typeName:ue.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 Ct.create(this,this._def)}nullable(){return zt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return pr.create(this)}promise(){return Tr.create(this,this._def)}or(t){return ln.create([this,t],this._def)}and(t){return dn.create(this,t,this._def)}transform(t){return new Et({...me(this._def),schema:this,typeName:ue.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new hn({...me(this._def),innerType:this,defaultValue:r,typeName:ue.ZodDefault})}brand(){return new ki({typeName:ue.ZodBranded,type:this,...me(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new yn({...me(this._def),innerType:this,catchValue:r,typeName:ue.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Oi.create(this,t)}readonly(){return vn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},FR=/^c[^\s-]{8,}$/i,DR=/^[0-9a-z]+$/,MR=/^[0-9A-HJKMNP-TV-Z]{26}$/i,LR=/^[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,jR=/^[a-z0-9_-]{21}$/i,qR=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,UR=/^[-+]?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)?)??$/,VR=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,GR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",qd,BR=/^(?:(?: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])$/,$R=/^(?:(?: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])$/,QR=/^(([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]))$/,HR=/^(([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])$/,zR=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,WR=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Oy="((\\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])))",KR=new RegExp(`^${Oy}$`);function Py(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 YR(e){return new RegExp(`^${Py(e)}$`)}function Ny(e){let t=`${Oy}T${Py(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 XR(e,t){return!!((t==="v4"||!t)&&BR.test(e)||(t==="v6"||!t)&&QR.test(e))}function ZR(e,t){if(!qR.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 JR(e,t){return!!((t==="v4"||!t)&&$R.test(e)||(t==="v6"||!t)&&HR.test(e))}var Ir=class e extends he{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==te.string){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_type,expected:te.string,received:i.parsedType}),ce}let n=new et,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?Z(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&Z(o,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")VR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"email",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")qd||(qd=new RegExp(GR,"u")),qd.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"emoji",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")LR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"uuid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")jR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"nanoid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")FR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cuid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")DR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cuid2",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")MR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"ulid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),Z(o,{validation:"url",code:z.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"regex",code:z.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Ny(i).test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?KR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?YR(i).test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?UR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"duration",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?XR(t.data,i.version)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"ip",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?ZR(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"jwt",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?JR(t.data,i.version)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cidr",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?zR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"base64",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?WR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"base64url",code:z.invalid_string,message:i.message}),n.dirty()):Ae.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:z.invalid_string,...ne.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ne.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ne.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ne.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ne.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ne.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ne.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ne.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ne.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ne.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ne.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ne.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ne.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ne.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,...ne.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,...ne.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ne.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ne.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ne.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ne.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ne.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ne.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ne.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ne.errToObj(r)})}nonempty(t){return this.min(1,ne.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}};Ir.create=e=>new Ir({checks:[],typeName:ue.ZodString,coerce:e?.coerce??!1,...me(e)});function eT(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var nn=class e extends he{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)!==te.number){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_type,expected:te.number,received:i.parsedType}),ce}let n,o=new et;for(let i of this._def.checks)i.kind==="int"?Ae.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),Z(n,{code:z.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),Z(n,{code:z.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),Z(n,{code:z.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?eT(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),Z(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),Z(n,{code:z.not_finite,message:i.message}),o.dirty()):Ae.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ne.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ne.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ne.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ne.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ne.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ne.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ne.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ne.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ne.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ne.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ne.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ne.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ne.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ne.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"&&Ae.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)}};nn.create=e=>new nn({checks:[],typeName:ue.ZodNumber,coerce:e?.coerce||!1,...me(e)});var on=class e extends he{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)!==te.bigint)return this._getInvalidInput(t);let n,o=new et;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),Z(n,{code:z.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),Z(n,{code:z.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),Z(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ae.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Z(r,{code:z.invalid_type,expected:te.bigint,received:r.parsedType}),ce}gte(t,r){return this.setLimit("min",t,!0,ne.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ne.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ne.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ne.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ne.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:ne.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ne.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ne.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ne.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ne.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}};on.create=e=>new on({checks:[],typeName:ue.ZodBigInt,coerce:e?.coerce??!1,...me(e)});var sn=class extends he{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==te.boolean){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.boolean,received:n.parsedType}),ce}return it(t.data)}};sn.create=e=>new sn({typeName:ue.ZodBoolean,coerce:e?.coerce||!1,...me(e)});var an=class e extends he{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==te.date){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_type,expected:te.date,received:i.parsedType}),ce}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_date}),ce}let n=new et,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:z.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:z.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Ae.assertNever(i);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:ne.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ne.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}};an.create=e=>new an({checks:[],coerce:e?.coerce||!1,typeName:ue.ZodDate,...me(e)});var uo=class extends he{_parse(t){if(this._getType(t)!==te.symbol){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.symbol,received:n.parsedType}),ce}return it(t.data)}};uo.create=e=>new uo({typeName:ue.ZodSymbol,...me(e)});var cn=class extends he{_parse(t){if(this._getType(t)!==te.undefined){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.undefined,received:n.parsedType}),ce}return it(t.data)}};cn.create=e=>new cn({typeName:ue.ZodUndefined,...me(e)});var un=class extends he{_parse(t){if(this._getType(t)!==te.null){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.null,received:n.parsedType}),ce}return it(t.data)}};un.create=e=>new un({typeName:ue.ZodNull,...me(e)});var Rr=class extends he{constructor(){super(...arguments),this._any=!0}_parse(t){return it(t.data)}};Rr.create=e=>new Rr({typeName:ue.ZodAny,...me(e)});var dr=class extends he{constructor(){super(...arguments),this._unknown=!0}_parse(t){return it(t.data)}};dr.create=e=>new dr({typeName:ue.ZodUnknown,...me(e)});var Dt=class extends he{_parse(t){let r=this._getOrReturnCtx(t);return Z(r,{code:z.invalid_type,expected:te.never,received:r.parsedType}),ce}};Dt.create=e=>new Dt({typeName:ue.ZodNever,...me(e)});var lo=class extends he{_parse(t){if(this._getType(t)!==te.undefined){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.void,received:n.parsedType}),ce}return it(t.data)}};lo.create=e=>new lo({typeName:ue.ZodVoid,...me(e)});var pr=class e extends he{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==te.array)return Z(r,{code:z.invalid_type,expected:te.array,received:r.parsedType}),ce;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&(Z(r,{code:s?z.too_big:z.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?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&&(Z(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&&(Z(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((s,a)=>o.type._parseAsync(new xt(r,s,r.path,a)))).then(s=>et.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new xt(r,s,r.path,a)));return et.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:ne.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ne.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ne.toString(r)}})}nonempty(t){return this.min(1,t)}};pr.create=(e,t)=>new pr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ue.ZodArray,...me(t)});function co(e){if(e instanceof lt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Ct.create(co(n))}return new lt({...e._def,shape:()=>t})}else return e instanceof pr?new pr({...e._def,type:co(e.element)}):e instanceof Ct?Ct.create(co(e.unwrap())):e instanceof zt?zt.create(co(e.unwrap())):e instanceof Ht?Ht.create(e.items.map(t=>co(t))):e}var lt=class e extends he{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=Ae.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==te.object){let c=this._getOrReturnCtx(t);return Z(c,{code:z.invalid_type,expected:te.object,received:c.parsedType}),ce}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Dt&&this._def.unknownKeys==="strip"))for(let c in o.data)s.includes(c)||a.push(c);let u=[];for(let c of s){let g=i[c],v=o.data[c];u.push({key:{status:"valid",value:c},value:g._parse(new xt(o,v,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Dt){let c=this._def.unknownKeys;if(c==="passthrough")for(let g of a)u.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(c==="strict")a.length>0&&(Z(o,{code:z.unrecognized_keys,keys:a}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let g of a){let v=o.data[g];u.push({key:{status:"valid",value:g},value:c._parse(new xt(o,v,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let c=[];for(let g of u){let v=yield g.key,E=yield g.value;c.push({key:v,value:E,alwaysSet:g.alwaysSet})}return c})).then(c=>et.mergeObjectSync(n,c)):et.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(t){return ne.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:ne.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:ue.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 Ae.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 Ae.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return co(this)}partial(t){let r={};for(let n of Ae.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 Ae.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Ct;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Fy(Ae.objectKeys(this.shape))}};lt.create=(e,t)=>new lt({shape:()=>e,unknownKeys:"strip",catchall:Dt.create(),typeName:ue.ZodObject,...me(t)});lt.strictCreate=(e,t)=>new lt({shape:()=>e,unknownKeys:"strict",catchall:Dt.create(),typeName:ue.ZodObject,...me(t)});lt.lazycreate=(e,t)=>new lt({shape:e,unknownKeys:"strip",catchall:Dt.create(),typeName:ue.ZodObject,...me(t)});var ln=class extends he{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new ut(a.ctx.common.issues));return Z(r,{code:z.invalid_union,unionErrors:s}),ce}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(i){let s={...r,common:{...r.common,issues:[]},parent:null};return{result:yield i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}});return function(_x81){return _ref35.apply(this,arguments)}}())).then(o);{let i,s=[];for(let u of n){let c={...r,common:{...r.common,issues:[]},parent:null},g=u._parseSync({data:r.data,path:r.path,parent:c});if(g.status==="valid")return g;g.status==="dirty"&&!i&&(i={result:g,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(u=>new ut(u));return Z(r,{code:z.invalid_union,unionErrors:a}),ce}}get options(){return this._def.options}};ln.create=(e,t)=>new ln({options:e,typeName:ue.ZodUnion,...me(t)});var lr=e=>e instanceof pn?lr(e.schema):e instanceof Et?lr(e.innerType()):e instanceof fn?[e.value]:e instanceof mn?e.options:e instanceof gn?Ae.objectValues(e.enum):e instanceof hn?lr(e._def.innerType):e instanceof cn?[void 0]:e instanceof un?[null]:e instanceof Ct?[void 0,...lr(e.unwrap())]:e instanceof zt?[null,...lr(e.unwrap())]:e instanceof ki||e instanceof vn?lr(e.unwrap()):e instanceof yn?lr(e._def.innerType):[],Na=class e extends he{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.object)return Z(r,{code:z.invalid_type,expected:te.object,received:r.parsedType}),ce;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(Z(r,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ce)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let s=lr(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new e({typeName:ue.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...me(n)})}};function Ud(e,t){let r=Qt(e),n=Qt(t);if(e===t)return{valid:!0,data:e};if(r===te.object&&n===te.object){let o=Ae.objectKeys(t),i=Ae.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let u=Ud(e[a],t[a]);if(!u.valid)return{valid:!1};s[a]=u.data}return{valid:!0,data:s}}else if(r===te.array&&n===te.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],u=Ud(s,a);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===te.date&&n===te.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var dn=class extends he{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,s)=>{if(Oa(i)||Oa(s))return ce;let a=Ud(i.value,s.value);return a.valid?((Pa(i)||Pa(s))&&r.dirty(),{status:r.value,value:a.data}):(Z(n,{code:z.invalid_intersection_types}),ce)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):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}))}};dn.create=(e,t,r)=>new dn({left:e,right:t,typeName:ue.ZodIntersection,...me(r)});var Ht=class e extends he{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.array)return Z(n,{code:z.invalid_type,expected:te.array,received:n.parsedType}),ce;if(n.data.length<this._def.items.length)return Z(n,{code:z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ce;!this._def.rest&&n.data.length>this._def.items.length&&(Z(n,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let u=this._def.items[a]||this._def.rest;return u?u._parse(new xt(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>et.mergeArray(r,s)):et.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ht.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ht({items:e,typeName:ue.ZodTuple,rest:null,...me(t)})};var Fa=class e extends he{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!==te.object)return Z(n,{code:z.invalid_type,expected:te.object,received:n.parsedType}),ce;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new xt(n,a,n.path,a)),value:s._parse(new xt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?et.mergeObjectAsync(r,o):et.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof he?new e({keyType:t,valueType:r,typeName:ue.ZodRecord,...me(n)}):new e({keyType:Ir.create(),valueType:t,typeName:ue.ZodRecord,...me(r)})}},po=class extends he{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!==te.map)return Z(n,{code:z.invalid_type,expected:te.map,received:n.parsedType}),ce;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,u],c)=>({key:o._parse(new xt(n,a,n.path,[c,"key"])),value:i._parse(new xt(n,u,n.path,[c,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let u of s){let c=yield u.key,g=yield u.value;if(c.status==="aborted"||g.status==="aborted")return ce;(c.status==="dirty"||g.status==="dirty")&&r.dirty(),a.set(c.value,g.value)}return{status:r.value,value:a}}))}else{let a=new Map;for(let u of s){let c=u.key,g=u.value;if(c.status==="aborted"||g.status==="aborted")return ce;(c.status==="dirty"||g.status==="dirty")&&r.dirty(),a.set(c.value,g.value)}return{status:r.value,value:a}}}};po.create=(e,t,r)=>new po({valueType:t,keyType:e,typeName:ue.ZodMap,...me(r)});var fo=class e extends he{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.set)return Z(n,{code:z.invalid_type,expected:te.set,received:n.parsedType}),ce;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(Z(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&&(Z(n,{code:z.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(u){let c=new Set;for(let g of u){if(g.status==="aborted")return ce;g.status==="dirty"&&r.dirty(),c.add(g.value)}return{status:r.value,value:c}}let a=[...n.data.values()].map((u,c)=>i._parse(new xt(n,u,n.path,c)));return n.common.async?Promise.all(a).then(u=>s(u)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:ne.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ne.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};fo.create=(e,t)=>new fo({valueType:e,minSize:null,maxSize:null,typeName:ue.ZodSet,...me(t)});var Da=class e extends he{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.function)return Z(r,{code:z.invalid_type,expected:te.function,received:r.parsedType}),ce;function n(a,u){return _i({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,so(),ur].filter(c=>!!c),issueData:{code:z.invalid_arguments,argumentsError:u}})}function o(a,u){return _i({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,so(),ur].filter(c=>!!c),issueData:{code:z.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Tr){let a=this;return it(/*#__PURE__*/_asyncToGenerator(function*(...u){let c=new ut([]),g=yield a._def.args.parseAsync(u,i).catch(h=>{throw c.addIssue(n(u,h)),c}),v=yield Reflect.apply(s,this,g);return yield a._def.returns._def.type.parseAsync(v,i).catch(h=>{throw c.addIssue(o(v,h)),c})}))}else{let a=this;return it(function(...u){let c=a._def.args.safeParse(u,i);if(!c.success)throw new ut([n(u,c.error)]);let g=Reflect.apply(s,this,c.data),v=a._def.returns.safeParse(g,i);if(!v.success)throw new ut([o(g,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ht.create(t).rest(dr.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||Ht.create([]).rest(dr.create()),returns:r||dr.create(),typeName:ue.ZodFunction,...me(n)})}},pn=class extends he{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})}};pn.create=(e,t)=>new pn({getter:e,typeName:ue.ZodLazy,...me(t)});var fn=class extends he{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Z(r,{received:r.data,code:z.invalid_literal,expected:this._def.value}),ce}return{status:"valid",value:t.data}}get value(){return this._def.value}};fn.create=(e,t)=>new fn({value:e,typeName:ue.ZodLiteral,...me(t)});function Fy(e,t){return new mn({values:e,typeName:ue.ZodEnum,...me(t)})}var mn=class e extends he{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return Z(r,{expected:Ae.joinValues(n),received:r.parsedType,code:z.invalid_type}),ce}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return Z(r,{received:r.data,code:z.invalid_enum_value,options:n}),ce}return it(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})}};mn.create=Fy;var gn=class extends he{_parse(t){let r=Ae.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==te.string&&n.parsedType!==te.number){let o=Ae.objectValues(r);return Z(n,{expected:Ae.joinValues(o),received:n.parsedType,code:z.invalid_type}),ce}if(this._cache||(this._cache=new Set(Ae.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Ae.objectValues(r);return Z(n,{received:n.data,code:z.invalid_enum_value,options:o}),ce}return it(t.data)}get enum(){return this._def.values}};gn.create=(e,t)=>new gn({values:e,typeName:ue.ZodNativeEnum,...me(t)});var Tr=class extends he{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.promise&&r.common.async===!1)return Z(r,{code:z.invalid_type,expected:te.promise,received:r.parsedType}),ce;let n=r.parsedType===te.promise?r.data:Promise.resolve(r.data);return it(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Tr.create=(e,t)=>new Tr({type:e,typeName:ue.ZodPromise,...me(t)});var Et=class extends he{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ue.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this9=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{Z(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(a){if(r.value==="aborted")return ce;let u=yield _this9._def.schema._parseAsync({data:a,path:n.path,parent:n});return u.status==="aborted"?ce:u.status==="dirty"?rn(u.value):r.value==="dirty"?rn(u.value):u});return function(_x82){return _ref38.apply(this,arguments)}}());{if(r.value==="aborted")return ce;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ce:a.status==="dirty"?rn(a.value):r.value==="dirty"?rn(a.value):a}}if(o.type==="refinement"){let s=a=>{let u=o.refinement(a,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ce:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ce:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Er(s))return ce;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Er(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):ce);Ae.assertNever(o)}};Et.create=(e,t,r)=>new Et({schema:e,typeName:ue.ZodEffects,effect:t,...me(r)});Et.createWithPreprocess=(e,t,r)=>new Et({schema:t,effect:{type:"preprocess",transform:e},typeName:ue.ZodEffects,...me(r)});var Ct=class extends he{_parse(t){return this._getType(t)===te.undefined?it(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ct.create=(e,t)=>new Ct({innerType:e,typeName:ue.ZodOptional,...me(t)});var zt=class extends he{_parse(t){return this._getType(t)===te.null?it(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};zt.create=(e,t)=>new zt({innerType:e,typeName:ue.ZodNullable,...me(t)});var hn=class extends he{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===te.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};hn.create=(e,t)=>new hn({innerType:e,typeName:ue.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...me(t)});var yn=class extends he{_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 ao(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ut(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ut(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};yn.create=(e,t)=>new yn({innerType:e,typeName:ue.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...me(t)});var mo=class extends he{_parse(t){if(this._getType(t)!==te.nan){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.nan,received:n.parsedType}),ce}return{status:"valid",value:t.data}}};mo.create=e=>new mo({typeName:ue.ZodNaN,...me(e)});var tT=Symbol("zod_brand"),ki=class extends he{_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}},Oi=class e extends he{_parse(t){var _this0=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let i=yield _this0._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ce:i.status==="dirty"?(r.dirty(),rn(i.value)):_this0._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ce:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:ue.ZodPipeline})}},vn=class extends he{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Er(o)&&(o.value=Object.freeze(o.value)),o);return ao(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};vn.create=(e,t)=>new vn({innerType:e,typeName:ue.ZodReadonly,...me(t)});function ky(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Dy(e,t={},r){return e?Rr.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=ky(t,n),u=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:u})}});if(!i){let s=ky(t,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):Rr.create()}var rT={object:lt.lazycreate},ue;(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"})(ue||(ue={}));var nT=(e,t={message:`Input not instance of ${e.name}`})=>Dy(r=>r instanceof e,t),My=Ir.create,Ly=nn.create,oT=mo.create,iT=on.create,jy=sn.create,sT=an.create,aT=uo.create,cT=cn.create,uT=un.create,lT=Rr.create,dT=dr.create,pT=Dt.create,fT=lo.create,mT=pr.create,gT=lt.create,hT=lt.strictCreate,yT=ln.create,vT=Na.create,ST=dn.create,AT=Ht.create,bT=Fa.create,wT=po.create,CT=fo.create,xT=Da.create,ET=pn.create,IT=fn.create,RT=mn.create,TT=gn.create,_T=Tr.create,kT=Et.create,OT=Ct.create,PT=zt.create,NT=Et.createWithPreprocess,FT=Oi.create,DT=()=>My().optional(),MT=()=>Ly().optional(),LT=()=>jy().optional(),jT={string:e=>Ir.create({...e,coerce:!0}),number:e=>nn.create({...e,coerce:!0}),boolean:e=>sn.create({...e,coerce:!0}),bigint:e=>on.create({...e,coerce:!0}),date:e=>an.create({...e,coerce:!0})};var qT=ce;var UT=b.object({name:b.string(),arguments:b.string()}),VT=b.object({id:b.string(),type:b.literal("function"),function:UT,encryptedValue:b.string().optional()}),Ma=b.object({id:b.string(),role:b.string(),content:b.string().optional(),name:b.string().optional(),encryptedValue:b.string().optional()}),GT=b.object({type:b.literal("text"),text:b.string()}),BT=b.object({type:b.literal("data"),value:b.string(),mimeType:b.string()}),$T=b.object({type:b.literal("url"),value:b.string(),mimeType:b.string().optional()}),La=b.discriminatedUnion("type",[BT,$T]),QT=b.object({type:b.literal("image"),source:La,metadata:b.unknown().optional()}),HT=b.object({type:b.literal("audio"),source:La,metadata:b.unknown().optional()}),zT=b.object({type:b.literal("video"),source:La,metadata:b.unknown().optional()}),WT=b.object({type:b.literal("document"),source:La,metadata:b.unknown().optional()});var qy=b.object({type:b.literal("binary"),mimeType:b.string(),id:b.string().optional(),url:b.string().optional(),data:b.string().optional(),filename:b.string().optional()}),Uy=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:b.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},R4=qy.superRefine((e,t)=>{Uy(e,t)}),KT=b.discriminatedUnion("type",[GT,QT,HT,zT,WT,qy]),YT=KT.superRefine((e,t)=>{e.type==="binary"&&Uy(e,t)}),XT=Ma.extend({role:b.literal("developer"),content:b.string()}),ZT=Ma.extend({role:b.literal("system"),content:b.string()}),JT=Ma.extend({role:b.literal("assistant"),content:b.string().optional(),toolCalls:b.array(VT).optional()}),e_=Ma.extend({role:b.literal("user"),content:b.union([b.string(),b.array(YT)])}),t_=b.object({id:b.string(),content:b.string(),role:b.literal("tool"),toolCallId:b.string(),error:b.string().optional(),encryptedValue:b.string().optional()}),r_=b.object({id:b.string(),role:b.literal("activity"),activityType:b.string(),content:b.record(b.any())}),n_=b.object({id:b.string(),role:b.literal("reasoning"),content:b.string(),encryptedValue:b.string().optional()}),Vy=b.discriminatedUnion("role",[XT,ZT,JT,e_,t_,r_,n_]),T4=b.union([b.literal("developer"),b.literal("system"),b.literal("assistant"),b.literal("user"),b.literal("tool"),b.literal("activity"),b.literal("reasoning")]),o_=b.object({description:b.string(),value:b.string()}),Gy=b.object({name:b.string(),description:b.string(),parameters:b.any(),metadata:b.record(b.any()).optional()}),i_=b.object({threadId:b.string(),runId:b.string(),parentRunId:b.string().optional(),state:b.any(),messages:b.array(Vy),tools:b.array(Gy),context:b.array(o_),forwardedProps:b.any()}),s_=b.any(),De=class extends Error{constructor(e){super(e)}},Vd=class extends De{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},a_=b.object({name:b.string(),description:b.string().optional()}),c_=b.object({name:b.string().optional(),type:b.string().optional(),description:b.string().optional(),version:b.string().optional(),provider:b.string().optional(),documentationUrl:b.string().optional(),metadata:b.record(b.unknown()).optional()}),u_=b.object({streaming:b.boolean().optional(),websocket:b.boolean().optional(),httpBinary:b.boolean().optional(),pushNotifications:b.boolean().optional(),resumable:b.boolean().optional()}),l_=b.object({supported:b.boolean().optional(),items:b.array(Gy).optional(),parallelCalls:b.boolean().optional(),clientProvided:b.boolean().optional()}),d_=b.object({structuredOutput:b.boolean().optional(),supportedMimeTypes:b.array(b.string()).optional()}),p_=b.object({snapshots:b.boolean().optional(),deltas:b.boolean().optional(),memory:b.boolean().optional(),persistentState:b.boolean().optional()}),f_=b.object({supported:b.boolean().optional(),delegation:b.boolean().optional(),handoffs:b.boolean().optional(),subAgents:b.array(a_).optional()}),m_=b.object({supported:b.boolean().optional(),streaming:b.boolean().optional(),encrypted:b.boolean().optional()}),g_=b.object({image:b.boolean().optional(),audio:b.boolean().optional(),video:b.boolean().optional(),pdf:b.boolean().optional(),file:b.boolean().optional()}),h_=b.object({image:b.boolean().optional(),audio:b.boolean().optional()}),y_=b.object({input:g_.optional(),output:h_.optional()}),v_=b.object({codeExecution:b.boolean().optional(),sandboxed:b.boolean().optional(),maxIterations:b.number().optional(),maxExecutionTime:b.number().optional()}),S_=b.object({supported:b.boolean().optional(),approvals:b.boolean().optional(),interventions:b.boolean().optional(),feedback:b.boolean().optional()}),_4=b.object({identity:c_.optional(),transport:u_.optional(),tools:l_.optional(),output:d_.optional(),state:p_.optional(),multiAgent:f_.optional(),reasoning:m_.optional(),multimodal:y_.optional(),execution:v_.optional(),humanInTheLoop:S_.optional(),custom:b.record(b.unknown()).optional()}),By=b.union([b.literal("developer"),b.literal("system"),b.literal("assistant"),b.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}({}),xe=b.object({type:b.nativeEnum(D),timestamp:b.number().optional(),rawEvent:b.any().optional()}).passthrough(),A_=xe.extend({type:b.literal(D.TEXT_MESSAGE_START),messageId:b.string(),role:By.default("assistant"),name:b.string().optional()}),$y=xe.extend({type:b.literal(D.TEXT_MESSAGE_CONTENT),messageId:b.string(),delta:b.string()}),b_=xe.extend({type:b.literal(D.TEXT_MESSAGE_END),messageId:b.string()}),w_=xe.extend({type:b.literal(D.TEXT_MESSAGE_CHUNK),messageId:b.string().optional(),role:By.optional(),delta:b.string().optional(),name:b.string().optional()}),C_=xe.extend({type:b.literal(D.THINKING_TEXT_MESSAGE_START)}),x_=$y.omit({messageId:!0,type:!0}).extend({type:b.literal(D.THINKING_TEXT_MESSAGE_CONTENT)}),E_=xe.extend({type:b.literal(D.THINKING_TEXT_MESSAGE_END)}),I_=xe.extend({type:b.literal(D.TOOL_CALL_START),toolCallId:b.string(),toolCallName:b.string(),parentMessageId:b.string().optional()}),R_=xe.extend({type:b.literal(D.TOOL_CALL_ARGS),toolCallId:b.string(),delta:b.string()}),T_=xe.extend({type:b.literal(D.TOOL_CALL_END),toolCallId:b.string()}),__=xe.extend({messageId:b.string(),type:b.literal(D.TOOL_CALL_RESULT),toolCallId:b.string(),content:b.string(),role:b.literal("tool").optional()}),k_=xe.extend({type:b.literal(D.TOOL_CALL_CHUNK),toolCallId:b.string().optional(),toolCallName:b.string().optional(),parentMessageId:b.string().optional(),delta:b.string().optional()}),O_=xe.extend({type:b.literal(D.THINKING_START),title:b.string().optional()}),P_=xe.extend({type:b.literal(D.THINKING_END)}),N_=xe.extend({type:b.literal(D.STATE_SNAPSHOT),snapshot:s_}),F_=xe.extend({type:b.literal(D.STATE_DELTA),delta:b.array(b.any())}),D_=xe.extend({type:b.literal(D.MESSAGES_SNAPSHOT),messages:b.array(Vy)}),M_=xe.extend({type:b.literal(D.ACTIVITY_SNAPSHOT),messageId:b.string(),activityType:b.string(),content:b.record(b.any()),replace:b.boolean().optional().default(!0)}),L_=xe.extend({type:b.literal(D.ACTIVITY_DELTA),messageId:b.string(),activityType:b.string(),patch:b.array(b.any())}),j_=xe.extend({type:b.literal(D.RAW),event:b.any(),source:b.string().optional()}),q_=xe.extend({type:b.literal(D.CUSTOM),name:b.string(),value:b.any()}),U_=xe.extend({type:b.literal(D.RUN_STARTED),threadId:b.string(),runId:b.string(),parentRunId:b.string().optional(),input:i_.optional()}),V_=xe.extend({type:b.literal(D.RUN_FINISHED),threadId:b.string(),runId:b.string(),result:b.any().optional()}),G_=xe.extend({type:b.literal(D.RUN_ERROR),message:b.string(),code:b.string().optional()}),B_=xe.extend({type:b.literal(D.STEP_STARTED),stepName:b.string()}),$_=xe.extend({type:b.literal(D.STEP_FINISHED),stepName:b.string()}),Q_=b.union([b.literal("tool-call"),b.literal("message")]),H_=xe.extend({type:b.literal(D.REASONING_START),messageId:b.string()}),z_=xe.extend({type:b.literal(D.REASONING_MESSAGE_START),messageId:b.string(),role:b.literal("reasoning")}),W_=xe.extend({type:b.literal(D.REASONING_MESSAGE_CONTENT),messageId:b.string(),delta:b.string()}),K_=xe.extend({type:b.literal(D.REASONING_MESSAGE_END),messageId:b.string()}),Y_=xe.extend({type:b.literal(D.REASONING_MESSAGE_CHUNK),messageId:b.string().optional(),delta:b.string().optional()}),X_=xe.extend({type:b.literal(D.REASONING_END),messageId:b.string()}),Z_=xe.extend({type:b.literal(D.REASONING_ENCRYPTED_VALUE),subtype:Q_,entityId:b.string(),encryptedValue:b.string()}),ja=b.discriminatedUnion("type",[A_,$y,b_,w_,O_,P_,C_,x_,E_,I_,R_,T_,k_,__,N_,F_,D_,M_,L_,j_,q_,U_,V_,G_,B_,$_,H_,z_,W_,K_,Y_,X_,Z_]);m();d();f();p();var Gd={};zi(Gd,{JsonPatchError:()=>qe,_areEquals:()=>Fi,applyOperation:()=>Sn,applyPatch:()=>Qa,applyReducer:()=>nk,deepClone:()=>tk,getValueByPointer:()=>Ba,validate:()=>Hy,validator:()=>$a});m();d();f();p();m();d();f();p();var J_=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},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)}}(),ek=Object.prototype.hasOwnProperty;function Ua(e,t){return ek.call(e,t)}function Va(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)Ua(e,o)&&n.push(o);return n}function tt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Ga(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 Wt(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Pi(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function qa(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(qa(e[t]))return!0}else if(typeof e=="object"){for(var n=Va(e),o=n.length,i=0;i<o;i++)if(qa(e[n[i]]))return!0}}return!1}function Qy(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
33
- `)}var Ni=function(e){J_(t,e);function t(r,n,o,i,s){var a=this.constructor,u=e.call(this,Qy(r,{name:n,index:o,operation:i,tree:s}))||this;return u.name=n,u.index=o,u.operation=i,u.tree=s,Object.setPrototypeOf(u,a.prototype),u.message=Qy(r,{name:n,index:o,operation:i,tree:s}),u}return t}(Error);var qe=Ni,tk=tt,go={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=Ba(r,this.path);n&&(n=tt(n));var o=Sn(r,{op:"remove",path:this.from}).removed;return Sn(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Ba(r,this.from);return Sn(r,{op:"add",path:this.path,value:tt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Fi(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},rk={add:function(e,t,r){return Ga(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:go.move,copy:go.copy,test:go.test,_get:go._get};function Ba(e,t){if(t=="")return e;var r={op:"_get",path:t};return Sn(e,r),r.value}function Sn(e,t,r,n,o,i){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),i===void 0&&(i=0),r&&(typeof r=="function"?r(t,0,e,t.path):$a(t,0)),t.path===""){var s={newDocument:e};if(t.op==="add")return s.newDocument=t.value,s;if(t.op==="replace")return s.newDocument=t.value,s.removed=e,s;if(t.op==="move"||t.op==="copy")return s.newDocument=Ba(e,t.from),t.op==="move"&&(s.removed=e),s;if(t.op==="test"){if(s.test=Fi(e,t.value),s.test===!1)throw new qe("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s.newDocument=e,s}else{if(t.op==="remove")return s.removed=e,s.newDocument=null,s;if(t.op==="_get")return t.value=e,s;if(r)throw new qe("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return s}}else{n||(e=tt(e));var a=t.path||"",u=a.split("/"),c=e,g=1,v=u.length,E=void 0,h=void 0,y=void 0;for(typeof r=="function"?y=r:y=$a;;){if(h=u[g],h&&h.indexOf("~")!=-1&&(h=Pi(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&u[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&&E===void 0&&(c[h]===void 0?E=u.slice(0,g).join("/"):g==v-1&&(E=t.path),E!==void 0&&y(t,0,e,E)),g++,Array.isArray(c)){if(h==="-")h=c.length;else{if(r&&!Ga(h))throw new qe("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",i,t,e);Ga(h)&&(h=~~h)}if(g>=v){if(r&&t.op==="add"&&h>c.length)throw new qe("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);var s=rk[t.op].call(t,c,h,e);if(s.test===!1)throw new qe("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}}else if(g>=v){var s=go[t.op].call(t,c,h,e);if(s.test===!1)throw new qe("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}if(c=c[h],r&&g<v&&(!c||typeof c!="object"))throw new qe("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function Qa(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new qe("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=tt(e));for(var i=new Array(t.length),s=0,a=t.length;s<a;s++)i[s]=Sn(e,t[s],r,!0,o,s),e=i[s].newDocument;return i.newDocument=e,i}function nk(e,t,r){var n=Sn(e,t);if(n.test===!1)throw new qe("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function $a(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new qe("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(go[e.op]){if(typeof e.path!="string")throw new qe("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new qe("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 qe("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 qe("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")&&qa(e.value))throw new qe("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,i=n.split("/").length;if(o!==i+1&&o!==i)throw new qe("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 qe("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 s={op:"_get",path:e.from,value:void 0},a=Hy([s],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new qe("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new qe("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function Hy(e,t,r){try{if(!Array.isArray(e))throw new qe("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Qa(tt(t),tt(e),r||!0);else{r=r||$a;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof qe)return o;throw o}}function Fi(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,i,s;if(r&&n){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!Fi(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var a=Object.keys(e);if(i=a.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(a[o]))return!1;for(o=i;o--!==0;)if(s=a[o],!Fi(e[s],t[s]))return!1;return!0}return e!==e&&t!==t}var Hd={};zi(Hd,{compare:()=>dk,generate:()=>Bd,observe:()=>lk,unobserve:()=>uk});m();d();f();p();var $d=new WeakMap,ok=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),ik=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function sk(e){return $d.get(e)}function ak(e,t){return e.observers.get(t)}function ck(e,t){e.observers.delete(t.callback)}function uk(e,t){t.unobserve()}function lk(e,t){var r=[],n,o=sk(e);if(!o)o=new ok(e),$d.set(e,o);else{var i=ak(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=tt(e),t){n.callback=t,n.next=null;var s=function(){Bd(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(s)};typeof window<"u"&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return n.patches=r,n.object=e,n.unobserve=function(){Bd(n),clearTimeout(n.next),ck(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},o.observers.set(t,new ik(t,n)),n}function Bd(e,t){t===void 0&&(t=!1);var r=$d.get(e.object);Qd(r.value,e.object,e.patches,"",t),e.patches.length&&Qa(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Qd(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=Va(t),s=Va(e),a=!1,u=!1,c=s.length-1;c>=0;c--){var g=s[c],v=e[g];if(Ua(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var E=t[g];typeof v=="object"&&v!=null&&typeof E=="object"&&E!=null&&Array.isArray(v)===Array.isArray(E)?Qd(v,E,r,n+"/"+Wt(g),o):v!==E&&(a=!0,o&&r.push({op:"test",path:n+"/"+Wt(g),value:tt(v)}),r.push({op:"replace",path:n+"/"+Wt(g),value:tt(E)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+Wt(g),value:tt(v)}),r.push({op:"remove",path:n+"/"+Wt(g)}),u=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),a=!0)}if(!(!u&&i.length==s.length))for(var c=0;c<i.length;c++){var g=i[c];!Ua(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+Wt(g),value:tt(t[g])})}}}function dk(e,t,r){r===void 0&&(r=!1);var n=[];return Qd(e,t,n,"",r),n}var Ha=Object.assign({},Gd,Hd,{JsonPatchError:Ni,deepClone:tt,escapePathComponent:Wt,unescapePathComponent:Pi});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var zd=function(e,t){return zd=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])},zd(e,t)};function Kt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");zd(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function zy(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(g){try{c(n.next(g))}catch(v){s(v)}}function u(g){try{c(n.throw(g))}catch(v){s(v)}}function c(g){g.done?i(g.value):o(g.value).then(a,u)}c((n=n.apply(e,t||[])).next())})}function za(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function fr(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 ho(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-->0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function yo(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function An(e){return this instanceof An?(this.v=e,this):new An(e)}function Wy(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(h){return function(y){return Promise.resolve(y).then(h,v)}}function a(h,y){n[h]&&(o[h]=function(S){return new Promise(function(x,I){i.push([h,S,x,I])>1||u(h,S)})},y&&(o[h]=y(o[h])))}function u(h,y){try{c(n[h](y))}catch(S){E(i[0][3],S)}}function c(h){h.value instanceof An?Promise.resolve(h.value.v).then(g,v):E(i[0][2],h)}function g(h){u("next",h)}function v(h){u("throw",h)}function E(h,y){h(y),i.shift(),i.length&&u(i[0][0],i[0][1])}}function Ky(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 fr=="function"?fr(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(s){return new Promise(function(a,u){s=e[i](s),o(a,u,s.done,s.value)})}}function o(i,s,a,u){Promise.resolve(u).then(function(c){i({value:c,done:a})},s)}}m();d();f();p();function Se(e){return typeof e=="function"}m();d();f();p();m();d();f();p();m();d();f();p();function vo(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 Wa=vo(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
31
+ `;function zE(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var WE=["1",1,"yes",!0];function na(){let e=[];return Fl()&&e.push(window.doNotTrack),zl()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>WE.indexOf(t)!==-1)}var Wg="v15",Kg={default:"https://analytics.cloud.coveo.com/rest/ua",production:"https://analytics.cloud.coveo.com/rest/ua",hipaa:"https://analyticshipaa.cloud.coveo.com/rest/ua"};function KE(e=Kg.default,t=Wg,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 YE="38824e1f-37f5-42d3-8372-a4b8fa9df946",Gt=class{get defaultOptions(){return{endpoint:Kg.default,isCustomEndpoint:!1,token:"",version:Wg,beforeSendHooks:[],afterSendHooks:[]}}get version(){return $g}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=[jx,Nx].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};na()?this.runtime=new ra:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(ve.view,{newEventType:ve.view,addClientIdParameter:!0}),this.addEventTypeMapping(ve.click,{newEventType:ve.click,addClientIdParameter:!0}),this.addEventTypeMapping(ve.custom,{newEventType:ve.custom,addClientIdParameter:!0}),this.addEventTypeMapping(ve.search,{newEventType:ve.search,addClientIdParameter:!0})}initRuntime(t){return Fl()&&Wn()?new Ql(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(zE()&&console.warn(HE),new Hl(t))}get storage(){return this.runtime.storage}determineVisitorId(){return q(this,void 0,void 0,function*(){try{return Fl()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Xr()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Xr()}})}getCurrentVisitorId(){return q(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return q(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return q(this,void 0,void 0,function*(){if(Zs(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(Og(t,Og(r,YE)))}})}getParameters(t,...r){return q(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return q(this,void 0,void 0,function*(){let n=yield this.resolveParameters(t,...r);return yield this.resolvePayloadForParameters(t,n)})}get currentVisitorId(){return typeof(this.visitorId||this.storage.getItem("visitorId"))!="string"&&this.setCurrentVisitorId(Xr()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(na())return null;try{let r=new URL(t).searchParams.get(vr.cvo_cid);if(r==null)return null;let n=vr.fromString(r);return!n||!Wn()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return q(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:i=!1,addClientIdParameter:s=!1}=this.eventTypeMapping[t]||{};return yield[h=>n.length>0?this.parseVariableArgumentsPayload(n,h):h[0],h=>q(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>q(this,void 0,void 0,function*(){return s?Object.assign(Object.assign({},h),{clientId:yield this.getCurrentVisitorId()}):h}),h=>i?this.ensureAnonymousUserWhenUsingApiKey(h):h,h=>this.beforeSendHooks.reduce((y,S)=>q(this,void 0,void 0,function*(){let x=yield y;return yield S(t,x)}),h)].reduce((h,y)=>q(this,void 0,void 0,function*(){let S=yield h;return yield y(S)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return q(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[v=>this.setTrackingIdIfTrackingIdNotPresent(v),v=>this.removeEmptyPayloadValues(v,t),v=>this.validateParams(v,t),v=>n?ME(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,E)=>q(this,void 0,void 0,function*(){let h=yield v;return yield E(h)}),Promise.resolve(r))})}makeEvent(t,...r){return q(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},o=yield this.resolveParameters(t,...r),i=yield this.resolvePayloadForParameters(t,o);return{eventType:n,payload:i,log:s=>q(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},i),s)}),yield Promise.all(this.afterSendHooks.map(a=>a(t,Object.assign(Object.assign({},o),s)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return q(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return q(this,void 0,void 0,function*(){let t=this.bufferedRequests.shift();if(t){let{eventType:r,payload:n}=t;return this.runtime.getClientDependingOnEventType(r).sendEvent(r,n)}})}clear(){this.storage.removeItem("visitorId"),new Xs().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ve.search,t)})}sendSearchEvent(t){return q(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=ar(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ve.click,t)})}sendClickEvent(t){return q(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=ar(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ve.custom,t)})}sendCustomEvent(t){return q(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=ar(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ve.view,t)})}sendViewEvent(t){return q(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return q(this,void 0,void 0,function*(){let r=yield(yield w(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return q(this,void 0,void 0,function*(){return yield(yield w(`${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,i=r.length;o<i;o++){let s=r[o];if(typeof s=="string")n[t[o]]=s;else if(typeof s=="object")return Object.assign(Object.assign({},n),s)}return n}isKeyAllowedEmpty(t,r){return({[ve.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,i)=>Object.assign(Object.assign({},o),{[i]:t[i]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(UE(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=ar(t,["custom"]),o={};r&&Ys(r)&&(o=this.lowercaseKeys(r));let i=VE(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=ar(t,["custom"]);if(r&&Ys(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=ar(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==ve.view||r==ve.click||r==ve.search||r==ve.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==ve.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=ar(t,["userId"]);return QE(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=ar(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Ys(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Ys(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"?Jx(t,r):t}get baseUrl(){return KE(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},cr;(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"})(cr||(cr={}));var B;(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"})(B||(B={}));var jg={[B.triggerNotify]:"queryPipelineTriggers",[B.triggerExecute]:"queryPipelineTriggers",[B.triggerQuery]:"queryPipelineTriggers",[B.triggerRedirect]:"queryPipelineTriggers",[B.queryErrorBack]:"errors",[B.queryErrorClear]:"errors",[B.queryErrorRetry]:"errors",[B.pagerNext]:"getMoreResults",[B.pagerPrevious]:"getMoreResults",[B.pagerNumber]:"getMoreResults",[B.pagerResize]:"getMoreResults",[B.pagerScrolling]:"getMoreResults",[B.facetSearch]:"facet",[B.facetShowLess]:"facet",[B.facetShowMore]:"facet",[B.recommendation]:"recommendation",[B.likeSmartSnippet]:"smartSnippet",[B.dislikeSmartSnippet]:"smartSnippet",[B.expandSmartSnippet]:"smartSnippet",[B.collapseSmartSnippet]:"smartSnippet",[B.openSmartSnippetFeedbackModal]:"smartSnippet",[B.closeSmartSnippetFeedbackModal]:"smartSnippet",[B.sendSmartSnippetReason]:"smartSnippet",[B.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.clearRecentQueries]:"recentQueries",[B.recentResultClick]:"recentlyClickedDocuments",[B.clearRecentResults]:"recentlyClickedDocuments",[B.showLessFoldedResults]:"folding",[B.caseDetach]:"case",[B.likeGeneratedAnswer]:"generatedAnswer",[B.dislikeGeneratedAnswer]:"generatedAnswer",[B.openGeneratedAnswerSource]:"generatedAnswer",[B.generatedAnswerOpenInlineLink]:"generatedAnswer",[B.generatedAnswerFollowupOpenSource]:"generatedAnswer",[B.generatedAnswerStreamEnd]:"generatedAnswer",[B.generatedAnswerSourceHover]:"generatedAnswer",[B.generatedAnswerCopyToClipboard]:"generatedAnswer",[B.generatedAnswerHideAnswers]:"generatedAnswer",[B.generatedAnswerShowAnswers]:"generatedAnswer",[B.generatedAnswerExpand]:"generatedAnswer",[B.generatedAnswerCollapse]:"generatedAnswer",[B.generatedAnswerFeedbackSubmit]:"generatedAnswer",[B.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[cr.expandToFullUI]:"interface",[cr.openUserActions]:"User Actions",[cr.showPrecedingSessions]:"User Actions",[cr.showFollowingSessions]:"User Actions",[cr.clickViewedDocument]:"User Actions",[cr.clickPageView]:"User Actions",[cr.createArticle]:"createArticle"},Xn=class{constructor(){this.runtime=new ra,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(ve.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(ve.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(ve.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(ve.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return $g}};function XE(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function ZE(e){return e.map(t=>t.replace(/;/g,""))}function Yg(e){let r=e.join(";");return r.length<=256?r:Yg(e.slice(1))}var qg=e=>{let t=ZE(e),r=XE(t);return Yg(r)};function Ug(e){let t=typeof e.partialQueries=="string"?e.partialQueries:qg(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:qg(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var oa=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||na();this.coveoAnalyticsClient=n?new Xn:new Gt(t)}disable(){this.coveoAnalyticsClient=new Xn}enable(){this.coveoAnalyticsClient=new Gt(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(B.interfaceLoad)}logInterfaceLoad(){return q(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(B.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(B.recommendation)}logRecommendation(){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent(B.recommendationOpen,t,r)}logRecommendationOpen(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(B.staticFilterClearAll,t)}logStaticFilterClearAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent(B.staticFilterSelect,t)}logStaticFilterSelect(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent(B.staticFilterDeselect,t)}logStaticFilterDeselect(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(B.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return q(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent(B.interfaceChange,t)}logInterfaceChange(t){return q(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(B.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(B.didyoumeanClick)}logDidYouMeanClick(){return q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(B.resultsSort,t)}logResultsSort(t){return q(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(B.searchboxSubmit)}logSearchboxSubmit(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(B.searchboxClear)}logSearchboxClear(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(B.searchboxAsYouType)}logSearchboxAsYouType(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(B.breadcrumbFacet,t)}logBreadcrumbFacet(t){return q(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(B.breadcrumbResetAll)}logBreadcrumbResetAll(){return q(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent(B.documentQuickview,t,r)}logDocumentQuickview(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent(B.documentOpen,t,r)}logDocumentOpen(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(B.omniboxAnalytics,Ug(t))}logOmniboxAnalytics(t){return q(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(B.omniboxFromLink,Ug(t))}logOmniboxFromLink(t){return q(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(B.searchFromLink)}logSearchFromLink(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(B.triggerNotify,t)}logTriggerNotify(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(B.triggerExecute,t)}logTriggerExecute(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(B.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(B.undoTriggerQuery,t)}logUndoTriggerQuery(t){return q(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(B.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(B.pagerResize,t)}logPagerResize(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(B.pagerNumber,t)}logPagerNumber(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(B.pagerNext,t)}logPagerNext(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(B.pagerPrevious,t)}logPagerPrevious(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(B.pagerScrolling)}logPagerScrolling(){return q(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(B.facetClearAll,t)}logFacetClearAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(B.facetSearch,t)}logFacetSearch(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(B.facetSelect,t)}logFacetSelect(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(B.facetDeselect,t)}logFacetDeselect(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(B.facetExclude,t)}logFacetExclude(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(B.facetUnexclude,t)}logFacetUnexclude(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(B.facetSelectAll,t)}logFacetSelectAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(B.facetUpdateSort,t)}logFacetUpdateSort(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(B.facetShowMore,t)}logFacetShowMore(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(B.facetShowLess,t)}logFacetShowLess(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(B.queryError,t)}logQueryError(t){return q(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(B.queryErrorBack);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.queryErrorBack)})}})}logQueryErrorBack(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(B.queryErrorRetry);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.queryErrorRetry)})}})}logQueryErrorRetry(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(B.queryErrorClear);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.queryErrorClear)})}})}logQueryErrorClear(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(B.likeSmartSnippet)}logLikeSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(B.dislikeSmartSnippet)}logDislikeSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(B.expandSmartSnippet)}logExpandSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(B.collapseSmartSnippet)}logCollapseSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(B.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(B.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return q(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent(B.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(B.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent(B.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent(B.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent(B.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent(B.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent(B.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(B.copyToClipboard,t,r)}logCopyToClipboard(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent(B.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent(B.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(B.recentQueryClick)}logRecentQueryClick(){return q(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(B.clearRecentQueries)}logClearRecentQueries(){return q(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent(B.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(B.clearRecentResults)}logClearRecentResults(){return q(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(B.noResultsBack)}logNoResultsBack(){return q(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent(B.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(B.showLessFoldedResults)}logShowLessFoldedResults(){return q(this,void 0,void 0,function*(){return(yield this.makeShowLessFoldedResults()).log({searchUID:this.provider.getSearchUID()})})}makeEventDescription(t,r){var n;return{actionCause:r,customData:(n=t.payload)===null||n===void 0?void 0:n.customData}}makeCustomEvent(t,r){return q(this,arguments,void 0,function*(n,o,i=jg[n]){this.coveoAnalyticsClient.getParameters;let s=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),a=Object.assign(Object.assign({},yield this.getBaseEventRequest(s)),{eventType:i,eventValue:n}),u=yield this.coveoAnalyticsClient.makeCustomEvent(a);return{description:this.makeEventDescription(u,n),log:({searchUID:c})=>u.log({lastSearchQueryUid:c})}})}logCustomEvent(t,r){return q(this,arguments,void 0,function*(n,o,i=jg[n]){return(yield this.makeCustomEvent(n,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return q(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),i=Object.assign(Object.assign({},yield this.getBaseEventRequest(o)),{eventType:r,eventValue:t}),s=yield this.coveoAnalyticsClient.makeCustomEvent(i);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({lastSearchQueryUid:a})}})}logCustomEventWithType(t,r,n){return q(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return q(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),o=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(o,t),log:({searchUID:i})=>o.log({searchQueryUid:i})}})}makeClickEvent(t,r,n,o){return q(this,void 0,void 0,function*(){let i=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),s=yield this.coveoAnalyticsClient.makeClickEvent(i);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({searchQueryUid:a})}})}logClickEvent(t,r,n,o){return q(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return q(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return q(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.getOrigins()),this.getSplitTestRun()),{customData:r,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,r;return{originContext:(r=(t=this.provider).getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof Gt?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(B.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(B.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(B.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return q(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent(B.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(B.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent(B.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(B.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(B.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(B.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(B.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(B.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(B.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(B.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(B.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(B.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(B.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return q(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(B.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},ia=Object.assign({},pi),Vg=Object.keys(ia).map(e=>ia[e]),Kn=class extends Ll{constructor({client:t,uuidGenerator:r=Xr}){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])=>Vg.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Vg.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(ia.pageview,{newEventType:ve.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(ia.event,{newEventType:ve.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}:{}),i=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},i),o),r)}getTicketPayload(){return oE(this.ticket)}};Kn.Id="svc";var sa;(function(e){e.click="click",e.flowStart="flowStart"})(sa||(sa={}));var bt;(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"})(bt||(bt={}));var aa;(function(e){e.quit="Quit",e.solved="Solved"})(aa||(aa={}));var ca=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!na();this.coveoAnalyticsClient=o?new Gt(t):new Xn,this.svc=new Kn({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Xn,this.svc=new Kn({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Gt(this.options),this.svc=new Kn({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(bt.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(bt.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(bt.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(bt.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(bt.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(bt.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(bt.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(bt.caseCancelled,{reason:aa.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(bt.caseSolved,{reason:aa.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(bt.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",sa.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",sa.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return q(this,void 0,void 0,function*(){var r,n;let o=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:o,language:(r=this.provider)===null||r===void 0?void 0:r.getLanguage(),anonymous:(n=this.provider)===null||n===void 0?void 0:n.getIsAnonymous(),clientId:yield this.getClientId()})})}getClientId(){return this.coveoAnalyticsClient instanceof Gt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,o,i;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:(i=this.provider)===null||i===void 0?void 0:i.getOriginLevel3()}}logClickEvent(t,r,n,o){return q(this,void 0,void 0,function*(){var i,s;let a=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:(s=(i=this.provider)===null||i===void 0?void 0:i.getSearchUID())!==null&&s!==void 0?s:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(a)})}};m();d();f();p();var JE=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},Zr=class{constructor(t){oe(this,"getState",t);oe(this,"state");this.state=t()}getLanguage(){return JE(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[i,s]of Object.entries(n)){let a=`context_${i}`;o[a]=s}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=Gn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||$n()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};m();d();f();p();var Zn=e=>new Gt(e).getCurrentVisitorId(),gi=(e,t)=>typeof t=="function"?(...r)=>{let n=jo(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,hi=(e,t)=>(...r)=>{let n=jo(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var yi=class extends Zr{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Xg=({logger:e,getState:t,analyticsClientMiddleware:r=(i,s)=>s,preprocessRequest:n,provider:o=new yi(t)})=>{let i=t(),s=i.configuration.accessToken,a=i.configuration.analytics.apiBaseUrl??rt(i.configuration.organizationId,i.configuration.environment,"analytics"),u=i.configuration.analytics.runtimeEnvironment,c=i.configuration.analytics.enabled,g=new ca({enableAnalytics:c,token:s,endpoint:a,runtimeEnvironment:u,preprocessRequest:gi(e,n),beforeSendHooks:[hi(e,r),(v,E)=>(e.info({...E,type:v,endpoint:a,token:s},"Analytics request"),E)]},o);return c||g.disable(),g};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function ua(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function Zg(e){let{activeValue:t,ancestryMap:r}=rI(e);return t?nI(t,r):[]}function rI(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 nI(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var oI=(e,t)=>e.categoryFacetSet[t]?.request;var Wl=(e,t)=>{let r=oI(e,t);return Zg(r?.currentValues??[])};m();d();f();p();function la(){return{}}m();d();f();p();function da(){return{}}m();d();f();p();function pa(){return{}}m();d();f();p();function fa(){return{}}function Kl(e){return{facetSet:e.facetSet??fa(),categoryFacetSet:e.categoryFacetSet??la(),dateFacetSet:e.dateFacetSet??da(),numericFacetSet:e.numericFacetSet??pa(),automaticFacetSet:e.automaticFacetSet??ua()}}var Yl=e=>{let t=[];return aI(e).forEach((r,n)=>{let o=gI(e,r.facetId),i=fI(r,n+1);if(sI(r)){if(!!!Wl(e,r.facetId).length)return;t.push({...i,...dI(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((s,a)=>{if(s.state==="idle")return;let u=Jg(s,a+1,o),c=iI(r)?eh(s):uI(s);t.push({...i,...u,...c})})}),cI(e).forEach((r,n)=>{let o=pI(r,n+1);r.values.forEach((i,s)=>{if(i.state==="idle")return;let a=Jg(i,s+1,"specific"),u=eh(i);t.push({...o,...a,...u})})}),t},iI=e=>e.type==="specific",sI=e=>e.type==="hierarchical",aI=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),cI=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),Jg=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),uI=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),eh=e=>({displayValue:e.value,value:e.value}),lI=(e,t)=>Wl(e,t).map(n=>n.value).join(";"),dI=(e,t)=>{let n=lI(e,t);return{value:n,valuePosition:1,displayValue:n}},pI=(e,t)=>({title:th(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),fI=(e,t)=>({title:th(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),th=(e,t)=>`${e}_${t}`,mI=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,gI=(e,t)=>{let r=mI(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var Xl=e=>e.configuration.search.locale,rh=e=>e.configuration.search.timezone,nh=e=>e.configuration.accessToken,oh=e=>e.configuration.organizationId,ih=e=>e.configuration.environment,ma=e=>e.configuration?.knowledge?.agentId,sh=e=>e.configuration.knowledge.debugAgentSession;var Jr=e=>{if(hI(e)||Zl(e))return e.generatedAnswer?.answerId;if(yI(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},hI=e=>"answer"in e&&"generatedAnswer"in e&&!ce(e.generatedAnswer?.answerConfigurationId),Zl=e=>{let t=ma(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},yI=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Jl=e=>e.generatedAnswer?.fieldsToIncludeInCitations,ah=e=>e.followUpAnswers?.conversationId,vI=e=>e.generatedAnswer?.citations,SI=e=>e.followUpAnswers?.followUpAnswers,AI=je(SI,e=>e?.flatMap(t=>t.citations)),bI=(e,t)=>t,wI=je(vI,AI,bI,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));m();d();f();p();var Ft=()=>({q:"",enableQuerySyntax:!1});m();d();f();p();function ed(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Bt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:ed(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:ed(),extendedResults:{},searchAction:void 0}}m();d();f();p();m();d();f();p();m();d();f();p();var ch=(r=>(r.Ascending="ascending",r.Descending="descending",r))(ch||{}),uh=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(uh||{}),td=e=>{if(Ef(e))return e.map(t=>td(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""}},lh=()=>({by:"relevancy"});var lV=new xe({values:{by:new Uu({enum:uh,required:!0}),order:new Uu({enum:ch}),field:new re}});function ga(){return td(lh())}m();d();f();p();m();d();f();p();m();d();f();p();var Jn=class e{static set(t,r,n){let o,i,s;n&&(i=new Date,i.setTime(i.getTime()+n));let a=window.location.hostname,u=/^(\d{1,3}\.){3}\d{1,3}$/,c=/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/;u.test(a)||c.test(a)||a.indexOf(".")===-1?rd(t,r,i):(s=a.split("."),o=s[s.length-2]+"."+s[s.length-1],rd(t,r,i,o))}static get(t){let r=t+"=",n=document.cookie.split(";");for(let o=0;o<n.length;o++){let i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function rd(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}m();d();f();p();function CI(){return typeof navigator<"u"}function dh(){try{return typeof localStorage<"u"}catch{return!1}}function ph(){try{return typeof sessionStorage<"u"}catch{return!1}}function fh(){return!!(CI()&&navigator.cookieEnabled)}var mh=null;function gh(){return mh||(dh()?localStorage:fh()?new nd:ph()?sessionStorage:new od)}var eo=class eo{getItem(t){return Jn.get(`${eo.prefix}${t}`)}removeItem(t){Jn.erase(`${eo.prefix}${t}`)}setItem(t,r,n){Jn.set(`${eo.prefix}${t}`,r,n)}};oe(eo,"prefix","coveo_");var nd=eo;var od=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var ha="__coveo.analytics.history",xI=20,EI=1e3*60,II=75,en=class en{constructor(t){oe(this,"store");this.store=t||gh()}static getInstance(t){return en.instance||(en.instance=new en(t)),en.instance}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!==null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _this4=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this4.cropQueryElement(_this4.stripEmptyQuery(t));let r=yield _this4.getHistoryWithInternalTimeAsync();r!==null?_this4.isValidEntry(t)&&_this4.setHistory([t].concat(r)):_this4.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this5=this;return _asyncToGenerator(function*(){let t=yield _this5.getHistoryWithInternalTimeAsync();return _this5.stripEmptyQueries(_this5.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(ha);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this6=this;return _asyncToGenerator(function*(){try{let t=yield _this6.store.getItem(ha);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(ha,JSON.stringify(t.slice(0,xI)))}catch{}}clear(){try{this.store.removeItem(ha)}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,II)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value===t.value?(t.internalTime||0)-(r.internalTime||0)>EI:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};oe(en,"instance",null);var id=en,$t=id;var vi=class vi extends Zr{constructor(){super(...arguments);oe(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 Yl(Kl(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||vi.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||Bt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||vi.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=Jr(r);return o&&(n.generativeQuestionAnsweringId=o),n}getFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetValue:n,facetTitle:`${i}_${r}`}}getFacetClearAllMetadata(r){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetTitle:`${o}_${r}`}}getFacetUpdateSortMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,criteria:n,facetTitle:`${i}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${i}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??ga()}}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 i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:i,categoryFacetPath:n,categoryFacetTitle:`${i}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let o=this.state.querySuggest?.[r],i=o.completions.map(c=>c.expression),s=o.partialQueries.length-1,a=o.partialQueries[s]||"",u=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(n),partialQuery:a,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:i.length>0?i:"",querySuggestResponseId:u}}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||Ft().q}get responseTime(){return this.state.search?.duration||Bt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Bt().response.totalCountFiltered}};oe(vi,"fallbackPipelineName","default");var Sr=vi,hh=({logger:e,getState:t,analyticsClientMiddleware:r=(i,s)=>s,preprocessRequest:n,provider:o})=>{let i=t(),s=i.configuration.accessToken,a=i.configuration.analytics.apiBaseUrl??rt(i.configuration.organizationId,i.configuration.environment,"analytics"),u=i.configuration.analytics.runtimeEnvironment,c=i.configuration.analytics.enabled,g=new oa({token:s,endpoint:a,runtimeEnvironment:u,preprocessRequest:gi(e,n),beforeSendHooks:[hi(e,r),(v,E)=>(e.info({...E,type:v,endpoint:a,token:s},"Analytics request"),E)]},o);return c||g.disable(),g},sd=()=>{let t=$t.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};m();d();f();p();function yh(e){let t=vh(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return mf([e,...t,...r],o=>o.uniqueId)}function vh(e){return e.childResults?e.childResults.flatMap(t=>[t,...vh(t)]):[]}m();d();f();p();var ya=()=>"";function Ah(e,t){return{...new Sr(t).getBaseMetadata(),actionCause:e,type:e}}function RI(e){return Object.assign(e,{instantlyCallable:!0})}function TI(e,t){let r=i=>{let s=Ce(e,i);return RI(Object.assign(s,{type:s.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*(i,{getState:s,extra:a}){let{analyticsClientMiddleware:u,preprocessRequest:c,logger:g}=a;return yield(yield t({getState:s,analyticsClientMiddleware:u,preprocessRequest:c,logger:g})).log({state:s(),extra:a})});return function(_x42,_x43){return _ref17.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref18=_asyncToGenerator(function*({getState:i,analyticsClientMiddleware:s,preprocessRequest:a,logger:u}){let{description:c,log:g}=yield t({getState:i,analyticsClientMiddleware:s,preprocessRequest:a,logger:u});return{description:c,action:r(/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(v,{getState:E,extra:h}){return yield g({state:E(),extra:h})});return function(_x45,_x46){return _ref19.apply(this,arguments)}}())}});return function prepare(_x44){return _ref18.apply(this,arguments)}}()}),n}var bh=(e,t,r)=>{function n(...o){let i=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 OI(i)}return n},_I=e=>e.configuration.analytics.analyticsMode==="legacy",kI=e=>e.configuration.analytics.analyticsMode==="next",OI=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:s})=>(r??(r=a=>new s(a)),TI(e,/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*({getState:a,analyticsClientMiddleware:u,preprocessRequest:c,logger:g}){let v=[],E={log:function(){var _ref21=_asyncToGenerator(function*({state:I}){for(let T of v)yield T(I)});return function log(_x48){return _ref21.apply(this,arguments)}}()},h=a(),y=i({getState:a,logger:g,analyticsClientMiddleware:u,preprocessRequest:c,provider:r(a)}),S=yield t(y,a());E.description=S?.description,v.push(/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(I){_I(I)&&(yield PI(S,r,I,g,y.coveoAnalyticsClient))});return function(_x49){return _ref22.apply(this,arguments)}}());let{emit:x}=ii(h);return v.push(/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(I){if(kI(I)&&o&&n){let T=n(I);yield UI(x,o,T)}});return function(_x50){return _ref23.apply(this,arguments)}}()),E});return function(_x47){return _ref20.apply(this,arguments)}}()));function PI(_x51,_x52,_x53,_x54,_x55){return _PI.apply(this,arguments)}function _PI(){_PI=_asyncToGenerator(function*(e,t,r,n,o){t(()=>r);let i=yield e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:o,response:i},"Analytics response")});return _PI.apply(this,arguments)}var NI=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref24=_asyncToGenerator(function*(i){r(n,o)});return function log(_x56){return _ref24.apply(this,arguments)}}()}),ot=bh(e=>hh({...e,provider:e.provider||new Sr(e.getState)}),e=>e,Sr),ht=bh(Xg,NI("caseAssist"),yi);var ad=(e,t)=>{let r=i=>i+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=xh(e,o),n<0&&(n=qI(e,o)),n<0&&(n=0),FI(e,r(n),t)};function FI(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:LI(e),...(Sh(e)?{documentCategory:Sh(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:jI(e),queryPipeline:r.pipeline||ya()}}function Sh(e){return e.raw?.objecttype||void 0}var cd=e=>(e.raw.permanentid||console.warn("Missing field permanentid on result. This might cause many issues with your Coveo deployment. See https://docs.coveo.com/en/1913 and https://docs.coveo.com/en/1640 for more information.",e),{contentIDKey:"permanentid",contentIDValue:e.raw.permanentid||""}),wh={urihash:new re,sourcetype:new re,permanentid:new re},Ch={uniqueId:ee,raw:new xe({values:wh}),title:ee,uri:ee,clickUri:ee,rankingModifier:new re({required:!1,emptyAllowed:!0})};function DI(e){return Object.assign({},...Object.keys(wh).map(t=>({[t]:e[t]})))}function MI(e){return Object.assign({},...Object.keys(Ch).map(t=>({[t]:e[t]})),{raw:DI(e.raw)})}function LI(e){let t=e.raw.author;return ce(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function jI(e){let t=e.raw.source;return ce(t)?"unknown":t}var ud=e=>new Ot(Ch).validate(MI(e));function qI(e,t){for(let[r,n]of t.entries()){let o=yh(n);if(xh(e,o)!==-1)return r}return-1}function xh(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function UI(_x57,_x58,_x59){return _UI.apply(this,arguments)}function _UI(){_UI=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _UI.apply(this,arguments)}m();d();f();p();var to=(e,t,r)=>ot({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let i=t??Jr(o);if(!i)return null;let s=ah(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:r,...(s&&{conversationId:s})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Jr(n)??"",answerGenerated:e??!1})}),ro=e=>ot({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Jr(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})});m();d();f();p();m();d();f();p();var Eh=je(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})}});m();d();f();p();var tn=(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:Qn(e)}});m();d();f();p();var ld=e=>e.context;m();d();f();p();var dd=e=>e.pipeline;m();d();f();p();m();d();f();p();var Ai=kt(va(),1),Oh=kt(Ih(),1);m();d();f();p();var Th=kt(va(),1),_h=kt(Rh(),1);Th.default.extend(_h.default);var VI="YYYY/MM/DD@HH:mm:ss";function kh(e){return e.format(VI)}Ai.default.extend(Oh.default);var GI=["past","now","next"],BI=["minute","hour","day","week","month","quarter","year"];function $I(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Ai.default)().subtract(r,n);case"next":return(0,Ai.default)().add(r,n);case"now":return(0,Ai.default)()}}function vd(e){return kh($I(QI(e)))}function Ph(e){return e.toLocaleLowerCase().split("-")}function Sd(e){let[t,r,n]=Ph(e);if(t==="now")return!0;if(!GI.includes(t)||!BI.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function QI(e){let[t,r,n]=Ph(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function Nh(e){return e.type==="dateRange"}function Fh(e){return`start${e}`}function Dh(e){return`end${e}`}var Ad=()=>({dateFacetValueMap:{}});function HI(e,t,r){let n=e.start,o=e.end;return Sd(n)&&(n=vd(n),r.dateFacetValueMap[t][Fh(n)]=e.start),Sd(o)&&(o=vd(o),r.dateFacetValueMap[t][Dh(o)]=e.end),{...e,start:n,end:o}}function bd(e,t){if(Nh(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>HI(o,r,t))}}return e}function Ar(e){let t=Ad();return{request:{...e,facets:e.facets?.map(n=>bd(n,t))},mappings:t}}function zI(e,t,r){return{...e,start:r.dateFacetValueMap[t][Fh(e.start)]||e.start,end:r.dateFacetValueMap[t][Dh(e.end)]||e.end}}function WI(e,t){return e.facetId in t.dateFacetValueMap}function KI(e,t){return WI(e,t)?{...e,values:e.values.map(r=>zI(r,e.facetId,t))}:e}function Sa(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>KI(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function br(e){return Object.values(e).map(t=>t.request)}function wd(e,t){let r={};e.forEach(i=>{r[i.facetId]=i});let n=[];t.forEach(i=>{i in r&&(n.push(r[i]),delete r[i])});let o=Object.values(r);return[...n,...o]}function Mh(e){return br(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Cd={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function YI(e){return br(e).map(t=>{let r=Cd[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function XI(e){return[...YI(e.facetSet??{}),...Mh(e.numericFacetSet??{}),...Mh(e.dateFacetSet??{}),...br(e.categoryFacetSet??{})]}function ZI(e){return XI(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function Aa(e){return wd(ZI(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();m();d();f();p();var Lh=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield Zn(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}),...(sd()&&{pageId:sd()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:Qn(e)})}}});return function Lh(_x60,_x61){return _ref25.apply(this,arguments)}}();var no=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Fn(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,...(e.configuration.analytics.enabled&&{actionsHistory:$t.getInstance().getHistory()}),...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&(yield Lh(e.configuration.analytics,t))),...(e.excerptLength&&!ce(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function no(_x62,_x63){return _ref26.apply(this,arguments)}}();m();d();f();p();var ba=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Fn(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&&tn(e.configuration.analytics,t,r)),...(e.excerptLength&&!ce(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});m();d();f();p();var jh=je(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o}));var wr=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t,r){let n=Ed(e),o=JI(e),i=eR(e),s=e.configuration.analytics.analyticsMode==="legacy"?yield no(e,r):ba(e,t,r);return Ar({...s,...(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:xd(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:i}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function wr(_x64,_x65,_x66){return _ref27.apply(this,arguments)}}();function xd(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function JI(e){return wd(rR(e),e.facetOrder??[])}function eR(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(tR).filter(r=>r.currentValues.length>0):void 0}function tR(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function rR(e){return nR(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function nR(e){return[...oR(e.facetSet??{}),...qh(e.numericFacetSet??{}),...qh(e.dateFacetSet??{}),...br(e.categoryFacetSet??{})]}function oR(e){return br(e).map(t=>{let r=Cd[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function qh(e){return br(e).map(t=>{let r=t.currentValues,n=r.some(({state:i})=>i!=="idle"),o=r.some(i=>i.previousState);return t.generateAutomaticRanges&&!n&&!o?{...t,currentValues:[]}:t})}function Ed(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=jh(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();f();p();m();d();f();p();var wi=(e,t)=>{let r=e;return ce(r[t])?ce(e.raw[t])?null:e.raw[t]:r[t]},iR=e=>t=>e.every(r=>!ce(wi(t,r))),sR=e=>t=>e.every(r=>ce(wi(t,r))),aR=(e,t)=>r=>{let n=Uh(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},cR=(e,t)=>r=>{let n=Uh(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},Uh=(e,t)=>{let r=wi(t,e);return ff(r)?r:[r]},Vh={getResultProperty:wi,fieldsMustBeDefined:iR,fieldsMustNotBeDefined:sR,fieldMustMatch:aR,fieldMustNotMatch:cR};var Id=je(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var Rd=e=>e.searchHub;m();d();f();p();var wa=je(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),T$=je(e=>e,e=>{let t=wa(e);return t&&e?e[t].expression:""});m();d();f();p();var Gh=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var Bh=e=>e.excerptLength?.length;m();d();f();p();var $h=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var Qh=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};m();d();f();p();var Hh=e=>e.sortCriteria;var zh=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Nn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function zh(_x67){return _ref28.apply(this,arguments)}}(),Wh=(e,t)=>{let r=Yr(e)?.q,{aq:n,cq:o,dq:i,lq:s}=Xh(e),a=ld(e),u=tn(e.configuration.analytics,t,{actionCause:Id(e)}),c=Rd(e),g=dd(e),v=Jl(e)??[],E=Yh(e),h=wa(e.tabSet)||"default",y=Xl(e),S=rh(e),x=t.referrer||"",I=$h(e),T=Hh(e),R=uR(e),k=Bh(e),_=Qh(e),F=Gh(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(s&&{lq:s}),...(e.query&&{enableQuerySyntax:Tg(e)}),...(a?.contextValues&&{context:a.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(c?.length&&{searchHub:c}),...(g?.length&&{pipeline:g}),...(E.length&&{facets:E}),...(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:xd(e),firstResult:e.pagination.firstResult}),tab:h,locale:y,timezone:S,...(e.debug!==void 0&&{debug:e.debug}),referrer:x,...R,...(_??{}),...(k&&{excerptLength:k}),...(F&&{dictionaryFieldContext:F}),sortCriteria:T,...(I&&{facetOptions:I}),...u,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Kh=(e,t)=>{let r=Yr(e)?.q,n=Yh(e),o=tn(e.configuration.analytics,t,{actionCause:Id(e)}),i=Xl(e),s=wa(e.tabSet)||"default",a=t.referrer,{aq:u,cq:c}=Xh(e),g=Rd(e),v=dd(e),E=ld(e),h=Jl(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(v?.length&&{pipeline:v}),...(E?.contextValues&&{context:E.contextValues}),...(u&&{aq:u}),...(c&&{cq:c}),tab:s,referrer:a,...o,locale:i}},Yh=e=>Aa(e)?.map(t=>bd(t,Ad())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),uR=e=>({actionsHistory:e.configuration.analytics.enabled?$t.getInstance().getHistory():[]}),Xh=e=>{let t=Eh(e),r=Ed(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var Ca=["searching","thinking","answering"];function xa(e){return e.toLowerCase()}var Ea=["search","generic"];m();d();f();p();var Zh=["text/plain","text/markdown"];var oo=new re({required:!0}),Jh=new re,io=new Le({required:!0}),Td={id:oo,title:oo,uri:oo,permanentid:oo,clickUri:Jh},Ia=new re({required:!0,constrainTo:Zh}),ey=new re({required:!0,constrainTo:Ca}),ty=e=>({...e,name:xa(e.name)}),W3=G("generatedAnswer/setIsVisible",e=>W(e,io)),Ra=G("generatedAnswer/setAnswerId",e=>W(e,ee)),K3=G("generatedAnswer/setAnswerGenerationMode",e=>W(e,new re({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),Y3=G("generatedAnswer/setIsEnabled",e=>W(e,io)),xi=G("generatedAnswer/updateMessage",e=>W(e,{textDelta:oo})),Ei=G("generatedAnswer/updateCitations",e=>W(e,{citations:new Pt({required:!0,each:new xe({values:Td})})})),Ii=G("generatedAnswer/updateError",e=>W(e,{message:Jh,code:new De({min:0})})),Ta=G("generatedAnswer/resetAnswer"),X3=G("generatedAnswer/like"),Z3=G("generatedAnswer/dislike"),J3=G("generatedAnswer/feedbackModal/open"),eQ=G("generatedAnswer/expand"),tQ=G("generatedAnswer/collapse"),rQ=G("generatedAnswer/setId",e=>W(e,{id:new re({required:!0})})),nQ=G("generatedAnswer/feedbackModal/close"),oQ=G("generatedAnswer/sendFeedback"),Cr=G("generatedAnswer/setIsLoading",e=>W(e,io)),Ci=G("generatedAnswer/setIsStreaming",e=>W(e,io)),Ri=G("generatedAnswer/setAnswerContentFormat",e=>W(e,Ia)),iQ=G("generatedAnswer/updateResponseFormat",e=>W(e,{contentFormat:new Pt({each:Ia,default:["text/plain"]})})),sQ=G("knowledge/updateAnswerConfigurationId",e=>W(e,oo)),aQ=G("generatedAnswer/registerFieldsToIncludeInCitations",e=>W(e,Cm)),_d=G("generatedAnswer/setIsAnswerGenerated",e=>W(e,io)),Ti=G("generatedAnswer/setCannotAnswer",e=>W(e,io)),lR=G("generatedAnswer/setAnswerApiQueryParams",e=>W(e,new xe({}))),ry=G("generatedAnswer/startStep",e=>W(ty(e),{name:ey,startedAt:new De({min:0,required:!0})})),ny=G("generatedAnswer/finishStep",e=>W(ty(e),{name:ey,finishedAt:new De({min:0,required:!0})})),oy=G("generatedAnswer/startToolCall",e=>W(e,{toolCallName:ee,startedAt:new De({min:0,required:!0}),toolCallId:ee})),iy=G("generatedAnswer/finishToolCall",e=>W(e,{finishedAt:new De({min:0,required:!0}),toolCallId:ee})),_a=G("generatedAnswer/toolCallArgs",e=>W(e,{toolCallId:ee,args:new xe({options:{required:!0}}),type:new re({required:!0,constrainTo:Ea})})),cQ=Ce("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:i}=t,{search:s}=i(),{queryExecuted:a}=s,{setAbortControllerRef:u}=e,c=yield zh(r),g=(h,y)=>{switch(h){case"genqa.headerMessageType":{let S=JSON.parse(y);n(Ri(S.contentFormat));break}case"genqa.messageType":n(xi(JSON.parse(y)));break;case"genqa.citationsType":n(Ei(JSON.parse(y)));break;case"genqa.endOfStreamType":{let S=JSON.parse(y).answerGenerated,{answerId:x,answer:I}=i().generatedAnswer,R=a.length!==0&&!S,k=!I?.trim();n(Ti(R)),n(Ci(!1)),n(_d(S)),n(to(S,x,S?k:void 0)),n(ro());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${h}"`)}};n(Cr(!0));let v=h=>h.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,E=o.streamingClient?.streamGeneratedAnswer(c,{write:h=>{v(c)&&(n(Cr(!1)),h.payload&&h.payloadType&&g(h.payloadType,h.payload))},abort:h=>{v(c)&&n(Ii(h))},close:()=>{v(c)&&n(Ci(!1))},resetAnswer:()=>{v(c)&&n(Ta())}});E?u(E):n(Cr(!1))});return function(_x68,_x69){return _ref29.apply(this,arguments)}}()),uQ=Ce("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(Ta());let i=t();if(i.generatedAnswer.answerConfigurationId){let s=Wh(i,n);r(lR(s)),yield r(sy(s))}else o.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.")});return function(_x70,_x71){return _ref30.apply(this,arguments)}}());m();d();f();p();m();d();f();p();function cy(_x72,_x73){return _cy.apply(this,arguments)}function _cy(){_cy=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _cy.apply(this,arguments)}function uy(e){let t,r,n,o=!1;return function(s){t===void 0?(t=s,r=0,n=-1):t=pR(t,s);let a=t.length,u=0;for(;r<a;){o&&(t[r]===10&&(u=++r),o=!1);let c=-1;for(;r<a&&c===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-u);break;case 13:o=!0,c=r;break;case 10:c=r;break}if(c===-1)break;e(t.subarray(u,c),n),u=r,n=-1}u===a?t=void 0:u!==0&&(t=t.subarray(u),r-=u)}}function ly(e,t,r){let n=ay(),o=new TextDecoder;return function(s,a){if(s.length===0)r?.(n),n=ay();else if(a>0){let u=o.decode(s.subarray(0,a)),c=a+(s[a+1]===32?2:1),g=o.decode(s.subarray(c));switch(u){case"data":n.data=n.data?`${n.data}
32
+ ${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":dR(g,n,t);break}}}}function dR(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function pR(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function ay(){return{data:"",event:"",id:"",retry:void 0}}var kd="text/event-stream",fR=1e3,dy="last-event-id";function py(){return typeof window<"u"}function fy(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:s,openWhenHidden:a,fetch:u,...c}){return new Promise((g,v)=>{let E={...r};E.accept||(E.accept=kd);let h;function y(){h?.abort(),document.hidden||k()}!a&&py()&&document.addEventListener("visibilitychange",y);let S=fR,x;function I(){py()&&document.removeEventListener("visibilitychange",y),clearTimeout(x),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let T=u??w,R=n??mR;function k(){return _k2.apply(this,arguments)}function _k2(){_k2=_asyncToGenerator(function*(){h=l.AbortController?new l.AbortController:null;try{let _=yield T(e,{...c,headers:E,signal:h?.signal});yield R(_),yield cy(_.body,uy(ly(F=>{F?E[dy]=F:delete E[dy]},F=>{S=F},o))),i?.(),I(),g()}catch(_){if(!h?.signal?.aborted)try{let F=s?.(_)??S;clearTimeout(x),x=setTimeout(k,F)}catch(F){I(),v(F)}}});return _k2.apply(this,arguments)}k()})}function mR(e){let t=e.headers.get("content-type");if(!t?.startsWith(kd))throw new Error(`Expected content-type to be ${kd}, Actual: ${t}`)}m();d();f();p();var gR=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:i,organizationId:s}=n.configuration,a=n.generatedAnswer.answerConfigurationId,u={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let c=Nn(n.configuration.search?.apiBaseUrl,s,i);return mg({baseUrl:`${c}/rest/organizations/${s}/answer/v1/configs/${a}`,fetchFn:function(){var _ref32=_asyncToGenerator(function*(g){if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let v=g.url,E={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{E[h]=g[h]}),E.duplex="half",E.body=yield g.text(),w(v,E)});return function fetchFn(_x77){return _ref32.apply(this,arguments)}}()})(u,{...t,signal:null},r)}catch(c){return{error:c}}});return function gR(_x74,_x75,_x76){return _ref31.apply(this,arguments)}}(),my=Rg({reducerPath:"answer",baseQuery:hg(gR,{maxRetries:3}),endpoints:()=>({})});var hR=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},yR=(e,t)=>{let{textDelta:r}=t;if(typeof r!="string")return;let n=e.answer;!n?.trim()&&!r.trim()||(e.answer=n?.trim()?n.concat(r):r)},vR=(e,t)=>{e.citations=t.citations},SR=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},AR=(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})`)},bR=(e,t,r)=>{let n=JSON.parse(e.data);n.finishReason==="ERROR"&&n.errorMessage&&AR(t,n);let o=n.payload.length?JSON.parse(n.payload):{};switch(n.payloadType){case"genqa.headerMessageType":o.contentFormat&&(hR(t,o),r(Ri(o.contentFormat)));break;case"genqa.messageType":typeof o.textDelta=="string"&&(yR(t,o),r(xi({textDelta:o.textDelta})));break;case"genqa.citationsType":o.citations&&(vR(t,o),r(Ei({citations:o.citations})));break;case"genqa.endOfStreamType":{SR(t,o);let i=t.answerId,s=o.answerGenerated??!1,a=s?!t.answer?.trim():void 0;r(to(s,i,a)),r(ro());break}}},wR=(e,t,r,n)=>{if(!e||!t||!r)throw new Error("Missing required parameters for answer endpoint");let o=`/rest/organizations/${t}`,i=n?`insight/v1/configs/${n}/answer`:"answer/v1/configs";return`${e}${o}/${i}/${r}/generate`},Od=my.injectEndpoints({overrideExisting:!0,endpoints:e=>({getAnswer:e.query({queryFn:()=>({data:{contentFormat:void 0,answer:void 0,citations:void 0,error:void 0,generated:!1,isStreaming:!0,isLoading:!0}}),serializeQueryArgs:({endpointName:t,queryArgs:r})=>{let{analytics:n,...o}=r;return`${t}(${JSON.stringify(o)})`},onCacheEntryAdded(_x78,_x79){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:i}){yield n;let{configuration:s,generatedAnswer:a,insightConfiguration:u}=r(),{organizationId:c,environment:g,accessToken:v}=s,E=Nn(s.search.apiBaseUrl,c,g),h=wR(E,c,a.answerConfigurationId,u?.insightId);yield fy(h,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${v}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:w,onopen:function(){var _ref33=_asyncToGenerator(function*(y){let S=y.headers.get("x-answer-id");S&&o(x=>{x.answerId=S,i(Ra(S))})});return function onopen(_x80){return _ref33.apply(this,arguments)}}(),onmessage:y=>{o(S=>{bR(y,S,i)})},onerror:y=>{throw y},onclose:()=>{o(y=>{i(Ti(!y.generated))})}})}).apply(this,arguments)}})})}),sy=e=>Od.endpoints.getAnswer.initiate(e);m();d();f();p();var gy=Ge(Gn,e=>e);m();d();f();p();function CR(e){let t=e.payload?.analyticsAction;return hy(e)&&!ce(t)}function hy(e){return"type"in e}var yy=e=>t=>r=>{let n;CR(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return hy(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};m();d();f();p();m();d();f();p();m();d();f();p();var sH=G("tab/register",e=>{let t=new xe({values:{id:ee,expression:Nt}});return W(e,t)}),vy=G("tab/updateActiveTab",e=>W(e,ee));m();d();f();p();var ka=kt(va(),1),by=kt(Sy(),1),wy=kt(Ay(),1);ka.default.extend(wy.default);ka.default.extend(by.default);var Cy=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:ka.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"});m();d();f();p();var xR=/(^|; )Coveo-Pendragon=([^;]*)/,ER=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function xy(){return typeof window>"u"?!1:xR.exec(document.cookie)?.pop()||null}function Ey(){return typeof window>"u"?!1:ER.test(document.cookie)}var Iy=Ge(Cy(),e=>e.addCase(Bn,(t,r)=>{IR(t,r.payload)}).addCase(Ms,(t,r)=>{RR(t,r.payload)}).addCase(Ls,(t,r)=>{TR(t,r.payload)}).addCase(js,t=>{t.analytics.enabled=!1}).addCase(qs,t=>{t.analytics.enabled=!0}).addCase(Fm,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(Dm,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(vy,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Tm,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Ns,(t,r)=>{ce(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Mm,(t,{payload:r})=>{_R(t,r)}));function IR(e,t){ce(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ce(t.organizationId)||(e.organizationId=t.organizationId)}function RR(e,t){ce(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),ce(t.locale)||(e.search.locale=t.locale),ce(t.timezone)||(e.search.timezone=t.timezone),ce(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function TR(e,t){ce(t.enabled)||(e.analytics.enabled=t.enabled),ce(t.originContext)||(e.analytics.originContext=t.originContext),ce(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),ce(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),ce(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),ce(t.trackingId)||(e.analytics.trackingId=t.trackingId),ce(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),ce(t.source)||(e.analytics.source=t.source);try{let r=xy();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}ce(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),ce(t.anonymous)||(e.analytics.anonymous=t.anonymous),ce(t.deviceId)||(e.analytics.deviceId=t.deviceId),ce(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),ce(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function _R(e,t){e.knowledge.agentId=t;try{Ey()&&(e.knowledge.debugAgentSession=!0)}catch{}}var yt=Iy;m();d();f();p();function kR(e){return e.instantlyCallable}var Ry=()=>e=>t=>e(kR(t)?t():t);m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Je=[];for(let e=0;e<256;++e)Je.push((e+256).toString(16).slice(1));function Ty(e,t=0){return(Je[e[t+0]]+Je[e[t+1]]+Je[e[t+2]]+Je[e[t+3]]+"-"+Je[e[t+4]]+Je[e[t+5]]+"-"+Je[e[t+6]]+Je[e[t+7]]+"-"+Je[e[t+8]]+Je[e[t+9]]+"-"+Je[e[t+10]]+Je[e[t+11]]+Je[e[t+12]]+Je[e[t+13]]+Je[e[t+14]]+Je[e[t+15]]).toLowerCase()}m();d();f();p();var Md,OR=new Uint8Array(16);function Ld(){if(!Md){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Md=crypto.getRandomValues.bind(crypto)}return Md(OR)}m();d();f();p();m();d();f();p();var PR=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),jd={randomUUID:PR};function NR(e,t,r){if(jd.randomUUID&&!t&&!e)return jd.randomUUID();e=e||{};let n=e.random??e.rng?.()??Ld();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 Ty(n)}var xr=NR;m();d();f();p();m();d();f();p();var A={};zi(A,{BRAND:()=>iT,DIRTY:()=>rn,EMPTY_PATH:()=>LR,INVALID:()=>ue,NEVER:()=>BT,OK:()=>it,ParseStatus:()=>et,Schema:()=>ye,ZodAny:()=>Rr,ZodArray:()=>pr,ZodBigInt:()=>on,ZodBoolean:()=>sn,ZodBranded:()=>ki,ZodCatch:()=>yn,ZodDate:()=>an,ZodDefault:()=>hn,ZodDiscriminatedUnion:()=>Na,ZodEffects:()=>Et,ZodEnum:()=>mn,ZodError:()=>ut,ZodFirstPartyTypeKind:()=>le,ZodFunction:()=>Da,ZodIntersection:()=>dn,ZodIssueCode:()=>z,ZodLazy:()=>pn,ZodLiteral:()=>fn,ZodMap:()=>po,ZodNaN:()=>mo,ZodNativeEnum:()=>gn,ZodNever:()=>Dt,ZodNull:()=>un,ZodNullable:()=>zt,ZodNumber:()=>nn,ZodObject:()=>lt,ZodOptional:()=>Ct,ZodParsedType:()=>te,ZodPipeline:()=>Oi,ZodPromise:()=>Tr,ZodReadonly:()=>vn,ZodRecord:()=>Fa,ZodSchema:()=>ye,ZodSet:()=>fo,ZodString:()=>Ir,ZodSymbol:()=>uo,ZodTransformer:()=>Et,ZodTuple:()=>Ht,ZodType:()=>ye,ZodUndefined:()=>cn,ZodUnion:()=>ln,ZodUnknown:()=>dr,ZodVoid:()=>lo,addIssueToContext:()=>Z,any:()=>mT,array:()=>vT,bigint:()=>uT,boolean:()=>qy,coerce:()=>GT,custom:()=>My,date:()=>lT,datetimeRegex:()=>Fy,defaultErrorMap:()=>ur,discriminatedUnion:()=>wT,effect:()=>FT,enum:()=>OT,function:()=>TT,getErrorMap:()=>so,getParsedType:()=>Qt,instanceof:()=>aT,intersection:()=>CT,isAborted:()=>Oa,isAsync:()=>ao,isDirty:()=>Pa,isValid:()=>Er,late:()=>sT,lazy:()=>_T,literal:()=>kT,makeIssue:()=>_i,map:()=>IT,nan:()=>cT,nativeEnum:()=>PT,never:()=>hT,null:()=>fT,nullable:()=>MT,number:()=>jy,object:()=>ST,objectUtil:()=>qd,oboolean:()=>VT,onumber:()=>UT,optional:()=>DT,ostring:()=>qT,pipeline:()=>jT,preprocess:()=>LT,promise:()=>NT,quotelessJson:()=>FR,record:()=>ET,set:()=>RT,setErrorMap:()=>MR,strictObject:()=>AT,string:()=>Ly,symbol:()=>dT,transformer:()=>FT,tuple:()=>xT,undefined:()=>pT,union:()=>bT,unknown:()=>gT,util:()=>Ae,void:()=>yT});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Ae;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ae||(Ae={}));var qd;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(qd||(qd={}));var te=Ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qt=e=>{switch(typeof e){case"undefined":return te.undefined;case"string":return te.string;case"number":return Number.isNaN(e)?te.nan:te.number;case"boolean":return te.boolean;case"function":return te.function;case"bigint":return te.bigint;case"symbol":return te.symbol;case"object":return Array.isArray(e)?te.array:e===null?te.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?te.promise:typeof Map<"u"&&e instanceof Map?te.map:typeof Set<"u"&&e instanceof Set?te.set:typeof Date<"u"&&e instanceof Date?te.date:te.object;default:return te.unknown}};var z=Ae.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"]),FR=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ut=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(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,u=0;for(;u<s.path.length;){let c=s.path[u];u===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(s))):a[c]=a[c]||{_errors:[]},a=a[c],u++}}};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,Ae.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 i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ut.create=e=>new ut(e);var DR=(e,t)=>{let r;switch(e.code){case z.invalid_type:e.received===te.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ae.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ae.joinValues(e.keys,", ")}`;break;case z.invalid_union:r="Invalid input";break;case z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ae.joinValues(e.options)}`;break;case z.invalid_enum_value:r=`Invalid enum value. Expected ${Ae.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}"`:Ae.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,Ae.assertNever(e)}return{message:r}},ur=DR;var _y=ur;function MR(e){_y=e}function so(){return _y}m();d();f();p();var _i=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...(o.path||[])],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",u=n.filter(c=>!!c).slice().reverse();for(let c of u)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},LR=[];function Z(e,t){let r=so(),n=_i({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===ur?void 0:ur].filter(o=>!!o)});e.common.issues.push(n)}var et=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 ue;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let o of r){let i=yield o.key,s=yield o.value;n.push({key:i,value:s})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return ue;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},ue=Object.freeze({status:"aborted"}),rn=e=>({status:"dirty",value:e}),it=e=>({status:"valid",value:e}),Oa=e=>e.status==="aborted",Pa=e=>e.status==="dirty",Er=e=>e.status==="valid",ao=e=>typeof Promise<"u"&&e instanceof Promise;m();d();f();p();m();d();f();p();var ne;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ne||(ne={}));var xt=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}},ky=(e,t)=>{if(Er(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 ut(e.common.issues);return this._error=r,this._error}}};function me(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:(s,a)=>{let{message:u}=e;return s.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:u??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:u??r??a.defaultError}},description:o}}var ye=class{get description(){return this._def.description}_getType(t){return Qt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Qt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new et,ctx:{common:t.parent.common,data:t.data,parsedType:Qt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(ao(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:Qt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return ky(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Qt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Er(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=>Er(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this7=this;return _asyncToGenerator(function*(){let n=yield _this7.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this8=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this8._def.errorMap,parent:null,data:t,parsedType:Qt(t)},o=_this8._parse({data:t,path:n.path,parent:n}),i=yield ao(o)?o:Promise.resolve(o);return ky(n,i)})()}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=t(o),a=()=>i.addIssue({code:z.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(a(),!1)):s?!0:(a(),!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 Et({schema:this,typeName:le.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 Ct.create(this,this._def)}nullable(){return zt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return pr.create(this)}promise(){return Tr.create(this,this._def)}or(t){return ln.create([this,t],this._def)}and(t){return dn.create(this,t,this._def)}transform(t){return new Et({...me(this._def),schema:this,typeName:le.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new hn({...me(this._def),innerType:this,defaultValue:r,typeName:le.ZodDefault})}brand(){return new ki({typeName:le.ZodBranded,type:this,...me(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new yn({...me(this._def),innerType:this,catchValue:r,typeName:le.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Oi.create(this,t)}readonly(){return vn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},jR=/^c[^\s-]{8,}$/i,qR=/^[0-9a-z]+$/,UR=/^[0-9A-HJKMNP-TV-Z]{26}$/i,VR=/^[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,GR=/^[a-z0-9_-]{21}$/i,BR=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,$R=/^[-+]?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)?)??$/,QR=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,HR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ud,zR=/^(?:(?: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])$/,WR=/^(?:(?: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])$/,KR=/^(([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]))$/,YR=/^(([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])$/,XR=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ZR=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Py="((\\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])))",JR=new RegExp(`^${Py}$`);function Ny(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 eT(e){return new RegExp(`^${Ny(e)}$`)}function Fy(e){let t=`${Py}T${Ny(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 tT(e,t){return!!((t==="v4"||!t)&&zR.test(e)||(t==="v6"||!t)&&KR.test(e))}function rT(e,t){if(!BR.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 nT(e,t){return!!((t==="v4"||!t)&&WR.test(e)||(t==="v6"||!t)&&YR.test(e))}var Ir=class e extends ye{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==te.string){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_type,expected:te.string,received:i.parsedType}),ue}let n=new et,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?Z(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&Z(o,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")QR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"email",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Ud||(Ud=new RegExp(HR,"u")),Ud.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"emoji",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")VR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"uuid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")GR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"nanoid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")jR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cuid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")qR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cuid2",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")UR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"ulid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),Z(o,{validation:"url",code:z.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"regex",code:z.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Fy(i).test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?JR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?eT(i).test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?$R.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"duration",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?tT(t.data,i.version)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"ip",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?rT(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"jwt",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?nT(t.data,i.version)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cidr",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?XR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"base64",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?ZR.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"base64url",code:z.invalid_string,message:i.message}),n.dirty()):Ae.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:z.invalid_string,...ne.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ne.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ne.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ne.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ne.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ne.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ne.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ne.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ne.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ne.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ne.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ne.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ne.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ne.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,...ne.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,...ne.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ne.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ne.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ne.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ne.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ne.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ne.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ne.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ne.errToObj(r)})}nonempty(t){return this.min(1,ne.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}};Ir.create=e=>new Ir({checks:[],typeName:le.ZodString,coerce:e?.coerce??!1,...me(e)});function oT(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var nn=class e extends ye{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)!==te.number){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_type,expected:te.number,received:i.parsedType}),ue}let n,o=new et;for(let i of this._def.checks)i.kind==="int"?Ae.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),Z(n,{code:z.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),Z(n,{code:z.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),Z(n,{code:z.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?oT(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),Z(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),Z(n,{code:z.not_finite,message:i.message}),o.dirty()):Ae.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ne.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ne.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ne.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ne.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ne.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ne.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ne.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ne.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ne.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ne.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ne.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ne.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ne.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ne.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"&&Ae.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)}};nn.create=e=>new nn({checks:[],typeName:le.ZodNumber,coerce:e?.coerce||!1,...me(e)});var on=class e extends ye{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)!==te.bigint)return this._getInvalidInput(t);let n,o=new et;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),Z(n,{code:z.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),Z(n,{code:z.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),Z(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ae.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Z(r,{code:z.invalid_type,expected:te.bigint,received:r.parsedType}),ue}gte(t,r){return this.setLimit("min",t,!0,ne.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ne.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ne.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ne.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ne.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:ne.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ne.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ne.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ne.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ne.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}};on.create=e=>new on({checks:[],typeName:le.ZodBigInt,coerce:e?.coerce??!1,...me(e)});var sn=class extends ye{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==te.boolean){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.boolean,received:n.parsedType}),ue}return it(t.data)}};sn.create=e=>new sn({typeName:le.ZodBoolean,coerce:e?.coerce||!1,...me(e)});var an=class e extends ye{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==te.date){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_type,expected:te.date,received:i.parsedType}),ue}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_date}),ue}let n=new et,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:z.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:z.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Ae.assertNever(i);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:ne.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ne.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}};an.create=e=>new an({checks:[],coerce:e?.coerce||!1,typeName:le.ZodDate,...me(e)});var uo=class extends ye{_parse(t){if(this._getType(t)!==te.symbol){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.symbol,received:n.parsedType}),ue}return it(t.data)}};uo.create=e=>new uo({typeName:le.ZodSymbol,...me(e)});var cn=class extends ye{_parse(t){if(this._getType(t)!==te.undefined){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.undefined,received:n.parsedType}),ue}return it(t.data)}};cn.create=e=>new cn({typeName:le.ZodUndefined,...me(e)});var un=class extends ye{_parse(t){if(this._getType(t)!==te.null){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.null,received:n.parsedType}),ue}return it(t.data)}};un.create=e=>new un({typeName:le.ZodNull,...me(e)});var Rr=class extends ye{constructor(){super(...arguments),this._any=!0}_parse(t){return it(t.data)}};Rr.create=e=>new Rr({typeName:le.ZodAny,...me(e)});var dr=class extends ye{constructor(){super(...arguments),this._unknown=!0}_parse(t){return it(t.data)}};dr.create=e=>new dr({typeName:le.ZodUnknown,...me(e)});var Dt=class extends ye{_parse(t){let r=this._getOrReturnCtx(t);return Z(r,{code:z.invalid_type,expected:te.never,received:r.parsedType}),ue}};Dt.create=e=>new Dt({typeName:le.ZodNever,...me(e)});var lo=class extends ye{_parse(t){if(this._getType(t)!==te.undefined){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.void,received:n.parsedType}),ue}return it(t.data)}};lo.create=e=>new lo({typeName:le.ZodVoid,...me(e)});var pr=class e extends ye{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==te.array)return Z(r,{code:z.invalid_type,expected:te.array,received:r.parsedType}),ue;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&(Z(r,{code:s?z.too_big:z.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?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&&(Z(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&&(Z(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((s,a)=>o.type._parseAsync(new xt(r,s,r.path,a)))).then(s=>et.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new xt(r,s,r.path,a)));return et.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:ne.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ne.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ne.toString(r)}})}nonempty(t){return this.min(1,t)}};pr.create=(e,t)=>new pr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:le.ZodArray,...me(t)});function co(e){if(e instanceof lt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Ct.create(co(n))}return new lt({...e._def,shape:()=>t})}else return e instanceof pr?new pr({...e._def,type:co(e.element)}):e instanceof Ct?Ct.create(co(e.unwrap())):e instanceof zt?zt.create(co(e.unwrap())):e instanceof Ht?Ht.create(e.items.map(t=>co(t))):e}var lt=class e extends ye{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=Ae.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==te.object){let c=this._getOrReturnCtx(t);return Z(c,{code:z.invalid_type,expected:te.object,received:c.parsedType}),ue}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Dt&&this._def.unknownKeys==="strip"))for(let c in o.data)s.includes(c)||a.push(c);let u=[];for(let c of s){let g=i[c],v=o.data[c];u.push({key:{status:"valid",value:c},value:g._parse(new xt(o,v,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Dt){let c=this._def.unknownKeys;if(c==="passthrough")for(let g of a)u.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(c==="strict")a.length>0&&(Z(o,{code:z.unrecognized_keys,keys:a}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let g of a){let v=o.data[g];u.push({key:{status:"valid",value:g},value:c._parse(new xt(o,v,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let c=[];for(let g of u){let v=yield g.key,E=yield g.value;c.push({key:v,value:E,alwaysSet:g.alwaysSet})}return c})).then(c=>et.mergeObjectSync(n,c)):et.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(t){return ne.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:ne.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:le.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 Ae.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 Ae.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return co(this)}partial(t){let r={};for(let n of Ae.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 Ae.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Ct;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Dy(Ae.objectKeys(this.shape))}};lt.create=(e,t)=>new lt({shape:()=>e,unknownKeys:"strip",catchall:Dt.create(),typeName:le.ZodObject,...me(t)});lt.strictCreate=(e,t)=>new lt({shape:()=>e,unknownKeys:"strict",catchall:Dt.create(),typeName:le.ZodObject,...me(t)});lt.lazycreate=(e,t)=>new lt({shape:e,unknownKeys:"strip",catchall:Dt.create(),typeName:le.ZodObject,...me(t)});var ln=class extends ye{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new ut(a.ctx.common.issues));return Z(r,{code:z.invalid_union,unionErrors:s}),ue}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(i){let s={...r,common:{...r.common,issues:[]},parent:null};return{result:yield i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}});return function(_x81){return _ref35.apply(this,arguments)}}())).then(o);{let i,s=[];for(let u of n){let c={...r,common:{...r.common,issues:[]},parent:null},g=u._parseSync({data:r.data,path:r.path,parent:c});if(g.status==="valid")return g;g.status==="dirty"&&!i&&(i={result:g,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(u=>new ut(u));return Z(r,{code:z.invalid_union,unionErrors:a}),ue}}get options(){return this._def.options}};ln.create=(e,t)=>new ln({options:e,typeName:le.ZodUnion,...me(t)});var lr=e=>e instanceof pn?lr(e.schema):e instanceof Et?lr(e.innerType()):e instanceof fn?[e.value]:e instanceof mn?e.options:e instanceof gn?Ae.objectValues(e.enum):e instanceof hn?lr(e._def.innerType):e instanceof cn?[void 0]:e instanceof un?[null]:e instanceof Ct?[void 0,...lr(e.unwrap())]:e instanceof zt?[null,...lr(e.unwrap())]:e instanceof ki||e instanceof vn?lr(e.unwrap()):e instanceof yn?lr(e._def.innerType):[],Na=class e extends ye{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.object)return Z(r,{code:z.invalid_type,expected:te.object,received:r.parsedType}),ue;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(Z(r,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ue)}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 i of r){let s=lr(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new e({typeName:le.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...me(n)})}};function Vd(e,t){let r=Qt(e),n=Qt(t);if(e===t)return{valid:!0,data:e};if(r===te.object&&n===te.object){let o=Ae.objectKeys(t),i=Ae.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let u=Vd(e[a],t[a]);if(!u.valid)return{valid:!1};s[a]=u.data}return{valid:!0,data:s}}else if(r===te.array&&n===te.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],u=Vd(s,a);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===te.date&&n===te.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var dn=class extends ye{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,s)=>{if(Oa(i)||Oa(s))return ue;let a=Vd(i.value,s.value);return a.valid?((Pa(i)||Pa(s))&&r.dirty(),{status:r.value,value:a.data}):(Z(n,{code:z.invalid_intersection_types}),ue)};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(([i,s])=>o(i,s)):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}))}};dn.create=(e,t,r)=>new dn({left:e,right:t,typeName:le.ZodIntersection,...me(r)});var Ht=class e extends ye{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.array)return Z(n,{code:z.invalid_type,expected:te.array,received:n.parsedType}),ue;if(n.data.length<this._def.items.length)return Z(n,{code:z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ue;!this._def.rest&&n.data.length>this._def.items.length&&(Z(n,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let u=this._def.items[a]||this._def.rest;return u?u._parse(new xt(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>et.mergeArray(r,s)):et.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ht.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ht({items:e,typeName:le.ZodTuple,rest:null,...me(t)})};var Fa=class e extends ye{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!==te.object)return Z(n,{code:z.invalid_type,expected:te.object,received:n.parsedType}),ue;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new xt(n,a,n.path,a)),value:s._parse(new xt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?et.mergeObjectAsync(r,o):et.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof ye?new e({keyType:t,valueType:r,typeName:le.ZodRecord,...me(n)}):new e({keyType:Ir.create(),valueType:t,typeName:le.ZodRecord,...me(r)})}},po=class extends ye{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!==te.map)return Z(n,{code:z.invalid_type,expected:te.map,received:n.parsedType}),ue;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,u],c)=>({key:o._parse(new xt(n,a,n.path,[c,"key"])),value:i._parse(new xt(n,u,n.path,[c,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let u of s){let c=yield u.key,g=yield u.value;if(c.status==="aborted"||g.status==="aborted")return ue;(c.status==="dirty"||g.status==="dirty")&&r.dirty(),a.set(c.value,g.value)}return{status:r.value,value:a}}))}else{let a=new Map;for(let u of s){let c=u.key,g=u.value;if(c.status==="aborted"||g.status==="aborted")return ue;(c.status==="dirty"||g.status==="dirty")&&r.dirty(),a.set(c.value,g.value)}return{status:r.value,value:a}}}};po.create=(e,t,r)=>new po({valueType:t,keyType:e,typeName:le.ZodMap,...me(r)});var fo=class e extends ye{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.set)return Z(n,{code:z.invalid_type,expected:te.set,received:n.parsedType}),ue;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(Z(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&&(Z(n,{code:z.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(u){let c=new Set;for(let g of u){if(g.status==="aborted")return ue;g.status==="dirty"&&r.dirty(),c.add(g.value)}return{status:r.value,value:c}}let a=[...n.data.values()].map((u,c)=>i._parse(new xt(n,u,n.path,c)));return n.common.async?Promise.all(a).then(u=>s(u)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:ne.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ne.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};fo.create=(e,t)=>new fo({valueType:e,minSize:null,maxSize:null,typeName:le.ZodSet,...me(t)});var Da=class e extends ye{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.function)return Z(r,{code:z.invalid_type,expected:te.function,received:r.parsedType}),ue;function n(a,u){return _i({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,so(),ur].filter(c=>!!c),issueData:{code:z.invalid_arguments,argumentsError:u}})}function o(a,u){return _i({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,so(),ur].filter(c=>!!c),issueData:{code:z.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Tr){let a=this;return it(/*#__PURE__*/_asyncToGenerator(function*(...u){let c=new ut([]),g=yield a._def.args.parseAsync(u,i).catch(h=>{throw c.addIssue(n(u,h)),c}),v=yield Reflect.apply(s,this,g);return yield a._def.returns._def.type.parseAsync(v,i).catch(h=>{throw c.addIssue(o(v,h)),c})}))}else{let a=this;return it(function(...u){let c=a._def.args.safeParse(u,i);if(!c.success)throw new ut([n(u,c.error)]);let g=Reflect.apply(s,this,c.data),v=a._def.returns.safeParse(g,i);if(!v.success)throw new ut([o(g,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ht.create(t).rest(dr.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||Ht.create([]).rest(dr.create()),returns:r||dr.create(),typeName:le.ZodFunction,...me(n)})}},pn=class extends ye{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})}};pn.create=(e,t)=>new pn({getter:e,typeName:le.ZodLazy,...me(t)});var fn=class extends ye{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Z(r,{received:r.data,code:z.invalid_literal,expected:this._def.value}),ue}return{status:"valid",value:t.data}}get value(){return this._def.value}};fn.create=(e,t)=>new fn({value:e,typeName:le.ZodLiteral,...me(t)});function Dy(e,t){return new mn({values:e,typeName:le.ZodEnum,...me(t)})}var mn=class e extends ye{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return Z(r,{expected:Ae.joinValues(n),received:r.parsedType,code:z.invalid_type}),ue}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 Z(r,{received:r.data,code:z.invalid_enum_value,options:n}),ue}return it(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})}};mn.create=Dy;var gn=class extends ye{_parse(t){let r=Ae.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==te.string&&n.parsedType!==te.number){let o=Ae.objectValues(r);return Z(n,{expected:Ae.joinValues(o),received:n.parsedType,code:z.invalid_type}),ue}if(this._cache||(this._cache=new Set(Ae.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Ae.objectValues(r);return Z(n,{received:n.data,code:z.invalid_enum_value,options:o}),ue}return it(t.data)}get enum(){return this._def.values}};gn.create=(e,t)=>new gn({values:e,typeName:le.ZodNativeEnum,...me(t)});var Tr=class extends ye{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.promise&&r.common.async===!1)return Z(r,{code:z.invalid_type,expected:te.promise,received:r.parsedType}),ue;let n=r.parsedType===te.promise?r.data:Promise.resolve(r.data);return it(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Tr.create=(e,t)=>new Tr({type:e,typeName:le.ZodPromise,...me(t)});var Et=class extends ye{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===le.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this9=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{Z(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(a){if(r.value==="aborted")return ue;let u=yield _this9._def.schema._parseAsync({data:a,path:n.path,parent:n});return u.status==="aborted"?ue:u.status==="dirty"?rn(u.value):r.value==="dirty"?rn(u.value):u});return function(_x82){return _ref38.apply(this,arguments)}}());{if(r.value==="aborted")return ue;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ue:a.status==="dirty"?rn(a.value):r.value==="dirty"?rn(a.value):a}}if(o.type==="refinement"){let s=a=>{let u=o.refinement(a,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ue:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ue:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Er(s))return ue;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Er(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):ue);Ae.assertNever(o)}};Et.create=(e,t,r)=>new Et({schema:e,typeName:le.ZodEffects,effect:t,...me(r)});Et.createWithPreprocess=(e,t,r)=>new Et({schema:t,effect:{type:"preprocess",transform:e},typeName:le.ZodEffects,...me(r)});var Ct=class extends ye{_parse(t){return this._getType(t)===te.undefined?it(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ct.create=(e,t)=>new Ct({innerType:e,typeName:le.ZodOptional,...me(t)});var zt=class extends ye{_parse(t){return this._getType(t)===te.null?it(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};zt.create=(e,t)=>new zt({innerType:e,typeName:le.ZodNullable,...me(t)});var hn=class extends ye{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===te.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};hn.create=(e,t)=>new hn({innerType:e,typeName:le.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...me(t)});var yn=class extends ye{_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 ao(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ut(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ut(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};yn.create=(e,t)=>new yn({innerType:e,typeName:le.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...me(t)});var mo=class extends ye{_parse(t){if(this._getType(t)!==te.nan){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.nan,received:n.parsedType}),ue}return{status:"valid",value:t.data}}};mo.create=e=>new mo({typeName:le.ZodNaN,...me(e)});var iT=Symbol("zod_brand"),ki=class extends ye{_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}},Oi=class e extends ye{_parse(t){var _this0=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let i=yield _this0._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ue:i.status==="dirty"?(r.dirty(),rn(i.value)):_this0._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ue: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:le.ZodPipeline})}},vn=class extends ye{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Er(o)&&(o.value=Object.freeze(o.value)),o);return ao(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};vn.create=(e,t)=>new vn({innerType:e,typeName:le.ZodReadonly,...me(t)});function Oy(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function My(e,t={},r){return e?Rr.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=Oy(t,n),u=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:u})}});if(!i){let s=Oy(t,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):Rr.create()}var sT={object:lt.lazycreate},le;(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"})(le||(le={}));var aT=(e,t={message:`Input not instance of ${e.name}`})=>My(r=>r instanceof e,t),Ly=Ir.create,jy=nn.create,cT=mo.create,uT=on.create,qy=sn.create,lT=an.create,dT=uo.create,pT=cn.create,fT=un.create,mT=Rr.create,gT=dr.create,hT=Dt.create,yT=lo.create,vT=pr.create,ST=lt.create,AT=lt.strictCreate,bT=ln.create,wT=Na.create,CT=dn.create,xT=Ht.create,ET=Fa.create,IT=po.create,RT=fo.create,TT=Da.create,_T=pn.create,kT=fn.create,OT=mn.create,PT=gn.create,NT=Tr.create,FT=Et.create,DT=Ct.create,MT=zt.create,LT=Et.createWithPreprocess,jT=Oi.create,qT=()=>Ly().optional(),UT=()=>jy().optional(),VT=()=>qy().optional(),GT={string:e=>Ir.create({...e,coerce:!0}),number:e=>nn.create({...e,coerce:!0}),boolean:e=>sn.create({...e,coerce:!0}),bigint:e=>on.create({...e,coerce:!0}),date:e=>an.create({...e,coerce:!0})};var BT=ue;var $T=A.object({name:A.string(),arguments:A.string()}),QT=A.object({id:A.string(),type:A.literal("function"),function:$T,encryptedValue:A.string().optional()}),Ma=A.object({id:A.string(),role:A.string(),content:A.string().optional(),name:A.string().optional(),encryptedValue:A.string().optional()}),HT=A.object({type:A.literal("text"),text:A.string()}),zT=A.object({type:A.literal("data"),value:A.string(),mimeType:A.string()}),WT=A.object({type:A.literal("url"),value:A.string(),mimeType:A.string().optional()}),La=A.discriminatedUnion("type",[zT,WT]),KT=A.object({type:A.literal("image"),source:La,metadata:A.unknown().optional()}),YT=A.object({type:A.literal("audio"),source:La,metadata:A.unknown().optional()}),XT=A.object({type:A.literal("video"),source:La,metadata:A.unknown().optional()}),ZT=A.object({type:A.literal("document"),source:La,metadata:A.unknown().optional()});var Uy=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()}),Vy=(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"]})},L4=Uy.superRefine((e,t)=>{Vy(e,t)}),JT=A.discriminatedUnion("type",[HT,KT,YT,XT,ZT,Uy]),e_=JT.superRefine((e,t)=>{e.type==="binary"&&Vy(e,t)}),t_=Ma.extend({role:A.literal("developer"),content:A.string()}),r_=Ma.extend({role:A.literal("system"),content:A.string()}),n_=Ma.extend({role:A.literal("assistant"),content:A.string().optional(),toolCalls:A.array(QT).optional()}),o_=Ma.extend({role:A.literal("user"),content:A.union([A.string(),A.array(e_)])}),i_=A.object({id:A.string(),content:A.string(),role:A.literal("tool"),toolCallId:A.string(),error:A.string().optional(),encryptedValue:A.string().optional()}),s_=A.object({id:A.string(),role:A.literal("activity"),activityType:A.string(),content:A.record(A.any())}),a_=A.object({id:A.string(),role:A.literal("reasoning"),content:A.string(),encryptedValue:A.string().optional()}),Gy=A.discriminatedUnion("role",[t_,r_,n_,o_,i_,s_,a_]),j4=A.union([A.literal("developer"),A.literal("system"),A.literal("assistant"),A.literal("user"),A.literal("tool"),A.literal("activity"),A.literal("reasoning")]),c_=A.object({description:A.string(),value:A.string()}),By=A.object({name:A.string(),description:A.string(),parameters:A.any(),metadata:A.record(A.any()).optional()}),u_=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()}),l_=A.object({interruptId:A.string(),status:A.enum(["resolved","cancelled"]),payload:A.any().optional()}),d_=A.object({threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),state:A.any(),messages:A.array(Gy),tools:A.array(By),context:A.array(c_),forwardedProps:A.any(),resume:A.array(l_).optional()}),p_=A.any(),Pe=class extends Error{constructor(e){super(e)}},Gd=class extends Pe{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},f_=A.object({name:A.string(),description:A.string().optional()}),m_=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()}),g_=A.object({streaming:A.boolean().optional(),websocket:A.boolean().optional(),httpBinary:A.boolean().optional(),pushNotifications:A.boolean().optional(),resumable:A.boolean().optional()}),h_=A.object({supported:A.boolean().optional(),items:A.array(By).optional(),parallelCalls:A.boolean().optional(),clientProvided:A.boolean().optional()}),y_=A.object({structuredOutput:A.boolean().optional(),supportedMimeTypes:A.array(A.string()).optional()}),v_=A.object({snapshots:A.boolean().optional(),deltas:A.boolean().optional(),memory:A.boolean().optional(),persistentState:A.boolean().optional()}),S_=A.object({supported:A.boolean().optional(),delegation:A.boolean().optional(),handoffs:A.boolean().optional(),subAgents:A.array(f_).optional()}),A_=A.object({supported:A.boolean().optional(),streaming:A.boolean().optional(),encrypted:A.boolean().optional()}),b_=A.object({image:A.boolean().optional(),audio:A.boolean().optional(),video:A.boolean().optional(),pdf:A.boolean().optional(),file:A.boolean().optional()}),w_=A.object({image:A.boolean().optional(),audio:A.boolean().optional()}),C_=A.object({input:b_.optional(),output:w_.optional()}),x_=A.object({codeExecution:A.boolean().optional(),sandboxed:A.boolean().optional(),maxIterations:A.number().optional(),maxExecutionTime:A.number().optional()}),E_=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()}),q4=A.object({identity:m_.optional(),transport:g_.optional(),tools:h_.optional(),output:y_.optional(),state:v_.optional(),multiAgent:S_.optional(),reasoning:A_.optional(),multimodal:C_.optional(),execution:x_.optional(),humanInTheLoop:E_.optional(),custom:A.record(A.unknown()).optional()}),$y=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}({}),Ee=A.object({type:A.nativeEnum(D),timestamp:A.number().optional(),rawEvent:A.any().optional()}).passthrough(),I_=Ee.extend({type:A.literal(D.TEXT_MESSAGE_START),messageId:A.string(),role:$y.default("assistant"),name:A.string().optional()}),Qy=Ee.extend({type:A.literal(D.TEXT_MESSAGE_CONTENT),messageId:A.string(),delta:A.string()}),R_=Ee.extend({type:A.literal(D.TEXT_MESSAGE_END),messageId:A.string()}),T_=Ee.extend({type:A.literal(D.TEXT_MESSAGE_CHUNK),messageId:A.string().optional(),role:$y.optional(),delta:A.string().optional(),name:A.string().optional()}),__=Ee.extend({type:A.literal(D.THINKING_TEXT_MESSAGE_START)}),k_=Qy.omit({messageId:!0,type:!0}).extend({type:A.literal(D.THINKING_TEXT_MESSAGE_CONTENT)}),O_=Ee.extend({type:A.literal(D.THINKING_TEXT_MESSAGE_END)}),P_=Ee.extend({type:A.literal(D.TOOL_CALL_START),toolCallId:A.string(),toolCallName:A.string(),parentMessageId:A.string().optional()}),N_=Ee.extend({type:A.literal(D.TOOL_CALL_ARGS),toolCallId:A.string(),delta:A.string()}),F_=Ee.extend({type:A.literal(D.TOOL_CALL_END),toolCallId:A.string()}),D_=Ee.extend({messageId:A.string(),type:A.literal(D.TOOL_CALL_RESULT),toolCallId:A.string(),content:A.string(),role:A.literal("tool").optional()}),M_=Ee.extend({type:A.literal(D.TOOL_CALL_CHUNK),toolCallId:A.string().optional(),toolCallName:A.string().optional(),parentMessageId:A.string().optional(),delta:A.string().optional()}),L_=Ee.extend({type:A.literal(D.THINKING_START),title:A.string().optional()}),j_=Ee.extend({type:A.literal(D.THINKING_END)}),q_=Ee.extend({type:A.literal(D.STATE_SNAPSHOT),snapshot:p_}),U_=Ee.extend({type:A.literal(D.STATE_DELTA),delta:A.array(A.any())}),V_=Ee.extend({type:A.literal(D.MESSAGES_SNAPSHOT),messages:A.array(Gy)}),G_=Ee.extend({type:A.literal(D.ACTIVITY_SNAPSHOT),messageId:A.string(),activityType:A.string(),content:A.record(A.any()),replace:A.boolean().optional().default(!0)}),B_=Ee.extend({type:A.literal(D.ACTIVITY_DELTA),messageId:A.string(),activityType:A.string(),patch:A.array(A.any())}),$_=Ee.extend({type:A.literal(D.RAW),event:A.any(),source:A.string().optional()}),Q_=Ee.extend({type:A.literal(D.CUSTOM),name:A.string(),value:A.any()}),H_=Ee.extend({type:A.literal(D.RUN_STARTED),threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),input:d_.optional()}),z_=A.object({type:A.literal("success")}).strict(),W_=A.object({type:A.literal("interrupt"),interrupts:A.array(u_).min(1)}).strict(),K_=A.discriminatedUnion("type",[z_,W_]),Y_=Ee.extend({type:A.literal(D.RUN_FINISHED),threadId:A.string(),runId:A.string(),result:A.any().optional(),outcome:K_.nullable().optional().transform(e=>e??void 0)}),X_=Ee.extend({type:A.literal(D.RUN_ERROR),message:A.string(),code:A.string().optional()}),Z_=Ee.extend({type:A.literal(D.STEP_STARTED),stepName:A.string()}),J_=Ee.extend({type:A.literal(D.STEP_FINISHED),stepName:A.string()}),ek=A.union([A.literal("tool-call"),A.literal("message")]),tk=Ee.extend({type:A.literal(D.REASONING_START),messageId:A.string()}),rk=Ee.extend({type:A.literal(D.REASONING_MESSAGE_START),messageId:A.string(),role:A.literal("reasoning")}),nk=Ee.extend({type:A.literal(D.REASONING_MESSAGE_CONTENT),messageId:A.string(),delta:A.string()}),ok=Ee.extend({type:A.literal(D.REASONING_MESSAGE_END),messageId:A.string()}),ik=Ee.extend({type:A.literal(D.REASONING_MESSAGE_CHUNK),messageId:A.string().optional(),delta:A.string().optional()}),sk=Ee.extend({type:A.literal(D.REASONING_END),messageId:A.string()}),ak=Ee.extend({type:A.literal(D.REASONING_ENCRYPTED_VALUE),subtype:ek,entityId:A.string(),encryptedValue:A.string()}),ja=A.discriminatedUnion("type",[I_,Qy,R_,T_,L_,j_,__,k_,O_,P_,N_,F_,M_,D_,q_,U_,V_,G_,B_,$_,Q_,H_,Y_,X_,Z_,J_,tk,rk,nk,ok,ik,sk,ak]);m();d();f();p();var Bd={};zi(Bd,{JsonPatchError:()=>qe,_areEquals:()=>Fi,applyOperation:()=>Sn,applyPatch:()=>Qa,applyReducer:()=>pk,deepClone:()=>lk,getValueByPointer:()=>Ba,validate:()=>zy,validator:()=>$a});m();d();f();p();m();d();f();p();var ck=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},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)}}(),uk=Object.prototype.hasOwnProperty;function Ua(e,t){return uk.call(e,t)}function Va(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)Ua(e,o)&&n.push(o);return n}function tt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Ga(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 Wt(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Pi(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function qa(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(qa(e[t]))return!0}else if(typeof e=="object"){for(var n=Va(e),o=n.length,i=0;i<o;i++)if(qa(e[n[i]]))return!0}}return!1}function Hy(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
33
+ `)}var Ni=function(e){ck(t,e);function t(r,n,o,i,s){var a=this.constructor,u=e.call(this,Hy(r,{name:n,index:o,operation:i,tree:s}))||this;return u.name=n,u.index=o,u.operation=i,u.tree=s,Object.setPrototypeOf(u,a.prototype),u.message=Hy(r,{name:n,index:o,operation:i,tree:s}),u}return t}(Error);var qe=Ni,lk=tt,go={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=Ba(r,this.path);n&&(n=tt(n));var o=Sn(r,{op:"remove",path:this.from}).removed;return Sn(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Ba(r,this.from);return Sn(r,{op:"add",path:this.path,value:tt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Fi(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},dk={add:function(e,t,r){return Ga(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:go.move,copy:go.copy,test:go.test,_get:go._get};function Ba(e,t){if(t=="")return e;var r={op:"_get",path:t};return Sn(e,r),r.value}function Sn(e,t,r,n,o,i){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),i===void 0&&(i=0),r&&(typeof r=="function"?r(t,0,e,t.path):$a(t,0)),t.path===""){var s={newDocument:e};if(t.op==="add")return s.newDocument=t.value,s;if(t.op==="replace")return s.newDocument=t.value,s.removed=e,s;if(t.op==="move"||t.op==="copy")return s.newDocument=Ba(e,t.from),t.op==="move"&&(s.removed=e),s;if(t.op==="test"){if(s.test=Fi(e,t.value),s.test===!1)throw new qe("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s.newDocument=e,s}else{if(t.op==="remove")return s.removed=e,s.newDocument=null,s;if(t.op==="_get")return t.value=e,s;if(r)throw new qe("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return s}}else{n||(e=tt(e));var a=t.path||"",u=a.split("/"),c=e,g=1,v=u.length,E=void 0,h=void 0,y=void 0;for(typeof r=="function"?y=r:y=$a;;){if(h=u[g],h&&h.indexOf("~")!=-1&&(h=Pi(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&u[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&&E===void 0&&(c[h]===void 0?E=u.slice(0,g).join("/"):g==v-1&&(E=t.path),E!==void 0&&y(t,0,e,E)),g++,Array.isArray(c)){if(h==="-")h=c.length;else{if(r&&!Ga(h))throw new qe("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",i,t,e);Ga(h)&&(h=~~h)}if(g>=v){if(r&&t.op==="add"&&h>c.length)throw new qe("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);var s=dk[t.op].call(t,c,h,e);if(s.test===!1)throw new qe("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}}else if(g>=v){var s=go[t.op].call(t,c,h,e);if(s.test===!1)throw new qe("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}if(c=c[h],r&&g<v&&(!c||typeof c!="object"))throw new qe("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function Qa(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new qe("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=tt(e));for(var i=new Array(t.length),s=0,a=t.length;s<a;s++)i[s]=Sn(e,t[s],r,!0,o,s),e=i[s].newDocument;return i.newDocument=e,i}function pk(e,t,r){var n=Sn(e,t);if(n.test===!1)throw new qe("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function $a(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new qe("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(go[e.op]){if(typeof e.path!="string")throw new qe("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new qe("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 qe("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 qe("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")&&qa(e.value))throw new qe("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,i=n.split("/").length;if(o!==i+1&&o!==i)throw new qe("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 qe("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 s={op:"_get",path:e.from,value:void 0},a=zy([s],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new qe("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new qe("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function zy(e,t,r){try{if(!Array.isArray(e))throw new qe("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Qa(tt(t),tt(e),r||!0);else{r=r||$a;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof qe)return o;throw o}}function Fi(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,i,s;if(r&&n){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!Fi(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var a=Object.keys(e);if(i=a.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(a[o]))return!1;for(o=i;o--!==0;)if(s=a[o],!Fi(e[s],t[s]))return!1;return!0}return e!==e&&t!==t}var zd={};zi(zd,{compare:()=>Ak,generate:()=>$d,observe:()=>Sk,unobserve:()=>vk});m();d();f();p();var Qd=new WeakMap,fk=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),mk=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function gk(e){return Qd.get(e)}function hk(e,t){return e.observers.get(t)}function yk(e,t){e.observers.delete(t.callback)}function vk(e,t){t.unobserve()}function Sk(e,t){var r=[],n,o=gk(e);if(!o)o=new fk(e),Qd.set(e,o);else{var i=hk(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=tt(e),t){n.callback=t,n.next=null;var s=function(){$d(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(s)};typeof window<"u"&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return n.patches=r,n.object=e,n.unobserve=function(){$d(n),clearTimeout(n.next),yk(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},o.observers.set(t,new mk(t,n)),n}function $d(e,t){t===void 0&&(t=!1);var r=Qd.get(e.object);Hd(r.value,e.object,e.patches,"",t),e.patches.length&&Qa(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Hd(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=Va(t),s=Va(e),a=!1,u=!1,c=s.length-1;c>=0;c--){var g=s[c],v=e[g];if(Ua(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var E=t[g];typeof v=="object"&&v!=null&&typeof E=="object"&&E!=null&&Array.isArray(v)===Array.isArray(E)?Hd(v,E,r,n+"/"+Wt(g),o):v!==E&&(a=!0,o&&r.push({op:"test",path:n+"/"+Wt(g),value:tt(v)}),r.push({op:"replace",path:n+"/"+Wt(g),value:tt(E)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+Wt(g),value:tt(v)}),r.push({op:"remove",path:n+"/"+Wt(g)}),u=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),a=!0)}if(!(!u&&i.length==s.length))for(var c=0;c<i.length;c++){var g=i[c];!Ua(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+Wt(g),value:tt(t[g])})}}}function Ak(e,t,r){r===void 0&&(r=!1);var n=[];return Hd(e,t,n,"",r),n}var Ha=Object.assign({},Bd,zd,{JsonPatchError:Ni,deepClone:tt,escapePathComponent:Wt,unescapePathComponent:Pi});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Wd=function(e,t){return Wd=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])},Wd(e,t)};function Kt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Wd(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Wy(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(g){try{c(n.next(g))}catch(v){s(v)}}function u(g){try{c(n.throw(g))}catch(v){s(v)}}function c(g){g.done?i(g.value):o(g.value).then(a,u)}c((n=n.apply(e,t||[])).next())})}function za(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function fr(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 ho(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-->0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function yo(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function An(e){return this instanceof An?(this.v=e,this):new An(e)}function Ky(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(h){return function(y){return Promise.resolve(y).then(h,v)}}function a(h,y){n[h]&&(o[h]=function(S){return new Promise(function(x,I){i.push([h,S,x,I])>1||u(h,S)})},y&&(o[h]=y(o[h])))}function u(h,y){try{c(n[h](y))}catch(S){E(i[0][3],S)}}function c(h){h.value instanceof An?Promise.resolve(h.value.v).then(g,v):E(i[0][2],h)}function g(h){u("next",h)}function v(h){u("throw",h)}function E(h,y){h(y),i.shift(),i.length&&u(i[0][0],i[0][1])}}function Yy(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 fr=="function"?fr(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(s){return new Promise(function(a,u){s=e[i](s),o(a,u,s.done,s.value)})}}function o(i,s,a,u){Promise.resolve(u).then(function(c){i({value:c,done:a})},s)}}m();d();f();p();function Se(e){return typeof e=="function"}m();d();f();p();m();d();f();p();m();d();f();p();function vo(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 Wa=vo(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
34
34
  `+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
35
- `):"",this.name="UnsubscriptionError",this.errors=r}});m();d();f();p();function Di(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var So=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,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=fr(s),u=a.next();!u.done;u=a.next()){var c=u.value;c.remove(this)}}catch(S){t={error:S}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var g=this.initialTeardown;if(Se(g))try{g()}catch(S){i=S instanceof Wa?S.errors:[S]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var E=fr(v),h=E.next();!h.done;h=E.next()){var y=h.value;try{Yy(y)}catch(S){i=i??[],S instanceof Wa?i=yo(yo([],ho(i)),ho(S.errors)):i.push(S)}}}catch(S){n={error:S}}finally{try{h&&!h.done&&(o=E.return)&&o.call(E)}finally{if(n)throw n.error}}}if(i)throw new Wa(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Yy(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)&&Di(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Di(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Wd=So.EMPTY;function Ka(e){return e instanceof So||e&&"closed"in e&&Se(e.remove)&&Se(e.add)&&Se(e.unsubscribe)}function Yy(e){Se(e)?e():e.unsubscribe()}m();d();f();p();var Mt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var Ao={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Ao.delegate;return o?.setTimeout?o.setTimeout.apply(o,yo([e,t],ho(r))):setTimeout.apply(void 0,yo([e,t],ho(r)))},clearTimeout:function(e){var t=Ao.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Ya(e){Ao.setTimeout(function(){var t=Mt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function Mi(){}m();d();f();p();var Xy=function(){return Kd("C",void 0,void 0)}();function Zy(e){return Kd("E",void 0,e)}function Jy(e){return Kd("N",e,void 0)}function Kd(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var bn=null;function bo(e){if(Mt.useDeprecatedSynchronousErrorHandling){var t=!bn;if(t&&(bn={errorThrown:!1,error:null}),e(),t){var r=bn,n=r.errorThrown,o=r.error;if(bn=null,n)throw o}}else e()}function ev(e){Mt.useDeprecatedSynchronousErrorHandling&&bn&&(bn.errorThrown=!0,bn.error=e)}var Li=function(e){Kt(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Ka(r)&&r.add(n)):n.destination=gk,n}return t.create=function(r,n,o){return new Za(r,n,o)},t.prototype.next=function(r){this.isStopped?Xd(Jy(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Xd(Zy(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Xd(Xy,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}(So);var pk=Function.prototype.bind;function Yd(e,t){return pk.call(e,t)}var fk=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){Xa(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Xa(n)}else Xa(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Xa(r)}},e}(),Za=function(e){Kt(t,e);function t(r,n,o){var i=e.call(this)||this,s;if(Se(r)||!r)s={next:r??void 0,error:n??void 0,complete:o??void 0};else{var a;i&&Mt.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return i.unsubscribe()},s={next:r.next&&Yd(r.next,a),error:r.error&&Yd(r.error,a),complete:r.complete&&Yd(r.complete,a)}):s=r}return i.destination=new fk(s),i}return t}(Li);function Xa(e){Mt.useDeprecatedSynchronousErrorHandling?ev(e):Ya(e)}function mk(e){throw e}function Xd(e,t){var r=Mt.onStoppedNotification;r&&Ao.setTimeout(function(){return r(e,t)})}var gk={closed:!0,next:Mi,error:mk,complete:Mi};m();d();f();p();var wo=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function Co(e){return e}function Ja(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Zd(e)}function Zd(e){return e.length===0?Co:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var Pe=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,i=yk(t)?t:new Za(t,r,n);return bo(function(){var s=o,a=s.operator,u=s.source;i.add(a?a.call(i,u):u?o._subscribe(i):o._trySubscribe(i))}),i},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=tv(r),new r(function(o,i){var s=new Za({next:function(a){try{t(a)}catch(u){i(u),s.unsubscribe()}},error:i,complete:o});n.subscribe(s)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[wo]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Zd(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=tv(t),new t(function(n,o){var i;r.subscribe(function(s){return i=s},function(s){return o(s)},function(){return n(i)})})},e.create=function(t){return new e(t)},e}();function tv(e){var t;return(t=e??Mt.Promise)!==null&&t!==void 0?t:Promise}function hk(e){return e&&Se(e.next)&&Se(e.error)&&Se(e.complete)}function yk(e){return e&&e instanceof Li||hk(e)&&Ka(e)}m();d();f();p();function vk(e){return Se(e?.lift)}function Ve(e){return function(t){if(vk(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")}}m();d();f();p();function He(e,t,r,n,o){return new Sk(e,t,r,n,o)}var Sk=function(e){Kt(t,e);function t(r,n,o,i,s,a){var u=e.call(this,r)||this;return u.onFinalize=s,u.shouldUnsubscribe=a,u._next=n?function(c){try{n(c)}catch(g){r.error(g)}}:e.prototype._next,u._error=i?function(c){try{i(c)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=o?function(){try{o()}catch(c){r.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,u}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}(Li);m();d();f();p();m();d();f();p();var rv=vo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Yt=function(e){Kt(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 nv(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new rv},t.prototype.next=function(r){var n=this;bo(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=fr(n.currentObservers),a=s.next();!a.done;a=s.next()){var u=a.value;u.next(r)}}catch(c){o={error:c}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;bo(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;bo(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,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Wd:(this.currentObservers=null,a.push(r),new So(function(){n.currentObservers=null,Di(a,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},t.prototype.asObservable=function(){var r=new Pe;return r.source=this,r},t.create=function(r,n){return new nv(r,n)},t}(Pe);var nv=function(e){Kt(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:Wd},t}(Yt);m();d();f();p();m();d();f();p();var Jd={now:function(){return(Jd.delegate||Date).now()},delegate:void 0};var ec=function(e){Kt(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=Jd);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,u=n._windowTime;o||(i.push(r),!s&&i.push(a.now()+u)),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,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),u=0;u<a.length&&!r.closed;u+=i?1:2)r.next(a[u]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,i=r._buffer,s=r._infiniteTimeWindow,a=(s?1:2)*n;if(n<1/0&&a<i.length&&i.splice(0,i.length-a),!s){for(var u=o.now(),c=0,g=1;g<i.length&&i[g]<=u;g+=2)c=g;c&&i.splice(0,c+1)}},t}(Yt);m();d();f();p();var tc=new Pe(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function ov(e){return e&&Se(e.schedule)}function Ak(e){return e[e.length-1]}function iv(e){return ov(Ak(e))?e.pop():void 0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var rc=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function nc(e){return Se(e?.then)}m();d();f();p();function oc(e){return Se(e[wo])}m();d();f();p();function ic(e){return Symbol.asyncIterator&&Se(e?.[Symbol.asyncIterator])}m();d();f();p();function sc(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.")}m();d();f();p();m();d();f();p();function bk(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var ac=bk();function cc(e){return Se(e?.[ac])}m();d();f();p();function uc(e){return Wy(this,arguments,function(){var r,n,o,i;return za(this,function(s){switch(s.label){case 0:r=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,An(r.read())];case 3:return n=s.sent(),o=n.value,i=n.done,i?[4,An(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,An(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function lc(e){return Se(e?.getReader)}function ze(e){if(e instanceof Pe)return e;if(e!=null){if(oc(e))return wk(e);if(rc(e))return Ck(e);if(nc(e))return xk(e);if(ic(e))return sv(e);if(cc(e))return Ek(e);if(lc(e))return Ik(e)}throw sc(e)}function wk(e){return new Pe(function(t){var r=e[wo]();if(Se(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Ck(e){return new Pe(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function xk(e){return new Pe(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Ya)})}function Ek(e){return new Pe(function(t){var r,n;try{for(var o=fr(e),i=o.next();!i.done;i=o.next()){var s=i.value;if(t.next(s),t.closed)return}}catch(a){r={error:a}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function sv(e){return new Pe(function(t){Rk(e,t).catch(function(r){return t.error(r)})})}function Ik(e){return sv(uc(e))}function Rk(e,t){var r,n,o,i;return zy(this,void 0,void 0,function(){var s,a;return za(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),r=Ky(e),u.label=1;case 1:return[4,r.next()];case 2:if(n=u.sent(),!!n.done)return[3,4];if(s=n.value,t.next(s),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=u.sent(),o={error:a},[3,11];case 6:return u.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:u.sent(),u.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]}})})}m();d();f();p();m();d();f();p();function It(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!o)return i}function dc(e,t){return t===void 0&&(t=0),Ve(function(r,n){r.subscribe(He(n,function(o){return It(n,e,function(){return n.next(o)},t)},function(){return It(n,e,function(){return n.complete()},t)},function(o){return It(n,e,function(){return n.error(o)},t)}))})}m();d();f();p();function pc(e,t){return t===void 0&&(t=0),Ve(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function av(e,t){return ze(e).pipe(pc(t),dc(t))}m();d();f();p();function cv(e,t){return ze(e).pipe(pc(t),dc(t))}m();d();f();p();function uv(e,t){return new Pe(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}m();d();f();p();function lv(e,t){return new Pe(function(r){var n;return It(r,t,function(){n=e[ac](),It(r,t,function(){var o,i,s;try{o=n.next(),i=o.value,s=o.done}catch(a){r.error(a);return}s?r.complete():r.next(i)},0,!0)}),function(){return Se(n?.return)&&n.return()}})}m();d();f();p();function fc(e,t){if(!e)throw new Error("Iterable cannot be null");return new Pe(function(r){It(r,t,function(){var n=e[Symbol.asyncIterator]();It(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}m();d();f();p();function dv(e,t){return fc(uc(e),t)}function pv(e,t){if(e!=null){if(oc(e))return av(e,t);if(rc(e))return uv(e,t);if(nc(e))return cv(e,t);if(ic(e))return fc(e,t);if(cc(e))return lv(e,t);if(lc(e))return dv(e,t)}throw sc(e)}function wn(e,t){return t?pv(e,t):ze(e)}function Me(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=iv(e);return wn(e,r)}m();d();f();p();function Ne(e,t){var r=Se(e)?e:function(){return e},n=function(o){return o.error(r())};return new Pe(t?function(o){return t.schedule(n,0,o)}:n)}m();d();f();p();m();d();f();p();var fv=vo(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function mc(e,t){var r=typeof t=="object";return new Promise(function(n,o){var i=!1,s;e.subscribe({next:function(a){s=a,i=!0},error:o,complete:function(){i?n(s):r?n(t.defaultValue):o(new fv)}})})}m();d();f();p();function Cn(e,t){return Ve(function(r,n){var o=0;r.subscribe(He(n,function(i){n.next(e.call(t,i,o++))}))})}m();d();f();p();m();d();f();p();m();d();f();p();function mv(e,t,r,n,o,i,s,a){var u=[],c=0,g=0,v=!1,E=function(){v&&!u.length&&!c&&t.complete()},h=function(S){return c<n?y(S):u.push(S)},y=function(S){i&&t.next(S),c++;var x=!1;ze(r(S,g++)).subscribe(He(t,function(I){o?.(I),i?h(I):t.next(I)},function(){x=!0},void 0,function(){if(x)try{c--;for(var I=function(){var T=u.shift();s?It(t,s,function(){return y(T)}):y(T)};u.length&&c<n;)I();E()}catch(T){t.error(T)}}))};return e.subscribe(He(t,h,function(){v=!0,E()})),function(){a?.()}}function dt(e,t,r){return r===void 0&&(r=1/0),Se(t)?dt(function(n,o){return Cn(function(i,s){return t(n,i,o,s)})(ze(e(n,o)))},r):(typeof t=="number"&&(r=t),Ve(function(n,o){return mv(n,o,e,r)}))}function ep(e){return e===void 0&&(e=1/0),dt(Co,e)}m();d();f();p();function gc(e){return new Pe(function(t){ze(e()).subscribe(t)})}m();d();f();p();function ji(e){return Ve(function(t,r){var n=null,o=!1,i;n=t.subscribe(He(r,void 0,void 0,function(s){i=ze(e(s,ji(e)(t))),n?(n.unsubscribe(),n=null,i.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(r))})}m();d();f();p();function hc(e,t){return Se(t)?dt(e,t,1):dt(e,1)}m();d();f();p();function tp(e){return Ve(function(t,r){var n=!1;t.subscribe(He(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}m();d();f();p();function xn(e){return Ve(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function rp(e,t){return Ve(function(r,n){var o=null,i=0,s=!1,a=function(){return s&&!o&&n.complete()};r.subscribe(He(n,function(u){o?.unsubscribe();var c=0,g=i++;ze(e(u,g)).subscribe(o=He(n,function(v){return n.next(t?t(u,v,g,c++):v)},function(){o=null,a()}))},function(){s=!0,a()}))})}m();d();f();p();function yc(e){return Ve(function(t,r){ze(e).subscribe(He(r,function(){return r.complete()},Mi)),!r.closed&&t.subscribe(r)})}m();d();f();p();function np(e,t,r){var n=Se(e)||t||r?{next:e,error:t,complete:r}:e;return n?Ve(function(o,i){var s;(s=n.subscribe)===null||s===void 0||s.call(n);var a=!0;o.subscribe(He(i,function(u){var c;(c=n.next)===null||c===void 0||c.call(n,u),i.next(u)},function(){var u;a=!1,(u=n.complete)===null||u===void 0||u.call(n),i.complete()},function(u){var c;a=!1,(c=n.error)===null||c===void 0||c.call(n,u),i.error(u)},function(){var u,c;a&&((u=n.unsubscribe)===null||u===void 0||u.call(n)),(c=n.finalize)===null||c===void 0||c.call(n)}))}):Co}m();d();f();p();m();d();f();p();function gv(e){return` \r
36
- `.indexOf(e)>=0}function vc(e){for(var t=["topLevel"],r=0,n,o,i,s=function(T){return t.push(T)},a=function(T){return t[t.length-1]=T},u=function(T){n==null&&(n=r,o=t.length,i=T)},c=function(T){T===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},E=function(T){if("0"<=T&&T<="9"){s("number");return}switch(T){case"\"":s("string");return;case"-":s("numberNeedsDigit");return;case"t":s("true");return;case"f":s("false");return;case"n":s("null");return;case"[":s("arrayNeedsValue");return;case"{":s("objectNeedsKey");return}},h=e.length;r<h;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":E(y);break;case"string":switch(y){case"\"":g();break;case"\\":u("stringEscape"),s("stringEscaped");break}break;case"stringEscaped":y==="u"?s("stringUnicode"):(c("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(c("stringEscape"),g());break;case"number":y==="."?a("numberNeedsDigit"):y==="e"||y==="E"?a("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),g());break;case"numberNeedsDigit":a("number");break;case"numberNeedsExponent":a(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),g());break;case"arrayNeedsValue":y==="]"?g():gv(y)||(c("collectionItem"),a("arrayNeedsComma"),E(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(u("collectionItem"),a("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(u("collectionItem"),a("objectNeedsColon"),s("string"));break;case"objectNeedsColon":y===":"&&a("objectNeedsValue");break;case"objectNeedsValue":gv(y)||(c("collectionItem"),a("objectNeedsComma"),E(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(u("collectionItem"),a("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var S=[n!=null?e.slice(0,n):e],x=function(T){return S.push(T.slice(e.length-e.lastIndexOf(T[0])))},I=t.length-1;I>=0;I--)switch(t[I]){case"string":S.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":S.push("0");break;case"true":x("true");break;case"false":x("false");break;case"null":x("null");break;case"arrayNeedsValue":case"arrayNeedsComma":S.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":S.push("}");break}return S.join("")}m();d();f();p();m();d();f();p();m();d();f();p();function yv(){let e=0,t=0;for(let n=0;n<28;n+=7){let o=this.buf[this.pos++];if(e|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}let r=this.buf[this.pos++];if(e|=(r&15)<<28,t=(r&112)>>4,(r&128)==0)return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let o=this.buf[this.pos++];if(t|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function Ac(e,t,r){for(let i=0;i<28;i=i+7){let s=e>>>i,a=!(!(s>>>7)&&t==0),u=(a?s|128:s)&255;if(r.push(u),!a)return}let n=e>>>28&15|(t&7)<<4,o=t>>3!=0;if(r.push((o?n|128:n)&255),!!o){for(let i=3;i<31;i=i+7){let s=t>>>i,a=!!(s>>>7),u=(a?s|128:s)&255;if(r.push(u),!a)return}r.push(t>>>31&1)}}var Sc=4294967296;function op(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(s,a){let u=Number(e.slice(s,a));o*=r,n=n*r+u,n>=Sc&&(o=o+(n/Sc|0),n=n%Sc)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?Sv(n,o):sp(n,o)}function vv(e,t){let r=sp(e,t),n=r.hi&2147483648;n&&(r=Sv(r.lo,r.hi));let o=ip(r.lo,r.hi);return n?"-"+o:o}function ip(e,t){if({lo:e,hi:t}=Tk(e,t),t<=2097151)return String(Sc*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,i=r+n*6777216+o*6710656,s=n+o*8147497,a=o*2,u=1e7;return i>=u&&(s+=Math.floor(i/u),i%=u),s>=u&&(a+=Math.floor(s/u),s%=u),a.toString()+hv(s)+hv(i)}function Tk(e,t){return{lo:e>>>0,hi:t>>>0}}function sp(e,t){return{lo:e|0,hi:t|0}}function Sv(e,t){return t=~t,e?e=~e+1:t+=1,sp(e,t)}var hv=e=>{let t=String(e);return"0000000".slice(t.length)+t};function ap(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let r=0;r<9;r++)t.push(e&127|128),e=e>>7;t.push(1)}}function Av(){let e=this.buf[this.pos++],t=e&127;if((e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)==0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!=0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();f();p();var Lt=_k();function _k(){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"&&(!!A.Deno||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(s){let a=typeof s=="bigint"?s:BigInt(s);if(a>n||a<r)throw new Error(`invalid int64: ${s}`);return a},uParse(s){let a=typeof s=="bigint"?s:BigInt(s);if(a>i||a<o)throw new Error(`invalid uint64: ${s}`);return a},enc(s){return e.setBigInt64(0,this.parse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(s){return e.setBigInt64(0,this.uParse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigInt64(0,!0)},uDec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),bv(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),wv(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),bv(r),op(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),wv(r),op(r)},dec(r,n){return vv(r,n)},uDec(r,n){return ip(r,n)}}}function bv(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function wv(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var cp=Symbol.for("@bufbuild/protobuf/text-encoding");function up(){if(A[cp]==null){let e=new A.TextEncoder,t=new A.TextDecoder,r;A[cp]={encodeUtf8(n){return e.encode(n)},decodeUtf8(n,o){return o?(r===void 0&&(r=new A.TextDecoder("utf-8",{fatal:!0})),r.decode(n)):t.decode(n)},checkUtf8(n){try{return encodeURIComponent(n),!0}catch{return!1}}}}return A[cp]}var _r;(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"})(_r||(_r={}));var kk=34028234663852886e22,Ok=-34028234663852886e22,Pk=4294967295,Nk=2147483647,Fk=-2147483648,ye=class{constructor(t=up().encodeUtf8){this.encodeUtf8=t,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let t=0;for(let o=0;o<this.chunks.length;o++)t+=this.chunks[o].length;let r=new Uint8Array(t),n=0;for(let o=0;o<this.chunks.length;o++)r.set(this.chunks[o],n),n+=this.chunks[o].length;return this.chunks=[],r}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let t=this.finish(),r=this.stack.pop();if(!r)throw new Error("invalid state, fork stack empty");return this.chunks=r.chunks,this.buf=r.buf,this.uint32(t.byteLength),this.raw(t)}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(Cv(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return lp(t),ap(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let r=this.encodeUtf8(t);return this.uint32(r.byteLength),this.raw(r)}float(t){Dk(t);let r=new Uint8Array(4);return new DataView(r.buffer).setFloat32(0,t,!0),this.raw(r)}double(t){let r=new Uint8Array(8);return new DataView(r.buffer).setFloat64(0,t,!0),this.raw(r)}fixed32(t){Cv(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){lp(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return lp(t),t=(t<<1^t>>31)>>>0,ap(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Lt.enc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}fixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Lt.uEnc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}int64(t){let r=Lt.enc(t);return Ac(r.lo,r.hi,this.buf),this}sint64(t){let r=Lt.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return Ac(o,i,this.buf),this}uint64(t){let r=Lt.uEnc(t);return Ac(r.lo,r.hi,this.buf),this}},X=class{constructor(t,r=up().decodeUtf8){this.decodeUtf8=r,this.varint64=yv,this.uint32=Av,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,i=r&7;if(o<=0||i>5)throw new Error("illegal tag: field no "+o+" wire type "+i);return[o,i]}skip(t,r){let n=this.pos;switch(t){case _r.Varint:for(;this.buf[this.pos++]&128;);break;case _r.Bit64:this.pos+=4;case _r.Bit32:this.pos+=4;break;case _r.LengthDelimited:let o=this.uint32();this.pos+=o;break;case _r.StartGroup:for(;;){let[i,s]=this.tag();if(s===_r.EndGroup){if(r!==void 0&&i!==r)throw new Error("invalid end group tag");break}this.skip(s,i)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return Lt.dec(...this.varint64())}uint64(){return Lt.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Lt.dec(t,r)}bool(){let[t,r]=this.varint64();return t!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Lt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Lt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){return this.decodeUtf8(this.bytes(),t)}};function lp(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>Nk||e<Fk)throw new Error("invalid int32: "+e)}function Cv(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>Pk||e<0)throw new Error("invalid uint32: "+e)}function Dk(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>kk||e<Ok))throw new Error("invalid float32: "+e)}var Mk=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function dp(){return{fields:{}}}var qi={encode(e,t=new ye){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&mp.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=dp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let s=mp.decode(r,r.uint32());s.value!==void 0&&(o.fields[s.key]=s.value);continue}}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return qi.fromPartial(e??{})},fromPartial(e){let t=dp();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=dp();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 xv(){return{key:"",value:void 0}}var mp={encode(e,t=new ye){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&le.encode(le.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=xv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=r.string();continue;case 2:if(i!==18)break;o.value=le.unwrap(le.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return mp.fromPartial(e??{})},fromPartial(e){let t=xv();return t.key=e.key??"",t.value=e.value??void 0,t}};function pp(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var le={encode(e,t=new ye){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&&qi.encode(qi.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Ui.encode(Ui.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=pp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.nullValue=r.int32();continue;case 2:if(i!==17)break;o.numberValue=r.double();continue;case 3:if(i!==26)break;o.stringValue=r.string();continue;case 4:if(i!==32)break;o.boolValue=r.bool();continue;case 5:if(i!==42)break;o.structValue=qi.unwrap(qi.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=Ui.unwrap(Ui.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return le.fromPartial(e??{})},fromPartial(e){let t=pp();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=pp();if(e===null)t.nullValue=Mk.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(A.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new A.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 fp(){return{values:[]}}var Ui={encode(e,t=new ye){for(let r of e.values)le.encode(le.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=fp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(le.unwrap(le.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ui.fromPartial(e??{})},fromPartial(e){let t=fp();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=fp();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&A.Array.isArray(e.values)?e.values:e}},Lk=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 Ev(){return{op:0,path:"",from:void 0,value:void 0}}var wc={encode(e,t=new ye){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&&le.encode(le.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Ev();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.op=r.int32();continue;case 2:if(i!==18)break;o.path=r.string();continue;case 3:if(i!==26)break;o.from=r.string();continue;case 4:if(i!==34)break;o.value=le.unwrap(le.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return wc.fromPartial(e??{})},fromPartial(e){let t=Ev();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function Iv(){return{id:"",type:"",function:void 0}}var Cc={encode(e,t=new ye){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&xc.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Iv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.type=r.string();continue;case 3:if(i!==26)break;o.function=xc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Cc.fromPartial(e??{})},fromPartial(e){let t=Iv();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?xc.fromPartial(e.function):void 0,t}};function Rv(){return{name:"",arguments:""}}var xc={encode(e,t=new ye){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 X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Rv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.name=r.string();continue;case 2:if(i!==18)break;o.arguments=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xc.fromPartial(e??{})},fromPartial(e){let t=Rv();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function Tv(){return{value:"",mimeType:""}}var Ec={encode(e,t=new ye){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 X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Tv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ec.fromPartial(e??{})},fromPartial(e){let t=Tv();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function _v(){return{value:"",mimeType:void 0}}var Ic={encode(e,t=new ye){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 X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=_v();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ic.fromPartial(e??{})},fromPartial(e){let t=_v();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function kv(){return{data:void 0,url:void 0}}var vt={encode(e,t=new ye){return e.data!==void 0&&Ec.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Ic.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=kv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=Ec.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=Ic.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vt.fromPartial(e??{})},fromPartial(e){let t=kv();return t.data=e.data!==void 0&&e.data!==null?Ec.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Ic.fromPartial(e.url):void 0,t}};function Ov(){return{text:""}}var Rc={encode(e,t=new ye){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Ov();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Rc.fromPartial(e??{})},fromPartial(e){let t=Ov();return t.text=e.text??"",t}};function Pv(){return{source:void 0,metadata:void 0}}var Tc={encode(e,t=new ye){return e.source!==void 0&&vt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&le.encode(le.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Pv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=vt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=le.unwrap(le.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Tc.fromPartial(e??{})},fromPartial(e){let t=Pv();return t.source=e.source!==void 0&&e.source!==null?vt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Nv(){return{source:void 0,metadata:void 0}}var _c={encode(e,t=new ye){return e.source!==void 0&&vt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&le.encode(le.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Nv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=vt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=le.unwrap(le.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return _c.fromPartial(e??{})},fromPartial(e){let t=Nv();return t.source=e.source!==void 0&&e.source!==null?vt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Fv(){return{source:void 0,metadata:void 0}}var kc={encode(e,t=new ye){return e.source!==void 0&&vt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&le.encode(le.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Fv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=vt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=le.unwrap(le.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return kc.fromPartial(e??{})},fromPartial(e){let t=Fv();return t.source=e.source!==void 0&&e.source!==null?vt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Dv(){return{source:void 0,metadata:void 0}}var Oc={encode(e,t=new ye){return e.source!==void 0&&vt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&le.encode(le.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Dv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=vt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=le.unwrap(le.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Oc.fromPartial(e??{})},fromPartial(e){let t=Dv();return t.source=e.source!==void 0&&e.source!==null?vt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Mv(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var Pc={encode(e,t=new ye){return e.text!==void 0&&Rc.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Tc.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&_c.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&kc.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Oc.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Mv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=Rc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=Tc.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=_c.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=kc.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=Oc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Pc.fromPartial(e??{})},fromPartial(e){let t=Mv();return t.text=e.text!==void 0&&e.text!==null?Rc.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Tc.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?_c.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?kc.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Oc.fromPartial(e.document):void 0,t}};function Lv(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var Nc={encode(e,t=new ye){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)Cc.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)Pc.encode(r,t.uint32(66).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Lv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.role=r.string();continue;case 3:if(i!==26)break;o.content=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue;case 5:if(i!==42)break;o.toolCalls.push(Cc.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.toolCallId=r.string();continue;case 7:if(i!==58)break;o.error=r.string();continue;case 8:if(i!==66)break;o.contentParts.push(Pc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Nc.fromPartial(e??{})},fromPartial(e){let t=Lv();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=>Cc.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>Pc.fromPartial(r))||[],t}},jk=function(e){return e[e.TEXT_MESSAGE_START=0]="TEXT_MESSAGE_START",e[e.TEXT_MESSAGE_CONTENT=1]="TEXT_MESSAGE_CONTENT",e[e.TEXT_MESSAGE_END=2]="TEXT_MESSAGE_END",e[e.TOOL_CALL_START=3]="TOOL_CALL_START",e[e.TOOL_CALL_ARGS=4]="TOOL_CALL_ARGS",e[e.TOOL_CALL_END=5]="TOOL_CALL_END",e[e.STATE_SNAPSHOT=6]="STATE_SNAPSHOT",e[e.STATE_DELTA=7]="STATE_DELTA",e[e.MESSAGES_SNAPSHOT=8]="MESSAGES_SNAPSHOT",e[e.RAW=9]="RAW",e[e.CUSTOM=10]="CUSTOM",e[e.RUN_STARTED=11]="RUN_STARTED",e[e.RUN_FINISHED=12]="RUN_FINISHED",e[e.RUN_ERROR=13]="RUN_ERROR",e[e.STEP_STARTED=14]="STEP_STARTED",e[e.STEP_FINISHED=15]="STEP_FINISHED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function jv(){return{type:0,timestamp:void 0,rawEvent:void 0}}var se={encode(e,t=new ye){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&le.encode(le.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=jv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.type=r.int32();continue;case 2:if(i!==16)break;o.timestamp=qk(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=le.unwrap(le.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return se.fromPartial(e??{})},fromPartial(e){let t=jv();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function qv(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var Fc={encode(e,t=new ye){return e.baseEvent!==void 0&&se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=qv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Fc.fromPartial(e??{})},fromPartial(e){let t=qv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function Uv(){return{baseEvent:void 0,messageId:"",delta:""}}var Dc={encode(e,t=new ye){return e.baseEvent!==void 0&&se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Uv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Dc.fromPartial(e??{})},fromPartial(e){let t=Uv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function Vv(){return{baseEvent:void 0,messageId:""}}var Mc={encode(e,t=new ye){return e.baseEvent!==void 0&&se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Vv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Mc.fromPartial(e??{})},fromPartial(e){let t=Vv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function Gv(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var Lc={encode(e,t=new ye){return e.baseEvent!==void 0&&se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Gv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Lc.fromPartial(e??{})},fromPartial(e){let t=Gv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function Bv(){return{baseEvent:void 0,toolCallId:"",delta:""}}var jc={encode(e,t=new ye){return e.baseEvent!==void 0&&se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Bv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return jc.fromPartial(e??{})},fromPartial(e){let t=Bv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function $v(){return{baseEvent:void 0,toolCallId:""}}var qc={encode(e,t=new ye){return e.baseEvent!==void 0&&se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=$v();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return qc.fromPartial(e??{})},fromPartial(e){let t=$v();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function Qv(){return{baseEvent:void 0,snapshot:void 0}}var Uc={encode(e,t=new ye){return e.baseEvent!==void 0&&se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&le.encode(le.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Qv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=le.unwrap(le.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Uc.fromPartial(e??{})},fromPartial(e){let t=Qv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function Hv(){return{baseEvent:void 0,delta:[]}}var Vc={encode(e,t=new ye){e.baseEvent!==void 0&&se.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)wc.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Hv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(wc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Vc.fromPartial(e??{})},fromPartial(e){let t=Hv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>wc.fromPartial(r))||[],t}};function zv(){return{baseEvent:void 0,messages:[]}}var Gc={encode(e,t=new ye){e.baseEvent!==void 0&&se.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Nc.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=zv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(Nc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Gc.fromPartial(e??{})},fromPartial(e){let t=zv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Nc.fromPartial(r))||[],t}};function Wv(){return{baseEvent:void 0,event:void 0,source:void 0}}var Bc={encode(e,t=new ye){return e.baseEvent!==void 0&&se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&le.encode(le.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Wv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=le.unwrap(le.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.source=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Bc.fromPartial(e??{})},fromPartial(e){let t=Wv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function Kv(){return{baseEvent:void 0,name:"",value:void 0}}var $c={encode(e,t=new ye){return e.baseEvent!==void 0&&se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&le.encode(le.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Kv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=le.unwrap(le.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return $c.fromPartial(e??{})},fromPartial(e){let t=Kv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function Yv(){return{baseEvent:void 0,threadId:"",runId:""}}var Qc={encode(e,t=new ye){return e.baseEvent!==void 0&&se.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 X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Yv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Qc.fromPartial(e??{})},fromPartial(e){let t=Yv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function Xv(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0}}var Hc={encode(e,t=new ye){return e.baseEvent!==void 0&&se.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&&le.encode(le.wrap(e.result),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Xv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue;case 4:if(i!==34)break;o.result=le.unwrap(le.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Hc.fromPartial(e??{})},fromPartial(e){let t=Xv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t}};function Zv(){return{baseEvent:void 0,code:void 0,message:""}}var zc={encode(e,t=new ye){return e.baseEvent!==void 0&&se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Zv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.code=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return zc.fromPartial(e??{})},fromPartial(e){let t=Zv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function Jv(){return{baseEvent:void 0,stepName:""}}var Wc={encode(e,t=new ye){return e.baseEvent!==void 0&&se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Jv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Wc.fromPartial(e??{})},fromPartial(e){let t=Jv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function eS(){return{baseEvent:void 0,stepName:""}}var Kc={encode(e,t=new ye){return e.baseEvent!==void 0&&se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=eS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Kc.fromPartial(e??{})},fromPartial(e){let t=eS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function tS(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var Yc={encode(e,t=new ye){return e.baseEvent!==void 0&&se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=tS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.delta=r.string();continue;case 5:if(i!==42)break;o.name=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Yc.fromPartial(e??{})},fromPartial(e){let t=tS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t}};function rS(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var Xc={encode(e,t=new ye){return e.baseEvent!==void 0&&se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=rS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue;case 5:if(i!==42)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Xc.fromPartial(e??{})},fromPartial(e){let t=rS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?se.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function nS(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0}}var oS={encode(e,t=new ye){return e.textMessageStart!==void 0&&Fc.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Dc.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Mc.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Lc.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&jc.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&qc.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Uc.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Vc.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Gc.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Bc.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&$c.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Qc.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Hc.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&zc.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Wc.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Kc.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Yc.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Xc.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=nS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=Fc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=Dc.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=Mc.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=Lc.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=jc.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=qc.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=Uc.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Vc.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=Gc.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Bc.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=$c.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Qc.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Hc.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=zc.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Wc.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=Kc.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=Yc.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Xc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return oS.fromPartial(e??{})},fromPartial(e){let t=nS();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Fc.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Dc.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Mc.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Lc.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?jc.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?qc.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Uc.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Vc.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Gc.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Bc.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?$c.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Qc.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Hc.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?zc.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Wc.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Kc.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Yc.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Xc.fromPartial(e.toolCallChunk):void 0,t}};function qk(e){let t=A.Number(e.toString());if(t>A.Number.MAX_SAFE_INTEGER)throw new A.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<A.Number.MIN_SAFE_INTEGER)throw new A.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var bc=e=>{if(!(!e||typeof e!="object")){if(e.data)return{type:"data",value:e.data.value,mimeType:e.data.mimeType};if(e.url)return{type:"url",value:e.url.value,mimeType:e.url.mimeType}}},Uk=e=>{if(!(!e||typeof e!="object")){if(e.text)return{type:"text",text:e.text.text};if(e.image)return{type:"image",source:bc(e.image.source),metadata:e.image.metadata};if(e.audio)return{type:"audio",source:bc(e.audio.source),metadata:e.audio.metadata};if(e.video)return{type:"video",source:bc(e.video.source),metadata:e.video.metadata};if(e.document)return{type:"document",source:bc(e.document.source),metadata:e.document.metadata}}};function iS(e){let t=oS.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=jk[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.type===D.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;if(o.role==="user"&&Array.isArray(o.contentParts)){let i=o.contentParts.map(s=>Uk(s)).filter(s=>s!==void 0);i.length>0&&(o.content=i)}Array.isArray(o.contentParts)&&o.contentParts.length===0&&(o.contentParts=void 0),o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===D.STATE_DELTA)for(let n of r.delta)n.op=Lk[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]}),ja.parse(r)}var gp="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var Gk=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,hp=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(Gk);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},sS=e=>e==="*"||e==="x"||e==="X",aS=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},Bk=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],$k=(e,t)=>{if(sS(e)||sS(t))return 0;let[r,n]=Bk(aS(e),aS(t));return r>n?1:r<n?-1:0},yp=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=$k(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Vi=(e,t)=>{let r=hp(e),n=hp(t),o=r.pop(),i=n.pop(),s=yp(r,n);return s!==0?s:o&&i?yp(o.split("."),i.split(".")):o||i?o?-1:1:0};var Ee=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function Gi(){return xr()}function Ap(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&Ap(t);return e}function Re(_x83,_x84,_x85,_x86){return _Re.apply(this,arguments)}function _Re(){_Re=_asyncToGenerator(function*(e,t,r,n){let o=typeof process<"u"&&process.env!==void 0,i=o&&!!process.env.VITEST_WORKER_ID,s=o&&!!process.env.VITEST_WORKER_ID,a=Ee(t),u=Ee(r),c=a,g=u,v;for(let E of e)try{s&&(Ap(c),Ap(g));let h=yield n(E,c,g);if(h===void 0)continue;if(h.messages!==void 0&&h.messages!==c&&(c=Ee(h.messages)),h.state!==void 0&&h.state!==g&&(g=Ee(h.state)),v=h.stopPropagation,v===!0)break}catch(h){if(s&&h instanceof TypeError){if(i)throw h;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",h)}else i||console.error("Subscriber error:",h);continue}return{...(c===a?{}:{messages:s&&Object.isFrozen(c)?Ee(c):c}),...(g===u?{}:{state:s&&Object.isFrozen(g)?Ee(g):g}),...(v===void 0?{}:{stopPropagation:v})}});return _Re.apply(this,arguments)}function Zc(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 Bi(e){if(e instanceof bp)return e;if(e===!0)return new bp(Zc(!0))}var bp=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 vp(e){return e.enabled?new bp(e):void 0}function Qk(e,t,r){if(t){let o=e.find(s=>s.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 i={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(i),i}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}var fS=(e,t,r,n,o)=>{let i=Bi(o),s=Ee(r.messages),a=Ee(e.state),u={},c=v=>{v.messages!==void 0&&(s=v.messages,u.messages=v.messages),v.state!==void 0&&(a=v.state,u.state=v.state)},g=()=>{let v=Ee(u);return u={},v.messages!==void 0||v.state!==void 0?Me(v):tc};return t.pipe(hc(/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(v){let E=yield Re(n,s,a,(h,y,S)=>h.onEvent?.({event:v,agent:r,input:e,messages:y,state:S}));if(c(E),E.stopPropagation===!0?i?.event("APPLY","Event dropped:",v,{type:v.type,reason:"stopPropagation by subscriber"}):i?.event("APPLY","Event applied:",v,{type:v.type,subscribers:n.length}),E.stopPropagation===!0)return g();switch(v.type){case D.TEXT_MESSAGE_START:{let h=yield Re(n,s,a,(y,S,x)=>y.onTextMessageStartEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,role:S="assistant",name:x}=v;if(!s.find(I=>I.id===y)){let I={id:y,role:S,content:"",...(x!==void 0&&{name:x})};s.push(I),c({messages:s})}}return g()}case D.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,S=s.find(I=>I.id===h);if(!S)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let x=yield Re(n,s,a,(I,T,R)=>I.onTextMessageContentEvent?.({event:v,messages:T,state:R,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}));return c(x),x.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${y}`,c({messages:s})),g()}case D.TEXT_MESSAGE_END:{let{messageId:h}=v,y=s.find(S=>S.id===h);return y?(c(yield Re(n,s,a,(S,x,I)=>S.onTextMessageEndEvent?.({event:v,messages:x,state:I,agent:r,input:e,textMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(S=>{S.onNewMessage?.({message:y,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g())}case D.TOOL_CALL_START:{let h=yield Re(n,s,a,(y,S,x)=>y.onToolCallStartEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:S,parentMessageId:x}=v,I=Qk(s,x,y);I.toolCalls??(I.toolCalls=[]),I.toolCalls.push({id:y,type:"function",function:{name:S,arguments:""}}),c({messages:s})}return g()}case D.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=v,S=s.find(T=>T.toolCalls?.some(R=>R.id===h));if(!S)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let x=S.toolCalls?.find(T=>T.id===h);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=yield Re(n,s,a,(T,R,k)=>{let _=x.function.arguments,F=x.function.name,V={};try{V=vc(_)}catch{}return T.onToolCallArgsEvent?.({event:v,messages:R,state:k,agent:r,input:e,toolCallBuffer:_,toolCallName:F,partialToolCallArgs:V})});return c(I),I.stopPropagation!==!0&&(x.function.arguments+=y,c({messages:s})),g()}case D.TOOL_CALL_END:{let{toolCallId:h}=v,y=s.find(x=>x.toolCalls?.some(I=>I.id===h));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let S=y.toolCalls?.find(x=>x.id===h);return S?(c(yield Re(n,s,a,(x,I,T)=>{let R=S.function.arguments,k=S.function.name,_={};try{_=JSON.parse(R)}catch{}return x.onToolCallEndEvent?.({event:v,messages:I,state:T,agent:r,input:e,toolCallName:k,toolCallArgs:_})})),yield Promise.all(n.map(x=>{x.onNewToolCall?.({toolCall:S,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g())}case D.TOOL_CALL_RESULT:{let h=yield Re(n,s,a,(y,S,x)=>y.onToolCallResultEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:S,content:x,role:I}=v,T={id:y,toolCallId:S,role:I||"tool",content:x};s.push(T),yield Promise.all(n.map(R=>{R.onNewMessage?.({message:T,messages:s,state:a,agent:r,input:e})})),c({messages:s})}return g()}case D.STATE_SNAPSHOT:{let h=yield Re(n,s,a,(y,S,x)=>y.onStateSnapshotEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{snapshot:y}=v;a=y,c({state:a})}return g()}case D.STATE_DELTA:{let h=yield Re(n,s,a,(y,S,x)=>y.onStateDeltaEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{delta:y}=v;try{a=Ha.applyPatch(a,y,!0,!1).newDocument,c({state:a})}catch(S){let x=S instanceof Error?S.message:String(S);console.warn(`Failed to apply state patch:
35
+ `):"",this.name="UnsubscriptionError",this.errors=r}});m();d();f();p();function Di(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var So=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,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=fr(s),u=a.next();!u.done;u=a.next()){var c=u.value;c.remove(this)}}catch(S){t={error:S}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var g=this.initialTeardown;if(Se(g))try{g()}catch(S){i=S instanceof Wa?S.errors:[S]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var E=fr(v),h=E.next();!h.done;h=E.next()){var y=h.value;try{Xy(y)}catch(S){i=i??[],S instanceof Wa?i=yo(yo([],ho(i)),ho(S.errors)):i.push(S)}}}catch(S){n={error:S}}finally{try{h&&!h.done&&(o=E.return)&&o.call(E)}finally{if(n)throw n.error}}}if(i)throw new Wa(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Xy(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)&&Di(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Di(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Kd=So.EMPTY;function Ka(e){return e instanceof So||e&&"closed"in e&&Se(e.remove)&&Se(e.add)&&Se(e.unsubscribe)}function Xy(e){Se(e)?e():e.unsubscribe()}m();d();f();p();var Mt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var Ao={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Ao.delegate;return o?.setTimeout?o.setTimeout.apply(o,yo([e,t],ho(r))):setTimeout.apply(void 0,yo([e,t],ho(r)))},clearTimeout:function(e){var t=Ao.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Ya(e){Ao.setTimeout(function(){var t=Mt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function Mi(){}m();d();f();p();var Zy=function(){return Yd("C",void 0,void 0)}();function Jy(e){return Yd("E",void 0,e)}function ev(e){return Yd("N",e,void 0)}function Yd(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var bn=null;function bo(e){if(Mt.useDeprecatedSynchronousErrorHandling){var t=!bn;if(t&&(bn={errorThrown:!1,error:null}),e(),t){var r=bn,n=r.errorThrown,o=r.error;if(bn=null,n)throw o}}else e()}function tv(e){Mt.useDeprecatedSynchronousErrorHandling&&bn&&(bn.errorThrown=!0,bn.error=e)}var Li=function(e){Kt(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Ka(r)&&r.add(n)):n.destination=xk,n}return t.create=function(r,n,o){return new Za(r,n,o)},t.prototype.next=function(r){this.isStopped?Zd(ev(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Zd(Jy(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Zd(Zy,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}(So);var bk=Function.prototype.bind;function Xd(e,t){return bk.call(e,t)}var wk=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){Xa(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Xa(n)}else Xa(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Xa(r)}},e}(),Za=function(e){Kt(t,e);function t(r,n,o){var i=e.call(this)||this,s;if(Se(r)||!r)s={next:r??void 0,error:n??void 0,complete:o??void 0};else{var a;i&&Mt.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return i.unsubscribe()},s={next:r.next&&Xd(r.next,a),error:r.error&&Xd(r.error,a),complete:r.complete&&Xd(r.complete,a)}):s=r}return i.destination=new wk(s),i}return t}(Li);function Xa(e){Mt.useDeprecatedSynchronousErrorHandling?tv(e):Ya(e)}function Ck(e){throw e}function Zd(e,t){var r=Mt.onStoppedNotification;r&&Ao.setTimeout(function(){return r(e,t)})}var xk={closed:!0,next:Mi,error:Ck,complete:Mi};m();d();f();p();var wo=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function Co(e){return e}function Ja(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Jd(e)}function Jd(e){return e.length===0?Co:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var Ne=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,i=Ik(t)?t:new Za(t,r,n);return bo(function(){var s=o,a=s.operator,u=s.source;i.add(a?a.call(i,u):u?o._subscribe(i):o._trySubscribe(i))}),i},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=rv(r),new r(function(o,i){var s=new Za({next:function(a){try{t(a)}catch(u){i(u),s.unsubscribe()}},error:i,complete:o});n.subscribe(s)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[wo]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Jd(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=rv(t),new t(function(n,o){var i;r.subscribe(function(s){return i=s},function(s){return o(s)},function(){return n(i)})})},e.create=function(t){return new e(t)},e}();function rv(e){var t;return(t=e??Mt.Promise)!==null&&t!==void 0?t:Promise}function Ek(e){return e&&Se(e.next)&&Se(e.error)&&Se(e.complete)}function Ik(e){return e&&e instanceof Li||Ek(e)&&Ka(e)}m();d();f();p();function Rk(e){return Se(e?.lift)}function Ve(e){return function(t){if(Rk(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")}}m();d();f();p();function He(e,t,r,n,o){return new Tk(e,t,r,n,o)}var Tk=function(e){Kt(t,e);function t(r,n,o,i,s,a){var u=e.call(this,r)||this;return u.onFinalize=s,u.shouldUnsubscribe=a,u._next=n?function(c){try{n(c)}catch(g){r.error(g)}}:e.prototype._next,u._error=i?function(c){try{i(c)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=o?function(){try{o()}catch(c){r.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,u}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}(Li);m();d();f();p();m();d();f();p();var nv=vo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Yt=function(e){Kt(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 ov(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new nv},t.prototype.next=function(r){var n=this;bo(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=fr(n.currentObservers),a=s.next();!a.done;a=s.next()){var u=a.value;u.next(r)}}catch(c){o={error:c}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;bo(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;bo(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,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Kd:(this.currentObservers=null,a.push(r),new So(function(){n.currentObservers=null,Di(a,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},t.prototype.asObservable=function(){var r=new Ne;return r.source=this,r},t.create=function(r,n){return new ov(r,n)},t}(Ne);var ov=function(e){Kt(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:Kd},t}(Yt);m();d();f();p();m();d();f();p();var ep={now:function(){return(ep.delegate||Date).now()},delegate:void 0};var ec=function(e){Kt(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=ep);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,u=n._windowTime;o||(i.push(r),!s&&i.push(a.now()+u)),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,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),u=0;u<a.length&&!r.closed;u+=i?1:2)r.next(a[u]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,i=r._buffer,s=r._infiniteTimeWindow,a=(s?1:2)*n;if(n<1/0&&a<i.length&&i.splice(0,i.length-a),!s){for(var u=o.now(),c=0,g=1;g<i.length&&i[g]<=u;g+=2)c=g;c&&i.splice(0,c+1)}},t}(Yt);m();d();f();p();var tc=new Ne(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function iv(e){return e&&Se(e.schedule)}function _k(e){return e[e.length-1]}function sv(e){return iv(_k(e))?e.pop():void 0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var rc=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function nc(e){return Se(e?.then)}m();d();f();p();function oc(e){return Se(e[wo])}m();d();f();p();function ic(e){return Symbol.asyncIterator&&Se(e?.[Symbol.asyncIterator])}m();d();f();p();function sc(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.")}m();d();f();p();m();d();f();p();function kk(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var ac=kk();function cc(e){return Se(e?.[ac])}m();d();f();p();function uc(e){return Ky(this,arguments,function(){var r,n,o,i;return za(this,function(s){switch(s.label){case 0:r=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,An(r.read())];case 3:return n=s.sent(),o=n.value,i=n.done,i?[4,An(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,An(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function lc(e){return Se(e?.getReader)}function ze(e){if(e instanceof Ne)return e;if(e!=null){if(oc(e))return Ok(e);if(rc(e))return Pk(e);if(nc(e))return Nk(e);if(ic(e))return av(e);if(cc(e))return Fk(e);if(lc(e))return Dk(e)}throw sc(e)}function Ok(e){return new Ne(function(t){var r=e[wo]();if(Se(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Pk(e){return new Ne(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function Nk(e){return new Ne(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Ya)})}function Fk(e){return new Ne(function(t){var r,n;try{for(var o=fr(e),i=o.next();!i.done;i=o.next()){var s=i.value;if(t.next(s),t.closed)return}}catch(a){r={error:a}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function av(e){return new Ne(function(t){Mk(e,t).catch(function(r){return t.error(r)})})}function Dk(e){return av(uc(e))}function Mk(e,t){var r,n,o,i;return Wy(this,void 0,void 0,function(){var s,a;return za(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),r=Yy(e),u.label=1;case 1:return[4,r.next()];case 2:if(n=u.sent(),!!n.done)return[3,4];if(s=n.value,t.next(s),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=u.sent(),o={error:a},[3,11];case 6:return u.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:u.sent(),u.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]}})})}m();d();f();p();m();d();f();p();function It(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!o)return i}function dc(e,t){return t===void 0&&(t=0),Ve(function(r,n){r.subscribe(He(n,function(o){return It(n,e,function(){return n.next(o)},t)},function(){return It(n,e,function(){return n.complete()},t)},function(o){return It(n,e,function(){return n.error(o)},t)}))})}m();d();f();p();function pc(e,t){return t===void 0&&(t=0),Ve(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function cv(e,t){return ze(e).pipe(pc(t),dc(t))}m();d();f();p();function uv(e,t){return ze(e).pipe(pc(t),dc(t))}m();d();f();p();function lv(e,t){return new Ne(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}m();d();f();p();function dv(e,t){return new Ne(function(r){var n;return It(r,t,function(){n=e[ac](),It(r,t,function(){var o,i,s;try{o=n.next(),i=o.value,s=o.done}catch(a){r.error(a);return}s?r.complete():r.next(i)},0,!0)}),function(){return Se(n?.return)&&n.return()}})}m();d();f();p();function fc(e,t){if(!e)throw new Error("Iterable cannot be null");return new Ne(function(r){It(r,t,function(){var n=e[Symbol.asyncIterator]();It(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}m();d();f();p();function pv(e,t){return fc(uc(e),t)}function fv(e,t){if(e!=null){if(oc(e))return cv(e,t);if(rc(e))return lv(e,t);if(nc(e))return uv(e,t);if(ic(e))return fc(e,t);if(cc(e))return dv(e,t);if(lc(e))return pv(e,t)}throw sc(e)}function wn(e,t){return t?fv(e,t):ze(e)}function Me(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=sv(e);return wn(e,r)}m();d();f();p();function Fe(e,t){var r=Se(e)?e:function(){return e},n=function(o){return o.error(r())};return new Ne(t?function(o){return t.schedule(n,0,o)}:n)}m();d();f();p();m();d();f();p();var mv=vo(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function mc(e,t){var r=typeof t=="object";return new Promise(function(n,o){var i=!1,s;e.subscribe({next:function(a){s=a,i=!0},error:o,complete:function(){i?n(s):r?n(t.defaultValue):o(new mv)}})})}m();d();f();p();function Cn(e,t){return Ve(function(r,n){var o=0;r.subscribe(He(n,function(i){n.next(e.call(t,i,o++))}))})}m();d();f();p();m();d();f();p();m();d();f();p();function gv(e,t,r,n,o,i,s,a){var u=[],c=0,g=0,v=!1,E=function(){v&&!u.length&&!c&&t.complete()},h=function(S){return c<n?y(S):u.push(S)},y=function(S){i&&t.next(S),c++;var x=!1;ze(r(S,g++)).subscribe(He(t,function(I){o?.(I),i?h(I):t.next(I)},function(){x=!0},void 0,function(){if(x)try{c--;for(var I=function(){var T=u.shift();s?It(t,s,function(){return y(T)}):y(T)};u.length&&c<n;)I();E()}catch(T){t.error(T)}}))};return e.subscribe(He(t,h,function(){v=!0,E()})),function(){a?.()}}function dt(e,t,r){return r===void 0&&(r=1/0),Se(t)?dt(function(n,o){return Cn(function(i,s){return t(n,i,o,s)})(ze(e(n,o)))},r):(typeof t=="number"&&(r=t),Ve(function(n,o){return gv(n,o,e,r)}))}function tp(e){return e===void 0&&(e=1/0),dt(Co,e)}m();d();f();p();function gc(e){return new Ne(function(t){ze(e()).subscribe(t)})}m();d();f();p();function ji(e){return Ve(function(t,r){var n=null,o=!1,i;n=t.subscribe(He(r,void 0,void 0,function(s){i=ze(e(s,ji(e)(t))),n?(n.unsubscribe(),n=null,i.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(r))})}m();d();f();p();function hc(e,t){return Se(t)?dt(e,t,1):dt(e,1)}m();d();f();p();function rp(e){return Ve(function(t,r){var n=!1;t.subscribe(He(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}m();d();f();p();function xn(e){return Ve(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function np(e,t){return Ve(function(r,n){var o=null,i=0,s=!1,a=function(){return s&&!o&&n.complete()};r.subscribe(He(n,function(u){o?.unsubscribe();var c=0,g=i++;ze(e(u,g)).subscribe(o=He(n,function(v){return n.next(t?t(u,v,g,c++):v)},function(){o=null,a()}))},function(){s=!0,a()}))})}m();d();f();p();function yc(e){return Ve(function(t,r){ze(e).subscribe(He(r,function(){return r.complete()},Mi)),!r.closed&&t.subscribe(r)})}m();d();f();p();function op(e,t,r){var n=Se(e)||t||r?{next:e,error:t,complete:r}:e;return n?Ve(function(o,i){var s;(s=n.subscribe)===null||s===void 0||s.call(n);var a=!0;o.subscribe(He(i,function(u){var c;(c=n.next)===null||c===void 0||c.call(n,u),i.next(u)},function(){var u;a=!1,(u=n.complete)===null||u===void 0||u.call(n),i.complete()},function(u){var c;a=!1,(c=n.error)===null||c===void 0||c.call(n,u),i.error(u)},function(){var u,c;a&&((u=n.unsubscribe)===null||u===void 0||u.call(n)),(c=n.finalize)===null||c===void 0||c.call(n)}))}):Co}m();d();f();p();m();d();f();p();function hv(e){return` \r
36
+ `.indexOf(e)>=0}function vc(e){for(var t=["topLevel"],r=0,n,o,i,s=function(T){return t.push(T)},a=function(T){return t[t.length-1]=T},u=function(T){n==null&&(n=r,o=t.length,i=T)},c=function(T){T===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},E=function(T){if("0"<=T&&T<="9"){s("number");return}switch(T){case"\"":s("string");return;case"-":s("numberNeedsDigit");return;case"t":s("true");return;case"f":s("false");return;case"n":s("null");return;case"[":s("arrayNeedsValue");return;case"{":s("objectNeedsKey");return}},h=e.length;r<h;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":E(y);break;case"string":switch(y){case"\"":g();break;case"\\":u("stringEscape"),s("stringEscaped");break}break;case"stringEscaped":y==="u"?s("stringUnicode"):(c("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(c("stringEscape"),g());break;case"number":y==="."?a("numberNeedsDigit"):y==="e"||y==="E"?a("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),g());break;case"numberNeedsDigit":a("number");break;case"numberNeedsExponent":a(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),g());break;case"arrayNeedsValue":y==="]"?g():hv(y)||(c("collectionItem"),a("arrayNeedsComma"),E(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(u("collectionItem"),a("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(u("collectionItem"),a("objectNeedsColon"),s("string"));break;case"objectNeedsColon":y===":"&&a("objectNeedsValue");break;case"objectNeedsValue":hv(y)||(c("collectionItem"),a("objectNeedsComma"),E(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(u("collectionItem"),a("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var S=[n!=null?e.slice(0,n):e],x=function(T){return S.push(T.slice(e.length-e.lastIndexOf(T[0])))},I=t.length-1;I>=0;I--)switch(t[I]){case"string":S.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":S.push("0");break;case"true":x("true");break;case"false":x("false");break;case"null":x("null");break;case"arrayNeedsValue":case"arrayNeedsComma":S.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":S.push("}");break}return S.join("")}m();d();f();p();m();d();f();p();m();d();f();p();function vv(){let e=0,t=0;for(let n=0;n<28;n+=7){let o=this.buf[this.pos++];if(e|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}let r=this.buf[this.pos++];if(e|=(r&15)<<28,t=(r&112)>>4,(r&128)==0)return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let o=this.buf[this.pos++];if(t|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function Ac(e,t,r){for(let i=0;i<28;i=i+7){let s=e>>>i,a=!(!(s>>>7)&&t==0),u=(a?s|128:s)&255;if(r.push(u),!a)return}let n=e>>>28&15|(t&7)<<4,o=t>>3!=0;if(r.push((o?n|128:n)&255),!!o){for(let i=3;i<31;i=i+7){let s=t>>>i,a=!!(s>>>7),u=(a?s|128:s)&255;if(r.push(u),!a)return}r.push(t>>>31&1)}}var Sc=4294967296;function ip(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(s,a){let u=Number(e.slice(s,a));o*=r,n=n*r+u,n>=Sc&&(o=o+(n/Sc|0),n=n%Sc)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?Av(n,o):ap(n,o)}function Sv(e,t){let r=ap(e,t),n=r.hi&2147483648;n&&(r=Av(r.lo,r.hi));let o=sp(r.lo,r.hi);return n?"-"+o:o}function sp(e,t){if({lo:e,hi:t}=Lk(e,t),t<=2097151)return String(Sc*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,i=r+n*6777216+o*6710656,s=n+o*8147497,a=o*2,u=1e7;return i>=u&&(s+=Math.floor(i/u),i%=u),s>=u&&(a+=Math.floor(s/u),s%=u),a.toString()+yv(s)+yv(i)}function Lk(e,t){return{lo:e>>>0,hi:t>>>0}}function ap(e,t){return{lo:e|0,hi:t|0}}function Av(e,t){return t=~t,e?e=~e+1:t+=1,ap(e,t)}var yv=e=>{let t=String(e);return"0000000".slice(t.length)+t};function cp(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let r=0;r<9;r++)t.push(e&127|128),e=e>>7;t.push(1)}}function bv(){let e=this.buf[this.pos++],t=e&127;if((e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)==0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!=0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();f();p();var Lt=jk();function jk(){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"&&(!!b.Deno||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(s){let a=typeof s=="bigint"?s:BigInt(s);if(a>n||a<r)throw new Error(`invalid int64: ${s}`);return a},uParse(s){let a=typeof s=="bigint"?s:BigInt(s);if(a>i||a<o)throw new Error(`invalid uint64: ${s}`);return a},enc(s){return e.setBigInt64(0,this.parse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(s){return e.setBigInt64(0,this.uParse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigInt64(0,!0)},uDec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),wv(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),Cv(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),wv(r),ip(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),Cv(r),ip(r)},dec(r,n){return Sv(r,n)},uDec(r,n){return sp(r,n)}}}function wv(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function Cv(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var up=Symbol.for("@bufbuild/protobuf/text-encoding");function lp(){if(b[up]==null){let e=new b.TextEncoder,t=new b.TextDecoder,r;b[up]={encodeUtf8(n){return e.encode(n)},decodeUtf8(n,o){return o?(r===void 0&&(r=new b.TextDecoder("utf-8",{fatal:!0})),r.decode(n)):t.decode(n)},checkUtf8(n){try{return encodeURIComponent(n),!0}catch{return!1}}}}return b[up]}var _r;(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"})(_r||(_r={}));var qk=34028234663852886e22,Uk=-34028234663852886e22,Vk=4294967295,Gk=2147483647,Bk=-2147483648,ge=class{constructor(t=lp().encodeUtf8){this.encodeUtf8=t,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let t=0;for(let o=0;o<this.chunks.length;o++)t+=this.chunks[o].length;let r=new Uint8Array(t),n=0;for(let o=0;o<this.chunks.length;o++)r.set(this.chunks[o],n),n+=this.chunks[o].length;return this.chunks=[],r}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let t=this.finish(),r=this.stack.pop();if(!r)throw new Error("invalid state, fork stack empty");return this.chunks=r.chunks,this.buf=r.buf,this.uint32(t.byteLength),this.raw(t)}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(xv(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return dp(t),cp(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let r=this.encodeUtf8(t);return this.uint32(r.byteLength),this.raw(r)}float(t){$k(t);let r=new Uint8Array(4);return new DataView(r.buffer).setFloat32(0,t,!0),this.raw(r)}double(t){let r=new Uint8Array(8);return new DataView(r.buffer).setFloat64(0,t,!0),this.raw(r)}fixed32(t){xv(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){dp(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return dp(t),t=(t<<1^t>>31)>>>0,cp(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Lt.enc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}fixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Lt.uEnc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}int64(t){let r=Lt.enc(t);return Ac(r.lo,r.hi,this.buf),this}sint64(t){let r=Lt.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return Ac(o,i,this.buf),this}uint64(t){let r=Lt.uEnc(t);return Ac(r.lo,r.hi,this.buf),this}},X=class{constructor(t,r=lp().decodeUtf8){this.decodeUtf8=r,this.varint64=vv,this.uint32=bv,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,i=r&7;if(o<=0||i>5)throw new Error("illegal tag: field no "+o+" wire type "+i);return[o,i]}skip(t,r){let n=this.pos;switch(t){case _r.Varint:for(;this.buf[this.pos++]&128;);break;case _r.Bit64:this.pos+=4;case _r.Bit32:this.pos+=4;break;case _r.LengthDelimited:let o=this.uint32();this.pos+=o;break;case _r.StartGroup:for(;;){let[i,s]=this.tag();if(s===_r.EndGroup){if(r!==void 0&&i!==r)throw new Error("invalid end group tag");break}this.skip(s,i)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return Lt.dec(...this.varint64())}uint64(){return Lt.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Lt.dec(t,r)}bool(){let[t,r]=this.varint64();return t!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Lt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Lt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){return this.decodeUtf8(this.bytes(),t)}};function dp(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>Gk||e<Bk)throw new Error("invalid int32: "+e)}function xv(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>Vk||e<0)throw new Error("invalid uint32: "+e)}function $k(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>qk||e<Uk))throw new Error("invalid float32: "+e)}var Qk=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function pp(){return{fields:{}}}var qi={encode(e,t=new ge){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&gp.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=pp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let s=gp.decode(r,r.uint32());s.value!==void 0&&(o.fields[s.key]=s.value);continue}}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return qi.fromPartial(e??{})},fromPartial(e){let t=pp();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=pp();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 Ev(){return{key:"",value:void 0}}var gp={encode(e,t=new ge){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&ie.encode(ie.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Ev();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=r.string();continue;case 2:if(i!==18)break;o.value=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return gp.fromPartial(e??{})},fromPartial(e){let t=Ev();return t.key=e.key??"",t.value=e.value??void 0,t}};function fp(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var ie={encode(e,t=new ge){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&&qi.encode(qi.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Ui.encode(Ui.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=fp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.nullValue=r.int32();continue;case 2:if(i!==17)break;o.numberValue=r.double();continue;case 3:if(i!==26)break;o.stringValue=r.string();continue;case 4:if(i!==32)break;o.boolValue=r.bool();continue;case 5:if(i!==42)break;o.structValue=qi.unwrap(qi.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=Ui.unwrap(Ui.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ie.fromPartial(e??{})},fromPartial(e){let t=fp();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=fp();if(e===null)t.nullValue=Qk.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(b.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new b.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 mp(){return{values:[]}}var Ui={encode(e,t=new ge){for(let r of e.values)ie.encode(ie.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=mp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(ie.unwrap(ie.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ui.fromPartial(e??{})},fromPartial(e){let t=mp();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=mp();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&b.Array.isArray(e.values)?e.values:e}},Hk=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 Iv(){return{op:0,path:"",from:void 0,value:void 0}}var wc={encode(e,t=new ge){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&&ie.encode(ie.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Iv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.op=r.int32();continue;case 2:if(i!==18)break;o.path=r.string();continue;case 3:if(i!==26)break;o.from=r.string();continue;case 4:if(i!==34)break;o.value=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return wc.fromPartial(e??{})},fromPartial(e){let t=Iv();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function Rv(){return{id:"",type:"",function:void 0}}var Cc={encode(e,t=new ge){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&xc.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Rv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.type=r.string();continue;case 3:if(i!==26)break;o.function=xc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Cc.fromPartial(e??{})},fromPartial(e){let t=Rv();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?xc.fromPartial(e.function):void 0,t}};function Tv(){return{name:"",arguments:""}}var xc={encode(e,t=new ge){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 X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Tv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.name=r.string();continue;case 2:if(i!==18)break;o.arguments=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xc.fromPartial(e??{})},fromPartial(e){let t=Tv();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function _v(){return{value:"",mimeType:""}}var Ec={encode(e,t=new ge){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 X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=_v();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ec.fromPartial(e??{})},fromPartial(e){let t=_v();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function kv(){return{value:"",mimeType:void 0}}var Ic={encode(e,t=new ge){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 X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=kv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ic.fromPartial(e??{})},fromPartial(e){let t=kv();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function Ov(){return{data:void 0,url:void 0}}var vt={encode(e,t=new ge){return e.data!==void 0&&Ec.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Ic.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Ov();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=Ec.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=Ic.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vt.fromPartial(e??{})},fromPartial(e){let t=Ov();return t.data=e.data!==void 0&&e.data!==null?Ec.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Ic.fromPartial(e.url):void 0,t}};function Pv(){return{text:""}}var Rc={encode(e,t=new ge){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Pv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Rc.fromPartial(e??{})},fromPartial(e){let t=Pv();return t.text=e.text??"",t}};function Nv(){return{source:void 0,metadata:void 0}}var Tc={encode(e,t=new ge){return e.source!==void 0&&vt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ie.encode(ie.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Nv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=vt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Tc.fromPartial(e??{})},fromPartial(e){let t=Nv();return t.source=e.source!==void 0&&e.source!==null?vt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Fv(){return{source:void 0,metadata:void 0}}var _c={encode(e,t=new ge){return e.source!==void 0&&vt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ie.encode(ie.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Fv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=vt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return _c.fromPartial(e??{})},fromPartial(e){let t=Fv();return t.source=e.source!==void 0&&e.source!==null?vt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Dv(){return{source:void 0,metadata:void 0}}var kc={encode(e,t=new ge){return e.source!==void 0&&vt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ie.encode(ie.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Dv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=vt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return kc.fromPartial(e??{})},fromPartial(e){let t=Dv();return t.source=e.source!==void 0&&e.source!==null?vt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Mv(){return{source:void 0,metadata:void 0}}var Oc={encode(e,t=new ge){return e.source!==void 0&&vt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ie.encode(ie.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Mv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=vt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Oc.fromPartial(e??{})},fromPartial(e){let t=Mv();return t.source=e.source!==void 0&&e.source!==null?vt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Lv(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var Pc={encode(e,t=new ge){return e.text!==void 0&&Rc.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Tc.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&_c.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&kc.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Oc.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Lv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=Rc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=Tc.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=_c.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=kc.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=Oc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Pc.fromPartial(e??{})},fromPartial(e){let t=Lv();return t.text=e.text!==void 0&&e.text!==null?Rc.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Tc.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?_c.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?kc.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Oc.fromPartial(e.document):void 0,t}};function jv(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var Nc={encode(e,t=new ge){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)Cc.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)Pc.encode(r,t.uint32(66).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=jv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.role=r.string();continue;case 3:if(i!==26)break;o.content=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue;case 5:if(i!==42)break;o.toolCalls.push(Cc.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.toolCallId=r.string();continue;case 7:if(i!==58)break;o.error=r.string();continue;case 8:if(i!==66)break;o.contentParts.push(Pc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Nc.fromPartial(e??{})},fromPartial(e){let t=jv();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=>Cc.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>Pc.fromPartial(r))||[],t}};function qv(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0}}var Fc={encode(e,t=new ge){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&&ie.encode(ie.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&ie.encode(ie.wrap(e.metadata),t.uint32(58).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=qv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.reason=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.toolCallId=r.string();continue;case 5:if(i!==42)break;o.responseSchema=ie.unwrap(ie.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.expiresAt=r.string();continue;case 7:if(i!==58)break;o.metadata=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Fc.fromPartial(e??{})},fromPartial(e){let t=qv();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}},zk=function(e){return e[e.TEXT_MESSAGE_START=0]="TEXT_MESSAGE_START",e[e.TEXT_MESSAGE_CONTENT=1]="TEXT_MESSAGE_CONTENT",e[e.TEXT_MESSAGE_END=2]="TEXT_MESSAGE_END",e[e.TOOL_CALL_START=3]="TOOL_CALL_START",e[e.TOOL_CALL_ARGS=4]="TOOL_CALL_ARGS",e[e.TOOL_CALL_END=5]="TOOL_CALL_END",e[e.STATE_SNAPSHOT=6]="STATE_SNAPSHOT",e[e.STATE_DELTA=7]="STATE_DELTA",e[e.MESSAGES_SNAPSHOT=8]="MESSAGES_SNAPSHOT",e[e.RAW=9]="RAW",e[e.CUSTOM=10]="CUSTOM",e[e.RUN_STARTED=11]="RUN_STARTED",e[e.RUN_FINISHED=12]="RUN_FINISHED",e[e.RUN_ERROR=13]="RUN_ERROR",e[e.STEP_STARTED=14]="STEP_STARTED",e[e.STEP_FINISHED=15]="STEP_FINISHED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Uv(){return{type:0,timestamp:void 0,rawEvent:void 0}}var ae={encode(e,t=new ge){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&ie.encode(ie.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Uv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.type=r.int32();continue;case 2:if(i!==16)break;o.timestamp=Wk(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ae.fromPartial(e??{})},fromPartial(e){let t=Uv();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function Vv(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var Dc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Vv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Dc.fromPartial(e??{})},fromPartial(e){let t=Vv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function Gv(){return{baseEvent:void 0,messageId:"",delta:""}}var Mc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Gv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Mc.fromPartial(e??{})},fromPartial(e){let t=Gv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function Bv(){return{baseEvent:void 0,messageId:""}}var Lc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Bv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Lc.fromPartial(e??{})},fromPartial(e){let t=Bv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function $v(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var jc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=$v();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return jc.fromPartial(e??{})},fromPartial(e){let t=$v();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function Qv(){return{baseEvent:void 0,toolCallId:"",delta:""}}var qc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Qv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return qc.fromPartial(e??{})},fromPartial(e){let t=Qv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function Hv(){return{baseEvent:void 0,toolCallId:""}}var Uc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Hv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Uc.fromPartial(e??{})},fromPartial(e){let t=Hv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function zv(){return{baseEvent:void 0,snapshot:void 0}}var Vc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&ie.encode(ie.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=zv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Vc.fromPartial(e??{})},fromPartial(e){let t=zv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function Wv(){return{baseEvent:void 0,delta:[]}}var Gc={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)wc.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Wv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(wc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Gc.fromPartial(e??{})},fromPartial(e){let t=Wv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>wc.fromPartial(r))||[],t}};function Kv(){return{baseEvent:void 0,messages:[]}}var Bc={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Nc.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Kv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(Nc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Bc.fromPartial(e??{})},fromPartial(e){let t=Kv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Nc.fromPartial(r))||[],t}};function Yv(){return{baseEvent:void 0,event:void 0,source:void 0}}var $c={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&ie.encode(ie.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Yv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=ie.unwrap(ie.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.source=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return $c.fromPartial(e??{})},fromPartial(e){let t=Yv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function Xv(){return{baseEvent:void 0,name:"",value:void 0}}var Qc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&ie.encode(ie.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Xv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Qc.fromPartial(e??{})},fromPartial(e){let t=Xv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function Zv(){return{baseEvent:void 0,threadId:"",runId:""}}var Hc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Zv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Hc.fromPartial(e??{})},fromPartial(e){let t=Zv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function Jv(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[]}}var zc={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&ie.encode(ie.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)Fc.encode(r,t.uint32(50).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Jv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue;case 4:if(i!==34)break;o.result=ie.unwrap(ie.decode(r,r.uint32()));continue;case 5:if(i!==42)break;o.outcome=r.string();continue;case 6:if(i!==50)break;o.interrupts.push(Fc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return zc.fromPartial(e??{})},fromPartial(e){let t=Jv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interrupts=e.interrupts?.map(r=>Fc.fromPartial(r))||[],t}};function eS(){return{baseEvent:void 0,code:void 0,message:""}}var Wc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=eS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.code=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Wc.fromPartial(e??{})},fromPartial(e){let t=eS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function tS(){return{baseEvent:void 0,stepName:""}}var Kc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=tS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Kc.fromPartial(e??{})},fromPartial(e){let t=tS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function rS(){return{baseEvent:void 0,stepName:""}}var Yc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=rS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Yc.fromPartial(e??{})},fromPartial(e){let t=rS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function nS(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var Xc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=nS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.delta=r.string();continue;case 5:if(i!==42)break;o.name=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Xc.fromPartial(e??{})},fromPartial(e){let t=nS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t}};function oS(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var Zc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=oS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue;case 5:if(i!==42)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Zc.fromPartial(e??{})},fromPartial(e){let t=oS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function iS(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0}}var sS={encode(e,t=new ge){return e.textMessageStart!==void 0&&Dc.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Mc.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Lc.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&jc.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&qc.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Uc.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Vc.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Gc.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Bc.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&$c.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Qc.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Hc.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&zc.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Wc.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Kc.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Yc.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Xc.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Zc.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=iS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=Dc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=Mc.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=Lc.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=jc.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=qc.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=Uc.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=Vc.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Gc.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=Bc.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=$c.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Qc.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Hc.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=zc.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=Wc.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Kc.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=Yc.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=Xc.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Zc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return sS.fromPartial(e??{})},fromPartial(e){let t=iS();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Dc.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Mc.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Lc.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?jc.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?qc.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Uc.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Vc.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Gc.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Bc.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?$c.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Qc.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Hc.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?zc.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Wc.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Kc.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Yc.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Xc.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Zc.fromPartial(e.toolCallChunk):void 0,t}};function Wk(e){let t=b.Number(e.toString());if(t>b.Number.MAX_SAFE_INTEGER)throw new b.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<b.Number.MIN_SAFE_INTEGER)throw new b.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var bc=e=>{if(!(!e||typeof e!="object")){if(e.data)return{type:"data",value:e.data.value,mimeType:e.data.mimeType};if(e.url)return{type:"url",value:e.url.value,mimeType:e.url.mimeType}}},Kk=e=>{if(!(!e||typeof e!="object")){if(e.text)return{type:"text",text:e.text.text};if(e.image)return{type:"image",source:bc(e.image.source),metadata:e.image.metadata};if(e.audio)return{type:"audio",source:bc(e.audio.source),metadata:e.audio.metadata};if(e.video)return{type:"video",source:bc(e.video.source),metadata:e.video.metadata};if(e.document)return{type:"document",source:bc(e.document.source),metadata:e.document.metadata}}};function aS(e){let t=sS.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=zk[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,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 i=o.contentParts.map(s=>Kk(s)).filter(s=>s!==void 0);i.length>0&&(o.content=i)}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,i=Array.isArray(n.interrupts)?n.interrupts:[];delete n.interrupts,o==="interrupt"?n.outcome={type:"interrupt",interrupts:i}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if(r.type===D.STATE_DELTA)for(let n of r.delta)n.op=Hk[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]}),ja.parse(r)}var hp="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var Xk=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,yp=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(Xk);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},cS=e=>e==="*"||e==="x"||e==="X",uS=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},Zk=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],Jk=(e,t)=>{if(cS(e)||cS(t))return 0;let[r,n]=Zk(uS(e),uS(t));return r>n?1:r<n?-1:0},vp=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=Jk(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Vi=(e,t)=>{let r=yp(e),n=yp(t),o=r.pop(),i=n.pop(),s=vp(r,n);return s!==0?s:o&&i?vp(o.split("."),i.split(".")):o||i?o?-1:1:0};var we=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function Gi(){return xr()}function bp(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&bp(t);return e}var lS=512*1024;function dS(e,t,r){let n=0,o=[e,t],i=new WeakSet;for(;o.length>0;){let s=o.pop();if(typeof s=="string"){if(n+=s.length,n>r)return!0}else if(typeof s=="object"&&s){if(i.has(s))continue;if(i.add(s),Array.isArray(s))for(let a=0;a<s.length;a++)o.push(s[a]);else{let a=Object.keys(s);for(let u=0;u<a.length;u++){let c=a[u];if(n+=c.length,n>r)return!0;o.push(s[c])}}}}return!1}function Re(_x83,_x84,_x85,_x86){return _Re.apply(this,arguments)}function _Re(){_Re=_asyncToGenerator(function*(e,t,r,n){let o=typeof process<"u"&&process.env!==void 0,i=o&&!!process.env.VITEST_WORKER_ID,s=o&&!!process.env.VITEST_WORKER_ID,a=s&&!dS(t,r,lS),u=a?we(t):t,c=a?we(r):r,g=!1,v=!1,E;for(let h of e)try{a&&(bp(u),bp(c));let y=yield n(h,u,c);if(y===void 0)continue;let S=!1;if(y.messages!==void 0&&y.messages!==u&&(u=we(y.messages),g=!0,S=!0),y.state!==void 0&&y.state!==c&&(c=we(y.state),v=!0,S=!0),a&&S&&dS(u,c,lS)&&(a=!1),E=y.stopPropagation,E===!0)break}catch(y){if(s&&y instanceof TypeError){if(i)throw y;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",y)}else i||console.error("Subscriber error:",y);continue}return{...(g?{messages:Object.isFrozen(u)?we(u):u}:{}),...(v?{state:Object.isFrozen(c)?we(c):c}:{}),...(E===void 0?{}:{stopPropagation:E})}});return _Re.apply(this,arguments)}function Jc(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 Bi(e){if(e instanceof wp)return e;if(e===!0)return new wp(Jc(!0))}var wp=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 Sp(e){return e.enabled?new wp(e):void 0}function e0(e,t,r){if(t){let o=e.find(s=>s.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 i={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(i),i}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}var yS=(e,t,r,n,o)=>{let i=Bi(o),s=we(r.messages),a=we(e.state),u={},c=v=>{v.messages!==void 0&&(s=v.messages,u.messages=v.messages),v.state!==void 0&&(a=v.state,u.state=v.state)},g=()=>{let v=we(u);return u={},v.messages!==void 0||v.state!==void 0?Me(v):tc};return t.pipe(hc(/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(v){let E=yield Re(n,s,a,(h,y,S)=>h.onEvent?.({event:v,agent:r,input:e,messages:y,state:S}));if(c(E),E.stopPropagation===!0?i?.event("APPLY","Event dropped:",v,{type:v.type,reason:"stopPropagation by subscriber"}):i?.event("APPLY","Event applied:",v,{type:v.type,subscribers:n.length}),E.stopPropagation===!0)return g();switch(v.type){case D.TEXT_MESSAGE_START:{let h=yield Re(n,s,a,(y,S,x)=>y.onTextMessageStartEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,role:S="assistant",name:x}=v;if(!s.find(I=>I.id===y)){let I={id:y,role:S,content:"",...(x!==void 0&&{name:x})};s.push(I),c({messages:s})}}return g()}case D.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,S=s.find(I=>I.id===h);if(!S)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let x=yield Re(n,s,a,(I,T,R)=>I.onTextMessageContentEvent?.({event:v,messages:T,state:R,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}));return c(x),x.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${y}`,c({messages:s})),g()}case D.TEXT_MESSAGE_END:{let{messageId:h}=v,y=s.find(S=>S.id===h);return y?(c(yield Re(n,s,a,(S,x,I)=>S.onTextMessageEndEvent?.({event:v,messages:x,state:I,agent:r,input:e,textMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(S=>{S.onNewMessage?.({message:y,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g())}case D.TOOL_CALL_START:{let h=yield Re(n,s,a,(y,S,x)=>y.onToolCallStartEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:S,parentMessageId:x}=v,I=e0(s,x,y);I.toolCalls??(I.toolCalls=[]),I.toolCalls.push({id:y,type:"function",function:{name:S,arguments:""}}),c({messages:s})}return g()}case D.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=v,S=s.find(T=>T.toolCalls?.some(R=>R.id===h));if(!S)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let x=S.toolCalls?.find(T=>T.id===h);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=yield Re(n,s,a,(T,R,k)=>{let _=x.function.arguments,F=x.function.name,V={};try{V=vc(_)}catch{}return T.onToolCallArgsEvent?.({event:v,messages:R,state:k,agent:r,input:e,toolCallBuffer:_,toolCallName:F,partialToolCallArgs:V})});return c(I),I.stopPropagation!==!0&&(x.function.arguments+=y,c({messages:s})),g()}case D.TOOL_CALL_END:{let{toolCallId:h}=v,y=s.find(x=>x.toolCalls?.some(I=>I.id===h));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let S=y.toolCalls?.find(x=>x.id===h);return S?(c(yield Re(n,s,a,(x,I,T)=>{let R=S.function.arguments,k=S.function.name,_={};try{_=JSON.parse(R)}catch{}return x.onToolCallEndEvent?.({event:v,messages:I,state:T,agent:r,input:e,toolCallName:k,toolCallArgs:_})})),yield Promise.all(n.map(x=>{x.onNewToolCall?.({toolCall:S,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g())}case D.TOOL_CALL_RESULT:{let h=yield Re(n,s,a,(y,S,x)=>y.onToolCallResultEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:S,content:x,role:I}=v,T={id:y,toolCallId:S,role:I||"tool",content:x},R=s.findIndex(k=>k.role==="assistant"&&k.toolCalls?.some(_=>_.id===S));if(R===-1)s.push(T);else{let k=R+1;for(;k<s.length&&s[k].role==="tool";)k++;s.splice(k,0,T)}yield Promise.all(n.map(k=>{k.onNewMessage?.({message:T,messages:s,state:a,agent:r,input:e})})),c({messages:s})}return g()}case D.STATE_SNAPSHOT:{let h=yield Re(n,s,a,(y,S,x)=>y.onStateSnapshotEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{snapshot:y}=v;a=y,c({state:a})}return g()}case D.STATE_DELTA:{let h=yield Re(n,s,a,(y,S,x)=>y.onStateDeltaEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{delta:y}=v;try{a=Ha.applyPatch(a,y,!0,!1).newDocument,c({state:a})}catch(S){let x=S instanceof Error?S.message:String(S);console.warn(`Failed to apply state patch:
37
37
  Current state: ${JSON.stringify(a,null,2)}
38
38
  Patch operations: ${JSON.stringify(y,null,2)}
39
- Error: ${x}`)}}return g()}case D.MESSAGES_SNAPSHOT:{let h=yield Re(n,s,a,(y,S,x)=>y.onMessagesSnapshotEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messages:y}=v,S=new Map(y.map(T=>[T.id,T])),x=T=>T==="activity"||T==="reasoning";s=s.filter(T=>x(T.role)||S.has(T.id)).map(T=>x(T.role)?T:S.get(T.id));let I=new Set(s.map(T=>T.id));for(let T of y)I.has(T.id)||s.push(T);c({messages:s})}return g()}case D.ACTIVITY_SNAPSHOT:{let h=v,y=s.findIndex(R=>R.id===h.messageId),S=y>=0?s[y]:void 0,x=S?.role==="activity"?S:void 0,I=h.replace??!0,T=yield Re(n,s,a,(R,k,_)=>R.onActivitySnapshotEvent?.({event:h,messages:k,state:_,agent:r,input:e,activityMessage:x,existingMessage:S}));if(c(T),T.stopPropagation!==!0){let R={id:h.messageId,role:"activity",activityType:h.activityType,content:Ee(h.content)},k;y===-1?(s.push(R),k=R):x?I&&(s[y]={...x,activityType:h.activityType,content:Ee(h.content)}):I&&(s[y]=R,k=R),c({messages:s}),k&&(yield Promise.all(n.map(_=>_.onNewMessage?.({message:k,messages:s,state:a,agent:r,input:e}))))}return g()}case D.ACTIVITY_DELTA:{let h=v,y=s.findIndex(T=>T.id===h.messageId);if(y===-1)return g();let S=s[y];if(S.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let x=S,I=yield Re(n,s,a,(T,R,k)=>T.onActivityDeltaEvent?.({event:h,messages:R,state:k,agent:r,input:e,activityMessage:x}));if(c(I),I.stopPropagation!==!0)try{let T=Ee(x.content??{}),R=Ha.applyPatch(T,h.patch??[],!0,!1).newDocument;s[y]={...x,content:Ee(R),activityType:h.activityType},c({messages:s})}catch(T){let R=T instanceof Error?T.message:String(T);console.warn(`Failed to apply activity patch for '${h.messageId}': ${R}`)}return g()}case D.RAW:return c(yield Re(n,s,a,(h,y,S)=>h.onRawEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.CUSTOM:return c(yield Re(n,s,a,(h,y,S)=>h.onCustomEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.RUN_STARTED:{let h=yield Re(n,s,a,(y,S,x)=>y.onRunStartedEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let y=v;if(y.input?.messages){for(let S of y.input.messages)s.find(x=>x.id===S.id)||s.push(S);c({messages:s})}}return g()}case D.RUN_FINISHED:return c(yield Re(n,s,a,(h,y,S)=>h.onRunFinishedEvent?.({event:v,messages:y,state:S,agent:r,input:e,result:v.result}))),g();case D.RUN_ERROR:return c(yield Re(n,s,a,(h,y,S)=>h.onRunErrorEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.STEP_STARTED:return c(yield Re(n,s,a,(h,y,S)=>h.onStepStartedEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.STEP_FINISHED:return c(yield Re(n,s,a,(h,y,S)=>h.onStepFinishedEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case D.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed 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 c(yield Re(n,s,a,(h,y,S)=>h.onReasoningStartEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.REASONING_MESSAGE_START:{let h=yield Re(n,s,a,(y,S,x)=>y.onReasoningMessageStartEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y}=v;if(!s.find(S=>S.id===y)){let S={id:y,role:"reasoning",content:""};s.push(S),c({messages:s})}}return g()}case D.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,S=s.find(I=>I.id===h);if(!S)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let x=yield Re(n,s,a,(I,T,R)=>I.onReasoningMessageContentEvent?.({event:v,messages:T,state:R,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}));return c(x),x.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${y}`,c({messages:s})),g()}case D.REASONING_MESSAGE_END:{let{messageId:h}=v,y=s.find(S=>S.id===h);return y?(c(yield Re(n,s,a,(S,x,I)=>S.onReasoningMessageEndEvent?.({event:v,messages:x,state:I,agent:r,input:e,reasoningMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(S=>{S.onNewMessage?.({message:y,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g())}case D.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case D.REASONING_END:return c(yield Re(n,s,a,(h,y,S)=>h.onReasoningEndEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:y,encryptedValue:S}=v,x=yield Re(n,s,a,(I,T,R)=>I.onReasoningEncryptedValueEvent?.({event:v,messages:T,state:R,agent:r,input:e}));if(c(x),x.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let T of s)if(T.role==="assistant"&&T.toolCalls){let R=T.toolCalls.find(k=>k.id===y);if(R){R.encryptedValue=S,I=!0;break}}}else{let T=s.find(R=>R.id===y);T?.role!=="activity"&&T&&(T.encryptedValue=S,I=!0)}I&&(u.messages=s)}return g()}}return v.type,g()});return function(_x87){return _ref40.apply(this,arguments)}}()),ep(),n.length>0?tp({}):v=>v)},Sp=e=>t=>{let r=Bi(e),n=new Map,o=new Map,i=!1,s=!1,a=!1,u=new Map,c=!1,g=!1,v=!1,E=()=>{n.clear(),o.clear(),u.clear(),c=!1,g=!1,i=!1,s=!1,v=!0};return t.pipe(dt(h=>{let y=h.type;if(r?.event("VERIFY","Event:",h,{type:h.type}),s)return Ne(()=>new De(`Cannot send event type '${y}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(i&&y!==D.RUN_ERROR&&y!==D.RUN_STARTED)return Ne(()=>new De(`Cannot send event type '${y}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(a){if(y===D.RUN_STARTED){if(v&&!i)return Ne(()=>new De("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));i&&E()}}else if(a=!0,y!==D.RUN_STARTED&&y!==D.RUN_ERROR)return Ne(()=>new De("First event must be 'RUN_STARTED'"));switch(y){case D.TEXT_MESSAGE_START:{let S=h.messageId;return n.has(S)?Ne(()=>new De(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${S}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(n.set(S,!0),Me(h))}case D.TEXT_MESSAGE_CONTENT:{let S=h.messageId;return n.has(S)?Me(h):Ne(()=>new De(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${S}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case D.TEXT_MESSAGE_END:{let S=h.messageId;return n.has(S)?(n.delete(S),Me(h)):Ne(()=>new De(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${S}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case D.TOOL_CALL_START:{let S=h.toolCallId;return o.has(S)?Ne(()=>new De(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${S}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(o.set(S,!0),Me(h))}case D.TOOL_CALL_ARGS:{let S=h.toolCallId;return o.has(S)?Me(h):Ne(()=>new De(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${S}'. Start a tool call with 'TOOL_CALL_START' first.`))}case D.TOOL_CALL_END:{let S=h.toolCallId;return o.has(S)?(o.delete(S),Me(h)):Ne(()=>new De(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${S}'. A 'TOOL_CALL_START' event must be sent first.`))}case D.STEP_STARTED:{let S=h.stepName;return u.has(S)?Ne(()=>new De(`Step "${S}" is already active for 'STEP_STARTED'`)):(u.set(S,!0),Me(h))}case D.STEP_FINISHED:{let S=h.stepName;return u.has(S)?(u.delete(S),Me(h)):Ne(()=>new De(`Cannot send 'STEP_FINISHED' for step "${S}" that was not started`))}case D.RUN_STARTED:return v=!0,Me(h);case D.RUN_FINISHED:if(u.size>0){let S=Array.from(u.keys()).join(", ");return Ne(()=>new De(`Cannot send 'RUN_FINISHED' while steps are still active: ${S}`))}if(n.size>0){let S=Array.from(n.keys()).join(", ");return Ne(()=>new De(`Cannot send 'RUN_FINISHED' while text messages are still active: ${S}`))}if(o.size>0){let S=Array.from(o.keys()).join(", ");return Ne(()=>new De(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${S}`))}return i=!0,Me(h);case D.RUN_ERROR:return s=!0,Me(h);case D.CUSTOM:return Me(h);case D.THINKING_TEXT_MESSAGE_START:return c?g?Ne(()=>new De("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(g=!0,Me(h)):Ne(()=>new De("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 g?Me(h):Ne(()=>new De("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 g?(g=!1,Me(h)):Ne(()=>new De("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 c?Ne(()=>new De("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(c=!0,Me(h));case D.THINKING_END:return c?(c=!1,Me(h)):Ne(()=>new De("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Me(h)}}))},En=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),Hk=(e,t)=>gc(()=>wn(w(e,t))).pipe(rp(r=>{if(!r.ok){let i=r.headers.get("content-type")||"";return wn(r.text()).pipe(dt(s=>{let a=s;if(i.includes("application/json"))try{a=JSON.parse(s)}catch{}let u=Error(`HTTP ${r.status}: ${typeof a=="string"?a:JSON.stringify(a)}`);return u.status=r.status,u.payload=a,Ne(()=>u)}))}let n={type:En.HEADERS,status:r.status,headers:r.headers},o=r.body?.getReader();return o?new Pe(i=>(i.next(n),_asyncToGenerator(function*(){try{for(;;){let{done:s,value:a}=yield o.read();if(s)break;let u={type:En.DATA,data:a};i.next(u)}i.complete()}catch(s){i.error(s)}})(),()=>{o.cancel().catch(s=>{if(s?.name!=="AbortError")throw s})})):Ne(()=>Error("Failed to getReader() from response"))})),zk=(e,t)=>{let r=Bi(t),n=new Yt,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:a=>{if(a.type!==En.HEADERS&&a.type===En.DATA&&a.data){let u=o.decode(a.data,{stream:!0});i+=u;let c=i.split(/\n\n/);i=c.pop()||"";for(let g of c)s(g)}},error:a=>n.error(a),complete:()=>{i&&(i+=o.decode(),s(i)),n.complete()}});function s(a){let u=a.split(`
39
+ Error: ${x}`)}}return g()}case D.MESSAGES_SNAPSHOT:{let h=yield Re(n,s,a,(y,S,x)=>y.onMessagesSnapshotEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messages:y}=v,S=new Map(y.map(R=>[R.id,R])),x=y.some(R=>R.role==="reasoning"),I=R=>R.role==="activity"||R.role==="reasoning"&&!x;s=s.filter(R=>I(R)||S.has(R.id)).map(R=>I(R)?R:S.get(R.id));let T=new Set(s.map(R=>R.id));for(let R of y)T.has(R.id)||s.push(R);c({messages:s})}return g()}case D.ACTIVITY_SNAPSHOT:{let h=v,y=s.findIndex(R=>R.id===h.messageId),S=y>=0?s[y]:void 0,x=S?.role==="activity"?S:void 0,I=h.replace??!0,T=yield Re(n,s,a,(R,k,_)=>R.onActivitySnapshotEvent?.({event:h,messages:k,state:_,agent:r,input:e,activityMessage:x,existingMessage:S}));if(c(T),T.stopPropagation!==!0){let R={id:h.messageId,role:"activity",activityType:h.activityType,content:we(h.content)},k;y===-1?(s.push(R),k=R):x?I&&(s[y]={...x,activityType:h.activityType,content:we(h.content)}):I&&(s[y]=R,k=R),c({messages:s}),k&&(yield Promise.all(n.map(_=>_.onNewMessage?.({message:k,messages:s,state:a,agent:r,input:e}))))}return g()}case D.ACTIVITY_DELTA:{let h=v,y=s.findIndex(T=>T.id===h.messageId);if(y===-1)return g();let S=s[y];if(S.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let x=S,I=yield Re(n,s,a,(T,R,k)=>T.onActivityDeltaEvent?.({event:h,messages:R,state:k,agent:r,input:e,activityMessage:x}));if(c(I),I.stopPropagation!==!0)try{let T=we(x.content??{}),R=Ha.applyPatch(T,h.patch??[],!0,!1).newDocument;s[y]={...x,content:we(R),activityType:h.activityType},c({messages:s})}catch(T){let R=T instanceof Error?T.message:String(T);console.warn(`Failed to apply activity patch for '${h.messageId}': ${R}`)}return g()}case D.RAW:return c(yield Re(n,s,a,(h,y,S)=>h.onRawEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.CUSTOM:return c(yield Re(n,s,a,(h,y,S)=>h.onCustomEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.RUN_STARTED:{let h=yield Re(n,s,a,(y,S,x)=>y.onRunStartedEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let y=v;if(y.input?.messages){for(let S of y.input.messages)s.find(x=>x.id===S.id)||s.push(S);c({messages:s})}}return g()}case D.RUN_FINISHED:{let h=v,y=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},S=yield Re(n,s,a,(x,I,T)=>x.onRunFinishedEvent?.({...y,messages:I,state:T,agent:r,input:e}));return c(S),S.stopPropagation!==!0&&(r.pendingInterrupts=y.outcome==="interrupt"?[...y.interrupts]:[]),g()}case D.RUN_ERROR:return c(yield Re(n,s,a,(h,y,S)=>h.onRunErrorEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.STEP_STARTED:return c(yield Re(n,s,a,(h,y,S)=>h.onStepStartedEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.STEP_FINISHED:return c(yield Re(n,s,a,(h,y,S)=>h.onStepFinishedEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case D.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed 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 c(yield Re(n,s,a,(h,y,S)=>h.onReasoningStartEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.REASONING_MESSAGE_START:{let h=yield Re(n,s,a,(y,S,x)=>y.onReasoningMessageStartEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y}=v;if(!s.find(S=>S.id===y)){let S={id:y,role:"reasoning",content:""};s.push(S),c({messages:s})}}return g()}case D.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,S=s.find(I=>I.id===h);if(!S)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let x=yield Re(n,s,a,(I,T,R)=>I.onReasoningMessageContentEvent?.({event:v,messages:T,state:R,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}));return c(x),x.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${y}`,c({messages:s})),g()}case D.REASONING_MESSAGE_END:{let{messageId:h}=v,y=s.find(S=>S.id===h);return y?(c(yield Re(n,s,a,(S,x,I)=>S.onReasoningMessageEndEvent?.({event:v,messages:x,state:I,agent:r,input:e,reasoningMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(S=>{S.onNewMessage?.({message:y,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g())}case D.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case D.REASONING_END:return c(yield Re(n,s,a,(h,y,S)=>h.onReasoningEndEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:y,encryptedValue:S}=v,x=yield Re(n,s,a,(I,T,R)=>I.onReasoningEncryptedValueEvent?.({event:v,messages:T,state:R,agent:r,input:e}));if(c(x),x.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let T of s)if(T.role==="assistant"&&T.toolCalls){let R=T.toolCalls.find(k=>k.id===y);if(R){R.encryptedValue=S,I=!0;break}}}else{let T=s.find(R=>R.id===y);T?.role!=="activity"&&T&&(T.encryptedValue=S,I=!0)}I&&(u.messages=s)}return g()}}return v.type,g()});return function(_x87){return _ref40.apply(this,arguments)}}()),tp(),n.length>0?rp({}):v=>v)},Ap=e=>t=>{let r=Bi(e),n=new Map,o=new Map,i=!1,s=!1,a=!1,u=new Map,c=!1,g=!1,v=!1,E=()=>{n.clear(),o.clear(),u.clear(),c=!1,g=!1,i=!1,s=!1,v=!0};return t.pipe(dt(h=>{let y=h.type;if(r?.event("VERIFY","Event:",h,{type:h.type}),s)return Fe(()=>new Pe(`Cannot send event type '${y}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(i&&y!==D.RUN_ERROR&&y!==D.RUN_STARTED)return Fe(()=>new Pe(`Cannot send event type '${y}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(a){if(y===D.RUN_STARTED){if(v&&!i)return Fe(()=>new Pe("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));i&&E()}}else if(a=!0,y!==D.RUN_STARTED&&y!==D.RUN_ERROR)return Fe(()=>new Pe("First event must be 'RUN_STARTED'"));switch(y){case D.TEXT_MESSAGE_START:{let S=h.messageId;return n.has(S)?Fe(()=>new Pe(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${S}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(n.set(S,!0),Me(h))}case D.TEXT_MESSAGE_CONTENT:{let S=h.messageId;return n.has(S)?Me(h):Fe(()=>new Pe(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${S}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case D.TEXT_MESSAGE_END:{let S=h.messageId;return n.has(S)?(n.delete(S),Me(h)):Fe(()=>new Pe(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${S}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case D.TOOL_CALL_START:{let S=h.toolCallId;return o.has(S)?Fe(()=>new Pe(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${S}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(o.set(S,!0),Me(h))}case D.TOOL_CALL_ARGS:{let S=h.toolCallId;return o.has(S)?Me(h):Fe(()=>new Pe(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${S}'. Start a tool call with 'TOOL_CALL_START' first.`))}case D.TOOL_CALL_END:{let S=h.toolCallId;return o.has(S)?(o.delete(S),Me(h)):Fe(()=>new Pe(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${S}'. A 'TOOL_CALL_START' event must be sent first.`))}case D.STEP_STARTED:{let S=h.stepName;return u.has(S)?Fe(()=>new Pe(`Step "${S}" is already active for 'STEP_STARTED'`)):(u.set(S,!0),Me(h))}case D.STEP_FINISHED:{let S=h.stepName;return u.has(S)?(u.delete(S),Me(h)):Fe(()=>new Pe(`Cannot send 'STEP_FINISHED' for step "${S}" that was not started`))}case D.RUN_STARTED:return v=!0,Me(h);case D.RUN_FINISHED:if(u.size>0){let S=Array.from(u.keys()).join(", ");return Fe(()=>new Pe(`Cannot send 'RUN_FINISHED' while steps are still active: ${S}`))}if(n.size>0){let S=Array.from(n.keys()).join(", ");return Fe(()=>new Pe(`Cannot send 'RUN_FINISHED' while text messages are still active: ${S}`))}if(o.size>0){let S=Array.from(o.keys()).join(", ");return Fe(()=>new Pe(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${S}`))}return i=!0,Me(h);case D.RUN_ERROR:return s=!0,Me(h);case D.CUSTOM:return Me(h);case D.THINKING_TEXT_MESSAGE_START:return c?g?Fe(()=>new Pe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(g=!0,Me(h)):Fe(()=>new Pe("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 g?Me(h):Fe(()=>new Pe("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 g?(g=!1,Me(h)):Fe(()=>new Pe("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 c?Fe(()=>new Pe("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(c=!0,Me(h));case D.THINKING_END:return c?(c=!1,Me(h)):Fe(()=>new Pe("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Me(h)}}))},En=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),t0=e=>gc(()=>wn(e())).pipe(np(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return wn(t.text()).pipe(dt(i=>{let s=i;if(o.includes("application/json"))try{s=JSON.parse(i)}catch{}let a=Error(`HTTP ${t.status}: ${typeof s=="string"?s:JSON.stringify(s)}`);return a.status=t.status,a.payload=s,Fe(()=>a)}))}let r={type:En.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new Ne(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:s}=yield n.read();if(i)break;let a={type:En.DATA,data:s};o.next(a)}o.complete()}catch(i){o.error(i)}})(),()=>{n.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):Fe(()=>Error("Failed to getReader() from response"))})),r0=(e,t)=>{let r=Bi(t),n=new Yt,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:a=>{if(a.type!==En.HEADERS&&a.type===En.DATA&&a.data){let u=o.decode(a.data,{stream:!0});i+=u;let c=i.split(/\n\n/);i=c.pop()||"";for(let g of c)s(g)}},error:a=>n.error(a),complete:()=>{i&&(i+=o.decode(),s(i)),n.complete()}});function s(a){let u=a.split(`
40
40
  `),c=[];for(let g of u)g.startsWith("data:")&&c.push(g.slice(5).replace(/^ /,""));if(c.length>0)try{let g=c.join(`
41
- `),v=JSON.parse(g);r?.event("SSE","Event received:",v,{type:v.type}),n.next(v)}catch(g){n.error(g)}}return n.asObservable()},Wk=e=>{let t=new Yt,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==En.HEADERS&&o.type===En.DATA&&o.data){let i=new Uint8Array(r.length+o.data.length);i.set(r,0),i.set(o.data,r.length),r=i,n()}},error:o=>t.error(o),complete:()=>{if(r.length>0)try{n()}catch{console.warn("Incomplete or invalid protocol buffer data at stream end")}t.complete()}});function n(){for(;r.length>=4;){let o=4+new DataView(r.buffer,r.byteOffset,4).getUint32(0,!1);if(r.length<o)break;try{let i=r.slice(4,o),s=iS(i);t.next(s),r=r.slice(o)}catch(i){let s=i instanceof Error?i.message:String(i);t.error(Error(`Failed to decode protocol buffer message: ${s}`));return}}}return t.asObservable()},Kk=(e,t)=>{let r=Bi(t),n=new Yt,o=new ec,i=!1;return e.subscribe({next:s=>{if(o.next(s),s.type===En.HEADERS&&!i){i=!0;let a=s.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:a,parser:a===gp?"protobuf":"sse"}),a===gp?Wk(o).subscribe({next:u=>n.next(u),error:u=>n.error(u),complete:()=>n.complete()}):zk(o,r).subscribe({next:u=>{try{let c=ja.parse(u);r?.event("HTTP","Event validated:",c,{type:c.type,valid:!0}),n.next(c)}catch(c){r?.event("HTTP","Event invalid:",{json:u,error:String(c)}),n.error(c)}},error:u=>{if(u?.name==="AbortError"){n.next({type:D.RUN_ERROR,message:u.message||"Request aborted",code:"abort",rawEvent:u}),n.complete();return}return n.error(u)},complete:()=>n.complete()})}else i||n.error(Error("No headers event received before data events"))},error:s=>{o.error(s),n.error(s)},complete:()=>{o.complete()}}),n.asObservable()},ke=b.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),Yk=b.enum(["LangGraphInterruptEvent","PredictState","Exit"]),Xk=b.object({type:b.literal(ke.enum.TextMessageStart),messageId:b.string(),parentMessageId:b.string().optional(),role:b.string().optional()}),Zk=b.object({type:b.literal(ke.enum.TextMessageContent),messageId:b.string(),content:b.string()}),Jk=b.object({type:b.literal(ke.enum.TextMessageEnd),messageId:b.string()}),e0=b.object({type:b.literal(ke.enum.ActionExecutionStart),actionExecutionId:b.string(),actionName:b.string(),parentMessageId:b.string().optional()}),t0=b.object({type:b.literal(ke.enum.ActionExecutionArgs),actionExecutionId:b.string(),args:b.string()}),r0=b.object({type:b.literal(ke.enum.ActionExecutionEnd),actionExecutionId:b.string()}),n0=b.object({type:b.literal(ke.enum.ActionExecutionResult),actionName:b.string(),actionExecutionId:b.string(),result:b.string()}),o0=b.object({type:b.literal(ke.enum.AgentStateMessage),threadId:b.string(),agentName:b.string(),nodeName:b.string(),runId:b.string(),active:b.boolean(),role:b.string(),state:b.string(),running:b.boolean()}),i0=b.object({type:b.literal(ke.enum.MetaEvent),name:Yk,value:b.any()}),s0=b.object({type:b.literal(ke.enum.RunError),message:b.string(),code:b.string().optional()});b.discriminatedUnion("type",[Xk,Zk,Jk,e0,t0,r0,n0,o0,i0,s0]),b.object({id:b.string(),role:b.string(),content:b.string(),parentMessageId:b.string().optional()}),b.object({id:b.string(),name:b.string(),arguments:b.any(),parentMessageId:b.string().optional()}),b.object({id:b.string(),result:b.any(),actionExecutionId:b.string(),actionName:b.string()});var a0=e=>{if(typeof e=="string")return e;if(!Array.isArray(e))return;let t=e.filter(r=>r.type==="text").map(r=>r.text).filter(r=>r.length>0);if(t.length!==0)return t.join(`
42
- `)},c0=(e,t,r)=>n=>{let o={},i=!0,s=!0,a="",u=null,c=null,g=[],v={},E=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(dt(h=>{switch(h.type){case D.TEXT_MESSAGE_START:{let y=h;return[{type:ke.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case D.TEXT_MESSAGE_CONTENT:{let y=h;return[{type:ke.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case D.TEXT_MESSAGE_END:{let y=h;return[{type:ke.enum.TextMessageEnd,messageId:y.messageId}]}case D.TOOL_CALL_START:{let y=h;return g.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),s=!0,v[y.toolCallId]=y.toolCallName,[{type:ke.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case D.TOOL_CALL_ARGS:{let y=h,S=g.find(I=>I.id===y.toolCallId);if(!S)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];S.function.arguments+=y.delta;let x=!1;if(c){let I=c.find(T=>T.tool==S.function.name);if(I)try{let T=JSON.parse(vc(S.function.arguments));I.tool_argument&&I.tool_argument in T?(E({...o,[I.state_key]:T[I.tool_argument]}),x=!0):I.tool_argument||(E({...o,[I.state_key]:T}),x=!0)}catch{}}return[{type:ke.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(x?[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}]:[])]}case D.TOOL_CALL_END:{let y=h;return[{type:ke.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case D.TOOL_CALL_RESULT:{let y=h;return[{type:ke.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:v[y.toolCallId]||"unknown"}]}case D.RAW:return[];case D.CUSTOM:{let y=h;switch(y.name){case"Exit":i=!1;break;case"PredictState":c=y.value;break}return[{type:ke.enum.MetaEvent,name:y.name,value:y.value}]}case D.STATE_SNAPSHOT:return E(h.snapshot),[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}];case D.STATE_DELTA:{let y=h,S=Ha.applyPatch(o,y.delta,!0,!1);return S?(E(S.newDocument),[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}]):[]}case D.MESSAGES_SNAPSHOT:return u=h.messages,[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(u?{messages:u}:{})}),active:!0}];case D.RUN_STARTED:return[];case D.RUN_FINISHED:return u&&(o.messages=u),Object.keys(o).length===0?[]:[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(u?{messages:u0(u)}:{})}),active:!1}];case D.RUN_ERROR:{let y=h;return[{type:ke.enum.RunError,message:y.message,code:y.code}]}case D.STEP_STARTED:return a=h.stepName,g=[],c=null,[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case D.STEP_FINISHED:return g=[],c=null,[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function u0(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=a0(r.content);if(n){let o={id:r.id,role:r.role,content:n};t.push(o)}if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0)for(let o of r.toolCalls){let i={id:o.id,name:o.function.name,arguments:JSON.parse(o.function.arguments),parentMessageId:r.id};t.push(i)}}else if(r.role==="tool"){let n="unknown";for(let i of e)if(i.role==="assistant"&&i.toolCalls?.length){for(let s of i.toolCalls)if(s.id===r.toolCallId){n=s.function.name;break}}let o={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(o)}return t}var Jc=e=>t=>{let r=Bi(e),n,o,i,s,a=()=>{if(!n||s!=="text")throw Error("No text message to close");let v={type:D.TEXT_MESSAGE_END,messageId:n.messageId};return s=void 0,n=void 0,r?.event("TRANSFORM","TEXT_MESSAGE_END",v,{messageId:v.messageId}),v},u=()=>{if(!o||s!=="tool")throw Error("No tool call to close");let v={type:D.TOOL_CALL_END,toolCallId:o.toolCallId};return s=void 0,o=void 0,r?.event("TRANSFORM","TOOL_CALL_END",v,{toolCallId:v.toolCallId}),v},c=()=>{if(!i||s!=="reasoning")throw Error("No reasoning message to close");let v={type:D.REASONING_MESSAGE_END,messageId:i.messageId};return s=void 0,i=void 0,r?.event("TRANSFORM","REASONING_MESSAGE_END",v,{messageId:v.messageId}),v},g=()=>s==="text"?[a()]:s==="tool"?[u()]:s==="reasoning"?[c()]:[];return t.pipe(dt(v=>{switch(v.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.MESSAGES_SNAPSHOT:case D.CUSTOM:case D.RUN_STARTED:case D.RUN_FINISHED:case D.RUN_ERROR: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[...g(),v];case D.RAW:case D.ACTIVITY_SNAPSHOT:case D.ACTIVITY_DELTA:case D.REASONING_ENCRYPTED_VALUE:return[v];case D.TEXT_MESSAGE_CHUNK:let E=v,h=[];if((s!=="text"||E.messageId!==void 0&&E.messageId!==n?.messageId)&&h.push(...g()),s!=="text"){if(E.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");n={messageId:E.messageId,name:E.name},s="text";let T={type:D.TEXT_MESSAGE_START,messageId:E.messageId,role:E.role||"assistant",...(E.name!==void 0&&{name:E.name})};h.push(T),r?.event("TRANSFORM","TEXT_MESSAGE_START",T,{messageId:E.messageId})}if(E.delta!==void 0){let T={type:D.TEXT_MESSAGE_CONTENT,messageId:n.messageId,delta:E.delta};h.push(T),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",T,{messageId:n.messageId})}return h;case D.TOOL_CALL_CHUNK:let y=v,S=[];if((s!=="tool"||y.toolCallId!==void 0&&y.toolCallId!==o?.toolCallId)&&S.push(...g()),s!=="tool"){if(y.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(y.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");o={toolCallId:y.toolCallId,toolCallName:y.toolCallName,parentMessageId:y.parentMessageId},s="tool";let T={type:D.TOOL_CALL_START,toolCallId:y.toolCallId,toolCallName:y.toolCallName,parentMessageId:y.parentMessageId};S.push(T),r?.event("TRANSFORM","TOOL_CALL_START",T,{toolCallId:y.toolCallId,toolCallName:y.toolCallName})}if(y.delta!==void 0){let T={type:D.TOOL_CALL_ARGS,toolCallId:o.toolCallId,delta:y.delta};S.push(T),r?.event("TRANSFORM","TOOL_CALL_ARGS",T,{toolCallId:o.toolCallId})}return S;case D.REASONING_MESSAGE_CHUNK:let x=v,I=[];if((s!=="reasoning"||x.messageId&&x.messageId!==i?.messageId)&&I.push(...g()),s!=="reasoning"){if(x.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");i={messageId:x.messageId},s="reasoning";let T={type:D.REASONING_MESSAGE_START,messageId:x.messageId};I.push(T),r?.event("TRANSFORM","REASONING_MESSAGE_START",T,{messageId:x.messageId})}if(x.delta!==void 0){let T={type:D.REASONING_MESSAGE_CONTENT,messageId:i.messageId,delta:x.delta};I.push(T),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",T,{messageId:i.messageId})}return I}return v.type,[]}),xn(()=>{g()}))},eu=class{runNext(e,t){return t.run(e).pipe(Jc(!1))}runNextWithState(e,t){let r=Ee(e.messages||[]),n=Ee(e.state||{}),o=new ec;return fS(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(hc(/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(s=>setTimeout(s,0)),{event:i,messages:Ee(r),state:Ee(n)}});return function(_x88){return _ref42.apply(this,arguments)}}()))}},l0=class extends eu{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function d0(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 p0=class extends eu{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(d0)};return this.runNext(o,t)}},cS="THINKING_START",uS="THINKING_END",lS="THINKING_TEXT_MESSAGE_START",dS="THINKING_TEXT_MESSAGE_CONTENT",pS="THINKING_TEXT_MESSAGE_END",f0=class extends eu{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(Cn(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case cS:{this.currentReasoningId=Gi();let{title:t,...r}=e;return this.warnAboutTransformation(cS,D.REASONING_START),{...r,type:D.REASONING_START,messageId:this.currentReasoningId}}case lS:return this.currentMessageId=Gi(),this.warnAboutTransformation(lS,D.REASONING_MESSAGE_START),{...e,type:D.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case dS:{let{delta:t,...r}=e;return this.warnAboutTransformation(dS,D.REASONING_MESSAGE_CONTENT),{...r,type:D.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Gi(),delta:t}}case pS:{let t=this.currentMessageId??Gi();return this.warnAboutTransformation(pS,D.REASONING_MESSAGE_END),{...e,type:D.REASONING_MESSAGE_END,messageId:t}}case uS:{let t=this.currentReasoningId??Gi();return this.warnAboutTransformation(uS,D.REASONING_END),{...e,type:D.REASONING_END,messageId:t}}default:return e}}};function m0(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function g0(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function h0(e){let t=m0(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 y0(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>g0(n)?h0(n):n);return{...e,content:r}}var v0=class extends eu{run(e,t){let r={...e,messages:e.messages.map(y0)};return this.runNext(r,t)}},S0="0.0.53",A0=class{get maxVersion(){return S0}get debug(){return this._debug}set debug(e){this._debug=Zc(e),this._debugLogger=vp(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?vp(Zc(!0)):void 0:this._debugLogger=e}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:i}={}){this.subscribers=[],this.isRunning=!1,this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??xr(),this.messages=Ee(n??[]),this.state=Ee(o??{}),this._debug=Zc(i),this._debugLogger=vp(this._debug),Vi(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new p0),Vi(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new f0),Vi(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new v0)}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 l0(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this1=this;return _asyncToGenerator(function*(){try{_this1.isRunning=!0,_this1.agentId=_this1.agentId??xr();let r=_this1.prepareRunAgentInput(e);_this1.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this1.agentId,threadId:_this1.threadId});let n,o=new Set(_this1.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{n=u.result}},..._this1.subscribers,t??{}];yield _this1.onInitialize(r,i),_this1.activeRunDetach$=new Yt;let s;_this1.activeRunCompletionPromise=new Promise(u=>{s=u}),yield mc(Ja(()=>_this1.middlewares.length===0?_this1.run(r):_this1.middlewares.reduceRight((u,c)=>({run:g=>c.run(g,u),get messages(){return u.messages},get state(){return u.state}}),_this1).run(r),Jc(_this1.debugLogger),Sp(_this1.debugLogger),u=>u.pipe(yc(_this1.activeRunDetach$)),u=>_this1.apply(r,u,i),u=>_this1.processApplyEvents(r,u,i),ji(u=>(_this1.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this1.agentId,error:u instanceof Error?u.message:String(u)}),_this1.isRunning=!1,_this1.onError(r,u,i))),xn(()=>{_this1.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this1.agentId,threadId:_this1.threadId}),_this1.isRunning=!1,_this1.onFinalize(r,i),s?.(),s=void 0,_this1.activeRunCompletionPromise=void 0,_this1.activeRunDetach$=void 0}))(Me(null)));let a=Ee(_this1.messages).filter(u=>!o.has(u.id));return{result:n,newMessages:a}}finally{_this1.isRunning=!1}})()}connect(e){throw new Vd}connectAgent(e,t){var _this10=this;return _asyncToGenerator(function*(){try{_this10.isRunning=!0,_this10.agentId=_this10.agentId??xr();let r=_this10.prepareRunAgentInput(e),n,o=new Set(_this10.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{n=u.result}},..._this10.subscribers,t??{}];yield _this10.onInitialize(r,i),_this10.activeRunDetach$=new Yt;let s;_this10.activeRunCompletionPromise=new Promise(u=>{s=u}),yield mc(Ja(()=>gc(()=>_this10.connect(r)),Jc(_this10.debugLogger),Sp(_this10.debugLogger),u=>u.pipe(yc(_this10.activeRunDetach$)),u=>_this10.apply(r,u,i),u=>_this10.processApplyEvents(r,u,i),ji(u=>(_this10.isRunning=!1,u instanceof Vd?tc:_this10.onError(r,u,i))),xn(()=>{_this10.isRunning=!1,_this10.onFinalize(r,i),s?.(),s=void 0,_this10.activeRunCompletionPromise=void 0,_this10.activeRunDetach$=void 0}))(Me(null)),{defaultValue:void 0});let a=Ee(_this10.messages).filter(u=>!o.has(u.id));return{result:n,newMessages:a}}finally{_this10.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this11=this;return _asyncToGenerator(function*(){if(!_this11.activeRunDetach$)return;let e=_this11.activeRunCompletionPromise??Promise.resolve();_this11.activeRunDetach$.next(),_this11.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return fS(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(np(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=Ee(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||xr(),tools:Ee(e?.tools??[]),context:Ee(e?.context??[]),forwardedProps:Ee(e?.forwardedProps??{}),state:Ee(this.state),messages:t}}onInitialize(e,t){var _this12=this;return _asyncToGenerator(function*(){let r=yield Re(t,_this12.messages,_this12.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this12,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this12.messages=r.messages,e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this12.messages,state:_this12.state,agent:_this12,input:e})})),r.state&&(_this12.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this12.state,messages:_this12.messages,agent:_this12,input:e})})))})()}onError(e,t,r){return wn(Re(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(Cn(n=>{let o=n;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,r.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,r.forEach(i=>{i.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),o.stopPropagation!==!0){let i=String(t);if(!(t.name==="AbortError"||t.message==="Fetch is aborted"||t.message==="signal is aborted without reason"||t.message==="component unmounted"||i==="component unmounted"))throw console.error("Agent execution failed:",t),t}return{}}))}onFinalize(e,t){var _this13=this;return _asyncToGenerator(function*(){let r=yield Re(t,_this13.messages,_this13.state,(n,o,i)=>n.onRunFinalized?.({messages:o,state:i,agent:_this13,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this13.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this13.messages,state:_this13.state,agent:_this13,input:e})})),r.state!==void 0&&(_this13.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this13.state,messages:_this13.messages,agent:_this13,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=Ee(this.messages),e.state=Ee(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e}addMessage(e){var _this14=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this14.subscribers)yield t.onNewMessage?.({message:e,messages:_this14.messages,state:_this14.state,agent:_this14});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this14.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this14.messages,state:_this14.state,agent:_this14});for(let t of _this14.subscribers)yield t.onMessagesChanged?.({messages:_this14.messages,state:_this14.state,agent:_this14})})()}addMessages(e){var _this15=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this15.subscribers)yield r.onNewMessage?.({message:t,messages:_this15.messages,state:_this15.state,agent:_this15});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this15.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this15.messages,state:_this15.state,agent:_this15})}for(let t of _this15.subscribers)yield t.onMessagesChanged?.({messages:_this15.messages,state:_this15.state,agent:_this15})})()}setMessages(e){var _this16=this;this.messages=Ee(e),_asyncToGenerator(function*(){for(let t of _this16.subscribers)yield t.onMessagesChanged?.({messages:_this16.messages,state:_this16.state,agent:_this16})})()}setState(e){var _this17=this;this.state=Ee(e),_asyncToGenerator(function*(){for(let t of _this17.subscribers)yield t.onStateChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??xr();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(Jc(this.debugLogger),Sp(this.debugLogger),c0(this.threadId,t.runId,this.agentId),r=>r.pipe(Cn(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}},mS=class extends A0{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(e),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new l.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new l.AbortController,this.url=e.url,this.headers=Ee(e.headers??{})}run(e){return Kk(Hk(this.url,this.requestInit(e)),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Ee(this.headers??{});let t=new l.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};m();d();f();p();var gS=(e,t,r)=>{let n=rt(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let i=`/api/preview/organizations/${t}/agents`;return`${n}${i}/${o}`};var wp=class extends mS{requestInit(t){let{params:r,accessToken:n,recordDebugSession:o}=t.forwardedProps||{},i={...r,...(o&&{recordDebugSession:!0})};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream, application/json"},body:JSON.stringify(i),signal:this.abortController.signal}}},hS=(e,t,r)=>new wp({url:`${gS(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var b0=new re({required:!0}),yS=new re({required:!0,constrainTo:Ca}),vS=e=>({...e,name:xa(e.name)}),SS=G("followUpAnswers/setIsEnabled",e=>W(e,new Le({required:!0}))),AS=G("followUpAnswers/setFollowUpAnswersConversationId",e=>W(e,ee)),bS=G("followUpAnswers/setFollowUpAnswersConversationToken",e=>W(e,ee)),wS=G("followUpAnswers/clearFollowUpAnswersConversationToken"),qJ=G("followUpAnswers/createFollowUpAnswer",e=>W(e,{question:ee})),UJ=G("followUpAnswers/setActiveFollowUpAnswerId",e=>W(e,ee)),VJ=G("followUpAnswers/setFollowUpAnswerContentFormat",e=>W(e,{contentFormat:Ia,answerId:ee})),GJ=G("followUpAnswers/setFollowUpIsLoading",e=>W(e,{isLoading:new Le({required:!0}),answerId:ee})),BJ=G("followUpAnswers/setFollowUpIsStreaming",e=>W(e,{isStreaming:new Le({required:!0}),answerId:ee})),$J=G("followUpAnswers/followUpMessageChunkReceived",e=>W(e,{textDelta:b0,answerId:ee})),QJ=G("followUpAnswers/followUpCitationsReceived",e=>W(e,{citations:new Pt({required:!0,each:new Ce({values:Rd})}),answerId:ee})),HJ=G("followUpAnswers/followUpCompleted",e=>W(e,{answerId:ee,cannotAnswer:new Le({required:!1})})),zJ=G("followUpAnswers/followUpFailed",e=>W(e,{message:new re,code:new Fe({min:0}),answerId:ee})),WJ=G("followUpAnswers/activeFollowUpStartFailed",e=>W(e,{message:new re})),KJ=G("followUpAnswers/likeFollowUp",e=>W(e,{answerId:ee})),YJ=G("followUpAnswers/dislikeFollowUp",e=>W(e,{answerId:ee})),XJ=G("followUpAnswers/submitFollowUpFeedback",e=>W(e,{answerId:ee})),CS=G("followUpAnswers/resetFollowUpAnswers"),ZJ=G("followUpAnswers/stepStarted",e=>W(vS(e),{answerId:ee,name:yS,startedAt:new Fe({min:0,required:!0})})),JJ=G("followUpAnswers/stepFinished",e=>W(vS(e),{answerId:ee,name:yS,finishedAt:new Fe({min:0,required:!0})})),eee=G("followUpAnswers/startToolCall",e=>W(e,{answerId:ee,toolCallName:ee,startedAt:new Fe({min:0,required:!0}),toolCallId:ee})),tee=G("followUpAnswers/finishToolCall",e=>W(e,{answerId:ee,finishedAt:new Fe({min:0,required:!0}),toolCallId:ee})),ree=G("followUpAnswers/toolCallArgs",e=>W(e,{answerId:ee,toolCallId:ee,args:new Ce({options:{required:!0}}),type:new re({required:!0,constrainTo:Ea})}));m();d();f();p();var w0={"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 xS(e){return e?w0[e]??1004:1004}var ES=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Ra(n.runId)),e(Cr(!1)),e(Ci(!0)),e(AS(n.threadId)),e(wS())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(ty({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(ry({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onToolCallStartEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:i,toolCallId:s,timestamp:a}=n;e(ny({toolCallId:s,toolCallName:i,startedAt:a??Date.now()}))},onToolCallEndEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,timestamp:s}=n;e(oy({toolCallId:i,finishedAt:s??Date.now()}))},onToolCallArgsEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,delta:s}=n;try{let a=JSON.parse(s);typeof a?.q=="string"?e(_a({toolCallId:i,args:a,type:"search"})):e(_a({toolCallId:i,args:{raw:s},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${s}`),e(_a({toolCallId:i,args:{raw:s},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(xi({textDelta:n.delta})))},onCustomEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{name:i,value:s}=n;switch(i){case"header":{s?.contentFormat&&e(Ri(s.contentFormat)),typeof s?.followUpEnabled=="boolean"&&e(SS(s.followUpEnabled)),s?.conversationToken&&e(bS(s.conversationToken));return}case"citations":{e(Ei({citations:s.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=xS(n.code);e(Ii({message:n.message,code:i}))},onRunFinishedEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=n.result?.completionReason==="ANSWERED",s=i?!r:void 0;e(Td(i)),e(Ti(!i)),e(Ci(!1)),e(to(i,t,s)),e(ro())}}};var IS=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _ref47=_asyncToGenerator(function*(n,o,i){t();let s=ma(n),a=nh(n),u=oh(n),c=rh(n),g=ih(n),v=hS(s,a,u);e=v;let E=ES(o),h=Wh(n,i());try{o(Cr(!0)),yield v.runAgent({forwardedProps:{params:h,accessToken:c,recordDebugSession:g}},E)}catch(y){o(Cr(!1)),o(Ii({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});return function run(_x89,_x90,_x91){return _ref47.apply(this,arguments)}}(),abortRun:t}};m();d();f();p();m();d();f();p();var RS=G("breadcrumb/deselectAll"),TS=G("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var _S=G("facet/updateFacetAutoSelection",e=>W(e,{allow:new Le({required:!0})}));m();d();f();p();m();d();f();p();var tu=class extends Sr{constructor(r){super(r);oe(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??Ft().q}get responseTime(){return this.activeInstantResultCache?.duration??Bt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??Bt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var kS=()=>ot("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new tu(e)),OS=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var Cp={id:ee},C0={...Cp,q:Nt},dte=G("instantResults/register",e=>W(e,Cp)),ru=G("instantResults/updateQuery",e=>W(e,C0)),pte=G("instantResults/clearExpired",e=>W(e,Cp));m();d();f();p();var nu=new Fe({required:!0,min:0}),bte=G("pagination/registerNumberOfResults",e=>W(e,nu)),wte=G("pagination/updateNumberOfResults",e=>W(e,nu)),Cte=G("pagination/registerPage",e=>W(e,nu)),PS=G("pagination/updatePage",e=>W(e,nu)),xte=G("pagination/nextPage"),Ete=G("pagination/previousPage");m();d();f();p();var xo=G("query/updateQuery",e=>W(e,{q:new re,enableQuerySyntax:new Le}));m();d();f();p();m();d();f();p();m();d();f();p();var Eo=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var xp=()=>ot("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),kr=e=>ot("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||Ft().q,aq:r.advancedSearchQueries?.aq||Eo().aq,cq:r.advancedSearchQueries?.cq||Eo().cq,dq:r.advancedSearchQueries?.dq||Eo().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();m();d();f();p();var ou=e=>e.success!==void 0,pt=e=>e.error!==void 0;m();d();f();p();var wre=G("didYouMean/enable"),Cre=G("didYouMean/disable"),xre=G("didYouMean/automaticCorrections/disable"),Ere=G("didYouMean/automaticCorrections/enable"),iu=G("didYouMean/correction",e=>W(e,ee)),Ire=G("didYouMean/automaticCorrections/mode",e=>W(e,new re({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var Ep=()=>ot("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var NS=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function FS(){return{contextValues:{}}}m();d();f();p();function DS(){return{contextValues:{}}}m();d();f();p();function MS(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function LS(){return[]}m();d();f();p();function jS(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function qS(){return{}}m();d();f();p();function US(){return{}}m();d();f();p();function VS(){return{}}function Xt(e){return{context:e.context||FS(),dictionaryFieldContext:e.dictionaryFieldContext||DS(),facetSet:e.facetSet||fa(),numericFacetSet:e.numericFacetSet||pa(),dateFacetSet:e.dateFacetSet||da(),categoryFacetSet:e.categoryFacetSet||la(),automaticFacetSet:e.automaticFacetSet??ua(),pagination:e.pagination||jS(),query:e.query||Ft(),tabSet:e.tabSet||VS(),advancedSearchQueries:e.advancedSearchQueries||Eo(),staticFilterSet:e.staticFilterSet||US(),querySet:e.querySet||qS(),sortCriteria:e.sortCriteria||ga(),pipeline:e.pipeline||ya(),searchHub:e.searchHub||$n(),facetOptions:e.facetOptions||MS(),facetOrder:e.facetOrder??LS(),debug:e.debug??Fs()}}m();d();f();p();var Zne=new Ce({values:{undoneQuery:Nt},options:{required:!0}}),GS=()=>ot("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var su=G("trigger/query/ignore",e=>W(e,new re({emptyAllowed:!0,required:!0}))),au=G("trigger/query/modification",e=>W(e,new Ce({values:{originalQuery:Be,modification:Be}})));m();d();f();p();var Or=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=I0(e),n=Aa(e),o=x0(e),i=yield no(e,t),s=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Ar({...i,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(r&&{cq:r}),...(n.length&&{facets:n}),...(e.pagination&&{numberOfResults:s(),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:o}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Or(_x92,_x93){return _ref48.apply(this,arguments)}}();function x0(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(E0).filter(r=>r.currentValues.length>0):void 0}function E0(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function I0(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=R0(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function R0(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o})}var Pr=class{constructor(t,r=n=>{this.dispatch(xo({q:n}))}){oe(this,"config",t);oe(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x94,_x95){var _this18=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Sa(yield _this18.extra.apiClient.search(r,n),t),s=Date.now()-o,a=_this18.getState().query?.q||"";return{response:i,duration:s,queryExecuted:a,requestExecuted:r}}).apply(this,arguments)}process(t){var _this19=this;return _asyncToGenerator(function*(){return _this19.processQueryErrorOrContinue(t)??(yield _this19.processQueryCorrectionsOrContinue(t))??(yield _this19.processQueryTriggersOrContinue(t))??_this19.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return pt(t.response)?(this.dispatch(kr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this20=this;return _asyncToGenerator(function*(){let r=_this20.getState(),n=_this20.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:s,queryCorrections:a,queryCorrection:u}=n;if(!o||!i)return null;let c=s.length===0&&a&&a.length!==0,g=!ae(u)&&!ae(u.correctedQuery);if(!c&&!g)return null;let E=c?yield _this20.processLegacyDidYouMeanAutoCorrection(t):_this20.processModernDidYouMeanAutoCorrection(t);return _this20.dispatch(Vt(Xt(_this20.getState()))),E})()}processLegacyDidYouMeanAutoCorrection(t){var _this21=this;return _asyncToGenerator(function*(){let r=_this21.getCurrentQuery(),n=_this21.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this21.automaticallyRetryQueryWithCorrection(o);return pt(i.response)?(_this21.dispatch(kr(i.response.error)),_this21.rejectWithValue(i.response.error)):(_this21.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this21.dispatch(Vt(Xt(_this21.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Ep()})})()}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:Ep()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let r=this.getState(),n=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,r,n),this.extra)}processQueryTriggersOrContinue(t){var _this22=this;return _asyncToGenerator(function*(){let r=_this22.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(a=>a.type==="query")?.content||"";if(!n)return null;if(_this22.getState().triggers?.queryModification.queryToIgnore===n)return _this22.dispatch(su("")),null;_this22.analyticsAction&&(yield _this22.dispatch(_this22.analyticsAction));let i=_this22.getCurrentQuery(),s=yield _this22.automaticallyRetryQueryWithTriggerModification(n);return pt(s.response)?(_this22.dispatch(kr(s.response.error)),_this22.rejectWithValue(s.response.error)):(_this22.dispatch(Vt(Xt(_this22.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:GS()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??Ft().enableQuerySyntax},search:{...Bt(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Vt(Xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return ou(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this23=this;return _asyncToGenerator(function*(){_this23.onUpdateQueryForCorrection(t);let r=yield _this23.fetchFromAPI(yield Or(_this23.getState()),{origin:"mainSearch"});return _this23.dispatch(iu(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.dispatch(au({newQuery:t,originalQuery:_this24.getCurrentQuery()})),_this24.onUpdateQueryForCorrection(t),yield _this24.fetchFromAPI(yield Or(_this24.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 Zoe=we("search/executeSearch",/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t){let r=t.getState();return yield cu(r,t,e)});return function(_x96,_x97){return _ref49.apply(this,arguments)}}()),Joe=we("search/fetchPage",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Rp(r,t,e)});return function(_x98,_x99){return _ref50.apply(this,arguments)}}()),eie=we("search/fetchMoreResults",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Tp(t,r)});return function(_x100,_x101){return _ref51.apply(this,arguments)}}()),tie=we("search/fetchFacetValues",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield O0(t,e,r)});return function(_x102,_x103){return _ref52.apply(this,arguments)}}()),rie=we("search/fetchInstantResults",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){return Ip(e,t)});return function(_x104,_x105){return _ref53.apply(this,arguments)}}()),T0=/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=yield Or(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function T0(_x106,_x107){return _ref54.apply(this,arguments)}}(),_0=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield no(e);return Ar({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function _0(_x108,_x109,_x110){return _ref55.apply(this,arguments)}}(),k0=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){let r=yield Or(e,t);return r.request.numberOfResults=0,r});return function k0(_x111,_x112){return _ref56.apply(this,arguments)}}(),BS=e=>{e.configuration.analytics.enabled&&$t.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Ip(_x113,_x114){return _Ip.apply(this,arguments)}function _Ip(){_Ip=_asyncToGenerator(function*(e,t){W(e,{id:ee,q:ee,maxResultsPerQuery:new Fe({required:!0,min:1}),cacheTimeout:new Fe});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new Pr({...t,analyticsAction:kS()},c=>{t.dispatch(ru({q:c,id:e.id}))}),s=yield _0(o,r,n),a=yield i.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),u=yield i.process(a);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,analyticsAction:u.analyticsAction,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return _Ip.apply(this,arguments)}function Rp(_x115,_x116,_x117){return _Rp.apply(this,arguments)}function _Rp(){_Rp=_asyncToGenerator(function*(e,t,r){BS(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:s}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),a=new Pr({...t,analyticsAction:r}),u=yield Or(e,s),c=yield a.fetchFromAPI(u,{origin:"mainSearch"});return yield a.process(c)});return _Rp.apply(this,arguments)}function Tp(_x118,_x119){return _Tp.apply(this,arguments)}function _Tp(){_Tp=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield xp().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),s=new Pr({...e,analyticsAction:xp()}),a=yield T0(t,i),u=yield s.fetchFromAPI(a,{origin:"mainSearch"});return yield s.process(u)});return _Tp.apply(this,arguments)}function O0(_x120,_x121,_x122){return _O2.apply(this,arguments)}function _O2(){_O2=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=e.extra,{description:s}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),a=new Pr({...e,analyticsAction:t}),u=yield k0(r,s),c=yield a.fetchFromAPI(u,{origin:"facetValues"});return yield a.process(c)});return _O2.apply(this,arguments)}function cu(_x123,_x124,_x125){return _cu.apply(this,arguments)}function _cu(){_cu=_asyncToGenerator(function*(e,t,r){BS(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:s}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),a=yield Or(e,s),u=new Pr({...t,analyticsAction:r}),c=yield u.fetchFromAPI(a,{origin:"mainSearch"});return yield u.process(c)});return _cu.apply(this,arguments)}m();d();f();p();var Nr=class{constructor(t,r=n=>{this.dispatch(xo({q:n}))}){oe(this,"config",t);oe(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x126,_x127){var _this25=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Sa(yield _this25.extra.apiClient.search(r,n),t),s=Date.now()-o,a=_this25.getState().query?.q||"";return{response:i,duration:s,queryExecuted:a,requestExecuted:r}}).apply(this,arguments)}process(t){var _this26=this;return _asyncToGenerator(function*(){return _this26.processQueryErrorOrContinue(t)??(yield _this26.processQueryCorrectionsOrContinue(t))??(yield _this26.processQueryTriggersOrContinue(t))??_this26.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return pt(t.response)?(this.dispatch(kr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getState(),n=_this27.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:s,queryCorrections:a,queryCorrection:u}=n;if(!o)return null;if(!i)return!ae(u)&&!ae(u.correctedQuery)?_this27.processModernDidYouMeanAutoCorrection(t):null;let c=s.length===0&&a&&a.length!==0,g=!ae(u)&&!ae(u.correctedQuery);if(!c&&!g)return null;let E=c?yield _this27.processLegacyDidYouMeanAutoCorrection(t):_this27.processModernDidYouMeanAutoCorrection(t);return _this27.dispatch(Vt(Xt(_this27.getState()))),E})()}processLegacyDidYouMeanAutoCorrection(t){var _this28=this;return _asyncToGenerator(function*(){let r=_this28.getCurrentQuery(),n=_this28.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this28.automaticallyRetryQueryWithCorrection(o);return pt(i.response)?(_this28.dispatch(kr(i.response.error)),_this28.rejectWithValue(i.response.error)):(_this28.dispatch(Vt(Xt(_this28.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o}}processQueryTriggersOrContinue(t){var _this29=this;return _asyncToGenerator(function*(){let r=_this29.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(a=>a.type==="query")?.content||"";if(!n)return null;if(_this29.getState().triggers?.queryModification.queryToIgnore===n)return _this29.dispatch(su("")),null;let i=_this29.getCurrentQuery(),s=yield _this29.automaticallyRetryQueryWithTriggerModification(n);return pt(s.response)?(_this29.dispatch(kr(s.response.error)),_this29.rejectWithValue(s.response.error)):(_this29.dispatch(Vt(Xt(_this29.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Vt(Xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return ou(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this30=this;return _asyncToGenerator(function*(){_this30.onUpdateQueryForCorrection(t);let r=_this30.getState(),{actionCause:n}=NS(),o=yield _this30.fetchFromAPI(yield wr(r,_this30.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this30.dispatch(iu(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.dispatch(au({newQuery:t,originalQuery:_this31.getCurrentQuery()})),_this31.onUpdateQueryForCorrection(t),yield _this31.fetchFromAPI(yield wr(_this31.getState(),_this31.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 Gie=we("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;W(e,{q:new re,enableQuerySyntax:new Le,clearFilters:new Le}),e.clearFilters&&(r(RS()),r(TS())),r(_S({allow:!0})),r(xo({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(PS(1))}),Bie=G("search/updateSearchAction"),uu=we("search/executeSearch",/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return cu(r,t,e.legacy);HS(r);let n=e.next?zS(e.next):void 0,o=yield wr(r,t.extra.navigatorContext,n),i=new Nr({...t,analyticsAction:n??{}}),s=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(s)});return function(_x128,_x129){return _ref57.apply(this,arguments)}}()),$S=we("search/fetchPage",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t){let r=t.getState();if(HS(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Rp(r,t,e.legacy);let n=new Nr({...t,analyticsAction:e.next}),o=yield wr(r,t.extra.navigatorContext,e.next),i=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(i)});return function(_x130,_x131){return _ref58.apply(this,arguments)}}()),QS=we("search/fetchMoreResults",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Tp(t,r);let n=Sh("browseResults",t.getState),o=new Nr({...t,analyticsAction:n}),i=yield P0(r,t.extra.navigatorContext,n),s=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(s)});return function(_x132,_x133){return _ref59.apply(this,arguments)}}()),$ie=we("search/fetchFacetValues",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return cu(r,t,e.legacy);let n=new Nr({...t,analyticsAction:{}}),o=yield F0(r,t.extra.navigatorContext),i=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(i)});return function(_x134,_x135){return _ref60.apply(this,arguments)}}()),Qie=we("search/fetchInstantResults",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Ip(e,t);W(e,{id:ee,q:ee,maxResultsPerQuery:new Fe({required:!0,min:1}),cacheTimeout:new Fe});let{q:n,maxResultsPerQuery:o}=e,i=zS(OS()),s=yield N0(r,t.extra.navigatorContext,n,o,i),a=new Nr({...t,analyticsAction:i},g=>{t.dispatch(ru({q:g,id:e.id}))}),u=yield a.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),c=yield a.process(u);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return function(_x136,_x137){return _ref61.apply(this,arguments)}}()),P0=/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(e,t,r){let n=yield wr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function P0(_x138,_x139,_x140){return _ref62.apply(this,arguments)}}(),N0=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t,r,n,o){let i=ba(e,t,o);return Ar({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function N0(_x141,_x142,_x143,_x144,_x145){return _ref63.apply(this,arguments)}}(),F0=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t,r){let n=yield wr(e,t,r);return n.request.numberOfResults=0,n});return function F0(_x146,_x147,_x148){return _ref64.apply(this,arguments)}}(),HS=e=>{e.configuration.analytics.enabled&&$t.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},zS=e=>({actionCause:e.actionCause,type:e.actionCause});var WS=e=>{let t=bm({extra:e}),r=IS();return t.startListening({actionCreator:uu.pending,effect:function(){var _ref65=_asyncToGenerator(function*(n,o){let i=o.getState();if(!Xl(i))return;r.abortRun(),o.dispatch(Ta()),o.dispatch(CS());let s=Yr(i)?.q;!s||s.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});return function effect(_x149,_x150){return _ref65.apply(this,arguments)}}()}),t};m();d();f();p();var KS=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)},YS=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var _p=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:i}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:i}};m();d();f();p();function XS(e,t){let r={...e},n,o=i=>(s,a)=>{let u=i(s,a);return n?n(u,a):u};return{get combinedReducer(){let i=gf(Object.entries(t).filter(([s])=>!(s in r)).map(([s,a])=>[s,()=>a]));return o(Ln({...i,...r}))},containsAll(i){return Object.keys(i).every(a=>a in r)},add(i){Object.keys(i).filter(s=>!(s in r)).forEach(s=>{r[s]=i[s]})},addCrossReducer(i){n=i}}}m();d();f();p();m();d();f();p();var Io=G("app/setError");m();d();f();p();function D0(e){if(!e||!M0(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),o=decodeURIComponent(n.split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(o)}catch{return null}}function ZS(e,t=60){if(!e)return!1;let r=D0(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function M0(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function eA(e,t){let r=0,n=null,o=Ji(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(u,c=!1){let g=!n;g&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(E){if(!c)throw E;return null}})().finally(()=>{n=null}));let v=yield n;return g&&v&&u.dispatch(Bn({accessToken:v})),v});return function i(_x151){return _ref66.apply(this,arguments)}}(),s=/*#__PURE__*/function(){var _ref68=_asyncToGenerator(function*(u){let c=u.getState(),g=j0(c);if(!(!g||!ZS(g))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(u))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(v){e.warn(v,"Access token renewal failed. A retry will occur if necessary.")}}});return function s(_x152){return _ref68.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(u,c,g){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),JS(u,c.error),c;!n&&(r++,o());try{yield i(u,!0)}catch(E){e.debug(E,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}u.dispatch(g)});return function a(_x153,_x154,_x155){return _ref69.apply(this,arguments)}}();return u=>c=>(/*#__PURE__*/function(){var _ref70=_asyncToGenerator(function*(g){let v=typeof g=="function",E=typeof t=="function";if(!v)return c(g);E&&(yield s(u));let h=yield c(g);return L0(h)?E?yield a(u,h,g):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),JS(u,h.error),h):h});return function(_x156){return _ref70.apply(this,arguments)}}())}function L0(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Pn().name}function JS(e,t){e.dispatch(Io({status:401,statusCode:401,message:t.message,type:t.name}))}function j0(e){return e.configuration.accessToken}m();d();f();p();function tA({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return am({reducer:e,preloadedState:t,devTools:{stateSanitizer:i=>i.history?{...i,history:"<<OMIT>>"}:i,name:o,shouldHotReload:!1},middleware:i=>i({thunk:{extraArgument:n}}).prepend(...r).concat(YS(n.logger))})}function q0(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...o}=r??{},i={...o,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return i.analyticsMode!=="next"&&mf()?(t.info("Analytics disabled since doNotTrack is active."),{...i,enabled:!1}):i}function rA(e,t){let r={...e.reducers,configuration:yt,version:my},n=U0({...e,reducers:r},t,yt),{accessToken:o,environment:i,organizationId:s}=e.configuration;n.dispatch(Bn({accessToken:o,environment:i,organizationId:s}));let a=q0(e.configuration,n.logger);return a&&n.dispatch(Ls(a)),n}function U0(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=XS({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let s=t.logger,a={...t,get relay(){return ii(c.state,o)},get navigatorContext(){return _p(this.relay,o)}},u=V0(e,a,i),c={addReducers(g){i.containsAll(g)||(i.add(g),u.replaceReducer(i.combinedReducer))},dispatch:u.dispatch,subscribe:u.subscribe,enableAnalytics(){u.dispatch(qs())},disableAnalytics(){u.dispatch(js())},get state(){return u.getState()},get relay(){return ii(this.state,o)},get navigatorContext(){return _p(this.relay,o)},logger:s,store:u};return c}function V0(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",s=G0(e,t.logger,()=>t.navigatorContext);return tA({preloadedState:n,reducer:r.combinedReducer,middlewares:s,thunkExtraArguments:t,name:i})}function G0(e,t,r){let{renewAccessToken:n}=e.configuration,o=eA(t,n),i=WS({getNavigatorContext:r});return[Iy,o,KS(t),hy].concat(kd.middleware,i.middleware,e.middlewares||[])}var B0=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
41
+ `),v=JSON.parse(g);r?.event("SSE","Event received:",v,{type:v.type}),n.next(v)}catch(g){n.error(g)}}return n.asObservable()},n0=e=>{let t=new Yt,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==En.HEADERS&&o.type===En.DATA&&o.data){let i=new Uint8Array(r.length+o.data.length);i.set(r,0),i.set(o.data,r.length),r=i,n()}},error:o=>t.error(o),complete:()=>{if(r.length>0)try{n()}catch{console.warn("Incomplete or invalid protocol buffer data at stream end")}t.complete()}});function n(){for(;r.length>=4;){let o=4+new DataView(r.buffer,r.byteOffset,4).getUint32(0,!1);if(r.length<o)break;try{let i=r.slice(4,o),s=aS(i);t.next(s),r=r.slice(o)}catch(i){let s=i instanceof Error?i.message:String(i);t.error(Error(`Failed to decode protocol buffer message: ${s}`));return}}}return t.asObservable()},o0=(e,t)=>{let r=Bi(t),n=new Yt,o=new ec,i=!1;return e.subscribe({next:s=>{if(o.next(s),s.type===En.HEADERS&&!i){i=!0;let a=s.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:a,parser:a===hp?"protobuf":"sse"}),a===hp?n0(o).subscribe({next:u=>n.next(u),error:u=>n.error(u),complete:()=>n.complete()}):r0(o,r).subscribe({next:u=>{try{let c=ja.parse(u);r?.event("HTTP","Event validated:",c,{type:c.type,valid:!0}),n.next(c)}catch(c){r?.event("HTTP","Event invalid:",{json:u,error:String(c)}),n.error(c)}},error:u=>{if(u?.name==="AbortError"){n.next({type:D.RUN_ERROR,message:u.message||"Request aborted",code:"abort",rawEvent:u}),n.complete();return}return n.error(u)},complete:()=>n.complete()})}else i||n.error(Error("No headers event received before data events"))},error:s=>{o.error(s),n.error(s)},complete:()=>{o.complete()}}),n.asObservable()},ke=A.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),i0=A.enum(["LangGraphInterruptEvent","PredictState","Exit"]),s0=A.object({type:A.literal(ke.enum.TextMessageStart),messageId:A.string(),parentMessageId:A.string().optional(),role:A.string().optional()}),a0=A.object({type:A.literal(ke.enum.TextMessageContent),messageId:A.string(),content:A.string()}),c0=A.object({type:A.literal(ke.enum.TextMessageEnd),messageId:A.string()}),u0=A.object({type:A.literal(ke.enum.ActionExecutionStart),actionExecutionId:A.string(),actionName:A.string(),parentMessageId:A.string().optional()}),l0=A.object({type:A.literal(ke.enum.ActionExecutionArgs),actionExecutionId:A.string(),args:A.string()}),d0=A.object({type:A.literal(ke.enum.ActionExecutionEnd),actionExecutionId:A.string()}),p0=A.object({type:A.literal(ke.enum.ActionExecutionResult),actionName:A.string(),actionExecutionId:A.string(),result:A.string()}),f0=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()}),m0=A.object({type:A.literal(ke.enum.MetaEvent),name:i0,value:A.any()}),g0=A.object({type:A.literal(ke.enum.RunError),message:A.string(),code:A.string().optional()});A.discriminatedUnion("type",[s0,a0,c0,u0,l0,d0,p0,f0,m0,g0]),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 h0=e=>{if(typeof e=="string")return e;if(!Array.isArray(e))return;let t=e.filter(r=>r.type==="text").map(r=>r.text).filter(r=>r.length>0);if(t.length!==0)return t.join(`
42
+ `)},y0=(e,t,r)=>n=>{let o={},i=!0,s=!0,a="",u=null,c=null,g=[],v={},E=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(dt(h=>{switch(h.type){case D.TEXT_MESSAGE_START:{let y=h;return[{type:ke.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case D.TEXT_MESSAGE_CONTENT:{let y=h;return[{type:ke.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case D.TEXT_MESSAGE_END:{let y=h;return[{type:ke.enum.TextMessageEnd,messageId:y.messageId}]}case D.TOOL_CALL_START:{let y=h;return g.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),s=!0,v[y.toolCallId]=y.toolCallName,[{type:ke.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case D.TOOL_CALL_ARGS:{let y=h,S=g.find(I=>I.id===y.toolCallId);if(!S)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];S.function.arguments+=y.delta;let x=!1;if(c){let I=c.find(T=>T.tool==S.function.name);if(I)try{let T=JSON.parse(vc(S.function.arguments));I.tool_argument&&I.tool_argument in T?(E({...o,[I.state_key]:T[I.tool_argument]}),x=!0):I.tool_argument||(E({...o,[I.state_key]:T}),x=!0)}catch{}}return[{type:ke.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(x?[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}]:[])]}case D.TOOL_CALL_END:{let y=h;return[{type:ke.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case D.TOOL_CALL_RESULT:{let y=h;return[{type:ke.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:v[y.toolCallId]||"unknown"}]}case D.RAW:return[];case D.CUSTOM:{let y=h;switch(y.name){case"Exit":i=!1;break;case"PredictState":c=y.value;break}return[{type:ke.enum.MetaEvent,name:y.name,value:y.value}]}case D.STATE_SNAPSHOT:return E(h.snapshot),[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}];case D.STATE_DELTA:{let y=h,S=Ha.applyPatch(o,y.delta,!0,!1);return S?(E(S.newDocument),[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}]):[]}case D.MESSAGES_SNAPSHOT:return u=h.messages,[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(u?{messages:u}:{})}),active:!0}];case D.RUN_STARTED:return[];case D.RUN_FINISHED:return u&&(o.messages=u),Object.keys(o).length===0?[]:[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(u?{messages:v0(u)}:{})}),active:!1}];case D.RUN_ERROR:{let y=h;return[{type:ke.enum.RunError,message:y.message,code:y.code}]}case D.STEP_STARTED:return a=h.stepName,g=[],c=null,[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case D.STEP_FINISHED:return g=[],c=null,[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function v0(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=h0(r.content);if(n){let o={id:r.id,role:r.role,content:n};t.push(o)}if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0)for(let o of r.toolCalls){let i={id:o.id,name:o.function.name,arguments:JSON.parse(o.function.arguments),parentMessageId:r.id};t.push(i)}}else if(r.role==="tool"){let n="unknown";for(let i of e)if(i.role==="assistant"&&i.toolCalls?.length){for(let s of i.toolCalls)if(s.id===r.toolCallId){n=s.function.name;break}}let o={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(o)}return t}var eu=e=>t=>{let r=Bi(e),n,o,i,s,a=()=>{if(!n||s!=="text")throw Error("No text message to close");let v={type:D.TEXT_MESSAGE_END,messageId:n.messageId};return s=void 0,n=void 0,r?.event("TRANSFORM","TEXT_MESSAGE_END",v,{messageId:v.messageId}),v},u=()=>{if(!o||s!=="tool")throw Error("No tool call to close");let v={type:D.TOOL_CALL_END,toolCallId:o.toolCallId};return s=void 0,o=void 0,r?.event("TRANSFORM","TOOL_CALL_END",v,{toolCallId:v.toolCallId}),v},c=()=>{if(!i||s!=="reasoning")throw Error("No reasoning message to close");let v={type:D.REASONING_MESSAGE_END,messageId:i.messageId};return s=void 0,i=void 0,r?.event("TRANSFORM","REASONING_MESSAGE_END",v,{messageId:v.messageId}),v},g=()=>s==="text"?[a()]:s==="tool"?[u()]:s==="reasoning"?[c()]:[];return t.pipe(dt(v=>{switch(v.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.MESSAGES_SNAPSHOT:case D.CUSTOM:case D.RUN_STARTED:case D.RUN_FINISHED:case D.RUN_ERROR: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[...g(),v];case D.RAW:case D.ACTIVITY_SNAPSHOT:case D.ACTIVITY_DELTA:case D.REASONING_ENCRYPTED_VALUE:return[v];case D.TEXT_MESSAGE_CHUNK:let E=v,h=[];if((s!=="text"||E.messageId!==void 0&&E.messageId!==n?.messageId)&&h.push(...g()),s!=="text"){if(E.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");n={messageId:E.messageId,name:E.name},s="text";let T={type:D.TEXT_MESSAGE_START,messageId:E.messageId,role:E.role||"assistant",...(E.name!==void 0&&{name:E.name})};h.push(T),r?.event("TRANSFORM","TEXT_MESSAGE_START",T,{messageId:E.messageId})}if(E.delta!==void 0){let T={type:D.TEXT_MESSAGE_CONTENT,messageId:n.messageId,delta:E.delta};h.push(T),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",T,{messageId:n.messageId})}return h;case D.TOOL_CALL_CHUNK:let y=v,S=[];if((s!=="tool"||y.toolCallId!==void 0&&y.toolCallId!==o?.toolCallId)&&S.push(...g()),s!=="tool"){if(y.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(y.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");o={toolCallId:y.toolCallId,toolCallName:y.toolCallName,parentMessageId:y.parentMessageId},s="tool";let T={type:D.TOOL_CALL_START,toolCallId:y.toolCallId,toolCallName:y.toolCallName,parentMessageId:y.parentMessageId};S.push(T),r?.event("TRANSFORM","TOOL_CALL_START",T,{toolCallId:y.toolCallId,toolCallName:y.toolCallName})}if(y.delta!==void 0){let T={type:D.TOOL_CALL_ARGS,toolCallId:o.toolCallId,delta:y.delta};S.push(T),r?.event("TRANSFORM","TOOL_CALL_ARGS",T,{toolCallId:o.toolCallId})}return S;case D.REASONING_MESSAGE_CHUNK:let x=v,I=[];if((s!=="reasoning"||x.messageId&&x.messageId!==i?.messageId)&&I.push(...g()),s!=="reasoning"){if(x.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");i={messageId:x.messageId},s="reasoning";let T={type:D.REASONING_MESSAGE_START,messageId:x.messageId};I.push(T),r?.event("TRANSFORM","REASONING_MESSAGE_START",T,{messageId:x.messageId})}if(x.delta!==void 0){let T={type:D.REASONING_MESSAGE_CONTENT,messageId:i.messageId,delta:x.delta};I.push(T),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",T,{messageId:i.messageId})}return I}return v.type,[]}),xn(()=>{g()}))};function S0(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var tu=class{runNext(e,t){return t.run(e).pipe(eu(!1))}runNextWithState(e,t){let r=we(e.messages||[]),n=we(e.state||{}),o=new ec;return yS(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(hc(/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(s=>setTimeout(s,0)),{event:i,messages:we(r),state:we(n)}});return function(_x88){return _ref42.apply(this,arguments)}}()))}},A0=class extends tu{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function b0(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 w0=class extends tu{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(b0)};return this.runNext(o,t)}},pS="THINKING_START",fS="THINKING_END",mS="THINKING_TEXT_MESSAGE_START",gS="THINKING_TEXT_MESSAGE_CONTENT",hS="THINKING_TEXT_MESSAGE_END",C0=class extends tu{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(Cn(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case pS:{this.currentReasoningId=Gi();let{title:t,...r}=e;return this.warnAboutTransformation(pS,D.REASONING_START),{...r,type:D.REASONING_START,messageId:this.currentReasoningId}}case mS:return this.currentMessageId=Gi(),this.warnAboutTransformation(mS,D.REASONING_MESSAGE_START),{...e,type:D.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case gS:{let{delta:t,...r}=e;return this.warnAboutTransformation(gS,D.REASONING_MESSAGE_CONTENT),{...r,type:D.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Gi(),delta:t}}case hS:{let t=this.currentMessageId??Gi();return this.warnAboutTransformation(hS,D.REASONING_MESSAGE_END),{...e,type:D.REASONING_MESSAGE_END,messageId:t}}case fS:{let t=this.currentReasoningId??Gi();return this.warnAboutTransformation(fS,D.REASONING_END),{...e,type:D.REASONING_END,messageId:t}}default:return e}}};function x0(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function E0(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function I0(e){let t=x0(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 R0(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>E0(n)?I0(n):n);return{...e,content:r}}var T0=class extends tu{run(e,t){let r={...e,messages:e.messages.map(R0)};return this.runNext(r,t)}},_0="0.0.57",k0=class{get maxVersion(){return _0}get debug(){return this._debug}set debug(e){this._debug=Jc(e),this._debugLogger=Sp(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?Sp(Jc(!0)):void 0:this._debugLogger=e}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:i}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??xr(),this.messages=we(n??[]),this.state=we(o??{}),this._debug=Jc(i),this._debugLogger=Sp(this._debug),Vi(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new w0),Vi(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new C0),Vi(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new T0)}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 A0(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this1=this;return _asyncToGenerator(function*(){try{_this1.isRunning=!0,_this1.agentId=_this1.agentId??xr();let r=_this1.prepareRunAgentInput(e);_this1.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this1.agentId,threadId:_this1.threadId});let n,o=new Set(_this1.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{u.outcome==="success"&&(n=u.result)}},..._this1.subscribers,t??{}];yield _this1.onInitialize(r,i),_this1.activeRunDetach$=new Yt;let s;_this1.activeRunCompletionPromise=new Promise(u=>{s=u}),yield mc(Ja(()=>_this1.middlewares.length===0?_this1.run(r):_this1.middlewares.reduceRight((u,c)=>({run:g=>c.run(g,u),get messages(){return u.messages},get state(){return u.state}}),_this1).run(r),eu(_this1.debugLogger),Ap(_this1.debugLogger),u=>u.pipe(yc(_this1.activeRunDetach$)),u=>_this1.apply(r,u,i),u=>_this1.processApplyEvents(r,u,i),ji(u=>(_this1.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this1.agentId,error:u instanceof Error?u.message:String(u)}),_this1.isRunning=!1,_this1.onError(r,u,i))),xn(()=>{_this1.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this1.agentId,threadId:_this1.threadId}),_this1.isRunning=!1,_this1.onFinalize(r,i),s?.(),s=void 0,_this1.activeRunCompletionPromise=void 0,_this1.activeRunDetach$=void 0}))(Me(null)));let a=we(_this1.messages).filter(u=>!o.has(u.id));return{result:n,newMessages:a}}finally{_this1.isRunning=!1}})()}connect(e){throw new Gd}connectAgent(e,t){var _this10=this;return _asyncToGenerator(function*(){try{_this10.isRunning=!0,_this10.agentId=_this10.agentId??xr();let r=_this10.prepareRunAgentInput(e),n,o=new Set(_this10.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{u.outcome==="success"&&(n=u.result)}},..._this10.subscribers,t??{}];yield _this10.onInitialize(r,i),_this10.activeRunDetach$=new Yt;let s;_this10.activeRunCompletionPromise=new Promise(u=>{s=u}),yield mc(Ja(()=>gc(()=>_this10.connect(r)),eu(_this10.debugLogger),Ap(_this10.debugLogger),u=>u.pipe(yc(_this10.activeRunDetach$)),u=>_this10.apply(r,u,i),u=>_this10.processApplyEvents(r,u,i),ji(u=>(_this10.isRunning=!1,u instanceof Gd?tc:_this10.onError(r,u,i))),xn(()=>{_this10.isRunning=!1,_this10.onFinalize(r,i),s?.(),s=void 0,_this10.activeRunCompletionPromise=void 0,_this10.activeRunDetach$=void 0}))(Me(null)),{defaultValue:void 0});let a=we(_this10.messages).filter(u=>!o.has(u.id));return{result:n,newMessages:a}}finally{_this10.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this11=this;return _asyncToGenerator(function*(){if(!_this11.activeRunDetach$)return;let e=_this11.activeRunCompletionPromise??Promise.resolve();_this11.activeRunDetach$.next(),_this11.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return yS(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(op(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=we(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||xr(),tools:we(e?.tools??[]),context:we(e?.context??[]),forwardedProps:we(e?.forwardedProps??{}),state:we(this.state),messages:t,...(e?.resume===void 0?{}:{resume:we(e.resume)})}}onInitialize(e,t){var _this12=this;return _asyncToGenerator(function*(){if(_this12.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(i=>i.interruptId)),o=_this12.pendingInterrupts.map(i=>i.id).filter(i=>!n.has(i));if(o.length>0)throw new Pe(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let i of _this12.pendingInterrupts)if(S0(i))throw new Pe(`Interrupt ${i.id} expired at ${i.expiresAt}`)}let r=yield Re(t,_this12.messages,_this12.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this12,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this12.messages=r.messages,e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this12.messages,state:_this12.state,agent:_this12,input:e})})),r.state&&(_this12.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this12.state,messages:_this12.messages,agent:_this12,input:e})})))})()}onError(e,t,r){return wn(Re(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(Cn(n=>{let o=n;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,r.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,r.forEach(i=>{i.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),o.stopPropagation!==!0){let i=String(t);if(!(t.name==="AbortError"||t.message==="Fetch is aborted"||t.message==="signal is aborted without reason"||t.message==="component unmounted"||i==="component unmounted"))throw console.error("Agent execution failed:",t),t}return{}}))}onFinalize(e,t){var _this13=this;return _asyncToGenerator(function*(){let r=yield Re(t,_this13.messages,_this13.state,(n,o,i)=>n.onRunFinalized?.({messages:o,state:i,agent:_this13,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this13.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this13.messages,state:_this13.state,agent:_this13,input:e})})),r.state!==void 0&&(_this13.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this13.state,messages:_this13.messages,agent:_this13,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=we(this.messages),e.state=we(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=we(this.pendingInterrupts),e}addMessage(e){var _this14=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this14.subscribers)yield t.onNewMessage?.({message:e,messages:_this14.messages,state:_this14.state,agent:_this14});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this14.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this14.messages,state:_this14.state,agent:_this14});for(let t of _this14.subscribers)yield t.onMessagesChanged?.({messages:_this14.messages,state:_this14.state,agent:_this14})})()}addMessages(e){var _this15=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this15.subscribers)yield r.onNewMessage?.({message:t,messages:_this15.messages,state:_this15.state,agent:_this15});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this15.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this15.messages,state:_this15.state,agent:_this15})}for(let t of _this15.subscribers)yield t.onMessagesChanged?.({messages:_this15.messages,state:_this15.state,agent:_this15})})()}setMessages(e){var _this16=this;this.messages=we(e),_asyncToGenerator(function*(){for(let t of _this16.subscribers)yield t.onMessagesChanged?.({messages:_this16.messages,state:_this16.state,agent:_this16})})()}setState(e){var _this17=this;this.state=we(e),_asyncToGenerator(function*(){for(let t of _this17.subscribers)yield t.onStateChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??xr();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(eu(this.debugLogger),Ap(this.debugLogger),y0(this.threadId,t.runId,this.agentId),r=>r.pipe(Cn(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}},vS=class extends k0{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(e),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new l.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new l.AbortController,this.url=e.url,this.headers=we(e.headers??{}),this.fetch=e.fetch??((t,r)=>w(t,r))}run(e){return o0(t0(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=we(this.headers??{}),e.fetch=this.fetch;let t=new l.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};m();d();f();p();var SS=(e,t,r)=>{let n=rt(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let i=`/api/v1/organizations/${t}/agents`;return`${n}${i}/${o}`};var Cp=class extends vS{requestInit(t){let{params:r,accessToken:n,recordDebugSession:o}=t.forwardedProps||{},i={...r,...(o&&{recordDebugSession:!0})};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream, application/json"},body:JSON.stringify(i),signal:this.abortController.signal}}},AS=(e,t,r)=>new Cp({url:`${SS(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var O0=new re({required:!0}),bS=new re({required:!0,constrainTo:Ca}),wS=e=>({...e,name:xa(e.name)}),CS=G("followUpAnswers/setIsEnabled",e=>W(e,new Le({required:!0}))),xS=G("followUpAnswers/setFollowUpAnswersConversationId",e=>W(e,ee)),ES=G("followUpAnswers/setFollowUpAnswersConversationToken",e=>W(e,ee)),IS=G("followUpAnswers/clearFollowUpAnswersConversationToken"),KJ=G("followUpAnswers/createFollowUpAnswer",e=>W(e,{question:ee})),YJ=G("followUpAnswers/setActiveFollowUpAnswerId",e=>W(e,ee)),XJ=G("followUpAnswers/setFollowUpAnswerContentFormat",e=>W(e,{contentFormat:Ia,answerId:ee})),ZJ=G("followUpAnswers/setFollowUpIsLoading",e=>W(e,{isLoading:new Le({required:!0}),answerId:ee})),JJ=G("followUpAnswers/setFollowUpIsStreaming",e=>W(e,{isStreaming:new Le({required:!0}),answerId:ee})),eee=G("followUpAnswers/followUpMessageChunkReceived",e=>W(e,{textDelta:O0,answerId:ee})),tee=G("followUpAnswers/followUpCitationsReceived",e=>W(e,{citations:new Pt({required:!0,each:new xe({values:Td})}),answerId:ee})),ree=G("followUpAnswers/followUpCompleted",e=>W(e,{answerId:ee,cannotAnswer:new Le({required:!1})})),nee=G("followUpAnswers/followUpFailed",e=>W(e,{message:new re,code:new De({min:0}),answerId:ee})),oee=G("followUpAnswers/activeFollowUpStartFailed",e=>W(e,{message:new re})),iee=G("followUpAnswers/likeFollowUp",e=>W(e,{answerId:ee})),see=G("followUpAnswers/dislikeFollowUp",e=>W(e,{answerId:ee})),aee=G("followUpAnswers/submitFollowUpFeedback",e=>W(e,{answerId:ee})),RS=G("followUpAnswers/resetFollowUpAnswers"),cee=G("followUpAnswers/stepStarted",e=>W(wS(e),{answerId:ee,name:bS,startedAt:new De({min:0,required:!0})})),uee=G("followUpAnswers/stepFinished",e=>W(wS(e),{answerId:ee,name:bS,finishedAt:new De({min:0,required:!0})})),lee=G("followUpAnswers/startToolCall",e=>W(e,{answerId:ee,toolCallName:ee,startedAt:new De({min:0,required:!0}),toolCallId:ee})),dee=G("followUpAnswers/finishToolCall",e=>W(e,{answerId:ee,finishedAt:new De({min:0,required:!0}),toolCallId:ee})),pee=G("followUpAnswers/toolCallArgs",e=>W(e,{answerId:ee,toolCallId:ee,args:new xe({options:{required:!0}}),type:new re({required:!0,constrainTo:Ea})}));m();d();f();p();var P0={"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 TS(e){return e?P0[e]??1004:1004}var _S=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Ra(n.runId)),e(Cr(!1)),e(Ci(!0)),e(xS(n.threadId)),e(IS())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(ry({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(ny({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onToolCallStartEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:i,toolCallId:s,timestamp:a}=n;e(oy({toolCallId:s,toolCallName:i,startedAt:a??Date.now()}))},onToolCallEndEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,timestamp:s}=n;e(iy({toolCallId:i,finishedAt:s??Date.now()}))},onToolCallArgsEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,delta:s}=n;try{let a=JSON.parse(s);typeof a?.q=="string"?e(_a({toolCallId:i,args:a,type:"search"})):e(_a({toolCallId:i,args:{raw:s},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${s}`),e(_a({toolCallId:i,args:{raw:s},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(xi({textDelta:n.delta})))},onCustomEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{name:i,value:s}=n;switch(i){case"header":{s?.contentFormat&&e(Ri(s.contentFormat)),typeof s?.followUpEnabled=="boolean"&&e(CS(s.followUpEnabled)),s?.conversationToken&&e(ES(s.conversationToken));return}case"citations":{e(Ei({citations:s.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=TS(n.code);e(Ii({message:n.message,code:i}))},onRunFinishedEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=n.result?.completionReason==="ANSWERED",s=i?!r:void 0;e(_d(i)),e(Ti(!i)),e(Ci(!1)),e(to(i,t,s)),e(ro())}}};var kS=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _ref47=_asyncToGenerator(function*(n,o,i){t();let s=ma(n),a=oh(n),u=ih(n),c=nh(n),g=sh(n),v=AS(s,a,u);e=v;let E=_S(o),h=Kh(n,i());try{o(Cr(!0)),yield v.runAgent({forwardedProps:{params:h,accessToken:c,recordDebugSession:g}},E)}catch(y){o(Cr(!1)),o(Ii({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});return function run(_x89,_x90,_x91){return _ref47.apply(this,arguments)}}(),abortRun:t}};m();d();f();p();m();d();f();p();var OS=G("breadcrumb/deselectAll"),PS=G("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var NS=G("facet/updateFacetAutoSelection",e=>W(e,{allow:new Le({required:!0})}));m();d();f();p();m();d();f();p();var ru=class extends Sr{constructor(r){super(r);oe(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??Ft().q}get responseTime(){return this.activeInstantResultCache?.duration??Bt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??Bt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var FS=()=>ot("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new ru(e)),DS=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var xp={id:ee},N0={...xp,q:Nt},bte=G("instantResults/register",e=>W(e,xp)),nu=G("instantResults/updateQuery",e=>W(e,N0)),wte=G("instantResults/clearExpired",e=>W(e,xp));m();d();f();p();var ou=new De({required:!0,min:0}),Ote=G("pagination/registerNumberOfResults",e=>W(e,ou)),Pte=G("pagination/updateNumberOfResults",e=>W(e,ou)),Nte=G("pagination/registerPage",e=>W(e,ou)),MS=G("pagination/updatePage",e=>W(e,ou)),Fte=G("pagination/nextPage"),Dte=G("pagination/previousPage");m();d();f();p();var xo=G("query/updateQuery",e=>W(e,{q:new re,enableQuerySyntax:new Le}));m();d();f();p();m();d();f();p();m();d();f();p();var Eo=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var Ep=()=>ot("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),kr=e=>ot("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||Ft().q,aq:r.advancedSearchQueries?.aq||Eo().aq,cq:r.advancedSearchQueries?.cq||Eo().cq,dq:r.advancedSearchQueries?.dq||Eo().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();m();d();f();p();var iu=e=>e.success!==void 0,pt=e=>e.error!==void 0;m();d();f();p();var Pre=G("didYouMean/enable"),Nre=G("didYouMean/disable"),Fre=G("didYouMean/automaticCorrections/disable"),Dre=G("didYouMean/automaticCorrections/enable"),su=G("didYouMean/correction",e=>W(e,ee)),Mre=G("didYouMean/automaticCorrections/mode",e=>W(e,new re({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var Ip=()=>ot("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var LS=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function jS(){return{contextValues:{}}}m();d();f();p();function qS(){return{contextValues:{}}}m();d();f();p();function US(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function VS(){return[]}m();d();f();p();function GS(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function BS(){return{}}m();d();f();p();function $S(){return{}}m();d();f();p();function QS(){return{}}function Xt(e){return{context:e.context||jS(),dictionaryFieldContext:e.dictionaryFieldContext||qS(),facetSet:e.facetSet||fa(),numericFacetSet:e.numericFacetSet||pa(),dateFacetSet:e.dateFacetSet||da(),categoryFacetSet:e.categoryFacetSet||la(),automaticFacetSet:e.automaticFacetSet??ua(),pagination:e.pagination||GS(),query:e.query||Ft(),tabSet:e.tabSet||QS(),advancedSearchQueries:e.advancedSearchQueries||Eo(),staticFilterSet:e.staticFilterSet||$S(),querySet:e.querySet||BS(),sortCriteria:e.sortCriteria||ga(),pipeline:e.pipeline||ya(),searchHub:e.searchHub||$n(),facetOptions:e.facetOptions||US(),facetOrder:e.facetOrder??VS(),debug:e.debug??Fs()}}m();d();f();p();var coe=new xe({values:{undoneQuery:Nt},options:{required:!0}}),HS=()=>ot("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var au=G("trigger/query/ignore",e=>W(e,new re({emptyAllowed:!0,required:!0}))),cu=G("trigger/query/modification",e=>W(e,new xe({values:{originalQuery:Be,modification:Be}})));m();d();f();p();var Or=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=M0(e),n=Aa(e),o=F0(e),i=yield no(e,t),s=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Ar({...i,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(r&&{cq:r}),...(n.length&&{facets:n}),...(e.pagination&&{numberOfResults:s(),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:o}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Or(_x92,_x93){return _ref48.apply(this,arguments)}}();function F0(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(D0).filter(r=>r.currentValues.length>0):void 0}function D0(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function M0(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=L0(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function L0(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o})}var Pr=class{constructor(t,r=n=>{this.dispatch(xo({q:n}))}){oe(this,"config",t);oe(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x94,_x95){var _this18=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Sa(yield _this18.extra.apiClient.search(r,n),t),s=Date.now()-o,a=_this18.getState().query?.q||"";return{response:i,duration:s,queryExecuted:a,requestExecuted:r}}).apply(this,arguments)}process(t){var _this19=this;return _asyncToGenerator(function*(){return _this19.processQueryErrorOrContinue(t)??(yield _this19.processQueryCorrectionsOrContinue(t))??(yield _this19.processQueryTriggersOrContinue(t))??_this19.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return pt(t.response)?(this.dispatch(kr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this20=this;return _asyncToGenerator(function*(){let r=_this20.getState(),n=_this20.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:s,queryCorrections:a,queryCorrection:u}=n;if(!o||!i)return null;let c=s.length===0&&a&&a.length!==0,g=!ce(u)&&!ce(u.correctedQuery);if(!c&&!g)return null;let E=c?yield _this20.processLegacyDidYouMeanAutoCorrection(t):_this20.processModernDidYouMeanAutoCorrection(t);return _this20.dispatch(Vt(Xt(_this20.getState()))),E})()}processLegacyDidYouMeanAutoCorrection(t){var _this21=this;return _asyncToGenerator(function*(){let r=_this21.getCurrentQuery(),n=_this21.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this21.automaticallyRetryQueryWithCorrection(o);return pt(i.response)?(_this21.dispatch(kr(i.response.error)),_this21.rejectWithValue(i.response.error)):(_this21.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this21.dispatch(Vt(Xt(_this21.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Ip()})})()}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:Ip()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let r=this.getState(),n=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,r,n),this.extra)}processQueryTriggersOrContinue(t){var _this22=this;return _asyncToGenerator(function*(){let r=_this22.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(a=>a.type==="query")?.content||"";if(!n)return null;if(_this22.getState().triggers?.queryModification.queryToIgnore===n)return _this22.dispatch(au("")),null;_this22.analyticsAction&&(yield _this22.dispatch(_this22.analyticsAction));let i=_this22.getCurrentQuery(),s=yield _this22.automaticallyRetryQueryWithTriggerModification(n);return pt(s.response)?(_this22.dispatch(kr(s.response.error)),_this22.rejectWithValue(s.response.error)):(_this22.dispatch(Vt(Xt(_this22.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:HS()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??Ft().enableQuerySyntax},search:{...Bt(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Vt(Xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return iu(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this23=this;return _asyncToGenerator(function*(){_this23.onUpdateQueryForCorrection(t);let r=yield _this23.fetchFromAPI(yield Or(_this23.getState()),{origin:"mainSearch"});return _this23.dispatch(su(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.dispatch(cu({newQuery:t,originalQuery:_this24.getCurrentQuery()})),_this24.onUpdateQueryForCorrection(t),yield _this24.fetchFromAPI(yield Or(_this24.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 cie=Ce("search/executeSearch",/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t){let r=t.getState();return yield uu(r,t,e)});return function(_x96,_x97){return _ref49.apply(this,arguments)}}()),uie=Ce("search/fetchPage",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Tp(r,t,e)});return function(_x98,_x99){return _ref50.apply(this,arguments)}}()),lie=Ce("search/fetchMoreResults",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();return yield _p(t,r)});return function(_x100,_x101){return _ref51.apply(this,arguments)}}()),die=Ce("search/fetchFacetValues",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield V0(t,e,r)});return function(_x102,_x103){return _ref52.apply(this,arguments)}}()),pie=Ce("search/fetchInstantResults",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){return Rp(e,t)});return function(_x104,_x105){return _ref53.apply(this,arguments)}}()),j0=/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=yield Or(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function j0(_x106,_x107){return _ref54.apply(this,arguments)}}(),q0=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield no(e);return Ar({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function q0(_x108,_x109,_x110){return _ref55.apply(this,arguments)}}(),U0=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){let r=yield Or(e,t);return r.request.numberOfResults=0,r});return function U0(_x111,_x112){return _ref56.apply(this,arguments)}}(),zS=e=>{e.configuration.analytics.enabled&&$t.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Rp(_x113,_x114){return _Rp.apply(this,arguments)}function _Rp(){_Rp=_asyncToGenerator(function*(e,t){W(e,{id:ee,q:ee,maxResultsPerQuery:new De({required:!0,min:1}),cacheTimeout:new De});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new Pr({...t,analyticsAction:FS()},c=>{t.dispatch(nu({q:c,id:e.id}))}),s=yield q0(o,r,n),a=yield i.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),u=yield i.process(a);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,analyticsAction:u.analyticsAction,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return _Rp.apply(this,arguments)}function Tp(_x115,_x116,_x117){return _Tp.apply(this,arguments)}function _Tp(){_Tp=_asyncToGenerator(function*(e,t,r){zS(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:s}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),a=new Pr({...t,analyticsAction:r}),u=yield Or(e,s),c=yield a.fetchFromAPI(u,{origin:"mainSearch"});return yield a.process(c)});return _Tp.apply(this,arguments)}function _p(_x118,_x119){return _p2.apply(this,arguments)}function _p2(){_p2=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield Ep().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),s=new Pr({...e,analyticsAction:Ep()}),a=yield j0(t,i),u=yield s.fetchFromAPI(a,{origin:"mainSearch"});return yield s.process(u)});return _p2.apply(this,arguments)}function V0(_x120,_x121,_x122){return _V.apply(this,arguments)}function _V(){_V=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=e.extra,{description:s}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),a=new Pr({...e,analyticsAction:t}),u=yield U0(r,s),c=yield a.fetchFromAPI(u,{origin:"facetValues"});return yield a.process(c)});return _V.apply(this,arguments)}function uu(_x123,_x124,_x125){return _uu.apply(this,arguments)}function _uu(){_uu=_asyncToGenerator(function*(e,t,r){zS(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:s}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),a=yield Or(e,s),u=new Pr({...t,analyticsAction:r}),c=yield u.fetchFromAPI(a,{origin:"mainSearch"});return yield u.process(c)});return _uu.apply(this,arguments)}m();d();f();p();var Nr=class{constructor(t,r=n=>{this.dispatch(xo({q:n}))}){oe(this,"config",t);oe(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x126,_x127){var _this25=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Sa(yield _this25.extra.apiClient.search(r,n),t),s=Date.now()-o,a=_this25.getState().query?.q||"";return{response:i,duration:s,queryExecuted:a,requestExecuted:r}}).apply(this,arguments)}process(t){var _this26=this;return _asyncToGenerator(function*(){return _this26.processQueryErrorOrContinue(t)??(yield _this26.processQueryCorrectionsOrContinue(t))??(yield _this26.processQueryTriggersOrContinue(t))??_this26.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return pt(t.response)?(this.dispatch(kr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getState(),n=_this27.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:s,queryCorrections:a,queryCorrection:u}=n;if(!o)return null;if(!i)return!ce(u)&&!ce(u.correctedQuery)?_this27.processModernDidYouMeanAutoCorrection(t):null;let c=s.length===0&&a&&a.length!==0,g=!ce(u)&&!ce(u.correctedQuery);if(!c&&!g)return null;let E=c?yield _this27.processLegacyDidYouMeanAutoCorrection(t):_this27.processModernDidYouMeanAutoCorrection(t);return _this27.dispatch(Vt(Xt(_this27.getState()))),E})()}processLegacyDidYouMeanAutoCorrection(t){var _this28=this;return _asyncToGenerator(function*(){let r=_this28.getCurrentQuery(),n=_this28.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this28.automaticallyRetryQueryWithCorrection(o);return pt(i.response)?(_this28.dispatch(kr(i.response.error)),_this28.rejectWithValue(i.response.error)):(_this28.dispatch(Vt(Xt(_this28.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o}}processQueryTriggersOrContinue(t){var _this29=this;return _asyncToGenerator(function*(){let r=_this29.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(a=>a.type==="query")?.content||"";if(!n)return null;if(_this29.getState().triggers?.queryModification.queryToIgnore===n)return _this29.dispatch(au("")),null;let i=_this29.getCurrentQuery(),s=yield _this29.automaticallyRetryQueryWithTriggerModification(n);return pt(s.response)?(_this29.dispatch(kr(s.response.error)),_this29.rejectWithValue(s.response.error)):(_this29.dispatch(Vt(Xt(_this29.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Vt(Xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return iu(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this30=this;return _asyncToGenerator(function*(){_this30.onUpdateQueryForCorrection(t);let r=_this30.getState(),{actionCause:n}=LS(),o=yield _this30.fetchFromAPI(yield wr(r,_this30.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this30.dispatch(su(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.dispatch(cu({newQuery:t,originalQuery:_this31.getCurrentQuery()})),_this31.onUpdateQueryForCorrection(t),yield _this31.fetchFromAPI(yield wr(_this31.getState(),_this31.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 Zie=Ce("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;W(e,{q:new re,enableQuerySyntax:new Le,clearFilters:new Le}),e.clearFilters&&(r(OS()),r(PS())),r(NS({allow:!0})),r(xo({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(MS(1))}),Jie=G("search/updateSearchAction"),lu=Ce("search/executeSearch",/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return uu(r,t,e.legacy);YS(r);let n=e.next?XS(e.next):void 0,o=yield wr(r,t.extra.navigatorContext,n),i=new Nr({...t,analyticsAction:n??{}}),s=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(s)});return function(_x128,_x129){return _ref57.apply(this,arguments)}}()),WS=Ce("search/fetchPage",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t){let r=t.getState();if(YS(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Tp(r,t,e.legacy);let n=new Nr({...t,analyticsAction:e.next}),o=yield wr(r,t.extra.navigatorContext,e.next),i=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(i)});return function(_x130,_x131){return _ref58.apply(this,arguments)}}()),KS=Ce("search/fetchMoreResults",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return _p(t,r);let n=Ah("browseResults",t.getState),o=new Nr({...t,analyticsAction:n}),i=yield G0(r,t.extra.navigatorContext,n),s=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(s)});return function(_x132,_x133){return _ref59.apply(this,arguments)}}()),ese=Ce("search/fetchFacetValues",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return uu(r,t,e.legacy);let n=new Nr({...t,analyticsAction:{}}),o=yield $0(r,t.extra.navigatorContext),i=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(i)});return function(_x134,_x135){return _ref60.apply(this,arguments)}}()),tse=Ce("search/fetchInstantResults",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Rp(e,t);W(e,{id:ee,q:ee,maxResultsPerQuery:new De({required:!0,min:1}),cacheTimeout:new De});let{q:n,maxResultsPerQuery:o}=e,i=XS(DS()),s=yield B0(r,t.extra.navigatorContext,n,o,i),a=new Nr({...t,analyticsAction:i},g=>{t.dispatch(nu({q:g,id:e.id}))}),u=yield a.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),c=yield a.process(u);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return function(_x136,_x137){return _ref61.apply(this,arguments)}}()),G0=/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(e,t,r){let n=yield wr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function G0(_x138,_x139,_x140){return _ref62.apply(this,arguments)}}(),B0=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t,r,n,o){let i=ba(e,t,o);return Ar({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function B0(_x141,_x142,_x143,_x144,_x145){return _ref63.apply(this,arguments)}}(),$0=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t,r){let n=yield wr(e,t,r);return n.request.numberOfResults=0,n});return function $0(_x146,_x147,_x148){return _ref64.apply(this,arguments)}}(),YS=e=>{e.configuration.analytics.enabled&&$t.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},XS=e=>({actionCause:e.actionCause,type:e.actionCause});var ZS=e=>{let t=wm({extra:e}),r=kS();return t.startListening({actionCreator:lu.pending,effect:function(){var _ref65=_asyncToGenerator(function*(n,o){let i=o.getState();if(!Zl(i))return;r.abortRun(),o.dispatch(Ta()),o.dispatch(RS());let s=Yr(i)?.q;!s||s.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});return function effect(_x149,_x150){return _ref65.apply(this,arguments)}}()}),t};m();d();f();p();var JS=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)},eA=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var kp=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:i}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:i}};m();d();f();p();function tA(e,t){let r={...e},n,o=i=>(s,a)=>{let u=i(s,a);return n?n(u,a):u};return{get combinedReducer(){let i=hf(Object.entries(t).filter(([s])=>!(s in r)).map(([s,a])=>[s,()=>a]));return o(Ln({...i,...r}))},containsAll(i){return Object.keys(i).every(a=>a in r)},add(i){Object.keys(i).filter(s=>!(s in r)).forEach(s=>{r[s]=i[s]})},addCrossReducer(i){n=i}}}m();d();f();p();m();d();f();p();var Io=G("app/setError");m();d();f();p();function Q0(e){if(!e||!H0(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),o=decodeURIComponent(n.split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(o)}catch{return null}}function rA(e,t=60){if(!e)return!1;let r=Q0(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function H0(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function oA(e,t){let r=0,n=null,o=Ji(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(u,c=!1){let g=!n;g&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(E){if(!c)throw E;return null}})().finally(()=>{n=null}));let v=yield n;return g&&v&&u.dispatch(Bn({accessToken:v})),v});return function i(_x151){return _ref66.apply(this,arguments)}}(),s=/*#__PURE__*/function(){var _ref68=_asyncToGenerator(function*(u){let c=u.getState(),g=W0(c);if(!(!g||!rA(g))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(u))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(v){e.warn(v,"Access token renewal failed. A retry will occur if necessary.")}}});return function s(_x152){return _ref68.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(u,c,g){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),nA(u,c.error),c;!n&&(r++,o());try{yield i(u,!0)}catch(E){e.debug(E,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}u.dispatch(g)});return function a(_x153,_x154,_x155){return _ref69.apply(this,arguments)}}();return u=>c=>(/*#__PURE__*/function(){var _ref70=_asyncToGenerator(function*(g){let v=typeof g=="function",E=typeof t=="function";if(!v)return c(g);E&&(yield s(u));let h=yield c(g);return z0(h)?E?yield a(u,h,g):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),nA(u,h.error),h):h});return function(_x156){return _ref70.apply(this,arguments)}}())}function z0(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Pn().name}function nA(e,t){e.dispatch(Io({status:401,statusCode:401,message:t.message,type:t.name}))}function W0(e){return e.configuration.accessToken}m();d();f();p();function iA({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return cm({reducer:e,preloadedState:t,devTools:{stateSanitizer:i=>i.history?{...i,history:"<<OMIT>>"}:i,name:o,shouldHotReload:!1},middleware:i=>i({thunk:{extraArgument:n}}).prepend(...r).concat(eA(n.logger))})}function K0(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...o}=r??{},i={...o,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return i.analyticsMode!=="next"&&gf()?(t.info("Analytics disabled since doNotTrack is active."),{...i,enabled:!1}):i}function sA(e,t){let r={...e.reducers,configuration:yt,version:gy},n=Y0({...e,reducers:r},t,yt),{accessToken:o,environment:i,organizationId:s}=e.configuration;n.dispatch(Bn({accessToken:o,environment:i,organizationId:s}));let a=K0(e.configuration,n.logger);return a&&n.dispatch(Ls(a)),n}function Y0(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=tA({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let s=t.logger,a={...t,get relay(){return ii(c.state,o)},get navigatorContext(){return kp(this.relay,o)}},u=X0(e,a,i),c={addReducers(g){i.containsAll(g)||(i.add(g),u.replaceReducer(i.combinedReducer))},dispatch:u.dispatch,subscribe:u.subscribe,enableAnalytics(){u.dispatch(qs())},disableAnalytics(){u.dispatch(js())},get state(){return u.getState()},get relay(){return ii(this.state,o)},get navigatorContext(){return kp(this.relay,o)},logger:s,store:u};return c}function X0(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",s=Z0(e,t.logger,()=>t.navigatorContext);return iA({preloadedState:n,reducer:r.combinedReducer,middlewares:s,thunkExtraArguments:t,name:i})}function Z0(e,t,r){let{renewAccessToken:n}=e.configuration,o=oA(t,n),i=ZS({getNavigatorContext:r});return[Ry,o,JS(t),yy].concat(Od.middleware,i.middleware,e.middlewares||[])}var J0=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
43
43
  However, this mode is not available for Coveo for Service features, and this configuration may not work as expected.
44
44
  Please switch back to the "legacy" analytics mode to ensure proper functionality.
45
- For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function nA(e){e==="next"&&console.warn(B0)}m();d();f();p();var fA=kt(pA(),1);function mA(e){return(0,fA.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function gA(e,t){let r=aO(e),n=ll,o=cO(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t}}function aO(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function cO(e){return e.preprocessRequest||ts}m();d();f();p();m();d();f();p();var hA={organizationId:ee,accessToken:ee,name:new re({required:!1,emptyAllowed:!1}),analytics:new Ce({options:{required:!1},values:{enabled:new Le({required:!1}),originContext:new re({required:!1}),originLevel2:new re({required:!1}),originLevel3:new re({required:!1}),analyticsMode:new re({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new re({required:!1,url:!0}),trackingId:new re({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/})}}),environment:new re({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};var yA=new Ot({...hA,caseAssistId:ee,locale:Be});var uO={debug:km,caseAssistConfiguration:yr,searchHub:Mm};function vA(e){let t=mA(e.loggerOptions);lO(e.configuration,t);let r=dO(e.configuration,t),n={...gA(e.configuration,t),apiClient:r},o={...e,reducers:uO},i=rA(o,n);nA(i.state.configuration.analytics.analyticsMode);let{caseAssistId:s,locale:a,searchHub:u,proxyBaseUrl:c}=e.configuration;return i.dispatch(Ps({caseAssistId:s,locale:a,proxyBaseUrl:c})),ae(u)||i.dispatch(Ds(u)),{...i,get state(){return i.state}}}function lO(e,t){try{yA.validate(e)}catch(r){throw t.error(r,"Case Assist engine configuration error"),r}}function dO(e,t){return new ss({logger:t,preprocessRequest:e.preprocessRequest||ts})}m();d();f();p();m();d();f();p();m();d();f();p();var SA=(i=>(i.id="id",i.subject="subject",i.description="description",i.category="category",i.productId="productId",i))(SA||{}),AA=e=>!Object.values(SA).includes(e),ft=e=>{let t=r=>pO(e,r)??mO(e,r);return{id:t("id"),subject:t("subject"),description:t("description"),category:t("category"),productId:t("productId"),custom:{...fO(e),...gO(e)}}},pO=(e,t)=>e?.caseInput?.[t]?.value,fO=e=>Object.keys(e?.caseInput??[]).reduce((t,r)=>{if(AA(r)){let n=e?.caseInput?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),mO=(e,t)=>e?.caseField?.fields[t]?.value,gO=e=>Object.keys(e?.caseField?.fields??[]).reduce((t,r)=>{if(AA(r)){let n=e?.caseField?.fields?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),Dp=(e,t,r=!1)=>{let n=Object.keys(e?.caseField?.fields??{}).find(a=>e?.caseField?.fields[a].suggestions.some(u=>u.id===t));if(!n)throw new Error(`Classification with ID '${t}' could not be found.`);let i=e?.caseField?.fields[n]?.suggestions.find(a=>a.id===t),s={classificationId:i?.id??"",responseId:e.caseField?.status.lastResponseId??"",fieldName:n,classification:{value:i?.value??"",confidence:i?.confidence??0}};return r?{...s,autoSelection:r}:s},gr=(e,t,r=!1,n=!1)=>{let o,i=e.documentSuggestion?.documents.find((a,u)=>{let c=a.uniqueId===t;return c&&(o=u+1),c});if(!i)throw new Error(`Document Suggestion with ID '${t}' could not be found.`);let s={suggestionId:i.uniqueId,permanentId:i.fields.permanentid,responseId:e.documentSuggestion?.status.lastResponseId??"",suggestion:{documentUri:i.fields.uri,documentUriHash:i.fields.urihash,documentTitle:i.title,documentUrl:i.clickUri,documentPosition:o??0,sourceName:i.fields.source}};return r?{...s,fromQuickview:r}:n?{...s,openDocument:n}:s};var bA=()=>ht({prefix:"analytics/caseAssist/case/start",__legacy__getBuilder:(e,t)=>e.logEnterInterface({ticket:ft(t)}),analyticsType:"CaseAssist.Start",analyticsPayloadBuilder:()=>({})}),wA=e=>ht("analytics/caseAssist/case/nextStage",(t,r)=>t.logMoveToNextCaseStep({ticket:ft(r),stage:e?.stageName})),CA=()=>ht({prefix:"analytics/caseAssist/case/create",__legacy__getBuilder:(e,t)=>e.logCaseCreated({ticket:ft(t)}),analyticsType:"CaseAssist.CreateTicket",analyticsPayloadBuilder:e=>{let{id:t,category:r,subject:n,description:o,productId:i}=ft(e);return{ticket:{id:t,category:r,subject:n,description:o,system:i}}}}),xA=()=>ht({prefix:"analytics/caseAssist/case/solve",__legacy__getBuilder:(e,t)=>e.logCaseSolved({ticket:ft(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"solved"})}),EA=()=>ht({prefix:"analytics/caseAssist/case/abandon",__legacy__getBuilder:(e,t)=>e.logCaseCancelled({ticket:ft(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"quit"})}),To=e=>ht({prefix:"analytics/caseAssist/case/field/update",__legacy__getBuilder:(t,r)=>t.logUpdateCaseField({fieldName:e,ticket:ft(r)}),analyticsType:"CaseAssist.UpdateField",analyticsPayloadBuilder:t=>{let r=t.caseField?.fields?.[e]?.value||t.caseInput?.[e]?.value||"";return{fieldName:e,fieldValue:r}}}),IA=e=>ht({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:Dp(r,e,!0),ticket:ft(r)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let r=t.caseField?.status?.lastResponseId;if(r)return{autoselected:!0,classificationId:e,responseId:r}}}),pu=e=>ht({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:Dp(r,e),ticket:ft(r)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let r=t.caseField?.status?.lastResponseId;if(r)return{autoselected:!1,classificationId:e,responseId:r}}}),RA=e=>ht({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logSelectDocumentSuggestion({suggestion:gr(r,e),ticket:ft(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=gr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),fu=e=>ht({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logQuickviewDocumentSuggestion({suggestion:gr(r,e),ticket:ft(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=gr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),TA=e=>ht({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logSelectDocumentSuggestion({suggestion:gr(r,e,!1,!0),ticket:ft(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=gr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),_A=(e,t)=>ht({prefix:"analytics/caseAssist/documentSuggestion/rate",__legacy__getBuilder:(r,n)=>r.logRateDocumentSuggestion({rating:t,suggestion:gr(n,e),ticket:ft(n)}),analyticsType:"CaseAssist.DocumentSuggestionFeedback",analyticsPayloadBuilder:r=>{let n=r.documentSuggestion?.status?.lastResponseId,o=gr(r,e);if(n)return{responseId:n,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:o.suggestionId,url:o.suggestion.documentUri,title:o.suggestion.documentTitle},liked:!!t}}});m();d();f();p();var _o=G("caseAssist/caseField/register",e=>W(e,{fieldName:ee,fieldValue:Nt})),ko=G("caseAssist/caseField/update",e=>W(e,{fieldName:ee,fieldValue:Nt})),Zt=we("caseAssist/classifications/fetch",/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=yield n.getCaseClassifications(yield hO(o));return pt(i)?r(i.error):{response:i.success}});return function(_x157,_x158){return _ref71.apply(this,arguments)}}()),hO=/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??rt(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield Zn(e.configuration.analytics)}),fields:e.caseInput,context:e.caseField?is(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function hO(_x159){return _ref72.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var kA=()=>({status:{loading:!1,error:null,lastResponseId:""},fields:{}});var Dr=Ge(kA(),e=>{e.addCase(_o,(t,r)=>{let{fieldName:n,fieldValue:o}=r.payload;t.fields[n]={value:o,suggestions:[]}}).addCase(ko,(t,r)=>{let{fieldName:n,fieldValue:o}=r.payload;t.fields[n].value=o}).addCase(Zt.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase(Zt.fulfilled,(t,r)=>{let n={value:"",suggestions:[]};Object.entries(r.payload.response.fields).forEach(([o,i])=>{t.fields[o]||(t.fields[o]={...n}),t.fields[o].suggestions=i.predictions}),t.status.lastResponseId=r.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase(Zt.pending,t=>{t.status.loading=!0}).addCase(Io,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();m();d();f();p();var Rn=G("caseAssist/caseInput/update",e=>W(e,{fieldName:ee,fieldValue:Nt}));m();d();f();p();var OA=()=>({});var Mr=Ge(OA(),e=>{e.addCase(Rn,(t,r)=>{t[r.payload.fieldName]={value:r.payload.fieldValue}})});m();d();f();p();var Rt=we("caseAssist/documentSuggestions/fetch",/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),s=yield n.getDocumentSuggestions(yield yO(i,o));return pt(s)?r(s.error):{response:s.success}});return function(_x160,_x161){return _ref73.apply(this,arguments)}}()),yO=/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??rt(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield Zn(e.configuration.analytics)}),...(e.configuration.analytics.enabled&&tn(e.configuration.analytics,t,{actionCause:"documentSuggestion"})),fields:e.caseInput,context:e.caseField?is(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function yO(_x162,_x163){return _ref74.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var PA=()=>({status:{loading:!1,error:null,lastResponseId:""},documents:[]});var Jt=Ge(PA(),e=>{e.addCase(Rt.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase(Rt.fulfilled,(t,r)=>{t.documents=r.payload.response.documents,t.status.lastResponseId=r.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase(Rt.pending,t=>{t.status.loading=!0}).addCase(Io,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();function er(e){let t,r=new Map,n=()=>r.size===0,o=i=>{try{let s=JSON.stringify(i),a=t!==s;return t=s,a}catch(s){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",s),!0}};return{subscribe(i){i();let s=Symbol(),a;return n()&&(t=JSON.stringify(this.state),a=e.subscribe(()=>{o(this.state)&&r.forEach(u=>u())})),r.set(s,i),()=>{r.delete(s),n()&&a?.()}},get state(){return{}}}}var vO=new Ot({field:ee});function NA(e,t={}){if(!SO(e))throw At;let r=er(e),{dispatch:n}=e,o=Os(e,vO,t.options,"buildCaseField"),i=()=>e.state;return i().caseField?.fields?.[o.field]||n(_o({fieldName:o.field,fieldValue:""})),{...r,get state(){let a=i().caseField?.status?.loading??!1,u=i().caseField?.status?.error??null,c=i().caseField?.fields?.[o.field],g=c?.value??"",v=c?.suggestions??[];return{loading:a,error:u,value:g,suggestions:v}},update(a,u,c){let g=i().caseField?.fields?.[o.field]?.suggestions?.find(v=>v.value===a)?.id;g&&n(c?IA(g):pu(g)),n(ko({fieldName:o.field,fieldValue:a})),!c&&n(To(o.field)),u?.caseClassifications&&n(Zt()),u?.documentSuggestions&&n(Rt())}}}function SO(e){return e.addReducers({configuration:yt,caseAssistConfiguration:yr,caseInput:Mr,caseField:Dr,documentSuggestion:Jt}),!0}m();d();f();p();function AO(e,t){let r=new Ot({field:ee});Os(e,r,t,"buildCaseInput")}function FA(e,t){if(!bO(e))throw At;let r=er(e),{dispatch:n}=e,o=()=>e.state;AO(e,t.options);let i=t.options.field;return o().caseInput?.[i]||n(Rn({fieldName:i,fieldValue:""})),{...r,update(a,u){n(Rn({fieldName:i,fieldValue:a})),n(To(i)),u?.caseClassifications&&n(Zt()),u?.documentSuggestions&&n(Rt())},get state(){return o().caseInput[i]}}}function bO(e){return e.addReducers({configuration:yt,caseAssistConfiguration:yr,caseInput:Mr,caseField:Dr,documentSuggestion:Jt}),!0}m();d();f();p();m();d();f();p();function DA(e,t,r){if(!wO(e))throw At;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:Ji(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function wO(e){return e.addReducers({configuration:yt}),!0}function MA(e,t){let r=!1;return DA(e,t,()=>{r||(r=!0,e.dispatch(TA(t.options.result.uniqueId)))})}m();d();f();p();function Mp(e){if(!CO(e))throw At;let t=er(e),{dispatch:r}=e,n=()=>e.state;return{...t,fetch(){r(Rt())},get state(){let o=n().documentSuggestion;return{loading:o.status.loading,error:o.status.error,documents:o.documents}}}}function CO(e){return e.addReducers({configuration:yt,caseAssistConfiguration:yr,caseInput:Mr,caseField:Dr,documentSuggestion:Jt}),!0}m();d();f();p();m();d();f();p();m();d();f();p();function mu(_x164,_x165){return _mu.apply(this,arguments)}function _mu(){_mu=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:o}=e.configuration,i=e.query?.q||"";return{url:r.apiBaseUrl??Fn(e.configuration.organizationId,e.configuration.environment),accessToken:n,organizationId:o,enableNavigation:!1,q:i,...t,requestedOutputSize:t.requestedOutputSize||0,...(r.authenticationProviders.length&&{authentication:r.authenticationProviders.join(",")})}});return _mu.apply(this,arguments)}var Qi=we("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),i=yield mu(o,e),s=yield t.apiClient.html(i);return pt(s)?n(s.error):{content:s.success,uniqueId:e.uniqueId}});return function(_x166,_x167){return _ref75.apply(this,arguments)}}()),gu=G("resultPreview/next"),hu=G("resultPreview/previous"),yu=G("resultPreview/prepare",e=>W(e,{results:new Pt({required:!0})})),LA=2048,vu=we("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=If(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>LA&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${LA} characters.`),{contentURL:o}});return function(_x168,_x169){return _ref76.apply(this,arguments)}}());m();d();f();p();m();d();f();p();m();d();f();p();function Lp(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var jp=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=Lp();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},qp=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),jA=Ge(Lp(),e=>{e.addCase(Qi.pending,t=>{t.isLoading=!0}).addCase(Qi.fulfilled,(t,r)=>{let{content:n,uniqueId:o}=r.payload;t.position=t.resultsWithPreview.indexOf(o),t.content=n,t.uniqueId=o,t.isLoading=!1}).addCase(uu.fulfilled,(t,r)=>{jp(t),t.resultsWithPreview=qp(r.payload.response.results)}).addCase(QS.fulfilled,(t,r)=>{jp(t),t.resultsWithPreview=t.resultsWithPreview.concat(qp(r.payload.response.results))}).addCase($S.fulfilled,jp).addCase(yu,(t,r)=>{t.resultsWithPreview=qp(r.payload.results)}).addCase(gu,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(hu,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(vu.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});function qA(e,t,r,n,o){if(!xO(e))throw At;let{dispatch:i}=e,s=()=>e.state,a=er(e),{result:u,maximumPreviewSize:c}=t.options,g=()=>{let{resultsWithPreview:E,position:h}=s().resultPreview;return E[h]},v=E=>{i(vu({uniqueId:E,requestedOutputSize:c,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||i(Qi({uniqueId:E,requestedOutputSize:c})),o&&o()};return{...a,fetchResultContent(){v(u.uniqueId)},next(){i(gu()),v(g())},previous(){i(hu()),v(g())},get state(){let E=s(),h=u.hasHtmlVersion,y=E.resultPreview,S=u.uniqueId===y.uniqueId?y.content:"",x=y.isLoading,I=y.contentURL,T=g();return{content:S,resultHasPreview:h,isLoading:x,contentURL:I,currentResultUniqueId:T}}}}function xO(e){return e.addReducers({configuration:yt,resultPreview:jA}),!0}function UA(e,t){if(!EO(e))throw At;let{dispatch:r}=e,n=()=>e.state,o=()=>n().documentSuggestion.documents,a=qA(e,t,mu,"/html",()=>{e.dispatch(fu(t.options.result.uniqueId))});return r(yu({results:o()})),{...a,get state(){return{...a.state,currentDocument:o().findIndex(u=>u.uniqueId===a.state.currentResultUniqueId)+1,totalDocuments:o().length}}}}function EO(e){return e.addReducers({documentSuggestion:Jt}),!0}m();d();f();p();m();d();f();p();var Up=e=>W(e,{evt:ee,type:Be}),VA=e=>ot("analytics/generic/search",t=>{Up(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),GA=e=>ot("analytics/generic/click",(t,r)=>(cd(e.result),Up(e),t.makeClickEvent(e.evt,sd(e.result,r),ad(e.result),e.meta))),BA=e=>ot("analytics/generic/custom",t=>(Up(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));function IO(e){return e.addReducers({}),{logSearchEvent:VA,logClickEvent:GA,logCustomEvent:BA}}m();d();f();p();function RO(e){return e.addReducers({}),{logCaseStart:bA,logCaseNextStage:wA,logCreateCase:CA,logSolveCase:xA,logAbandonCase:EA,logUpdateCaseField:To,logClassificationClick:pu,logDocumentSuggestionClick:RA,logDocumentSuggestionRating:_A,logQuickviewDocumentSuggestionClick:fu}}m();d();f();p();function TO(e){return e.addReducers({caseField:Dr}),{registerCaseField:_o,updateCaseField:ko,fetchCaseClassifications:Zt}}m();d();f();p();function _O(e){return e.addReducers({caseInput:Mr}),{updateCaseInput:Rn}}m();d();f();p();function kO(e){return e.addReducers({documentSuggestion:Jt}),{fetchDocumentSuggestions:Rt}}/**
45
+ For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function aA(e){e==="next"&&console.warn(J0)}m();d();f();p();var yA=kt(hA(),1);function vA(e){return(0,yA.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function SA(e,t){let r=yO(e),n=dl,o=vO(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t}}function yO(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function vO(e){return e.preprocessRequest||ts}m();d();f();p();m();d();f();p();var AA={organizationId:ee,accessToken:ee,name:new re({required:!1,emptyAllowed:!1}),analytics:new xe({options:{required:!1},values:{enabled:new Le({required:!1}),originContext:new re({required:!1}),originLevel2:new re({required:!1}),originLevel3:new re({required:!1}),analyticsMode:new re({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new re({required:!1,url:!0}),trackingId:new re({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/})}}),environment:new re({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};var bA=new Ot({...AA,caseAssistId:ee,locale:Be});var SO={debug:Om,caseAssistConfiguration:yr,searchHub:Lm};function wA(e){let t=vA(e.loggerOptions);AO(e.configuration,t);let r=bO(e.configuration,t),n={...SA(e.configuration,t),apiClient:r},o={...e,reducers:SO},i=sA(o,n);aA(i.state.configuration.analytics.analyticsMode);let{caseAssistId:s,locale:a,searchHub:u,proxyBaseUrl:c}=e.configuration;return i.dispatch(Ps({caseAssistId:s,locale:a,proxyBaseUrl:c})),ce(u)||i.dispatch(Ds(u)),{...i,get state(){return i.state}}}function AO(e,t){try{bA.validate(e)}catch(r){throw t.error(r,"Case Assist engine configuration error"),r}}function bO(e,t){return new ss({logger:t,preprocessRequest:e.preprocessRequest||ts})}m();d();f();p();m();d();f();p();m();d();f();p();var CA=(i=>(i.id="id",i.subject="subject",i.description="description",i.category="category",i.productId="productId",i))(CA||{}),xA=e=>!Object.values(CA).includes(e),ft=e=>{let t=r=>wO(e,r)??xO(e,r);return{id:t("id"),subject:t("subject"),description:t("description"),category:t("category"),productId:t("productId"),custom:{...CO(e),...EO(e)}}},wO=(e,t)=>e?.caseInput?.[t]?.value,CO=e=>Object.keys(e?.caseInput??[]).reduce((t,r)=>{if(xA(r)){let n=e?.caseInput?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),xO=(e,t)=>e?.caseField?.fields[t]?.value,EO=e=>Object.keys(e?.caseField?.fields??[]).reduce((t,r)=>{if(xA(r)){let n=e?.caseField?.fields?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),Mp=(e,t,r=!1)=>{let n=Object.keys(e?.caseField?.fields??{}).find(a=>e?.caseField?.fields[a].suggestions.some(u=>u.id===t));if(!n)throw new Error(`Classification with ID '${t}' could not be found.`);let i=e?.caseField?.fields[n]?.suggestions.find(a=>a.id===t),s={classificationId:i?.id??"",responseId:e.caseField?.status.lastResponseId??"",fieldName:n,classification:{value:i?.value??"",confidence:i?.confidence??0}};return r?{...s,autoSelection:r}:s},gr=(e,t,r=!1,n=!1)=>{let o,i=e.documentSuggestion?.documents.find((a,u)=>{let c=a.uniqueId===t;return c&&(o=u+1),c});if(!i)throw new Error(`Document Suggestion with ID '${t}' could not be found.`);let s={suggestionId:i.uniqueId,permanentId:i.fields.permanentid,responseId:e.documentSuggestion?.status.lastResponseId??"",suggestion:{documentUri:i.fields.uri,documentUriHash:i.fields.urihash,documentTitle:i.title,documentUrl:i.clickUri,documentPosition:o??0,sourceName:i.fields.source}};return r?{...s,fromQuickview:r}:n?{...s,openDocument:n}:s};var EA=()=>ht({prefix:"analytics/caseAssist/case/start",__legacy__getBuilder:(e,t)=>e.logEnterInterface({ticket:ft(t)}),analyticsType:"CaseAssist.Start",analyticsPayloadBuilder:()=>({})}),IA=e=>ht("analytics/caseAssist/case/nextStage",(t,r)=>t.logMoveToNextCaseStep({ticket:ft(r),stage:e?.stageName})),RA=()=>ht({prefix:"analytics/caseAssist/case/create",__legacy__getBuilder:(e,t)=>e.logCaseCreated({ticket:ft(t)}),analyticsType:"CaseAssist.CreateTicket",analyticsPayloadBuilder:e=>{let{id:t,category:r,subject:n,description:o,productId:i}=ft(e);return{ticket:{id:t,category:r,subject:n,description:o,system:i}}}}),TA=()=>ht({prefix:"analytics/caseAssist/case/solve",__legacy__getBuilder:(e,t)=>e.logCaseSolved({ticket:ft(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"solved"})}),_A=()=>ht({prefix:"analytics/caseAssist/case/abandon",__legacy__getBuilder:(e,t)=>e.logCaseCancelled({ticket:ft(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"quit"})}),To=e=>ht({prefix:"analytics/caseAssist/case/field/update",__legacy__getBuilder:(t,r)=>t.logUpdateCaseField({fieldName:e,ticket:ft(r)}),analyticsType:"CaseAssist.UpdateField",analyticsPayloadBuilder:t=>{let r=t.caseField?.fields?.[e]?.value||t.caseInput?.[e]?.value||"";return{fieldName:e,fieldValue:r}}}),kA=e=>ht({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:Mp(r,e,!0),ticket:ft(r)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let r=t.caseField?.status?.lastResponseId;if(r)return{autoselected:!0,classificationId:e,responseId:r}}}),fu=e=>ht({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:Mp(r,e),ticket:ft(r)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let r=t.caseField?.status?.lastResponseId;if(r)return{autoselected:!1,classificationId:e,responseId:r}}}),OA=e=>ht({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logSelectDocumentSuggestion({suggestion:gr(r,e),ticket:ft(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=gr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),mu=e=>ht({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logQuickviewDocumentSuggestion({suggestion:gr(r,e),ticket:ft(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=gr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),PA=e=>ht({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logSelectDocumentSuggestion({suggestion:gr(r,e,!1,!0),ticket:ft(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=gr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),NA=(e,t)=>ht({prefix:"analytics/caseAssist/documentSuggestion/rate",__legacy__getBuilder:(r,n)=>r.logRateDocumentSuggestion({rating:t,suggestion:gr(n,e),ticket:ft(n)}),analyticsType:"CaseAssist.DocumentSuggestionFeedback",analyticsPayloadBuilder:r=>{let n=r.documentSuggestion?.status?.lastResponseId,o=gr(r,e);if(n)return{responseId:n,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:o.suggestionId,url:o.suggestion.documentUri,title:o.suggestion.documentTitle},liked:!!t}}});m();d();f();p();var _o=G("caseAssist/caseField/register",e=>W(e,{fieldName:ee,fieldValue:Nt})),ko=G("caseAssist/caseField/update",e=>W(e,{fieldName:ee,fieldValue:Nt})),Zt=Ce("caseAssist/classifications/fetch",/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=yield n.getCaseClassifications(yield IO(o));return pt(i)?r(i.error):{response:i.success}});return function(_x157,_x158){return _ref71.apply(this,arguments)}}()),IO=/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??rt(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield Zn(e.configuration.analytics)}),fields:e.caseInput,context:e.caseField?is(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function IO(_x159){return _ref72.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var FA=()=>({status:{loading:!1,error:null,lastResponseId:""},fields:{}});var Dr=Ge(FA(),e=>{e.addCase(_o,(t,r)=>{let{fieldName:n,fieldValue:o}=r.payload;t.fields[n]={value:o,suggestions:[]}}).addCase(ko,(t,r)=>{let{fieldName:n,fieldValue:o}=r.payload;t.fields[n].value=o}).addCase(Zt.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase(Zt.fulfilled,(t,r)=>{let n={value:"",suggestions:[]};Object.entries(r.payload.response.fields).forEach(([o,i])=>{t.fields[o]||(t.fields[o]={...n}),t.fields[o].suggestions=i.predictions}),t.status.lastResponseId=r.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase(Zt.pending,t=>{t.status.loading=!0}).addCase(Io,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();m();d();f();p();var Rn=G("caseAssist/caseInput/update",e=>W(e,{fieldName:ee,fieldValue:Nt}));m();d();f();p();var DA=()=>({});var Mr=Ge(DA(),e=>{e.addCase(Rn,(t,r)=>{t[r.payload.fieldName]={value:r.payload.fieldValue}})});m();d();f();p();var Rt=Ce("caseAssist/documentSuggestions/fetch",/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),s=yield n.getDocumentSuggestions(yield RO(i,o));return pt(s)?r(s.error):{response:s.success}});return function(_x160,_x161){return _ref73.apply(this,arguments)}}()),RO=/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??rt(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield Zn(e.configuration.analytics)}),...(e.configuration.analytics.enabled&&tn(e.configuration.analytics,t,{actionCause:"documentSuggestion"})),fields:e.caseInput,context:e.caseField?is(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function RO(_x162,_x163){return _ref74.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var MA=()=>({status:{loading:!1,error:null,lastResponseId:""},documents:[]});var Jt=Ge(MA(),e=>{e.addCase(Rt.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase(Rt.fulfilled,(t,r)=>{t.documents=r.payload.response.documents,t.status.lastResponseId=r.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase(Rt.pending,t=>{t.status.loading=!0}).addCase(Io,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();function er(e){let t,r=new Map,n=()=>r.size===0,o=i=>{try{let s=JSON.stringify(i),a=t!==s;return t=s,a}catch(s){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",s),!0}};return{subscribe(i){i();let s=Symbol(),a;return n()&&(t=JSON.stringify(this.state),a=e.subscribe(()=>{o(this.state)&&r.forEach(u=>u())})),r.set(s,i),()=>{r.delete(s),n()&&a?.()}},get state(){return{}}}}var TO=new Ot({field:ee});function LA(e,t={}){if(!_O(e))throw At;let r=er(e),{dispatch:n}=e,o=Os(e,TO,t.options,"buildCaseField"),i=()=>e.state;return i().caseField?.fields?.[o.field]||n(_o({fieldName:o.field,fieldValue:""})),{...r,get state(){let a=i().caseField?.status?.loading??!1,u=i().caseField?.status?.error??null,c=i().caseField?.fields?.[o.field],g=c?.value??"",v=c?.suggestions??[];return{loading:a,error:u,value:g,suggestions:v}},update(a,u,c){let g=i().caseField?.fields?.[o.field]?.suggestions?.find(v=>v.value===a)?.id;g&&n(c?kA(g):fu(g)),n(ko({fieldName:o.field,fieldValue:a})),!c&&n(To(o.field)),u?.caseClassifications&&n(Zt()),u?.documentSuggestions&&n(Rt())}}}function _O(e){return e.addReducers({configuration:yt,caseAssistConfiguration:yr,caseInput:Mr,caseField:Dr,documentSuggestion:Jt}),!0}m();d();f();p();function kO(e,t){let r=new Ot({field:ee});Os(e,r,t,"buildCaseInput")}function jA(e,t){if(!OO(e))throw At;let r=er(e),{dispatch:n}=e,o=()=>e.state;kO(e,t.options);let i=t.options.field;return o().caseInput?.[i]||n(Rn({fieldName:i,fieldValue:""})),{...r,update(a,u){n(Rn({fieldName:i,fieldValue:a})),n(To(i)),u?.caseClassifications&&n(Zt()),u?.documentSuggestions&&n(Rt())},get state(){return o().caseInput[i]}}}function OO(e){return e.addReducers({configuration:yt,caseAssistConfiguration:yr,caseInput:Mr,caseField:Dr,documentSuggestion:Jt}),!0}m();d();f();p();m();d();f();p();function qA(e,t,r){if(!PO(e))throw At;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:Ji(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function PO(e){return e.addReducers({configuration:yt}),!0}function UA(e,t){let r=!1;return qA(e,t,()=>{r||(r=!0,e.dispatch(PA(t.options.result.uniqueId)))})}m();d();f();p();function Lp(e){if(!NO(e))throw At;let t=er(e),{dispatch:r}=e,n=()=>e.state;return{...t,fetch(){r(Rt())},get state(){let o=n().documentSuggestion;return{loading:o.status.loading,error:o.status.error,documents:o.documents}}}}function NO(e){return e.addReducers({configuration:yt,caseAssistConfiguration:yr,caseInput:Mr,caseField:Dr,documentSuggestion:Jt}),!0}m();d();f();p();m();d();f();p();m();d();f();p();function gu(_x164,_x165){return _gu.apply(this,arguments)}function _gu(){_gu=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:o}=e.configuration,i=e.query?.q||"";return{url:r.apiBaseUrl??Fn(e.configuration.organizationId,e.configuration.environment),accessToken:n,organizationId:o,enableNavigation:!1,q:i,...t,requestedOutputSize:t.requestedOutputSize||0,...(r.authenticationProviders.length&&{authentication:r.authenticationProviders.join(",")})}});return _gu.apply(this,arguments)}var Qi=Ce("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),i=yield gu(o,e),s=yield t.apiClient.html(i);return pt(s)?n(s.error):{content:s.success,uniqueId:e.uniqueId}});return function(_x166,_x167){return _ref75.apply(this,arguments)}}()),hu=G("resultPreview/next"),yu=G("resultPreview/previous"),vu=G("resultPreview/prepare",e=>W(e,{results:new Pt({required:!0})})),VA=2048,Su=Ce("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=Rf(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>VA&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${VA} characters.`),{contentURL:o}});return function(_x168,_x169){return _ref76.apply(this,arguments)}}());m();d();f();p();m();d();f();p();m();d();f();p();function jp(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var qp=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=jp();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},Up=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),GA=Ge(jp(),e=>{e.addCase(Qi.pending,t=>{t.isLoading=!0}).addCase(Qi.fulfilled,(t,r)=>{let{content:n,uniqueId:o}=r.payload;t.position=t.resultsWithPreview.indexOf(o),t.content=n,t.uniqueId=o,t.isLoading=!1}).addCase(lu.fulfilled,(t,r)=>{qp(t),t.resultsWithPreview=Up(r.payload.response.results)}).addCase(KS.fulfilled,(t,r)=>{qp(t),t.resultsWithPreview=t.resultsWithPreview.concat(Up(r.payload.response.results))}).addCase(WS.fulfilled,qp).addCase(vu,(t,r)=>{t.resultsWithPreview=Up(r.payload.results)}).addCase(hu,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(yu,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(Su.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});function BA(e,t,r,n,o){if(!FO(e))throw At;let{dispatch:i}=e,s=()=>e.state,a=er(e),{result:u,maximumPreviewSize:c}=t.options,g=()=>{let{resultsWithPreview:E,position:h}=s().resultPreview;return E[h]},v=E=>{i(Su({uniqueId:E,requestedOutputSize:c,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||i(Qi({uniqueId:E,requestedOutputSize:c})),o&&o()};return{...a,fetchResultContent(){v(u.uniqueId)},next(){i(hu()),v(g())},previous(){i(yu()),v(g())},get state(){let E=s(),h=u.hasHtmlVersion,y=E.resultPreview,S=u.uniqueId===y.uniqueId?y.content:"",x=y.isLoading,I=y.contentURL,T=g();return{content:S,resultHasPreview:h,isLoading:x,contentURL:I,currentResultUniqueId:T}}}}function FO(e){return e.addReducers({configuration:yt,resultPreview:GA}),!0}function $A(e,t){if(!DO(e))throw At;let{dispatch:r}=e,n=()=>e.state,o=()=>n().documentSuggestion.documents,a=BA(e,t,gu,"/html",()=>{e.dispatch(mu(t.options.result.uniqueId))});return r(vu({results:o()})),{...a,get state(){return{...a.state,currentDocument:o().findIndex(u=>u.uniqueId===a.state.currentResultUniqueId)+1,totalDocuments:o().length}}}}function DO(e){return e.addReducers({documentSuggestion:Jt}),!0}m();d();f();p();m();d();f();p();var Vp=e=>W(e,{evt:ee,type:Be}),QA=e=>ot("analytics/generic/search",t=>{Vp(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),HA=e=>ot("analytics/generic/click",(t,r)=>(ud(e.result),Vp(e),t.makeClickEvent(e.evt,ad(e.result,r),cd(e.result),e.meta))),zA=e=>ot("analytics/generic/custom",t=>(Vp(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));function MO(e){return e.addReducers({}),{logSearchEvent:QA,logClickEvent:HA,logCustomEvent:zA}}m();d();f();p();function LO(e){return e.addReducers({}),{logCaseStart:EA,logCaseNextStage:IA,logCreateCase:RA,logSolveCase:TA,logAbandonCase:_A,logUpdateCaseField:To,logClassificationClick:fu,logDocumentSuggestionClick:OA,logDocumentSuggestionRating:NA,logQuickviewDocumentSuggestionClick:mu}}m();d();f();p();function jO(e){return e.addReducers({caseField:Dr}),{registerCaseField:_o,updateCaseField:ko,fetchCaseClassifications:Zt}}m();d();f();p();function qO(e){return e.addReducers({caseInput:Mr}),{updateCaseInput:Rn}}m();d();f();p();function UO(e){return e.addReducers({documentSuggestion:Jt}),{fetchDocumentSuggestions:Rt}}/**
46
46
  * @license
47
47
  *
48
48
  * Copyright 2026 Coveo Solutions Inc.
@@ -75,4 +75,4 @@ fast-json-patch/module/duplex.mjs:
75
75
  *)
76
76
  */if(__exports!=exports)module.exports=exports;return module.exports});
77
77
 
78
- window.coveoQuanticVersion = '3.42.0';
78
+ window.coveoQuanticVersion = '3.42.1';