@coveo/quantic 3.44.2 → 3.44.3

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.
@@ -24,7 +24,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24
24
  `)}
25
25
 
26
26
  ${t}
27
- `;return new Hu(r)}var Hu=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Nt=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 uw(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}},Vr=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 Ln(e){return e===void 0}function lw(e){return e===null}function ce(e){return Ln(e)||lw(e)}var je=class{constructor(e={}){oe(this,"value");this.value=new Vr(e)}validate(e){let t=this.value.validate(e);return t||(dw(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function dw(e){return Ln(e)||xf(e)}function xf(e){return typeof e=="boolean"}var Le=class{constructor(e={}){oe(this,"config");oe(this,"value");this.config=e,this.value=new Vr(e)}validate(e){let t=this.value.validate(e);return t||(pw(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 pw(e){return Ln(e)||Ef(e)}function Ef(e){return typeof e=="number"&&!Number.isNaN(e)}var fw=/^\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 Vr(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(Ln(e))return null;if(!If(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&&!(fw.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 If(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(Ln(e))return this.config.options.required?"value is required and is currently undefined":null;if(!Rf(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 Rf(e){return e!==void 0&&typeof e=="object"}var Ft=class{constructor(e={}){oe(this,"config");oe(this,"value");this.config=e,this.value=new Vr(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 xf(e)||If(e)||Ef(e)||Rf(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Tf(e){return Array.isArray(e)}var zu=class{constructor(e){oe(this,"config");oe(this,"value");this.config=e,this.value=new Vr(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Ln(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 is=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();var jn=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 Wu(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Ku=e=>{let{response:t}=e;return t.body?mw(e):gw(t)},mw=e=>yw(e)?vw(e):hw(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},gw=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function hw(e){return e.body.statusCode!==void 0}function yw(e){return e.body.exception!==void 0}var vw=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();function kf(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var Yu=(e,t,r,n)=>{let o=new jn(`${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 _f=(e,t)=>{let r=new jn(`${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},Xu=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield yr.call({...Yu(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Wu(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=kf(r),o=yield r.arrayBuffer(),s=new TextDecoder(n).decode(o);return Sw(s)?{success:s}:{error:Ku({response:r,body:s})}});return function Xu(_x3,_x4){return _ref3.apply(this,arguments)}}();function Sw(e){return typeof e=="string"}m();d();f();p();function Aw(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function bw(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function ss(e,t){if(t&&e.name==="AbortError")return{error:bw(e)};if(e instanceof Ur)return{error:Aw(e)};throw e}m();d();f();p();m();d();f();p();var as=(e,t,r,n,o={})=>{ww(e);let i=`${e.url}/rest/organizations/${e.organizationId}/caseassists/${e.caseAssistId}${n}`,s=Cw(o),a=s?`${i}?${s}`:i;return{accessToken:e.accessToken,method:t,contentType:r,url:a,origin:"caseAssistApiFetch"}},cs=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r],t),{}),us=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r].value,t),{}),ww=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.")},Cw=e=>Object.keys(e).map(t=>`${t}=${encodeURIComponent(e[t])}`).join("&");var Of=e=>{let t=e.debug?{debug:"1"}:{};return{...as(e,"POST","application/json","/classify",t),requestParams:xw(e)}},xw=e=>({clientId:e.clientId,locale:e.locale,fields:cs(e.fields)});m();d();f();p();var Pf=e=>{let t={};return e.debug&&(t.debug="1"),e.numberOfResults&&(t.numberOfResults=e.numberOfResults.toString()),{...as(e,"POST","application/json","/documents/suggest",t),requestParams:Ew(e)}},Ew=e=>({clientId:e.clientId,locale:e.locale,fields:cs(e.fields),context:e.context,analytics:e.analytics});var ls=class{constructor(t){oe(this,"options",t)}getCaseClassifications(t){var _this=this;return _asyncToGenerator(function*(){let r=yield yr.call({...Of(t),..._this.options});if(r instanceof Error)return ss(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}getDocumentSuggestions(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield yr.call({...Pf(t),..._this2.options});if(r instanceof Error)return ss(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this3=this;return _asyncToGenerator(function*(){return Xu(t,_this3.options)})()}};m();d();f();p();m();d();f();p();m();d();f();p();function Xe(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 Iw=typeof Symbol=="function"&&Symbol.observable||"@@observable",Nf=Iw,Zu=()=>Math.random().toString(36).substring(7).split("").join("."),Rw={INIT:`@@redux/INIT${Zu()}`,REPLACE:`@@redux/REPLACE${Zu()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Zu()}`},ds=Rw;function Vt(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 Ju(e,t,r){if(typeof e!="function")throw new Error(Xe(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Xe(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Xe(1));return r(Ju)(e,t)}let n=e,o=t,i=new Map,s=i,a=0,c=!1;function u(){s===i&&(s=new Map,i.forEach((x,I)=>{s.set(I,x)}))}function g(){if(c)throw new Error(Xe(3));return o}function v(x){if(typeof x!="function")throw new Error(Xe(4));if(c)throw new Error(Xe(5));let I=!0;u();let _=a++;return s.set(_,x),function(){if(I){if(c)throw new Error(Xe(6));I=!1,u(),s.delete(_),i=null}}}function w(x){if(!Vt(x))throw new Error(Xe(7));if(typeof x.type>"u")throw new Error(Xe(8));if(typeof x.type!="string")throw new Error(Xe(17));if(c)throw new Error(Xe(9));try{c=!0,o=n(o,x)}finally{c=!1}return(i=s).forEach(_=>{_()}),x}function h(x){if(typeof x!="function")throw new Error(Xe(10));n=x,w({type:ds.REPLACE})}function y(){let x=v;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(Xe(11));function _(){let T=I;T.next&&T.next(g())}return _(),{unsubscribe:x(_)}},[Nf](){return this}}}return w({type:ds.INIT}),{dispatch:w,subscribe:v,getState:g,replaceReducer:h,[Nf]:y}}function Tw(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:ds.INIT})>"u")throw new Error(Xe(12));if(typeof r(void 0,{type:ds.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Xe(13))})}function qn(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{Tw(r)}catch(s){i=s}return function(a={},c){if(i)throw i;let u=!1,g={};for(let v=0;v<n.length;v++){let w=n[v],h=r[w],y=a[w],S=h(y,c);if(typeof S>"u"){let x=c&&c.type;throw new Error(Xe(14))}g[w]=S,u=u||S!==y}return u=u||n.length!==Object.keys(a).length,u?g:a}}function Go(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Ff(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(Xe(15))},s={getState:o.getState,dispatch:(c,...u)=>i(c,...u)},a=e.map(c=>c(s));return i=Go(...a)(o.dispatch),{...o,dispatch:i}}}function $o(e){return Vt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var cl=Symbol.for("immer-nothing"),Qo=Symbol.for("immer-draftable"),$e=Symbol.for("immer-state");function Ze(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ht=Object,Gr=ht.getPrototypeOf,Ho="constructor",Xo="prototype",rl="configurable",gs="enumerable",fs="writable",zo="value",ct=e=>!!e&&!!e[$e];function it(e){return e?Bf(e)||Jo(e)||!!e[Qo]||!!e[Ho]?.[Qo]||ei(e)||ti(e):!1}var kw=ht[Xo][Ho].toString(),Df=new WeakMap;function Bf(e){if(!e||!Vn(e))return!1;let t=Gr(e);if(t===null||t===ht[Xo])return!0;let r=ht.hasOwnProperty.call(t,Ho)&&t[Ho];if(r===Object)return!0;if(!Br(r))return!1;let n=Df.get(r);return n===void 0&&(n=Function.toString.call(r),Df.set(r,n)),n===kw}function Gf(e){return ct(e)||Ze(15,e),e[$e].base_}function Zo(e,t,r=!0){$r(e)===0?(r?Reflect.ownKeys(e):ht.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function $r(e){let t=e[$e];return t?t.type_:Jo(e)?1:ei(e)?2:ti(e)?3:0}var Un=(e,t,r=$r(e))=>r===2?e.has(t):ht[Xo].hasOwnProperty.call(e,t),nr=(e,t,r=$r(e))=>r===2?e.get(t):e[t],hs=(e,t,r,n=$r(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function _w(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Jo=Array.isArray,ei=e=>e instanceof Map,ti=e=>e instanceof Set,Vn=e=>typeof e=="object",Br=e=>typeof e=="function",el=e=>typeof e=="boolean";function Ow(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Pw=e=>Vn(e)?e?.[$e]:null,or=e=>e.copy_||e.base_;var ul=e=>e.modified_?e.copy_:e.base_;function nl(e,t){if(ei(e))return new Map(e);if(ti(e))return new Set(e);if(Jo(e))return Array[Xo].slice.call(e);let r=Bf(e);if(t===!0||t==="class_only"&&!r){let n=ht.getOwnPropertyDescriptors(e);delete n[$e];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let s=o[i],a=n[s];a[fs]===!1&&(a[fs]=!0,a[rl]=!0),(a.get||a.set)&&(n[s]={[rl]:!0,[fs]:!0,[gs]:a[gs],[zo]:e[s]})}return ht.create(Gr(e),n)}else{let n=Gr(e);if(n!==null&&r)return{...e};let o=ht.create(n);return ht.assign(o,e)}}function ll(e,t=!1){return ws(e)||ct(e)||!it(e)||($r(e)>1&&ht.defineProperties(e,{set:ps,add:ps,clear:ps,delete:ps}),ht.freeze(e),t&&Zo(e,(r,n)=>{ll(n,!0)},!1)),e}function Nw(){Ze(2)}var ps={[zo]:Nw};function ws(e){return e===null||!Vn(e)?!0:ht.isFrozen(e)}var ys="MapSet",vs="Patches",Mf="ArrayMethods",Ss={};function Qr(e){let t=Ss[e];return t||Ze(0,e),t}var Lf=e=>!!Ss[e];function Fw(e,t){Ss[e]||(Ss[e]=t)}var Wo,$f=()=>Wo,Dw=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Lf(ys)?Qr(ys):void 0,arrayMethodsPlugin_:Lf(Mf)?Qr(Mf):void 0});function jf(e,t){t&&(e.patchPlugin_=Qr(vs),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ol(e){il(e),e.drafts_.forEach(Mw),e.drafts_=null}function il(e){e===Wo&&(Wo=e.parent_)}var qf=e=>Wo=Dw(Wo,e);function Mw(e){let t=e[$e];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Uf(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[$e].modified_&&(ol(t),Ze(4)),it(e)&&(e=Vf(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[$e].base_,e,t)}else e=Vf(t,r);return Lw(t,e,!0),ol(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==cl?e:void 0}function Vf(e,t){if(ws(t))return t;let r=t[$e];if(!r)return As(t,e.handledSet_,e);if(!Cs(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);zf(r,e)}return r.copy_}function Lw(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ll(t,r)}function Qf(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Cs=(e,t)=>e.scope_===t,jw=[];function Hf(e,t,r,n){let o=or(e),i=e.type_;if(n!==void 0&&nr(o,n,i)===t){hs(o,n,r,i);return}if(!e.draftLocations_){let a=e.draftLocations_=new Map;Zo(o,(c,u)=>{if(ct(u)){let g=a.get(u)||[];g.push(c),a.set(u,g)}})}let s=e.draftLocations_.get(t)??jw;for(let a of s)hs(o,a,r,i)}function qw(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!Cs(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let s=ul(i);Hf(e,i.draft_??i,s,r),zf(i,o)})}function zf(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)}Qf(e)}}function Uw(e,t,r){let{scope_:n}=e;if(ct(r)){let o=r[$e];Cs(o,n)&&o.callbacks_.push(function(){ms(e);let s=ul(o);Hf(e,r,s,t)})}else it(r)&&e.callbacks_.push(function(){let i=or(e);e.type_===3?i.has(r)&&As(r,n.handledSet_,n):nr(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&As(nr(e.copy_,t,e.type_),n.handledSet_,n)})}function As(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||ct(e)||t.has(e)||!it(e)||ws(e)||(t.add(e),Zo(e,(n,o)=>{if(ct(o)){let i=o[$e];if(Cs(i,r)){let s=ul(i);hs(e,n,s,e.type_),Qf(i)}}else it(o)&&As(o,t,r)})),e}function Vw(e,t){let r=Jo(e),n={type_:r?1:0,scope_:t?t.scope_:$f(),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=bs;r&&(o=[n],i=Ko);let{revoke:s,proxy:a}=Proxy.revocable(o,i);return n.draft_=a,n.revoke_=s,[a,n]}var bs={get(e,t){if(t===$e)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=or(e);if(!Un(o,t,e.type_))return Gw(e,o,t);let i=o[t];if(e.finalized_||!it(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Ow(t))return i;if(i===tl(e.base_,t)||Bw(e,t,i)){ms(e);let s=e.type_===1?+t:t,a=al(e.scope_,i,e,s);return e.copy_[s]=a}return i},has(e,t){return t in or(e)},ownKeys(e){return Reflect.ownKeys(or(e))},set(e,t,r){let n=Wf(or(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=tl(or(e),t),i=o?.[$e];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(_w(r,o)&&(r!==void 0||Un(e.base_,t,e.type_)))return!0;ms(e),sl(e)}return e.copy_[t]===r&&(r!==void 0||Un(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Uw(e,t,r)),!0},deleteProperty(e,t){return ms(e),tl(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),sl(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=or(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[fs]:!0,[rl]:e.type_!==1||t!=="length",[gs]:n[gs],[zo]:r[t]}},defineProperty(){Ze(11)},getPrototypeOf(e){return Gr(e.base_)},setPrototypeOf(){Ze(12)}},Ko={};for(let e in bs){let t=bs[e];Ko[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Ko.deleteProperty=function(e,t){return Ko.set.call(this,e,t,void 0)};Ko.set=function(e,t,r){return bs.set.call(this,e[0],t,r,e[0])};function tl(e,t){let r=e[$e];return(r?or(r):e)[t]}function Bw(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!it(r)||r[$e]?!1:e.baseRefs_.has(r)}function Gw(e,t,r){let n=Wf(t,r);return n?zo in n?n[zo]:n.get?.call(e.draft_):void 0}function Wf(e,t){if(!(t in e))return;let r=Gr(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Gr(r)}}function sl(e){e.modified_||(e.modified_=!0,e.parent_&&sl(e.parent_))}function ms(e){e.copy_||(e.assigned_=new Map,e.copy_=nl(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(Br(t)&&!Br(r)){let i=r;r=t;let s=this;return function(c=i,...u){return s.produce(c,g=>r.call(this,g,...u))}}Br(r)||Ze(6),n!==void 0&&!Br(n)&&Ze(7);let o;if(it(t)){let i=qf(this),s=al(i,t,void 0),a=!0;try{o=r(s),a=!1}finally{a?ol(i):il(i)}return jf(i,n),Uf(o,i)}else if(!t||!Vn(t)){if(o=r(t),o===void 0&&(o=t),o===cl&&(o=void 0),this.autoFreeze_&&ll(o,!0),n){let i=[],s=[];Qr(vs).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:s}),n(i,s)}return o}else Ze(1,t)},this.produceWithPatches=(t,r)=>{if(Br(t))return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let n,o;return[this.produce(t,r,(s,a)=>{n=s,o=a}),n,o]},el(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),el(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),el(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){it(e)||Ze(8),ct(e)&&(e=xs(e));let t=qf(this),r=al(t,e,void 0);return r[$e].isManual_=!0,il(t),r}finishDraft(e,t){let r=e&&e[$e];(!r||!r.isManual_)&&Ze(9);let{scope_:n}=r;return jf(n,t),Uf(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=Qr(vs).applyPatches_;return ct(e)?n(e,t):this.produce(e,o=>n(o,t))}};function al(e,t,r,n){let[o,i]=ei(t)?Qr(ys).proxyMap_(t,r):ti(t)?Qr(ys).proxySet_(t,r):Vw(t,r);return(r?.scope_??$f()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?qw(r,i,n):i.callbacks_.push(function(c){c.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:u}=c;i.modified_&&u&&u.generatePatches_(i,[],c)}),o}function xs(e){return ct(e)||Ze(10,e),Kf(e)}function Kf(e){if(!it(e)||ws(e))return e;let t=e[$e],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=nl(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=nl(e,!0);return Zo(r,(o,i)=>{hs(r,o,Kf(i))},n),t&&(t.finalized_=!1),r}function Yf(){function t(y,S=[]){if(y.key_!==void 0){let x=y.parent_.copy_??y.parent_.base_,I=Pw(nr(x,y.key_)),_=nr(x,y.key_);if(_===void 0||_!==y.draft_&&_!==y.base_&&_!==y.copy_||I!=null&&I.base_!==y.base_)return null;let R=y.parent_.type_===3,T;if(R){let k=y.parent_;T=Array.from(k.drafts_.keys()).indexOf(y.key_)}else T=y.key_;if(!(R&&x.size>T||Un(x,T)))return null;S.push(T)}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 _=S[I];if(x=nr(x,_),!Vn(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_:_}=x;switch(y.type_){case 0:case 2:return c(y,S,I,_);case 1:return a(y,S,I,_);case 3:return u(y,S,I,_)}}function a(y,S,x,I){let{base_:_,assigned_:R}=y,T=y.copy_;T.length<_.length&&([_,T]=[T,_],[x,I]=[I,x]);let k=y.allIndicesReassigned_===!0;for(let F=0;F<_.length;F++){let V=T[F],U=_[F];if((k||R?.get(F.toString()))&&V!==U){let j=V?.[$e];if(j&&j.modified_)continue;let M=S.concat([F]);x.push({op:n,path:M,value:h(V)}),I.push({op:n,path:M,value:h(U)})}}for(let F=_.length;F<T.length;F++){let V=S.concat([F]);x.push({op:o,path:V,value:h(T[F])})}for(let F=T.length-1;_.length<=F;--F){let V=S.concat([F]);I.push({op:i,path:V})}}function c(y,S,x,I){let{base_:_,copy_:R,type_:T}=y;Zo(y.assigned_,(k,F)=>{let V=nr(_,k,T),U=nr(R,k,T),L=F?Un(_,k)?n:o:i;if(V===U&&L===n)return;let j=S.concat(k);x.push(L===i?{op:L,path:j}:{op:L,path:j,value:h(U)}),I.push(L===o?{op:i,path:j}:L===i?{op:o,path:j,value:h(V)}:{op:n,path:j,value:h(V)})})}function u(y,S,x,I){let{base_:_,copy_:R}=y,T=0;_.forEach(k=>{if(!R.has(k)){let F=S.concat([T]);x.push({op:i,path:F,value:k}),I.unshift({op:o,path:F,value:k})}T++}),T=0,R.forEach(k=>{if(!_.has(k)){let F=S.concat([T]);x.push({op:o,path:F,value:k}),I.unshift({op:i,path:F,value:k})}T++})}function g(y,S,x){let{patches_:I,inversePatches_:_}=x;I.push({op:n,path:[],value:S===cl?void 0:S}),_.push({op:n,path:[],value:y})}function v(y,S){return S.forEach(x=>{let{path:I,op:_}=x,R=y;for(let V=0;V<I.length-1;V++){let U=$r(R),L=I[V];typeof L!="string"&&typeof L!="number"&&(L=""+L),(U===0||U===1)&&(L==="__proto__"||L===Ho)&&Ze(19),Br(R)&&L===Xo&&Ze(19),R=nr(R,L),(R===null||!Vn(R))&&Ze(18,I.join("/"))}let T=$r(R),k=w(x.value),F=I[I.length-1];switch(_){case n:switch(T){case 2:return R.set(F,k);case 3:Ze(16);default:return R[F]=k}case o:switch(T){case 1:return F==="-"?R.push(k):R.splice(F,0,k);case 2:return R.set(F,k);case 3:return R.add(k);default:return R[F]=k}case i:switch(T){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:Ze(17,_)}}),y}function w(y){if(!it(y))return y;if(Jo(y))return y.map(w);if(ei(y))return new Map(Array.from(y.entries()).map(([x,I])=>[x,w(I)]));if(ti(y))return new Set(Array.from(y).map(w));let S=Object.create(Gr(y));for(let x in y)S[x]=w(y[x]);return Un(y,Qo)&&(S[Qo]=y[Qo]),S}function h(y){return ct(y)?w(y):y}Fw(vs,{applyPatches_:v,generatePatches_:s,generateReplacementPatches_:g,getPath:t})}var Qw=b.Iterator,PD=typeof Qw?.from=="function";var Yo=new $w,Hr=Yo.produce,dl=Yo.produceWithPatches.bind(Yo);var pl=Yo.applyPatches.bind(Yo);m();d();f();p();function Hw(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function zw(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 Xf=e=>Array.isArray(e)?e:[e];function Ww(e){let t=Array.isArray(e[0])?e[0]:e;return zw(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Kw(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var Yw=class{constructor(e){this.value=e}deref(){return this.value}},Xw=()=>typeof WeakRef>"u"?Yw:WeakRef,Jf=Xw(),Zw=0,Zf=1;function Es(){return{s:Zw,v:void 0,o:null,p:null}}function Jw(e){return e instanceof Jf?e.deref():e}function ri(e,t={}){let r=Es(),{resultEqualityCheck:n}=t,o,i=0;function s(){let a=r,{length:c}=arguments;for(let v=0,w=c;v<w;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=Es(),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=Es(),y.set(h,a)):a=S}}let u=a,g;if(a.s===Zf)g=a.v;else if(g=e.apply(null,arguments),i++,n){let v=Jw(o);v!=null&&n(v,g)&&(g=v,i!==0&&i--),o=typeof g=="object"&&g!==null||typeof g=="function"?new Jf(g):g}return u.s=Zf,u.v=g,g}return s.clearCache=()=>{r=Es(),s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function eC(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,s=0,a,c={},u=o.pop();typeof u=="object"&&(c=u,u=o.pop()),Hw(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);let g={...r,...c},{memoize:v,memoizeOptions:w=[],argsMemoize:h=ri,argsMemoizeOptions:y=[]}=g,S=Xf(w),x=Xf(y),I=Ww(o),_=v(function(){return i++,u.apply(null,arguments)},...S),R=!0,T=h(function(){s++;let F=Kw(I,arguments);return a=_.apply(null,F),a},...x);return Object.assign(T,{resultFunc:u,memoizedResultFunc:_,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 Ue=eC(ri);m();d();f();p();function em(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var tm=em(),rm=em;var tC=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Go:Go.apply(null,arguments)},rM=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},rC=e=>e&&typeof e.match=="function";function B(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(ut(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=>$o(n)&&n.type===e,r}var lm=class ni extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,ni.prototype)}static get[Symbol.species](){return ni}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new ni(...t[0].concat(this)):new ni(...t.concat(this))}};function nm(e){return it(e)?Hr(e,()=>{}):e}function Is(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function nC(e){return typeof e=="boolean"}var oC=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},s=new lm;return r&&(nC(r)?s.push(tm):s.push(rm(r.extraArgument))),s},oi="RTK_autoBatch",$n=()=>e=>({payload:e,meta:{[oi]:!0}}),om=e=>t=>{setTimeout(t,e)},iC=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(i),clearTimeout(s),r())},i=e(o),s=setTimeout(o,t)},sC=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,s=!1,a=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?iC(window.requestAnimationFrame,100):om(10):e.type==="callback"?e.queueNotification:om(e.timeout),u=()=>{s=!1,i&&(i=!1,a.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let v=()=>o&&g(),w=n.subscribe(v);return a.add(g),()=>{w(),a.delete(g)}},dispatch(g){try{return o=!g?.meta?.[oi],i=!o,i&&(s||(s=!0,c(u))),n.dispatch(g)}finally{o=!0}}})},aC=e=>function(r){let{autoBatch:n=!0}=r??{},o=new lm(e);return n&&o.push(sC(typeof n=="object"?n:void 0)),o};function dm(e){let t=oC(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:s=void 0,enhancers:a=void 0}=e||{},c;if(typeof r=="function")c=r;else if(Vt(r))c=qn(r);else throw new Error(ut(1));let u;typeof n=="function"?u=n(t):u=t();let g=Go;o&&(g=tC({trace:!1,...(typeof o=="object"&&o)}));let v=Ff(...u),w=aC(v),h=typeof a=="function"?a(w):w(),y=g(...h);return Ju(c,s,y)}function pm(e){let t={},r=[],n,o={addCase(i,s){let a=typeof i=="string"?i:i.type;if(!a)throw new Error(ut(28));if(a in t)throw new Error(ut(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 cC(e){return typeof e=="function"}function Qe(e,t){let[r,n,o]=pm(t),i;if(cC(e))i=()=>nm(e());else{let a=nm(e);i=()=>a}function s(a=i(),c){let u=[r[c.type],...n.filter(({matcher:g})=>g(c)).map(({reducer:g})=>g)];return u.filter(g=>!!g).length===0&&(u=[o]),u.reduce((g,v)=>{if(v)if(ct(g)){let h=v(g,c);return h===void 0?g:h}else{if(it(g))return Hr(g,w=>v(w,c));{let w=v(g,c);if(w===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return w}}return g},a)}return s.getInitialState=i,s}var fm=(e,t)=>rC(e)?e.match(t):e(t);function Bt(...e){return t=>e.some(r=>fm(r,t))}function Gn(...e){return t=>e.every(r=>fm(r,t))}function _s(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 ii(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Os(...e){return e.length===0?t=>_s(t,["pending"]):ii(e)?Bt(...e.map(t=>t.pending)):Os()(e[0])}function Wr(...e){return e.length===0?t=>_s(t,["rejected"]):ii(e)?Bt(...e.map(t=>t.rejected)):Wr()(e[0])}function si(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Gn(Wr(...e),t):ii(e)?Gn(Wr(...e),t):si()(e[0])}function ir(...e){return e.length===0?t=>_s(t,["fulfilled"]):ii(e)?Bt(...e.map(t=>t.fulfilled)):ir()(e[0])}function Ps(...e){return e.length===0?t=>_s(t,["pending","fulfilled","rejected"]):ii(e)?Bt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Ps()(e[0])}var uC="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",ai=(e=21)=>{let t="",r=e;for(;r--;)t+=uC[Math.random()*64|0];return t},lC=["name","message","stack","code"],fl=class{constructor(e,t){oe(this,"payload");oe(this,"meta");oe(this,"_type");this.payload=e,this.meta=t}},im=class{constructor(e,t){oe(this,"payload");oe(this,"meta");oe(this,"_type");this.payload=e,this.meta=t}},dC=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of lC)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},sm="External signal was aborted",Ce=(()=>{function e(t,r,n){let o=B(t+"/fulfilled",(c,u,g,v)=>({payload:c,meta:{...(v||{}),arg:g,requestId:u,requestStatus:"fulfilled"}})),i=B(t+"/pending",(c,u,g)=>({payload:void 0,meta:{...(g||{}),arg:u,requestId:c,requestStatus:"pending"}})),s=B(t+"/rejected",(c,u,g,v,w)=>({payload:v,error:(n&&n.serializeError||dC)(c||"Rejected"),meta:{...(w||{}),arg:g,requestId:u,rejectedWithValue:!!v,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function a(c,{signal:u}={}){return(g,v,w)=>{let h=n?.idGenerator?n.idGenerator(c):ai(),y=new l.AbortController,S,x;function I(R){x=R,y.abort()}u&&(u.aborted?I(sm):u.addEventListener("abort",()=>I(sm),{once:!0}));let _=_asyncToGenerator(function*(){let R;try{let k=n?.condition?.(c,{getState:v,extra:w});if(fC(k)&&(k=yield k),k===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let F=new Promise((V,U)=>{S=()=>{U({name:"AbortError",message:x||"Aborted"})},y.signal.addEventListener("abort",S,{once:!0})});g(i(h,c,n?.getPendingMeta?.({requestId:h,arg:c},{getState:v,extra:w}))),R=yield Promise.race([F,Promise.resolve(r(c,{dispatch:g,getState:v,extra:w,requestId:h,signal:y.signal,abort:I,rejectWithValue:(V,U)=>new fl(V,U),fulfillWithValue:(V,U)=>new im(V,U)})).then(V=>{if(V instanceof fl)throw V;return V instanceof im?o(V.payload,h,c,V.meta):o(V,h,c)})])}catch(k){R=k instanceof fl?s(null,h,c,k.payload,k.meta):s(k,h,c)}finally{S&&y.signal.removeEventListener("abort",S)}return n&&!n.dispatchConditionRejection&&s.match(R)&&R.meta.condition||g(R),R})();return Object.assign(_,{abort:I,requestId:h,arg:c,unwrap(){return _.then(pC)}})}}return Object.assign(a,{pending:i,rejected:s,fulfilled:o,settled:Bt(s,o),typePrefix:t})}return e.withTypes=()=>e,e})();function pC(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function fC(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var mm=Symbol.for("rtk-slice-createasyncthunk"),oM={[mm]:Ce};function mC(e,t){return`${e}/${t}`}function gC({creators:e}={}){let t=e?.asyncThunk?.[mm];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(ut(11));typeof process<"u";let s=(typeof n.reducers=="function"?n.reducers(yC()):n.reducers)||{},a=Object.keys(s),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(R,T){let k=typeof R=="string"?R:R.type;if(!k)throw new Error(ut(12));if(k in c.sliceCaseReducersByType)throw new Error(ut(13));return c.sliceCaseReducersByType[k]=T,u},addMatcher(R,T){return c.sliceMatchers.push({matcher:R,reducer:T}),u},exposeAction(R,T){return c.actionCreators[R]=T,u},exposeCaseReducer(R,T){return c.sliceCaseReducersByName[R]=T,u}};a.forEach(R=>{let T=s[R],k={reducerName:R,type:mC(o,R),createNotation:typeof n.reducers=="function"};SC(T)?bC(k,T,u,t):vC(k,T,u)});function g(){let[R={},T=[],k=void 0]=typeof n.extraReducers=="function"?pm(n.extraReducers):[n.extraReducers],F={...R,...c.sliceCaseReducersByType};return Qe(n.initialState,V=>{for(let U in F)V.addCase(U,F[U]);for(let U of c.sliceMatchers)V.addMatcher(U.matcher,U.reducer);for(let U of T)V.addMatcher(U.matcher,U.reducer);k&&V.addDefaultCase(k)})}let v=R=>R,w=new Map,h=new WeakMap,y;function S(R,T){return y||(y=g()),y(R,T)}function x(){return y||(y=g()),y.getInitialState()}function I(R,T=!1){function k(V){let U=V[R];return typeof U>"u"&&T&&(U=Is(h,k,x)),U}function F(V=v){let U=Is(w,T,()=>new WeakMap);return Is(U,V,()=>{let L={};for(let[j,M]of Object.entries(n.selectors??{}))L[j]=hC(M,V,()=>Is(h,V,x),T);return L})}return{reducerPath:R,getSelectors:F,get selectors(){return F(k)},selectSlice:k}}let _={name:o,reducer:S,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:x,...I(i),injectInto(R,{reducerPath:T,...k}={}){let F=T??i;return R.inject({reducerPath:F,reducer:S},k),{..._,...I(F,!0)}}};return _}}function hC(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 Kr=gC();function yC(){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 vC({type:e,reducerName:t,createNotation:r},n,o){let i,s;if("reducer"in n){if(r&&!AC(n))throw new Error(ut(17));i=n.reducer,s=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?B(e,s):B(e))}function SC(e){return e._reducerDefinitionType==="asyncThunk"}function AC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function bC({type:e,reducerName:t},r,n,o){if(!o)throw new Error(ut(18));let{payloadCreator:i,fulfilled:s,pending:a,rejected:c,settled:u,options:g}=r,v=o(e,i,g);n.exposeAction(t,v),s&&n.addCase(v.fulfilled,s),a&&n.addCase(v.pending,a),c&&n.addCase(v.rejected,c),u&&n.addMatcher(v.settled,u),n.exposeCaseReducer(t,{fulfilled:s||Rs,pending:a||Rs,rejected:c||Rs,settled:u||Rs})}function Rs(){}var wC="task",gm="listener",hm="completed",hl="cancelled",CC=`task-${hl}`,xC=`task-${hm}`,ml=`${gm}-${hl}`,EC=`${gm}-${hm}`,Ns=class{constructor(e){oe(this,"code");oe(this,"name","TaskAbortError");oe(this,"message");this.code=e,this.message=`${wC} ${hl} (reason: ${e})`}},yl=(e,t)=>{if(typeof e!="function")throw new TypeError(ut(32))},Ts=()=>{},ym=(e,t=Ts)=>(e.catch(t),e),vm=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),zr=e=>{if(e.aborted)throw new Ns(e.reason)};function Sm(e,t){let r=Ts;return new Promise((n,o)=>{let i=()=>o(new Ns(e.reason));if(e.aborted){i();return}r=vm(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=Ts})}var IC=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof Ns?"cancelled":"rejected",error:r}}finally{t?.()}});return function IC(_x5,_x6){return _ref5.apply(this,arguments)}}(),ks=e=>t=>ym(Sm(e,t).then(r=>(zr(e),r))),Am=e=>{let t=ks(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Bn}=Object,am={},Fs="listenerMiddleware",RC=(e,t)=>{let r=n=>vm(e,()=>n.abort(e.reason));return(n,o)=>{yl(n,"taskExecutor");let i=new l.AbortController;r(i);let s=IC(/*#__PURE__*/_asyncToGenerator(function*(){zr(e),zr(i.signal);let a=yield n({pause:ks(i.signal),delay:Am(i.signal),signal:i.signal});return zr(i.signal),a}),()=>i.abort(xC));return o?.autoJoin&&t.push(s.catch(Ts)),{result:ks(e)(s),cancel(){i.abort(CC)}}}},TC=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){zr(t);let i=()=>{},a=[new Promise((c,u)=>{let g=e({predicate:n,effect:(v,w)=>{w.unsubscribe(),c([v,w.getState(),w.getOriginalState()])}});i=()=>{g(),u()}})];o!=null&&a.push(new Promise(c=>setTimeout(c,o,null)));try{let c=yield Sm(t,Promise.race(a));return zr(t),c}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>ym(r(n,o))},bm=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=B(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(ut(21));return yl(i,"options.listener"),{predicate:o,type:t,effect:i}},wm=Bn(e=>{let{type:t,predicate:r,effect:n}=bm(e);return{id:ai(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(ut(22))}}},{withTypes:()=>wm}),cm=(e,t)=>{let{type:r,effect:n,predicate:o}=bm(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},gl=e=>{e.pending.forEach(t=>{t.abort(ml)})},kC=(e,t)=>()=>{for(let r of t.keys())gl(r);e.clear()},um=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Cm=Bn(B(`${Fs}/add`),{withTypes:()=>Cm}),_C=B(`${Fs}/removeAll`),xm=Bn(B(`${Fs}/remove`),{withTypes:()=>xm}),OC=(...e)=>{console.error(`${Fs}/error`,...e)},Em=(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=OC}=e;yl(s,"onError");let a=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&gl(h)}),c=h=>{let y=cm(t,h)??wm(h);return a(y)};Bn(c,{withTypes:()=>c});let u=h=>{let y=cm(t,h);return y&&(y.unsubscribe(),h.cancelActive&&gl(y)),!!y};Bn(u,{withTypes:()=>u});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,S,x){let I=new l.AbortController,_=TC(c,I.signal),R=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(y,Bn({},S,{getOriginalState:x,condition:(T,k)=>_(T,k).then(Boolean),take:_,delay:Am(I.signal),pause:ks(I.signal),extra:i,signal:I.signal,fork:RC(I.signal,R),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((T,k,F)=>{T!==I&&(T.abort(ml),F.delete(T))})},cancel:()=>{I.abort(ml),h.pending.delete(I)},throwIfCancelled:()=>{zr(I.signal)}})))}catch(T){T instanceof Ns||um(s,T,{raisedBy:"effect"})}finally{yield Promise.all(R),I.abort(EC),o(h),h.pending.delete(I)}});return function g(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),v=kC(t,r);return{middleware:h=>y=>S=>{if(!$o(S))return y(S);if(Cm.match(S))return c(S.payload);if(_C.match(S)){v();return}if(xm.match(S))return u(S.payload);let x=h.getState(),I=()=>{if(x===am)throw new Error(ut(23));return x},_;try{if(_=y(S),t.size>0){let R=h.getState(),T=Array.from(t.values());for(let k of T){let F=!1;try{F=k.predicate(S,R,x)}catch(V){F=!1,um(s,V,{raisedBy:"predicate"})}F&&g(k,S,h,I)}}}finally{x=am}return _},startListening:c,stopListening:u,clearListeners:v}};function ut(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}),He=new re({required:!1,emptyAllowed:!1}),Dt=new re({required:!0,emptyAllowed:!0}),hM=new re({required:!1,emptyAllowed:!0}),Im=new Ft({each:ee,required:!0}),Rm=new re({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Tm=new re({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),yM=new re({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),PC=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),vl=(e,t)=>{if("required"in t)return{payload:new Nt({value:t}).validate({value:e}).value};let o=new xe({options:{required:!0},values:t}).validate(e);if(o)throw new Hu(o);return{payload:e}},W=(e,t)=>{try{return vl(e,t)}catch(r){return{payload:e,error:PC(r)}}};var Ds=(e,t,r,n)=>{let o=`Check the options of ${n}`;return NC(e,t,r,o,"Controller initialization error")},NC=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};var Ms=B("caseAssistConfiguration/set",e=>W(e,{caseAssistId:ee,locale:He,proxyBaseUrl:new re({required:!1,url:!0})}));m();d();f();p();m();d();f();p();var km=()=>({caseAssistId:"",locale:"en-US"});var vr=Qe(km(),e=>{e.addCase(Ms,(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 _m={q:new re,enableQuerySyntax:new je,aq:new re,cq:new re,firstResult:new Le({min:0}),numberOfResults:new Le({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 je,sf:new xe,tab:new re,af:new xe};var Ls=B("searchParameters/restore",e=>W(e,_m)),Om=B("searchParameters/restoreTab",e=>W(e,ee));m();d();f();p();var Pm=B("debug/enable"),Nm=B("debug/disable");m();d();f();p();var js=()=>!1;var Fm=Qe(js(),e=>{e.addCase(Pm,()=>!0).addCase(Nm,()=>!1).addCase(Ls,(t,r)=>r.payload.debug??t)});m();d();f();p();var qs=B("searchHub/set",e=>W(e,new re({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var Qn="3.55.3",Dm=["@coveo/atomic","@coveo/quantic"];var Sl=()=>He,Mm=()=>ee,Hn=B("configuration/updateBasicConfiguration",e=>W(e,{accessToken:He,environment:new re({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:He})),Us=B("configuration/updateSearchConfiguration",e=>W(e,{proxyBaseUrl:new re({required:!1,url:!0}),pipeline:new re({required:!1,emptyAllowed:!0}),searchHub:He,timezone:He,locale:He,authenticationProviders:new Ft({required:!1,each:ee})})),FC={enabled:new je({default:!0}),originContext:Sl(),originLevel2:Sl(),originLevel3:Sl(),proxyBaseUrl:new re({required:!1,url:!0}),runtimeEnvironment:new Vr,anonymous:new je({default:!1}),deviceId:He,userDisplayName:He,documentLocation:He,trackingId:Tm,analyticsMode:new re({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new xe({options:{required:!1},values:Dm.reduce((e,t)=>(e[t]=Rm,e),{})})},Vs=B("configuration/updateAnalyticsConfiguration",e=>W(e,FC)),Bs=B("configuration/analytics/disable"),Gs=B("configuration/analytics/enable"),Lm=B("configuration/analytics/originlevel2",e=>W(e,{originLevel2:Mm()})),jm=B("configuration/analytics/originlevel3",e=>W(e,{originLevel3:Mm()})),qm=B("knowledge/setAgentId",e=>W(e,new re({required:!0})));m();d();f();p();var DC=B("history/undo"),MC=B("history/redo"),Gt=B("history/snapshot"),zL=Ce("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(DC()),yield t($s())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),WL=Ce("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(MC()),yield t($s())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),$s=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 zn=()=>"default";var Um=Qe(zn(),e=>{e.addCase(qs,(t,r)=>r.payload).addCase($s.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Us,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function Vm(){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 Bm=/^(?:[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 LC(e){return typeof e=="string"&&Bm.test(e)}var Al=LC;m();d();f();p();var Je=[];for(let e=0;e<256;++e)Je.push((e+256).toString(16).slice(1));function Gm(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 jC=new Uint8Array(16);function bl(){return crypto.getRandomValues(jC)}m();d();f();p();function qC(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():UC(e,t,r)}function UC(e,t,r){e=e||{};let n=e.random??e.rng?.()??bl();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 Gm(n)}var wl=qC;function VC(_x17){return _VC.apply(this,arguments)}function _VC(){_VC=_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 _VC.apply(this,arguments)}var Km="2.1.3",Cl=128,Ym=192,$m=224,Qm=240,BC=248;function GC(e){return(e&BC)===Qm?4:(e&Qm)===$m?3:(e&$m)===Ym?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&Cl)!=Cl)break;if(r-=3,(n&Ym)!=Cl){t-r>=GC(n)*3&&(r=t);break}}return e.substring(0,r)}function QC(e){let{trackingId:t}=e;return{trackingId:t}}function HC(e){return(e.source||[]).concat([`relay@${Km}`])}function Xm(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,s=QC(t),a=r.getClientId();return Object.freeze({type:e,config:s,ts:Date.now(),source:HC(t),clientId:a,userAgent:i(),referrer:Hm(n()),location:Hm(o())})}function Hm(e){return e!==null?$C(e,1024):null}function zC(e,t,r,n){return{...t,meta:Xm(e,r,n)}}var WC="*";function KC(){let e=[];function t({type:c,callback:u}){return e.findIndex(g=>g.type===c&&g.callback===u)}function r(c,u){return c.type==="*"||u===c.type}function n(c){return t(c)<0&&e.push(c),()=>a(c.type,c.callback)}function o(c){e.forEach(u=>{if(r(u,c.meta.type))try{u.callback(c)}catch(g){console.error(g)}})}function i(c){if(c===WC)e.length=0;else for(let u=e.length-1;u>=0;u--)e[u].type===c&&e.splice(u,1)}function s(c){let u=t(c);u>=0&&e.splice(u,1)}function a(c,u){u?s({type:c,callback:u}):i(c)}return{add:n,call:o,remove:a}}function zm({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 YC(e){let t=zm(e);return{get:()=>t,update:r=>{t=zm({...t,...r})}}}var xl=XC();function XC(){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 ZC(){return{getItem(e){return xl.getItem(e)||localStorage.getItem(e)},removeItem(e){xl.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),xl.setItem(e,t,31556952e3)}}}var Wm="visitorId";function JC(){let e=document.referrer;return e===""?null:e}function El(){let e=ZC();return{runtime:"browser",send:function(){var _ref10=_asyncToGenerator(function*(t,r,n){let o=C(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});Vm().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 c of a.events)if(!c.accepted)throw new Error(`Received event was rejected for processing: ${c.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(Wm);if(t&&Al(t))return t;let r=wl();return e.setItem(Wm,r),r}}}function ex(){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 tx(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function rx(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=tx();return t&&r?{...r,runtime:"custom"}:t&&nx()&&ex()?El():n}function nx(){try{return typeof window=="object"}catch{return!1}}function ox(e){return{get:()=>Object.freeze(rx(e))}}function Zm(e){let t=YC(e),r=KC(),n=ox(t);return{emit:function(){var _ref11=_asyncToGenerator(function*(o,i){let s=t.get(),a=n.get(),c=zC(o,i,s,a);return VC({config:s,environment:a,event:c,listenerManager:r})});return function emit(_x21,_x22){return _ref11.apply(this,arguments)}}(),getMeta:o=>Xm(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:Km}}m();d();f();p();function Jm(){return typeof window<"u"&&typeof document<"u"}m();d();f();p();var Wn=Ue(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Qn}`));var ci=Ue(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Wn(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},s,a)=>{let c=sx(a);return Zm({mode:i?"emit":"disabled",url:o??os(e,t),token:r,trackingId:n??null,source:s,environment:c})}),ix={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref12=_asyncToGenerator(function*(){});return function send(){return _ref12.apply(this,arguments)}}()},sx=e=>{if(!e)return;let t=e();return{...(Jm()?El():ix),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 eg=class extends Error{constructor(t){super(t[0].message);oe(this,"issues");this.name="SchemaError",this.issues=t}};var ar="uninitialized",Tl="pending",li="fulfilled",di="rejected";function tg(e){return{status:e,isUninitialized:e===ar,isLoading:e===Tl,isSuccess:e===li,isError:e===di}}var rg=Vt;function hg(e,t){if(e===t||!(rg(e)&&rg(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]=hg(e[s],t[s]),o&&(o=e[s]===i[s]);return o?e:i}function kl(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function ax(e){return new RegExp("(^|:)//").test(e)}function cx(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Nl(e){return e!=null}function ng(e){return[...(e?.values()??[])].filter(Nl)}function ux(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var lx=e=>e.replace(/\/$/,""),dx=e=>e.replace(/^\//,"");function px(e,t){if(!e)return t;if(!t)return e;if(ax(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=lx(e),t=dx(t),`${e}${r}${t}`}function zs(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var _l=()=>new Map,fx=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},mx=(...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},og=(...e)=>C(...e),gx=e=>e.status>=200&&e.status<=299,hx=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function ig(e){if(!Vt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var yx=e=>typeof e=="object"&&(Vt(e)||Array.isArray(e)||typeof e.toJSON=="function");function yg({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=og,paramsSerializer:n,isJsonContentType:o=hx,jsonContentType:i="application/json",jsonReplacer:s,timeout:a,responseHandler:c,validateStatus:u,...g}={}){return typeof C>"u"&&r===og&&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*(w,h,y){let{getState:S,extra:x,endpoint:I,forced:_,type:R}=h,T,{url:k,headers:F=new E(g.headers),params:V=void 0,responseHandler:U=c??"json",validateStatus:L=u??gx,timeout:j=a,...M}=typeof w=="string"?{url:w}:w,O={...g,signal:j?mx(h.signal,fx(j)):h.signal,...M};F=new E(ig(F)),O.headers=(yield t(F,{getState:S,arg:w,extra:x,endpoint:I,forced:_,type:R,extraOptions:y}))||F;let P=yx(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")||(U==="json"?O.headers.set("accept","application/json"):U==="text"&&O.headers.set("accept","text/plain, text/html, */*")),V){let J=~k.indexOf("?")?"&":"?",se=n?n(V):new URLSearchParams(ig(V));k+=J+se}k=px(e,k);let N=new Request(k,O);T={request:new Request(k,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:T}}let Y=$.clone();T.response=Y;let K,H="";try{let J;if(yield Promise.all([v($,U).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:T}}return L($,K)?{data:K,meta:T}:{error:{status:$.status,data:K},meta:T}});return function(_x23,_x24,_x25){return _ref13.apply(this,arguments)}}());function v(_x26,_x27){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(w,h){if(typeof h=="function")return h(w);if(h==="content-type"&&(h=o(w.headers)?"json":"text"),h==="json"){let y=yield w.text();return y.length?JSON.parse(y):null}return w.text()});return _v2.apply(this,arguments)}}var Kn=class{constructor(e,t=void 0){oe(this,"value");oe(this,"meta");this.value=e,this.meta=t}};function vx(){return _vx.apply(this,arguments)}function _vx(){_vx=_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 c=()=>{clearTimeout(a),s(new Error("Aborted"))};r.aborted?(clearTimeout(a),s(new Error("Aborted"))):r.addEventListener("abort",c,{once:!0})}})});return _vx.apply(this,arguments)}function vg(e,t){throw Object.assign(new Kn({error:e,meta:t}),{throwImmediately:!0})}function Il(e){e.aborted&&vg({status:"CUSTOM_ERROR",error:"Aborted"})}var sg={},Sx=(e,t)=>(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(r,n,o){let i=[5,(t||sg).maxRetries,(o||sg).maxRetries].filter(g=>g!==void 0),[s]=i.slice(-1),c={maxRetries:s,backoff:vx,retryCondition:(g,v,{attempt:w})=>w<=s,...t,...o},u=0;for(;;){Il(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Kn(g);return g}catch(g){if(u++,g.throwImmediately){if(g instanceof Kn)return g.value;throw g}if(g instanceof Kn){if(!c.retryCondition(g.value.error,r,{attempt:u,baseQueryApi:n,extraOptions:o}))return g.value}else if(u>c.maxRetries)return{error:g};Il(n.signal);try{yield c.backoff(u,c.maxRetries,n.signal)}catch(v){throw Il(n.signal),v}}}});return function(_x28,_x29,_x30){return _ref14.apply(this,arguments)}}()),Sg=Object.assign(Sx,{fail:vg}),Ks="__rtkq/",Ax="online",bx="offline";var Ag="focused";var Fl=B(`${Ks}${Ag}`),bg=B(`${Ks}un${Ag}`),Dl=B(`${Ks}${Ax}`),wg=B(`${Ks}${bx}`);var mi="query",Cg="mutation",xg="infinitequery";function Ys(e){return e.type===mi}function wx(e){return e.type===Cg}function Xs(e){return e.type===xg}function Ws(e){return Ys(e)||Xs(e)}function Ml(e,t,r,n,o,i){let s=Cx(e)?e(t,r,n,o):e;return s?kl(s,Nl,a=>i(Eg(a))):[]}function Cx(e){return typeof e=="function"}function Eg(e){return typeof e=="string"?{type:e}:e}function xx(e,t){return e.catch(t)}var Yn=(e,t)=>e.endpointDefinitions[t],pi=Symbol("forceQueryFn"),Ol=e=>typeof e[pi]=="function";function Ex({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:s}){let a=k=>s(k)?.runningQueries,c=k=>s(k)?.runningMutations,{unsubscribeQueryResult:u,removeMutationResult:g,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:_,buildInitiateInfiniteQuery:R,buildInitiateMutation:T,getRunningQueryThunk:w,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:S};function w(k,F){return V=>{let U=Yn(i,k),L=e({queryArgs:F,endpointDefinition:U,endpointName:k});return a(V)?.get(L)}}function h(k,F){return V=>c(V)?.get(F)}function y(){return k=>ng(a(k))}function S(){return k=>ng(c(k))}function x(k){}function I(k,F){let V=(U,{subscribe:L=!0,forceRefetch:j,subscriptionOptions:M,[pi]:O,...P}={})=>(N,Q)=>{let $=e({queryArgs:U,endpointDefinition:F,endpointName:k}),Y,K={...P,type:mi,subscribe:L,forceRefetch:j,subscriptionOptions:M,endpointName:k,originalArgs:U,queryCacheKey:$,[pi]:O};if(Ys(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[k].select(U),J=N(Y),se=H(Q());let{requestId:be,abort:Ne}=J,Ie=se.requestId!==be,ke=a(N)?.get($),_e=()=>H(Q()),pe=Object.assign(O?J.then(_e):Ie&&!ke?Promise.resolve(se):Promise.all([ke,J]).then(_e),{arg:U,requestId:be,subscriptionOptions:M,queryCacheKey:$,abort:Ne,unwrap(){return _asyncToGenerator(function*(){let de=yield pe;if(de.isError)throw de.error;return de.data})()},refetch:de=>N(V(U,{subscribe:!1,forceRefetch:!0,...de})),unsubscribe(){L&&N(u({queryCacheKey:$,requestId:be}))},updateSubscriptionOptions(de){pe.subscriptionOptions=de,N(v({endpointName:k,requestId:be,queryCacheKey:$,options:de}))}});if(!ke&&!Ie&&!O){let de=a(N);de.set($,pe),pe.then(()=>{de.delete($)})}return pe};return V}function _(k,F){return I(k,F)}function R(k,F){return I(k,F)}function T(k){return(F,{track:V=!0,fixedCacheKey:U}={})=>(L,j)=>{let M=n({type:"mutation",endpointName:k,originalArgs:F,track:V,fixedCacheKey:U}),O=L(M);let{requestId:P,abort:N,unwrap:Q}=O,$=xx(O.unwrap().then(J=>({data:J})),J=>({error:J})),Y=()=>{L(g({requestId:P,fixedCacheKey:U}))},K=Object.assign($,{arg:O.arg,requestId:P,abort:N,unwrap:Q,reset:Y}),H=c(L);return H.set(P,K),K.then(()=>{H.delete(P)}),U&&(H.set(U,K),K.then(()=>{H.get(U)===K&&H.delete(U)})),K}}}var Ig=class extends eg{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}},Yr=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function Xr(_x31,_x32,_x33,_x34){return _Xr.apply(this,arguments)}function _Xr(){_Xr=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new Ig(o.issues,t,r,n);return o.value});return _Xr.apply(this,arguments)}function ag(e){return e}var ui=(e={})=>({...e,[oi]:!0});function Ix({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:s,onSchemaFailure:a,catchSchemaFailure:c,skipSchemaValidation:u}){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=Ml(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 w(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===ar)return H;let J;if("data"in K)if(it(K.data)){let[se,be,Ne]=dl(K.data,P);H.patches.push(...be),H.inversePatches.push(...Ne),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,[pi]:()=>({data:P})})),S=(M,O)=>M.query&&M[O]?M[O]:ag,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=u}=H,be=M.type===mi;try{let Ne=ag,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},ke=be?M[pi]:void 0,_e,pe=/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(he,fe,Be,ze){if(fe==null&&he.pages.length)return Promise.resolve({data:he});let _t={queryArg:M.originalArgs,pageParam:fe},gt=yield de(_t),Ut=ze?v:w;return{data:{pages:Ut(he.pages,gt.data,Be),pageParams:Ut(he.pageParams,fe,Be)},meta:gt.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:Be,argSchema:ze,rawResponseSchema:_t,responseSchema:gt}=H;if(ze&&!Yr(se,"arg")&&(he=yield Xr(ze,he,"argSchema",{})),ke?fe=ke():H.query?(Ne=S(H,"transformResponse"),fe=yield t(H.query(he),Ie,Be)):fe=yield H.queryFn(he,Ie,Be,Ot=>t(Ot,Ie,Be)),typeof process<"u",fe.error)throw new Kn(fe.error,fe.meta);let{data:Ut}=fe;_t&&!Yr(se,"rawResponse")&&(Ut=yield Xr(_t,fe.data,"rawResponseSchema",fe.meta));let bt=yield Ne(Ut,fe.meta,he);return gt&&!Yr(se,"response")&&(bt=yield Xr(gt,bt,"responseSchema",fe.meta)),{...fe,data:bt}});return _de.apply(this,arguments)}if(be&&"infiniteQueryOptions"in H){let{infiniteQueryOptions:he}=H,{maxPages:fe=1/0}=he,Be=M.refetchCachedPages??he.refetchCachedPages??!0,ze,_t={pages:[],pageParams:[]},gt=s.selectQueryEntry(Y(),M.queryCacheKey)?.data,bt=I(M,Y())&&!M.direction||!gt?_t:gt;if("direction"in M&&M.direction&&bt.pages.length){let Ot=M.direction==="backward",Yi=(Ot?Rg:Pl)(he,bt,M.originalArgs);ze=yield pe(bt,Yi,fe,Ot)}else{let{initialPageParam:Ot=he.initialPageParam}=M,Do=gt?.pageParams??[],Yi=Do[0]??Ot,ob=Do.length;if(ze=yield pe(bt,Yi,fe),ke&&(ze={data:ze.data.pages[0]}),Be)for(let Hp=1;Hp<ob;Hp++){let ib=Pl(he,ze.data,M.originalArgs);ze=yield pe(ze.data,ib,fe)}}_e=ze}else _e=yield de(M.originalArgs);return J&&!Yr(se,"meta")&&_e.meta&&(_e.meta=yield Xr(J,_e.meta,"metaSchema",_e.meta)),Q(_e.data,ui({fulfilledTimeStamp:Date.now(),baseQueryMeta:_e.meta}))}catch(Ne){let Ie=Ne;if(Ie instanceof Kn){let ke=S(H,"transformErrorResponse"),{rawErrorResponseSchema:_e,errorResponseSchema:pe}=H,{value:de,meta:he}=Ie;try{_e&&!Yr(se,"rawErrorResponse")&&(de=yield Xr(_e,de,"rawErrorResponseSchema",he)),J&&!Yr(se,"meta")&&(he=yield Xr(J,he,"metaSchema",he));let fe=yield ke(de,he,M.originalArgs);return pe&&!Yr(se,"errorResponse")&&(fe=yield Xr(pe,fe,"errorResponseSchema",he)),N(fe,ui({baseQueryMeta:he}))}catch(fe){Ie=fe}}try{if(Ie instanceof Ig){let ke={endpoint:M.endpointName,arg:M.originalArgs,type:M.type,queryCacheKey:be?M.queryCacheKey:void 0};H.onSchemaFailure?.(Ie,ke),a?.(Ie,ke);let{catchSchemaFailure:_e=c}=H;if(_e)return N(_e(Ie,ke),ui({baseQueryMeta:Ie._bqMeta}))}}catch(ke){Ie=ke}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 _=()=>Ce(`${e}/executeQuery`,x,{getPendingMeta({arg:O}){let P=r[O.endpointName];return ui({startedTimeStamp:Date.now(),...(Xs(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 Ol(O)?!0:Q?.status==="pending"?!1:I(O,N)||Ys(H)&&H?.forceRefetch?.({currentArg:Y,previousArg:K,endpointState:Q,state:N})?!0:!($&&!J)},dispatchConditionRejection:!0}),R=_(),T=_(),k=Ce(`${e}/executeMutation`,x,{getPendingMeta(){return ui({startedTimeStamp:Date.now()})}}),F=M=>"force"in M,V=M=>"ifOlderThan"in M,U=(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 j(M,O){return{matchPending:Gn(Os(M),L(O)),matchFulfilled:Gn(ir(M),L(O)),matchRejected:Gn(Wr(M),L(O))}}return{queryThunk:R,mutationThunk:k,infiniteQueryThunk:T,prefetch:U,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:j}}function Pl(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function Rg(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function Tg(e,t,r,n){return Ml(r[e.meta.arg.endpointName][t],ir(e)?e.payload:void 0,si(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function cg(e){return ct(e)?xs(e):e}function Qs(e,t,r){let n=e[t];n&&r(n)}function fi(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function ug(e,t,r){let n=e[fi(t)];n&&r(n)}var Hs={};function Rx({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:s,hasRehydrationInfo:a},assertTagType:c,config:u}){let g=B(`${e}/resetApiState`);function v(L,j,M,O){var P;L[P=j.queryCacheKey]??(L[P]={status:ar,endpointName:j.endpointName}),Qs(L,j.queryCacheKey,N=>{N.status=Tl,N.requestId=M&&N.requestId?N.requestId:O.requestId,j.originalArgs!==void 0&&(N.originalArgs=j.originalArgs),N.startedTimeStamp=O.startedTimeStamp;let Q=o[O.arg.endpointName];Xs(Q)&&"direction"in j&&(N.direction=j.direction)})}function w(L,j,M,O){Qs(L,j.arg.queryCacheKey,P=>{if(P.requestId!==j.requestId&&!O)return;let{merge:N}=o[j.arg.endpointName];if(P.status=li,N){if(P.data!==void 0){let{fulfilledTimeStamp:Q,arg:$,baseQueryMeta:Y,requestId:K}=j,H=Hr(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[j.arg.endpointName].structuralSharing??!0?hg(ct(P.data)?Gf(P.data):P.data,M):M;delete P.error,P.fulfilledTimeStamp=j.fulfilledTimeStamp})}let h=Kr({name:`${e}/queries`,initialState:Hs,reducers:{removeQueryResult:{reducer(L,{payload:{queryCacheKey:j}}){delete L[j]},prepare:$n()},cacheEntriesUpserted:{reducer(L,j){for(let M of j.payload){let{queryDescription:O,value:P}=M;v(L,O,!0,{arg:O,requestId:j.meta.requestId,startedTimeStamp:j.meta.timestamp}),w(L,{arg:O,requestId:j.meta.requestId,fulfilledTimeStamp:j.meta.timestamp,baseQueryMeta:{}},P,!0)}},prepare:L=>({payload:L.map(O=>{let{endpointName:P,arg:N,value:Q}=O,$=o[P];return{queryDescription:{type:mi,endpointName:P,originalArgs:O.arg,queryCacheKey:n({queryArgs:N,endpointDefinition:$,endpointName:P})},value:Q}}),meta:{[oi]:!0,requestId:ai(),timestamp:Date.now()}})},queryResultPatched:{reducer(L,{payload:{queryCacheKey:j,patches:M}}){Qs(L,j,O=>{O.data=pl(O.data,M.concat())})},prepare:$n()}},extraReducers(L){L.addCase(t.pending,(j,{meta:M,meta:{arg:O}})=>{let P=Ol(O);v(j,O,P,M)}).addCase(t.fulfilled,(j,{meta:M,payload:O})=>{let P=Ol(M.arg);w(j,M,O,P)}).addCase(t.rejected,(j,{meta:{condition:M,arg:O,requestId:P},error:N,payload:Q})=>{Qs(j,O.queryCacheKey,$=>{if(!M){if($.requestId!==P)return;$.status=di,$.error=Q??N}})}).addMatcher(a,(j,M)=>{let{queries:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===li||N?.status===di)&&(j[P]=N)})}}),y=Kr({name:`${e}/mutations`,initialState:Hs,reducers:{removeMutationResult:{reducer(L,{payload:j}){let M=fi(j);M in L&&delete L[M]},prepare:$n()}},extraReducers(L){L.addCase(r.pending,(j,{meta:M,meta:{requestId:O,arg:P,startedTimeStamp:N}})=>{P.track&&(j[fi(M)]={requestId:O,status:Tl,endpointName:P.endpointName,startedTimeStamp:N})}).addCase(r.fulfilled,(j,{payload:M,meta:O})=>{O.arg.track&&ug(j,O,P=>{P.requestId===O.requestId&&(P.status=li,P.data=M,P.fulfilledTimeStamp=O.fulfilledTimeStamp)})}).addCase(r.rejected,(j,{payload:M,error:O,meta:P})=>{P.arg.track&&ug(j,P,N=>{N.requestId===P.requestId&&(N.status=di,N.error=M??O)})}).addMatcher(a,(j,M)=>{let{mutations:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===li||N?.status===di)&&P!==N?.requestId&&(j[P]=N)})}}),S={tags:{},keys:{}},x=Kr({name:`${e}/invalidation`,initialState:S,reducers:{updateProvidedBy:{reducer(L,j){var M,O,P;for(let{queryCacheKey:N,providedTags:Q}of j.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:$n()}},extraReducers(L){L.addCase(h.actions.removeQueryResult,(j,{payload:{queryCacheKey:M}})=>{I(j,M)}).addMatcher(a,(j,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=j.tags)[$]??(P[$]={}))[Q=K||"__internal_without_id"]??(N[Q]=[]);for(let se of H)J.includes(se)||J.push(se),j.keys[se]=O.keys[se]}}).addMatcher(Bt(ir(t),si(t)),(j,M)=>{_(j,[M])}).addMatcher(h.actions.cacheEntriesUpserted.match,(j,M)=>{let O=M.payload.map(({queryDescription:P,value:N})=>({type:"UNKNOWN",payload:N,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:P}}));_(j,O)})}});function I(L,j){let M=cg(L.keys[j]??[]);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]=cg(Q).filter($=>$!==j))}delete L.keys[j]}function _(L,j){let M=j.map(O=>{let P=Tg(O,"providesTags",o,c),{queryCacheKey:N}=O.meta.arg;return{queryCacheKey:N,providedTags:P}});x.caseReducers.updateProvidedBy(L,x.actions.updateProvidedBy(M))}let R=Kr({name:`${e}/subscriptions`,initialState:Hs,reducers:{updateSubscriptionOptions(L,j){},unsubscribeQueryResult(L,j){},internal_getRTKQSubscriptions(){}}}),T=Kr({name:`${e}/internalSubscriptions`,initialState:Hs,reducers:{subscriptionsUpdated:{reducer(L,j){return pl(L,j.payload)},prepare:$n()}}}),k=Kr({name:`${e}/config`,initialState:{online:ux(),focused:cx(),middlewareRegistered:!1,...u},reducers:{middlewareRegistered(L,{payload:j}){L.middlewareRegistered=L.middlewareRegistered==="conflict"||i!==j?"conflict":!0}},extraReducers:L=>{L.addCase(Dl,j=>{j.online=!0}).addCase(wg,j=>{j.online=!1}).addCase(Fl,j=>{j.focused=!0}).addCase(bg,j=>{j.focused=!1}).addMatcher(a,j=>({...j}))}}),F=qn({queries:h.reducer,mutations:y.reducer,provided:x.reducer,subscriptions:T.reducer,config:k.reducer}),V=(L,j)=>F(g.match(j)?void 0:L,j),U={...k.actions,...h.actions,...R.actions,...T.actions,...y.actions,...x.actions,resetApiState:g};return{reducer:V,actions:U}}var Rl=Symbol.for("RTKQ/skipToken"),kg={status:ar},lg=Hr(kg,()=>{}),dg=Hr(kg,()=>{});function Tx({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=R=>lg,o=R=>dg;return{buildQuerySelector:w,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:S,selectCachedArgsForQuery:x,selectApiState:s,selectQueries:a,selectMutations:u,selectQueryEntry:c,selectConfig:g};function i(R){return{...R,...tg(R.status)}}function s(R){return R[t]}function a(R){return s(R)?.queries}function c(R,T){return a(R)?.[T]}function u(R){return s(R)?.mutations}function g(R){return s(R)?.config}function v(R,T,k){return F=>{if(F===Rl)return r(n,k);let V=e({queryArgs:F,endpointDefinition:T,endpointName:R});return r(L=>c(L,V)??lg,k)}}function w(R,T){return v(R,T,i)}function h(R,T){let{infiniteQueryOptions:k}=T;function F(V){let U={...V,...tg(V.status)},{isLoading:L,isError:j,direction:M}=U,O=M==="forward",P=M==="backward";return{...U,hasNextPage:I(k,U.data,U.originalArgs),hasPreviousPage:_(k,U.data,U.originalArgs),isFetchingNextPage:L&&O,isFetchingPreviousPage:L&&P,isFetchNextPageError:j&&O,isFetchPreviousPageError:j&&P}}return v(R,T,F)}function y(){return R=>{let T;return typeof R=="object"?T=fi(R)??Rl:T=R,r(T===Rl?o:V=>s(V)?.mutations?.[T]??dg,i)}}function S(R,T){let k=R[t],F=new Set,V=kl(T,Nl,Eg);for(let U of V){let L=k.provided.tags[U.type];if(!L)continue;let j=(U.id!==void 0?L[U.id]:Object.values(L).flat())??[];for(let M of j)F.add(M)}return Array.from(F.values()).flatMap(U=>{let L=k.queries[U];return L?{queryCacheKey:U,endpointName:L.endpointName,originalArgs:L.originalArgs}:[]})}function x(R,T){return kl(Object.values(a(R)),k=>k?.endpointName===T&&k.status!==ar,k=>k.originalArgs)}function I(R,T,k){return T?Pl(R,T,k)!=null:!1}function _(R,T,k){return!T||!R.getPreviousPageParam?!1:Rg(R,T,k)!=null}}var pg=WeakMap?new WeakMap:void 0,fg=({endpointName:e,queryArgs:t})=>{let r="",n=pg?.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=Vt(s)?Object.keys(s).sort().reduce((a,c)=>(a[c]=s[c],a),{}):s,s));Vt(t)&&pg?.set(t,o),r=o}return`${e}(${r})`};function kx(...e){return function(r){let n=ri(u=>r.extractRehydrationInfo?.(u,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(u){let g=fg;if("serializeQueryArgs"in u.endpointDefinition){let v=u.endpointDefinition.serializeQueryArgs;g=w=>{let h=v(w);return typeof h=="string"?h:fg({...w,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(u)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(u){u()},apiUid:ai(),extractRehydrationInfo:n,hasRehydrationInfo:ri(u=>n(u)!=null)},s={injectEndpoints:c,enhanceEndpoints({addTagTypes:u,endpoints:g}){if(u)for(let v of u)o.tagTypes.includes(v)||o.tagTypes.push(v);if(g)for(let[v,w]of Object.entries(g))typeof w=="function"?w(Yn(i,v)):Object.assign(Yn(i,v)||{},w);return s}},a=e.map(u=>u.init(s,o,i));function c(u){let g=u.endpoints({query:v=>({...v,type:mi}),mutation:v=>({...v,type:Cg}),infiniteQuery:v=>({...v,type:xg})});for(let[v,w]of Object.entries(g)){if(u.overrideExisting!==!0&&v in i.endpointDefinitions){if(u.overrideExisting==="throw")throw new Error(ut(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[v]=w;for(let h of a)h.injectEndpoint(v,w)}return s}return s.injectEndpoints({endpoints:r.endpoints})}}function sr(e,...t){return Object.assign(e,...t)}var _x=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,i=null,s=null,{updateSubscriptionOptions:a,unsubscribeQueryResult:c}=e.internalActions,u=(S,x)=>{if(a.match(x)){let{queryCacheKey:_,requestId:R,options:T}=x.payload,k=S.get(_);return k?.has(R)&&k.set(R,T),!0}if(c.match(x)){let{queryCacheKey:_,requestId:R}=x.payload,T=S.get(_);return T&&T.delete(R),!0}if(e.internalActions.removeQueryResult.match(x))return S.delete(x.payload.queryCacheKey),!0;if(t.pending.match(x)){let{meta:{arg:_,requestId:R}}=x,T=zs(S,_.queryCacheKey,_l);return _.subscribe&&T.set(R,_.subscriptionOptions??T.get(R)??{}),!0}let I=!1;if(t.rejected.match(x)){let{meta:{condition:_,arg:R,requestId:T}}=x;if(_&&R.subscribe){let k=zs(S,R.queryCacheKey,_l);k.set(T,R.subscriptionOptions??k.get(T)??{}),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=u(r.currentSubscriptions,S),_=!0;if(I){s||(s=setTimeout(()=>{let k=y(r.currentSubscriptions),[,F]=dl(i,()=>k);x.next(e.internalActions.subscriptionsUpdated(F)),i=k,s=null},500));let R=typeof S.type=="string"&&!!S.type.startsWith(o),T=t.rejected.match(S)&&S.meta.condition&&!!S.meta.arg.subscribe;_=!R&&!T}return[_,!1]}},Ox=2147483647/1e3-1,Px=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:s},getRunningQueryThunk:a,mwApi:c})=>{let{removeQueryResult:u,unsubscribeQueryResult:g,cacheEntriesUpserted:v}=t.internalActions,w=Bt(g.match,r.fulfilled,r.rejected,v.match);function h(R){let T=o.currentSubscriptions.get(R);return T?T.size>0:!1}let y={};function S(R){for(let T of R.values())T?.abort?.()}let x=(R,T)=>{let k=T.getState(),F=s(k);if(w(R)){let V;if(v.match(R))V=R.payload.map(U=>U.queryDescription.queryCacheKey);else{let{queryCacheKey:U}=g.match(R)?R.payload:R.meta.arg;V=[U]}I(V,T,F)}if(t.util.resetApiState.match(R)){for(let[V,U]of Object.entries(y))U&&clearTimeout(U),delete y[V];S(o.runningQueries),S(o.runningMutations)}if(n.hasRehydrationInfo(R)){let{queries:V}=n.extractRehydrationInfo(R);I(Object.keys(V),T,F)}};function I(R,T,k){let F=T.getState();for(let V of R){let U=i(F,V);U?.endpointName&&_(V,U.endpointName,T,k)}}function _(R,T,k,F){let U=Yn(n,T)?.keepUnusedDataFor??F.keepUnusedDataFor;if(U===1/0)return;let L=Math.max(0,Math.min(U,Ox));if(!h(R)){let j=y[R];j&&clearTimeout(j),y[R]=setTimeout(()=>{if(!h(R)){let M=i(k.getState(),R);M?.endpointName&&k.dispatch(a(M.endpointName,M.originalArgs))?.abort(),k.dispatch(u({queryCacheKey:R}))}delete y[R]},L*1e3)}}return x},mg=new Error("Promise never resolved before cacheEntryRemoved."),Nx=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:s,selectApiState:a}})=>{let c=Ps(n),u=Ps(o),g=ir(n,o),v={},{removeQueryResult:w,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function S(k,F,V){let U=v[k];U?.valueResolved&&(U.valueResolved({data:F,meta:V}),delete U.valueResolved)}function x(k){let F=v[k];F&&(delete v[k],F.cacheEntryRemoved())}function I(k){let{arg:F,requestId:V}=k.meta,{endpointName:U,originalArgs:L}=F;return[U,L,V]}let _=(k,F,V)=>{let U=R(k);function L(j,M,O,P){let N=s(V,M),Q=s(F.getState(),M);!N&&Q&&T(j,P,M,F,O)}if(n.pending.match(k)){let[j,M,O]=I(k);L(j,U,O,M)}else if(y.match(k))for(let{queryDescription:j,value:M}of k.payload){let{endpointName:O,originalArgs:P,queryCacheKey:N}=j;L(O,N,k.meta.requestId,P),S(N,M,{})}else if(o.pending.match(k)){if(F.getState()[t].mutations[U]){let[M,O,P]=I(k);T(M,O,U,F,P)}}else if(g(k))S(U,k.payload,k.meta.baseQueryMeta);else if(w.match(k)||h.match(k))x(U);else if(e.util.resetApiState.match(k))for(let j of Object.keys(v))x(j)};function R(k){return c(k)?k.meta.arg.queryCacheKey:u(k)?k.meta.arg.fixedCacheKey??k.meta.requestId:w.match(k)?k.payload.queryCacheKey:h.match(k)?fi(k.payload):""}function T(k,F,V,U,L){let j=Yn(r,k),M=j?.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 mg})]);N.catch(()=>{}),v[V]=O;let Q=e.endpoints[k].select(Ws(j)?F:V),$=U.dispatch((H,J,se)=>se),Y={...U,getCacheEntry:()=>Q(U.getState()),requestId:L,extra:$,updateCachedData:Ws(j)?H=>U.dispatch(e.util.updateQueryData(k,F,H)):void 0,cacheDataLoaded:N,cacheEntryRemoved:P},K=M(F,Y);Promise.resolve(K).catch(H=>{if(H!==mg)throw H})}return _},Fx=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},Dx=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:s,refetchQuery:a,internalState:c})=>{let{removeQueryResult:u}=i.internalActions,g=Bt(ir(n),si(n)),v=Bt(ir(o,n),Wr(o,n)),w=[],h=0,y=(I,_)=>{(o.pending.match(I)||n.pending.match(I))&&h++,v(I)&&(h=Math.max(0,h-1)),g(I)?x(Tg(I,"invalidatesTags",r,s),_):v(I)?x([],_):i.util.invalidateTags.match(I)&&x(Ml(I.payload,void 0,void 0,void 0,void 0,s),_)};function S(){return h>0}function x(I,_){let R=_.getState(),T=R[e];if(w.push(...I),T.config.invalidationBehavior==="delayed"&&S())return;let k=w;if(w=[],k.length===0)return;let F=i.util.selectInvalidatedBy(R,k);t.batch(()=>{let V=Array.from(F.values());for(let{queryCacheKey:U}of V){let L=T.queries[U],j=zs(c.currentSubscriptions,U,_l);L&&(j.size===0?_.dispatch(u({queryCacheKey:U})):L.status!==ar&&_.dispatch(a(L)))}})}return y},Mx=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:s}=o,a=new Set,c=null,u=(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(),c&&(clearTimeout(c),c=null),a.clear())};function g(x,I){a.add(x),c||(c=setTimeout(()=>{for(let _ of a)w({queryCacheKey:_},I);a.clear(),c=null},0))}function v({queryCacheKey:x},I){let _=I.getState()[e],R=_.queries[x],T=s.get(x);if(!R||R.status===ar)return;let{lowestPollingInterval:k,skipPollingIfUnfocused:F}=S(T);if(!Number.isFinite(k))return;let V=i.get(x);V?.timeout&&(clearTimeout(V.timeout),V.timeout=void 0);let U=Date.now()+k;i.set(x,{nextPollTimestamp:U,pollingInterval:k,timeout:setTimeout(()=>{(_.config.focused||!F)&&I.dispatch(n(R)),v({queryCacheKey:x},I)},k)})}function w({queryCacheKey:x},I){let R=I.getState()[e].queries[x],T=s.get(x);if(!R||R.status===ar)return;let{lowestPollingInterval:k}=S(T);if(!Number.isFinite(k)){h(x);return}let F=i.get(x),V=Date.now()+k;(!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,_=Number.POSITIVE_INFINITY;for(let R of x.values())R.pollingInterval&&(_=Math.min(R.pollingInterval,_),I=R.skipPollingIfUnfocused||I);return{lowestPollingInterval:_,skipPollingIfUnfocused:I}}return u},Lx=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=Os(r,n),i=Wr(r,n),s=ir(r,n),a={};return(u,g)=>{if(o(u)){let{requestId:v,arg:{endpointName:w,originalArgs:h}}=u.meta,y=Yn(t,w),S=y?.onQueryStarted;if(S){let x={},I=new Promise((k,F)=>{x.resolve=k,x.reject=F});I.catch(()=>{}),a[v]=x;let _=e.endpoints[w].select(Ws(y)?h:v),R=g.dispatch((k,F,V)=>V),T={...g,getCacheEntry:()=>_(g.getState()),requestId:v,extra:R,updateCachedData:Ws(y)?k=>g.dispatch(e.util.updateQueryData(w,h,k)):void 0,queryFulfilled:I};S(h,T)}}else if(s(u)){let{requestId:v,baseQueryMeta:w}=u.meta;a[v]?.resolve({data:u.payload,meta:w}),delete a[v]}else if(i(u)){let{requestId:v,rejectedWithValue:w,baseQueryMeta:h}=u.meta;a[v]?.reject({error:u.payload??u.error,isUnhandledError:!w,meta:h}),delete a[v]}}},jx=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,s=(c,u)=>{Fl.match(c)&&a(u,"refetchOnFocus"),Dl.match(c)&&a(u,"refetchOnReconnect")};function a(c,u){let g=c.getState()[e],v=g.queries,w=o.currentSubscriptions;t.batch(()=>{for(let h of w.keys()){let y=v[h],S=w.get(h);if(!S||!y)continue;let x=[...S.values()];(x.some(_=>_[u]===!0)||x.every(_=>_[u]===void 0)&&g.config[u])&&(S.size===0?c.dispatch(i({queryCacheKey:h})):y.status!==ar&&c.dispatch(n(y)))}})}return s};function qx(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:s}=o,a={invalidateTags:B(`${t}/invalidateTags`)},c=w=>w.type.startsWith(`${t}/`),u=[Fx,Px,Dx,Mx,Nx,Lx];return{middleware:w=>{let h=!1,y=i(w.dispatch),S={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:c,mwApi:w},x=u.map(R=>R(S)),I=_x(S),_=jx(S);return R=>T=>{if(!$o(T))return R(T);h||(h=!0,w.dispatch(n.internalActions.middlewareRegistered(s)));let k={...w,next:R},F=w.getState(),[V,U]=I(T,k,F),L;if(V?L=R(T):L=U,w.getState()[t]&&(_(T,k,F),c(T)||o.hasRehydrationInfo(T)))for(let j of x)j(T,k,F);return L}},actions:a};function v(w){return e.api.endpoints[w.endpointName].initiate(w.originalArgs,{subscribe:!1,forceRefetch:!0})}}var gg=Symbol(),Ux=({createSelector:e=Ue}={})=>({name:gg,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:s,refetchOnMountOrArgChange:a,refetchOnFocus:c,refetchOnReconnect:u,invalidationBehavior:g,onSchemaFailure:v,catchSchemaFailure:w,skipSchemaValidation:h},y){Yf();let S=pe=>(typeof process<"u",pe);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:Dl,onOffline:wg,onFocus:Fl,onFocusLost:bg},util:{}});let x=Tx({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:_,buildQuerySelector:R,buildInfiniteQuerySelector:T,buildMutationSelector:k}=x;sr(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:_});let{queryThunk:F,infiniteQueryThunk:V,mutationThunk:U,patchQueryData:L,updateQueryData:j,upsertQueryData:M,prefetch:O,buildMatchThunkActions:P}=Ix({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:S,selectors:x,onSchemaFailure:v,catchSchemaFailure:w,skipSchemaValidation:h}),{reducer:N,actions:Q}=Rx({context:y,queryThunk:F,infiniteQueryThunk:V,mutationThunk:U,serializeQueryArgs:i,reducerPath:o,assertTagType:S,config:{refetchOnFocus:c,refetchOnReconnect:u,refetchOnMountOrArgChange:a,keepUnusedDataFor:s,reducerPath:o,invalidationBehavior:g}});sr(t.util,{patchQueryData:L,updateQueryData:j,upsertQueryData:M,prefetch:O,resetApiState:Q.resetApiState,upsertQueryEntries:Q.cacheEntriesUpserted}),sr(t.internalActions,Q);let $=new WeakMap,Y=pe=>zs($,pe,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:K,buildInitiateInfiniteQuery:H,buildInitiateMutation:J,getRunningMutationThunk:se,getRunningMutationsThunk:be,getRunningQueriesThunk:Ne,getRunningQueryThunk:Ie}=Ex({queryThunk:F,mutationThunk:U,infiniteQueryThunk:V,api:t,serializeQueryArgs:i,context:y,getInternalState:Y});sr(t.util,{getRunningMutationThunk:se,getRunningMutationsThunk:be,getRunningQueryThunk:Ie,getRunningQueriesThunk:Ne});let{middleware:ke,actions:_e}=qx({reducerPath:o,context:y,queryThunk:F,mutationThunk:U,infiniteQueryThunk:V,api:t,assertTagType:S,selectors:x,getRunningQueryThunk:Ie,getInternalState:Y});return sr(t.util,_e),sr(t,{reducer:N,middleware:ke}),{name:gg,injectEndpoint(pe,de){var Be;let fe=(Be=t.endpoints)[pe]??(Be[pe]={});Ys(de)&&sr(fe,{name:pe,select:R(pe,de),initiate:K(pe,de)},P(F,pe)),wx(de)&&sr(fe,{name:pe,select:k(),initiate:J(pe)},P(U,pe)),Xs(de)&&sr(fe,{name:pe,select:T(pe,de),initiate:H(pe,de)},P(F,pe))}}}}),_g=kx(Ux());m();d();f();p();m();d();f();p();var Zr=e=>e.query,Og=e=>e.query?.enableQuerySyntax;var iU=Ue(e=>Zr(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})),Vx=Ue(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 cr(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{u(n.next(g))}catch(v){s(v)}}function c(g){try{u(n.throw(g))}catch(v){s(v)}}function u(g){g.done?i(g.value):o(g.value).then(a,c)}u((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 ql(){return typeof window<"u"}function Zl(){return typeof navigator<"u"}function Xn(){return typeof document<"u"}function Ul(){try{return typeof localStorage<"u"}catch{return!1}}function Bx(){try{return typeof sessionStorage<"u"}catch{return!1}}function $g(){return Zl()&&navigator.cookieEnabled}var Gx=[ve.click,ve.custom,ve.search,ve.view],$x=(e,t)=>Gx.indexOf(e)!==-1?Object.assign({language:Xn()?document.documentElement.lang:"unknown",userAgent:Zl()?navigator.userAgent:"unknown"},t):t,hi=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?Pg(t,r,i):(s=a.split("."),o=s[s.length-2]+"."+s[s.length-1],Pg(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 Pg(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function Qx(){return Ul()?localStorage:$g()?new yi:Bx()?sessionStorage:new Jn}var yi=class e{getItem(t){return hi.get(`${e.prefix}${t}`)}removeItem(t){hi.erase(`${e.prefix}${t}`)}setItem(t,r,n){hi.set(`${e.prefix}${t}`,r,n)}};yi.prefix="coveo_";var Vl=class{constructor(){this.cookieStorage=new yi}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)}},Jn=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Zs="__coveo.analytics.history",Hx=20,zx=1e3*60,Wx=75,ea=class{constructor(t){this.store=t||Qx()}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(Zs);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(Zs);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Zs,JSON.stringify(t.slice(0,Hx)))}catch{}}clear(){try{this.store.removeItem(Zs)}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,Wx)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>zx:!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 Kx=(e,t)=>q(void 0,void 0,void 0,function*(){return e===ve.view?(yield Yx(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),Yx=e=>q(void 0,void 0,void 0,function*(){let t=new ea,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),Xx=/^(?:[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 ta(e){return typeof e=="string"&&Xx.test(e)}function Ng(e){if(!ta(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var et=[];for(let e=0;e<256;++e)et.push((e+256).toString(16).slice(1));function Qg(e,t=0){return(et[e[t+0]]+et[e[t+1]]+et[e[t+2]]+et[e[t+3]]+"-"+et[e[t+4]]+et[e[t+5]]+"-"+et[e[t+6]]+et[e[t+7]]+"-"+et[e[t+8]]+et[e[t+9]]+"-"+et[e[t+10]]+et[e[t+11]]+et[e[t+12]]+et[e[t+13]]+et[e[t+14]]+et[e[t+15]]).toLowerCase()}var Zx=new Uint8Array(16);function Jx(){return crypto.getRandomValues(Zx)}function eE(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}var tE="6ba7b810-9dad-11d1-80b4-00c04fd430c8",rE="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function nE(e,t,r,n,o,i){let s=typeof r=="string"?eE(r):r,a=typeof n=="string"?Ng(n):n;if(typeof n=="string"&&(n=Ng(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+s.length);return c.set(a),c.set(s,a.length),c=t(c),c[6]=c[6]&15|e,c[8]=c[8]&63|128,Qg(c)}function Jr(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():oE(e,t,r)}function oE(e,t,r){e=e||{};let n=e.random??e.rng?.()??Jx();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 Qg(n)}function iE(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 Ll(e,t){return e<<t|e>>>32-t}function sE(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,i=Math.ceil(o/16),s=new Array(i);for(let a=0;a<i;++a){let c=new Uint32Array(16);for(let u=0;u<16;++u)c[u]=e[a*64+u*4]<<24|e[a*64+u*4+1]<<16|e[a*64+u*4+2]<<8|e[a*64+u*4+3];s[a]=c}s[i-1][14]=(e.length-1)*8/2**32,s[i-1][14]=Math.floor(s[i-1][14]),s[i-1][15]=(e.length-1)*8&4294967295;for(let a=0;a<i;++a){let c=new Uint32Array(80);for(let y=0;y<16;++y)c[y]=s[a][y];for(let y=16;y<80;++y)c[y]=Ll(c[y-3]^c[y-8]^c[y-14]^c[y-16],1);let u=r[0],g=r[1],v=r[2],w=r[3],h=r[4];for(let y=0;y<80;++y){let S=Math.floor(y/20),x=Ll(u,5)+iE(S,g,v,w)+h+t[S]+c[y]>>>0;h=w,w=v,v=Ll(g,30)>>>0,g=u,u=x}r[0]=r[0]+u>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+v>>>0,r[3]=r[3]+w>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function ra(e,t,r,n){return nE(80,sE,e,t)}ra.DNS=tE;ra.URL=rE;var Hg="2.33.0",Fg=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,gi={pageview:"pageview",event:"event"},na=class{constructor({client:t,uuidGenerator:r=Jr}){this.client=t,this.uuidGenerator=r}},Bl=class extends na{constructor({client:t,uuidGenerator:r=Jr}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=Fg(window.location),this.lastReferrer=Xn()?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:Xn()?document.title:"",encoding:Xn()?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===gi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===gi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===gi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===gi.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 Fg(window.location)}},Sr=class e{constructor(t,r){if(!ta(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 ta(i)?new e(i,Number.parseInt(o)*1e3):null}};Sr.cvo_cid="cvo_cid";Sr.expirationTime=120;var Gl=class extends na{constructor({client:t,uuidGenerator:r=Jr}){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(Sr.cvo_cid,new Sr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Gl.Id="link";var xt=Object.keys;function Js(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var jl=128,zg=192,Dg=224,Mg=240;function aE(e){return(e&248)===Mg?4:(e&Mg)===Dg?3:(e&Dg)===zg?2:1}function cE(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&jl)!=jl)break;if(r-=3,(n&zg)!=jl){t-r>=aE(n)*3&&(r=t);break}}return e.substring(0,r)}var $l={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"},uE=xt($l).map(e=>$l[e]),lE=[...uE].join("|"),dE=new RegExp(`^(${lE}$)`),pE={svcAction:"svc_action",svcActionData:"svc_action_data"},fE=e=>xt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=$l[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),mE=e=>dE.test(e),gE=[mE],Lg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},jg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},st={action:"pa",list:"pal",listSource:"pls"},oa={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},hE=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Ql={id:"quoteId",affiliation:"quoteAffiliation"},Hl={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},yE={add:st,bookmark_add:st,bookmark_remove:st,click:st,checkout:st,checkout_option:st,detail:st,impression:st,remove:st,refund:Object.assign(Object.assign({},st),oa),purchase:Object.assign(Object.assign({},st),oa),quickview:st,quote:Object.assign(Object.assign({},st),Ql),review:Object.assign(Object.assign({},st),Hl)},vE=xt(Lg).map(e=>Lg[e]),SE=xt(jg).map(e=>jg[e]),AE=xt(st).map(e=>st[e]),bE=xt(oa).map(e=>oa[e]),wE=xt(Hl).map(e=>Hl[e]),CE=xt(Ql).map(e=>Ql[e]),xE=[...vE,"custom"].join("|"),EE=[...SE,"custom"].join("|"),Wg="(pr[0-9]+)",Kg="(il[0-9]+pi[0-9]+)",IE=new RegExp(`^${Wg}(${xE})$`),RE=new RegExp(`^(${Kg}(${EE}))|(il[0-9]+nm)$`),TE=new RegExp(`^(${AE.join("|")})$`),kE=new RegExp(`^(${bE.join("|")})$`),_E=new RegExp(`^${Wg}custom$`),OE=new RegExp(`^${Kg}custom$`),PE=new RegExp(`^(${[...hE,...wE,...CE].join("|")})$`),NE=e=>IE.test(e),FE=e=>RE.test(e),DE=e=>TE.test(e),ME=e=>kE.test(e),LE=e=>PE.test(e),jE=[FE,NE,DE,ME,LE],qE=[_E,OE],UE={anonymizeIp:"aip"},VE={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},BE={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},GE=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],$E=Object.assign(Object.assign(Object.assign(Object.assign({},UE),VE),BE),GE.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),zl=Object.assign(Object.assign({},$E),pE),QE=e=>{let t=!!e.action&&yE[e.action]||{};return xt(e).reduce((r,n)=>{let o=t[n]||zl[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},HE=xt(zl).map(e=>zl[e]),zE=e=>HE.indexOf(e)!==-1,WE=e=>e==="custom",KE=e=>[...jE,...gE,zE,WE].some(t=>t(e)),YE=e=>xt(e).reduce((t,r)=>{let n=XE(r);return n?Object.assign(Object.assign({},t),ZE(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),XE=e=>{let t;return[...qE].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},ZE=(e,t)=>xt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),Wl=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),c=this.encodeForEventType(t,a),u=new Blob([c],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(s,u)})}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:c}=s;o=a||t;try{i=JSON.parse(c)}catch(u){console.error("Unable to process the request body as a JSON string",u)}}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}},Kl=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()})}},qg=b.fetch,ia=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)},c=Object.assign(Object.assign({},a),i?yield i(a,"analyticsFetch"):{}),{url:u}=c,g=cr(c,["url"]),v;try{v=yield qg(u,g)}catch(w){console.error("An error has occurred when sending the event.",w);return}if(v.ok){let w=yield v.json();return w.visitorId&&o.setCurrentVisitorId(w.visitorId),w}else{try{v.json()}catch{}throw console.error(`An error has occurred 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 qg(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"})}},Yl=class{constructor(t,r){Ul()&&$g()?this.storage=new Vl:Ul()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Jn),this.client=new ia(t),this.beaconClient=new Wl(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}},Xl=class{constructor(t,r){this.storage=r||new Jn,this.client=new ia(t)}getClientDependingOnEventType(t){return this.client}},sa=class{constructor(){this.storage=new Jn,this.client=new Kl}getClientDependingOnEventType(t){return this.client}},JE="xx",eI=e=>e?.startsWith(JE)||!1,tI=`
27
+ `;return new Hu(r)}var Hu=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Nt=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 uw(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}},Vr=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 Ln(e){return e===void 0}function lw(e){return e===null}function ce(e){return Ln(e)||lw(e)}var je=class{constructor(e={}){oe(this,"value");this.value=new Vr(e)}validate(e){let t=this.value.validate(e);return t||(dw(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function dw(e){return Ln(e)||xf(e)}function xf(e){return typeof e=="boolean"}var Le=class{constructor(e={}){oe(this,"config");oe(this,"value");this.config=e,this.value=new Vr(e)}validate(e){let t=this.value.validate(e);return t||(pw(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 pw(e){return Ln(e)||Ef(e)}function Ef(e){return typeof e=="number"&&!Number.isNaN(e)}var fw=/^\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 Vr(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(Ln(e))return null;if(!If(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&&!(fw.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 If(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(Ln(e))return this.config.options.required?"value is required and is currently undefined":null;if(!Rf(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 Rf(e){return e!==void 0&&typeof e=="object"}var Ft=class{constructor(e={}){oe(this,"config");oe(this,"value");this.config=e,this.value=new Vr(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 xf(e)||If(e)||Ef(e)||Rf(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Tf(e){return Array.isArray(e)}var zu=class{constructor(e){oe(this,"config");oe(this,"value");this.config=e,this.value=new Vr(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Ln(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 is=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();var jn=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 Wu(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Ku=e=>{let{response:t}=e;return t.body?mw(e):gw(t)},mw=e=>yw(e)?vw(e):hw(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},gw=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function hw(e){return e.body.statusCode!==void 0}function yw(e){return e.body.exception!==void 0}var vw=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();function kf(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var Yu=(e,t,r,n)=>{let o=new jn(`${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 _f=(e,t)=>{let r=new jn(`${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},Xu=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield yr.call({...Yu(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Wu(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=kf(r),o=yield r.arrayBuffer(),s=new TextDecoder(n).decode(o);return Sw(s)?{success:s}:{error:Ku({response:r,body:s})}});return function Xu(_x3,_x4){return _ref3.apply(this,arguments)}}();function Sw(e){return typeof e=="string"}m();d();f();p();function Aw(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function bw(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function ss(e,t){if(t&&e.name==="AbortError")return{error:bw(e)};if(e instanceof Ur)return{error:Aw(e)};throw e}m();d();f();p();m();d();f();p();var as=(e,t,r,n,o={})=>{ww(e);let i=`${e.url}/rest/organizations/${e.organizationId}/caseassists/${e.caseAssistId}${n}`,s=Cw(o),a=s?`${i}?${s}`:i;return{accessToken:e.accessToken,method:t,contentType:r,url:a,origin:"caseAssistApiFetch"}},cs=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r],t),{}),us=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r].value,t),{}),ww=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.")},Cw=e=>Object.keys(e).map(t=>`${t}=${encodeURIComponent(e[t])}`).join("&");var Of=e=>{let t=e.debug?{debug:"1"}:{};return{...as(e,"POST","application/json","/classify",t),requestParams:xw(e)}},xw=e=>({clientId:e.clientId,locale:e.locale,fields:cs(e.fields)});m();d();f();p();var Pf=e=>{let t={};return e.debug&&(t.debug="1"),e.numberOfResults&&(t.numberOfResults=e.numberOfResults.toString()),{...as(e,"POST","application/json","/documents/suggest",t),requestParams:Ew(e)}},Ew=e=>({clientId:e.clientId,locale:e.locale,fields:cs(e.fields),context:e.context,analytics:e.analytics});var ls=class{constructor(t){oe(this,"options",t)}getCaseClassifications(t){var _this=this;return _asyncToGenerator(function*(){let r=yield yr.call({...Of(t),..._this.options});if(r instanceof Error)return ss(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}getDocumentSuggestions(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield yr.call({...Pf(t),..._this2.options});if(r instanceof Error)return ss(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this3=this;return _asyncToGenerator(function*(){return Xu(t,_this3.options)})()}};m();d();f();p();m();d();f();p();m();d();f();p();function Xe(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 Iw=typeof Symbol=="function"&&Symbol.observable||"@@observable",Nf=Iw,Zu=()=>Math.random().toString(36).substring(7).split("").join("."),Rw={INIT:`@@redux/INIT${Zu()}`,REPLACE:`@@redux/REPLACE${Zu()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Zu()}`},ds=Rw;function Vt(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 Ju(e,t,r){if(typeof e!="function")throw new Error(Xe(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Xe(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Xe(1));return r(Ju)(e,t)}let n=e,o=t,i=new Map,s=i,a=0,c=!1;function u(){s===i&&(s=new Map,i.forEach((x,I)=>{s.set(I,x)}))}function g(){if(c)throw new Error(Xe(3));return o}function v(x){if(typeof x!="function")throw new Error(Xe(4));if(c)throw new Error(Xe(5));let I=!0;u();let _=a++;return s.set(_,x),function(){if(I){if(c)throw new Error(Xe(6));I=!1,u(),s.delete(_),i=null}}}function w(x){if(!Vt(x))throw new Error(Xe(7));if(typeof x.type>"u")throw new Error(Xe(8));if(typeof x.type!="string")throw new Error(Xe(17));if(c)throw new Error(Xe(9));try{c=!0,o=n(o,x)}finally{c=!1}return(i=s).forEach(_=>{_()}),x}function h(x){if(typeof x!="function")throw new Error(Xe(10));n=x,w({type:ds.REPLACE})}function y(){let x=v;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(Xe(11));function _(){let T=I;T.next&&T.next(g())}return _(),{unsubscribe:x(_)}},[Nf](){return this}}}return w({type:ds.INIT}),{dispatch:w,subscribe:v,getState:g,replaceReducer:h,[Nf]:y}}function Tw(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:ds.INIT})>"u")throw new Error(Xe(12));if(typeof r(void 0,{type:ds.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Xe(13))})}function qn(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{Tw(r)}catch(s){i=s}return function(a={},c){if(i)throw i;let u=!1,g={};for(let v=0;v<n.length;v++){let w=n[v],h=r[w],y=a[w],S=h(y,c);if(typeof S>"u"){let x=c&&c.type;throw new Error(Xe(14))}g[w]=S,u=u||S!==y}return u=u||n.length!==Object.keys(a).length,u?g:a}}function Go(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Ff(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(Xe(15))},s={getState:o.getState,dispatch:(c,...u)=>i(c,...u)},a=e.map(c=>c(s));return i=Go(...a)(o.dispatch),{...o,dispatch:i}}}function $o(e){return Vt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var cl=Symbol.for("immer-nothing"),Qo=Symbol.for("immer-draftable"),$e=Symbol.for("immer-state");function Ze(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ht=Object,Gr=ht.getPrototypeOf,Ho="constructor",Xo="prototype",rl="configurable",gs="enumerable",fs="writable",zo="value",ct=e=>!!e&&!!e[$e];function it(e){return e?Bf(e)||Jo(e)||!!e[Qo]||!!e[Ho]?.[Qo]||ei(e)||ti(e):!1}var kw=ht[Xo][Ho].toString(),Df=new WeakMap;function Bf(e){if(!e||!Vn(e))return!1;let t=Gr(e);if(t===null||t===ht[Xo])return!0;let r=ht.hasOwnProperty.call(t,Ho)&&t[Ho];if(r===Object)return!0;if(!Br(r))return!1;let n=Df.get(r);return n===void 0&&(n=Function.toString.call(r),Df.set(r,n)),n===kw}function Gf(e){return ct(e)||Ze(15,e),e[$e].base_}function Zo(e,t,r=!0){$r(e)===0?(r?Reflect.ownKeys(e):ht.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function $r(e){let t=e[$e];return t?t.type_:Jo(e)?1:ei(e)?2:ti(e)?3:0}var Un=(e,t,r=$r(e))=>r===2?e.has(t):ht[Xo].hasOwnProperty.call(e,t),nr=(e,t,r=$r(e))=>r===2?e.get(t):e[t],hs=(e,t,r,n=$r(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function _w(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Jo=Array.isArray,ei=e=>e instanceof Map,ti=e=>e instanceof Set,Vn=e=>typeof e=="object",Br=e=>typeof e=="function",el=e=>typeof e=="boolean";function Ow(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Pw=e=>Vn(e)?e?.[$e]:null,or=e=>e.copy_||e.base_;var ul=e=>e.modified_?e.copy_:e.base_;function nl(e,t){if(ei(e))return new Map(e);if(ti(e))return new Set(e);if(Jo(e))return Array[Xo].slice.call(e);let r=Bf(e);if(t===!0||t==="class_only"&&!r){let n=ht.getOwnPropertyDescriptors(e);delete n[$e];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let s=o[i],a=n[s];a[fs]===!1&&(a[fs]=!0,a[rl]=!0),(a.get||a.set)&&(n[s]={[rl]:!0,[fs]:!0,[gs]:a[gs],[zo]:e[s]})}return ht.create(Gr(e),n)}else{let n=Gr(e);if(n!==null&&r)return{...e};let o=ht.create(n);return ht.assign(o,e)}}function ll(e,t=!1){return ws(e)||ct(e)||!it(e)||($r(e)>1&&ht.defineProperties(e,{set:ps,add:ps,clear:ps,delete:ps}),ht.freeze(e),t&&Zo(e,(r,n)=>{ll(n,!0)},!1)),e}function Nw(){Ze(2)}var ps={[zo]:Nw};function ws(e){return e===null||!Vn(e)?!0:ht.isFrozen(e)}var ys="MapSet",vs="Patches",Mf="ArrayMethods",Ss={};function Qr(e){let t=Ss[e];return t||Ze(0,e),t}var Lf=e=>!!Ss[e];function Fw(e,t){Ss[e]||(Ss[e]=t)}var Wo,$f=()=>Wo,Dw=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Lf(ys)?Qr(ys):void 0,arrayMethodsPlugin_:Lf(Mf)?Qr(Mf):void 0});function jf(e,t){t&&(e.patchPlugin_=Qr(vs),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ol(e){il(e),e.drafts_.forEach(Mw),e.drafts_=null}function il(e){e===Wo&&(Wo=e.parent_)}var qf=e=>Wo=Dw(Wo,e);function Mw(e){let t=e[$e];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Uf(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[$e].modified_&&(ol(t),Ze(4)),it(e)&&(e=Vf(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[$e].base_,e,t)}else e=Vf(t,r);return Lw(t,e,!0),ol(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==cl?e:void 0}function Vf(e,t){if(ws(t))return t;let r=t[$e];if(!r)return As(t,e.handledSet_,e);if(!Cs(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);zf(r,e)}return r.copy_}function Lw(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ll(t,r)}function Qf(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Cs=(e,t)=>e.scope_===t,jw=[];function Hf(e,t,r,n){let o=or(e),i=e.type_;if(n!==void 0&&nr(o,n,i)===t){hs(o,n,r,i);return}if(!e.draftLocations_){let a=e.draftLocations_=new Map;Zo(o,(c,u)=>{if(ct(u)){let g=a.get(u)||[];g.push(c),a.set(u,g)}})}let s=e.draftLocations_.get(t)??jw;for(let a of s)hs(o,a,r,i)}function qw(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!Cs(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let s=ul(i);Hf(e,i.draft_??i,s,r),zf(i,o)})}function zf(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)}Qf(e)}}function Uw(e,t,r){let{scope_:n}=e;if(ct(r)){let o=r[$e];Cs(o,n)&&o.callbacks_.push(function(){ms(e);let s=ul(o);Hf(e,r,s,t)})}else it(r)&&e.callbacks_.push(function(){let i=or(e);e.type_===3?i.has(r)&&As(r,n.handledSet_,n):nr(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&As(nr(e.copy_,t,e.type_),n.handledSet_,n)})}function As(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||ct(e)||t.has(e)||!it(e)||ws(e)||(t.add(e),Zo(e,(n,o)=>{if(ct(o)){let i=o[$e];if(Cs(i,r)){let s=ul(i);hs(e,n,s,e.type_),Qf(i)}}else it(o)&&As(o,t,r)})),e}function Vw(e,t){let r=Jo(e),n={type_:r?1:0,scope_:t?t.scope_:$f(),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=bs;r&&(o=[n],i=Ko);let{revoke:s,proxy:a}=Proxy.revocable(o,i);return n.draft_=a,n.revoke_=s,[a,n]}var bs={get(e,t){if(t===$e)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=or(e);if(!Un(o,t,e.type_))return Gw(e,o,t);let i=o[t];if(e.finalized_||!it(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Ow(t))return i;if(i===tl(e.base_,t)||Bw(e,t,i)){ms(e);let s=e.type_===1?+t:t,a=al(e.scope_,i,e,s);return e.copy_[s]=a}return i},has(e,t){return t in or(e)},ownKeys(e){return Reflect.ownKeys(or(e))},set(e,t,r){let n=Wf(or(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=tl(or(e),t),i=o?.[$e];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(_w(r,o)&&(r!==void 0||Un(e.base_,t,e.type_)))return!0;ms(e),sl(e)}return e.copy_[t]===r&&(r!==void 0||Un(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Uw(e,t,r)),!0},deleteProperty(e,t){return ms(e),tl(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),sl(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=or(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[fs]:!0,[rl]:e.type_!==1||t!=="length",[gs]:n[gs],[zo]:r[t]}},defineProperty(){Ze(11)},getPrototypeOf(e){return Gr(e.base_)},setPrototypeOf(){Ze(12)}},Ko={};for(let e in bs){let t=bs[e];Ko[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Ko.deleteProperty=function(e,t){return Ko.set.call(this,e,t,void 0)};Ko.set=function(e,t,r){return bs.set.call(this,e[0],t,r,e[0])};function tl(e,t){let r=e[$e];return(r?or(r):e)[t]}function Bw(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!it(r)||r[$e]?!1:e.baseRefs_.has(r)}function Gw(e,t,r){let n=Wf(t,r);return n?zo in n?n[zo]:n.get?.call(e.draft_):void 0}function Wf(e,t){if(!(t in e))return;let r=Gr(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Gr(r)}}function sl(e){e.modified_||(e.modified_=!0,e.parent_&&sl(e.parent_))}function ms(e){e.copy_||(e.assigned_=new Map,e.copy_=nl(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(Br(t)&&!Br(r)){let i=r;r=t;let s=this;return function(c=i,...u){return s.produce(c,g=>r.call(this,g,...u))}}Br(r)||Ze(6),n!==void 0&&!Br(n)&&Ze(7);let o;if(it(t)){let i=qf(this),s=al(i,t,void 0),a=!0;try{o=r(s),a=!1}finally{a?ol(i):il(i)}return jf(i,n),Uf(o,i)}else if(!t||!Vn(t)){if(o=r(t),o===void 0&&(o=t),o===cl&&(o=void 0),this.autoFreeze_&&ll(o,!0),n){let i=[],s=[];Qr(vs).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:s}),n(i,s)}return o}else Ze(1,t)},this.produceWithPatches=(t,r)=>{if(Br(t))return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let n,o;return[this.produce(t,r,(s,a)=>{n=s,o=a}),n,o]},el(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),el(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),el(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){it(e)||Ze(8),ct(e)&&(e=xs(e));let t=qf(this),r=al(t,e,void 0);return r[$e].isManual_=!0,il(t),r}finishDraft(e,t){let r=e&&e[$e];(!r||!r.isManual_)&&Ze(9);let{scope_:n}=r;return jf(n,t),Uf(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=Qr(vs).applyPatches_;return ct(e)?n(e,t):this.produce(e,o=>n(o,t))}};function al(e,t,r,n){let[o,i]=ei(t)?Qr(ys).proxyMap_(t,r):ti(t)?Qr(ys).proxySet_(t,r):Vw(t,r);return(r?.scope_??$f()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?qw(r,i,n):i.callbacks_.push(function(c){c.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:u}=c;i.modified_&&u&&u.generatePatches_(i,[],c)}),o}function xs(e){return ct(e)||Ze(10,e),Kf(e)}function Kf(e){if(!it(e)||ws(e))return e;let t=e[$e],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=nl(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=nl(e,!0);return Zo(r,(o,i)=>{hs(r,o,Kf(i))},n),t&&(t.finalized_=!1),r}function Yf(){function t(y,S=[]){if(y.key_!==void 0){let x=y.parent_.copy_??y.parent_.base_,I=Pw(nr(x,y.key_)),_=nr(x,y.key_);if(_===void 0||_!==y.draft_&&_!==y.base_&&_!==y.copy_||I!=null&&I.base_!==y.base_)return null;let R=y.parent_.type_===3,T;if(R){let k=y.parent_;T=Array.from(k.drafts_.keys()).indexOf(y.key_)}else T=y.key_;if(!(R&&x.size>T||Un(x,T)))return null;S.push(T)}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 _=S[I];if(x=nr(x,_),!Vn(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_:_}=x;switch(y.type_){case 0:case 2:return c(y,S,I,_);case 1:return a(y,S,I,_);case 3:return u(y,S,I,_)}}function a(y,S,x,I){let{base_:_,assigned_:R}=y,T=y.copy_;T.length<_.length&&([_,T]=[T,_],[x,I]=[I,x]);let k=y.allIndicesReassigned_===!0;for(let F=0;F<_.length;F++){let V=T[F],U=_[F];if((k||R?.get(F.toString()))&&V!==U){let j=V?.[$e];if(j&&j.modified_)continue;let M=S.concat([F]);x.push({op:n,path:M,value:h(V)}),I.push({op:n,path:M,value:h(U)})}}for(let F=_.length;F<T.length;F++){let V=S.concat([F]);x.push({op:o,path:V,value:h(T[F])})}for(let F=T.length-1;_.length<=F;--F){let V=S.concat([F]);I.push({op:i,path:V})}}function c(y,S,x,I){let{base_:_,copy_:R,type_:T}=y;Zo(y.assigned_,(k,F)=>{let V=nr(_,k,T),U=nr(R,k,T),L=F?Un(_,k)?n:o:i;if(V===U&&L===n)return;let j=S.concat(k);x.push(L===i?{op:L,path:j}:{op:L,path:j,value:h(U)}),I.push(L===o?{op:i,path:j}:L===i?{op:o,path:j,value:h(V)}:{op:n,path:j,value:h(V)})})}function u(y,S,x,I){let{base_:_,copy_:R}=y,T=0;_.forEach(k=>{if(!R.has(k)){let F=S.concat([T]);x.push({op:i,path:F,value:k}),I.unshift({op:o,path:F,value:k})}T++}),T=0,R.forEach(k=>{if(!_.has(k)){let F=S.concat([T]);x.push({op:o,path:F,value:k}),I.unshift({op:i,path:F,value:k})}T++})}function g(y,S,x){let{patches_:I,inversePatches_:_}=x;I.push({op:n,path:[],value:S===cl?void 0:S}),_.push({op:n,path:[],value:y})}function v(y,S){return S.forEach(x=>{let{path:I,op:_}=x,R=y;for(let V=0;V<I.length-1;V++){let U=$r(R),L=I[V];typeof L!="string"&&typeof L!="number"&&(L=""+L),(U===0||U===1)&&(L==="__proto__"||L===Ho)&&Ze(19),Br(R)&&L===Xo&&Ze(19),R=nr(R,L),(R===null||!Vn(R))&&Ze(18,I.join("/"))}let T=$r(R),k=w(x.value),F=I[I.length-1];switch(_){case n:switch(T){case 2:return R.set(F,k);case 3:Ze(16);default:return R[F]=k}case o:switch(T){case 1:return F==="-"?R.push(k):R.splice(F,0,k);case 2:return R.set(F,k);case 3:return R.add(k);default:return R[F]=k}case i:switch(T){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:Ze(17,_)}}),y}function w(y){if(!it(y))return y;if(Jo(y))return y.map(w);if(ei(y))return new Map(Array.from(y.entries()).map(([x,I])=>[x,w(I)]));if(ti(y))return new Set(Array.from(y).map(w));let S=Object.create(Gr(y));for(let x in y)S[x]=w(y[x]);return Un(y,Qo)&&(S[Qo]=y[Qo]),S}function h(y){return ct(y)?w(y):y}Fw(vs,{applyPatches_:v,generatePatches_:s,generateReplacementPatches_:g,getPath:t})}var Qw=b.Iterator,PD=typeof Qw?.from=="function";var Yo=new $w,Hr=Yo.produce,dl=Yo.produceWithPatches.bind(Yo);var pl=Yo.applyPatches.bind(Yo);m();d();f();p();function Hw(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function zw(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 Xf=e=>Array.isArray(e)?e:[e];function Ww(e){let t=Array.isArray(e[0])?e[0]:e;return zw(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Kw(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var Yw=class{constructor(e){this.value=e}deref(){return this.value}},Xw=()=>typeof WeakRef>"u"?Yw:WeakRef,Jf=Xw(),Zw=0,Zf=1;function Es(){return{s:Zw,v:void 0,o:null,p:null}}function Jw(e){return e instanceof Jf?e.deref():e}function ri(e,t={}){let r=Es(),{resultEqualityCheck:n}=t,o,i=0;function s(){let a=r,{length:c}=arguments;for(let v=0,w=c;v<w;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=Es(),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=Es(),y.set(h,a)):a=S}}let u=a,g;if(a.s===Zf)g=a.v;else if(g=e.apply(null,arguments),i++,n){let v=Jw(o);v!=null&&n(v,g)&&(g=v,i!==0&&i--),o=typeof g=="object"&&g!==null||typeof g=="function"?new Jf(g):g}return u.s=Zf,u.v=g,g}return s.clearCache=()=>{r=Es(),s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function eC(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,s=0,a,c={},u=o.pop();typeof u=="object"&&(c=u,u=o.pop()),Hw(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);let g={...r,...c},{memoize:v,memoizeOptions:w=[],argsMemoize:h=ri,argsMemoizeOptions:y=[]}=g,S=Xf(w),x=Xf(y),I=Ww(o),_=v(function(){return i++,u.apply(null,arguments)},...S),R=!0,T=h(function(){s++;let F=Kw(I,arguments);return a=_.apply(null,F),a},...x);return Object.assign(T,{resultFunc:u,memoizedResultFunc:_,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 Ue=eC(ri);m();d();f();p();function em(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var tm=em(),rm=em;var tC=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Go:Go.apply(null,arguments)},rM=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},rC=e=>e&&typeof e.match=="function";function B(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(ut(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=>$o(n)&&n.type===e,r}var lm=class ni extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,ni.prototype)}static get[Symbol.species](){return ni}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new ni(...t[0].concat(this)):new ni(...t.concat(this))}};function nm(e){return it(e)?Hr(e,()=>{}):e}function Is(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function nC(e){return typeof e=="boolean"}var oC=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},s=new lm;return r&&(nC(r)?s.push(tm):s.push(rm(r.extraArgument))),s},oi="RTK_autoBatch",$n=()=>e=>({payload:e,meta:{[oi]:!0}}),om=e=>t=>{setTimeout(t,e)},iC=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(i),clearTimeout(s),r())},i=e(o),s=setTimeout(o,t)},sC=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,s=!1,a=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?iC(window.requestAnimationFrame,100):om(10):e.type==="callback"?e.queueNotification:om(e.timeout),u=()=>{s=!1,i&&(i=!1,a.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let v=()=>o&&g(),w=n.subscribe(v);return a.add(g),()=>{w(),a.delete(g)}},dispatch(g){try{return o=!g?.meta?.[oi],i=!o,i&&(s||(s=!0,c(u))),n.dispatch(g)}finally{o=!0}}})},aC=e=>function(r){let{autoBatch:n=!0}=r??{},o=new lm(e);return n&&o.push(sC(typeof n=="object"?n:void 0)),o};function dm(e){let t=oC(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:s=void 0,enhancers:a=void 0}=e||{},c;if(typeof r=="function")c=r;else if(Vt(r))c=qn(r);else throw new Error(ut(1));let u;typeof n=="function"?u=n(t):u=t();let g=Go;o&&(g=tC({trace:!1,...(typeof o=="object"&&o)}));let v=Ff(...u),w=aC(v),h=typeof a=="function"?a(w):w(),y=g(...h);return Ju(c,s,y)}function pm(e){let t={},r=[],n,o={addCase(i,s){let a=typeof i=="string"?i:i.type;if(!a)throw new Error(ut(28));if(a in t)throw new Error(ut(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 cC(e){return typeof e=="function"}function Qe(e,t){let[r,n,o]=pm(t),i;if(cC(e))i=()=>nm(e());else{let a=nm(e);i=()=>a}function s(a=i(),c){let u=[r[c.type],...n.filter(({matcher:g})=>g(c)).map(({reducer:g})=>g)];return u.filter(g=>!!g).length===0&&(u=[o]),u.reduce((g,v)=>{if(v)if(ct(g)){let h=v(g,c);return h===void 0?g:h}else{if(it(g))return Hr(g,w=>v(w,c));{let w=v(g,c);if(w===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return w}}return g},a)}return s.getInitialState=i,s}var fm=(e,t)=>rC(e)?e.match(t):e(t);function Bt(...e){return t=>e.some(r=>fm(r,t))}function Gn(...e){return t=>e.every(r=>fm(r,t))}function _s(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 ii(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Os(...e){return e.length===0?t=>_s(t,["pending"]):ii(e)?Bt(...e.map(t=>t.pending)):Os()(e[0])}function Wr(...e){return e.length===0?t=>_s(t,["rejected"]):ii(e)?Bt(...e.map(t=>t.rejected)):Wr()(e[0])}function si(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Gn(Wr(...e),t):ii(e)?Gn(Wr(...e),t):si()(e[0])}function ir(...e){return e.length===0?t=>_s(t,["fulfilled"]):ii(e)?Bt(...e.map(t=>t.fulfilled)):ir()(e[0])}function Ps(...e){return e.length===0?t=>_s(t,["pending","fulfilled","rejected"]):ii(e)?Bt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Ps()(e[0])}var uC="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",ai=(e=21)=>{let t="",r=e;for(;r--;)t+=uC[Math.random()*64|0];return t},lC=["name","message","stack","code"],fl=class{constructor(e,t){oe(this,"payload");oe(this,"meta");oe(this,"_type");this.payload=e,this.meta=t}},im=class{constructor(e,t){oe(this,"payload");oe(this,"meta");oe(this,"_type");this.payload=e,this.meta=t}},dC=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of lC)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},sm="External signal was aborted",Ce=(()=>{function e(t,r,n){let o=B(t+"/fulfilled",(c,u,g,v)=>({payload:c,meta:{...(v||{}),arg:g,requestId:u,requestStatus:"fulfilled"}})),i=B(t+"/pending",(c,u,g)=>({payload:void 0,meta:{...(g||{}),arg:u,requestId:c,requestStatus:"pending"}})),s=B(t+"/rejected",(c,u,g,v,w)=>({payload:v,error:(n&&n.serializeError||dC)(c||"Rejected"),meta:{...(w||{}),arg:g,requestId:u,rejectedWithValue:!!v,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function a(c,{signal:u}={}){return(g,v,w)=>{let h=n?.idGenerator?n.idGenerator(c):ai(),y=new l.AbortController,S,x;function I(R){x=R,y.abort()}u&&(u.aborted?I(sm):u.addEventListener("abort",()=>I(sm),{once:!0}));let _=_asyncToGenerator(function*(){let R;try{let k=n?.condition?.(c,{getState:v,extra:w});if(fC(k)&&(k=yield k),k===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let F=new Promise((V,U)=>{S=()=>{U({name:"AbortError",message:x||"Aborted"})},y.signal.addEventListener("abort",S,{once:!0})});g(i(h,c,n?.getPendingMeta?.({requestId:h,arg:c},{getState:v,extra:w}))),R=yield Promise.race([F,Promise.resolve(r(c,{dispatch:g,getState:v,extra:w,requestId:h,signal:y.signal,abort:I,rejectWithValue:(V,U)=>new fl(V,U),fulfillWithValue:(V,U)=>new im(V,U)})).then(V=>{if(V instanceof fl)throw V;return V instanceof im?o(V.payload,h,c,V.meta):o(V,h,c)})])}catch(k){R=k instanceof fl?s(null,h,c,k.payload,k.meta):s(k,h,c)}finally{S&&y.signal.removeEventListener("abort",S)}return n&&!n.dispatchConditionRejection&&s.match(R)&&R.meta.condition||g(R),R})();return Object.assign(_,{abort:I,requestId:h,arg:c,unwrap(){return _.then(pC)}})}}return Object.assign(a,{pending:i,rejected:s,fulfilled:o,settled:Bt(s,o),typePrefix:t})}return e.withTypes=()=>e,e})();function pC(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function fC(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var mm=Symbol.for("rtk-slice-createasyncthunk"),oM={[mm]:Ce};function mC(e,t){return`${e}/${t}`}function gC({creators:e}={}){let t=e?.asyncThunk?.[mm];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(ut(11));typeof process<"u";let s=(typeof n.reducers=="function"?n.reducers(yC()):n.reducers)||{},a=Object.keys(s),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(R,T){let k=typeof R=="string"?R:R.type;if(!k)throw new Error(ut(12));if(k in c.sliceCaseReducersByType)throw new Error(ut(13));return c.sliceCaseReducersByType[k]=T,u},addMatcher(R,T){return c.sliceMatchers.push({matcher:R,reducer:T}),u},exposeAction(R,T){return c.actionCreators[R]=T,u},exposeCaseReducer(R,T){return c.sliceCaseReducersByName[R]=T,u}};a.forEach(R=>{let T=s[R],k={reducerName:R,type:mC(o,R),createNotation:typeof n.reducers=="function"};SC(T)?bC(k,T,u,t):vC(k,T,u)});function g(){let[R={},T=[],k=void 0]=typeof n.extraReducers=="function"?pm(n.extraReducers):[n.extraReducers],F={...R,...c.sliceCaseReducersByType};return Qe(n.initialState,V=>{for(let U in F)V.addCase(U,F[U]);for(let U of c.sliceMatchers)V.addMatcher(U.matcher,U.reducer);for(let U of T)V.addMatcher(U.matcher,U.reducer);k&&V.addDefaultCase(k)})}let v=R=>R,w=new Map,h=new WeakMap,y;function S(R,T){return y||(y=g()),y(R,T)}function x(){return y||(y=g()),y.getInitialState()}function I(R,T=!1){function k(V){let U=V[R];return typeof U>"u"&&T&&(U=Is(h,k,x)),U}function F(V=v){let U=Is(w,T,()=>new WeakMap);return Is(U,V,()=>{let L={};for(let[j,M]of Object.entries(n.selectors??{}))L[j]=hC(M,V,()=>Is(h,V,x),T);return L})}return{reducerPath:R,getSelectors:F,get selectors(){return F(k)},selectSlice:k}}let _={name:o,reducer:S,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:x,...I(i),injectInto(R,{reducerPath:T,...k}={}){let F=T??i;return R.inject({reducerPath:F,reducer:S},k),{..._,...I(F,!0)}}};return _}}function hC(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 Kr=gC();function yC(){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 vC({type:e,reducerName:t,createNotation:r},n,o){let i,s;if("reducer"in n){if(r&&!AC(n))throw new Error(ut(17));i=n.reducer,s=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?B(e,s):B(e))}function SC(e){return e._reducerDefinitionType==="asyncThunk"}function AC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function bC({type:e,reducerName:t},r,n,o){if(!o)throw new Error(ut(18));let{payloadCreator:i,fulfilled:s,pending:a,rejected:c,settled:u,options:g}=r,v=o(e,i,g);n.exposeAction(t,v),s&&n.addCase(v.fulfilled,s),a&&n.addCase(v.pending,a),c&&n.addCase(v.rejected,c),u&&n.addMatcher(v.settled,u),n.exposeCaseReducer(t,{fulfilled:s||Rs,pending:a||Rs,rejected:c||Rs,settled:u||Rs})}function Rs(){}var wC="task",gm="listener",hm="completed",hl="cancelled",CC=`task-${hl}`,xC=`task-${hm}`,ml=`${gm}-${hl}`,EC=`${gm}-${hm}`,Ns=class{constructor(e){oe(this,"code");oe(this,"name","TaskAbortError");oe(this,"message");this.code=e,this.message=`${wC} ${hl} (reason: ${e})`}},yl=(e,t)=>{if(typeof e!="function")throw new TypeError(ut(32))},Ts=()=>{},ym=(e,t=Ts)=>(e.catch(t),e),vm=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),zr=e=>{if(e.aborted)throw new Ns(e.reason)};function Sm(e,t){let r=Ts;return new Promise((n,o)=>{let i=()=>o(new Ns(e.reason));if(e.aborted){i();return}r=vm(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=Ts})}var IC=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof Ns?"cancelled":"rejected",error:r}}finally{t?.()}});return function IC(_x5,_x6){return _ref5.apply(this,arguments)}}(),ks=e=>t=>ym(Sm(e,t).then(r=>(zr(e),r))),Am=e=>{let t=ks(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Bn}=Object,am={},Fs="listenerMiddleware",RC=(e,t)=>{let r=n=>vm(e,()=>n.abort(e.reason));return(n,o)=>{yl(n,"taskExecutor");let i=new l.AbortController;r(i);let s=IC(/*#__PURE__*/_asyncToGenerator(function*(){zr(e),zr(i.signal);let a=yield n({pause:ks(i.signal),delay:Am(i.signal),signal:i.signal});return zr(i.signal),a}),()=>i.abort(xC));return o?.autoJoin&&t.push(s.catch(Ts)),{result:ks(e)(s),cancel(){i.abort(CC)}}}},TC=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){zr(t);let i=()=>{},a=[new Promise((c,u)=>{let g=e({predicate:n,effect:(v,w)=>{w.unsubscribe(),c([v,w.getState(),w.getOriginalState()])}});i=()=>{g(),u()}})];o!=null&&a.push(new Promise(c=>setTimeout(c,o,null)));try{let c=yield Sm(t,Promise.race(a));return zr(t),c}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>ym(r(n,o))},bm=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=B(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(ut(21));return yl(i,"options.listener"),{predicate:o,type:t,effect:i}},wm=Bn(e=>{let{type:t,predicate:r,effect:n}=bm(e);return{id:ai(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(ut(22))}}},{withTypes:()=>wm}),cm=(e,t)=>{let{type:r,effect:n,predicate:o}=bm(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},gl=e=>{e.pending.forEach(t=>{t.abort(ml)})},kC=(e,t)=>()=>{for(let r of t.keys())gl(r);e.clear()},um=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Cm=Bn(B(`${Fs}/add`),{withTypes:()=>Cm}),_C=B(`${Fs}/removeAll`),xm=Bn(B(`${Fs}/remove`),{withTypes:()=>xm}),OC=(...e)=>{console.error(`${Fs}/error`,...e)},Em=(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=OC}=e;yl(s,"onError");let a=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&gl(h)}),c=h=>{let y=cm(t,h)??wm(h);return a(y)};Bn(c,{withTypes:()=>c});let u=h=>{let y=cm(t,h);return y&&(y.unsubscribe(),h.cancelActive&&gl(y)),!!y};Bn(u,{withTypes:()=>u});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,S,x){let I=new l.AbortController,_=TC(c,I.signal),R=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(y,Bn({},S,{getOriginalState:x,condition:(T,k)=>_(T,k).then(Boolean),take:_,delay:Am(I.signal),pause:ks(I.signal),extra:i,signal:I.signal,fork:RC(I.signal,R),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((T,k,F)=>{T!==I&&(T.abort(ml),F.delete(T))})},cancel:()=>{I.abort(ml),h.pending.delete(I)},throwIfCancelled:()=>{zr(I.signal)}})))}catch(T){T instanceof Ns||um(s,T,{raisedBy:"effect"})}finally{yield Promise.all(R),I.abort(EC),o(h),h.pending.delete(I)}});return function g(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),v=kC(t,r);return{middleware:h=>y=>S=>{if(!$o(S))return y(S);if(Cm.match(S))return c(S.payload);if(_C.match(S)){v();return}if(xm.match(S))return u(S.payload);let x=h.getState(),I=()=>{if(x===am)throw new Error(ut(23));return x},_;try{if(_=y(S),t.size>0){let R=h.getState(),T=Array.from(t.values());for(let k of T){let F=!1;try{F=k.predicate(S,R,x)}catch(V){F=!1,um(s,V,{raisedBy:"predicate"})}F&&g(k,S,h,I)}}}finally{x=am}return _},startListening:c,stopListening:u,clearListeners:v}};function ut(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}),He=new re({required:!1,emptyAllowed:!1}),Dt=new re({required:!0,emptyAllowed:!0}),hM=new re({required:!1,emptyAllowed:!0}),Im=new Ft({each:ee,required:!0}),Rm=new re({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Tm=new re({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),yM=new re({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),PC=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),vl=(e,t)=>{if("required"in t)return{payload:new Nt({value:t}).validate({value:e}).value};let o=new xe({options:{required:!0},values:t}).validate(e);if(o)throw new Hu(o);return{payload:e}},W=(e,t)=>{try{return vl(e,t)}catch(r){return{payload:e,error:PC(r)}}};var Ds=(e,t,r,n)=>{let o=`Check the options of ${n}`;return NC(e,t,r,o,"Controller initialization error")},NC=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};var Ms=B("caseAssistConfiguration/set",e=>W(e,{caseAssistId:ee,locale:He,proxyBaseUrl:new re({required:!1,url:!0})}));m();d();f();p();m();d();f();p();var km=()=>({caseAssistId:"",locale:"en-US"});var vr=Qe(km(),e=>{e.addCase(Ms,(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 _m={q:new re,enableQuerySyntax:new je,aq:new re,cq:new re,firstResult:new Le({min:0}),numberOfResults:new Le({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 je,sf:new xe,tab:new re,af:new xe};var Ls=B("searchParameters/restore",e=>W(e,_m)),Om=B("searchParameters/restoreTab",e=>W(e,ee));m();d();f();p();var Pm=B("debug/enable"),Nm=B("debug/disable");m();d();f();p();var js=()=>!1;var Fm=Qe(js(),e=>{e.addCase(Pm,()=>!0).addCase(Nm,()=>!1).addCase(Ls,(t,r)=>r.payload.debug??t)});m();d();f();p();var qs=B("searchHub/set",e=>W(e,new re({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var Qn="3.55.4",Dm=["@coveo/atomic","@coveo/quantic"];var Sl=()=>He,Mm=()=>ee,Hn=B("configuration/updateBasicConfiguration",e=>W(e,{accessToken:He,environment:new re({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:He})),Us=B("configuration/updateSearchConfiguration",e=>W(e,{proxyBaseUrl:new re({required:!1,url:!0}),pipeline:new re({required:!1,emptyAllowed:!0}),searchHub:He,timezone:He,locale:He,authenticationProviders:new Ft({required:!1,each:ee})})),FC={enabled:new je({default:!0}),originContext:Sl(),originLevel2:Sl(),originLevel3:Sl(),proxyBaseUrl:new re({required:!1,url:!0}),runtimeEnvironment:new Vr,anonymous:new je({default:!1}),deviceId:He,userDisplayName:He,documentLocation:He,trackingId:Tm,analyticsMode:new re({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new xe({options:{required:!1},values:Dm.reduce((e,t)=>(e[t]=Rm,e),{})})},Vs=B("configuration/updateAnalyticsConfiguration",e=>W(e,FC)),Bs=B("configuration/analytics/disable"),Gs=B("configuration/analytics/enable"),Lm=B("configuration/analytics/originlevel2",e=>W(e,{originLevel2:Mm()})),jm=B("configuration/analytics/originlevel3",e=>W(e,{originLevel3:Mm()})),qm=B("knowledge/setAgentId",e=>W(e,new re({required:!0})));m();d();f();p();var DC=B("history/undo"),MC=B("history/redo"),Gt=B("history/snapshot"),zL=Ce("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(DC()),yield t($s())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),WL=Ce("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(MC()),yield t($s())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),$s=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 zn=()=>"default";var Um=Qe(zn(),e=>{e.addCase(qs,(t,r)=>r.payload).addCase($s.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Us,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function Vm(){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 Bm=/^(?:[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 LC(e){return typeof e=="string"&&Bm.test(e)}var Al=LC;m();d();f();p();var Je=[];for(let e=0;e<256;++e)Je.push((e+256).toString(16).slice(1));function Gm(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 jC=new Uint8Array(16);function bl(){return crypto.getRandomValues(jC)}m();d();f();p();function qC(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():UC(e,t,r)}function UC(e,t,r){e=e||{};let n=e.random??e.rng?.()??bl();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 Gm(n)}var wl=qC;function VC(_x17){return _VC.apply(this,arguments)}function _VC(){_VC=_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 _VC.apply(this,arguments)}var Km="2.1.3",Cl=128,Ym=192,$m=224,Qm=240,BC=248;function GC(e){return(e&BC)===Qm?4:(e&Qm)===$m?3:(e&$m)===Ym?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&Cl)!=Cl)break;if(r-=3,(n&Ym)!=Cl){t-r>=GC(n)*3&&(r=t);break}}return e.substring(0,r)}function QC(e){let{trackingId:t}=e;return{trackingId:t}}function HC(e){return(e.source||[]).concat([`relay@${Km}`])}function Xm(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,s=QC(t),a=r.getClientId();return Object.freeze({type:e,config:s,ts:Date.now(),source:HC(t),clientId:a,userAgent:i(),referrer:Hm(n()),location:Hm(o())})}function Hm(e){return e!==null?$C(e,1024):null}function zC(e,t,r,n){return{...t,meta:Xm(e,r,n)}}var WC="*";function KC(){let e=[];function t({type:c,callback:u}){return e.findIndex(g=>g.type===c&&g.callback===u)}function r(c,u){return c.type==="*"||u===c.type}function n(c){return t(c)<0&&e.push(c),()=>a(c.type,c.callback)}function o(c){e.forEach(u=>{if(r(u,c.meta.type))try{u.callback(c)}catch(g){console.error(g)}})}function i(c){if(c===WC)e.length=0;else for(let u=e.length-1;u>=0;u--)e[u].type===c&&e.splice(u,1)}function s(c){let u=t(c);u>=0&&e.splice(u,1)}function a(c,u){u?s({type:c,callback:u}):i(c)}return{add:n,call:o,remove:a}}function zm({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 YC(e){let t=zm(e);return{get:()=>t,update:r=>{t=zm({...t,...r})}}}var xl=XC();function XC(){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 ZC(){return{getItem(e){return xl.getItem(e)||localStorage.getItem(e)},removeItem(e){xl.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),xl.setItem(e,t,31556952e3)}}}var Wm="visitorId";function JC(){let e=document.referrer;return e===""?null:e}function El(){let e=ZC();return{runtime:"browser",send:function(){var _ref10=_asyncToGenerator(function*(t,r,n){let o=C(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});Vm().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 c of a.events)if(!c.accepted)throw new Error(`Received event was rejected for processing: ${c.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(Wm);if(t&&Al(t))return t;let r=wl();return e.setItem(Wm,r),r}}}function ex(){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 tx(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function rx(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=tx();return t&&r?{...r,runtime:"custom"}:t&&nx()&&ex()?El():n}function nx(){try{return typeof window=="object"}catch{return!1}}function ox(e){return{get:()=>Object.freeze(rx(e))}}function Zm(e){let t=YC(e),r=KC(),n=ox(t);return{emit:function(){var _ref11=_asyncToGenerator(function*(o,i){let s=t.get(),a=n.get(),c=zC(o,i,s,a);return VC({config:s,environment:a,event:c,listenerManager:r})});return function emit(_x21,_x22){return _ref11.apply(this,arguments)}}(),getMeta:o=>Xm(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:Km}}m();d();f();p();function Jm(){return typeof window<"u"&&typeof document<"u"}m();d();f();p();var Wn=Ue(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Qn}`));var ci=Ue(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Wn(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},s,a)=>{let c=sx(a);return Zm({mode:i?"emit":"disabled",url:o??os(e,t),token:r,trackingId:n??null,source:s,environment:c})}),ix={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref12=_asyncToGenerator(function*(){});return function send(){return _ref12.apply(this,arguments)}}()},sx=e=>{if(!e)return;let t=e();return{...(Jm()?El():ix),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 eg=class extends Error{constructor(t){super(t[0].message);oe(this,"issues");this.name="SchemaError",this.issues=t}};var ar="uninitialized",Tl="pending",li="fulfilled",di="rejected";function tg(e){return{status:e,isUninitialized:e===ar,isLoading:e===Tl,isSuccess:e===li,isError:e===di}}var rg=Vt;function hg(e,t){if(e===t||!(rg(e)&&rg(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]=hg(e[s],t[s]),o&&(o=e[s]===i[s]);return o?e:i}function kl(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function ax(e){return new RegExp("(^|:)//").test(e)}function cx(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Nl(e){return e!=null}function ng(e){return[...(e?.values()??[])].filter(Nl)}function ux(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var lx=e=>e.replace(/\/$/,""),dx=e=>e.replace(/^\//,"");function px(e,t){if(!e)return t;if(!t)return e;if(ax(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=lx(e),t=dx(t),`${e}${r}${t}`}function zs(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var _l=()=>new Map,fx=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},mx=(...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},og=(...e)=>C(...e),gx=e=>e.status>=200&&e.status<=299,hx=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function ig(e){if(!Vt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var yx=e=>typeof e=="object"&&(Vt(e)||Array.isArray(e)||typeof e.toJSON=="function");function yg({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=og,paramsSerializer:n,isJsonContentType:o=hx,jsonContentType:i="application/json",jsonReplacer:s,timeout:a,responseHandler:c,validateStatus:u,...g}={}){return typeof C>"u"&&r===og&&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*(w,h,y){let{getState:S,extra:x,endpoint:I,forced:_,type:R}=h,T,{url:k,headers:F=new E(g.headers),params:V=void 0,responseHandler:U=c??"json",validateStatus:L=u??gx,timeout:j=a,...M}=typeof w=="string"?{url:w}:w,O={...g,signal:j?mx(h.signal,fx(j)):h.signal,...M};F=new E(ig(F)),O.headers=(yield t(F,{getState:S,arg:w,extra:x,endpoint:I,forced:_,type:R,extraOptions:y}))||F;let P=yx(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")||(U==="json"?O.headers.set("accept","application/json"):U==="text"&&O.headers.set("accept","text/plain, text/html, */*")),V){let J=~k.indexOf("?")?"&":"?",se=n?n(V):new URLSearchParams(ig(V));k+=J+se}k=px(e,k);let N=new Request(k,O);T={request:new Request(k,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:T}}let Y=$.clone();T.response=Y;let K,H="";try{let J;if(yield Promise.all([v($,U).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:T}}return L($,K)?{data:K,meta:T}:{error:{status:$.status,data:K},meta:T}});return function(_x23,_x24,_x25){return _ref13.apply(this,arguments)}}());function v(_x26,_x27){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(w,h){if(typeof h=="function")return h(w);if(h==="content-type"&&(h=o(w.headers)?"json":"text"),h==="json"){let y=yield w.text();return y.length?JSON.parse(y):null}return w.text()});return _v2.apply(this,arguments)}}var Kn=class{constructor(e,t=void 0){oe(this,"value");oe(this,"meta");this.value=e,this.meta=t}};function vx(){return _vx.apply(this,arguments)}function _vx(){_vx=_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 c=()=>{clearTimeout(a),s(new Error("Aborted"))};r.aborted?(clearTimeout(a),s(new Error("Aborted"))):r.addEventListener("abort",c,{once:!0})}})});return _vx.apply(this,arguments)}function vg(e,t){throw Object.assign(new Kn({error:e,meta:t}),{throwImmediately:!0})}function Il(e){e.aborted&&vg({status:"CUSTOM_ERROR",error:"Aborted"})}var sg={},Sx=(e,t)=>(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(r,n,o){let i=[5,(t||sg).maxRetries,(o||sg).maxRetries].filter(g=>g!==void 0),[s]=i.slice(-1),c={maxRetries:s,backoff:vx,retryCondition:(g,v,{attempt:w})=>w<=s,...t,...o},u=0;for(;;){Il(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Kn(g);return g}catch(g){if(u++,g.throwImmediately){if(g instanceof Kn)return g.value;throw g}if(g instanceof Kn){if(!c.retryCondition(g.value.error,r,{attempt:u,baseQueryApi:n,extraOptions:o}))return g.value}else if(u>c.maxRetries)return{error:g};Il(n.signal);try{yield c.backoff(u,c.maxRetries,n.signal)}catch(v){throw Il(n.signal),v}}}});return function(_x28,_x29,_x30){return _ref14.apply(this,arguments)}}()),Sg=Object.assign(Sx,{fail:vg}),Ks="__rtkq/",Ax="online",bx="offline";var Ag="focused";var Fl=B(`${Ks}${Ag}`),bg=B(`${Ks}un${Ag}`),Dl=B(`${Ks}${Ax}`),wg=B(`${Ks}${bx}`);var mi="query",Cg="mutation",xg="infinitequery";function Ys(e){return e.type===mi}function wx(e){return e.type===Cg}function Xs(e){return e.type===xg}function Ws(e){return Ys(e)||Xs(e)}function Ml(e,t,r,n,o,i){let s=Cx(e)?e(t,r,n,o):e;return s?kl(s,Nl,a=>i(Eg(a))):[]}function Cx(e){return typeof e=="function"}function Eg(e){return typeof e=="string"?{type:e}:e}function xx(e,t){return e.catch(t)}var Yn=(e,t)=>e.endpointDefinitions[t],pi=Symbol("forceQueryFn"),Ol=e=>typeof e[pi]=="function";function Ex({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:s}){let a=k=>s(k)?.runningQueries,c=k=>s(k)?.runningMutations,{unsubscribeQueryResult:u,removeMutationResult:g,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:_,buildInitiateInfiniteQuery:R,buildInitiateMutation:T,getRunningQueryThunk:w,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:S};function w(k,F){return V=>{let U=Yn(i,k),L=e({queryArgs:F,endpointDefinition:U,endpointName:k});return a(V)?.get(L)}}function h(k,F){return V=>c(V)?.get(F)}function y(){return k=>ng(a(k))}function S(){return k=>ng(c(k))}function x(k){}function I(k,F){let V=(U,{subscribe:L=!0,forceRefetch:j,subscriptionOptions:M,[pi]:O,...P}={})=>(N,Q)=>{let $=e({queryArgs:U,endpointDefinition:F,endpointName:k}),Y,K={...P,type:mi,subscribe:L,forceRefetch:j,subscriptionOptions:M,endpointName:k,originalArgs:U,queryCacheKey:$,[pi]:O};if(Ys(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[k].select(U),J=N(Y),se=H(Q());let{requestId:be,abort:Ne}=J,Ie=se.requestId!==be,ke=a(N)?.get($),_e=()=>H(Q()),pe=Object.assign(O?J.then(_e):Ie&&!ke?Promise.resolve(se):Promise.all([ke,J]).then(_e),{arg:U,requestId:be,subscriptionOptions:M,queryCacheKey:$,abort:Ne,unwrap(){return _asyncToGenerator(function*(){let de=yield pe;if(de.isError)throw de.error;return de.data})()},refetch:de=>N(V(U,{subscribe:!1,forceRefetch:!0,...de})),unsubscribe(){L&&N(u({queryCacheKey:$,requestId:be}))},updateSubscriptionOptions(de){pe.subscriptionOptions=de,N(v({endpointName:k,requestId:be,queryCacheKey:$,options:de}))}});if(!ke&&!Ie&&!O){let de=a(N);de.set($,pe),pe.then(()=>{de.delete($)})}return pe};return V}function _(k,F){return I(k,F)}function R(k,F){return I(k,F)}function T(k){return(F,{track:V=!0,fixedCacheKey:U}={})=>(L,j)=>{let M=n({type:"mutation",endpointName:k,originalArgs:F,track:V,fixedCacheKey:U}),O=L(M);let{requestId:P,abort:N,unwrap:Q}=O,$=xx(O.unwrap().then(J=>({data:J})),J=>({error:J})),Y=()=>{L(g({requestId:P,fixedCacheKey:U}))},K=Object.assign($,{arg:O.arg,requestId:P,abort:N,unwrap:Q,reset:Y}),H=c(L);return H.set(P,K),K.then(()=>{H.delete(P)}),U&&(H.set(U,K),K.then(()=>{H.get(U)===K&&H.delete(U)})),K}}}var Ig=class extends eg{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}},Yr=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function Xr(_x31,_x32,_x33,_x34){return _Xr.apply(this,arguments)}function _Xr(){_Xr=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new Ig(o.issues,t,r,n);return o.value});return _Xr.apply(this,arguments)}function ag(e){return e}var ui=(e={})=>({...e,[oi]:!0});function Ix({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:s,onSchemaFailure:a,catchSchemaFailure:c,skipSchemaValidation:u}){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=Ml(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 w(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===ar)return H;let J;if("data"in K)if(it(K.data)){let[se,be,Ne]=dl(K.data,P);H.patches.push(...be),H.inversePatches.push(...Ne),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,[pi]:()=>({data:P})})),S=(M,O)=>M.query&&M[O]?M[O]:ag,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=u}=H,be=M.type===mi;try{let Ne=ag,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},ke=be?M[pi]:void 0,_e,pe=/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(he,fe,Be,ze){if(fe==null&&he.pages.length)return Promise.resolve({data:he});let _t={queryArg:M.originalArgs,pageParam:fe},gt=yield de(_t),Ut=ze?v:w;return{data:{pages:Ut(he.pages,gt.data,Be),pageParams:Ut(he.pageParams,fe,Be)},meta:gt.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:Be,argSchema:ze,rawResponseSchema:_t,responseSchema:gt}=H;if(ze&&!Yr(se,"arg")&&(he=yield Xr(ze,he,"argSchema",{})),ke?fe=ke():H.query?(Ne=S(H,"transformResponse"),fe=yield t(H.query(he),Ie,Be)):fe=yield H.queryFn(he,Ie,Be,Ot=>t(Ot,Ie,Be)),typeof process<"u",fe.error)throw new Kn(fe.error,fe.meta);let{data:Ut}=fe;_t&&!Yr(se,"rawResponse")&&(Ut=yield Xr(_t,fe.data,"rawResponseSchema",fe.meta));let bt=yield Ne(Ut,fe.meta,he);return gt&&!Yr(se,"response")&&(bt=yield Xr(gt,bt,"responseSchema",fe.meta)),{...fe,data:bt}});return _de.apply(this,arguments)}if(be&&"infiniteQueryOptions"in H){let{infiniteQueryOptions:he}=H,{maxPages:fe=1/0}=he,Be=M.refetchCachedPages??he.refetchCachedPages??!0,ze,_t={pages:[],pageParams:[]},gt=s.selectQueryEntry(Y(),M.queryCacheKey)?.data,bt=I(M,Y())&&!M.direction||!gt?_t:gt;if("direction"in M&&M.direction&&bt.pages.length){let Ot=M.direction==="backward",Yi=(Ot?Rg:Pl)(he,bt,M.originalArgs);ze=yield pe(bt,Yi,fe,Ot)}else{let{initialPageParam:Ot=he.initialPageParam}=M,Do=gt?.pageParams??[],Yi=Do[0]??Ot,ob=Do.length;if(ze=yield pe(bt,Yi,fe),ke&&(ze={data:ze.data.pages[0]}),Be)for(let Hp=1;Hp<ob;Hp++){let ib=Pl(he,ze.data,M.originalArgs);ze=yield pe(ze.data,ib,fe)}}_e=ze}else _e=yield de(M.originalArgs);return J&&!Yr(se,"meta")&&_e.meta&&(_e.meta=yield Xr(J,_e.meta,"metaSchema",_e.meta)),Q(_e.data,ui({fulfilledTimeStamp:Date.now(),baseQueryMeta:_e.meta}))}catch(Ne){let Ie=Ne;if(Ie instanceof Kn){let ke=S(H,"transformErrorResponse"),{rawErrorResponseSchema:_e,errorResponseSchema:pe}=H,{value:de,meta:he}=Ie;try{_e&&!Yr(se,"rawErrorResponse")&&(de=yield Xr(_e,de,"rawErrorResponseSchema",he)),J&&!Yr(se,"meta")&&(he=yield Xr(J,he,"metaSchema",he));let fe=yield ke(de,he,M.originalArgs);return pe&&!Yr(se,"errorResponse")&&(fe=yield Xr(pe,fe,"errorResponseSchema",he)),N(fe,ui({baseQueryMeta:he}))}catch(fe){Ie=fe}}try{if(Ie instanceof Ig){let ke={endpoint:M.endpointName,arg:M.originalArgs,type:M.type,queryCacheKey:be?M.queryCacheKey:void 0};H.onSchemaFailure?.(Ie,ke),a?.(Ie,ke);let{catchSchemaFailure:_e=c}=H;if(_e)return N(_e(Ie,ke),ui({baseQueryMeta:Ie._bqMeta}))}}catch(ke){Ie=ke}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 _=()=>Ce(`${e}/executeQuery`,x,{getPendingMeta({arg:O}){let P=r[O.endpointName];return ui({startedTimeStamp:Date.now(),...(Xs(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 Ol(O)?!0:Q?.status==="pending"?!1:I(O,N)||Ys(H)&&H?.forceRefetch?.({currentArg:Y,previousArg:K,endpointState:Q,state:N})?!0:!($&&!J)},dispatchConditionRejection:!0}),R=_(),T=_(),k=Ce(`${e}/executeMutation`,x,{getPendingMeta(){return ui({startedTimeStamp:Date.now()})}}),F=M=>"force"in M,V=M=>"ifOlderThan"in M,U=(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 j(M,O){return{matchPending:Gn(Os(M),L(O)),matchFulfilled:Gn(ir(M),L(O)),matchRejected:Gn(Wr(M),L(O))}}return{queryThunk:R,mutationThunk:k,infiniteQueryThunk:T,prefetch:U,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:j}}function Pl(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function Rg(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function Tg(e,t,r,n){return Ml(r[e.meta.arg.endpointName][t],ir(e)?e.payload:void 0,si(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function cg(e){return ct(e)?xs(e):e}function Qs(e,t,r){let n=e[t];n&&r(n)}function fi(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function ug(e,t,r){let n=e[fi(t)];n&&r(n)}var Hs={};function Rx({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:s,hasRehydrationInfo:a},assertTagType:c,config:u}){let g=B(`${e}/resetApiState`);function v(L,j,M,O){var P;L[P=j.queryCacheKey]??(L[P]={status:ar,endpointName:j.endpointName}),Qs(L,j.queryCacheKey,N=>{N.status=Tl,N.requestId=M&&N.requestId?N.requestId:O.requestId,j.originalArgs!==void 0&&(N.originalArgs=j.originalArgs),N.startedTimeStamp=O.startedTimeStamp;let Q=o[O.arg.endpointName];Xs(Q)&&"direction"in j&&(N.direction=j.direction)})}function w(L,j,M,O){Qs(L,j.arg.queryCacheKey,P=>{if(P.requestId!==j.requestId&&!O)return;let{merge:N}=o[j.arg.endpointName];if(P.status=li,N){if(P.data!==void 0){let{fulfilledTimeStamp:Q,arg:$,baseQueryMeta:Y,requestId:K}=j,H=Hr(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[j.arg.endpointName].structuralSharing??!0?hg(ct(P.data)?Gf(P.data):P.data,M):M;delete P.error,P.fulfilledTimeStamp=j.fulfilledTimeStamp})}let h=Kr({name:`${e}/queries`,initialState:Hs,reducers:{removeQueryResult:{reducer(L,{payload:{queryCacheKey:j}}){delete L[j]},prepare:$n()},cacheEntriesUpserted:{reducer(L,j){for(let M of j.payload){let{queryDescription:O,value:P}=M;v(L,O,!0,{arg:O,requestId:j.meta.requestId,startedTimeStamp:j.meta.timestamp}),w(L,{arg:O,requestId:j.meta.requestId,fulfilledTimeStamp:j.meta.timestamp,baseQueryMeta:{}},P,!0)}},prepare:L=>({payload:L.map(O=>{let{endpointName:P,arg:N,value:Q}=O,$=o[P];return{queryDescription:{type:mi,endpointName:P,originalArgs:O.arg,queryCacheKey:n({queryArgs:N,endpointDefinition:$,endpointName:P})},value:Q}}),meta:{[oi]:!0,requestId:ai(),timestamp:Date.now()}})},queryResultPatched:{reducer(L,{payload:{queryCacheKey:j,patches:M}}){Qs(L,j,O=>{O.data=pl(O.data,M.concat())})},prepare:$n()}},extraReducers(L){L.addCase(t.pending,(j,{meta:M,meta:{arg:O}})=>{let P=Ol(O);v(j,O,P,M)}).addCase(t.fulfilled,(j,{meta:M,payload:O})=>{let P=Ol(M.arg);w(j,M,O,P)}).addCase(t.rejected,(j,{meta:{condition:M,arg:O,requestId:P},error:N,payload:Q})=>{Qs(j,O.queryCacheKey,$=>{if(!M){if($.requestId!==P)return;$.status=di,$.error=Q??N}})}).addMatcher(a,(j,M)=>{let{queries:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===li||N?.status===di)&&(j[P]=N)})}}),y=Kr({name:`${e}/mutations`,initialState:Hs,reducers:{removeMutationResult:{reducer(L,{payload:j}){let M=fi(j);M in L&&delete L[M]},prepare:$n()}},extraReducers(L){L.addCase(r.pending,(j,{meta:M,meta:{requestId:O,arg:P,startedTimeStamp:N}})=>{P.track&&(j[fi(M)]={requestId:O,status:Tl,endpointName:P.endpointName,startedTimeStamp:N})}).addCase(r.fulfilled,(j,{payload:M,meta:O})=>{O.arg.track&&ug(j,O,P=>{P.requestId===O.requestId&&(P.status=li,P.data=M,P.fulfilledTimeStamp=O.fulfilledTimeStamp)})}).addCase(r.rejected,(j,{payload:M,error:O,meta:P})=>{P.arg.track&&ug(j,P,N=>{N.requestId===P.requestId&&(N.status=di,N.error=M??O)})}).addMatcher(a,(j,M)=>{let{mutations:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===li||N?.status===di)&&P!==N?.requestId&&(j[P]=N)})}}),S={tags:{},keys:{}},x=Kr({name:`${e}/invalidation`,initialState:S,reducers:{updateProvidedBy:{reducer(L,j){var M,O,P;for(let{queryCacheKey:N,providedTags:Q}of j.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:$n()}},extraReducers(L){L.addCase(h.actions.removeQueryResult,(j,{payload:{queryCacheKey:M}})=>{I(j,M)}).addMatcher(a,(j,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=j.tags)[$]??(P[$]={}))[Q=K||"__internal_without_id"]??(N[Q]=[]);for(let se of H)J.includes(se)||J.push(se),j.keys[se]=O.keys[se]}}).addMatcher(Bt(ir(t),si(t)),(j,M)=>{_(j,[M])}).addMatcher(h.actions.cacheEntriesUpserted.match,(j,M)=>{let O=M.payload.map(({queryDescription:P,value:N})=>({type:"UNKNOWN",payload:N,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:P}}));_(j,O)})}});function I(L,j){let M=cg(L.keys[j]??[]);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]=cg(Q).filter($=>$!==j))}delete L.keys[j]}function _(L,j){let M=j.map(O=>{let P=Tg(O,"providesTags",o,c),{queryCacheKey:N}=O.meta.arg;return{queryCacheKey:N,providedTags:P}});x.caseReducers.updateProvidedBy(L,x.actions.updateProvidedBy(M))}let R=Kr({name:`${e}/subscriptions`,initialState:Hs,reducers:{updateSubscriptionOptions(L,j){},unsubscribeQueryResult(L,j){},internal_getRTKQSubscriptions(){}}}),T=Kr({name:`${e}/internalSubscriptions`,initialState:Hs,reducers:{subscriptionsUpdated:{reducer(L,j){return pl(L,j.payload)},prepare:$n()}}}),k=Kr({name:`${e}/config`,initialState:{online:ux(),focused:cx(),middlewareRegistered:!1,...u},reducers:{middlewareRegistered(L,{payload:j}){L.middlewareRegistered=L.middlewareRegistered==="conflict"||i!==j?"conflict":!0}},extraReducers:L=>{L.addCase(Dl,j=>{j.online=!0}).addCase(wg,j=>{j.online=!1}).addCase(Fl,j=>{j.focused=!0}).addCase(bg,j=>{j.focused=!1}).addMatcher(a,j=>({...j}))}}),F=qn({queries:h.reducer,mutations:y.reducer,provided:x.reducer,subscriptions:T.reducer,config:k.reducer}),V=(L,j)=>F(g.match(j)?void 0:L,j),U={...k.actions,...h.actions,...R.actions,...T.actions,...y.actions,...x.actions,resetApiState:g};return{reducer:V,actions:U}}var Rl=Symbol.for("RTKQ/skipToken"),kg={status:ar},lg=Hr(kg,()=>{}),dg=Hr(kg,()=>{});function Tx({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=R=>lg,o=R=>dg;return{buildQuerySelector:w,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:S,selectCachedArgsForQuery:x,selectApiState:s,selectQueries:a,selectMutations:u,selectQueryEntry:c,selectConfig:g};function i(R){return{...R,...tg(R.status)}}function s(R){return R[t]}function a(R){return s(R)?.queries}function c(R,T){return a(R)?.[T]}function u(R){return s(R)?.mutations}function g(R){return s(R)?.config}function v(R,T,k){return F=>{if(F===Rl)return r(n,k);let V=e({queryArgs:F,endpointDefinition:T,endpointName:R});return r(L=>c(L,V)??lg,k)}}function w(R,T){return v(R,T,i)}function h(R,T){let{infiniteQueryOptions:k}=T;function F(V){let U={...V,...tg(V.status)},{isLoading:L,isError:j,direction:M}=U,O=M==="forward",P=M==="backward";return{...U,hasNextPage:I(k,U.data,U.originalArgs),hasPreviousPage:_(k,U.data,U.originalArgs),isFetchingNextPage:L&&O,isFetchingPreviousPage:L&&P,isFetchNextPageError:j&&O,isFetchPreviousPageError:j&&P}}return v(R,T,F)}function y(){return R=>{let T;return typeof R=="object"?T=fi(R)??Rl:T=R,r(T===Rl?o:V=>s(V)?.mutations?.[T]??dg,i)}}function S(R,T){let k=R[t],F=new Set,V=kl(T,Nl,Eg);for(let U of V){let L=k.provided.tags[U.type];if(!L)continue;let j=(U.id!==void 0?L[U.id]:Object.values(L).flat())??[];for(let M of j)F.add(M)}return Array.from(F.values()).flatMap(U=>{let L=k.queries[U];return L?{queryCacheKey:U,endpointName:L.endpointName,originalArgs:L.originalArgs}:[]})}function x(R,T){return kl(Object.values(a(R)),k=>k?.endpointName===T&&k.status!==ar,k=>k.originalArgs)}function I(R,T,k){return T?Pl(R,T,k)!=null:!1}function _(R,T,k){return!T||!R.getPreviousPageParam?!1:Rg(R,T,k)!=null}}var pg=WeakMap?new WeakMap:void 0,fg=({endpointName:e,queryArgs:t})=>{let r="",n=pg?.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=Vt(s)?Object.keys(s).sort().reduce((a,c)=>(a[c]=s[c],a),{}):s,s));Vt(t)&&pg?.set(t,o),r=o}return`${e}(${r})`};function kx(...e){return function(r){let n=ri(u=>r.extractRehydrationInfo?.(u,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(u){let g=fg;if("serializeQueryArgs"in u.endpointDefinition){let v=u.endpointDefinition.serializeQueryArgs;g=w=>{let h=v(w);return typeof h=="string"?h:fg({...w,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(u)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(u){u()},apiUid:ai(),extractRehydrationInfo:n,hasRehydrationInfo:ri(u=>n(u)!=null)},s={injectEndpoints:c,enhanceEndpoints({addTagTypes:u,endpoints:g}){if(u)for(let v of u)o.tagTypes.includes(v)||o.tagTypes.push(v);if(g)for(let[v,w]of Object.entries(g))typeof w=="function"?w(Yn(i,v)):Object.assign(Yn(i,v)||{},w);return s}},a=e.map(u=>u.init(s,o,i));function c(u){let g=u.endpoints({query:v=>({...v,type:mi}),mutation:v=>({...v,type:Cg}),infiniteQuery:v=>({...v,type:xg})});for(let[v,w]of Object.entries(g)){if(u.overrideExisting!==!0&&v in i.endpointDefinitions){if(u.overrideExisting==="throw")throw new Error(ut(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[v]=w;for(let h of a)h.injectEndpoint(v,w)}return s}return s.injectEndpoints({endpoints:r.endpoints})}}function sr(e,...t){return Object.assign(e,...t)}var _x=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,i=null,s=null,{updateSubscriptionOptions:a,unsubscribeQueryResult:c}=e.internalActions,u=(S,x)=>{if(a.match(x)){let{queryCacheKey:_,requestId:R,options:T}=x.payload,k=S.get(_);return k?.has(R)&&k.set(R,T),!0}if(c.match(x)){let{queryCacheKey:_,requestId:R}=x.payload,T=S.get(_);return T&&T.delete(R),!0}if(e.internalActions.removeQueryResult.match(x))return S.delete(x.payload.queryCacheKey),!0;if(t.pending.match(x)){let{meta:{arg:_,requestId:R}}=x,T=zs(S,_.queryCacheKey,_l);return _.subscribe&&T.set(R,_.subscriptionOptions??T.get(R)??{}),!0}let I=!1;if(t.rejected.match(x)){let{meta:{condition:_,arg:R,requestId:T}}=x;if(_&&R.subscribe){let k=zs(S,R.queryCacheKey,_l);k.set(T,R.subscriptionOptions??k.get(T)??{}),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=u(r.currentSubscriptions,S),_=!0;if(I){s||(s=setTimeout(()=>{let k=y(r.currentSubscriptions),[,F]=dl(i,()=>k);x.next(e.internalActions.subscriptionsUpdated(F)),i=k,s=null},500));let R=typeof S.type=="string"&&!!S.type.startsWith(o),T=t.rejected.match(S)&&S.meta.condition&&!!S.meta.arg.subscribe;_=!R&&!T}return[_,!1]}},Ox=2147483647/1e3-1,Px=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:s},getRunningQueryThunk:a,mwApi:c})=>{let{removeQueryResult:u,unsubscribeQueryResult:g,cacheEntriesUpserted:v}=t.internalActions,w=Bt(g.match,r.fulfilled,r.rejected,v.match);function h(R){let T=o.currentSubscriptions.get(R);return T?T.size>0:!1}let y={};function S(R){for(let T of R.values())T?.abort?.()}let x=(R,T)=>{let k=T.getState(),F=s(k);if(w(R)){let V;if(v.match(R))V=R.payload.map(U=>U.queryDescription.queryCacheKey);else{let{queryCacheKey:U}=g.match(R)?R.payload:R.meta.arg;V=[U]}I(V,T,F)}if(t.util.resetApiState.match(R)){for(let[V,U]of Object.entries(y))U&&clearTimeout(U),delete y[V];S(o.runningQueries),S(o.runningMutations)}if(n.hasRehydrationInfo(R)){let{queries:V}=n.extractRehydrationInfo(R);I(Object.keys(V),T,F)}};function I(R,T,k){let F=T.getState();for(let V of R){let U=i(F,V);U?.endpointName&&_(V,U.endpointName,T,k)}}function _(R,T,k,F){let U=Yn(n,T)?.keepUnusedDataFor??F.keepUnusedDataFor;if(U===1/0)return;let L=Math.max(0,Math.min(U,Ox));if(!h(R)){let j=y[R];j&&clearTimeout(j),y[R]=setTimeout(()=>{if(!h(R)){let M=i(k.getState(),R);M?.endpointName&&k.dispatch(a(M.endpointName,M.originalArgs))?.abort(),k.dispatch(u({queryCacheKey:R}))}delete y[R]},L*1e3)}}return x},mg=new Error("Promise never resolved before cacheEntryRemoved."),Nx=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:s,selectApiState:a}})=>{let c=Ps(n),u=Ps(o),g=ir(n,o),v={},{removeQueryResult:w,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function S(k,F,V){let U=v[k];U?.valueResolved&&(U.valueResolved({data:F,meta:V}),delete U.valueResolved)}function x(k){let F=v[k];F&&(delete v[k],F.cacheEntryRemoved())}function I(k){let{arg:F,requestId:V}=k.meta,{endpointName:U,originalArgs:L}=F;return[U,L,V]}let _=(k,F,V)=>{let U=R(k);function L(j,M,O,P){let N=s(V,M),Q=s(F.getState(),M);!N&&Q&&T(j,P,M,F,O)}if(n.pending.match(k)){let[j,M,O]=I(k);L(j,U,O,M)}else if(y.match(k))for(let{queryDescription:j,value:M}of k.payload){let{endpointName:O,originalArgs:P,queryCacheKey:N}=j;L(O,N,k.meta.requestId,P),S(N,M,{})}else if(o.pending.match(k)){if(F.getState()[t].mutations[U]){let[M,O,P]=I(k);T(M,O,U,F,P)}}else if(g(k))S(U,k.payload,k.meta.baseQueryMeta);else if(w.match(k)||h.match(k))x(U);else if(e.util.resetApiState.match(k))for(let j of Object.keys(v))x(j)};function R(k){return c(k)?k.meta.arg.queryCacheKey:u(k)?k.meta.arg.fixedCacheKey??k.meta.requestId:w.match(k)?k.payload.queryCacheKey:h.match(k)?fi(k.payload):""}function T(k,F,V,U,L){let j=Yn(r,k),M=j?.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 mg})]);N.catch(()=>{}),v[V]=O;let Q=e.endpoints[k].select(Ws(j)?F:V),$=U.dispatch((H,J,se)=>se),Y={...U,getCacheEntry:()=>Q(U.getState()),requestId:L,extra:$,updateCachedData:Ws(j)?H=>U.dispatch(e.util.updateQueryData(k,F,H)):void 0,cacheDataLoaded:N,cacheEntryRemoved:P},K=M(F,Y);Promise.resolve(K).catch(H=>{if(H!==mg)throw H})}return _},Fx=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},Dx=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:s,refetchQuery:a,internalState:c})=>{let{removeQueryResult:u}=i.internalActions,g=Bt(ir(n),si(n)),v=Bt(ir(o,n),Wr(o,n)),w=[],h=0,y=(I,_)=>{(o.pending.match(I)||n.pending.match(I))&&h++,v(I)&&(h=Math.max(0,h-1)),g(I)?x(Tg(I,"invalidatesTags",r,s),_):v(I)?x([],_):i.util.invalidateTags.match(I)&&x(Ml(I.payload,void 0,void 0,void 0,void 0,s),_)};function S(){return h>0}function x(I,_){let R=_.getState(),T=R[e];if(w.push(...I),T.config.invalidationBehavior==="delayed"&&S())return;let k=w;if(w=[],k.length===0)return;let F=i.util.selectInvalidatedBy(R,k);t.batch(()=>{let V=Array.from(F.values());for(let{queryCacheKey:U}of V){let L=T.queries[U],j=zs(c.currentSubscriptions,U,_l);L&&(j.size===0?_.dispatch(u({queryCacheKey:U})):L.status!==ar&&_.dispatch(a(L)))}})}return y},Mx=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:s}=o,a=new Set,c=null,u=(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(),c&&(clearTimeout(c),c=null),a.clear())};function g(x,I){a.add(x),c||(c=setTimeout(()=>{for(let _ of a)w({queryCacheKey:_},I);a.clear(),c=null},0))}function v({queryCacheKey:x},I){let _=I.getState()[e],R=_.queries[x],T=s.get(x);if(!R||R.status===ar)return;let{lowestPollingInterval:k,skipPollingIfUnfocused:F}=S(T);if(!Number.isFinite(k))return;let V=i.get(x);V?.timeout&&(clearTimeout(V.timeout),V.timeout=void 0);let U=Date.now()+k;i.set(x,{nextPollTimestamp:U,pollingInterval:k,timeout:setTimeout(()=>{(_.config.focused||!F)&&I.dispatch(n(R)),v({queryCacheKey:x},I)},k)})}function w({queryCacheKey:x},I){let R=I.getState()[e].queries[x],T=s.get(x);if(!R||R.status===ar)return;let{lowestPollingInterval:k}=S(T);if(!Number.isFinite(k)){h(x);return}let F=i.get(x),V=Date.now()+k;(!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,_=Number.POSITIVE_INFINITY;for(let R of x.values())R.pollingInterval&&(_=Math.min(R.pollingInterval,_),I=R.skipPollingIfUnfocused||I);return{lowestPollingInterval:_,skipPollingIfUnfocused:I}}return u},Lx=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=Os(r,n),i=Wr(r,n),s=ir(r,n),a={};return(u,g)=>{if(o(u)){let{requestId:v,arg:{endpointName:w,originalArgs:h}}=u.meta,y=Yn(t,w),S=y?.onQueryStarted;if(S){let x={},I=new Promise((k,F)=>{x.resolve=k,x.reject=F});I.catch(()=>{}),a[v]=x;let _=e.endpoints[w].select(Ws(y)?h:v),R=g.dispatch((k,F,V)=>V),T={...g,getCacheEntry:()=>_(g.getState()),requestId:v,extra:R,updateCachedData:Ws(y)?k=>g.dispatch(e.util.updateQueryData(w,h,k)):void 0,queryFulfilled:I};S(h,T)}}else if(s(u)){let{requestId:v,baseQueryMeta:w}=u.meta;a[v]?.resolve({data:u.payload,meta:w}),delete a[v]}else if(i(u)){let{requestId:v,rejectedWithValue:w,baseQueryMeta:h}=u.meta;a[v]?.reject({error:u.payload??u.error,isUnhandledError:!w,meta:h}),delete a[v]}}},jx=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,s=(c,u)=>{Fl.match(c)&&a(u,"refetchOnFocus"),Dl.match(c)&&a(u,"refetchOnReconnect")};function a(c,u){let g=c.getState()[e],v=g.queries,w=o.currentSubscriptions;t.batch(()=>{for(let h of w.keys()){let y=v[h],S=w.get(h);if(!S||!y)continue;let x=[...S.values()];(x.some(_=>_[u]===!0)||x.every(_=>_[u]===void 0)&&g.config[u])&&(S.size===0?c.dispatch(i({queryCacheKey:h})):y.status!==ar&&c.dispatch(n(y)))}})}return s};function qx(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:s}=o,a={invalidateTags:B(`${t}/invalidateTags`)},c=w=>w.type.startsWith(`${t}/`),u=[Fx,Px,Dx,Mx,Nx,Lx];return{middleware:w=>{let h=!1,y=i(w.dispatch),S={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:c,mwApi:w},x=u.map(R=>R(S)),I=_x(S),_=jx(S);return R=>T=>{if(!$o(T))return R(T);h||(h=!0,w.dispatch(n.internalActions.middlewareRegistered(s)));let k={...w,next:R},F=w.getState(),[V,U]=I(T,k,F),L;if(V?L=R(T):L=U,w.getState()[t]&&(_(T,k,F),c(T)||o.hasRehydrationInfo(T)))for(let j of x)j(T,k,F);return L}},actions:a};function v(w){return e.api.endpoints[w.endpointName].initiate(w.originalArgs,{subscribe:!1,forceRefetch:!0})}}var gg=Symbol(),Ux=({createSelector:e=Ue}={})=>({name:gg,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:s,refetchOnMountOrArgChange:a,refetchOnFocus:c,refetchOnReconnect:u,invalidationBehavior:g,onSchemaFailure:v,catchSchemaFailure:w,skipSchemaValidation:h},y){Yf();let S=pe=>(typeof process<"u",pe);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:Dl,onOffline:wg,onFocus:Fl,onFocusLost:bg},util:{}});let x=Tx({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:_,buildQuerySelector:R,buildInfiniteQuerySelector:T,buildMutationSelector:k}=x;sr(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:_});let{queryThunk:F,infiniteQueryThunk:V,mutationThunk:U,patchQueryData:L,updateQueryData:j,upsertQueryData:M,prefetch:O,buildMatchThunkActions:P}=Ix({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:S,selectors:x,onSchemaFailure:v,catchSchemaFailure:w,skipSchemaValidation:h}),{reducer:N,actions:Q}=Rx({context:y,queryThunk:F,infiniteQueryThunk:V,mutationThunk:U,serializeQueryArgs:i,reducerPath:o,assertTagType:S,config:{refetchOnFocus:c,refetchOnReconnect:u,refetchOnMountOrArgChange:a,keepUnusedDataFor:s,reducerPath:o,invalidationBehavior:g}});sr(t.util,{patchQueryData:L,updateQueryData:j,upsertQueryData:M,prefetch:O,resetApiState:Q.resetApiState,upsertQueryEntries:Q.cacheEntriesUpserted}),sr(t.internalActions,Q);let $=new WeakMap,Y=pe=>zs($,pe,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:K,buildInitiateInfiniteQuery:H,buildInitiateMutation:J,getRunningMutationThunk:se,getRunningMutationsThunk:be,getRunningQueriesThunk:Ne,getRunningQueryThunk:Ie}=Ex({queryThunk:F,mutationThunk:U,infiniteQueryThunk:V,api:t,serializeQueryArgs:i,context:y,getInternalState:Y});sr(t.util,{getRunningMutationThunk:se,getRunningMutationsThunk:be,getRunningQueryThunk:Ie,getRunningQueriesThunk:Ne});let{middleware:ke,actions:_e}=qx({reducerPath:o,context:y,queryThunk:F,mutationThunk:U,infiniteQueryThunk:V,api:t,assertTagType:S,selectors:x,getRunningQueryThunk:Ie,getInternalState:Y});return sr(t.util,_e),sr(t,{reducer:N,middleware:ke}),{name:gg,injectEndpoint(pe,de){var Be;let fe=(Be=t.endpoints)[pe]??(Be[pe]={});Ys(de)&&sr(fe,{name:pe,select:R(pe,de),initiate:K(pe,de)},P(F,pe)),wx(de)&&sr(fe,{name:pe,select:k(),initiate:J(pe)},P(U,pe)),Xs(de)&&sr(fe,{name:pe,select:T(pe,de),initiate:H(pe,de)},P(F,pe))}}}}),_g=kx(Ux());m();d();f();p();m();d();f();p();var Zr=e=>e.query,Og=e=>e.query?.enableQuerySyntax;var iU=Ue(e=>Zr(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})),Vx=Ue(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 cr(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{u(n.next(g))}catch(v){s(v)}}function c(g){try{u(n.throw(g))}catch(v){s(v)}}function u(g){g.done?i(g.value):o(g.value).then(a,c)}u((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 ql(){return typeof window<"u"}function Zl(){return typeof navigator<"u"}function Xn(){return typeof document<"u"}function Ul(){try{return typeof localStorage<"u"}catch{return!1}}function Bx(){try{return typeof sessionStorage<"u"}catch{return!1}}function $g(){return Zl()&&navigator.cookieEnabled}var Gx=[ve.click,ve.custom,ve.search,ve.view],$x=(e,t)=>Gx.indexOf(e)!==-1?Object.assign({language:Xn()?document.documentElement.lang:"unknown",userAgent:Zl()?navigator.userAgent:"unknown"},t):t,hi=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?Pg(t,r,i):(s=a.split("."),o=s[s.length-2]+"."+s[s.length-1],Pg(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 Pg(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function Qx(){return Ul()?localStorage:$g()?new yi:Bx()?sessionStorage:new Jn}var yi=class e{getItem(t){return hi.get(`${e.prefix}${t}`)}removeItem(t){hi.erase(`${e.prefix}${t}`)}setItem(t,r,n){hi.set(`${e.prefix}${t}`,r,n)}};yi.prefix="coveo_";var Vl=class{constructor(){this.cookieStorage=new yi}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)}},Jn=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Zs="__coveo.analytics.history",Hx=20,zx=1e3*60,Wx=75,ea=class{constructor(t){this.store=t||Qx()}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(Zs);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(Zs);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Zs,JSON.stringify(t.slice(0,Hx)))}catch{}}clear(){try{this.store.removeItem(Zs)}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,Wx)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>zx:!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 Kx=(e,t)=>q(void 0,void 0,void 0,function*(){return e===ve.view?(yield Yx(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),Yx=e=>q(void 0,void 0,void 0,function*(){let t=new ea,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),Xx=/^(?:[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 ta(e){return typeof e=="string"&&Xx.test(e)}function Ng(e){if(!ta(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var et=[];for(let e=0;e<256;++e)et.push((e+256).toString(16).slice(1));function Qg(e,t=0){return(et[e[t+0]]+et[e[t+1]]+et[e[t+2]]+et[e[t+3]]+"-"+et[e[t+4]]+et[e[t+5]]+"-"+et[e[t+6]]+et[e[t+7]]+"-"+et[e[t+8]]+et[e[t+9]]+"-"+et[e[t+10]]+et[e[t+11]]+et[e[t+12]]+et[e[t+13]]+et[e[t+14]]+et[e[t+15]]).toLowerCase()}var Zx=new Uint8Array(16);function Jx(){return crypto.getRandomValues(Zx)}function eE(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}var tE="6ba7b810-9dad-11d1-80b4-00c04fd430c8",rE="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function nE(e,t,r,n,o,i){let s=typeof r=="string"?eE(r):r,a=typeof n=="string"?Ng(n):n;if(typeof n=="string"&&(n=Ng(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+s.length);return c.set(a),c.set(s,a.length),c=t(c),c[6]=c[6]&15|e,c[8]=c[8]&63|128,Qg(c)}function Jr(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():oE(e,t,r)}function oE(e,t,r){e=e||{};let n=e.random??e.rng?.()??Jx();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 Qg(n)}function iE(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 Ll(e,t){return e<<t|e>>>32-t}function sE(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,i=Math.ceil(o/16),s=new Array(i);for(let a=0;a<i;++a){let c=new Uint32Array(16);for(let u=0;u<16;++u)c[u]=e[a*64+u*4]<<24|e[a*64+u*4+1]<<16|e[a*64+u*4+2]<<8|e[a*64+u*4+3];s[a]=c}s[i-1][14]=(e.length-1)*8/2**32,s[i-1][14]=Math.floor(s[i-1][14]),s[i-1][15]=(e.length-1)*8&4294967295;for(let a=0;a<i;++a){let c=new Uint32Array(80);for(let y=0;y<16;++y)c[y]=s[a][y];for(let y=16;y<80;++y)c[y]=Ll(c[y-3]^c[y-8]^c[y-14]^c[y-16],1);let u=r[0],g=r[1],v=r[2],w=r[3],h=r[4];for(let y=0;y<80;++y){let S=Math.floor(y/20),x=Ll(u,5)+iE(S,g,v,w)+h+t[S]+c[y]>>>0;h=w,w=v,v=Ll(g,30)>>>0,g=u,u=x}r[0]=r[0]+u>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+v>>>0,r[3]=r[3]+w>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function ra(e,t,r,n){return nE(80,sE,e,t)}ra.DNS=tE;ra.URL=rE;var Hg="2.33.0",Fg=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,gi={pageview:"pageview",event:"event"},na=class{constructor({client:t,uuidGenerator:r=Jr}){this.client=t,this.uuidGenerator=r}},Bl=class extends na{constructor({client:t,uuidGenerator:r=Jr}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=Fg(window.location),this.lastReferrer=Xn()?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:Xn()?document.title:"",encoding:Xn()?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===gi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===gi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===gi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===gi.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 Fg(window.location)}},Sr=class e{constructor(t,r){if(!ta(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 ta(i)?new e(i,Number.parseInt(o)*1e3):null}};Sr.cvo_cid="cvo_cid";Sr.expirationTime=120;var Gl=class extends na{constructor({client:t,uuidGenerator:r=Jr}){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(Sr.cvo_cid,new Sr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Gl.Id="link";var xt=Object.keys;function Js(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var jl=128,zg=192,Dg=224,Mg=240;function aE(e){return(e&248)===Mg?4:(e&Mg)===Dg?3:(e&Dg)===zg?2:1}function cE(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&jl)!=jl)break;if(r-=3,(n&zg)!=jl){t-r>=aE(n)*3&&(r=t);break}}return e.substring(0,r)}var $l={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"},uE=xt($l).map(e=>$l[e]),lE=[...uE].join("|"),dE=new RegExp(`^(${lE}$)`),pE={svcAction:"svc_action",svcActionData:"svc_action_data"},fE=e=>xt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=$l[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),mE=e=>dE.test(e),gE=[mE],Lg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},jg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},st={action:"pa",list:"pal",listSource:"pls"},oa={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},hE=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Ql={id:"quoteId",affiliation:"quoteAffiliation"},Hl={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},yE={add:st,bookmark_add:st,bookmark_remove:st,click:st,checkout:st,checkout_option:st,detail:st,impression:st,remove:st,refund:Object.assign(Object.assign({},st),oa),purchase:Object.assign(Object.assign({},st),oa),quickview:st,quote:Object.assign(Object.assign({},st),Ql),review:Object.assign(Object.assign({},st),Hl)},vE=xt(Lg).map(e=>Lg[e]),SE=xt(jg).map(e=>jg[e]),AE=xt(st).map(e=>st[e]),bE=xt(oa).map(e=>oa[e]),wE=xt(Hl).map(e=>Hl[e]),CE=xt(Ql).map(e=>Ql[e]),xE=[...vE,"custom"].join("|"),EE=[...SE,"custom"].join("|"),Wg="(pr[0-9]+)",Kg="(il[0-9]+pi[0-9]+)",IE=new RegExp(`^${Wg}(${xE})$`),RE=new RegExp(`^(${Kg}(${EE}))|(il[0-9]+nm)$`),TE=new RegExp(`^(${AE.join("|")})$`),kE=new RegExp(`^(${bE.join("|")})$`),_E=new RegExp(`^${Wg}custom$`),OE=new RegExp(`^${Kg}custom$`),PE=new RegExp(`^(${[...hE,...wE,...CE].join("|")})$`),NE=e=>IE.test(e),FE=e=>RE.test(e),DE=e=>TE.test(e),ME=e=>kE.test(e),LE=e=>PE.test(e),jE=[FE,NE,DE,ME,LE],qE=[_E,OE],UE={anonymizeIp:"aip"},VE={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},BE={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},GE=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],$E=Object.assign(Object.assign(Object.assign(Object.assign({},UE),VE),BE),GE.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),zl=Object.assign(Object.assign({},$E),pE),QE=e=>{let t=!!e.action&&yE[e.action]||{};return xt(e).reduce((r,n)=>{let o=t[n]||zl[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},HE=xt(zl).map(e=>zl[e]),zE=e=>HE.indexOf(e)!==-1,WE=e=>e==="custom",KE=e=>[...jE,...gE,zE,WE].some(t=>t(e)),YE=e=>xt(e).reduce((t,r)=>{let n=XE(r);return n?Object.assign(Object.assign({},t),ZE(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),XE=e=>{let t;return[...qE].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},ZE=(e,t)=>xt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),Wl=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),c=this.encodeForEventType(t,a),u=new Blob([c],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(s,u)})}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:c}=s;o=a||t;try{i=JSON.parse(c)}catch(u){console.error("Unable to process the request body as a JSON string",u)}}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}},Kl=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()})}},qg=b.fetch,ia=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)},c=Object.assign(Object.assign({},a),i?yield i(a,"analyticsFetch"):{}),{url:u}=c,g=cr(c,["url"]),v;try{v=yield qg(u,g)}catch(w){console.error("An error has occurred when sending the event.",w);return}if(v.ok){let w=yield v.json();return w.visitorId&&o.setCurrentVisitorId(w.visitorId),w}else{try{v.json()}catch{}throw console.error(`An error has occurred 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 qg(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"})}},Yl=class{constructor(t,r){Ul()&&$g()?this.storage=new Vl:Ul()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Jn),this.client=new ia(t),this.beaconClient=new Wl(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}},Xl=class{constructor(t,r){this.storage=r||new Jn,this.client=new ia(t)}getClientDependingOnEventType(t){return this.client}},sa=class{constructor(){this.storage=new Jn,this.client=new Kl}getClientDependingOnEventType(t){return this.client}},JE="xx",eI=e=>e?.startsWith(JE)||!1,tI=`
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
@@ -33,7 +33,7 @@ ${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":N
33
33
  `)}var Mi=function(e){_0(t,e);function t(r,n,o,i,s){var a=this.constructor,c=e.call(this,Zy(r,{name:n,index:o,operation:i,tree:s}))||this;return c.name=n,c.index=o,c.operation=i,c.tree=s,Object.setPrototypeOf(c,a.prototype),c.message=Zy(r,{name:n,index:o,operation:i,tree:s}),c}return t}(Error);var Ve=Mi,P0=nt,vo={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=Ya(r,this.path);n&&(n=nt(n));var o=An(r,{op:"remove",path:this.from}).removed;return An(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Ya(r,this.from);return An(r,{op:"add",path:this.path,value:nt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Li(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},N0={add:function(e,t,r){return Ka(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:vo.move,copy:vo.copy,test:vo.test,_get:vo._get};function Ya(e,t){if(t=="")return e;var r={op:"_get",path:t};return An(e,r),r.value}function An(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):Xa(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=Ya(e,t.from),t.op==="move"&&(s.removed=e),s;if(t.op==="test"){if(s.test=Li(e,t.value),s.test===!1)throw new Ve("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 Ve("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return s}}else{n||(e=nt(e));var a=t.path||"",c=a.split("/"),u=e,g=1,v=c.length,w=void 0,h=void 0,y=void 0;for(typeof r=="function"?y=r:y=Xa;;){if(h=c[g],h&&h.indexOf("~")!=-1&&(h=Di(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&c[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&&w===void 0&&(u[h]===void 0?w=c.slice(0,g).join("/"):g==v-1&&(w=t.path),w!==void 0&&y(t,0,e,w)),g++,Array.isArray(u)){if(h==="-")h=u.length;else{if(r&&!Ka(h))throw new Ve("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);Ka(h)&&(h=~~h)}if(g>=v){if(r&&t.op==="add"&&h>u.length)throw new Ve("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=N0[t.op].call(t,u,h,e);if(s.test===!1)throw new Ve("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}}else if(g>=v){var s=vo[t.op].call(t,u,h,e);if(s.test===!1)throw new Ve("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}if(u=u[h],r&&g<v&&(!u||typeof u!="object"))throw new Ve("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function Za(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new Ve("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=nt(e));for(var i=new Array(t.length),s=0,a=t.length;s<a;s++)i[s]=An(e,t[s],r,!0,o,s),e=i[s].newDocument;return i.newDocument=e,i}function F0(e,t,r){var n=An(e,t);if(n.test===!1)throw new Ve("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Xa(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Ve("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(vo[e.op]){if(typeof e.path!="string")throw new Ve("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Ve("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 Ve("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 Ve("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")&&Ha(e.value))throw new Ve("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 Ve("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 Ve("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=Jy([s],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new Ve("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Ve("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function Jy(e,t,r){try{if(!Array.isArray(e))throw new Ve("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Za(nt(t),nt(e),r||!0);else{r=r||Xa;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof Ve)return o;throw o}}function Li(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(!Li(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],!Li(e[s],t[s]))return!1;return!0}return e!==e&&t!==t}var Yd={};Xi(Yd,{compare:()=>B0,generate:()=>zd,observe:()=>V0,unobserve:()=>U0});m();d();f();p();var Wd=new WeakMap,D0=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),M0=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function L0(e){return Wd.get(e)}function j0(e,t){return e.observers.get(t)}function q0(e,t){e.observers.delete(t.callback)}function U0(e,t){t.unobserve()}function V0(e,t){var r=[],n,o=L0(e);if(!o)o=new D0(e),Wd.set(e,o);else{var i=j0(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=nt(e),t){n.callback=t,n.next=null;var s=function(){zd(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(){zd(n),clearTimeout(n.next),q0(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 M0(t,n)),n}function zd(e,t){t===void 0&&(t=!1);var r=Wd.get(e.object);Kd(r.value,e.object,e.patches,"",t),e.patches.length&&Za(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Kd(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=Wa(t),s=Wa(e),a=!1,c=!1,u=s.length-1;u>=0;u--){var g=s[u],v=e[g];if(za(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var w=t[g];typeof v=="object"&&v!=null&&typeof w=="object"&&w!=null&&Array.isArray(v)===Array.isArray(w)?Kd(v,w,r,n+"/"+Kt(g),o):v!==w&&(a=!0,o&&r.push({op:"test",path:n+"/"+Kt(g),value:nt(v)}),r.push({op:"replace",path:n+"/"+Kt(g),value:nt(w)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+Kt(g),value:nt(v)}),r.push({op:"remove",path:n+"/"+Kt(g)}),c=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),a=!0)}if(!(!c&&i.length==s.length))for(var u=0;u<i.length;u++){var g=i[u];!za(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+Kt(g),value:nt(t[g])})}}}function B0(e,t,r){r===void 0&&(r=!1);var n=[];return Kd(e,t,n,"",r),n}var Ja=Object.assign({},Hd,Yd,{JsonPatchError:Mi,deepClone:nt,escapePathComponent:Kt,unescapePathComponent:Di});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Xd=function(e,t){return Xd=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])},Xd(e,t)};function Yt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Xd(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function ev(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{u(n.next(g))}catch(v){s(v)}}function c(g){try{u(n.throw(g))}catch(v){s(v)}}function u(g){g.done?i(g.value):o(g.value).then(a,c)}u((n=n.apply(e,t||[])).next())})}function ec(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(u){return function(g){return c([u,g])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(r=0)),r;)try{if(n=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(g){u=[6,g],o=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function mr(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 So(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 Ao(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 bn(e){return this instanceof bn?(this.v=e,this):new bn(e)}function tv(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||c(h,S)})},y&&(o[h]=y(o[h])))}function c(h,y){try{u(n[h](y))}catch(S){w(i[0][3],S)}}function u(h){h.value instanceof bn?Promise.resolve(h.value.v).then(g,v):w(i[0][2],h)}function g(h){c("next",h)}function v(h){c("throw",h)}function w(h,y){h(y),i.shift(),i.length&&c(i[0][0],i[0][1])}}function rv(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 mr=="function"?mr(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,c){s=e[i](s),o(a,c,s.done,s.value)})}}function o(i,s,a,c){Promise.resolve(c).then(function(u){i({value:u,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 bo(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 tc=bo(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
35
  `):"",this.name="UnsubscriptionError",this.errors=r}});m();d();f();p();function ji(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var wo=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=mr(s),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(S){t={error:S}}finally{try{c&&!c.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 tc?S.errors:[S]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var w=mr(v),h=w.next();!h.done;h=w.next()){var y=h.value;try{nv(y)}catch(S){i=i??[],S instanceof tc?i=Ao(Ao([],So(i)),So(S.errors)):i.push(S)}}}catch(S){n={error:S}}finally{try{h&&!h.done&&(o=w.return)&&o.call(w)}finally{if(n)throw n.error}}}if(i)throw new tc(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)nv(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)&&ji(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&ji(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Zd=wo.EMPTY;function rc(e){return e instanceof wo||e&&"closed"in e&&Se(e.remove)&&Se(e.add)&&Se(e.unsubscribe)}function nv(e){Se(e)?e():e.unsubscribe()}m();d();f();p();var jt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var Co={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Co.delegate;return o?.setTimeout?o.setTimeout.apply(o,Ao([e,t],So(r))):setTimeout.apply(void 0,Ao([e,t],So(r)))},clearTimeout:function(e){var t=Co.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function nc(e){Co.setTimeout(function(){var t=jt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function qi(){}m();d();f();p();var ov=function(){return Jd("C",void 0,void 0)}();function iv(e){return Jd("E",void 0,e)}function sv(e){return Jd("N",e,void 0)}function Jd(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var wn=null;function xo(e){if(jt.useDeprecatedSynchronousErrorHandling){var t=!wn;if(t&&(wn={errorThrown:!1,error:null}),e(),t){var r=wn,n=r.errorThrown,o=r.error;if(wn=null,n)throw o}}else e()}function av(e){jt.useDeprecatedSynchronousErrorHandling&&wn&&(wn.errorThrown=!0,wn.error=e)}var Ui=function(e){Yt(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,rc(r)&&r.add(n)):n.destination=H0,n}return t.create=function(r,n,o){return new ic(r,n,o)},t.prototype.next=function(r){this.isStopped?tp(sv(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?tp(iv(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?tp(ov,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}(wo);var G0=Function.prototype.bind;function ep(e,t){return G0.call(e,t)}var $0=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){oc(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){oc(n)}else oc(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){oc(r)}},e}(),ic=function(e){Yt(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&&jt.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return i.unsubscribe()},s={next:r.next&&ep(r.next,a),error:r.error&&ep(r.error,a),complete:r.complete&&ep(r.complete,a)}):s=r}return i.destination=new $0(s),i}return t}(Ui);function oc(e){jt.useDeprecatedSynchronousErrorHandling?av(e):nc(e)}function Q0(e){throw e}function tp(e,t){var r=jt.onStoppedNotification;r&&Co.setTimeout(function(){return r(e,t)})}var H0={closed:!0,next:qi,error:Q0,complete:qi};m();d();f();p();var Eo=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function Io(e){return e}function sc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return rp(e)}function rp(e){return e.length===0?Io:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var De=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=W0(t)?t:new ic(t,r,n);return xo(function(){var s=o,a=s.operator,c=s.source;i.add(a?a.call(i,c):c?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=cv(r),new r(function(o,i){var s=new ic({next:function(a){try{t(a)}catch(c){i(c),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[Eo]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return rp(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=cv(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 cv(e){var t;return(t=e??jt.Promise)!==null&&t!==void 0?t:Promise}function z0(e){return e&&Se(e.next)&&Se(e.error)&&Se(e.complete)}function W0(e){return e&&e instanceof Ui||z0(e)&&rc(e)}m();d();f();p();function K0(e){return Se(e?.lift)}function Ge(e){return function(t){if(K0(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 We(e,t,r,n,o){return new Y0(e,t,r,n,o)}var Y0=function(e){Yt(t,e);function t(r,n,o,i,s,a){var c=e.call(this,r)||this;return c.onFinalize=s,c.shouldUnsubscribe=a,c._next=n?function(u){try{n(u)}catch(g){r.error(g)}}:e.prototype._next,c._error=i?function(u){try{i(u)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=o?function(){try{o()}catch(u){r.error(u)}finally{this.unsubscribe()}}:e.prototype._complete,c}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}(Ui);m();d();f();p();m();d();f();p();var uv=bo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Xt=function(e){Yt(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 lv(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new uv},t.prototype.next=function(r){var n=this;xo(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=mr(n.currentObservers),a=s.next();!a.done;a=s.next()){var c=a.value;c.next(r)}}catch(u){o={error:u}}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;xo(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;xo(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?Zd:(this.currentObservers=null,a.push(r),new wo(function(){n.currentObservers=null,ji(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 De;return r.source=this,r},t.create=function(r,n){return new lv(r,n)},t}(De);var lv=function(e){Yt(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:Zd},t}(Xt);m();d();f();p();m();d();f();p();var np={now:function(){return(np.delegate||Date).now()},delegate:void 0};var ac=function(e){Yt(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=np);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,c=n._windowTime;o||(i.push(r),!s&&i.push(a.now()+c)),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(),c=0;c<a.length&&!r.closed;c+=i?1:2)r.next(a[c]);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 c=o.now(),u=0,g=1;g<i.length&&i[g]<=c;g+=2)u=g;u&&i.splice(0,u+1)}},t}(Xt);m();d();f();p();var cc=new De(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function dv(e){return e&&Se(e.schedule)}function X0(e){return e[e.length-1]}function pv(e){return dv(X0(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 uc=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function lc(e){return Se(e?.then)}m();d();f();p();function dc(e){return Se(e[Eo])}m();d();f();p();function pc(e){return Symbol.asyncIterator&&Se(e?.[Symbol.asyncIterator])}m();d();f();p();function fc(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 Z0(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var mc=Z0();function gc(e){return Se(e?.[mc])}m();d();f();p();function hc(e){return tv(this,arguments,function(){var r,n,o,i;return ec(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,bn(r.read())];case 3:return n=s.sent(),o=n.value,i=n.done,i?[4,bn(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,bn(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 yc(e){return Se(e?.getReader)}function Ke(e){if(e instanceof De)return e;if(e!=null){if(dc(e))return J0(e);if(uc(e))return e_(e);if(lc(e))return t_(e);if(pc(e))return fv(e);if(gc(e))return r_(e);if(yc(e))return n_(e)}throw fc(e)}function J0(e){return new De(function(t){var r=e[Eo]();if(Se(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function e_(e){return new De(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function t_(e){return new De(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,nc)})}function r_(e){return new De(function(t){var r,n;try{for(var o=mr(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 fv(e){return new De(function(t){o_(e,t).catch(function(r){return t.error(r)})})}function n_(e){return fv(hc(e))}function o_(e,t){var r,n,o,i;return ev(this,void 0,void 0,function(){var s,a;return ec(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=rv(e),c.label=1;case 1:return[4,r.next()];case 2:if(n=c.sent(),!!n.done)return[3,4];if(s=n.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:c.sent(),c.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 Tt(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 vc(e,t){return t===void 0&&(t=0),Ge(function(r,n){r.subscribe(We(n,function(o){return Tt(n,e,function(){return n.next(o)},t)},function(){return Tt(n,e,function(){return n.complete()},t)},function(o){return Tt(n,e,function(){return n.error(o)},t)}))})}m();d();f();p();function Sc(e,t){return t===void 0&&(t=0),Ge(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function mv(e,t){return Ke(e).pipe(Sc(t),vc(t))}m();d();f();p();function gv(e,t){return Ke(e).pipe(Sc(t),vc(t))}m();d();f();p();function hv(e,t){return new De(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 yv(e,t){return new De(function(r){var n;return Tt(r,t,function(){n=e[mc](),Tt(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 Ac(e,t){if(!e)throw new Error("Iterable cannot be null");return new De(function(r){Tt(r,t,function(){var n=e[Symbol.asyncIterator]();Tt(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}m();d();f();p();function vv(e,t){return Ac(hc(e),t)}function Sv(e,t){if(e!=null){if(dc(e))return mv(e,t);if(uc(e))return hv(e,t);if(lc(e))return gv(e,t);if(pc(e))return Ac(e,t);if(gc(e))return yv(e,t);if(yc(e))return vv(e,t)}throw fc(e)}function Cn(e,t){return t?Sv(e,t):Ke(e)}function qe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=pv(e);return Cn(e,r)}m();d();f();p();function Me(e,t){var r=Se(e)?e:function(){return e},n=function(o){return o.error(r())};return new De(t?function(o){return t.schedule(n,0,o)}:n)}m();d();f();p();m();d();f();p();var Av=bo(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function bc(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 Av)}})})}m();d();f();p();function xn(e,t){return Ge(function(r,n){var o=0;r.subscribe(We(n,function(i){n.next(e.call(t,i,o++))}))})}m();d();f();p();m();d();f();p();m();d();f();p();function bv(e,t,r,n,o,i,s,a){var c=[],u=0,g=0,v=!1,w=function(){v&&!c.length&&!u&&t.complete()},h=function(S){return u<n?y(S):c.push(S)},y=function(S){i&&t.next(S),u++;var x=!1;Ke(r(S,g++)).subscribe(We(t,function(I){o?.(I),i?h(I):t.next(I)},function(){x=!0},void 0,function(){if(x)try{u--;for(var I=function(){var _=c.shift();s?Tt(t,s,function(){return y(_)}):y(_)};c.length&&u<n;)I();w()}catch(_){t.error(_)}}))};return e.subscribe(We(t,h,function(){v=!0,w()})),function(){a?.()}}function pt(e,t,r){return r===void 0&&(r=1/0),Se(t)?pt(function(n,o){return xn(function(i,s){return t(n,i,o,s)})(Ke(e(n,o)))},r):(typeof t=="number"&&(r=t),Ge(function(n,o){return bv(n,o,e,r)}))}function op(e){return e===void 0&&(e=1/0),pt(Io,e)}m();d();f();p();function wc(e){return new De(function(t){Ke(e()).subscribe(t)})}m();d();f();p();function Vi(e){return Ge(function(t,r){var n=null,o=!1,i;n=t.subscribe(We(r,void 0,void 0,function(s){i=Ke(e(s,Vi(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 Cc(e,t){return Se(t)?pt(e,t,1):pt(e,1)}m();d();f();p();function ip(e){return Ge(function(t,r){var n=!1;t.subscribe(We(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}m();d();f();p();function En(e){return Ge(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function sp(e,t){return Ge(function(r,n){var o=null,i=0,s=!1,a=function(){return s&&!o&&n.complete()};r.subscribe(We(n,function(c){o?.unsubscribe();var u=0,g=i++;Ke(e(c,g)).subscribe(o=We(n,function(v){return n.next(t?t(c,v,g,u++):v)},function(){o=null,a()}))},function(){s=!0,a()}))})}m();d();f();p();function xc(e){return Ge(function(t,r){Ke(e).subscribe(We(r,function(){return r.complete()},qi)),!r.closed&&t.subscribe(r)})}m();d();f();p();function ap(e,t,r){var n=Se(e)||t||r?{next:e,error:t,complete:r}:e;return n?Ge(function(o,i){var s;(s=n.subscribe)===null||s===void 0||s.call(n);var a=!0;o.subscribe(We(i,function(c){var u;(u=n.next)===null||u===void 0||u.call(n,c),i.next(c)},function(){var c;a=!1,(c=n.complete)===null||c===void 0||c.call(n),i.complete()},function(c){var u;a=!1,(u=n.error)===null||u===void 0||u.call(n,c),i.error(c)},function(){var c,u;a&&((c=n.unsubscribe)===null||c===void 0||c.call(n)),(u=n.finalize)===null||u===void 0||u.call(n)}))}):Io}m();d();f();p();m();d();f();p();function wv(e){return` \r
36
- `.indexOf(e)>=0}function Ec(e){for(var t=["topLevel"],r=0,n,o,i,s=function(_){return t.push(_)},a=function(_){return t[t.length-1]=_},c=function(_){n==null&&(n=r,o=t.length,i=_)},u=function(_){_===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},w=function(_){if("0"<=_&&_<="9"){s("number");return}switch(_){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":w(y);break;case"string":switch(y){case"\"":g();break;case"\\":c("stringEscape"),s("stringEscaped");break}break;case"stringEscaped":y==="u"?s("stringUnicode"):(u("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(u("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():wv(y)||(u("collectionItem"),a("arrayNeedsComma"),w(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(c("collectionItem"),a("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(c("collectionItem"),a("objectNeedsColon"),s("string"));break;case"objectNeedsColon":y===":"&&a("objectNeedsValue");break;case"objectNeedsValue":wv(y)||(u("collectionItem"),a("objectNeedsComma"),w(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(c("collectionItem"),a("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var S=[n!=null?e.slice(0,n):e],x=function(_){return S.push(_.slice(e.length-e.lastIndexOf(_[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 xv(){let e=this.buf,t=this.pos,r=0,n=0;for(let i=0;i<28;i+=7){let s=e[t++];if(r|=(s&127)<<i,(s&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}let o=e[t++];if(r|=(o&15)<<28,n=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}for(let i=3;i<=31;i+=7){let s=e[t++];if(n|=(s&127)<<i,(s&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}throw new Error("invalid varint")}var Ic=4294967296;function cp(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(s,a){let c=Number(e.slice(s,a));o*=r,n=n*r+c,n>=Ic&&(o=o+(n/Ic|0),n=n%Ic)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?Iv(n,o):lp(n,o)}function Ev(e,t){let r=lp(e,t),n=r.hi&2147483648;n&&(r=Iv(r.lo,r.hi));let o=up(r.lo,r.hi);return n?"-"+o:o}function up(e,t){if({lo:e,hi:t}=i_(e,t),t<=2097151)return String(Ic*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,c=1e7;return i>=c&&(s+=Math.floor(i/c),i%=c),s>=c&&(a+=Math.floor(s/c),s%=c),a.toString()+Cv(s)+Cv(i)}function i_(e,t){return{lo:e>>>0,hi:t>>>0}}function lp(e,t){return{lo:e|0,hi:t|0}}function Iv(e,t){return t=~t,e?e=~e+1:t+=1,lp(e,t)}var Cv=e=>{let t=String(e);return"0000000".slice(t.length)+t};function Rv(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)===0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();f();p();var qt=s_();function s_(){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||!!b.Bun||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()),Tv(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),kv(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),Tv(r),cp(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),kv(r),cp(r)},dec(r,n){return Ev(r,n)},uDec(r,n){return up(r,n)}}}function Tv(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function kv(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var dp=Symbol.for("@bufbuild/protobuf/text-encoding");function a_(e){var t;b[dp]=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:fp(e.encodeUtf8.bind(e))})}function pp(){let e=b;if(!e[dp]){let t=new e.TextEncoder,r=new e.TextDecoder,n,o={encodeUtf8(s){return t.encode(s)},decodeUtf8(s,a){return a?(n||(n=new e.TextDecoder("utf-8",{fatal:!0})),n.decode(s)):r.decode(s)},checkUtf8(s){try{return encodeURIComponent(s),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let i=String.prototype.isWellFormed;i&&(o.checkUtf8=s=>i.call(s)),a_(o)}return e[dp]}function fp(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var Or;(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"})(Or||(Or={}));var c_=34028234663852886e22,u_=-34028234663852886e22,l_=4294967295,d_=2147483647,p_=-2147483648,ge=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?fp(t):pp().encodeUtf8Into,this.buffer=Ov,this.viewCache=m_,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||f_;for(;n<r;)n*=2;let o=new Uint8Array(n);this.pos>0&&o.set(this.buffer),this.buffer=o}}view(){let t=this.buffer,r=this.viewCache;if(r.byteLength===t.byteLength)return r;let n=new DataView(t.buffer);return this.viewCache=n,n}finish(){let t=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],t}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(Bi),this.buffer[this.pos++]=0,this}join(){let t=this.stackPos.pop();if(t===void 0)throw new Error("invalid state, fork stack empty");let r=this.pos-t-Bi,n=mp(r);return n>Bi&&(this.ensureCapacity(n-Bi),this.buffer.copyWithin(t+n,t+Bi,this.pos)),this.pos=t,this.uint32(r),this.pos+=r,this}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if(_v(t),this.ensureCapacity(5),t<128)return this.buffer[this.pos++]=t,this;for(;t>127;)this.buffer[this.pos++]=t&127|128,t>>>=7;return this.buffer[this.pos++]=t,this}int32(t){if(gp(t),t>=0)return this.uint32(t);this.ensureCapacity(10);for(let r=0;r<9;r++)this.buffer[this.pos++]=t&127|128,t>>=7;return this.buffer[this.pos++]=1,this}bool(t){return this.ensureCapacity(1),this.buffer[this.pos++]=t?1:0,this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){typeof t!="string"&&(t=String(t));let r=t.length;if(r<=Pv){this.ensureCapacity(r+1);let c=this.buffer,u=this.pos;c[u++]=r;let g=0;for(;g<r;g++){let v=t.charCodeAt(g);if(v>127)break;c[u++]=v}if(g==r)return this.pos=u,this}this.ensureCapacity(r*3+5);let n=mp(r),o=this.buffer,i=this.pos,{written:s}=this.encodeUtf8Into(t,o.subarray(i+n)),a=mp(s);return a!=n&&o.copyWithin(i+a,i+n,i+n+s),this.uint32(s),this.pos+=s,this}float(t){return g_(t),this.ensureCapacity(4),this.view().setFloat32(this.pos,t,!0),this.pos+=4,this}double(t){return this.ensureCapacity(8),this.view().setFloat64(this.pos,t,!0),this.pos+=8,this}fixed32(t){return _v(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return gp(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return gp(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=qt.enc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}fixed64(t){let r=qt.uEnc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}int64(t){let r=qt.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=qt.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return this.writeVarint64(o,i)}uint64(t){let r=qt.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let a=0;a<28;a=a+7){let c=t>>>a,u=!(!(c>>>7)&&r==0);if(n[o++]=(u?c|128:c)&255,!u)return this.pos=o,this}let i=t>>>28&15|(r&7)<<4,s=r>>3!=0;if(n[o++]=(s?i|128:i)&255,!s)return this.pos=o,this;for(let a=3;a<31;a=a+7){let c=r>>>a,u=!!(c>>>7);if(n[o++]=(u?c|128:c)&255,!u)return this.pos=o,this}return n[o++]=r>>>31&1,this.pos=o,this}},f_=128,Bi=1,Ov=new Uint8Array(0),m_=new DataView(Ov.buffer),Pv=32;function mp(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var X=class{constructor(t,r=pp().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=xv,this.uint32=Rv,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,n=100){let o=this.pos;switch(t){case Or.Varint:for(;this.buf[this.pos++]&128;);break;case Or.Bit64:this.pos+=4;case Or.Bit32:this.pos+=4;break;case Or.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Or.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[s,a]=this.tag();if(a===Or.EndGroup){if(r!==void 0&&s!==r)throw new Error("invalid end group tag");break}this.skip(a,s,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return this.varint64(),qt.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),qt.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,r=this.varint64Hi,n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,qt.dec(t,r)}bool(){let t=this.buf[this.pos];return t<128?(this.pos++,t!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return qt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return qt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){let r=this.bytes(),n=r.length;if(n<=Pv){let o=new Array(n);for(let i=0;i<n;i++){let s=r[i];if(s>127)return this.decodeUtf8(r,t);o[i]=s}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(r,t)}};function gp(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>d_||e<p_)throw new Error("invalid int32: "+e)}function _v(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>l_||e<0)throw new Error("invalid uint32: "+e)}function g_(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>c_||e<u_))throw new Error("invalid float32: "+e)}var h_=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function hp(){return{fields:{}}}var Gi={encode(e,t=new ge){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&Sp.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=hp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let s=Sp.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 Gi.fromPartial(e??{})},fromPartial(e){let t=hp();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=hp();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 Nv(){return{key:"",value:void 0}}var Sp={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=Nv();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 Sp.fromPartial(e??{})},fromPartial(e){let t=Nv();return t.key=e.key??"",t.value=e.value??void 0,t}};function yp(){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&&Gi.encode(Gi.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&$i.encode($i.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=yp();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=Gi.unwrap(Gi.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=$i.unwrap($i.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=yp();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=yp();if(e===null)t.nullValue=h_.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 vp(){return{values:[]}}var $i={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=vp();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 $i.fromPartial(e??{})},fromPartial(e){let t=vp();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=vp();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&b.Array.isArray(e.values)?e.values:e}},y_=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 Fv(){return{op:0,path:"",from:void 0,value:void 0}}var Tc={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=Fv();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 Tc.fromPartial(e??{})},fromPartial(e){let t=Fv();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function Dv(){return{id:"",type:"",function:void 0}}var kc={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&&_c.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=Dv();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=_c.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.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?_c.fromPartial(e.function):void 0,t}};function Mv(){return{name:"",arguments:""}}var _c={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=Mv();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 _c.fromPartial(e??{})},fromPartial(e){let t=Mv();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function Lv(){return{value:"",mimeType:""}}var Oc={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=Lv();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 Oc.fromPartial(e??{})},fromPartial(e){let t=Lv();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function jv(){return{value:"",mimeType:void 0}}var Pc={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=jv();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 Pc.fromPartial(e??{})},fromPartial(e){let t=jv();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function qv(){return{data:void 0,url:void 0}}var At={encode(e,t=new ge){return e.data!==void 0&&Oc.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Pc.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=qv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=Oc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=Pc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return At.fromPartial(e??{})},fromPartial(e){let t=qv();return t.data=e.data!==void 0&&e.data!==null?Oc.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Pc.fromPartial(e.url):void 0,t}};function Uv(){return{text:""}}var Nc={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=Uv();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 Nc.fromPartial(e??{})},fromPartial(e){let t=Uv();return t.text=e.text??"",t}};function Vv(){return{source:void 0,metadata:void 0}}var Fc={encode(e,t=new ge){return e.source!==void 0&&At.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=Vv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.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 Fc.fromPartial(e??{})},fromPartial(e){let t=Vv();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Bv(){return{source:void 0,metadata:void 0}}var Dc={encode(e,t=new ge){return e.source!==void 0&&At.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=Bv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.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 Dc.fromPartial(e??{})},fromPartial(e){let t=Bv();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Gv(){return{source:void 0,metadata:void 0}}var Mc={encode(e,t=new ge){return e.source!==void 0&&At.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=Gv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.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 Mc.fromPartial(e??{})},fromPartial(e){let t=Gv();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function $v(){return{source:void 0,metadata:void 0}}var Lc={encode(e,t=new ge){return e.source!==void 0&&At.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=$v();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.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 Lc.fromPartial(e??{})},fromPartial(e){let t=$v();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Qv(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var jc={encode(e,t=new ge){return e.text!==void 0&&Nc.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Fc.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Dc.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Mc.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Lc.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=Qv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=Nc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=Fc.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=Dc.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=Mc.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=Lc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return jc.fromPartial(e??{})},fromPartial(e){let t=Qv();return t.text=e.text!==void 0&&e.text!==null?Nc.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Fc.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Dc.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Mc.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Lc.fromPartial(e.document):void 0,t}};function Hv(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var qc={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)kc.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)jc.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=Hv();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(kc.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(jc.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=Hv();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=>kc.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>jc.fromPartial(r))||[],t}};function zv(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0}}var Uc={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=zv();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 Uc.fromPartial(e??{})},fromPartial(e){let t=zv();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}},v_=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 Wv(){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=Wv();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=Ro(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=Wv();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function Kv(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var Vc={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=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.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 Vc.fromPartial(e??{})},fromPartial(e){let t=Kv();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 Yv(){return{baseEvent:void 0,messageId:"",delta:""}}var Bc={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=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.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 Bc.fromPartial(e??{})},fromPartial(e){let t=Yv();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 Xv(){return{baseEvent:void 0,messageId:""}}var Gc={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=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.messageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Gc.fromPartial(e??{})},fromPartial(e){let t=Xv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function Zv(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var $c={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=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.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 $c.fromPartial(e??{})},fromPartial(e){let t=Zv();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 Jv(){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=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.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=Jv();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 eS(){return{baseEvent:void 0,toolCallId:""}}var Hc={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=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.toolCallId=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=eS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function tS(){return{baseEvent:void 0,snapshot:void 0}}var zc={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=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.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 zc.fromPartial(e??{})},fromPartial(e){let t=tS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function rS(){return{baseEvent:void 0,delta:[]}}var Wc={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)Tc.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=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.delta.push(Tc.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=rS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>Tc.fromPartial(r))||[],t}};function nS(){return{baseEvent:void 0,messages:[]}}var Kc={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)qc.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=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.messages.push(qc.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=nS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>qc.fromPartial(r))||[],t}};function oS(){return{baseEvent:void 0,event:void 0,source:void 0}}var Yc={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=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.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 Yc.fromPartial(e??{})},fromPartial(e){let t=oS();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 iS(){return{baseEvent:void 0,name:"",value:void 0}}var Xc={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=iS();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 Xc.fromPartial(e??{})},fromPartial(e){let t=iS();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 sS(){return{baseEvent:void 0,threadId:"",runId:""}}var Zc={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=sS();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 Zc.fromPartial(e??{})},fromPartial(e){let t=sS();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 aS(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var In={encode(e,t=new ge){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=aS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.provider=r.string();continue;case 2:if(i!==18)break;o.model=r.string();continue;case 3:if(i!==24)break;o.inputTokens=Ro(r.int64());continue;case 4:if(i!==32)break;o.outputTokens=Ro(r.int64());continue;case 5:if(i!==40)break;o.totalTokens=Ro(r.int64());continue;case 6:if(i!==48)break;o.reasoningTokens=Ro(r.int64());continue;case 7:if(i!==56)break;o.cachedInputTokens=Ro(r.int64());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return In.fromPartial(e??{})},fromPartial(e){let t=aS();return t.provider=e.provider??void 0,t.model=e.model??void 0,t.inputTokens=e.inputTokens??void 0,t.outputTokens=e.outputTokens??void 0,t.totalTokens=e.totalTokens??void 0,t.reasoningTokens=e.reasoningTokens??void 0,t.cachedInputTokens=e.cachedInputTokens??void 0,t}};function cS(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var Jc={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)Uc.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)In.encode(r,t.uint32(58).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=cS();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(Uc.decode(r,r.uint32()));continue;case 7:if(i!==58)break;o.usage.push(In.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Jc.fromPartial(e??{})},fromPartial(e){let t=cS();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=>Uc.fromPartial(r))||[],t.usage=e.usage?.map(r=>In.fromPartial(r))||[],t}};function uS(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var eu={encode(e,t=new ge){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);for(let r of e.usage)In.encode(r,t.uint32(34).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=uS();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;case 4:if(i!==34)break;o.usage.push(In.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return eu.fromPartial(e??{})},fromPartial(e){let t=uS();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.usage=e.usage?.map(r=>In.fromPartial(r))||[],t}};function lS(){return{baseEvent:void 0,stepName:""}}var tu={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=lS();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 tu.fromPartial(e??{})},fromPartial(e){let t=lS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function dS(){return{baseEvent:void 0,stepName:""}}var ru={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=dS();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 ru.fromPartial(e??{})},fromPartial(e){let t=dS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function pS(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var nu={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=pS();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 nu.fromPartial(e??{})},fromPartial(e){let t=pS();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 fS(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var ou={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=fS();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 ou.fromPartial(e??{})},fromPartial(e){let t=fS();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 mS(){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 gS={encode(e,t=new ge){return e.textMessageStart!==void 0&&Vc.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Bc.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Gc.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&$c.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&&Hc.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&zc.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Wc.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Kc.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Yc.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Xc.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Zc.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Jc.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&eu.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&tu.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&ru.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&nu.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&ou.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=mS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=Vc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=Bc.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=Gc.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=$c.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=Hc.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=zc.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Wc.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=Kc.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Yc.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Xc.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Zc.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Jc.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=eu.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=tu.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=ru.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=nu.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=ou.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return gS.fromPartial(e??{})},fromPartial(e){let t=mS();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Vc.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Bc.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Gc.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?$c.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?Hc.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?zc.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Wc.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Kc.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Yc.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Xc.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Zc.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Jc.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?eu.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?tu.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?ru.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?nu.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?ou.fromPartial(e.toolCallChunk):void 0,t}};function Ro(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 hS=e=>e&&typeof e=="object"?e:void 0;var Rc=e=>{let t=hS(e);if(t){if(t.data){let r=t.data;return{type:"data",value:r.value,mimeType:r.mimeType}}if(t.url){let r=t.url;return{type:"url",value:r.value,mimeType:r.mimeType}}}},S_=e=>{let t=hS(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:Rc(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:Rc(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:Rc(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:Rc(r.source),metadata:r.metadata}}}};function yS(e){let t=gS.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=v_[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=>S_(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.RUN_FINISHED||r.type===D.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===D.STATE_DELTA)for(let n of r.delta)n.op=y_[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]}),Qa.parse(r)}var Ap="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var b_=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,bp=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(b_);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},vS=e=>e==="*"||e==="x"||e==="X",SS=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},w_=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],C_=(e,t)=>{if(vS(e)||vS(t))return 0;let[r,n]=w_(SS(e),SS(t));return r>n?1:r<n?-1:0},wp=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=C_(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Qi=(e,t)=>{let r=bp(e),n=bp(t),o=r.pop(),i=n.pop(),s=wp(r,n);return s!==0?s:o&&i?wp(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 Hi(){return Ir()}function Ep(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&Ep(t);return e}var AS=512*1024;function bS(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 c=0;c<a.length;c++){let u=a[c];if(n+=u.length,n>r)return!0;o.push(s[u])}}}}return!1}function Te(_x83,_x84,_x85,_x86){return _Te.apply(this,arguments)}function _Te(){_Te=_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&&!bS(t,r,AS),c=a?we(t):t,u=a?we(r):r,g=!1,v=!1,w;for(let h of e)try{a&&(Ep(c),Ep(u));let y=yield n(h,c,u);if(y===void 0)continue;let S=!1;if(y.messages!==void 0&&y.messages!==c&&(c=we(y.messages),g=!0,S=!0),y.state!==void 0&&y.state!==u&&(u=we(y.state),v=!0,S=!0),a&&S&&bS(c,u,AS)&&(a=!1),w=y.stopPropagation,w===!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(c)?we(c):c}:{}),...(v?{state:Object.isFrozen(u)?we(u):u}:{}),...(w===void 0?{}:{stopPropagation:w})}});return _Te.apply(this,arguments)}function iu(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 zi(e){if(e instanceof Ip)return e;if(e===!0)return new Ip(iu(!0))}var Ip=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 Cp(e){return e.enabled?new Ip(e):void 0}function x_(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 RS=(e,t,r,n,o)=>{let i=zi(o),s=we(r.messages),a=we(e.state),c={},u=v=>{v.messages!==void 0&&(s=v.messages,c.messages=v.messages),v.state!==void 0&&(a=v.state,c.state=v.state)},g=()=>{let v=we(c);return c={},v.messages!==void 0||v.state!==void 0?qe(v):cc};return t.pipe(Cc(/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(v){let w=yield Te(n,s,a,(h,y,S)=>h.onEvent?.({event:v,agent:r,input:e,messages:y,state:S}));if(u(w),w.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}),w.stopPropagation===!0)return g();switch(v.type){case D.TEXT_MESSAGE_START:{let h=yield Te(n,s,a,(y,S,x)=>y.onTextMessageStartEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(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),u({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 Te(n,s,a,(I,_,R)=>I.onTextMessageContentEvent?.({event:v,messages:_,state:R,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}));return u(x),x.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${y}`,u({messages:s})),g()}case D.TEXT_MESSAGE_END:{let{messageId:h}=v,y=s.find(S=>S.id===h);return y?(u(yield Te(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 Te(n,s,a,(y,S,x)=>y.onToolCallStartEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:S,parentMessageId:x}=v,I=s.find(R=>R.toolCalls?.some(T=>T.id===y))?.toolCalls?.find(R=>R.id===y);if(I)return I.function.name!==S&&(console.warn(`TOOL_CALL_START: tool call '${y}' already exists with name '${I.function.name}' \u2014 updating it to '${S}'`),I.function.name=S,u({messages:s})),g();let _=x_(s,x,y);_.toolCalls??(_.toolCalls=[]),_.toolCalls.push({id:y,type:"function",function:{name:S,arguments:""}}),u({messages:s})}return g()}case D.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=v,S=s.find(_=>_.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(_=>_.id===h);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=yield Te(n,s,a,(_,R,T)=>{let k=x.function.arguments,F=x.function.name,V={};try{V=Ec(k)}catch{}return _.onToolCallArgsEvent?.({event:v,messages:R,state:T,agent:r,input:e,toolCallBuffer:k,toolCallName:F,partialToolCallArgs:V})});return u(I),I.stopPropagation!==!0&&(x.function.arguments+=y,u({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?(u(yield Te(n,s,a,(x,I,_)=>{let R=S.function.arguments,T=S.function.name,k={};try{k=JSON.parse(R)}catch{}return x.onToolCallEndEvent?.({event:v,messages:I,state:_,agent:r,input:e,toolCallName:T,toolCallArgs:k})})),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 Te(n,s,a,(y,S,x)=>y.onToolCallResultEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:S,content:x,role:I}=v,_={id:y,toolCallId:S,role:I||"tool",content:x},R=s.findIndex(T=>T.role==="assistant"&&T.toolCalls?.some(k=>k.id===S));if(R===-1)s.push(_);else{let T=R+1;for(;T<s.length&&s[T].role==="tool";)T++;s.splice(T,0,_)}yield Promise.all(n.map(T=>{T.onNewMessage?.({message:_,messages:s,state:a,agent:r,input:e})})),u({messages:s})}return g()}case D.STATE_SNAPSHOT:{let h=yield Te(n,s,a,(y,S,x)=>y.onStateSnapshotEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{snapshot:y}=v;a=y,u({state:a})}return g()}case D.STATE_DELTA:{let h=yield Te(n,s,a,(y,S,x)=>y.onStateDeltaEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{delta:y}=v;try{a=Ja.applyPatch(a,y,!0,!1).newDocument,u({state:a})}catch(S){let x=S instanceof Error?S.message:String(S);console.warn(`Failed to apply state patch:
36
+ `.indexOf(e)>=0}function Ec(e){for(var t=["topLevel"],r=0,n,o,i,s=function(_){return t.push(_)},a=function(_){return t[t.length-1]=_},c=function(_){n==null&&(n=r,o=t.length,i=_)},u=function(_){_===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},w=function(_){if("0"<=_&&_<="9"){s("number");return}switch(_){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":w(y);break;case"string":switch(y){case"\"":g();break;case"\\":c("stringEscape"),s("stringEscaped");break}break;case"stringEscaped":y==="u"?s("stringUnicode"):(u("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(u("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():wv(y)||(u("collectionItem"),a("arrayNeedsComma"),w(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(c("collectionItem"),a("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(c("collectionItem"),a("objectNeedsColon"),s("string"));break;case"objectNeedsColon":y===":"&&a("objectNeedsValue");break;case"objectNeedsValue":wv(y)||(u("collectionItem"),a("objectNeedsComma"),w(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(c("collectionItem"),a("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var S=[n!=null?e.slice(0,n):e],x=function(_){return S.push(_.slice(e.length-e.lastIndexOf(_[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 xv(){let e=this.buf,t=this.pos,r=0,n=0;for(let i=0;i<28;i+=7){let s=e[t++];if(r|=(s&127)<<i,(s&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}let o=e[t++];if(r|=(o&15)<<28,n=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}for(let i=3;i<=31;i+=7){let s=e[t++];if(n|=(s&127)<<i,(s&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}throw new Error("invalid varint")}var Ic=4294967296;function cp(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(s,a){let c=Number(e.slice(s,a));o*=r,n=n*r+c,n>=Ic&&(o=o+(n/Ic|0),n=n%Ic)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?Iv(n,o):lp(n,o)}function Ev(e,t){let r=lp(e,t),n=r.hi&2147483648;n&&(r=Iv(r.lo,r.hi));let o=up(r.lo,r.hi);return n?"-"+o:o}function up(e,t){if({lo:e,hi:t}=i_(e,t),t<=2097151)return String(Ic*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,c=1e7;return i>=c&&(s+=Math.floor(i/c),i%=c),s>=c&&(a+=Math.floor(s/c),s%=c),a.toString()+Cv(s)+Cv(i)}function i_(e,t){return{lo:e>>>0,hi:t>>>0}}function lp(e,t){return{lo:e|0,hi:t|0}}function Iv(e,t){return t=~t,e?e=~e+1:t+=1,lp(e,t)}var Cv=e=>{let t=String(e);return"0000000".slice(t.length)+t};function Rv(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)===0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();f();p();var qt=s_();function s_(){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||!!b.Bun||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()),Tv(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),kv(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),Tv(r),cp(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),kv(r),cp(r)},dec(r,n){return Ev(r,n)},uDec(r,n){return up(r,n)}}}function Tv(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function kv(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var dp;function a_(e){var t;dp=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:fp(e.encodeUtf8.bind(e))})}function pp(){if(!dp){let e=b;if(!e.TextEncoder||!e.TextDecoder)throw new Error("encoding API missing: install TextEncoder and TextDecoder on globalThis");let t=new e.TextEncoder,r=new e.TextDecoder,n,o={encodeUtf8(s){return t.encode(s)},decodeUtf8(s,a){return a?(n||(n=new e.TextDecoder("utf-8",{fatal:!0})),n.decode(s)):r.decode(s)},checkUtf8(s){try{return encodeURIComponent(s),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let i=String.prototype.isWellFormed;i&&(o.checkUtf8=s=>i.call(s)),a_(o)}return dp}function fp(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var Or;(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"})(Or||(Or={}));var c_=34028234663852886e22,u_=-34028234663852886e22,l_=4294967295,d_=2147483647,p_=-2147483648,ge=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?fp(t):pp().encodeUtf8Into,this.buffer=Ov,this.viewCache=m_,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||f_;for(;n<r;)n*=2;let o=new Uint8Array(n);this.pos>0&&o.set(this.buffer),this.buffer=o}}view(){let t=this.buffer,r=this.viewCache;if(r.byteLength===t.byteLength)return r;let n=new DataView(t.buffer);return this.viewCache=n,n}finish(){let t=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],t}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(Bi),this.buffer[this.pos++]=0,this}join(){let t=this.stackPos.pop();if(t===void 0)throw new Error("invalid state, fork stack empty");let r=this.pos-t-Bi,n=mp(r);return n>Bi&&(this.ensureCapacity(n-Bi),this.buffer.copyWithin(t+n,t+Bi,this.pos)),this.pos=t,this.uint32(r),this.pos+=r,this}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if(_v(t),this.ensureCapacity(5),t<128)return this.buffer[this.pos++]=t,this;for(;t>127;)this.buffer[this.pos++]=t&127|128,t>>>=7;return this.buffer[this.pos++]=t,this}int32(t){if(gp(t),t>=0)return this.uint32(t);this.ensureCapacity(10);for(let r=0;r<9;r++)this.buffer[this.pos++]=t&127|128,t>>=7;return this.buffer[this.pos++]=1,this}bool(t){return this.ensureCapacity(1),this.buffer[this.pos++]=t?1:0,this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){typeof t!="string"&&(t=String(t));let r=t.length;if(r<=Pv){this.ensureCapacity(r+1);let c=this.buffer,u=this.pos;c[u++]=r;let g=0;for(;g<r;g++){let v=t.charCodeAt(g);if(v>127)break;c[u++]=v}if(g==r)return this.pos=u,this}this.ensureCapacity(r*3+5);let n=mp(r),o=this.buffer,i=this.pos,{written:s}=this.encodeUtf8Into(t,o.subarray(i+n)),a=mp(s);return a!=n&&o.copyWithin(i+a,i+n,i+n+s),this.uint32(s),this.pos+=s,this}float(t){return g_(t),this.ensureCapacity(4),this.view().setFloat32(this.pos,t,!0),this.pos+=4,this}double(t){return this.ensureCapacity(8),this.view().setFloat64(this.pos,t,!0),this.pos+=8,this}fixed32(t){return _v(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return gp(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return gp(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=qt.enc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}fixed64(t){let r=qt.uEnc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}int64(t){let r=qt.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=qt.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return this.writeVarint64(o,i)}uint64(t){let r=qt.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let a=0;a<28;a=a+7){let c=t>>>a,u=!(!(c>>>7)&&r==0);if(n[o++]=(u?c|128:c)&255,!u)return this.pos=o,this}let i=t>>>28&15|(r&7)<<4,s=r>>3!=0;if(n[o++]=(s?i|128:i)&255,!s)return this.pos=o,this;for(let a=3;a<31;a=a+7){let c=r>>>a,u=!!(c>>>7);if(n[o++]=(u?c|128:c)&255,!u)return this.pos=o,this}return n[o++]=r>>>31&1,this.pos=o,this}},f_=128,Bi=1,Ov=new Uint8Array(0),m_=new DataView(Ov.buffer),Pv=32;function mp(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var X=class{constructor(t,r=pp().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=xv,this.uint32=Rv,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,n=100){let o=this.pos;switch(t){case Or.Varint:for(;this.buf[this.pos++]&128;);break;case Or.Bit64:this.pos+=4;case Or.Bit32:this.pos+=4;break;case Or.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Or.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[s,a]=this.tag();if(a===Or.EndGroup){if(r!==void 0&&s!==r)throw new Error("invalid end group tag");break}this.skip(a,s,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return this.varint64(),qt.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),qt.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,r=this.varint64Hi,n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,qt.dec(t,r)}bool(){let t=this.buf[this.pos];return t<128?(this.pos++,t!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return qt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return qt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){let r=this.bytes(),n=r.length;if(n<=Pv){let o=new Array(n);for(let i=0;i<n;i++){let s=r[i];if(s>127)return this.decodeUtf8(r,t);o[i]=s}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(r,t)}};function gp(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>d_||e<p_)throw new Error("invalid int32: "+e)}function _v(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>l_||e<0)throw new Error("invalid uint32: "+e)}function g_(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>c_||e<u_))throw new Error("invalid float32: "+e)}var h_=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function hp(){return{fields:{}}}var Gi={encode(e,t=new ge){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&Sp.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=hp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let s=Sp.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 Gi.fromPartial(e??{})},fromPartial(e){let t=hp();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=hp();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 Nv(){return{key:"",value:void 0}}var Sp={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=Nv();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 Sp.fromPartial(e??{})},fromPartial(e){let t=Nv();return t.key=e.key??"",t.value=e.value??void 0,t}};function yp(){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&&Gi.encode(Gi.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&$i.encode($i.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=yp();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=Gi.unwrap(Gi.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=$i.unwrap($i.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=yp();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=yp();if(e===null)t.nullValue=h_.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 vp(){return{values:[]}}var $i={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=vp();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 $i.fromPartial(e??{})},fromPartial(e){let t=vp();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=vp();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&b.Array.isArray(e.values)?e.values:e}},y_=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 Fv(){return{op:0,path:"",from:void 0,value:void 0}}var Tc={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=Fv();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 Tc.fromPartial(e??{})},fromPartial(e){let t=Fv();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function Dv(){return{id:"",type:"",function:void 0}}var kc={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&&_c.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=Dv();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=_c.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.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?_c.fromPartial(e.function):void 0,t}};function Mv(){return{name:"",arguments:""}}var _c={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=Mv();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 _c.fromPartial(e??{})},fromPartial(e){let t=Mv();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function Lv(){return{value:"",mimeType:""}}var Oc={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=Lv();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 Oc.fromPartial(e??{})},fromPartial(e){let t=Lv();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function jv(){return{value:"",mimeType:void 0}}var Pc={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=jv();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 Pc.fromPartial(e??{})},fromPartial(e){let t=jv();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function qv(){return{data:void 0,url:void 0}}var At={encode(e,t=new ge){return e.data!==void 0&&Oc.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Pc.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=qv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=Oc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=Pc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return At.fromPartial(e??{})},fromPartial(e){let t=qv();return t.data=e.data!==void 0&&e.data!==null?Oc.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Pc.fromPartial(e.url):void 0,t}};function Uv(){return{text:""}}var Nc={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=Uv();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 Nc.fromPartial(e??{})},fromPartial(e){let t=Uv();return t.text=e.text??"",t}};function Vv(){return{source:void 0,metadata:void 0}}var Fc={encode(e,t=new ge){return e.source!==void 0&&At.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=Vv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.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 Fc.fromPartial(e??{})},fromPartial(e){let t=Vv();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Bv(){return{source:void 0,metadata:void 0}}var Dc={encode(e,t=new ge){return e.source!==void 0&&At.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=Bv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.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 Dc.fromPartial(e??{})},fromPartial(e){let t=Bv();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Gv(){return{source:void 0,metadata:void 0}}var Mc={encode(e,t=new ge){return e.source!==void 0&&At.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=Gv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.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 Mc.fromPartial(e??{})},fromPartial(e){let t=Gv();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function $v(){return{source:void 0,metadata:void 0}}var Lc={encode(e,t=new ge){return e.source!==void 0&&At.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=$v();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.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 Lc.fromPartial(e??{})},fromPartial(e){let t=$v();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Qv(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var jc={encode(e,t=new ge){return e.text!==void 0&&Nc.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Fc.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Dc.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Mc.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Lc.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=Qv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=Nc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=Fc.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=Dc.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=Mc.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=Lc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return jc.fromPartial(e??{})},fromPartial(e){let t=Qv();return t.text=e.text!==void 0&&e.text!==null?Nc.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Fc.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Dc.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Mc.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Lc.fromPartial(e.document):void 0,t}};function Hv(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var qc={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)kc.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)jc.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=Hv();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(kc.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(jc.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=Hv();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=>kc.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>jc.fromPartial(r))||[],t}};function zv(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0}}var Uc={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=zv();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 Uc.fromPartial(e??{})},fromPartial(e){let t=zv();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}},v_=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 Wv(){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=Wv();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=Ro(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=Wv();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function Kv(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var Vc={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=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.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 Vc.fromPartial(e??{})},fromPartial(e){let t=Kv();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 Yv(){return{baseEvent:void 0,messageId:"",delta:""}}var Bc={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=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.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 Bc.fromPartial(e??{})},fromPartial(e){let t=Yv();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 Xv(){return{baseEvent:void 0,messageId:""}}var Gc={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=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.messageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Gc.fromPartial(e??{})},fromPartial(e){let t=Xv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function Zv(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var $c={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=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.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 $c.fromPartial(e??{})},fromPartial(e){let t=Zv();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 Jv(){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=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.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=Jv();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 eS(){return{baseEvent:void 0,toolCallId:""}}var Hc={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=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.toolCallId=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=eS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function tS(){return{baseEvent:void 0,snapshot:void 0}}var zc={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=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.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 zc.fromPartial(e??{})},fromPartial(e){let t=tS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function rS(){return{baseEvent:void 0,delta:[]}}var Wc={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)Tc.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=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.delta.push(Tc.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=rS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>Tc.fromPartial(r))||[],t}};function nS(){return{baseEvent:void 0,messages:[]}}var Kc={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)qc.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=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.messages.push(qc.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=nS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>qc.fromPartial(r))||[],t}};function oS(){return{baseEvent:void 0,event:void 0,source:void 0}}var Yc={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=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.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 Yc.fromPartial(e??{})},fromPartial(e){let t=oS();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 iS(){return{baseEvent:void 0,name:"",value:void 0}}var Xc={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=iS();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 Xc.fromPartial(e??{})},fromPartial(e){let t=iS();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 sS(){return{baseEvent:void 0,threadId:"",runId:""}}var Zc={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=sS();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 Zc.fromPartial(e??{})},fromPartial(e){let t=sS();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 aS(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var In={encode(e,t=new ge){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=aS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.provider=r.string();continue;case 2:if(i!==18)break;o.model=r.string();continue;case 3:if(i!==24)break;o.inputTokens=Ro(r.int64());continue;case 4:if(i!==32)break;o.outputTokens=Ro(r.int64());continue;case 5:if(i!==40)break;o.totalTokens=Ro(r.int64());continue;case 6:if(i!==48)break;o.reasoningTokens=Ro(r.int64());continue;case 7:if(i!==56)break;o.cachedInputTokens=Ro(r.int64());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return In.fromPartial(e??{})},fromPartial(e){let t=aS();return t.provider=e.provider??void 0,t.model=e.model??void 0,t.inputTokens=e.inputTokens??void 0,t.outputTokens=e.outputTokens??void 0,t.totalTokens=e.totalTokens??void 0,t.reasoningTokens=e.reasoningTokens??void 0,t.cachedInputTokens=e.cachedInputTokens??void 0,t}};function cS(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var Jc={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)Uc.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)In.encode(r,t.uint32(58).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=cS();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(Uc.decode(r,r.uint32()));continue;case 7:if(i!==58)break;o.usage.push(In.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Jc.fromPartial(e??{})},fromPartial(e){let t=cS();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=>Uc.fromPartial(r))||[],t.usage=e.usage?.map(r=>In.fromPartial(r))||[],t}};function uS(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var eu={encode(e,t=new ge){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);for(let r of e.usage)In.encode(r,t.uint32(34).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=uS();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;case 4:if(i!==34)break;o.usage.push(In.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return eu.fromPartial(e??{})},fromPartial(e){let t=uS();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.usage=e.usage?.map(r=>In.fromPartial(r))||[],t}};function lS(){return{baseEvent:void 0,stepName:""}}var tu={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=lS();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 tu.fromPartial(e??{})},fromPartial(e){let t=lS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function dS(){return{baseEvent:void 0,stepName:""}}var ru={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=dS();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 ru.fromPartial(e??{})},fromPartial(e){let t=dS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function pS(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var nu={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=pS();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 nu.fromPartial(e??{})},fromPartial(e){let t=pS();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 fS(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var ou={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=fS();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 ou.fromPartial(e??{})},fromPartial(e){let t=fS();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 mS(){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 gS={encode(e,t=new ge){return e.textMessageStart!==void 0&&Vc.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Bc.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Gc.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&$c.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&&Hc.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&zc.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Wc.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Kc.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Yc.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Xc.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Zc.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Jc.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&eu.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&tu.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&ru.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&nu.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&ou.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=mS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=Vc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=Bc.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=Gc.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=$c.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=Hc.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=zc.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Wc.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=Kc.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Yc.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Xc.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Zc.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Jc.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=eu.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=tu.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=ru.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=nu.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=ou.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return gS.fromPartial(e??{})},fromPartial(e){let t=mS();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Vc.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Bc.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Gc.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?$c.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?Hc.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?zc.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Wc.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Kc.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Yc.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Xc.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Zc.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Jc.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?eu.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?tu.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?ru.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?nu.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?ou.fromPartial(e.toolCallChunk):void 0,t}};function Ro(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 hS=e=>e&&typeof e=="object"?e:void 0;var Rc=e=>{let t=hS(e);if(t){if(t.data){let r=t.data;return{type:"data",value:r.value,mimeType:r.mimeType}}if(t.url){let r=t.url;return{type:"url",value:r.value,mimeType:r.mimeType}}}},S_=e=>{let t=hS(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:Rc(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:Rc(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:Rc(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:Rc(r.source),metadata:r.metadata}}}};function yS(e){let t=gS.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=v_[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=>S_(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.RUN_FINISHED||r.type===D.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===D.STATE_DELTA)for(let n of r.delta)n.op=y_[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]}),Qa.parse(r)}var Ap="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var b_=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,bp=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(b_);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},vS=e=>e==="*"||e==="x"||e==="X",SS=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},w_=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],C_=(e,t)=>{if(vS(e)||vS(t))return 0;let[r,n]=w_(SS(e),SS(t));return r>n?1:r<n?-1:0},wp=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=C_(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Qi=(e,t)=>{let r=bp(e),n=bp(t),o=r.pop(),i=n.pop(),s=wp(r,n);return s!==0?s:o&&i?wp(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 Hi(){return Ir()}function Ep(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&Ep(t);return e}var AS=512*1024;function bS(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 c=0;c<a.length;c++){let u=a[c];if(n+=u.length,n>r)return!0;o.push(s[u])}}}}return!1}function Te(_x83,_x84,_x85,_x86){return _Te.apply(this,arguments)}function _Te(){_Te=_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&&!bS(t,r,AS),c=a?we(t):t,u=a?we(r):r,g=!1,v=!1,w;for(let h of e)try{a&&(Ep(c),Ep(u));let y=yield n(h,c,u);if(y===void 0)continue;let S=!1;if(y.messages!==void 0&&y.messages!==c&&(c=we(y.messages),g=!0,S=!0),y.state!==void 0&&y.state!==u&&(u=we(y.state),v=!0,S=!0),a&&S&&bS(c,u,AS)&&(a=!1),w=y.stopPropagation,w===!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(c)?we(c):c}:{}),...(v?{state:Object.isFrozen(u)?we(u):u}:{}),...(w===void 0?{}:{stopPropagation:w})}});return _Te.apply(this,arguments)}function iu(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 zi(e){if(e instanceof Ip)return e;if(e===!0)return new Ip(iu(!0))}var Ip=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 Cp(e){return e.enabled?new Ip(e):void 0}function x_(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 RS=(e,t,r,n,o)=>{let i=zi(o),s=we(r.messages),a=we(e.state),c={},u=v=>{v.messages!==void 0&&(s=v.messages,c.messages=v.messages),v.state!==void 0&&(a=v.state,c.state=v.state)},g=()=>{let v=we(c);return c={},v.messages!==void 0||v.state!==void 0?qe(v):cc};return t.pipe(Cc(/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(v){let w=yield Te(n,s,a,(h,y,S)=>h.onEvent?.({event:v,agent:r,input:e,messages:y,state:S}));if(u(w),w.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}),w.stopPropagation===!0)return g();switch(v.type){case D.TEXT_MESSAGE_START:{let h=yield Te(n,s,a,(y,S,x)=>y.onTextMessageStartEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(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),u({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 Te(n,s,a,(I,_,R)=>I.onTextMessageContentEvent?.({event:v,messages:_,state:R,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}));return u(x),x.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${y}`,u({messages:s})),g()}case D.TEXT_MESSAGE_END:{let{messageId:h}=v,y=s.find(S=>S.id===h);return y?(u(yield Te(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 Te(n,s,a,(y,S,x)=>y.onToolCallStartEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:S,parentMessageId:x}=v,I=s.find(R=>R.toolCalls?.some(T=>T.id===y))?.toolCalls?.find(R=>R.id===y);if(I)return I.function.name!==S&&(console.warn(`TOOL_CALL_START: tool call '${y}' already exists with name '${I.function.name}' \u2014 updating it to '${S}'`),I.function.name=S,u({messages:s})),g();let _=x_(s,x,y);_.toolCalls??(_.toolCalls=[]),_.toolCalls.push({id:y,type:"function",function:{name:S,arguments:""}}),u({messages:s})}return g()}case D.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=v,S=s.find(_=>_.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(_=>_.id===h);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=yield Te(n,s,a,(_,R,T)=>{let k=x.function.arguments,F=x.function.name,V={};try{V=Ec(k)}catch{}return _.onToolCallArgsEvent?.({event:v,messages:R,state:T,agent:r,input:e,toolCallBuffer:k,toolCallName:F,partialToolCallArgs:V})});return u(I),I.stopPropagation!==!0&&(x.function.arguments+=y,u({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?(u(yield Te(n,s,a,(x,I,_)=>{let R=S.function.arguments,T=S.function.name,k={};try{k=JSON.parse(R)}catch{}return x.onToolCallEndEvent?.({event:v,messages:I,state:_,agent:r,input:e,toolCallName:T,toolCallArgs:k})})),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 Te(n,s,a,(y,S,x)=>y.onToolCallResultEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:S,content:x,role:I}=v,_={id:y,toolCallId:S,role:I||"tool",content:x},R=s.findIndex(T=>T.role==="assistant"&&T.toolCalls?.some(k=>k.id===S));if(R===-1)s.push(_);else{let T=R+1;for(;T<s.length&&s[T].role==="tool";)T++;s.splice(T,0,_)}yield Promise.all(n.map(T=>{T.onNewMessage?.({message:_,messages:s,state:a,agent:r,input:e})})),u({messages:s})}return g()}case D.STATE_SNAPSHOT:{let h=yield Te(n,s,a,(y,S,x)=>y.onStateSnapshotEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{snapshot:y}=v;a=y,u({state:a})}return g()}case D.STATE_DELTA:{let h=yield Te(n,s,a,(y,S,x)=>y.onStateDeltaEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{delta:y}=v;try{a=Ja.applyPatch(a,y,!0,!1).newDocument,u({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
39
  Error: ${x}`)}}return g()}case D.MESSAGES_SNAPSHOT:{let h=yield Te(n,s,a,(y,S,x)=>y.onMessagesSnapshotEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{messages:y}=v,S=new Map(y.map(T=>[T.id,T])),x=y.some(T=>T.role==="activity"),I=y.some(T=>T.role==="reasoning"),_=T=>T.role==="activity"&&!x||T.role==="reasoning"&&!I;s=s.filter(T=>_(T)||S.has(T.id)).map(T=>_(T)?T:S.get(T.id));let R=new Set(s.map(T=>T.id));for(let T of y)R.has(T.id)||s.push(T);u({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,_=yield Te(n,s,a,(R,T,k)=>R.onActivitySnapshotEvent?.({event:h,messages:T,state:k,agent:r,input:e,activityMessage:x,existingMessage:S}));if(u(_),_.stopPropagation!==!0){let R={id:h.messageId,role:"activity",activityType:h.activityType,content:we(h.content)},T;y===-1?(s.push(R),T=R):x?I&&(s[y]={...x,activityType:h.activityType,content:we(h.content)}):I&&(s[y]=R,T=R),u({messages:s}),T&&(yield Promise.all(n.map(k=>k.onNewMessage?.({message:T,messages:s,state:a,agent:r,input:e}))))}return g()}case D.ACTIVITY_DELTA:{let h=v,y=s.findIndex(_=>_.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 Te(n,s,a,(_,R,T)=>_.onActivityDeltaEvent?.({event:h,messages:R,state:T,agent:r,input:e,activityMessage:x}));if(u(I),I.stopPropagation!==!0)try{let _=we(x.content??{}),R=Ja.applyPatch(_,h.patch??[],!0,!1).newDocument;s[y]={...x,content:we(R),activityType:h.activityType},u({messages:s})}catch(_){let R=_ instanceof Error?_.message:String(_);console.warn(`Failed to apply activity patch for '${h.messageId}': ${R}`)}return g()}case D.RAW:return u(yield Te(n,s,a,(h,y,S)=>h.onRawEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.CUSTOM:return u(yield Te(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 Te(n,s,a,(y,S,x)=>y.onRunStartedEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(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);u({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 Te(n,s,a,(x,I,_)=>x.onRunFinishedEvent?.({...y,messages:I,state:_,agent:r,input:e}));return u(S),S.stopPropagation!==!0&&(r.pendingInterrupts=y.outcome==="interrupt"?[...y.interrupts]:[]),g()}case D.RUN_ERROR:return u(yield Te(n,s,a,(h,y,S)=>h.onRunErrorEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.STEP_STARTED:return u(yield Te(n,s,a,(h,y,S)=>h.onStepStartedEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.STEP_FINISHED:return u(yield Te(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 u(yield Te(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 Te(n,s,a,(y,S,x)=>y.onReasoningMessageStartEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(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),u({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 Te(n,s,a,(I,_,R)=>I.onReasoningMessageContentEvent?.({event:v,messages:_,state:R,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}));return u(x),x.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${y}`,u({messages:s})),g()}case D.REASONING_MESSAGE_END:{let{messageId:h}=v,y=s.find(S=>S.id===h);return y?(u(yield Te(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 u(yield Te(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 Te(n,s,a,(I,_,R)=>I.onReasoningEncryptedValueEvent?.({event:v,messages:_,state:R,agent:r,input:e}));if(u(x),x.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let _ of s)if(_.role==="assistant"&&_.toolCalls){let R=_.toolCalls.find(T=>T.id===y);if(R){R.encryptedValue=S,I=!0;break}}}else{let _=s.find(R=>R.id===y);_?.role!=="activity"&&_&&(_.encryptedValue=S,I=!0)}I&&(c.messages=s)}return g()}}return v.type,g()});return function(_x87){return _ref40.apply(this,arguments)}}()),op(),n.length>0?ip({}):v=>v)},xp=e=>t=>{let r=zi(e),n=new Map,o=new Map,i=!1,s=!1,a=!1,c=new Map,u=!1,g=!1,v=!1,w=()=>{n.clear(),o.clear(),c.clear(),u=!1,g=!1,i=!1,s=!1,v=!0};return t.pipe(pt(h=>{let y=h.type;if(r?.event("VERIFY","Event:",h,{type:h.type}),s)return Me(()=>new Fe(`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 Me(()=>new Fe(`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 Me(()=>new Fe("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));i&&w()}}else if(a=!0,y!==D.RUN_STARTED&&y!==D.RUN_ERROR)return Me(()=>new Fe("First event must be 'RUN_STARTED'"));switch(y){case D.TEXT_MESSAGE_START:{let S=h.messageId;return n.has(S)?Me(()=>new Fe(`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),qe(h))}case D.TEXT_MESSAGE_CONTENT:{let S=h.messageId;return n.has(S)?qe(h):Me(()=>new Fe(`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),qe(h)):Me(()=>new Fe(`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)?Me(()=>new Fe(`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),qe(h))}case D.TOOL_CALL_ARGS:{let S=h.toolCallId;return o.has(S)?qe(h):Me(()=>new Fe(`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),qe(h)):Me(()=>new Fe(`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 c.has(S)?Me(()=>new Fe(`Step "${S}" is already active for 'STEP_STARTED'`)):(c.set(S,!0),qe(h))}case D.STEP_FINISHED:{let S=h.stepName;return c.has(S)?(c.delete(S),qe(h)):Me(()=>new Fe(`Cannot send 'STEP_FINISHED' for step "${S}" that was not started`))}case D.RUN_STARTED:return v=!0,qe(h);case D.RUN_FINISHED:if(c.size>0){let S=Array.from(c.keys()).join(", ");return Me(()=>new Fe(`Cannot send 'RUN_FINISHED' while steps are still active: ${S}`))}if(n.size>0){let S=Array.from(n.keys()).join(", ");return Me(()=>new Fe(`Cannot send 'RUN_FINISHED' while text messages are still active: ${S}`))}if(o.size>0){let S=Array.from(o.keys()).join(", ");return Me(()=>new Fe(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${S}`))}return i=!0,qe(h);case D.RUN_ERROR:return s=!0,qe(h);case D.CUSTOM:return qe(h);case D.THINKING_TEXT_MESSAGE_START:return u?g?Me(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(g=!0,qe(h)):Me(()=>new Fe("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?qe(h):Me(()=>new Fe("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,qe(h)):Me(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case D.THINKING_START:return u?Me(()=>new Fe("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(u=!0,qe(h));case D.THINKING_END:return u?(u=!1,qe(h)):Me(()=>new Fe("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return qe(h)}}))},Rn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),E_=e=>wc(()=>Cn(e())).pipe(sp(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return Cn(t.text()).pipe(pt(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,Me(()=>a)}))}let r={type:Rn.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new De(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:s}=yield n.read();if(i)break;let a={type:Rn.DATA,data:s};o.next(a)}o.complete()}catch(i){o.error(i)}})(),()=>{n.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):Me(()=>Error("Failed to getReader() from response"))})),I_=(e,t)=>{let r=zi(t),n=new Xt,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:a=>{if(a.type!==Rn.HEADERS&&a.type===Rn.DATA&&a.data){let c=o.decode(a.data,{stream:!0});i+=c;let u=i.split(/\n\n/);i=u.pop()||"";for(let g of u)s(g)}},error:a=>n.error(a),complete:()=>{i&&(i+=o.decode(),s(i)),n.complete()}});function s(a){let c=a.split(`
@@ -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.44.2';
78
+ window.coveoQuanticVersion = '3.44.3';