@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.
@@ -25,7 +25,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
25
25
 
26
26
  ${t}
27
27
  `;return new Pu(r)}var Pu=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},ve=class{constructor(e){me(this,"definition");this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let a=this.definition[o].validate(r[o]);a&&n.push(`${o}: ${a}`)}if(n.length)throw m_(n,t);return r}get default(){let e={};for(let t in this.definition){let r=this.definition[t].default;r!==void 0&&(e[t]=r)}return e}},Be=class{constructor(e={}){me(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&pe(e)?"value is required.":null}get default(){return this.baseConfig.default instanceof Function?this.baseConfig.default():this.baseConfig.default}get required(){return this.baseConfig.required===!0}};function Tt(e){return e===void 0}function g_(e){return e===null}function pe(e){return Tt(e)||g_(e)}var de=class{constructor(e={}){me(this,"value");this.value=new Be(e)}validate(e){let t=this.value.validate(e);return t||(h_(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function h_(e){return Tt(e)||hd(e)}function hd(e){return typeof e=="boolean"}var re=class{constructor(e={}){me(this,"config");me(this,"value");this.config=e,this.value=new Be(e)}validate(e){let t=this.value.validate(e);return t||(y_(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 y_(e){return Tt(e)||lx(e)}function lx(e){return typeof e=="number"&&!Number.isNaN(e)}var S_=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,L=class{constructor(e={}){me(this,"value");me(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Be(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:a}=this.config,i=this.value.validate(e);if(i)return i;if(Tt(e))return null;if(!_i(e))return"value is not a string.";if(!t&&!e.length)return"value is an empty string.";if(r)try{new URL(e)}catch{return"value is not a valid URL."}return n&&!n.test(e)?`value did not match provided regex ${n}`:o&&!o.includes(e)?`value should be one of: ${o.join(", ")}.`:a&&!(S_.test(e)&&new Date(e).toString()!=="Invalid Date")?"value is not a valid ISO8601 date string":null}get default(){return this.value.default}get required(){return this.value.required}};function _i(e){return Object.prototype.toString.call(e)==="[object String]"}var X=class{constructor(e={}){me(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Tt(e))return this.config.options.required?"value is required and is currently undefined":null;if(!dx(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&pe(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],a=n.validate(o);a!==null&&(t+=` ${a}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function dx(e){return e!==void 0&&typeof e=="object"}var se=class{constructor(e={}){me(this,"config");me(this,"value");this.config=e,this.value=new Be(this.config)}validate(e){if(!pe(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(pe(e))return null;if(this.config.max!==void 0&&e.length>this.config.max)return`value contains more than ${this.config.max}`;if(this.config.min!==void 0&&e.length<this.config.min)return`value contains less than ${this.config.min}`;if(this.config.each!==void 0){let r="";return e.forEach(n=>{this.config.each.required&&pe(n)&&(r=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(n,this.config.each);o!==null&&(r+=` ${o}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return hd(e)||_i(e)||lx(e)||dx(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Ni(e){return Array.isArray(e)}var ku=class{constructor(e){me(this,"config");me(this,"value");this.config=e,this.value=new Be(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Tt(e)||Object.values(this.config.enum).find(n=>n===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};d();c();l();u();var go=(e,t=5)=>e+Math.random().toString(36).substring(2,2+t);function yd(e){return Array.isArray(e)}function Sd(e){return e.trim()===""}function px(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}function v_(e){return btoa(encodeURI(e))}function vd(e,t){let{[e]:r,...n}=t;return n}function Di(e){return v_(JSON.stringify(e))}var A_=new Set(["1",1,"yes",!0]);function zy(){if(typeof navigator>"u"||typeof window>"u")return!1;let e=navigator,t=window;return[e.globalPrivacyControl,e.doNotTrack,e.msDoNotTrack,t.doNotTrack].some(r=>A_.has(r))}function fx(e){let t={};for(let[r,n]of e)t[r]=n;return t}function mx(e,t,r){return clearTimeout(t),setTimeout(e,r)}function Ou(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Ad(e,t,r={}){let n;return(...o)=>{let a=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,o)},t),a)return e.apply(void 0,o)}}function C_(e){if(Sd(e.openingDelimiter)||Sd(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(pe(e.content)||Sd(e.content))return e.content;if(e.highlights.length===0)return qi(e.content);let t=e.content.length,r="",n=0;for(let o=0;o<e.highlights.length;o++){let a=e.highlights[o],i=a.offset,p=i+a.length;if(p>t)break;r+=qi(e.content.slice(n,i)),r+=e.openingDelimiter,r+=qi(e.content.slice(i,p)),r+=e.closingDelimiter,n=p}return n!==t&&(r+=qi(e.content.slice(n))),r}function Ky(e,t){return e=qi(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,a)=>n?Wy(n,t.notMatchDelimiters):o?Wy(o,t.exactMatchDelimiters):a?Wy(a,t.correctionDelimiters):r)}function Wy(e,t){return t?t.open+e+t.close:e}function qi(e){let t={"&":"&amp;","<":"&lt;",">":"&gt;","\"":"&quot;","'":"&#x27;","`":"&#x60;"},r=`(?:${Object.keys(t).join("|")})`,n=RegExp(r),o=RegExp(r,"g");return n.test(e)?e.replace(o,a=>t[a]):e}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function hx(_x2,_x3){return _hx.apply(this,arguments)}function _hx(){_hx=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _hx.apply(this,arguments)}function yx(e){let t,r,n,o=!1;return function(i){t===void 0?(t=i,r=0,n=-1):t=b_(t,i);let p=t.length,f=0;for(;r<p;){o&&(t[r]===10&&(f=++r),o=!1);let m=-1;for(;r<p&&m===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-f);break;case 13:o=!0,m=r;break;case 10:m=r;break}if(m===-1)break;e(t.subarray(f,m),n),f=r,n=-1}f===p?t=void 0:f!==0&&(t=t.subarray(f),r-=f)}}function Sx(e,t,r){let n=gx(),o=new TextDecoder;return function(i,p){if(i.length===0)r?.(n),n=gx();else if(p>0){let f=o.decode(i.subarray(0,p)),m=p+(i[p+1]===32?2:1),g=o.decode(i.subarray(m));switch(f){case"data":n.data=n.data?`${n.data}
28
- ${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":x_(g,n,t);break}}}}function x_(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function b_(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function gx(){return{data:"",event:"",id:"",retry:void 0}}var Jy="text/event-stream",w_=1e3,vx="last-event-id";function Ax(){return typeof window<"u"}function Cd(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:a,onerror:i,openWhenHidden:p,fetch:f,...m}){return new Promise((g,S)=>{let x={...r};x.accept||(x.accept=Jy);let h;function C(){h?.abort(),document.hidden||T()}!p&&Ax()&&document.addEventListener("visibilitychange",C);let b=w_,w;function F(){Ax()&&document.removeEventListener("visibilitychange",C),clearTimeout(w),h?.abort()}t?.addEventListener("abort",()=>{F(),g()});let I=f??v,E=n??R_;function T(){return _T2.apply(this,arguments)}function _T2(){_T2=_asyncToGenerator(function*(){h=s.AbortController?new s.AbortController:null;try{let P=yield I(e,{...m,headers:x,signal:h?.signal});yield E(P),yield hx(P.body,yx(Sx(D=>{D?x[vx]=D:delete x[vx]},D=>{b=D},o))),a?.(),F(),g()}catch(P){if(!h?.signal?.aborted)try{let D=i?.(P)??b;clearTimeout(w),w=setTimeout(T,D)}catch(D){F(),S(D)}}});return _T2.apply(this,arguments)}T()})}function R_(e){let t=e.headers.get("content-type");if(!t?.startsWith(Jy))throw new Error(`Expected content-type to be ${Jy}, Actual: ${t}`)}d();c();l();u();var ho=class{constructor(t){me(this,"_basePath");me(this,"_params",{});this._basePath=t}addParam(t,r){this._params={...this.params,[t]:r}}get basePath(){return this._basePath}get params(){return this._params}get hasParams(){return Object.entries(this._params).length}get href(){return this.hasParams?`${this.basePath}?${Object.entries(this.params).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}`:this.basePath}};var F_=(e,t,r)=>new ho(`${e}/rest/organizations/${t}/machinelearning/streaming/${r}`).href,Cx=3,E_=5e3,I_="text/event-stream",eS=1,Xy=class extends Error{},_u=class extends Error{constructor(r){super(r.message);me(this,"payload",r)}},Zy=class{constructor(){me(this,"timeouts",new Set)}add(t){this.timeouts.add(t)}remove(t){clearTimeout(t),this.timeouts.delete(t)}isActive(t){return this.timeouts.has(t)}},xd=class{constructor(t){me(this,"logger");this.logger=t.logger}streamGeneratedAnswer(t,r){let{url:n,organizationId:o,streamId:a,accessToken:i}=t,{write:p,abort:f,close:m,resetAnswer:g}=r,S=new Zy;if(!a){this.logger.error("No stream ID found");return}let x=0,h,C=()=>{h&&!S.isActive(h)&&(w?.abort(),g(),F())},b=()=>{S.remove(h),h=mx(C,h,E_),S.add(h)},w=new s.AbortController,F=()=>Cd(F_(n,o,a),{method:"GET",fetch:v,headers:{Authorization:`Bearer ${i}`,accept:"*/*"},openWhenHidden:!0,signal:w?.signal,onopen(I){return _asyncToGenerator(function*(){if(I.ok&&I.headers.get("content-type")===I_)return;throw I.status>=400&&I.status<500&&I.status!==429?new _u({message:"Error opening stream",code:I.status}):new Xy})()},onmessage:I=>{if(w?.signal.aborted)return;let E=JSON.parse(I.data);if(E.finishReason==="ERROR"){S.remove(h),w?.abort(),f({message:E.errorMessage,code:E.statusCode});return}p(E),x=0,E.finishReason==="COMPLETED"?(S.remove(h),m()):b()},onerror:I=>{if(!w?.signal.aborted){if(S.remove(h),I instanceof _u)throw w?.abort(),f(I),I;if(++x>Cx){this.logger.info("Maximum retry exceeded.");let E={message:"Failed to complete stream.",code:eS};throw w?.abort(),f(E),new _u(E)}this.logger.info(`Retrying...(${x}/${Cx})`),g()}}});return F(),w}};d();c();l();u();var bd=e=>e;d();c();l();u();d();c();l();u();function Mi(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function ir(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Mi(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Mi(),extendedResults:{},searchAction:void 0}}d();c();l();u();function yo(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...a}=e;return a}var So=e=>{let{response:t}=e;return t.body?T_(e):P_(t)},T_=e=>O_(e)?__(e):k_(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},P_=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function k_(e){return e.body.statusCode!==void 0}function O_(e){return e.body.exception!==void 0}var __=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});d();c();l();u();var _x=jr(Tx(),1);d();c();l();u();var K=new Error("Failed to load reducers."),Vi=class extends Error{constructor(){super(),this.name="UnauthorizedTokenError",this.message="The token being used to perform the request is unauthorized. It may be expired or invalid."}},da=class extends Error{constructor(r,n){super();me(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};d();c();l();u();function Px(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function kx(e){return typeof e!="object"||!e?!1:Object.values(e).every(aN)}function aN(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Ox(e){return e===429}var Lr=class e{static call(t){return _asyncToGenerator(function*(){let r=iN(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:a,...i}=o,p=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let f=yield v(a,i);if(Ox(f.status))throw f;return f});return function p(){return _ref.apply(this,arguments)}}();try{let f=yield(0,_x.backOff)(p,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(m){let g=m&&Ox(m.status);return g&&(n.info("Platform retrying request"),yield new Promise(S=>setTimeout(S,1e3))),g});return function retry(_x4){return _ref2.apply(this,arguments)}}()});switch(f.status){case 419:case 401:throw n.info("Platform renewing token"),new Vi;case 404:throw new da(a,f.status);default:return n.info({response:f,requestInfo:o},"Platform response"),f}}catch(f){return f.message==="Failed to fetch"?new da(a):f}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:a,requestMetadata:i}=r,{signal:p,...f}=t,m=Ou(f);try{let g=yield o(t,n,i);return{...t,...g}}catch(g){a.error(g,"Platform request preprocessing failed. Returning default request options.")}return m})()}};function gr(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function ji(e,t,r="prod"){return e??gr(t,r)}function vt(e,t="prod"){return`${gr(e,t)}/rest/search/v2`}function Rd(e,t="prod"){return`${gr(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function iN(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:a,signal:i}=e,p=e.method==="POST"||e.method==="PUT",f=sN(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${a}`,...e.headers},...(p&&{body:f}),signal:i}}function sN(e,t){return t==="application/x-www-form-urlencoded"?kx(e)?Px(e):"":JSON.stringify(e)}d();c();l();u();var vo=class{constructor(){me(this,"currentAbortController",null)}enqueue(t,r){var _this=this;return _asyncToGenerator(function*(){let n=_this.currentAbortController;_this.currentAbortController=new s.AbortController;let o=_this.currentAbortController;n&&(r.warnOnAbort&&r.logger.warn("Cancelling current pending search query"),n.abort());try{return yield t(o?.signal??null)}finally{_this.currentAbortController===o&&(_this.currentAbortController=null)}})()}};d();c();l();u();d();c();l();u();function Nx(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}d();c();l();u();var Gn=(e,t,r,n)=>{let o=new ho(`${e.url}${n}`);return o.addParam("organizationId",e.organizationId),e.authentication&&o.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:o.href,origin:"searchApiFetch"}};var Dx=(e,t)=>{let r=new ho(`${e.url}${t}`);return r.addParam("access_token",e.accessToken),r.addParam("organizationId",e.organizationId),r.addParam("uniqueId",e.uniqueId),e.authentication&&r.addParam("authentication",e.authentication),e.q!==void 0&&r.addParam("q",e.q),e.enableNavigation!==void 0&&r.addParam("enableNavigation",`${e.enableNavigation}`),e.requestedOutputSize!==void 0&&r.addParam("requestedOutputSize",`${e.requestedOutputSize}`),r.href},qx=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Lr.call({...Gn(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:yo(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Nx(r),o=yield r.arrayBuffer(),i=new TextDecoder(n).decode(o);return cN(i)?{success:i}:{error:So({response:r,body:i})}});return function qx(_x5,_x6){return _ref3.apply(this,arguments)}}();function cN(e){return typeof e=="string"}d();c();l();u();function uN(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function lN(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Fd(e,t){if(t&&e.name==="AbortError")return{error:lN(e)};if(e instanceof da)return{error:uN(e)};throw e}var Ed=class{constructor(t){me(this,"options",t);me(this,"apiCallsQueues",{unknown:new vo,mainSearch:new vo,facetValues:new vo,foldingCollection:new vo,instantResults:new vo})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...Gn(t,"POST","application/json","/plan"),requestParams:yo(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return Fd(r);let n=yield r.json();return pN(n)?{success:n}:{error:So({response:r,body:n})}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...Gn(t,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:yo(t),..._this3.options});if(r instanceof Error)return Fd(r);let n=yield r.json(),o={response:r,body:n};return dN(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:So(o)}})()}search(t,r){var _this4=this;return _asyncToGenerator(function*(){let n=r?.origin??"unknown",o=yield _this4.apiCallsQueues[n].enqueue(p=>Lr.call({...Gn(t,"POST","application/json",""),requestParams:yo(t),requestMetadata:{method:"search",origin:r?.origin},..._this4.options,signal:p??void 0}),{logger:_this4.options.logger,warnOnAbort:!r?.disableAbortWarning});if(o instanceof Error)return Fd(o,r?.disableAbortWarning);let a=yield o.json(),i={response:o,body:a};return Mx(a)?(i.body=Vx(a),{success:(yield _this4.options.postprocessSearchResponseMiddleware(i)).body}):{error:So(i)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...Gn(t,"POST","application/json","/facet"),requestParams:yo(t),requestMetadata:{method:"facetSearch"},..._this5.options});if(r instanceof Error)throw r;let n=yield r.json(),o={response:r,body:n};return(yield _this5.options.postprocessFacetSearchResponseMiddleware(o)).body})()}recommendations(t){var _this6=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...Gn(t,"POST","application/json",""),requestParams:yo(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if(Mx(n)){let o={response:r,body:n};return o.body=Vx(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:So({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return qx(t,{..._this7.options})})()}fieldDescriptions(t){var _this8=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...Gn(t,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},..._this8.options});if(r instanceof Error)throw r;let n=yield r.json();return fN(n)?{success:n}:{error:So({response:r,body:n})}})()}},Id=e=>e.success!==void 0,At=e=>e.error!==void 0;function Mx(e){return e.results!==void 0}function Vx(e){let t=Mi();return pe(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function dN(e){return e.completions!==void 0}function pN(e){return e.preprocessingOutput!==void 0}function fN(e){return e.fields!==void 0}d();c();l();u();var jx=e=>e,Lx=e=>e,Ux=e=>e;d();c();l();u();d();c();l();u();var z=new L({required:!0,emptyAllowed:!1}),st=new L({required:!1,emptyAllowed:!1}),Ge=new L({required:!0,emptyAllowed:!0}),qK=new L({required:!1,emptyAllowed:!0}),Td=new se({each:z,required:!0}),Qx=new L({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Bx=new L({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),MK=new L({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),$n=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),hr=(e,t)=>{if("required"in t)return{payload:new ve({value:t}).validate({value:e}).value};let o=new X({options:{required:!0},values:t}).validate(e);if(o)throw new Pu(o);return{payload:e}},O=(e,t)=>{try{return hr(e,t)}catch(r){return{payload:e,error:$n(r)}}},lt=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return Gx(e,t,r,o,"Controller initialization error")},He=(e,t,r,n)=>{let o=`Check the options of ${n}`;return Gx(e,t,r,o,"Controller initialization error")},Gx=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(a){throw e.logger.error(a,o),a}};d();c();l();u();d();c();l();u();d();c();l();u();function Pt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var mN=typeof Symbol=="function"&&Symbol.observable||"@@observable",$x=mN,uS=()=>Math.random().toString(36).substring(7).split("").join("."),gN={INIT:`@@redux/INIT${uS()}`,REPLACE:`@@redux/REPLACE${uS()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${uS()}`},Pd=gN;function Xr(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function lS(e,t,r){if(typeof e!="function")throw new Error(Pt(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Pt(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Pt(1));return r(lS)(e,t)}let n=e,o=t,a=new Map,i=a,p=0,f=!1;function m(){i===a&&(i=new Map,a.forEach((w,F)=>{i.set(F,w)}))}function g(){if(f)throw new Error(Pt(3));return o}function S(w){if(typeof w!="function")throw new Error(Pt(4));if(f)throw new Error(Pt(5));let F=!0;m();let I=p++;return i.set(I,w),function(){if(F){if(f)throw new Error(Pt(6));F=!1,m(),i.delete(I),a=null}}}function x(w){if(!Xr(w))throw new Error(Pt(7));if(typeof w.type>"u")throw new Error(Pt(8));if(typeof w.type!="string")throw new Error(Pt(17));if(f)throw new Error(Pt(9));try{f=!0,o=n(o,w)}finally{f=!1}return(a=i).forEach(I=>{I()}),w}function h(w){if(typeof w!="function")throw new Error(Pt(10));n=w,x({type:Pd.REPLACE})}function C(){let w=S;return{subscribe(F){if(typeof F!="object"||F===null)throw new Error(Pt(11));function I(){let T=F;T.next&&T.next(g())}return I(),{unsubscribe:w(I)}},[$x](){return this}}}return x({type:Pd.INIT}),{dispatch:x,subscribe:S,getState:g,replaceReducer:h,[$x]:C}}function hN(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Pd.INIT})>"u")throw new Error(Pt(12));if(typeof r(void 0,{type:Pd.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Pt(13))})}function Li(e){let t=Object.keys(e),r={};for(let i=0;i<t.length;i++){let p=t[i];typeof e[p]=="function"&&(r[p]=e[p])}let n=Object.keys(r),o,a;try{hN(r)}catch(i){a=i}return function(p={},f){if(a)throw a;let m=!1,g={};for(let S=0;S<n.length;S++){let x=n[S],h=r[x],C=p[x],b=h(C,f);if(typeof b>"u"){let w=f&&f.type;throw new Error(Pt(14))}g[x]=b,m=m||b!==C}return m=m||n.length!==Object.keys(p).length,m?g:p}}function qu(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Hx(...e){return t=>(r,n)=>{let o=t(r,n),a=()=>{throw new Error(Pt(15))},i={getState:o.getState,dispatch:(f,...m)=>a(f,...m)},p=e.map(f=>f(i));return a=qu(...p)(o.dispatch),{...o,dispatch:a}}}function Mu(e){return Xr(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var vS=Symbol.for("immer-nothing"),Vu=Symbol.for("immer-draftable"),ht=Symbol.for("immer-state");function kt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var sr=Object,fa=sr.getPrototypeOf,ju="constructor",Gu="prototype",fS="configurable",Nd="enumerable",Od="writable",Lu="value",Yt=e=>!!e&&!!e[ht];function Vt(e){return e?eb(e)||Hu(e)||!!e[Vu]||!!e[ju]?.[Vu]||zu(e)||Wu(e):!1}var yN=sr[Gu][ju].toString(),zx=new WeakMap;function eb(e){if(!e||!Qi(e))return!1;let t=fa(e);if(t===null||t===sr[Gu])return!0;let r=sr.hasOwnProperty.call(t,ju)&&t[ju];if(r===Object)return!0;if(!pa(r))return!1;let n=zx.get(r);return n===void 0&&(n=Function.toString.call(r),zx.set(r,n)),n===yN}function tb(e){return Yt(e)||kt(15,e),e[ht].base_}function $u(e,t,r=!0){ma(e)===0?(r?Reflect.ownKeys(e):sr.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function ma(e){let t=e[ht];return t?t.type_:Hu(e)?1:zu(e)?2:Wu(e)?3:0}var Ui=(e,t,r=ma(e))=>r===2?e.has(t):sr[Gu].hasOwnProperty.call(e,t),Hn=(e,t,r=ma(e))=>r===2?e.get(t):e[t],Dd=(e,t,r,n=ma(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function SN(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Hu=Array.isArray,zu=e=>e instanceof Map,Wu=e=>e instanceof Set,Qi=e=>typeof e=="object",pa=e=>typeof e=="function",dS=e=>typeof e=="boolean";function vN(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var AN=e=>Qi(e)?e?.[ht]:null,zn=e=>e.copy_||e.base_;var AS=e=>e.modified_?e.copy_:e.base_;function mS(e,t){if(zu(e))return new Map(e);if(Wu(e))return new Set(e);if(Hu(e))return Array[Gu].slice.call(e);let r=eb(e);if(t===!0||t==="class_only"&&!r){let n=sr.getOwnPropertyDescriptors(e);delete n[ht];let o=Reflect.ownKeys(n);for(let a=0;a<o.length;a++){let i=o[a],p=n[i];p[Od]===!1&&(p[Od]=!0,p[fS]=!0),(p.get||p.set)&&(n[i]={[fS]:!0,[Od]:!0,[Nd]:p[Nd],[Lu]:e[i]})}return sr.create(fa(e),n)}else{let n=fa(e);if(n!==null&&r)return{...e};let o=sr.create(n);return sr.assign(o,e)}}function CS(e,t=!1){return Ud(e)||Yt(e)||!Vt(e)||(ma(e)>1&&sr.defineProperties(e,{set:kd,add:kd,clear:kd,delete:kd}),sr.freeze(e),t&&$u(e,(r,n)=>{CS(n,!0)},!1)),e}function CN(){kt(2)}var kd={[Lu]:CN};function Ud(e){return e===null||!Qi(e)?!0:sr.isFrozen(e)}var qd="MapSet",Md="Patches",Wx="ArrayMethods",Vd={};function ga(e){let t=Vd[e];return t||kt(0,e),t}var Kx=e=>!!Vd[e];function xN(e,t){Vd[e]||(Vd[e]=t)}var Uu,rb=()=>Uu,bN=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Kx(qd)?ga(qd):void 0,arrayMethodsPlugin_:Kx(Wx)?ga(Wx):void 0});function Yx(e,t){t&&(e.patchPlugin_=ga(Md),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function gS(e){hS(e),e.drafts_.forEach(wN),e.drafts_=null}function hS(e){e===Uu&&(Uu=e.parent_)}var Jx=e=>Uu=bN(Uu,e);function wN(e){let t=e[ht];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Xx(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[ht].modified_&&(gS(t),kt(4)),Vt(e)&&(e=Zx(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[ht].base_,e,t)}else e=Zx(t,r);return RN(t,e,!0),gS(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==vS?e:void 0}function Zx(e,t){if(Ud(t))return t;let r=t[ht];if(!r)return jd(t,e.handledSet_,e);if(!Qd(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){let{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);ab(r,e)}return r.copy_}function RN(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&CS(t,r)}function nb(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Qd=(e,t)=>e.scope_===t,FN=[];function ob(e,t,r,n){let o=zn(e),a=e.type_;if(n!==void 0&&Hn(o,n,a)===t){Dd(o,n,r,a);return}if(!e.draftLocations_){let p=e.draftLocations_=new Map;$u(o,(f,m)=>{if(Yt(m)){let g=p.get(m)||[];g.push(f),p.set(m,g)}})}let i=e.draftLocations_.get(t)??FN;for(let p of i)Dd(o,p,r,a)}function EN(e,t,r){e.callbacks_.push(function(o){let a=t;if(!a||!Qd(a,o))return;o.mapSetPlugin_?.fixSetContents(a);let i=AS(a);ob(e,a.draft_??a,i,r),ab(a,o)})}function ab(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)}nb(e)}}function IN(e,t,r){let{scope_:n}=e;if(Yt(r)){let o=r[ht];Qd(o,n)&&o.callbacks_.push(function(){_d(e);let i=AS(o);ob(e,r,i,t)})}else Vt(r)&&e.callbacks_.push(function(){let a=zn(e);e.type_===3?a.has(r)&&jd(r,n.handledSet_,n):Hn(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&jd(Hn(e.copy_,t,e.type_),n.handledSet_,n)})}function jd(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Yt(e)||t.has(e)||!Vt(e)||Ud(e)||(t.add(e),$u(e,(n,o)=>{if(Yt(o)){let a=o[ht];if(Qd(a,r)){let i=AS(a);Dd(e,n,i,e.type_),nb(a)}}else Vt(o)&&jd(o,t,r)})),e}function TN(e,t){let r=Hu(e),n={type_:r?1:0,scope_:t?t.scope_:rb(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=n,a=Ld;r&&(o=[n],a=Qu);let{revoke:i,proxy:p}=Proxy.revocable(o,a);return n.draft_=p,n.revoke_=i,[p,n]}var Ld={get(e,t){if(t===ht)return e;let r=e.scope_.arrayMethodsPlugin_,n=e.type_===1&&typeof t=="string";if(n&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let o=zn(e);if(!Ui(o,t,e.type_))return kN(e,o,t);let a=o[t];if(e.finalized_||!Vt(a)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&vN(t))return a;if(a===pS(e.base_,t)||PN(e,t,a)){_d(e);let i=e.type_===1?+t:t,p=SS(e.scope_,a,e,i);return e.copy_[i]=p}return a},has(e,t){return t in zn(e)},ownKeys(e){return Reflect.ownKeys(zn(e))},set(e,t,r){let n=ib(zn(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=pS(zn(e),t),a=o?.[ht];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(SN(r,o)&&(r!==void 0||Ui(e.base_,t,e.type_)))return!0;_d(e),yS(e)}return e.copy_[t]===r&&(r!==void 0||Ui(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),IN(e,t,r)),!0},deleteProperty(e,t){return _d(e),pS(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),yS(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=zn(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Od]:!0,[fS]:e.type_!==1||t!=="length",[Nd]:n[Nd],[Lu]:r[t]}},defineProperty(){kt(11)},getPrototypeOf(e){return fa(e.base_)},setPrototypeOf(){kt(12)}},Qu={};for(let e in Ld){let t=Ld[e];Qu[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Qu.deleteProperty=function(e,t){return Qu.set.call(this,e,t,void 0)};Qu.set=function(e,t,r){return Ld.set.call(this,e[0],t,r,e[0])};function pS(e,t){let r=e[ht];return(r?zn(r):e)[t]}function PN(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!Vt(r)||r[ht]?!1:e.baseRefs_.has(r)}function kN(e,t,r){let n=ib(t,r);return n?Lu in n?n[Lu]:n.get?.call(e.draft_):void 0}function ib(e,t){if(!(t in e))return;let r=fa(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=fa(r)}}function yS(e){e.modified_||(e.modified_=!0,e.parent_&&yS(e.parent_))}function _d(e){e.copy_||(e.assigned_=new Map,e.copy_=mS(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var ON=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(pa(t)&&!pa(r)){let a=r;r=t;let i=this;return function(f=a,...m){return i.produce(f,g=>r.call(this,g,...m))}}pa(r)||kt(6),n!==void 0&&!pa(n)&&kt(7);let o;if(Vt(t)){let a=Jx(this),i=SS(a,t,void 0),p=!0;try{o=r(i),p=!1}finally{p?gS(a):hS(a)}return Yx(a,n),Xx(o,a)}else if(!t||!Qi(t)){if(o=r(t),o===void 0&&(o=t),o===vS&&(o=void 0),this.autoFreeze_&&CS(o,!0),n){let a=[],i=[];ga(Md).generateReplacementPatches_(t,o,{patches_:a,inversePatches_:i}),n(a,i)}return o}else kt(1,t)},this.produceWithPatches=(t,r)=>{if(pa(t))return(i,...p)=>this.produceWithPatches(i,f=>t(f,...p));let n,o;return[this.produce(t,r,(i,p)=>{n=i,o=p}),n,o]},dS(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),dS(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),dS(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Vt(e)||kt(8),Yt(e)&&(e=Bd(e));let t=Jx(this),r=SS(t,e,void 0);return r[ht].isManual_=!0,hS(t),r}finishDraft(e,t){let r=e&&e[ht];(!r||!r.isManual_)&&kt(9);let{scope_:n}=r;return Yx(n,t),Xx(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let o=t[r];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}r>-1&&(t=t.slice(r+1));let n=ga(Md).applyPatches_;return Yt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function SS(e,t,r,n){let[o,a]=zu(t)?ga(qd).proxyMap_(t,r):Wu(t)?ga(qd).proxySet_(t,r):TN(t,r);return(r?.scope_??rb()).drafts_.push(o),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&n!==void 0?EN(r,a,n):a.callbacks_.push(function(f){f.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:m}=f;a.modified_&&m&&m.generatePatches_(a,[],f)}),o}function Bd(e){return Yt(e)||kt(10,e),sb(e)}function sb(e){if(!Vt(e)||Ud(e))return e;let t=e[ht],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=mS(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=mS(e,!0);return $u(r,(o,a)=>{Dd(r,o,sb(a))},n),t&&(t.finalized_=!1),r}function cb(){function t(C,b=[]){if(C.key_!==void 0){let w=C.parent_.copy_??C.parent_.base_,F=AN(Hn(w,C.key_)),I=Hn(w,C.key_);if(I===void 0||I!==C.draft_&&I!==C.base_&&I!==C.copy_||F!=null&&F.base_!==C.base_)return null;let E=C.parent_.type_===3,T;if(E){let P=C.parent_;T=Array.from(P.drafts_.keys()).indexOf(C.key_)}else T=C.key_;if(!(E&&w.size>T||Ui(w,T)))return null;b.push(T)}if(C.parent_)return t(C.parent_,b);b.reverse();try{r(C.copy_,b)}catch{return null}return b}function r(C,b){let w=C;for(let F=0;F<b.length-1;F++){let I=b[F];if(w=Hn(w,I),!Qi(w)||w===null)throw new Error(`Cannot resolve path at '${b.join("/")}'`)}return w}let n="replace",o="add",a="remove";function i(C,b,w){if(C.scope_.processedForPatches_.has(C))return;C.scope_.processedForPatches_.add(C);let{patches_:F,inversePatches_:I}=w;switch(C.type_){case 0:case 2:return f(C,b,F,I);case 1:return p(C,b,F,I);case 3:return m(C,b,F,I)}}function p(C,b,w,F){let{base_:I,assigned_:E}=C,T=C.copy_;T.length<I.length&&([I,T]=[T,I],[w,F]=[F,w]);let P=C.allIndicesReassigned_===!0;for(let D=0;D<I.length;D++){let G=T[D],Q=I[D];if((P||E?.get(D.toString()))&&G!==Q){let U=G?.[ht];if(U&&U.modified_)continue;let j=b.concat([D]);w.push({op:n,path:j,value:h(G)}),F.push({op:n,path:j,value:h(Q)})}}for(let D=I.length;D<T.length;D++){let G=b.concat([D]);w.push({op:o,path:G,value:h(T[D])})}for(let D=T.length-1;I.length<=D;--D){let G=b.concat([D]);F.push({op:a,path:G})}}function f(C,b,w,F){let{base_:I,copy_:E,type_:T}=C;$u(C.assigned_,(P,D)=>{let G=Hn(I,P,T),Q=Hn(E,P,T),V=D?Ui(I,P)?n:o:a;if(G===Q&&V===n)return;let U=b.concat(P);w.push(V===a?{op:V,path:U}:{op:V,path:U,value:h(Q)}),F.push(V===o?{op:a,path:U}:V===a?{op:o,path:U,value:h(G)}:{op:n,path:U,value:h(G)})})}function m(C,b,w,F){let{base_:I,copy_:E}=C,T=0;I.forEach(P=>{if(!E.has(P)){let D=b.concat([T]);w.push({op:a,path:D,value:P}),F.unshift({op:o,path:D,value:P})}T++}),T=0,E.forEach(P=>{if(!I.has(P)){let D=b.concat([T]);w.push({op:o,path:D,value:P}),F.unshift({op:a,path:D,value:P})}T++})}function g(C,b,w){let{patches_:F,inversePatches_:I}=w;F.push({op:n,path:[],value:b===vS?void 0:b}),I.push({op:n,path:[],value:C})}function S(C,b){return b.forEach(w=>{let{path:F,op:I}=w,E=C;for(let G=0;G<F.length-1;G++){let Q=ma(E),V=F[G];typeof V!="string"&&typeof V!="number"&&(V=""+V),(Q===0||Q===1)&&(V==="__proto__"||V===ju)&&kt(19),pa(E)&&V===Gu&&kt(19),E=Hn(E,V),(E===null||!Qi(E))&&kt(18,F.join("/"))}let T=ma(E),P=x(w.value),D=F[F.length-1];switch(I){case n:switch(T){case 2:return E.set(D,P);case 3:kt(16);default:return E[D]=P}case o:switch(T){case 1:return D==="-"?E.push(P):E.splice(D,0,P);case 2:return E.set(D,P);case 3:return E.add(P);default:return E[D]=P}case a:switch(T){case 1:return E.splice(D,1);case 2:return E.delete(D);case 3:return E.delete(w.value);default:return delete E[D]}default:kt(17,I)}}),C}function x(C){if(!Vt(C))return C;if(Hu(C))return C.map(x);if(zu(C))return new Map(Array.from(C.entries()).map(([w,F])=>[w,x(F)]));if(Wu(C))return new Set(Array.from(C).map(x));let b=Object.create(fa(C));for(let w in C)b[w]=x(C[w]);return Ui(C,Vu)&&(b[Vu]=C[Vu]),b}function h(C){return Yt(C)?x(C):C}xN(Md,{applyPatches_:S,generatePatches_:i,generateReplacementPatches_:g,getPath:t})}var _N=y.Iterator,WK=typeof _N?.from=="function";var Bu=new ON,ha=Bu.produce,xS=Bu.produceWithPatches.bind(Bu);var bS=Bu.applyPatches.bind(Bu);d();c();l();u();function NN(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function DN(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 ub=e=>Array.isArray(e)?e:[e];function qN(e){let t=Array.isArray(e[0])?e[0]:e;return DN(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function MN(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var VN=class{constructor(e){this.value=e}deref(){return this.value}},jN=()=>typeof WeakRef>"u"?VN:WeakRef,db=jN(),LN=0,lb=1;function Gd(){return{s:LN,v:void 0,o:null,p:null}}function UN(e){return e instanceof db?e.deref():e}function Ku(e,t={}){let r=Gd(),{resultEqualityCheck:n}=t,o,a=0;function i(){let p=r,{length:f}=arguments;for(let S=0,x=f;S<x;S++){let h=arguments[S];if(typeof h=="function"||typeof h=="object"&&h!==null){let C=p.o;C===null&&(p.o=C=new WeakMap);let b=C.get(h);b===void 0?(p=Gd(),C.set(h,p)):p=b}else{let C=p.p;C===null&&(p.p=C=new Map);let b=C.get(h);b===void 0?(p=Gd(),C.set(h,p)):p=b}}let m=p,g;if(p.s===lb)g=p.v;else if(g=e.apply(null,arguments),a++,n){let S=UN(o);S!=null&&n(S,g)&&(g=S,a!==0&&a--),o=typeof g=="object"&&g!==null||typeof g=="function"?new db(g):g}return m.s=lb,m.v=g,g}return i.clearCache=()=>{r=Gd(),i.resetResultsCount()},i.resultsCount=()=>a,i.resetResultsCount=()=>{a=0},i}function QN(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let a=0,i=0,p,f={},m=o.pop();typeof m=="object"&&(f=m,m=o.pop()),NN(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);let g={...r,...f},{memoize:S,memoizeOptions:x=[],argsMemoize:h=Ku,argsMemoizeOptions:C=[]}=g,b=ub(x),w=ub(C),F=qN(o),I=S(function(){return a++,m.apply(null,arguments)},...b),E=!0,T=h(function(){i++;let D=MN(F,arguments);return p=I.apply(null,D),p},...w);return Object.assign(T,{resultFunc:m,memoizedResultFunc:I,dependencies:F,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>p,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:S,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var tt=QN(Ku);d();c();l();u();function pb(e){return({dispatch:r,getState:n})=>o=>a=>typeof a=="function"?a(r,n,e):o(a)}var fb=pb(),mb=pb;var BN=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?qu:qu.apply(null,arguments)},S6=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},GN=e=>e&&typeof e.match=="function";function k(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(Jt(0));return{type:e,payload:o.payload,...("meta"in o&&{meta:o.meta}),...("error"in o&&{error:o.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Mu(n)&&n.type===e,r}var xb=class Yu extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Yu.prototype)}static get[Symbol.species](){return Yu}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Yu(...t[0].concat(this)):new Yu(...t.concat(this))}};function gb(e){return Vt(e)?ha(e,()=>{}):e}function $d(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function $N(e){return typeof e=="boolean"}var HN=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:a=!0}=t??{},i=new xb;return r&&($N(r)?i.push(fb):i.push(mb(r.extraArgument))),i},Ju="RTK_autoBatch",$i=()=>e=>({payload:e,meta:{[Ju]:!0}}),hb=e=>t=>{setTimeout(t,e)},zN=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(a),clearTimeout(i),r())},a=e(o),i=setTimeout(o,t)},WN=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,a=!1,i=!1,p=new Set,f=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?zN(window.requestAnimationFrame,100):hb(10):e.type==="callback"?e.queueNotification:hb(e.timeout),m=()=>{i=!1,a&&(a=!1,p.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let S=()=>o&&g(),x=n.subscribe(S);return p.add(g),()=>{x(),p.delete(g)}},dispatch(g){try{return o=!g?.meta?.[Ju],a=!o,a&&(i||(i=!0,f(m))),n.dispatch(g)}finally{o=!0}}})},KN=e=>function(r){let{autoBatch:n=!0}=r??{},o=new xb(e);return n&&o.push(WN(typeof n=="object"?n:void 0)),o};function bb(e){let t=HN(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:a=!0,preloadedState:i=void 0,enhancers:p=void 0}=e||{},f;if(typeof r=="function")f=r;else if(Xr(r))f=Li(r);else throw new Error(Jt(1));let m;typeof n=="function"?m=n(t):m=t();let g=qu;o&&(g=BN({trace:!1,...(typeof o=="object"&&o)}));let S=Hx(...m),x=KN(S),h=typeof p=="function"?p(x):x(),C=g(...h);return lS(f,i,C)}function wb(e){let t={},r=[],n,o={addCase(a,i){let p=typeof a=="string"?a:a.type;if(!p)throw new Error(Jt(28));if(p in t)throw new Error(Jt(29));return t[p]=i,o},addAsyncThunk(a,i){return i.pending&&(t[a.pending.type]=i.pending),i.rejected&&(t[a.rejected.type]=i.rejected),i.fulfilled&&(t[a.fulfilled.type]=i.fulfilled),i.settled&&r.push({matcher:a.settled,reducer:i.settled}),o},addMatcher(a,i){return r.push({matcher:a,reducer:i}),o},addDefaultCase(a){return n=a,o}};return e(o),[t,r,n]}function YN(e){return typeof e=="function"}function ae(e,t){let[r,n,o]=wb(t),a;if(YN(e))a=()=>gb(e());else{let p=gb(e);a=()=>p}function i(p=a(),f){let m=[r[f.type],...n.filter(({matcher:g})=>g(f)).map(({reducer:g})=>g)];return m.filter(g=>!!g).length===0&&(m=[o]),m.reduce((g,S)=>{if(S)if(Yt(g)){let h=S(g,f);return h===void 0?g:h}else{if(Vt(g))return ha(g,x=>S(x,f));{let x=S(g,f);if(x===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return x}}return g},p)}return i.getInitialState=a,i}var Rb=(e,t)=>GN(e)?e.match(t):e(t);function Zr(...e){return t=>e.some(r=>Rb(r,t))}function Gi(...e){return t=>e.every(r=>Rb(r,t))}function Kd(e,t){if(!e||!e.meta)return!1;let r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function Xu(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Yd(...e){return e.length===0?t=>Kd(t,["pending"]):Xu(e)?Zr(...e.map(t=>t.pending)):Yd()(e[0])}function Sa(...e){return e.length===0?t=>Kd(t,["rejected"]):Xu(e)?Zr(...e.map(t=>t.rejected)):Sa()(e[0])}function Zu(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Gi(Sa(...e),t):Xu(e)?Gi(Sa(...e),t):Zu()(e[0])}function Wn(...e){return e.length===0?t=>Kd(t,["fulfilled"]):Xu(e)?Zr(...e.map(t=>t.fulfilled)):Wn()(e[0])}function Jd(...e){return e.length===0?t=>Kd(t,["pending","fulfilled","rejected"]):Xu(e)?Zr(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Jd()(e[0])}var JN="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",el=(e=21)=>{let t="",r=e;for(;r--;)t+=JN[Math.random()*64|0];return t},XN=["name","message","stack","code"],wS=class{constructor(e,t){me(this,"payload");me(this,"meta");me(this,"_type");this.payload=e,this.meta=t}},yb=class{constructor(e,t){me(this,"payload");me(this,"meta");me(this,"_type");this.payload=e,this.meta=t}},ZN=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of XN)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},Sb="External signal was aborted",xe=(()=>{function e(t,r,n){let o=k(t+"/fulfilled",(f,m,g,S)=>({payload:f,meta:{...(S||{}),arg:g,requestId:m,requestStatus:"fulfilled"}})),a=k(t+"/pending",(f,m,g)=>({payload:void 0,meta:{...(g||{}),arg:m,requestId:f,requestStatus:"pending"}})),i=k(t+"/rejected",(f,m,g,S,x)=>({payload:S,error:(n&&n.serializeError||ZN)(f||"Rejected"),meta:{...(x||{}),arg:g,requestId:m,rejectedWithValue:!!S,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"}}));function p(f,{signal:m}={}){return(g,S,x)=>{let h=n?.idGenerator?n.idGenerator(f):el(),C=new s.AbortController,b,w;function F(E){w=E,C.abort()}m&&(m.aborted?F(Sb):m.addEventListener("abort",()=>F(Sb),{once:!0}));let I=_asyncToGenerator(function*(){let E;try{let P=n?.condition?.(f,{getState:S,extra:x});if(tD(P)&&(P=yield P),P===!1||C.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let D=new Promise((G,Q)=>{b=()=>{Q({name:"AbortError",message:w||"Aborted"})},C.signal.addEventListener("abort",b,{once:!0})});g(a(h,f,n?.getPendingMeta?.({requestId:h,arg:f},{getState:S,extra:x}))),E=yield Promise.race([D,Promise.resolve(r(f,{dispatch:g,getState:S,extra:x,requestId:h,signal:C.signal,abort:F,rejectWithValue:(G,Q)=>new wS(G,Q),fulfillWithValue:(G,Q)=>new yb(G,Q)})).then(G=>{if(G instanceof wS)throw G;return G instanceof yb?o(G.payload,h,f,G.meta):o(G,h,f)})])}catch(P){E=P instanceof wS?i(null,h,f,P.payload,P.meta):i(P,h,f)}finally{b&&C.signal.removeEventListener("abort",b)}return n&&!n.dispatchConditionRejection&&i.match(E)&&E.meta.condition||g(E),E})();return Object.assign(I,{abort:F,requestId:h,arg:f,unwrap(){return I.then(eD)}})}}return Object.assign(p,{pending:a,rejected:i,fulfilled:o,settled:Zr(i,o),typePrefix:t})}return e.withTypes=()=>e,e})();function eD(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function tD(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var Fb=Symbol.for("rtk-slice-createasyncthunk"),A6={[Fb]:xe};function rD(e,t){return`${e}/${t}`}function nD({creators:e}={}){let t=e?.asyncThunk?.[Fb];return function(n){let{name:o,reducerPath:a=o}=n;if(!o)throw new Error(Jt(11));typeof process<"u";let i=(typeof n.reducers=="function"?n.reducers(aD()):n.reducers)||{},p=Object.keys(i),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(E,T){let P=typeof E=="string"?E:E.type;if(!P)throw new Error(Jt(12));if(P in f.sliceCaseReducersByType)throw new Error(Jt(13));return f.sliceCaseReducersByType[P]=T,m},addMatcher(E,T){return f.sliceMatchers.push({matcher:E,reducer:T}),m},exposeAction(E,T){return f.actionCreators[E]=T,m},exposeCaseReducer(E,T){return f.sliceCaseReducersByName[E]=T,m}};p.forEach(E=>{let T=i[E],P={reducerName:E,type:rD(o,E),createNotation:typeof n.reducers=="function"};sD(T)?uD(P,T,m,t):iD(P,T,m)});function g(){let[E={},T=[],P=void 0]=typeof n.extraReducers=="function"?wb(n.extraReducers):[n.extraReducers],D={...E,...f.sliceCaseReducersByType};return ae(n.initialState,G=>{for(let Q in D)G.addCase(Q,D[Q]);for(let Q of f.sliceMatchers)G.addMatcher(Q.matcher,Q.reducer);for(let Q of T)G.addMatcher(Q.matcher,Q.reducer);P&&G.addDefaultCase(P)})}let S=E=>E,x=new Map,h=new WeakMap,C;function b(E,T){return C||(C=g()),C(E,T)}function w(){return C||(C=g()),C.getInitialState()}function F(E,T=!1){function P(G){let Q=G[E];return typeof Q>"u"&&T&&(Q=$d(h,P,w)),Q}function D(G=S){let Q=$d(x,T,()=>new WeakMap);return $d(Q,G,()=>{let V={};for(let[U,j]of Object.entries(n.selectors??{}))V[U]=oD(j,G,()=>$d(h,G,w),T);return V})}return{reducerPath:E,getSelectors:D,get selectors(){return D(P)},selectSlice:P}}let I={name:o,reducer:b,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:w,...F(a),injectInto(E,{reducerPath:T,...P}={}){let D=T??a;return E.inject({reducerPath:D,reducer:b},P),{...I,...F(D,!0)}}};return I}}function oD(e,t,r,n){function o(a,...i){let p=t(a);return typeof p>"u"&&n&&(p=r()),e(p,...i)}return o.unwrapped=e,o}var va=nD();function aD(){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 iD({type:e,reducerName:t,createNotation:r},n,o){let a,i;if("reducer"in n){if(r&&!cD(n))throw new Error(Jt(17));a=n.reducer,i=n.prepare}else a=n;o.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,i?k(e,i):k(e))}function sD(e){return e._reducerDefinitionType==="asyncThunk"}function cD(e){return e._reducerDefinitionType==="reducerWithPrepare"}function uD({type:e,reducerName:t},r,n,o){if(!o)throw new Error(Jt(18));let{payloadCreator:a,fulfilled:i,pending:p,rejected:f,settled:m,options:g}=r,S=o(e,a,g);n.exposeAction(t,S),i&&n.addCase(S.fulfilled,i),p&&n.addCase(S.pending,p),f&&n.addCase(S.rejected,f),m&&n.addMatcher(S.settled,m),n.exposeCaseReducer(t,{fulfilled:i||Hd,pending:p||Hd,rejected:f||Hd,settled:m||Hd})}function Hd(){}var lD="task",Eb="listener",Ib="completed",ES="cancelled",dD=`task-${ES}`,pD=`task-${Ib}`,RS=`${Eb}-${ES}`,fD=`${Eb}-${Ib}`,Xd=class{constructor(e){me(this,"code");me(this,"name","TaskAbortError");me(this,"message");this.code=e,this.message=`${lD} ${ES} (reason: ${e})`}},IS=(e,t)=>{if(typeof e!="function")throw new TypeError(Jt(32))},zd=()=>{},Tb=(e,t=zd)=>(e.catch(t),e),Pb=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),ya=e=>{if(e.aborted)throw new Xd(e.reason)};function kb(e,t){let r=zd;return new Promise((n,o)=>{let a=()=>o(new Xd(e.reason));if(e.aborted){a();return}r=Pb(e,a),t.finally(()=>r()).then(n,o)}).finally(()=>{r=zd})}var mD=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof Xd?"cancelled":"rejected",error:r}}finally{t?.()}});return function mD(_x7,_x8){return _ref5.apply(this,arguments)}}(),Wd=e=>t=>Tb(kb(e,t).then(r=>(ya(e),r))),Ob=e=>{let t=Wd(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Bi}=Object,vb={},Zd="listenerMiddleware",gD=(e,t)=>{let r=n=>Pb(e,()=>n.abort(e.reason));return(n,o)=>{IS(n,"taskExecutor");let a=new s.AbortController;r(a);let i=mD(/*#__PURE__*/_asyncToGenerator(function*(){ya(e),ya(a.signal);let p=yield n({pause:Wd(a.signal),delay:Ob(a.signal),signal:a.signal});return ya(a.signal),p}),()=>a.abort(pD));return o?.autoJoin&&t.push(i.catch(zd)),{result:Wd(e)(i),cancel(){a.abort(dD)}}}},hD=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){ya(t);let a=()=>{},p=[new Promise((f,m)=>{let g=e({predicate:n,effect:(S,x)=>{x.unsubscribe(),f([S,x.getState(),x.getOriginalState()])}});a=()=>{g(),m()}})];o!=null&&p.push(new Promise(f=>setTimeout(f,o,null)));try{let f=yield kb(t,Promise.race(p));return ya(t),f}finally{a()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>Tb(r(n,o))},_b=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:a}=e;if(t)o=k(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(Jt(21));return IS(a,"options.listener"),{predicate:o,type:t,effect:a}},Nb=Bi(e=>{let{type:t,predicate:r,effect:n}=_b(e);return{id:el(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Jt(22))}}},{withTypes:()=>Nb}),Ab=(e,t)=>{let{type:r,effect:n,predicate:o}=_b(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===o)&&a.effect===n)},FS=e=>{e.pending.forEach(t=>{t.abort(RS)})},yD=(e,t)=>()=>{for(let r of t.keys())FS(r);e.clear()},Cb=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Db=Bi(k(`${Zd}/add`),{withTypes:()=>Db}),SD=k(`${Zd}/removeAll`),qb=Bi(k(`${Zd}/remove`),{withTypes:()=>qb}),vD=(...e)=>{console.error(`${Zd}/error`,...e)},Mb=(e={})=>{let t=new Map,r=new Map,n=h=>{let C=r.get(h)??0;r.set(h,C+1)},o=h=>{let C=r.get(h)??1;C===1?r.delete(h):r.set(h,C-1)},{extra:a,onError:i=vD}=e;IS(i,"onError");let p=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),C=>{h.unsubscribe(),C?.cancelActive&&FS(h)}),f=h=>{let C=Ab(t,h)??Nb(h);return p(C)};Bi(f,{withTypes:()=>f});let m=h=>{let C=Ab(t,h);return C&&(C.unsubscribe(),h.cancelActive&&FS(C)),!!C};Bi(m,{withTypes:()=>m});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,C,b,w){let F=new s.AbortController,I=hD(f,F.signal),E=[];try{h.pending.add(F),n(h),yield Promise.resolve(h.effect(C,Bi({},b,{getOriginalState:w,condition:(T,P)=>I(T,P).then(Boolean),take:I,delay:Ob(F.signal),pause:Wd(F.signal),extra:a,signal:F.signal,fork:gD(F.signal,E),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((T,P,D)=>{T!==F&&(T.abort(RS),D.delete(T))})},cancel:()=>{F.abort(RS),h.pending.delete(F)},throwIfCancelled:()=>{ya(F.signal)}})))}catch(T){T instanceof Xd||Cb(i,T,{raisedBy:"effect"})}finally{yield Promise.all(E),F.abort(fD),o(h),h.pending.delete(F)}});return function g(_x1,_x10,_x11,_x12){return _ref8.apply(this,arguments)}}(),S=yD(t,r);return{middleware:h=>C=>b=>{if(!Mu(b))return C(b);if(Db.match(b))return f(b.payload);if(SD.match(b)){S();return}if(qb.match(b))return m(b.payload);let w=h.getState(),F=()=>{if(w===vb)throw new Error(Jt(23));return w},I;try{if(I=C(b),t.size>0){let E=h.getState(),T=Array.from(t.values());for(let P of T){let D=!1;try{D=P.predicate(b,E,w)}catch(G){D=!1,Cb(i,G,{raisedBy:"predicate"})}D&&g(P,b,h,F)}}}finally{w=vb}return I},startListening:f,stopListening:m,clearListeners:S}};function Jt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}d();c();l();u();d();c();l();u();d();c();l();u();function Vb(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}d();c();l();u();d();c();l();u();d();c();l();u();var jb=/^(?:[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 AD(e){return typeof e=="string"&&jb.test(e)}var TS=AD;d();c();l();u();var Ot=[];for(let e=0;e<256;++e)Ot.push((e+256).toString(16).slice(1));function Lb(e,t=0){return(Ot[e[t+0]]+Ot[e[t+1]]+Ot[e[t+2]]+Ot[e[t+3]]+"-"+Ot[e[t+4]]+Ot[e[t+5]]+"-"+Ot[e[t+6]]+Ot[e[t+7]]+"-"+Ot[e[t+8]]+Ot[e[t+9]]+"-"+Ot[e[t+10]]+Ot[e[t+11]]+Ot[e[t+12]]+Ot[e[t+13]]+Ot[e[t+14]]+Ot[e[t+15]]).toLowerCase()}d();c();l();u();var CD=new Uint8Array(16);function PS(){return crypto.getRandomValues(CD)}d();c();l();u();function xD(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():bD(e,t,r)}function bD(e,t,r){e=e||{};let n=e.random??e.rng?.()??PS();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 Lb(n)}var kS=xD;function wD(_x13){return _wD.apply(this,arguments)}function _wD(){_wD=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:a,mode:i}=e;if(i!=="disabled")return n.call(r),t.send(o,a,r)});return _wD.apply(this,arguments)}var Hb="2.1.3",OS=128,zb=192,Ub=224,Qb=240,RD=248;function FD(e){return(e&RD)===Qb?4:(e&Qb)===Ub?3:(e&Ub)===zb?2:1}function ED(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&OS)!=OS)break;if(r-=3,(n&zb)!=OS){t-r>=FD(n)*3&&(r=t);break}}return e.substring(0,r)}function ID(e){let{trackingId:t}=e;return{trackingId:t}}function TD(e){return(e.source||[]).concat([`relay@${Hb}`])}function Wb(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:a}=r,i=ID(t),p=r.getClientId();return Object.freeze({type:e,config:i,ts:Date.now(),source:TD(t),clientId:p,userAgent:a(),referrer:Bb(n()),location:Bb(o())})}function Bb(e){return e!==null?ED(e,1024):null}function PD(e,t,r,n){return{...t,meta:Wb(e,r,n)}}var kD="*";function OD(){let e=[];function t({type:f,callback:m}){return e.findIndex(g=>g.type===f&&g.callback===m)}function r(f,m){return f.type==="*"||m===f.type}function n(f){return t(f)<0&&e.push(f),()=>p(f.type,f.callback)}function o(f){e.forEach(m=>{if(r(m,f.meta.type))try{m.callback(f)}catch(g){console.error(g)}})}function a(f){if(f===kD)e.length=0;else for(let m=e.length-1;m>=0;m--)e[m].type===f&&e.splice(m,1)}function i(f){let m=t(f);m>=0&&e.splice(m,1)}function p(f,m){m?i({type:f,callback:m}):a(f)}return{add:n,call:o,remove:p}}function Gb({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 _D(e){let t=Gb(e);return{get:()=>t,update:r=>{t=Gb({...t,...r})}}}var _S=ND();function ND(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,o=document.cookie.split(";");for(let a of o){let i=a.replace(/^\s+/,"");if(i.lastIndexOf(n,0)===0)return i.substring(n.length,i.length)}return null},setItem(r,n,o){let a=t(window.location.hostname),i=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,p=a?`;domain=${a}`:"";document.cookie=`${e}${r}=${n}${i}${p};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function DD(){return{getItem(e){return _S.getItem(e)||localStorage.getItem(e)},removeItem(e){_S.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),_S.setItem(e,t,31556952e3)}}}var $b="visitorId";function qD(){let e=document.referrer;return e===""?null:e}function NS(){let e=DD();return{runtime:"browser",send:function(){var _ref9=_asyncToGenerator(function*(t,r,n){let o=v(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});Vb().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let i=yield o;if(i?.ok){let p;try{p=yield i.json()}catch{return}for(let f of p.events)if(!f.accepted)throw new Error(`Received event was rejected for processing: ${f.errorMessage}`)}else throw new Error(`Error ${i.status}: Failed to send the event(s).`)});return function send(_x14,_x15,_x16){return _ref9.apply(this,arguments)}}(),getReferrer:()=>qD(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem($b);if(t&&TS(t))return t;let r=kS();return e.setItem($b,r),r}}}function MD(){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 VD(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function jD(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=VD();return t&&r?{...r,runtime:"custom"}:t&&LD()&&MD()?NS():n}function LD(){try{return typeof window=="object"}catch{return!1}}function UD(e){return{get:()=>Object.freeze(jD(e))}}function Kb(e){let t=_D(e),r=OD(),n=UD(t);return{emit:function(){var _ref0=_asyncToGenerator(function*(o,a){let i=t.get(),p=n.get(),f=PD(o,a,i,p);return wD({config:i,environment:p,event:f,listenerManager:r})});return function emit(_x17,_x18){return _ref0.apply(this,arguments)}}(),getMeta:o=>Wb(o,t.get(),n.get()),on:(o,a)=>r.add({type:o,callback:a}),off:(o,a)=>r.remove(o,a),updateConfig:o=>t.update(o),version:Hb}}d();c();l();u();function Yb(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var Ao="3.55.3",Jb=["@coveo/atomic","@coveo/quantic"];var Hi=tt(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Ao}`));var tl=tt(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Hi(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:a},i,p)=>{let f=BD(p);return Kb({mode:a?"emit":"disabled",url:o??Rd(e,t),token:r,trackingId:n??null,source:i,environment:f})}),QD={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref1=_asyncToGenerator(function*(){});return function send(){return _ref1.apply(this,arguments)}}()},BD=e=>{if(!e)return;let t=e();return{...(Yb()?NS():QD),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};d();c();l();u();d();c();l();u();function Kn(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function B(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{m(n.next(g))}catch(S){i(S)}}function f(g){try{m(n.throw(g))}catch(S){i(S)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}var _e;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(_e||(_e={}));function MS(){return typeof window<"u"}function YS(){return typeof navigator<"u"}function zi(){return typeof document<"u"}function VS(){try{return typeof localStorage<"u"}catch{return!1}}function GD(){try{return typeof sessionStorage<"u"}catch{return!1}}function lw(){return YS()&&navigator.cookieEnabled}var $D=[_e.click,_e.custom,_e.search,_e.view],HD=(e,t)=>$D.indexOf(e)!==-1?Object.assign({language:zi()?document.documentElement.lang:"unknown",userAgent:YS()?navigator.userAgent:"unknown"},t):t,nl=class e{static set(t,r,n){var o,a,i,p;n&&(a=new Date,a.setTime(a.getTime()+n)),p=window.location.hostname,p.indexOf(".")===-1?Xb(t,r,a):(i=p.split("."),o=i[i.length-2]+"."+i[i.length-1],Xb(t,r,a,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var a=n[o];if(a=a.replace(/^\s+/,""),a.lastIndexOf(r,0)===0)return a.substring(r.length,a.length)}return null}static erase(t){e.set(t,"",-1)}};function Xb(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function zD(){return VS()?localStorage:lw()?new ol:GD()?sessionStorage:new Ki}var ol=class e{getItem(t){return nl.get(`${e.prefix}${t}`)}removeItem(t){nl.erase(`${e.prefix}${t}`)}setItem(t,r,n){nl.set(`${e.prefix}${t}`,r,n)}};ol.prefix="coveo_";var jS=class{constructor(){this.cookieStorage=new ol}getItem(t){return localStorage.getItem(t)||this.cookieStorage.getItem(t)}removeItem(t){this.cookieStorage.removeItem(t),localStorage.removeItem(t)}setItem(t,r){localStorage.setItem(t,r),this.cookieStorage.setItem(t,r,31556926e3)}},Ki=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},ep="__coveo.analytics.history",WD=20,KD=1e3*60,YD=75,rp=class{constructor(t){this.store=t||zD()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){return B(this,void 0,void 0,function*(){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=yield this.getHistoryWithInternalTimeAsync();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])})}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){return B(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(ep);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return B(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(ep);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(ep,JSON.stringify(t.slice(0,WD)))}catch{}}clear(){try{this.store.removeItem(ep)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,YD)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>KD:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:a}=r;return{name:n,time:o,value:a}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var JD=(e,t)=>B(void 0,void 0,void 0,function*(){return e===_e.view?(yield XD(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),XD=e=>B(void 0,void 0,void 0,function*(){let t=new rp,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),ZD=/^(?:[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 np(e){return typeof e=="string"&&ZD.test(e)}function Zb(e){if(!np(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var _t=[];for(let e=0;e<256;++e)_t.push((e+256).toString(16).slice(1));function dw(e,t=0){return(_t[e[t+0]]+_t[e[t+1]]+_t[e[t+2]]+_t[e[t+3]]+"-"+_t[e[t+4]]+_t[e[t+5]]+"-"+_t[e[t+6]]+_t[e[t+7]]+"-"+_t[e[t+8]]+_t[e[t+9]]+"-"+_t[e[t+10]]+_t[e[t+11]]+_t[e[t+12]]+_t[e[t+13]]+_t[e[t+14]]+_t[e[t+15]]).toLowerCase()}var eq=new Uint8Array(16);function tq(){return crypto.getRandomValues(eq)}function rq(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 nq="6ba7b810-9dad-11d1-80b4-00c04fd430c8",oq="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function aq(e,t,r,n,o,a){let i=typeof r=="string"?rq(r):r,p=typeof n=="string"?Zb(n):n;if(typeof n=="string"&&(n=Zb(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let f=new Uint8Array(16+i.length);return f.set(p),f.set(i,p.length),f=t(f),f[6]=f[6]&15|e,f[8]=f[8]&63|128,dw(f)}function Aa(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():iq(e,t,r)}function iq(e,t,r){e=e||{};let n=e.random??e.rng?.()??tq();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 dw(n)}function sq(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 DS(e,t){return e<<t|e>>>32-t}function cq(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,a=Math.ceil(o/16),i=new Array(a);for(let p=0;p<a;++p){let f=new Uint32Array(16);for(let m=0;m<16;++m)f[m]=e[p*64+m*4]<<24|e[p*64+m*4+1]<<16|e[p*64+m*4+2]<<8|e[p*64+m*4+3];i[p]=f}i[a-1][14]=(e.length-1)*8/2**32,i[a-1][14]=Math.floor(i[a-1][14]),i[a-1][15]=(e.length-1)*8&4294967295;for(let p=0;p<a;++p){let f=new Uint32Array(80);for(let C=0;C<16;++C)f[C]=i[p][C];for(let C=16;C<80;++C)f[C]=DS(f[C-3]^f[C-8]^f[C-14]^f[C-16],1);let m=r[0],g=r[1],S=r[2],x=r[3],h=r[4];for(let C=0;C<80;++C){let b=Math.floor(C/20),w=DS(m,5)+sq(b,g,S,x)+h+t[b]+f[C]>>>0;h=x,x=S,S=DS(g,30)>>>0,g=m,m=w}r[0]=r[0]+m>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+S>>>0,r[3]=r[3]+x>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function op(e,t,r,n){return aq(80,cq,e,t)}op.DNS=nq;op.URL=oq;var pw="2.33.0",ew=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,rl={pageview:"pageview",event:"event"},ap=class{constructor({client:t,uuidGenerator:r=Aa}){this.client=t,this.uuidGenerator=r}},LS=class extends ap{constructor({client:t,uuidGenerator:r=Aa}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=ew(window.location),this.lastReferrer=zi()?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:zi()?document.title:"",encoding:zi()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},a={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},a),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:a}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=a,t===rl.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===rl.pageview?this.nextPageViewId:this.pageViewId,referrer:t===rl.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===rl.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=o=>o.replace(/^\/?(.*)$/,"/$1");return`${(o=>o.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return ew(window.location)}},Co=class e{constructor(t,r){if(!np(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(r/1e3)}toString(){return this.clientId.replace(/-/g,"")+"."+this.creationDate.toString()}get expired(){let t=Math.floor(Date.now()/1e3)-this.creationDate;return t<0||t>e.expirationTime}validate(t,r){return!this.expired&&this.matchReferrer(t,r)}matchReferrer(t,r){try{let n=new URL(t);return r.some(o=>new RegExp(o.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(n.host))}catch{return!1}}static fromString(t){let r=t.split(".");if(r.length!==2)return null;let[n,o]=r;if(n.length!==32||isNaN(parseInt(o)))return null;let a=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return np(a)?new e(a,Number.parseInt(o)*1e3):null}};Co.cvo_cid="cvo_cid";Co.expirationTime=120;var US=class extends ap{constructor({client:t,uuidGenerator:r=Aa}){super({client:t,uuidGenerator:r})}getApi(t){switch(t){case"decorate":return this.decorate;case"acceptFrom":return this.acceptFrom;default:return null}}decorate(t){return B(this,void 0,void 0,function*(){if(!this.client.getCurrentVisitorId)throw new Error("Could not retrieve current clientId");try{let r=new URL(t),n=yield this.client.getCurrentVisitorId();return r.searchParams.set(Co.cvo_cid,new Co(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};US.Id="link";var Sr=Object.keys;function tp(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var qS=128,fw=192,tw=224,rw=240;function uq(e){return(e&248)===rw?4:(e&rw)===tw?3:(e&tw)===fw?2:1}function lq(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&qS)!=qS)break;if(r-=3,(n&fw)!=qS){t-r>=uq(n)*3&&(r=t);break}}return e.substring(0,r)}var QS={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"},dq=Sr(QS).map(e=>QS[e]),pq=[...dq].join("|"),fq=new RegExp(`^(${pq}$)`),mq={svcAction:"svc_action",svcActionData:"svc_action_data"},gq=e=>Sr(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=QS[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),hq=e=>fq.test(e),yq=[hq],nw={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},ow={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},jt={action:"pa",list:"pal",listSource:"pls"},ip={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},Sq=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],BS={id:"quoteId",affiliation:"quoteAffiliation"},GS={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},vq={add:jt,bookmark_add:jt,bookmark_remove:jt,click:jt,checkout:jt,checkout_option:jt,detail:jt,impression:jt,remove:jt,refund:Object.assign(Object.assign({},jt),ip),purchase:Object.assign(Object.assign({},jt),ip),quickview:jt,quote:Object.assign(Object.assign({},jt),BS),review:Object.assign(Object.assign({},jt),GS)},Aq=Sr(nw).map(e=>nw[e]),Cq=Sr(ow).map(e=>ow[e]),xq=Sr(jt).map(e=>jt[e]),bq=Sr(ip).map(e=>ip[e]),wq=Sr(GS).map(e=>GS[e]),Rq=Sr(BS).map(e=>BS[e]),Fq=[...Aq,"custom"].join("|"),Eq=[...Cq,"custom"].join("|"),mw="(pr[0-9]+)",gw="(il[0-9]+pi[0-9]+)",Iq=new RegExp(`^${mw}(${Fq})$`),Tq=new RegExp(`^(${gw}(${Eq}))|(il[0-9]+nm)$`),Pq=new RegExp(`^(${xq.join("|")})$`),kq=new RegExp(`^(${bq.join("|")})$`),Oq=new RegExp(`^${mw}custom$`),_q=new RegExp(`^${gw}custom$`),Nq=new RegExp(`^(${[...Sq,...wq,...Rq].join("|")})$`),Dq=e=>Iq.test(e),qq=e=>Tq.test(e),Mq=e=>Pq.test(e),Vq=e=>kq.test(e),jq=e=>Nq.test(e),Lq=[qq,Dq,Mq,Vq,jq],Uq=[Oq,_q],Qq={anonymizeIp:"aip"},Bq={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},Gq={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},$q=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],Hq=Object.assign(Object.assign(Object.assign(Object.assign({},Qq),Bq),Gq),$q.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),$S=Object.assign(Object.assign({},Hq),mq),zq=e=>{let t=!!e.action&&vq[e.action]||{};return Sr(e).reduce((r,n)=>{let o=t[n]||$S[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},Wq=Sr($S).map(e=>$S[e]),Kq=e=>Wq.indexOf(e)!==-1,Yq=e=>e==="custom",Jq=e=>[...Lq,...yq,Kq,Yq].some(t=>t(e)),Xq=e=>Sr(e).reduce((t,r)=>{let n=Zq(r);return n?Object.assign(Object.assign({},t),eM(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),Zq=e=>{let t;return[...Uq].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},eM=(e,t)=>Sr(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),HS=class{constructor(t){this.opts=t}sendEvent(t,r){return B(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:o}=this.opts,a=yield this.getQueryParamsForEventType(t),{url:i,payload:p}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${a}`,r,o),f=this.encodeForEventType(t,p),m=new Blob([f],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(i,m)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return B(this,void 0,void 0,function*(){let o=t,a=r;if(n){let i=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:p,body:f}=i;o=p||t;try{a=JSON.parse(f)}catch(m){console.error("Unable to process the request body as a JSON string",m)}}return{payload:a,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return B(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(a=>!!a).join("&")})}isEventTypeLegacy(t){return[_e.click,_e.custom,_e.search,_e.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let o=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(o=`access_token=${encodeURIComponent(n)}&${o}`),o}},zS=class{sendEvent(t,r){return B(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return B(this,void 0,void 0,function*(){return Promise.resolve()})}},aw=y.fetch,sp=class{constructor(t){this.opts=t}sendEvent(t,r){return B(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:a}=this.opts,i=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",p={url:`${n}/analytics/${t}${i}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},f=Object.assign(Object.assign({},p),a?yield a(p,"analyticsFetch"):{}),{url:m}=f,g=Kn(f,["url"]),S;try{S=yield aw(m,g)}catch(x){console.error("An error has occurred when sending the event.",x);return}if(S.ok){let x=yield S.json();return x.visitorId&&o.setCurrentVisitorId(x.visitorId),x}else{try{S.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,S,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return B(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield aw(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[_e.click,_e.custom,_e.search,_e.view].indexOf(t)!==-1}getVisitorIdParam(){return B(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,r=yield t.getCurrentVisitorId();return r?`?visitor=${r}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},WS=class{constructor(t,r){VS()&&lw()?this.storage=new jS:VS()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Ki),this.client=new sp(t),this.beaconClient=new HS(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:a}of n)this.beaconClient.sendEvent(o,a)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},KS=class{constructor(t,r){this.storage=r||new Ki,this.client=new sp(t)}getClientDependingOnEventType(t){return this.client}},cp=class{constructor(){this.storage=new Ki,this.client=new zS}getClientDependingOnEventType(t){return this.client}},tM="xx",rM=e=>e?.startsWith(tM)||!1,nM=`
28
+ ${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":x_(g,n,t);break}}}}function x_(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function b_(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function gx(){return{data:"",event:"",id:"",retry:void 0}}var Jy="text/event-stream",w_=1e3,vx="last-event-id";function Ax(){return typeof window<"u"}function Cd(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:a,onerror:i,openWhenHidden:p,fetch:f,...m}){return new Promise((g,S)=>{let x={...r};x.accept||(x.accept=Jy);let h;function C(){h?.abort(),document.hidden||T()}!p&&Ax()&&document.addEventListener("visibilitychange",C);let b=w_,w;function F(){Ax()&&document.removeEventListener("visibilitychange",C),clearTimeout(w),h?.abort()}t?.addEventListener("abort",()=>{F(),g()});let I=f??v,E=n??R_;function T(){return _T2.apply(this,arguments)}function _T2(){_T2=_asyncToGenerator(function*(){h=s.AbortController?new s.AbortController:null;try{let P=yield I(e,{...m,headers:x,signal:h?.signal});yield E(P),yield hx(P.body,yx(Sx(D=>{D?x[vx]=D:delete x[vx]},D=>{b=D},o))),a?.(),F(),g()}catch(P){if(!h?.signal?.aborted)try{let D=i?.(P)??b;clearTimeout(w),w=setTimeout(T,D)}catch(D){F(),S(D)}}});return _T2.apply(this,arguments)}T()})}function R_(e){let t=e.headers.get("content-type");if(!t?.startsWith(Jy))throw new Error(`Expected content-type to be ${Jy}, Actual: ${t}`)}d();c();l();u();var ho=class{constructor(t){me(this,"_basePath");me(this,"_params",{});this._basePath=t}addParam(t,r){this._params={...this.params,[t]:r}}get basePath(){return this._basePath}get params(){return this._params}get hasParams(){return Object.entries(this._params).length}get href(){return this.hasParams?`${this.basePath}?${Object.entries(this.params).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}`:this.basePath}};var F_=(e,t,r)=>new ho(`${e}/rest/organizations/${t}/machinelearning/streaming/${r}`).href,Cx=3,E_=5e3,I_="text/event-stream",eS=1,Xy=class extends Error{},_u=class extends Error{constructor(r){super(r.message);me(this,"payload",r)}},Zy=class{constructor(){me(this,"timeouts",new Set)}add(t){this.timeouts.add(t)}remove(t){clearTimeout(t),this.timeouts.delete(t)}isActive(t){return this.timeouts.has(t)}},xd=class{constructor(t){me(this,"logger");this.logger=t.logger}streamGeneratedAnswer(t,r){let{url:n,organizationId:o,streamId:a,accessToken:i}=t,{write:p,abort:f,close:m,resetAnswer:g}=r,S=new Zy;if(!a){this.logger.error("No stream ID found");return}let x=0,h,C=()=>{h&&!S.isActive(h)&&(w?.abort(),g(),F())},b=()=>{S.remove(h),h=mx(C,h,E_),S.add(h)},w=new s.AbortController,F=()=>Cd(F_(n,o,a),{method:"GET",fetch:v,headers:{Authorization:`Bearer ${i}`,accept:"*/*"},openWhenHidden:!0,signal:w?.signal,onopen(I){return _asyncToGenerator(function*(){if(I.ok&&I.headers.get("content-type")===I_)return;throw I.status>=400&&I.status<500&&I.status!==429?new _u({message:"Error opening stream",code:I.status}):new Xy})()},onmessage:I=>{if(w?.signal.aborted)return;let E=JSON.parse(I.data);if(E.finishReason==="ERROR"){S.remove(h),w?.abort(),f({message:E.errorMessage,code:E.statusCode});return}p(E),x=0,E.finishReason==="COMPLETED"?(S.remove(h),m()):b()},onerror:I=>{if(!w?.signal.aborted){if(S.remove(h),I instanceof _u)throw w?.abort(),f(I),I;if(++x>Cx){this.logger.info("Maximum retry exceeded.");let E={message:"Failed to complete stream.",code:eS};throw w?.abort(),f(E),new _u(E)}this.logger.info(`Retrying...(${x}/${Cx})`),g()}}});return F(),w}};d();c();l();u();var bd=e=>e;d();c();l();u();d();c();l();u();function Mi(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function ir(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Mi(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Mi(),extendedResults:{},searchAction:void 0}}d();c();l();u();function yo(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...a}=e;return a}var So=e=>{let{response:t}=e;return t.body?T_(e):P_(t)},T_=e=>O_(e)?__(e):k_(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},P_=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function k_(e){return e.body.statusCode!==void 0}function O_(e){return e.body.exception!==void 0}var __=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});d();c();l();u();var _x=jr(Tx(),1);d();c();l();u();var K=new Error("Failed to load reducers."),Vi=class extends Error{constructor(){super(),this.name="UnauthorizedTokenError",this.message="The token being used to perform the request is unauthorized. It may be expired or invalid."}},da=class extends Error{constructor(r,n){super();me(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};d();c();l();u();function Px(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function kx(e){return typeof e!="object"||!e?!1:Object.values(e).every(aN)}function aN(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Ox(e){return e===429}var Lr=class e{static call(t){return _asyncToGenerator(function*(){let r=iN(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:a,...i}=o,p=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let f=yield v(a,i);if(Ox(f.status))throw f;return f});return function p(){return _ref.apply(this,arguments)}}();try{let f=yield(0,_x.backOff)(p,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(m){let g=m&&Ox(m.status);return g&&(n.info("Platform retrying request"),yield new Promise(S=>setTimeout(S,1e3))),g});return function retry(_x4){return _ref2.apply(this,arguments)}}()});switch(f.status){case 419:case 401:throw n.info("Platform renewing token"),new Vi;case 404:throw new da(a,f.status);default:return n.info({response:f,requestInfo:o},"Platform response"),f}}catch(f){return f.message==="Failed to fetch"?new da(a):f}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:a,requestMetadata:i}=r,{signal:p,...f}=t,m=Ou(f);try{let g=yield o(t,n,i);return{...t,...g}}catch(g){a.error(g,"Platform request preprocessing failed. Returning default request options.")}return m})()}};function gr(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function ji(e,t,r="prod"){return e??gr(t,r)}function vt(e,t="prod"){return`${gr(e,t)}/rest/search/v2`}function Rd(e,t="prod"){return`${gr(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function iN(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:a,signal:i}=e,p=e.method==="POST"||e.method==="PUT",f=sN(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${a}`,...e.headers},...(p&&{body:f}),signal:i}}function sN(e,t){return t==="application/x-www-form-urlencoded"?kx(e)?Px(e):"":JSON.stringify(e)}d();c();l();u();var vo=class{constructor(){me(this,"currentAbortController",null)}enqueue(t,r){var _this=this;return _asyncToGenerator(function*(){let n=_this.currentAbortController;_this.currentAbortController=new s.AbortController;let o=_this.currentAbortController;n&&(r.warnOnAbort&&r.logger.warn("Cancelling current pending search query"),n.abort());try{return yield t(o?.signal??null)}finally{_this.currentAbortController===o&&(_this.currentAbortController=null)}})()}};d();c();l();u();d();c();l();u();function Nx(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}d();c();l();u();var Gn=(e,t,r,n)=>{let o=new ho(`${e.url}${n}`);return o.addParam("organizationId",e.organizationId),e.authentication&&o.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:o.href,origin:"searchApiFetch"}};var Dx=(e,t)=>{let r=new ho(`${e.url}${t}`);return r.addParam("access_token",e.accessToken),r.addParam("organizationId",e.organizationId),r.addParam("uniqueId",e.uniqueId),e.authentication&&r.addParam("authentication",e.authentication),e.q!==void 0&&r.addParam("q",e.q),e.enableNavigation!==void 0&&r.addParam("enableNavigation",`${e.enableNavigation}`),e.requestedOutputSize!==void 0&&r.addParam("requestedOutputSize",`${e.requestedOutputSize}`),r.href},qx=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Lr.call({...Gn(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:yo(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Nx(r),o=yield r.arrayBuffer(),i=new TextDecoder(n).decode(o);return cN(i)?{success:i}:{error:So({response:r,body:i})}});return function qx(_x5,_x6){return _ref3.apply(this,arguments)}}();function cN(e){return typeof e=="string"}d();c();l();u();function uN(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function lN(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Fd(e,t){if(t&&e.name==="AbortError")return{error:lN(e)};if(e instanceof da)return{error:uN(e)};throw e}var Ed=class{constructor(t){me(this,"options",t);me(this,"apiCallsQueues",{unknown:new vo,mainSearch:new vo,facetValues:new vo,foldingCollection:new vo,instantResults:new vo})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...Gn(t,"POST","application/json","/plan"),requestParams:yo(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return Fd(r);let n=yield r.json();return pN(n)?{success:n}:{error:So({response:r,body:n})}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...Gn(t,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:yo(t),..._this3.options});if(r instanceof Error)return Fd(r);let n=yield r.json(),o={response:r,body:n};return dN(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:So(o)}})()}search(t,r){var _this4=this;return _asyncToGenerator(function*(){let n=r?.origin??"unknown",o=yield _this4.apiCallsQueues[n].enqueue(p=>Lr.call({...Gn(t,"POST","application/json",""),requestParams:yo(t),requestMetadata:{method:"search",origin:r?.origin},..._this4.options,signal:p??void 0}),{logger:_this4.options.logger,warnOnAbort:!r?.disableAbortWarning});if(o instanceof Error)return Fd(o,r?.disableAbortWarning);let a=yield o.json(),i={response:o,body:a};return Mx(a)?(i.body=Vx(a),{success:(yield _this4.options.postprocessSearchResponseMiddleware(i)).body}):{error:So(i)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...Gn(t,"POST","application/json","/facet"),requestParams:yo(t),requestMetadata:{method:"facetSearch"},..._this5.options});if(r instanceof Error)throw r;let n=yield r.json(),o={response:r,body:n};return(yield _this5.options.postprocessFacetSearchResponseMiddleware(o)).body})()}recommendations(t){var _this6=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...Gn(t,"POST","application/json",""),requestParams:yo(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if(Mx(n)){let o={response:r,body:n};return o.body=Vx(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:So({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return qx(t,{..._this7.options})})()}fieldDescriptions(t){var _this8=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...Gn(t,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},..._this8.options});if(r instanceof Error)throw r;let n=yield r.json();return fN(n)?{success:n}:{error:So({response:r,body:n})}})()}},Id=e=>e.success!==void 0,At=e=>e.error!==void 0;function Mx(e){return e.results!==void 0}function Vx(e){let t=Mi();return pe(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function dN(e){return e.completions!==void 0}function pN(e){return e.preprocessingOutput!==void 0}function fN(e){return e.fields!==void 0}d();c();l();u();var jx=e=>e,Lx=e=>e,Ux=e=>e;d();c();l();u();d();c();l();u();var z=new L({required:!0,emptyAllowed:!1}),st=new L({required:!1,emptyAllowed:!1}),Ge=new L({required:!0,emptyAllowed:!0}),qK=new L({required:!1,emptyAllowed:!0}),Td=new se({each:z,required:!0}),Qx=new L({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Bx=new L({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),MK=new L({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),$n=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),hr=(e,t)=>{if("required"in t)return{payload:new ve({value:t}).validate({value:e}).value};let o=new X({options:{required:!0},values:t}).validate(e);if(o)throw new Pu(o);return{payload:e}},O=(e,t)=>{try{return hr(e,t)}catch(r){return{payload:e,error:$n(r)}}},lt=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return Gx(e,t,r,o,"Controller initialization error")},He=(e,t,r,n)=>{let o=`Check the options of ${n}`;return Gx(e,t,r,o,"Controller initialization error")},Gx=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(a){throw e.logger.error(a,o),a}};d();c();l();u();d();c();l();u();d();c();l();u();function Pt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var mN=typeof Symbol=="function"&&Symbol.observable||"@@observable",$x=mN,uS=()=>Math.random().toString(36).substring(7).split("").join("."),gN={INIT:`@@redux/INIT${uS()}`,REPLACE:`@@redux/REPLACE${uS()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${uS()}`},Pd=gN;function Xr(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function lS(e,t,r){if(typeof e!="function")throw new Error(Pt(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Pt(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Pt(1));return r(lS)(e,t)}let n=e,o=t,a=new Map,i=a,p=0,f=!1;function m(){i===a&&(i=new Map,a.forEach((w,F)=>{i.set(F,w)}))}function g(){if(f)throw new Error(Pt(3));return o}function S(w){if(typeof w!="function")throw new Error(Pt(4));if(f)throw new Error(Pt(5));let F=!0;m();let I=p++;return i.set(I,w),function(){if(F){if(f)throw new Error(Pt(6));F=!1,m(),i.delete(I),a=null}}}function x(w){if(!Xr(w))throw new Error(Pt(7));if(typeof w.type>"u")throw new Error(Pt(8));if(typeof w.type!="string")throw new Error(Pt(17));if(f)throw new Error(Pt(9));try{f=!0,o=n(o,w)}finally{f=!1}return(a=i).forEach(I=>{I()}),w}function h(w){if(typeof w!="function")throw new Error(Pt(10));n=w,x({type:Pd.REPLACE})}function C(){let w=S;return{subscribe(F){if(typeof F!="object"||F===null)throw new Error(Pt(11));function I(){let T=F;T.next&&T.next(g())}return I(),{unsubscribe:w(I)}},[$x](){return this}}}return x({type:Pd.INIT}),{dispatch:x,subscribe:S,getState:g,replaceReducer:h,[$x]:C}}function hN(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Pd.INIT})>"u")throw new Error(Pt(12));if(typeof r(void 0,{type:Pd.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Pt(13))})}function Li(e){let t=Object.keys(e),r={};for(let i=0;i<t.length;i++){let p=t[i];typeof e[p]=="function"&&(r[p]=e[p])}let n=Object.keys(r),o,a;try{hN(r)}catch(i){a=i}return function(p={},f){if(a)throw a;let m=!1,g={};for(let S=0;S<n.length;S++){let x=n[S],h=r[x],C=p[x],b=h(C,f);if(typeof b>"u"){let w=f&&f.type;throw new Error(Pt(14))}g[x]=b,m=m||b!==C}return m=m||n.length!==Object.keys(p).length,m?g:p}}function qu(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Hx(...e){return t=>(r,n)=>{let o=t(r,n),a=()=>{throw new Error(Pt(15))},i={getState:o.getState,dispatch:(f,...m)=>a(f,...m)},p=e.map(f=>f(i));return a=qu(...p)(o.dispatch),{...o,dispatch:a}}}function Mu(e){return Xr(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var vS=Symbol.for("immer-nothing"),Vu=Symbol.for("immer-draftable"),ht=Symbol.for("immer-state");function kt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var sr=Object,fa=sr.getPrototypeOf,ju="constructor",Gu="prototype",fS="configurable",Nd="enumerable",Od="writable",Lu="value",Yt=e=>!!e&&!!e[ht];function Vt(e){return e?eb(e)||Hu(e)||!!e[Vu]||!!e[ju]?.[Vu]||zu(e)||Wu(e):!1}var yN=sr[Gu][ju].toString(),zx=new WeakMap;function eb(e){if(!e||!Qi(e))return!1;let t=fa(e);if(t===null||t===sr[Gu])return!0;let r=sr.hasOwnProperty.call(t,ju)&&t[ju];if(r===Object)return!0;if(!pa(r))return!1;let n=zx.get(r);return n===void 0&&(n=Function.toString.call(r),zx.set(r,n)),n===yN}function tb(e){return Yt(e)||kt(15,e),e[ht].base_}function $u(e,t,r=!0){ma(e)===0?(r?Reflect.ownKeys(e):sr.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function ma(e){let t=e[ht];return t?t.type_:Hu(e)?1:zu(e)?2:Wu(e)?3:0}var Ui=(e,t,r=ma(e))=>r===2?e.has(t):sr[Gu].hasOwnProperty.call(e,t),Hn=(e,t,r=ma(e))=>r===2?e.get(t):e[t],Dd=(e,t,r,n=ma(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function SN(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Hu=Array.isArray,zu=e=>e instanceof Map,Wu=e=>e instanceof Set,Qi=e=>typeof e=="object",pa=e=>typeof e=="function",dS=e=>typeof e=="boolean";function vN(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var AN=e=>Qi(e)?e?.[ht]:null,zn=e=>e.copy_||e.base_;var AS=e=>e.modified_?e.copy_:e.base_;function mS(e,t){if(zu(e))return new Map(e);if(Wu(e))return new Set(e);if(Hu(e))return Array[Gu].slice.call(e);let r=eb(e);if(t===!0||t==="class_only"&&!r){let n=sr.getOwnPropertyDescriptors(e);delete n[ht];let o=Reflect.ownKeys(n);for(let a=0;a<o.length;a++){let i=o[a],p=n[i];p[Od]===!1&&(p[Od]=!0,p[fS]=!0),(p.get||p.set)&&(n[i]={[fS]:!0,[Od]:!0,[Nd]:p[Nd],[Lu]:e[i]})}return sr.create(fa(e),n)}else{let n=fa(e);if(n!==null&&r)return{...e};let o=sr.create(n);return sr.assign(o,e)}}function CS(e,t=!1){return Ud(e)||Yt(e)||!Vt(e)||(ma(e)>1&&sr.defineProperties(e,{set:kd,add:kd,clear:kd,delete:kd}),sr.freeze(e),t&&$u(e,(r,n)=>{CS(n,!0)},!1)),e}function CN(){kt(2)}var kd={[Lu]:CN};function Ud(e){return e===null||!Qi(e)?!0:sr.isFrozen(e)}var qd="MapSet",Md="Patches",Wx="ArrayMethods",Vd={};function ga(e){let t=Vd[e];return t||kt(0,e),t}var Kx=e=>!!Vd[e];function xN(e,t){Vd[e]||(Vd[e]=t)}var Uu,rb=()=>Uu,bN=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Kx(qd)?ga(qd):void 0,arrayMethodsPlugin_:Kx(Wx)?ga(Wx):void 0});function Yx(e,t){t&&(e.patchPlugin_=ga(Md),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function gS(e){hS(e),e.drafts_.forEach(wN),e.drafts_=null}function hS(e){e===Uu&&(Uu=e.parent_)}var Jx=e=>Uu=bN(Uu,e);function wN(e){let t=e[ht];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Xx(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[ht].modified_&&(gS(t),kt(4)),Vt(e)&&(e=Zx(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[ht].base_,e,t)}else e=Zx(t,r);return RN(t,e,!0),gS(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==vS?e:void 0}function Zx(e,t){if(Ud(t))return t;let r=t[ht];if(!r)return jd(t,e.handledSet_,e);if(!Qd(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){let{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);ab(r,e)}return r.copy_}function RN(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&CS(t,r)}function nb(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Qd=(e,t)=>e.scope_===t,FN=[];function ob(e,t,r,n){let o=zn(e),a=e.type_;if(n!==void 0&&Hn(o,n,a)===t){Dd(o,n,r,a);return}if(!e.draftLocations_){let p=e.draftLocations_=new Map;$u(o,(f,m)=>{if(Yt(m)){let g=p.get(m)||[];g.push(f),p.set(m,g)}})}let i=e.draftLocations_.get(t)??FN;for(let p of i)Dd(o,p,r,a)}function EN(e,t,r){e.callbacks_.push(function(o){let a=t;if(!a||!Qd(a,o))return;o.mapSetPlugin_?.fixSetContents(a);let i=AS(a);ob(e,a.draft_??a,i,r),ab(a,o)})}function ab(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)}nb(e)}}function IN(e,t,r){let{scope_:n}=e;if(Yt(r)){let o=r[ht];Qd(o,n)&&o.callbacks_.push(function(){_d(e);let i=AS(o);ob(e,r,i,t)})}else Vt(r)&&e.callbacks_.push(function(){let a=zn(e);e.type_===3?a.has(r)&&jd(r,n.handledSet_,n):Hn(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&jd(Hn(e.copy_,t,e.type_),n.handledSet_,n)})}function jd(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Yt(e)||t.has(e)||!Vt(e)||Ud(e)||(t.add(e),$u(e,(n,o)=>{if(Yt(o)){let a=o[ht];if(Qd(a,r)){let i=AS(a);Dd(e,n,i,e.type_),nb(a)}}else Vt(o)&&jd(o,t,r)})),e}function TN(e,t){let r=Hu(e),n={type_:r?1:0,scope_:t?t.scope_:rb(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=n,a=Ld;r&&(o=[n],a=Qu);let{revoke:i,proxy:p}=Proxy.revocable(o,a);return n.draft_=p,n.revoke_=i,[p,n]}var Ld={get(e,t){if(t===ht)return e;let r=e.scope_.arrayMethodsPlugin_,n=e.type_===1&&typeof t=="string";if(n&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let o=zn(e);if(!Ui(o,t,e.type_))return kN(e,o,t);let a=o[t];if(e.finalized_||!Vt(a)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&vN(t))return a;if(a===pS(e.base_,t)||PN(e,t,a)){_d(e);let i=e.type_===1?+t:t,p=SS(e.scope_,a,e,i);return e.copy_[i]=p}return a},has(e,t){return t in zn(e)},ownKeys(e){return Reflect.ownKeys(zn(e))},set(e,t,r){let n=ib(zn(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=pS(zn(e),t),a=o?.[ht];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(SN(r,o)&&(r!==void 0||Ui(e.base_,t,e.type_)))return!0;_d(e),yS(e)}return e.copy_[t]===r&&(r!==void 0||Ui(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),IN(e,t,r)),!0},deleteProperty(e,t){return _d(e),pS(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),yS(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=zn(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Od]:!0,[fS]:e.type_!==1||t!=="length",[Nd]:n[Nd],[Lu]:r[t]}},defineProperty(){kt(11)},getPrototypeOf(e){return fa(e.base_)},setPrototypeOf(){kt(12)}},Qu={};for(let e in Ld){let t=Ld[e];Qu[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Qu.deleteProperty=function(e,t){return Qu.set.call(this,e,t,void 0)};Qu.set=function(e,t,r){return Ld.set.call(this,e[0],t,r,e[0])};function pS(e,t){let r=e[ht];return(r?zn(r):e)[t]}function PN(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!Vt(r)||r[ht]?!1:e.baseRefs_.has(r)}function kN(e,t,r){let n=ib(t,r);return n?Lu in n?n[Lu]:n.get?.call(e.draft_):void 0}function ib(e,t){if(!(t in e))return;let r=fa(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=fa(r)}}function yS(e){e.modified_||(e.modified_=!0,e.parent_&&yS(e.parent_))}function _d(e){e.copy_||(e.assigned_=new Map,e.copy_=mS(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var ON=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(pa(t)&&!pa(r)){let a=r;r=t;let i=this;return function(f=a,...m){return i.produce(f,g=>r.call(this,g,...m))}}pa(r)||kt(6),n!==void 0&&!pa(n)&&kt(7);let o;if(Vt(t)){let a=Jx(this),i=SS(a,t,void 0),p=!0;try{o=r(i),p=!1}finally{p?gS(a):hS(a)}return Yx(a,n),Xx(o,a)}else if(!t||!Qi(t)){if(o=r(t),o===void 0&&(o=t),o===vS&&(o=void 0),this.autoFreeze_&&CS(o,!0),n){let a=[],i=[];ga(Md).generateReplacementPatches_(t,o,{patches_:a,inversePatches_:i}),n(a,i)}return o}else kt(1,t)},this.produceWithPatches=(t,r)=>{if(pa(t))return(i,...p)=>this.produceWithPatches(i,f=>t(f,...p));let n,o;return[this.produce(t,r,(i,p)=>{n=i,o=p}),n,o]},dS(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),dS(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),dS(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Vt(e)||kt(8),Yt(e)&&(e=Bd(e));let t=Jx(this),r=SS(t,e,void 0);return r[ht].isManual_=!0,hS(t),r}finishDraft(e,t){let r=e&&e[ht];(!r||!r.isManual_)&&kt(9);let{scope_:n}=r;return Yx(n,t),Xx(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let o=t[r];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}r>-1&&(t=t.slice(r+1));let n=ga(Md).applyPatches_;return Yt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function SS(e,t,r,n){let[o,a]=zu(t)?ga(qd).proxyMap_(t,r):Wu(t)?ga(qd).proxySet_(t,r):TN(t,r);return(r?.scope_??rb()).drafts_.push(o),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&n!==void 0?EN(r,a,n):a.callbacks_.push(function(f){f.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:m}=f;a.modified_&&m&&m.generatePatches_(a,[],f)}),o}function Bd(e){return Yt(e)||kt(10,e),sb(e)}function sb(e){if(!Vt(e)||Ud(e))return e;let t=e[ht],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=mS(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=mS(e,!0);return $u(r,(o,a)=>{Dd(r,o,sb(a))},n),t&&(t.finalized_=!1),r}function cb(){function t(C,b=[]){if(C.key_!==void 0){let w=C.parent_.copy_??C.parent_.base_,F=AN(Hn(w,C.key_)),I=Hn(w,C.key_);if(I===void 0||I!==C.draft_&&I!==C.base_&&I!==C.copy_||F!=null&&F.base_!==C.base_)return null;let E=C.parent_.type_===3,T;if(E){let P=C.parent_;T=Array.from(P.drafts_.keys()).indexOf(C.key_)}else T=C.key_;if(!(E&&w.size>T||Ui(w,T)))return null;b.push(T)}if(C.parent_)return t(C.parent_,b);b.reverse();try{r(C.copy_,b)}catch{return null}return b}function r(C,b){let w=C;for(let F=0;F<b.length-1;F++){let I=b[F];if(w=Hn(w,I),!Qi(w)||w===null)throw new Error(`Cannot resolve path at '${b.join("/")}'`)}return w}let n="replace",o="add",a="remove";function i(C,b,w){if(C.scope_.processedForPatches_.has(C))return;C.scope_.processedForPatches_.add(C);let{patches_:F,inversePatches_:I}=w;switch(C.type_){case 0:case 2:return f(C,b,F,I);case 1:return p(C,b,F,I);case 3:return m(C,b,F,I)}}function p(C,b,w,F){let{base_:I,assigned_:E}=C,T=C.copy_;T.length<I.length&&([I,T]=[T,I],[w,F]=[F,w]);let P=C.allIndicesReassigned_===!0;for(let D=0;D<I.length;D++){let G=T[D],Q=I[D];if((P||E?.get(D.toString()))&&G!==Q){let U=G?.[ht];if(U&&U.modified_)continue;let j=b.concat([D]);w.push({op:n,path:j,value:h(G)}),F.push({op:n,path:j,value:h(Q)})}}for(let D=I.length;D<T.length;D++){let G=b.concat([D]);w.push({op:o,path:G,value:h(T[D])})}for(let D=T.length-1;I.length<=D;--D){let G=b.concat([D]);F.push({op:a,path:G})}}function f(C,b,w,F){let{base_:I,copy_:E,type_:T}=C;$u(C.assigned_,(P,D)=>{let G=Hn(I,P,T),Q=Hn(E,P,T),V=D?Ui(I,P)?n:o:a;if(G===Q&&V===n)return;let U=b.concat(P);w.push(V===a?{op:V,path:U}:{op:V,path:U,value:h(Q)}),F.push(V===o?{op:a,path:U}:V===a?{op:o,path:U,value:h(G)}:{op:n,path:U,value:h(G)})})}function m(C,b,w,F){let{base_:I,copy_:E}=C,T=0;I.forEach(P=>{if(!E.has(P)){let D=b.concat([T]);w.push({op:a,path:D,value:P}),F.unshift({op:o,path:D,value:P})}T++}),T=0,E.forEach(P=>{if(!I.has(P)){let D=b.concat([T]);w.push({op:o,path:D,value:P}),F.unshift({op:a,path:D,value:P})}T++})}function g(C,b,w){let{patches_:F,inversePatches_:I}=w;F.push({op:n,path:[],value:b===vS?void 0:b}),I.push({op:n,path:[],value:C})}function S(C,b){return b.forEach(w=>{let{path:F,op:I}=w,E=C;for(let G=0;G<F.length-1;G++){let Q=ma(E),V=F[G];typeof V!="string"&&typeof V!="number"&&(V=""+V),(Q===0||Q===1)&&(V==="__proto__"||V===ju)&&kt(19),pa(E)&&V===Gu&&kt(19),E=Hn(E,V),(E===null||!Qi(E))&&kt(18,F.join("/"))}let T=ma(E),P=x(w.value),D=F[F.length-1];switch(I){case n:switch(T){case 2:return E.set(D,P);case 3:kt(16);default:return E[D]=P}case o:switch(T){case 1:return D==="-"?E.push(P):E.splice(D,0,P);case 2:return E.set(D,P);case 3:return E.add(P);default:return E[D]=P}case a:switch(T){case 1:return E.splice(D,1);case 2:return E.delete(D);case 3:return E.delete(w.value);default:return delete E[D]}default:kt(17,I)}}),C}function x(C){if(!Vt(C))return C;if(Hu(C))return C.map(x);if(zu(C))return new Map(Array.from(C.entries()).map(([w,F])=>[w,x(F)]));if(Wu(C))return new Set(Array.from(C).map(x));let b=Object.create(fa(C));for(let w in C)b[w]=x(C[w]);return Ui(C,Vu)&&(b[Vu]=C[Vu]),b}function h(C){return Yt(C)?x(C):C}xN(Md,{applyPatches_:S,generatePatches_:i,generateReplacementPatches_:g,getPath:t})}var _N=y.Iterator,WK=typeof _N?.from=="function";var Bu=new ON,ha=Bu.produce,xS=Bu.produceWithPatches.bind(Bu);var bS=Bu.applyPatches.bind(Bu);d();c();l();u();function NN(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function DN(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 ub=e=>Array.isArray(e)?e:[e];function qN(e){let t=Array.isArray(e[0])?e[0]:e;return DN(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function MN(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var VN=class{constructor(e){this.value=e}deref(){return this.value}},jN=()=>typeof WeakRef>"u"?VN:WeakRef,db=jN(),LN=0,lb=1;function Gd(){return{s:LN,v:void 0,o:null,p:null}}function UN(e){return e instanceof db?e.deref():e}function Ku(e,t={}){let r=Gd(),{resultEqualityCheck:n}=t,o,a=0;function i(){let p=r,{length:f}=arguments;for(let S=0,x=f;S<x;S++){let h=arguments[S];if(typeof h=="function"||typeof h=="object"&&h!==null){let C=p.o;C===null&&(p.o=C=new WeakMap);let b=C.get(h);b===void 0?(p=Gd(),C.set(h,p)):p=b}else{let C=p.p;C===null&&(p.p=C=new Map);let b=C.get(h);b===void 0?(p=Gd(),C.set(h,p)):p=b}}let m=p,g;if(p.s===lb)g=p.v;else if(g=e.apply(null,arguments),a++,n){let S=UN(o);S!=null&&n(S,g)&&(g=S,a!==0&&a--),o=typeof g=="object"&&g!==null||typeof g=="function"?new db(g):g}return m.s=lb,m.v=g,g}return i.clearCache=()=>{r=Gd(),i.resetResultsCount()},i.resultsCount=()=>a,i.resetResultsCount=()=>{a=0},i}function QN(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let a=0,i=0,p,f={},m=o.pop();typeof m=="object"&&(f=m,m=o.pop()),NN(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);let g={...r,...f},{memoize:S,memoizeOptions:x=[],argsMemoize:h=Ku,argsMemoizeOptions:C=[]}=g,b=ub(x),w=ub(C),F=qN(o),I=S(function(){return a++,m.apply(null,arguments)},...b),E=!0,T=h(function(){i++;let D=MN(F,arguments);return p=I.apply(null,D),p},...w);return Object.assign(T,{resultFunc:m,memoizedResultFunc:I,dependencies:F,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>p,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:S,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var tt=QN(Ku);d();c();l();u();function pb(e){return({dispatch:r,getState:n})=>o=>a=>typeof a=="function"?a(r,n,e):o(a)}var fb=pb(),mb=pb;var BN=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?qu:qu.apply(null,arguments)},S6=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},GN=e=>e&&typeof e.match=="function";function k(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(Jt(0));return{type:e,payload:o.payload,...("meta"in o&&{meta:o.meta}),...("error"in o&&{error:o.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Mu(n)&&n.type===e,r}var xb=class Yu extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Yu.prototype)}static get[Symbol.species](){return Yu}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Yu(...t[0].concat(this)):new Yu(...t.concat(this))}};function gb(e){return Vt(e)?ha(e,()=>{}):e}function $d(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function $N(e){return typeof e=="boolean"}var HN=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:a=!0}=t??{},i=new xb;return r&&($N(r)?i.push(fb):i.push(mb(r.extraArgument))),i},Ju="RTK_autoBatch",$i=()=>e=>({payload:e,meta:{[Ju]:!0}}),hb=e=>t=>{setTimeout(t,e)},zN=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(a),clearTimeout(i),r())},a=e(o),i=setTimeout(o,t)},WN=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,a=!1,i=!1,p=new Set,f=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?zN(window.requestAnimationFrame,100):hb(10):e.type==="callback"?e.queueNotification:hb(e.timeout),m=()=>{i=!1,a&&(a=!1,p.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let S=()=>o&&g(),x=n.subscribe(S);return p.add(g),()=>{x(),p.delete(g)}},dispatch(g){try{return o=!g?.meta?.[Ju],a=!o,a&&(i||(i=!0,f(m))),n.dispatch(g)}finally{o=!0}}})},KN=e=>function(r){let{autoBatch:n=!0}=r??{},o=new xb(e);return n&&o.push(WN(typeof n=="object"?n:void 0)),o};function bb(e){let t=HN(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:a=!0,preloadedState:i=void 0,enhancers:p=void 0}=e||{},f;if(typeof r=="function")f=r;else if(Xr(r))f=Li(r);else throw new Error(Jt(1));let m;typeof n=="function"?m=n(t):m=t();let g=qu;o&&(g=BN({trace:!1,...(typeof o=="object"&&o)}));let S=Hx(...m),x=KN(S),h=typeof p=="function"?p(x):x(),C=g(...h);return lS(f,i,C)}function wb(e){let t={},r=[],n,o={addCase(a,i){let p=typeof a=="string"?a:a.type;if(!p)throw new Error(Jt(28));if(p in t)throw new Error(Jt(29));return t[p]=i,o},addAsyncThunk(a,i){return i.pending&&(t[a.pending.type]=i.pending),i.rejected&&(t[a.rejected.type]=i.rejected),i.fulfilled&&(t[a.fulfilled.type]=i.fulfilled),i.settled&&r.push({matcher:a.settled,reducer:i.settled}),o},addMatcher(a,i){return r.push({matcher:a,reducer:i}),o},addDefaultCase(a){return n=a,o}};return e(o),[t,r,n]}function YN(e){return typeof e=="function"}function ae(e,t){let[r,n,o]=wb(t),a;if(YN(e))a=()=>gb(e());else{let p=gb(e);a=()=>p}function i(p=a(),f){let m=[r[f.type],...n.filter(({matcher:g})=>g(f)).map(({reducer:g})=>g)];return m.filter(g=>!!g).length===0&&(m=[o]),m.reduce((g,S)=>{if(S)if(Yt(g)){let h=S(g,f);return h===void 0?g:h}else{if(Vt(g))return ha(g,x=>S(x,f));{let x=S(g,f);if(x===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return x}}return g},p)}return i.getInitialState=a,i}var Rb=(e,t)=>GN(e)?e.match(t):e(t);function Zr(...e){return t=>e.some(r=>Rb(r,t))}function Gi(...e){return t=>e.every(r=>Rb(r,t))}function Kd(e,t){if(!e||!e.meta)return!1;let r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function Xu(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Yd(...e){return e.length===0?t=>Kd(t,["pending"]):Xu(e)?Zr(...e.map(t=>t.pending)):Yd()(e[0])}function Sa(...e){return e.length===0?t=>Kd(t,["rejected"]):Xu(e)?Zr(...e.map(t=>t.rejected)):Sa()(e[0])}function Zu(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Gi(Sa(...e),t):Xu(e)?Gi(Sa(...e),t):Zu()(e[0])}function Wn(...e){return e.length===0?t=>Kd(t,["fulfilled"]):Xu(e)?Zr(...e.map(t=>t.fulfilled)):Wn()(e[0])}function Jd(...e){return e.length===0?t=>Kd(t,["pending","fulfilled","rejected"]):Xu(e)?Zr(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Jd()(e[0])}var JN="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",el=(e=21)=>{let t="",r=e;for(;r--;)t+=JN[Math.random()*64|0];return t},XN=["name","message","stack","code"],wS=class{constructor(e,t){me(this,"payload");me(this,"meta");me(this,"_type");this.payload=e,this.meta=t}},yb=class{constructor(e,t){me(this,"payload");me(this,"meta");me(this,"_type");this.payload=e,this.meta=t}},ZN=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of XN)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},Sb="External signal was aborted",xe=(()=>{function e(t,r,n){let o=k(t+"/fulfilled",(f,m,g,S)=>({payload:f,meta:{...(S||{}),arg:g,requestId:m,requestStatus:"fulfilled"}})),a=k(t+"/pending",(f,m,g)=>({payload:void 0,meta:{...(g||{}),arg:m,requestId:f,requestStatus:"pending"}})),i=k(t+"/rejected",(f,m,g,S,x)=>({payload:S,error:(n&&n.serializeError||ZN)(f||"Rejected"),meta:{...(x||{}),arg:g,requestId:m,rejectedWithValue:!!S,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"}}));function p(f,{signal:m}={}){return(g,S,x)=>{let h=n?.idGenerator?n.idGenerator(f):el(),C=new s.AbortController,b,w;function F(E){w=E,C.abort()}m&&(m.aborted?F(Sb):m.addEventListener("abort",()=>F(Sb),{once:!0}));let I=_asyncToGenerator(function*(){let E;try{let P=n?.condition?.(f,{getState:S,extra:x});if(tD(P)&&(P=yield P),P===!1||C.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let D=new Promise((G,Q)=>{b=()=>{Q({name:"AbortError",message:w||"Aborted"})},C.signal.addEventListener("abort",b,{once:!0})});g(a(h,f,n?.getPendingMeta?.({requestId:h,arg:f},{getState:S,extra:x}))),E=yield Promise.race([D,Promise.resolve(r(f,{dispatch:g,getState:S,extra:x,requestId:h,signal:C.signal,abort:F,rejectWithValue:(G,Q)=>new wS(G,Q),fulfillWithValue:(G,Q)=>new yb(G,Q)})).then(G=>{if(G instanceof wS)throw G;return G instanceof yb?o(G.payload,h,f,G.meta):o(G,h,f)})])}catch(P){E=P instanceof wS?i(null,h,f,P.payload,P.meta):i(P,h,f)}finally{b&&C.signal.removeEventListener("abort",b)}return n&&!n.dispatchConditionRejection&&i.match(E)&&E.meta.condition||g(E),E})();return Object.assign(I,{abort:F,requestId:h,arg:f,unwrap(){return I.then(eD)}})}}return Object.assign(p,{pending:a,rejected:i,fulfilled:o,settled:Zr(i,o),typePrefix:t})}return e.withTypes=()=>e,e})();function eD(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function tD(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var Fb=Symbol.for("rtk-slice-createasyncthunk"),A6={[Fb]:xe};function rD(e,t){return`${e}/${t}`}function nD({creators:e}={}){let t=e?.asyncThunk?.[Fb];return function(n){let{name:o,reducerPath:a=o}=n;if(!o)throw new Error(Jt(11));typeof process<"u";let i=(typeof n.reducers=="function"?n.reducers(aD()):n.reducers)||{},p=Object.keys(i),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(E,T){let P=typeof E=="string"?E:E.type;if(!P)throw new Error(Jt(12));if(P in f.sliceCaseReducersByType)throw new Error(Jt(13));return f.sliceCaseReducersByType[P]=T,m},addMatcher(E,T){return f.sliceMatchers.push({matcher:E,reducer:T}),m},exposeAction(E,T){return f.actionCreators[E]=T,m},exposeCaseReducer(E,T){return f.sliceCaseReducersByName[E]=T,m}};p.forEach(E=>{let T=i[E],P={reducerName:E,type:rD(o,E),createNotation:typeof n.reducers=="function"};sD(T)?uD(P,T,m,t):iD(P,T,m)});function g(){let[E={},T=[],P=void 0]=typeof n.extraReducers=="function"?wb(n.extraReducers):[n.extraReducers],D={...E,...f.sliceCaseReducersByType};return ae(n.initialState,G=>{for(let Q in D)G.addCase(Q,D[Q]);for(let Q of f.sliceMatchers)G.addMatcher(Q.matcher,Q.reducer);for(let Q of T)G.addMatcher(Q.matcher,Q.reducer);P&&G.addDefaultCase(P)})}let S=E=>E,x=new Map,h=new WeakMap,C;function b(E,T){return C||(C=g()),C(E,T)}function w(){return C||(C=g()),C.getInitialState()}function F(E,T=!1){function P(G){let Q=G[E];return typeof Q>"u"&&T&&(Q=$d(h,P,w)),Q}function D(G=S){let Q=$d(x,T,()=>new WeakMap);return $d(Q,G,()=>{let V={};for(let[U,j]of Object.entries(n.selectors??{}))V[U]=oD(j,G,()=>$d(h,G,w),T);return V})}return{reducerPath:E,getSelectors:D,get selectors(){return D(P)},selectSlice:P}}let I={name:o,reducer:b,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:w,...F(a),injectInto(E,{reducerPath:T,...P}={}){let D=T??a;return E.inject({reducerPath:D,reducer:b},P),{...I,...F(D,!0)}}};return I}}function oD(e,t,r,n){function o(a,...i){let p=t(a);return typeof p>"u"&&n&&(p=r()),e(p,...i)}return o.unwrapped=e,o}var va=nD();function aD(){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 iD({type:e,reducerName:t,createNotation:r},n,o){let a,i;if("reducer"in n){if(r&&!cD(n))throw new Error(Jt(17));a=n.reducer,i=n.prepare}else a=n;o.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,i?k(e,i):k(e))}function sD(e){return e._reducerDefinitionType==="asyncThunk"}function cD(e){return e._reducerDefinitionType==="reducerWithPrepare"}function uD({type:e,reducerName:t},r,n,o){if(!o)throw new Error(Jt(18));let{payloadCreator:a,fulfilled:i,pending:p,rejected:f,settled:m,options:g}=r,S=o(e,a,g);n.exposeAction(t,S),i&&n.addCase(S.fulfilled,i),p&&n.addCase(S.pending,p),f&&n.addCase(S.rejected,f),m&&n.addMatcher(S.settled,m),n.exposeCaseReducer(t,{fulfilled:i||Hd,pending:p||Hd,rejected:f||Hd,settled:m||Hd})}function Hd(){}var lD="task",Eb="listener",Ib="completed",ES="cancelled",dD=`task-${ES}`,pD=`task-${Ib}`,RS=`${Eb}-${ES}`,fD=`${Eb}-${Ib}`,Xd=class{constructor(e){me(this,"code");me(this,"name","TaskAbortError");me(this,"message");this.code=e,this.message=`${lD} ${ES} (reason: ${e})`}},IS=(e,t)=>{if(typeof e!="function")throw new TypeError(Jt(32))},zd=()=>{},Tb=(e,t=zd)=>(e.catch(t),e),Pb=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),ya=e=>{if(e.aborted)throw new Xd(e.reason)};function kb(e,t){let r=zd;return new Promise((n,o)=>{let a=()=>o(new Xd(e.reason));if(e.aborted){a();return}r=Pb(e,a),t.finally(()=>r()).then(n,o)}).finally(()=>{r=zd})}var mD=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof Xd?"cancelled":"rejected",error:r}}finally{t?.()}});return function mD(_x7,_x8){return _ref5.apply(this,arguments)}}(),Wd=e=>t=>Tb(kb(e,t).then(r=>(ya(e),r))),Ob=e=>{let t=Wd(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Bi}=Object,vb={},Zd="listenerMiddleware",gD=(e,t)=>{let r=n=>Pb(e,()=>n.abort(e.reason));return(n,o)=>{IS(n,"taskExecutor");let a=new s.AbortController;r(a);let i=mD(/*#__PURE__*/_asyncToGenerator(function*(){ya(e),ya(a.signal);let p=yield n({pause:Wd(a.signal),delay:Ob(a.signal),signal:a.signal});return ya(a.signal),p}),()=>a.abort(pD));return o?.autoJoin&&t.push(i.catch(zd)),{result:Wd(e)(i),cancel(){a.abort(dD)}}}},hD=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){ya(t);let a=()=>{},p=[new Promise((f,m)=>{let g=e({predicate:n,effect:(S,x)=>{x.unsubscribe(),f([S,x.getState(),x.getOriginalState()])}});a=()=>{g(),m()}})];o!=null&&p.push(new Promise(f=>setTimeout(f,o,null)));try{let f=yield kb(t,Promise.race(p));return ya(t),f}finally{a()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>Tb(r(n,o))},_b=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:a}=e;if(t)o=k(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(Jt(21));return IS(a,"options.listener"),{predicate:o,type:t,effect:a}},Nb=Bi(e=>{let{type:t,predicate:r,effect:n}=_b(e);return{id:el(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Jt(22))}}},{withTypes:()=>Nb}),Ab=(e,t)=>{let{type:r,effect:n,predicate:o}=_b(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===o)&&a.effect===n)},FS=e=>{e.pending.forEach(t=>{t.abort(RS)})},yD=(e,t)=>()=>{for(let r of t.keys())FS(r);e.clear()},Cb=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Db=Bi(k(`${Zd}/add`),{withTypes:()=>Db}),SD=k(`${Zd}/removeAll`),qb=Bi(k(`${Zd}/remove`),{withTypes:()=>qb}),vD=(...e)=>{console.error(`${Zd}/error`,...e)},Mb=(e={})=>{let t=new Map,r=new Map,n=h=>{let C=r.get(h)??0;r.set(h,C+1)},o=h=>{let C=r.get(h)??1;C===1?r.delete(h):r.set(h,C-1)},{extra:a,onError:i=vD}=e;IS(i,"onError");let p=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),C=>{h.unsubscribe(),C?.cancelActive&&FS(h)}),f=h=>{let C=Ab(t,h)??Nb(h);return p(C)};Bi(f,{withTypes:()=>f});let m=h=>{let C=Ab(t,h);return C&&(C.unsubscribe(),h.cancelActive&&FS(C)),!!C};Bi(m,{withTypes:()=>m});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,C,b,w){let F=new s.AbortController,I=hD(f,F.signal),E=[];try{h.pending.add(F),n(h),yield Promise.resolve(h.effect(C,Bi({},b,{getOriginalState:w,condition:(T,P)=>I(T,P).then(Boolean),take:I,delay:Ob(F.signal),pause:Wd(F.signal),extra:a,signal:F.signal,fork:gD(F.signal,E),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((T,P,D)=>{T!==F&&(T.abort(RS),D.delete(T))})},cancel:()=>{F.abort(RS),h.pending.delete(F)},throwIfCancelled:()=>{ya(F.signal)}})))}catch(T){T instanceof Xd||Cb(i,T,{raisedBy:"effect"})}finally{yield Promise.all(E),F.abort(fD),o(h),h.pending.delete(F)}});return function g(_x1,_x10,_x11,_x12){return _ref8.apply(this,arguments)}}(),S=yD(t,r);return{middleware:h=>C=>b=>{if(!Mu(b))return C(b);if(Db.match(b))return f(b.payload);if(SD.match(b)){S();return}if(qb.match(b))return m(b.payload);let w=h.getState(),F=()=>{if(w===vb)throw new Error(Jt(23));return w},I;try{if(I=C(b),t.size>0){let E=h.getState(),T=Array.from(t.values());for(let P of T){let D=!1;try{D=P.predicate(b,E,w)}catch(G){D=!1,Cb(i,G,{raisedBy:"predicate"})}D&&g(P,b,h,F)}}}finally{w=vb}return I},startListening:f,stopListening:m,clearListeners:S}};function Jt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}d();c();l();u();d();c();l();u();d();c();l();u();function Vb(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}d();c();l();u();d();c();l();u();d();c();l();u();var jb=/^(?:[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 AD(e){return typeof e=="string"&&jb.test(e)}var TS=AD;d();c();l();u();var Ot=[];for(let e=0;e<256;++e)Ot.push((e+256).toString(16).slice(1));function Lb(e,t=0){return(Ot[e[t+0]]+Ot[e[t+1]]+Ot[e[t+2]]+Ot[e[t+3]]+"-"+Ot[e[t+4]]+Ot[e[t+5]]+"-"+Ot[e[t+6]]+Ot[e[t+7]]+"-"+Ot[e[t+8]]+Ot[e[t+9]]+"-"+Ot[e[t+10]]+Ot[e[t+11]]+Ot[e[t+12]]+Ot[e[t+13]]+Ot[e[t+14]]+Ot[e[t+15]]).toLowerCase()}d();c();l();u();var CD=new Uint8Array(16);function PS(){return crypto.getRandomValues(CD)}d();c();l();u();function xD(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():bD(e,t,r)}function bD(e,t,r){e=e||{};let n=e.random??e.rng?.()??PS();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 Lb(n)}var kS=xD;function wD(_x13){return _wD.apply(this,arguments)}function _wD(){_wD=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:a,mode:i}=e;if(i!=="disabled")return n.call(r),t.send(o,a,r)});return _wD.apply(this,arguments)}var Hb="2.1.3",OS=128,zb=192,Ub=224,Qb=240,RD=248;function FD(e){return(e&RD)===Qb?4:(e&Qb)===Ub?3:(e&Ub)===zb?2:1}function ED(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&OS)!=OS)break;if(r-=3,(n&zb)!=OS){t-r>=FD(n)*3&&(r=t);break}}return e.substring(0,r)}function ID(e){let{trackingId:t}=e;return{trackingId:t}}function TD(e){return(e.source||[]).concat([`relay@${Hb}`])}function Wb(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:a}=r,i=ID(t),p=r.getClientId();return Object.freeze({type:e,config:i,ts:Date.now(),source:TD(t),clientId:p,userAgent:a(),referrer:Bb(n()),location:Bb(o())})}function Bb(e){return e!==null?ED(e,1024):null}function PD(e,t,r,n){return{...t,meta:Wb(e,r,n)}}var kD="*";function OD(){let e=[];function t({type:f,callback:m}){return e.findIndex(g=>g.type===f&&g.callback===m)}function r(f,m){return f.type==="*"||m===f.type}function n(f){return t(f)<0&&e.push(f),()=>p(f.type,f.callback)}function o(f){e.forEach(m=>{if(r(m,f.meta.type))try{m.callback(f)}catch(g){console.error(g)}})}function a(f){if(f===kD)e.length=0;else for(let m=e.length-1;m>=0;m--)e[m].type===f&&e.splice(m,1)}function i(f){let m=t(f);m>=0&&e.splice(m,1)}function p(f,m){m?i({type:f,callback:m}):a(f)}return{add:n,call:o,remove:p}}function Gb({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 _D(e){let t=Gb(e);return{get:()=>t,update:r=>{t=Gb({...t,...r})}}}var _S=ND();function ND(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,o=document.cookie.split(";");for(let a of o){let i=a.replace(/^\s+/,"");if(i.lastIndexOf(n,0)===0)return i.substring(n.length,i.length)}return null},setItem(r,n,o){let a=t(window.location.hostname),i=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,p=a?`;domain=${a}`:"";document.cookie=`${e}${r}=${n}${i}${p};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function DD(){return{getItem(e){return _S.getItem(e)||localStorage.getItem(e)},removeItem(e){_S.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),_S.setItem(e,t,31556952e3)}}}var $b="visitorId";function qD(){let e=document.referrer;return e===""?null:e}function NS(){let e=DD();return{runtime:"browser",send:function(){var _ref9=_asyncToGenerator(function*(t,r,n){let o=v(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});Vb().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let i=yield o;if(i?.ok){let p;try{p=yield i.json()}catch{return}for(let f of p.events)if(!f.accepted)throw new Error(`Received event was rejected for processing: ${f.errorMessage}`)}else throw new Error(`Error ${i.status}: Failed to send the event(s).`)});return function send(_x14,_x15,_x16){return _ref9.apply(this,arguments)}}(),getReferrer:()=>qD(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem($b);if(t&&TS(t))return t;let r=kS();return e.setItem($b,r),r}}}function MD(){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 VD(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function jD(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=VD();return t&&r?{...r,runtime:"custom"}:t&&LD()&&MD()?NS():n}function LD(){try{return typeof window=="object"}catch{return!1}}function UD(e){return{get:()=>Object.freeze(jD(e))}}function Kb(e){let t=_D(e),r=OD(),n=UD(t);return{emit:function(){var _ref0=_asyncToGenerator(function*(o,a){let i=t.get(),p=n.get(),f=PD(o,a,i,p);return wD({config:i,environment:p,event:f,listenerManager:r})});return function emit(_x17,_x18){return _ref0.apply(this,arguments)}}(),getMeta:o=>Wb(o,t.get(),n.get()),on:(o,a)=>r.add({type:o,callback:a}),off:(o,a)=>r.remove(o,a),updateConfig:o=>t.update(o),version:Hb}}d();c();l();u();function Yb(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var Ao="3.55.4",Jb=["@coveo/atomic","@coveo/quantic"];var Hi=tt(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Ao}`));var tl=tt(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Hi(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:a},i,p)=>{let f=BD(p);return Kb({mode:a?"emit":"disabled",url:o??Rd(e,t),token:r,trackingId:n??null,source:i,environment:f})}),QD={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref1=_asyncToGenerator(function*(){});return function send(){return _ref1.apply(this,arguments)}}()},BD=e=>{if(!e)return;let t=e();return{...(Yb()?NS():QD),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};d();c();l();u();d();c();l();u();function Kn(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function B(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{m(n.next(g))}catch(S){i(S)}}function f(g){try{m(n.throw(g))}catch(S){i(S)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}var _e;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(_e||(_e={}));function MS(){return typeof window<"u"}function YS(){return typeof navigator<"u"}function zi(){return typeof document<"u"}function VS(){try{return typeof localStorage<"u"}catch{return!1}}function GD(){try{return typeof sessionStorage<"u"}catch{return!1}}function lw(){return YS()&&navigator.cookieEnabled}var $D=[_e.click,_e.custom,_e.search,_e.view],HD=(e,t)=>$D.indexOf(e)!==-1?Object.assign({language:zi()?document.documentElement.lang:"unknown",userAgent:YS()?navigator.userAgent:"unknown"},t):t,nl=class e{static set(t,r,n){var o,a,i,p;n&&(a=new Date,a.setTime(a.getTime()+n)),p=window.location.hostname,p.indexOf(".")===-1?Xb(t,r,a):(i=p.split("."),o=i[i.length-2]+"."+i[i.length-1],Xb(t,r,a,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var a=n[o];if(a=a.replace(/^\s+/,""),a.lastIndexOf(r,0)===0)return a.substring(r.length,a.length)}return null}static erase(t){e.set(t,"",-1)}};function Xb(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function zD(){return VS()?localStorage:lw()?new ol:GD()?sessionStorage:new Ki}var ol=class e{getItem(t){return nl.get(`${e.prefix}${t}`)}removeItem(t){nl.erase(`${e.prefix}${t}`)}setItem(t,r,n){nl.set(`${e.prefix}${t}`,r,n)}};ol.prefix="coveo_";var jS=class{constructor(){this.cookieStorage=new ol}getItem(t){return localStorage.getItem(t)||this.cookieStorage.getItem(t)}removeItem(t){this.cookieStorage.removeItem(t),localStorage.removeItem(t)}setItem(t,r){localStorage.setItem(t,r),this.cookieStorage.setItem(t,r,31556926e3)}},Ki=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},ep="__coveo.analytics.history",WD=20,KD=1e3*60,YD=75,rp=class{constructor(t){this.store=t||zD()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){return B(this,void 0,void 0,function*(){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=yield this.getHistoryWithInternalTimeAsync();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])})}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){return B(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(ep);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return B(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(ep);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(ep,JSON.stringify(t.slice(0,WD)))}catch{}}clear(){try{this.store.removeItem(ep)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,YD)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>KD:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:a}=r;return{name:n,time:o,value:a}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var JD=(e,t)=>B(void 0,void 0,void 0,function*(){return e===_e.view?(yield XD(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),XD=e=>B(void 0,void 0,void 0,function*(){let t=new rp,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),ZD=/^(?:[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 np(e){return typeof e=="string"&&ZD.test(e)}function Zb(e){if(!np(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var _t=[];for(let e=0;e<256;++e)_t.push((e+256).toString(16).slice(1));function dw(e,t=0){return(_t[e[t+0]]+_t[e[t+1]]+_t[e[t+2]]+_t[e[t+3]]+"-"+_t[e[t+4]]+_t[e[t+5]]+"-"+_t[e[t+6]]+_t[e[t+7]]+"-"+_t[e[t+8]]+_t[e[t+9]]+"-"+_t[e[t+10]]+_t[e[t+11]]+_t[e[t+12]]+_t[e[t+13]]+_t[e[t+14]]+_t[e[t+15]]).toLowerCase()}var eq=new Uint8Array(16);function tq(){return crypto.getRandomValues(eq)}function rq(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 nq="6ba7b810-9dad-11d1-80b4-00c04fd430c8",oq="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function aq(e,t,r,n,o,a){let i=typeof r=="string"?rq(r):r,p=typeof n=="string"?Zb(n):n;if(typeof n=="string"&&(n=Zb(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let f=new Uint8Array(16+i.length);return f.set(p),f.set(i,p.length),f=t(f),f[6]=f[6]&15|e,f[8]=f[8]&63|128,dw(f)}function Aa(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():iq(e,t,r)}function iq(e,t,r){e=e||{};let n=e.random??e.rng?.()??tq();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 dw(n)}function sq(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 DS(e,t){return e<<t|e>>>32-t}function cq(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,a=Math.ceil(o/16),i=new Array(a);for(let p=0;p<a;++p){let f=new Uint32Array(16);for(let m=0;m<16;++m)f[m]=e[p*64+m*4]<<24|e[p*64+m*4+1]<<16|e[p*64+m*4+2]<<8|e[p*64+m*4+3];i[p]=f}i[a-1][14]=(e.length-1)*8/2**32,i[a-1][14]=Math.floor(i[a-1][14]),i[a-1][15]=(e.length-1)*8&4294967295;for(let p=0;p<a;++p){let f=new Uint32Array(80);for(let C=0;C<16;++C)f[C]=i[p][C];for(let C=16;C<80;++C)f[C]=DS(f[C-3]^f[C-8]^f[C-14]^f[C-16],1);let m=r[0],g=r[1],S=r[2],x=r[3],h=r[4];for(let C=0;C<80;++C){let b=Math.floor(C/20),w=DS(m,5)+sq(b,g,S,x)+h+t[b]+f[C]>>>0;h=x,x=S,S=DS(g,30)>>>0,g=m,m=w}r[0]=r[0]+m>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+S>>>0,r[3]=r[3]+x>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function op(e,t,r,n){return aq(80,cq,e,t)}op.DNS=nq;op.URL=oq;var pw="2.33.0",ew=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,rl={pageview:"pageview",event:"event"},ap=class{constructor({client:t,uuidGenerator:r=Aa}){this.client=t,this.uuidGenerator=r}},LS=class extends ap{constructor({client:t,uuidGenerator:r=Aa}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=ew(window.location),this.lastReferrer=zi()?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:zi()?document.title:"",encoding:zi()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},a={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},a),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:a}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=a,t===rl.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===rl.pageview?this.nextPageViewId:this.pageViewId,referrer:t===rl.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===rl.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=o=>o.replace(/^\/?(.*)$/,"/$1");return`${(o=>o.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return ew(window.location)}},Co=class e{constructor(t,r){if(!np(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(r/1e3)}toString(){return this.clientId.replace(/-/g,"")+"."+this.creationDate.toString()}get expired(){let t=Math.floor(Date.now()/1e3)-this.creationDate;return t<0||t>e.expirationTime}validate(t,r){return!this.expired&&this.matchReferrer(t,r)}matchReferrer(t,r){try{let n=new URL(t);return r.some(o=>new RegExp(o.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(n.host))}catch{return!1}}static fromString(t){let r=t.split(".");if(r.length!==2)return null;let[n,o]=r;if(n.length!==32||isNaN(parseInt(o)))return null;let a=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return np(a)?new e(a,Number.parseInt(o)*1e3):null}};Co.cvo_cid="cvo_cid";Co.expirationTime=120;var US=class extends ap{constructor({client:t,uuidGenerator:r=Aa}){super({client:t,uuidGenerator:r})}getApi(t){switch(t){case"decorate":return this.decorate;case"acceptFrom":return this.acceptFrom;default:return null}}decorate(t){return B(this,void 0,void 0,function*(){if(!this.client.getCurrentVisitorId)throw new Error("Could not retrieve current clientId");try{let r=new URL(t),n=yield this.client.getCurrentVisitorId();return r.searchParams.set(Co.cvo_cid,new Co(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};US.Id="link";var Sr=Object.keys;function tp(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var qS=128,fw=192,tw=224,rw=240;function uq(e){return(e&248)===rw?4:(e&rw)===tw?3:(e&tw)===fw?2:1}function lq(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&qS)!=qS)break;if(r-=3,(n&fw)!=qS){t-r>=uq(n)*3&&(r=t);break}}return e.substring(0,r)}var QS={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"},dq=Sr(QS).map(e=>QS[e]),pq=[...dq].join("|"),fq=new RegExp(`^(${pq}$)`),mq={svcAction:"svc_action",svcActionData:"svc_action_data"},gq=e=>Sr(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=QS[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),hq=e=>fq.test(e),yq=[hq],nw={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},ow={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},jt={action:"pa",list:"pal",listSource:"pls"},ip={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},Sq=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],BS={id:"quoteId",affiliation:"quoteAffiliation"},GS={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},vq={add:jt,bookmark_add:jt,bookmark_remove:jt,click:jt,checkout:jt,checkout_option:jt,detail:jt,impression:jt,remove:jt,refund:Object.assign(Object.assign({},jt),ip),purchase:Object.assign(Object.assign({},jt),ip),quickview:jt,quote:Object.assign(Object.assign({},jt),BS),review:Object.assign(Object.assign({},jt),GS)},Aq=Sr(nw).map(e=>nw[e]),Cq=Sr(ow).map(e=>ow[e]),xq=Sr(jt).map(e=>jt[e]),bq=Sr(ip).map(e=>ip[e]),wq=Sr(GS).map(e=>GS[e]),Rq=Sr(BS).map(e=>BS[e]),Fq=[...Aq,"custom"].join("|"),Eq=[...Cq,"custom"].join("|"),mw="(pr[0-9]+)",gw="(il[0-9]+pi[0-9]+)",Iq=new RegExp(`^${mw}(${Fq})$`),Tq=new RegExp(`^(${gw}(${Eq}))|(il[0-9]+nm)$`),Pq=new RegExp(`^(${xq.join("|")})$`),kq=new RegExp(`^(${bq.join("|")})$`),Oq=new RegExp(`^${mw}custom$`),_q=new RegExp(`^${gw}custom$`),Nq=new RegExp(`^(${[...Sq,...wq,...Rq].join("|")})$`),Dq=e=>Iq.test(e),qq=e=>Tq.test(e),Mq=e=>Pq.test(e),Vq=e=>kq.test(e),jq=e=>Nq.test(e),Lq=[qq,Dq,Mq,Vq,jq],Uq=[Oq,_q],Qq={anonymizeIp:"aip"},Bq={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},Gq={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},$q=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],Hq=Object.assign(Object.assign(Object.assign(Object.assign({},Qq),Bq),Gq),$q.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),$S=Object.assign(Object.assign({},Hq),mq),zq=e=>{let t=!!e.action&&vq[e.action]||{};return Sr(e).reduce((r,n)=>{let o=t[n]||$S[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},Wq=Sr($S).map(e=>$S[e]),Kq=e=>Wq.indexOf(e)!==-1,Yq=e=>e==="custom",Jq=e=>[...Lq,...yq,Kq,Yq].some(t=>t(e)),Xq=e=>Sr(e).reduce((t,r)=>{let n=Zq(r);return n?Object.assign(Object.assign({},t),eM(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),Zq=e=>{let t;return[...Uq].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},eM=(e,t)=>Sr(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),HS=class{constructor(t){this.opts=t}sendEvent(t,r){return B(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:o}=this.opts,a=yield this.getQueryParamsForEventType(t),{url:i,payload:p}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${a}`,r,o),f=this.encodeForEventType(t,p),m=new Blob([f],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(i,m)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return B(this,void 0,void 0,function*(){let o=t,a=r;if(n){let i=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:p,body:f}=i;o=p||t;try{a=JSON.parse(f)}catch(m){console.error("Unable to process the request body as a JSON string",m)}}return{payload:a,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return B(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(a=>!!a).join("&")})}isEventTypeLegacy(t){return[_e.click,_e.custom,_e.search,_e.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let o=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(o=`access_token=${encodeURIComponent(n)}&${o}`),o}},zS=class{sendEvent(t,r){return B(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return B(this,void 0,void 0,function*(){return Promise.resolve()})}},aw=y.fetch,sp=class{constructor(t){this.opts=t}sendEvent(t,r){return B(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:a}=this.opts,i=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",p={url:`${n}/analytics/${t}${i}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},f=Object.assign(Object.assign({},p),a?yield a(p,"analyticsFetch"):{}),{url:m}=f,g=Kn(f,["url"]),S;try{S=yield aw(m,g)}catch(x){console.error("An error has occurred when sending the event.",x);return}if(S.ok){let x=yield S.json();return x.visitorId&&o.setCurrentVisitorId(x.visitorId),x}else{try{S.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,S,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return B(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield aw(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[_e.click,_e.custom,_e.search,_e.view].indexOf(t)!==-1}getVisitorIdParam(){return B(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,r=yield t.getCurrentVisitorId();return r?`?visitor=${r}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},WS=class{constructor(t,r){VS()&&lw()?this.storage=new jS:VS()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Ki),this.client=new sp(t),this.beaconClient=new HS(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:a}of n)this.beaconClient.sendEvent(o,a)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},KS=class{constructor(t,r){this.storage=r||new Ki,this.client=new sp(t)}getClientDependingOnEventType(t){return this.client}},cp=class{constructor(){this.storage=new Ki,this.client=new zS}getClientDependingOnEventType(t){return this.client}},tM="xx",rM=e=>e?.startsWith(tM)||!1,nM=`
29
29
  We've detected you're using React Native but have not provided the corresponding runtime,
30
30
  for an optimal experience please use the "coveo.analytics/react-native" subpackage.
31
31
  Follow the Readme on how to set it up: https://github.com/coveo/coveo.analytics.js#using-react-native
@@ -33,7 +33,7 @@ ${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":x
33
33
  `)}var Pl=function(e){mQ(t,e);function t(r,n,o,a,i){var p=this.constructor,f=e.call(this,pE(r,{name:n,index:o,operation:a,tree:i}))||this;return f.name=n,f.index=o,f.operation=a,f.tree=i,Object.setPrototypeOf(f,p.prototype),f.message=pE(r,{name:n,index:o,operation:a,tree:i}),f}return t}(Error);var at=Pl,hQ=Mt,tc={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=Yf(r,this.path);n&&(n=Mt(n));var o=ei(r,{op:"remove",path:this.from}).removed;return ei(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Yf(r,this.from);return ei(r,{op:"add",path:this.path,value:Mt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:kl(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},yQ={add:function(e,t,r){return Kf(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:tc.move,copy:tc.copy,test:tc.test,_get:tc._get};function Yf(e,t){if(t=="")return e;var r={op:"_get",path:t};return ei(e,r),r.value}function ei(e,t,r,n,o,a){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),a===void 0&&(a=0),r&&(typeof r=="function"?r(t,0,e,t.path):Jf(t,0)),t.path===""){var i={newDocument:e};if(t.op==="add")return i.newDocument=t.value,i;if(t.op==="replace")return i.newDocument=t.value,i.removed=e,i;if(t.op==="move"||t.op==="copy")return i.newDocument=Yf(e,t.from),t.op==="move"&&(i.removed=e),i;if(t.op==="test"){if(i.test=kl(e,t.value),i.test===!1)throw new at("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i.newDocument=e,i}else{if(t.op==="remove")return i.removed=e,i.newDocument=null,i;if(t.op==="_get")return t.value=e,i;if(r)throw new at("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",a,t,e);return i}}else{n||(e=Mt(e));var p=t.path||"",f=p.split("/"),m=e,g=1,S=f.length,x=void 0,h=void 0,C=void 0;for(typeof r=="function"?C=r:C=Jf;;){if(h=f[g],h&&h.indexOf("~")!=-1&&(h=Tl(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&f[g-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&x===void 0&&(m[h]===void 0?x=f.slice(0,g).join("/"):g==S-1&&(x=t.path),x!==void 0&&C(t,0,e,x)),g++,Array.isArray(m)){if(h==="-")h=m.length;else{if(r&&!Kf(h))throw new at("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",a,t,e);Kf(h)&&(h=~~h)}if(g>=S){if(r&&t.op==="add"&&h>m.length)throw new at("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",a,t,e);var i=yQ[t.op].call(t,m,h,e);if(i.test===!1)throw new at("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}}else if(g>=S){var i=tc[t.op].call(t,m,h,e);if(i.test===!1)throw new at("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}if(m=m[h],r&&g<S&&(!m||typeof m!="object"))throw new at("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",a,t,e)}}}function Xf(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new at("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=Mt(e));for(var a=new Array(t.length),i=0,p=t.length;i<p;i++)a[i]=ei(e,t[i],r,!0,o,i),e=a[i].newDocument;return a.newDocument=e,a}function SQ(e,t,r){var n=ei(e,t);if(n.test===!1)throw new at("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Jf(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new at("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(tc[e.op]){if(typeof e.path!="string")throw new at("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new at("Operation `path` property must start with \"/\"","OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new at("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new at("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&Hf(e.value))throw new at("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var o=e.path.split("/").length,a=n.split("/").length;if(o!==a+1&&o!==a)throw new at("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new at("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var i={op:"_get",path:e.from,value:void 0},p=fE([i],r);if(p&&p.name==="OPERATION_PATH_UNRESOLVABLE")throw new at("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new at("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function fE(e,t,r){try{if(!Array.isArray(e))throw new at("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Xf(Mt(t),Mt(e),r||!0);else{r=r||Jf;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof at)return o;throw o}}function kl(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),o,a,i;if(r&&n){if(a=e.length,a!=t.length)return!1;for(o=a;o--!==0;)if(!kl(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var p=Object.keys(e);if(a=p.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!t.hasOwnProperty(p[o]))return!1;for(o=a;o--!==0;)if(i=p[o],!kl(e[i],t[i]))return!1;return!0}return e!==e&&t!==t}var gA={};Fu(gA,{compare:()=>FQ,generate:()=>pA,observe:()=>RQ,unobserve:()=>wQ});d();c();l();u();var fA=new WeakMap,vQ=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),AQ=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function CQ(e){return fA.get(e)}function xQ(e,t){return e.observers.get(t)}function bQ(e,t){e.observers.delete(t.callback)}function wQ(e,t){t.unobserve()}function RQ(e,t){var r=[],n,o=CQ(e);if(!o)o=new vQ(e),fA.set(e,o);else{var a=xQ(o,t);n=a&&a.observer}if(n)return n;if(n={},o.value=Mt(e),t){n.callback=t,n.next=null;var i=function(){pA(n)},p=function(){clearTimeout(n.next),n.next=setTimeout(i)};typeof window<"u"&&(window.addEventListener("mouseup",p),window.addEventListener("keyup",p),window.addEventListener("mousedown",p),window.addEventListener("keydown",p),window.addEventListener("change",p))}return n.patches=r,n.object=e,n.unobserve=function(){pA(n),clearTimeout(n.next),bQ(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",p),window.removeEventListener("keyup",p),window.removeEventListener("mousedown",p),window.removeEventListener("keydown",p),window.removeEventListener("change",p))},o.observers.set(t,new AQ(t,n)),n}function pA(e,t){t===void 0&&(t=!1);var r=fA.get(e.object);mA(r.value,e.object,e.patches,"",t),e.patches.length&&Xf(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function mA(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var a=Wf(t),i=Wf(e),p=!1,f=!1,m=i.length-1;m>=0;m--){var g=i[m],S=e[g];if(zf(t,g)&&!(t[g]===void 0&&S!==void 0&&Array.isArray(t)===!1)){var x=t[g];typeof S=="object"&&S!=null&&typeof x=="object"&&x!=null&&Array.isArray(S)===Array.isArray(x)?mA(S,x,r,n+"/"+gn(g),o):S!==x&&(p=!0,o&&r.push({op:"test",path:n+"/"+gn(g),value:Mt(S)}),r.push({op:"replace",path:n+"/"+gn(g),value:Mt(x)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+gn(g),value:Mt(S)}),r.push({op:"remove",path:n+"/"+gn(g)}),f=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),p=!0)}if(!(!f&&a.length==i.length))for(var m=0;m<a.length;m++){var g=a[m];!zf(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+gn(g),value:Mt(t[g])})}}}function FQ(e,t,r){r===void 0&&(r=!1);var n=[];return mA(e,t,n,"",r),n}var Zf=Object.assign({},dA,gA,{JsonPatchError:Pl,deepClone:Mt,escapePathComponent:gn,unescapePathComponent:Tl});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var hA=function(e,t){return hA=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])},hA(e,t)};function hn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");hA(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function mE(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{m(n.next(g))}catch(S){i(S)}}function f(g){try{m(n.throw(g))}catch(S){i(S)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}function em(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=p(0),i.throw=p(1),i.return=p(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function p(m){return function(g){return f([m,g])}}function f(m){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,m[0]&&(r=0)),r;)try{if(n=1,o&&(a=m[0]&2?o.return:m[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,m[1])).done)return a;switch(o=0,a&&(m=[m[0]&2,a.value]),m[0]){case 0:case 1:a=m;break;case 4:return r.label++,{value:m[1],done:!1};case 5:r.label++,o=m[1],m=[0];continue;case 7:m=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(m[0]===6||m[0]===2)){r=0;continue}if(m[0]===3&&(!a||m[1]>a[0]&&m[1]<a[3])){r.label=m[1];break}if(m[0]===6&&r.label<a[1]){r.label=a[1],a=m;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(m);break}a[2]&&r.ops.pop(),r.trys.pop();continue}m=t.call(e,r)}catch(g){m=[6,g],o=0}finally{n=a=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}}function no(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function rc(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,a=[],i;try{for(;(t===void 0||t-->0)&&!(o=n.next()).done;)a.push(o.value)}catch(p){i={error:p}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return a}function nc(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,a;n<o;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}function ti(e){return this instanceof ti?(this.v=e,this):new ti(e)}function gE(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,a=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),p("next"),p("throw"),p("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(h){return function(C){return Promise.resolve(C).then(h,S)}}function p(h,C){n[h]&&(o[h]=function(b){return new Promise(function(w,F){a.push([h,b,w,F])>1||f(h,b)})},C&&(o[h]=C(o[h])))}function f(h,C){try{m(n[h](C))}catch(b){x(a[0][3],b)}}function m(h){h.value instanceof ti?Promise.resolve(h.value.v).then(g,S):x(a[0][2],h)}function g(h){f("next",h)}function S(h){f("throw",h)}function x(h,C){h(C),a.shift(),a.length&&f(a[0][0],a[0][1])}}function hE(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof no=="function"?no(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=e[a]&&function(i){return new Promise(function(p,f){i=e[a](i),o(p,f,i.done,i.value)})}}function o(a,i,p,f){Promise.resolve(f).then(function(m){a({value:m,done:p})},i)}}d();c();l();u();function Ne(e){return typeof e=="function"}d();c();l();u();d();c();l();u();d();c();l();u();function oc(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 tm=oc(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}});d();c();l();u();function Ol(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var ac=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,a;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var p=no(i),f=p.next();!f.done;f=p.next()){var m=f.value;m.remove(this)}}catch(b){t={error:b}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}else i.remove(this);var g=this.initialTeardown;if(Ne(g))try{g()}catch(b){a=b instanceof tm?b.errors:[b]}var S=this._finalizers;if(S){this._finalizers=null;try{for(var x=no(S),h=x.next();!h.done;h=x.next()){var C=h.value;try{yE(C)}catch(b){a=a??[],b instanceof tm?a=nc(nc([],rc(a)),rc(b.errors)):a.push(b)}}}catch(b){n={error:b}}finally{try{h&&!h.done&&(o=x.return)&&o.call(x)}finally{if(n)throw n.error}}}if(a)throw new tm(a)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)yE(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Ol(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Ol(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var yA=ac.EMPTY;function rm(e){return e instanceof ac||e&&"closed"in e&&Ne(e.remove)&&Ne(e.add)&&Ne(e.unsubscribe)}function yE(e){Ne(e)?e():e.unsubscribe()}d();c();l();u();var Hr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};d();c();l();u();d();c();l();u();var ic={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=ic.delegate;return o?.setTimeout?o.setTimeout.apply(o,nc([e,t],rc(r))):setTimeout.apply(void 0,nc([e,t],rc(r)))},clearTimeout:function(e){var t=ic.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function nm(e){ic.setTimeout(function(){var t=Hr.onUnhandledError;if(t)t(e);else throw e})}d();c();l();u();function _l(){}d();c();l();u();var SE=function(){return SA("C",void 0,void 0)}();function vE(e){return SA("E",void 0,e)}function AE(e){return SA("N",e,void 0)}function SA(e,t,r){return{kind:e,value:t,error:r}}d();c();l();u();var ri=null;function sc(e){if(Hr.useDeprecatedSynchronousErrorHandling){var t=!ri;if(t&&(ri={errorThrown:!1,error:null}),e(),t){var r=ri,n=r.errorThrown,o=r.error;if(ri=null,n)throw o}}else e()}function CE(e){Hr.useDeprecatedSynchronousErrorHandling&&ri&&(ri.errorThrown=!0,ri.error=e)}var Nl=function(e){hn(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,rm(r)&&r.add(n)):n.destination=PQ,n}return t.create=function(r,n,o){return new am(r,n,o)},t.prototype.next=function(r){this.isStopped?AA(AE(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?AA(vE(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?AA(SE,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}(ac);var EQ=Function.prototype.bind;function vA(e,t){return EQ.call(e,t)}var IQ=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){om(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){om(n)}else om(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){om(r)}},e}(),am=function(e){hn(t,e);function t(r,n,o){var a=e.call(this)||this,i;if(Ne(r)||!r)i={next:r??void 0,error:n??void 0,complete:o??void 0};else{var p;a&&Hr.useDeprecatedNextContext?(p=Object.create(r),p.unsubscribe=function(){return a.unsubscribe()},i={next:r.next&&vA(r.next,p),error:r.error&&vA(r.error,p),complete:r.complete&&vA(r.complete,p)}):i=r}return a.destination=new IQ(i),a}return t}(Nl);function om(e){Hr.useDeprecatedSynchronousErrorHandling?CE(e):nm(e)}function TQ(e){throw e}function AA(e,t){var r=Hr.onStoppedNotification;r&&ic.setTimeout(function(){return r(e,t)})}var PQ={closed:!0,next:_l,error:TQ,complete:_l};d();c();l();u();var cc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();d();c();l();u();d();c();l();u();function uc(e){return e}function im(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return CA(e)}function CA(e){return e.length===0?uc:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var Ze=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var o=this,a=OQ(t)?t:new am(t,r,n);return sc(function(){var i=o,p=i.operator,f=i.source;a.add(p?p.call(a,f):f?o._subscribe(a):o._trySubscribe(a))}),a},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=xE(r),new r(function(o,a){var i=new am({next:function(p){try{t(p)}catch(f){a(f),i.unsubscribe()}},error:a,complete:o});n.subscribe(i)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[cc]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return CA(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=xE(t),new t(function(n,o){var a;r.subscribe(function(i){return a=i},function(i){return o(i)},function(){return n(a)})})},e.create=function(t){return new e(t)},e}();function xE(e){var t;return(t=e??Hr.Promise)!==null&&t!==void 0?t:Promise}function kQ(e){return e&&Ne(e.next)&&Ne(e.error)&&Ne(e.complete)}function OQ(e){return e&&e instanceof Nl||kQ(e)&&rm(e)}d();c();l();u();function _Q(e){return Ne(e?.lift)}function mt(e){return function(t){if(_Q(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}d();c();l();u();function Ct(e,t,r,n,o){return new NQ(e,t,r,n,o)}var NQ=function(e){hn(t,e);function t(r,n,o,a,i,p){var f=e.call(this,r)||this;return f.onFinalize=i,f.shouldUnsubscribe=p,f._next=n?function(m){try{n(m)}catch(g){r.error(g)}}:e.prototype._next,f._error=a?function(m){try{a(m)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,f._complete=o?function(){try{o()}catch(m){r.error(m)}finally{this.unsubscribe()}}:e.prototype._complete,f}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(Nl);d();c();l();u();d();c();l();u();var bE=oc(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var yn=function(e){hn(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new wE(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new bE},t.prototype.next=function(r){var n=this;sc(function(){var o,a;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var i=no(n.currentObservers),p=i.next();!p.done;p=i.next()){var f=p.value;f.next(r)}}catch(m){o={error:m}}finally{try{p&&!p.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;sc(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;sc(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,a=o.hasError,i=o.isStopped,p=o.observers;return a||i?yA:(this.currentObservers=null,p.push(r),new ac(function(){n.currentObservers=null,Ol(p,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,a=n.thrownError,i=n.isStopped;o?r.error(a):i&&r.complete()},t.prototype.asObservable=function(){var r=new Ze;return r.source=this,r},t.create=function(r,n){return new wE(r,n)},t}(Ze);var wE=function(e){hn(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:yA},t}(yn);d();c();l();u();d();c();l();u();var xA={now:function(){return(xA.delegate||Date).now()},delegate:void 0};var sm=function(e){hn(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=xA);var a=e.call(this)||this;return a._bufferSize=r,a._windowTime=n,a._timestampProvider=o,a._buffer=[],a._infiniteTimeWindow=!0,a._infiniteTimeWindow=n===1/0,a._bufferSize=Math.max(1,r),a._windowTime=Math.max(1,n),a}return t.prototype.next=function(r){var n=this,o=n.isStopped,a=n._buffer,i=n._infiniteTimeWindow,p=n._timestampProvider,f=n._windowTime;o||(a.push(r),!i&&a.push(p.now()+f)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,a=o._infiniteTimeWindow,i=o._buffer,p=i.slice(),f=0;f<p.length&&!r.closed;f+=a?1:2)r.next(p[f]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,a=r._buffer,i=r._infiniteTimeWindow,p=(i?1:2)*n;if(n<1/0&&p<a.length&&a.splice(0,a.length-p),!i){for(var f=o.now(),m=0,g=1;g<a.length&&a[g]<=f;g+=2)m=g;m&&a.splice(0,m+1)}},t}(yn);d();c();l();u();var cm=new Ze(function(e){return e.complete()});d();c();l();u();d();c();l();u();d();c();l();u();function RE(e){return e&&Ne(e.schedule)}function DQ(e){return e[e.length-1]}function FE(e){return RE(DQ(e))?e.pop():void 0}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var um=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};d();c();l();u();function lm(e){return Ne(e?.then)}d();c();l();u();function dm(e){return Ne(e[cc])}d();c();l();u();function pm(e){return Symbol.asyncIterator&&Ne(e?.[Symbol.asyncIterator])}d();c();l();u();function fm(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}d();c();l();u();d();c();l();u();function qQ(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var mm=qQ();function gm(e){return Ne(e?.[mm])}d();c();l();u();function hm(e){return gE(this,arguments,function(){var r,n,o,a;return em(this,function(i){switch(i.label){case 0:r=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,ti(r.read())];case 3:return n=i.sent(),o=n.value,a=n.done,a?[4,ti(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,ti(o)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function ym(e){return Ne(e?.getReader)}function xt(e){if(e instanceof Ze)return e;if(e!=null){if(dm(e))return MQ(e);if(um(e))return VQ(e);if(lm(e))return jQ(e);if(pm(e))return EE(e);if(gm(e))return LQ(e);if(ym(e))return UQ(e)}throw fm(e)}function MQ(e){return new Ze(function(t){var r=e[cc]();if(Ne(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function VQ(e){return new Ze(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function jQ(e){return new Ze(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,nm)})}function LQ(e){return new Ze(function(t){var r,n;try{for(var o=no(e),a=o.next();!a.done;a=o.next()){var i=a.value;if(t.next(i),t.closed)return}}catch(p){r={error:p}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function EE(e){return new Ze(function(t){QQ(e,t).catch(function(r){return t.error(r)})})}function UQ(e){return EE(hm(e))}function QQ(e,t){var r,n,o,a;return mE(this,void 0,void 0,function(){var i,p;return em(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),r=hE(e),f.label=1;case 1:return[4,r.next()];case 2:if(n=f.sent(),!!n.done)return[3,4];if(i=n.value,t.next(i),t.closed)return[2];f.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return p=f.sent(),o={error:p},[3,11];case 6:return f.trys.push([6,,9,10]),n&&!n.done&&(a=r.return)?[4,a.call(r)]:[3,8];case 7:f.sent(),f.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}d();c();l();u();d();c();l();u();function Pr(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var a=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(a),!o)return a}function Sm(e,t){return t===void 0&&(t=0),mt(function(r,n){r.subscribe(Ct(n,function(o){return Pr(n,e,function(){return n.next(o)},t)},function(){return Pr(n,e,function(){return n.complete()},t)},function(o){return Pr(n,e,function(){return n.error(o)},t)}))})}d();c();l();u();function vm(e,t){return t===void 0&&(t=0),mt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function IE(e,t){return xt(e).pipe(vm(t),Sm(t))}d();c();l();u();function TE(e,t){return xt(e).pipe(vm(t),Sm(t))}d();c();l();u();function PE(e,t){return new Ze(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}d();c();l();u();function kE(e,t){return new Ze(function(r){var n;return Pr(r,t,function(){n=e[mm](),Pr(r,t,function(){var o,a,i;try{o=n.next(),a=o.value,i=o.done}catch(p){r.error(p);return}i?r.complete():r.next(a)},0,!0)}),function(){return Ne(n?.return)&&n.return()}})}d();c();l();u();function Am(e,t){if(!e)throw new Error("Iterable cannot be null");return new Ze(function(r){Pr(r,t,function(){var n=e[Symbol.asyncIterator]();Pr(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}d();c();l();u();function OE(e,t){return Am(hm(e),t)}function _E(e,t){if(e!=null){if(dm(e))return IE(e,t);if(um(e))return PE(e,t);if(lm(e))return TE(e,t);if(pm(e))return Am(e,t);if(gm(e))return kE(e,t);if(ym(e))return OE(e,t)}throw fm(e)}function ni(e,t){return t?_E(e,t):xt(e)}function ot(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=FE(e);return ni(e,r)}d();c();l();u();function et(e,t){var r=Ne(e)?e:function(){return e},n=function(o){return o.error(r())};return new Ze(t?function(o){return t.schedule(n,0,o)}:n)}d();c();l();u();d();c();l();u();var NE=oc(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Cm(e,t){var r=typeof t=="object";return new Promise(function(n,o){var a=!1,i;e.subscribe({next:function(p){i=p,a=!0},error:o,complete:function(){a?n(i):r?n(t.defaultValue):o(new NE)}})})}d();c();l();u();function oi(e,t){return mt(function(r,n){var o=0;r.subscribe(Ct(n,function(a){n.next(e.call(t,a,o++))}))})}d();c();l();u();d();c();l();u();d();c();l();u();function DE(e,t,r,n,o,a,i,p){var f=[],m=0,g=0,S=!1,x=function(){S&&!f.length&&!m&&t.complete()},h=function(b){return m<n?C(b):f.push(b)},C=function(b){a&&t.next(b),m++;var w=!1;xt(r(b,g++)).subscribe(Ct(t,function(F){o?.(F),a?h(F):t.next(F)},function(){w=!0},void 0,function(){if(w)try{m--;for(var F=function(){var I=f.shift();i?Pr(t,i,function(){return C(I)}):C(I)};f.length&&m<n;)F();x()}catch(I){t.error(I)}}))};return e.subscribe(Ct(t,h,function(){S=!0,x()})),function(){p?.()}}function nr(e,t,r){return r===void 0&&(r=1/0),Ne(t)?nr(function(n,o){return oi(function(a,i){return t(n,a,o,i)})(xt(e(n,o)))},r):(typeof t=="number"&&(r=t),mt(function(n,o){return DE(n,o,e,r)}))}function bA(e){return e===void 0&&(e=1/0),nr(uc,e)}d();c();l();u();function xm(e){return new Ze(function(t){xt(e()).subscribe(t)})}d();c();l();u();function Dl(e){return mt(function(t,r){var n=null,o=!1,a;n=t.subscribe(Ct(r,void 0,void 0,function(i){a=xt(e(i,Dl(e)(t))),n?(n.unsubscribe(),n=null,a.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,a.subscribe(r))})}d();c();l();u();function bm(e,t){return Ne(t)?nr(e,t,1):nr(e,1)}d();c();l();u();function wA(e){return mt(function(t,r){var n=!1;t.subscribe(Ct(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}d();c();l();u();function ai(e){return mt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}d();c();l();u();function RA(e,t){return mt(function(r,n){var o=null,a=0,i=!1,p=function(){return i&&!o&&n.complete()};r.subscribe(Ct(n,function(f){o?.unsubscribe();var m=0,g=a++;xt(e(f,g)).subscribe(o=Ct(n,function(S){return n.next(t?t(f,S,g,m++):S)},function(){o=null,p()}))},function(){i=!0,p()}))})}d();c();l();u();function wm(e){return mt(function(t,r){xt(e).subscribe(Ct(r,function(){return r.complete()},_l)),!r.closed&&t.subscribe(r)})}d();c();l();u();function FA(e,t,r){var n=Ne(e)||t||r?{next:e,error:t,complete:r}:e;return n?mt(function(o,a){var i;(i=n.subscribe)===null||i===void 0||i.call(n);var p=!0;o.subscribe(Ct(a,function(f){var m;(m=n.next)===null||m===void 0||m.call(n,f),a.next(f)},function(){var f;p=!1,(f=n.complete)===null||f===void 0||f.call(n),a.complete()},function(f){var m;p=!1,(m=n.error)===null||m===void 0||m.call(n,f),a.error(f)},function(){var f,m;p&&((f=n.unsubscribe)===null||f===void 0||f.call(n)),(m=n.finalize)===null||m===void 0||m.call(n)}))}):uc}d();c();l();u();d();c();l();u();function qE(e){return` \r
36
- `.indexOf(e)>=0}function Rm(e){for(var t=["topLevel"],r=0,n,o,a,i=function(I){return t.push(I)},p=function(I){return t[t.length-1]=I},f=function(I){n==null&&(n=r,o=t.length,a=I)},m=function(I){I===a&&(n=void 0,o=void 0,a=void 0)},g=function(){return t.pop()},S=function(){return r--},x=function(I){if("0"<=I&&I<="9"){i("number");return}switch(I){case"\"":i("string");return;case"-":i("numberNeedsDigit");return;case"t":i("true");return;case"f":i("false");return;case"n":i("null");return;case"[":i("arrayNeedsValue");return;case"{":i("objectNeedsKey");return}},h=e.length;r<h;r++){var C=e[r];switch(t[t.length-1]){case"topLevel":x(C);break;case"string":switch(C){case"\"":g();break;case"\\":f("stringEscape"),i("stringEscaped");break}break;case"stringEscaped":C==="u"?i("stringUnicode"):(m("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(m("stringEscape"),g());break;case"number":C==="."?p("numberNeedsDigit"):C==="e"||C==="E"?p("numberNeedsExponent"):(C<"0"||C>"9")&&(S(),g());break;case"numberNeedsDigit":p("number");break;case"numberNeedsExponent":p(C==="+"||C==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(C<"a"||C>"z")&&(S(),g());break;case"arrayNeedsValue":C==="]"?g():qE(C)||(m("collectionItem"),p("arrayNeedsComma"),x(C));break;case"arrayNeedsComma":C==="]"?g():C===","&&(f("collectionItem"),p("arrayNeedsValue"));break;case"objectNeedsKey":C==="}"?g():C==="\""&&(f("collectionItem"),p("objectNeedsColon"),i("string"));break;case"objectNeedsColon":C===":"&&p("objectNeedsValue");break;case"objectNeedsValue":qE(C)||(m("collectionItem"),p("objectNeedsComma"),x(C));break;case"objectNeedsComma":C==="}"?g():C===","&&(f("collectionItem"),p("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var b=[n!=null?e.slice(0,n):e],w=function(I){return b.push(I.slice(e.length-e.lastIndexOf(I[0])))},F=t.length-1;F>=0;F--)switch(t[F]){case"string":b.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":b.push("0");break;case"true":w("true");break;case"false":w("false");break;case"null":w("null");break;case"arrayNeedsValue":case"arrayNeedsComma":b.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":b.push("}");break}return b.join("")}d();c();l();u();d();c();l();u();d();c();l();u();function VE(){let e=this.buf,t=this.pos,r=0,n=0;for(let a=0;a<28;a+=7){let i=e[t++];if(r|=(i&127)<<a,(i&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}let o=e[t++];if(r|=(o&15)<<28,n=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}for(let a=3;a<=31;a+=7){let i=e[t++];if(n|=(i&127)<<a,(i&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}throw new Error("invalid varint")}var Fm=4294967296;function EA(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function a(i,p){let f=Number(e.slice(i,p));o*=r,n=n*r+f,n>=Fm&&(o=o+(n/Fm|0),n=n%Fm)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?LE(n,o):TA(n,o)}function jE(e,t){let r=TA(e,t),n=r.hi&2147483648;n&&(r=LE(r.lo,r.hi));let o=IA(r.lo,r.hi);return n?"-"+o:o}function IA(e,t){if({lo:e,hi:t}=BQ(e,t),t<=2097151)return String(Fm*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,a=r+n*6777216+o*6710656,i=n+o*8147497,p=o*2,f=1e7;return a>=f&&(i+=Math.floor(a/f),a%=f),i>=f&&(p+=Math.floor(i/f),i%=f),p.toString()+ME(i)+ME(a)}function BQ(e,t){return{lo:e>>>0,hi:t>>>0}}function TA(e,t){return{lo:e|0,hi:t|0}}function LE(e,t){return t=~t,e?e=~e+1:t+=1,TA(e,t)}var ME=e=>{let t=String(e);return"0000000".slice(t.length)+t};function UE(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)===0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}d();c();l();u();var zr=GQ();function GQ(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!y.Deno||!!y.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(i){let p=typeof i=="bigint"?i:BigInt(i);if(p>n||p<r)throw new Error(`invalid int64: ${i}`);return p},uParse(i){let p=typeof i=="bigint"?i:BigInt(i);if(p>a||p<o)throw new Error(`invalid uint64: ${i}`);return p},enc(i){return e.setBigInt64(0,this.parse(i),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(i){return e.setBigInt64(0,this.uParse(i),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(i,p){return e.setInt32(0,i,!0),e.setInt32(4,p,!0),e.getBigInt64(0,!0)},uDec(i,p){return e.setInt32(0,i,!0),e.setInt32(4,p,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),QE(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),BE(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),QE(r),EA(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),BE(r),EA(r)},dec(r,n){return jE(r,n)},uDec(r,n){return IA(r,n)}}}function QE(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function BE(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}d();c();l();u();var PA=Symbol.for("@bufbuild/protobuf/text-encoding");function $Q(e){var t;y[PA]=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:OA(e.encodeUtf8.bind(e))})}function kA(){let e=y;if(!e[PA]){let t=new e.TextEncoder,r=new e.TextDecoder,n,o={encodeUtf8(i){return t.encode(i)},decodeUtf8(i,p){return p?(n||(n=new e.TextDecoder("utf-8",{fatal:!0})),n.decode(i)):r.decode(i)},checkUtf8(i){try{return encodeURIComponent(i),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let a=String.prototype.isWellFormed;a&&(o.checkUtf8=i=>a.call(i)),$Q(o)}return e[PA]}function OA(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var $o;(function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"})($o||($o={}));var HQ=34028234663852886e22,zQ=-34028234663852886e22,WQ=4294967295,KQ=2147483647,YQ=-2147483648,Pe=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?OA(t):kA().encodeUtf8Into,this.buffer=$E,this.viewCache=XQ,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||JQ;for(;n<r;)n*=2;let o=new Uint8Array(n);this.pos>0&&o.set(this.buffer),this.buffer=o}}view(){let t=this.buffer,r=this.viewCache;if(r.byteLength===t.byteLength)return r;let n=new DataView(t.buffer);return this.viewCache=n,n}finish(){let t=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],t}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(ql),this.buffer[this.pos++]=0,this}join(){let t=this.stackPos.pop();if(t===void 0)throw new Error("invalid state, fork stack empty");let r=this.pos-t-ql,n=_A(r);return n>ql&&(this.ensureCapacity(n-ql),this.buffer.copyWithin(t+n,t+ql,this.pos)),this.pos=t,this.uint32(r),this.pos+=r,this}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if(GE(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(NA(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<=HE){this.ensureCapacity(r+1);let f=this.buffer,m=this.pos;f[m++]=r;let g=0;for(;g<r;g++){let S=t.charCodeAt(g);if(S>127)break;f[m++]=S}if(g==r)return this.pos=m,this}this.ensureCapacity(r*3+5);let n=_A(r),o=this.buffer,a=this.pos,{written:i}=this.encodeUtf8Into(t,o.subarray(a+n)),p=_A(i);return p!=n&&o.copyWithin(a+p,a+n,a+n+i),this.uint32(i),this.pos+=i,this}float(t){return ZQ(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 GE(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return NA(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return NA(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=zr.enc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}fixed64(t){let r=zr.uEnc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}int64(t){let r=zr.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=zr.enc(t),n=r.hi>>31,o=r.lo<<1^n,a=(r.hi<<1|r.lo>>>31)^n;return this.writeVarint64(o,a)}uint64(t){let r=zr.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let p=0;p<28;p=p+7){let f=t>>>p,m=!(!(f>>>7)&&r==0);if(n[o++]=(m?f|128:f)&255,!m)return this.pos=o,this}let a=t>>>28&15|(r&7)<<4,i=r>>3!=0;if(n[o++]=(i?a|128:a)&255,!i)return this.pos=o,this;for(let p=3;p<31;p=p+7){let f=r>>>p,m=!!(f>>>7);if(n[o++]=(m?f|128:f)&255,!m)return this.pos=o,this}return n[o++]=r>>>31&1,this.pos=o,this}},JQ=128,ql=1,$E=new Uint8Array(0),XQ=new DataView($E.buffer),HE=32;function _A(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var ie=class{constructor(t,r=kA().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=VE,this.uint32=UE,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.pos,r=this.uint32(),n=this.pos-t;if(n>5||n==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=r>>>3,a=r&7;if(o<=0||a>5)throw new Error("illegal tag: field no "+o+" wire type "+a);return[o,a]}skip(t,r,n=100){let o=this.pos;switch(t){case $o.Varint:for(;this.buf[this.pos++]&128;);break;case $o.Bit64:this.pos+=4;case $o.Bit32:this.pos+=4;break;case $o.LengthDelimited:let a=this.uint32();this.pos+=a;break;case $o.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[i,p]=this.tag();if(p===$o.EndGroup){if(r!==void 0&&i!==r)throw new Error("invalid end group tag");break}this.skip(p,i,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return this.varint64(),zr.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),zr.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,r=this.varint64Hi,n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,zr.dec(t,r)}bool(){let t=this.buf[this.pos];return t<128?(this.pos++,t!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return zr.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return zr.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){let r=this.bytes(),n=r.length;if(n<=HE){let o=new Array(n);for(let a=0;a<n;a++){let i=r[a];if(i>127)return this.decodeUtf8(r,t);o[a]=i}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(r,t)}};function NA(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>KQ||e<YQ)throw new Error("invalid int32: "+e)}function GE(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>WQ||e<0)throw new Error("invalid uint32: "+e)}function ZQ(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>HQ||e<zQ))throw new Error("invalid float32: "+e)}var eB=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function DA(){return{fields:{}}}var Ml={encode(e,t=new Pe){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&VA.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=DA();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:{if(a!==10)break;let i=VA.decode(r,r.uint32());i.value!==void 0&&(o.fields[i.key]=i.value);continue}}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ml.fromPartial(e??{})},fromPartial(e){let t=DA();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=DA();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 zE(){return{key:"",value:void 0}}var VA={encode(e,t=new Pe){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&ye.encode(ye.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=zE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.key=r.string();continue;case 2:if(a!==18)break;o.value=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return VA.fromPartial(e??{})},fromPartial(e){let t=zE();return t.key=e.key??"",t.value=e.value??void 0,t}};function qA(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var ye={encode(e,t=new Pe){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&Ml.encode(Ml.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Vl.encode(Vl.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=qA();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.nullValue=r.int32();continue;case 2:if(a!==17)break;o.numberValue=r.double();continue;case 3:if(a!==26)break;o.stringValue=r.string();continue;case 4:if(a!==32)break;o.boolValue=r.bool();continue;case 5:if(a!==42)break;o.structValue=Ml.unwrap(Ml.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.listValue=Vl.unwrap(Vl.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ye.fromPartial(e??{})},fromPartial(e){let t=qA();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=qA();if(e===null)t.nullValue=eB.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(y.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new y.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function MA(){return{values:[]}}var Vl={encode(e,t=new Pe){for(let r of e.values)ye.encode(ye.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=MA();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.values.push(ye.unwrap(ye.decode(r,r.uint32())));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Vl.fromPartial(e??{})},fromPartial(e){let t=MA();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=MA();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&y.Array.isArray(e.values)?e.values:e}},tB=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 WE(){return{op:0,path:"",from:void 0,value:void 0}}var Im={encode(e,t=new Pe){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&ye.encode(ye.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=WE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.op=r.int32();continue;case 2:if(a!==18)break;o.path=r.string();continue;case 3:if(a!==26)break;o.from=r.string();continue;case 4:if(a!==34)break;o.value=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Im.fromPartial(e??{})},fromPartial(e){let t=WE();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function KE(){return{id:"",type:"",function:void 0}}var Tm={encode(e,t=new Pe){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&Pm.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=KE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.type=r.string();continue;case 3:if(a!==26)break;o.function=Pm.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Tm.fromPartial(e??{})},fromPartial(e){let t=KE();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?Pm.fromPartial(e.function):void 0,t}};function YE(){return{name:"",arguments:""}}var Pm={encode(e,t=new Pe){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=YE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.name=r.string();continue;case 2:if(a!==18)break;o.arguments=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Pm.fromPartial(e??{})},fromPartial(e){let t=YE();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function JE(){return{value:"",mimeType:""}}var km={encode(e,t=new Pe){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==""&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=JE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.value=r.string();continue;case 2:if(a!==18)break;o.mimeType=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return km.fromPartial(e??{})},fromPartial(e){let t=JE();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function XE(){return{value:"",mimeType:void 0}}var Om={encode(e,t=new Pe){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=XE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.value=r.string();continue;case 2:if(a!==18)break;o.mimeType=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Om.fromPartial(e??{})},fromPartial(e){let t=XE();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function ZE(){return{data:void 0,url:void 0}}var pr={encode(e,t=new Pe){return e.data!==void 0&&km.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Om.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=ZE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.data=km.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.url=Om.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return pr.fromPartial(e??{})},fromPartial(e){let t=ZE();return t.data=e.data!==void 0&&e.data!==null?km.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Om.fromPartial(e.url):void 0,t}};function eI(){return{text:""}}var _m={encode(e,t=new Pe){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=eI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.text=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return _m.fromPartial(e??{})},fromPartial(e){let t=eI();return t.text=e.text??"",t}};function tI(){return{source:void 0,metadata:void 0}}var Nm={encode(e,t=new Pe){return e.source!==void 0&&pr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=tI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=pr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Nm.fromPartial(e??{})},fromPartial(e){let t=tI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function rI(){return{source:void 0,metadata:void 0}}var Dm={encode(e,t=new Pe){return e.source!==void 0&&pr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=rI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=pr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Dm.fromPartial(e??{})},fromPartial(e){let t=rI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function nI(){return{source:void 0,metadata:void 0}}var qm={encode(e,t=new Pe){return e.source!==void 0&&pr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=nI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=pr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return qm.fromPartial(e??{})},fromPartial(e){let t=nI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function oI(){return{source:void 0,metadata:void 0}}var Mm={encode(e,t=new Pe){return e.source!==void 0&&pr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=oI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=pr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Mm.fromPartial(e??{})},fromPartial(e){let t=oI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function aI(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var Vm={encode(e,t=new Pe){return e.text!==void 0&&_m.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Nm.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Dm.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&qm.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Mm.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=aI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.text=_m.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.image=Nm.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.audio=Dm.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.video=qm.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.document=Mm.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Vm.fromPartial(e??{})},fromPartial(e){let t=aI();return t.text=e.text!==void 0&&e.text!==null?_m.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Nm.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Dm.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?qm.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Mm.fromPartial(e.document):void 0,t}};function iI(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var jm={encode(e,t=new Pe){e.id!==""&&t.uint32(10).string(e.id),e.role!==""&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let r of e.toolCalls)Tm.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)Vm.encode(r,t.uint32(66).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=iI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.role=r.string();continue;case 3:if(a!==26)break;o.content=r.string();continue;case 4:if(a!==34)break;o.name=r.string();continue;case 5:if(a!==42)break;o.toolCalls.push(Tm.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.toolCallId=r.string();continue;case 7:if(a!==58)break;o.error=r.string();continue;case 8:if(a!==66)break;o.contentParts.push(Vm.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return jm.fromPartial(e??{})},fromPartial(e){let t=iI();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=>Tm.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>Vm.fromPartial(r))||[],t}};function sI(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0}}var Lm={encode(e,t=new Pe){return e.id!==""&&t.uint32(10).string(e.id),e.reason!==""&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&ye.encode(ye.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(58).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=sI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.reason=r.string();continue;case 3:if(a!==26)break;o.message=r.string();continue;case 4:if(a!==34)break;o.toolCallId=r.string();continue;case 5:if(a!==42)break;o.responseSchema=ye.unwrap(ye.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.expiresAt=r.string();continue;case 7:if(a!==58)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Lm.fromPartial(e??{})},fromPartial(e){let t=sI();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}},rB=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 cI(){return{type:0,timestamp:void 0,rawEvent:void 0}}var Ce={encode(e,t=new Pe){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&ye.encode(ye.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=cI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.type=r.int32();continue;case 2:if(a!==16)break;o.timestamp=lc(r.int64());continue;case 3:if(a!==26)break;o.rawEvent=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ce.fromPartial(e??{})},fromPartial(e){let t=cI();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function uI(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var Um={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=uI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.role=r.string();continue;case 4:if(a!==34)break;o.name=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Um.fromPartial(e??{})},fromPartial(e){let t=uI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function lI(){return{baseEvent:void 0,messageId:"",delta:""}}var Qm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=lI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Qm.fromPartial(e??{})},fromPartial(e){let t=lI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function dI(){return{baseEvent:void 0,messageId:""}}var Bm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=dI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Bm.fromPartial(e??{})},fromPartial(e){let t=dI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function pI(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var Gm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=pI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.toolCallName=r.string();continue;case 4:if(a!==34)break;o.parentMessageId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Gm.fromPartial(e??{})},fromPartial(e){let t=pI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function fI(){return{baseEvent:void 0,toolCallId:"",delta:""}}var $m={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=fI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return $m.fromPartial(e??{})},fromPartial(e){let t=fI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function mI(){return{baseEvent:void 0,toolCallId:""}}var Hm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=mI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Hm.fromPartial(e??{})},fromPartial(e){let t=mI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function gI(){return{baseEvent:void 0,snapshot:void 0}}var zm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&ye.encode(ye.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=gI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.snapshot=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return zm.fromPartial(e??{})},fromPartial(e){let t=gI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function hI(){return{baseEvent:void 0,delta:[]}}var Wm={encode(e,t=new Pe){e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)Im.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=hI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.delta.push(Im.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Wm.fromPartial(e??{})},fromPartial(e){let t=hI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>Im.fromPartial(r))||[],t}};function yI(){return{baseEvent:void 0,messages:[]}}var Km={encode(e,t=new Pe){e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)jm.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=yI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messages.push(jm.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Km.fromPartial(e??{})},fromPartial(e){let t=yI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>jm.fromPartial(r))||[],t}};function SI(){return{baseEvent:void 0,event:void 0,source:void 0}}var Ym={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&ye.encode(ye.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=SI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.event=ye.unwrap(ye.decode(r,r.uint32()));continue;case 3:if(a!==26)break;o.source=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ym.fromPartial(e??{})},fromPartial(e){let t=SI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function vI(){return{baseEvent:void 0,name:"",value:void 0}}var Jm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&ye.encode(ye.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=vI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.name=r.string();continue;case 3:if(a!==26)break;o.value=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Jm.fromPartial(e??{})},fromPartial(e){let t=vI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function AI(){return{baseEvent:void 0,threadId:"",runId:""}}var Xm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=AI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.threadId=r.string();continue;case 3:if(a!==26)break;o.runId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Xm.fromPartial(e??{})},fromPartial(e){let t=AI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function CI(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var ii={encode(e,t=new Pe){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=CI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.provider=r.string();continue;case 2:if(a!==18)break;o.model=r.string();continue;case 3:if(a!==24)break;o.inputTokens=lc(r.int64());continue;case 4:if(a!==32)break;o.outputTokens=lc(r.int64());continue;case 5:if(a!==40)break;o.totalTokens=lc(r.int64());continue;case 6:if(a!==48)break;o.reasoningTokens=lc(r.int64());continue;case 7:if(a!==56)break;o.cachedInputTokens=lc(r.int64());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ii.fromPartial(e??{})},fromPartial(e){let t=CI();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 xI(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var Zm={encode(e,t=new Pe){e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&ye.encode(ye.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)Lm.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)ii.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=xI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.threadId=r.string();continue;case 3:if(a!==26)break;o.runId=r.string();continue;case 4:if(a!==34)break;o.result=ye.unwrap(ye.decode(r,r.uint32()));continue;case 5:if(a!==42)break;o.outcome=r.string();continue;case 6:if(a!==50)break;o.interrupts.push(Lm.decode(r,r.uint32()));continue;case 7:if(a!==58)break;o.usage.push(ii.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Zm.fromPartial(e??{})},fromPartial(e){let t=xI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interrupts=e.interrupts?.map(r=>Lm.fromPartial(r))||[],t.usage=e.usage?.map(r=>ii.fromPartial(r))||[],t}};function bI(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var eg={encode(e,t=new Pe){e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message);for(let r of e.usage)ii.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=bI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.code=r.string();continue;case 3:if(a!==26)break;o.message=r.string();continue;case 4:if(a!==34)break;o.usage.push(ii.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return eg.fromPartial(e??{})},fromPartial(e){let t=bI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>ii.fromPartial(r))||[],t}};function wI(){return{baseEvent:void 0,stepName:""}}var tg={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=wI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return tg.fromPartial(e??{})},fromPartial(e){let t=wI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function RI(){return{baseEvent:void 0,stepName:""}}var rg={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=RI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return rg.fromPartial(e??{})},fromPartial(e){let t=RI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function FI(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var ng={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=FI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.role=r.string();continue;case 4:if(a!==34)break;o.delta=r.string();continue;case 5:if(a!==42)break;o.name=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ng.fromPartial(e??{})},fromPartial(e){let t=FI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t}};function EI(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var og={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=EI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.toolCallName=r.string();continue;case 4:if(a!==34)break;o.parentMessageId=r.string();continue;case 5:if(a!==42)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return og.fromPartial(e??{})},fromPartial(e){let t=EI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function II(){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 TI={encode(e,t=new Pe){return e.textMessageStart!==void 0&&Um.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Qm.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Bm.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Gm.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&$m.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Hm.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&zm.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Wm.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Km.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Ym.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Jm.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Xm.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Zm.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&eg.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&tg.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&rg.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&ng.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&og.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=II();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.textMessageStart=Um.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.textMessageContent=Qm.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.textMessageEnd=Bm.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.toolCallStart=Gm.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.toolCallArgs=$m.decode(r,r.uint32());continue;case 6:if(a!==50)break;o.toolCallEnd=Hm.decode(r,r.uint32());continue;case 7:if(a!==58)break;o.stateSnapshot=zm.decode(r,r.uint32());continue;case 8:if(a!==66)break;o.stateDelta=Wm.decode(r,r.uint32());continue;case 9:if(a!==74)break;o.messagesSnapshot=Km.decode(r,r.uint32());continue;case 10:if(a!==82)break;o.raw=Ym.decode(r,r.uint32());continue;case 11:if(a!==90)break;o.custom=Jm.decode(r,r.uint32());continue;case 12:if(a!==98)break;o.runStarted=Xm.decode(r,r.uint32());continue;case 13:if(a!==106)break;o.runFinished=Zm.decode(r,r.uint32());continue;case 14:if(a!==114)break;o.runError=eg.decode(r,r.uint32());continue;case 15:if(a!==122)break;o.stepStarted=tg.decode(r,r.uint32());continue;case 16:if(a!==130)break;o.stepFinished=rg.decode(r,r.uint32());continue;case 17:if(a!==138)break;o.textMessageChunk=ng.decode(r,r.uint32());continue;case 18:if(a!==146)break;o.toolCallChunk=og.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return TI.fromPartial(e??{})},fromPartial(e){let t=II();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Um.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Qm.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Bm.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Gm.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?$m.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Hm.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?zm.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Wm.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Km.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Ym.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Jm.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Xm.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Zm.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?eg.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?tg.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?rg.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?ng.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?og.fromPartial(e.toolCallChunk):void 0,t}};function lc(e){let t=y.Number(e.toString());if(t>y.Number.MAX_SAFE_INTEGER)throw new y.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<y.Number.MIN_SAFE_INTEGER)throw new y.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var PI=e=>e&&typeof e=="object"?e:void 0;var Em=e=>{let t=PI(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}}}},nB=e=>{let t=PI(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:Em(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:Em(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:Em(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:Em(r.source),metadata:r.metadata}}}};function kI(e){let t=TI.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=rB[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,delete r.baseEvent,r.type===M.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;if(o.role==="user"&&Array.isArray(o.contentParts)){let a=o.contentParts.map(i=>nB(i)).filter(i=>i!==void 0);a.length>0&&(o.content=a)}Array.isArray(o.contentParts)&&o.contentParts.length===0&&(o.contentParts=void 0),o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===M.RUN_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,a=Array.isArray(n.interrupts)?n.interrupts:[];delete n.interrupts,o==="interrupt"?n.outcome={type:"interrupt",interrupts:a}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if((r.type===M.RUN_FINISHED||r.type===M.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===M.STATE_DELTA)for(let n of r.delta)n.op=tB[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]}),$f.parse(r)}var jA="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var aB=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,LA=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(aB);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},OI=e=>e==="*"||e==="x"||e==="X",_I=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},iB=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],sB=(e,t)=>{if(OI(e)||OI(t))return 0;let[r,n]=iB(_I(e),_I(t));return r>n?1:r<n?-1:0},UA=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=sB(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var jl=(e,t)=>{let r=LA(e),n=LA(t),o=r.pop(),a=n.pop(),i=UA(r,n);return i!==0?i:o&&a?UA(o.split("."),a.split(".")):o||a?o?-1:1:0};var je=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function Ll(){return Lo()}function GA(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&GA(t);return e}var NI=512*1024;function DI(e,t,r){let n=0,o=[e,t],a=new WeakSet;for(;o.length>0;){let i=o.pop();if(typeof i=="string"){if(n+=i.length,n>r)return!0}else if(typeof i=="object"&&i){if(a.has(i))continue;if(a.add(i),Array.isArray(i))for(let p=0;p<i.length;p++)o.push(i[p]);else{let p=Object.keys(i);for(let f=0;f<p.length;f++){let m=p[f];if(n+=m.length,n>r)return!0;o.push(i[m])}}}}return!1}function $e(_x140,_x141,_x142,_x143){return _$e.apply(this,arguments)}function _$e(){_$e=_asyncToGenerator(function*(e,t,r,n){let o=typeof process<"u"&&process.env!==void 0,a=o&&!!process.env.VITEST_WORKER_ID,i=o&&!!process.env.VITEST_WORKER_ID,p=i&&!DI(t,r,NI),f=p?je(t):t,m=p?je(r):r,g=!1,S=!1,x;for(let h of e)try{p&&(GA(f),GA(m));let C=yield n(h,f,m);if(C===void 0)continue;let b=!1;if(C.messages!==void 0&&C.messages!==f&&(f=je(C.messages),g=!0,b=!0),C.state!==void 0&&C.state!==m&&(m=je(C.state),S=!0,b=!0),p&&b&&DI(f,m,NI)&&(p=!1),x=C.stopPropagation,x===!0)break}catch(C){if(i&&C instanceof TypeError){if(a)throw C;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",C)}else a||console.error("Subscriber error:",C);continue}return{...(g?{messages:Object.isFrozen(f)?je(f):f}:{}),...(S?{state:Object.isFrozen(m)?je(m):m}:{}),...(x===void 0?{}:{stopPropagation:x})}});return _$e.apply(this,arguments)}function ag(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,r=e.lifecycle??!0,n=e.verbose??!1;return{enabled:t||r,events:t,lifecycle:r,verbose:n}}function Ul(e){if(e instanceof $A)return e;if(e===!0)return new $A(ag(!0))}var $A=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 QA(e){return e.enabled?new $A(e):void 0}function cB(e,t,r){if(t){let o=e.find(i=>i.id===t);if(o?.role==="assistant")return o;o&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${o.role}' message, not assistant \u2014 falling back to toolCallId`);let a={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(a),a}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}var UI=(e,t,r,n,o)=>{let a=Ul(o),i=je(r.messages),p=je(e.state),f={},m=S=>{S.messages!==void 0&&(i=S.messages,f.messages=S.messages),S.state!==void 0&&(p=S.state,f.state=S.state)},g=()=>{let S=je(f);return f={},S.messages!==void 0||S.state!==void 0?ot(S):cm};return t.pipe(bm(/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(S){let x=yield $e(n,i,p,(h,C,b)=>h.onEvent?.({event:S,agent:r,input:e,messages:C,state:b}));if(m(x),x.stopPropagation===!0?a?.event("APPLY","Event dropped:",S,{type:S.type,reason:"stopPropagation by subscriber"}):a?.event("APPLY","Event applied:",S,{type:S.type,subscribers:n.length}),x.stopPropagation===!0)return g();switch(S.type){case M.TEXT_MESSAGE_START:{let h=yield $e(n,i,p,(C,b,w)=>C.onTextMessageStartEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:C,role:b="assistant",name:w}=S;if(!i.find(F=>F.id===C)){let F={id:C,role:b,content:"",...(w!==void 0&&{name:w})};i.push(F),m({messages:i})}}return g()}case M.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:C}=S,b=i.find(F=>F.id===h);if(!b)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield $e(n,i,p,(F,I,E)=>F.onTextMessageContentEvent?.({event:S,messages:I,state:E,agent:r,input:e,textMessageBuffer:typeof b.content=="string"?b.content:""}));return m(w),w.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${C}`,m({messages:i})),g()}case M.TEXT_MESSAGE_END:{let{messageId:h}=S,C=i.find(b=>b.id===h);return C?(m(yield $e(n,i,p,(b,w,F)=>b.onTextMessageEndEvent?.({event:S,messages:w,state:F,agent:r,input:e,textMessageBuffer:typeof C.content=="string"?C.content:""}))),yield Promise.all(n.map(b=>{b.onNewMessage?.({message:C,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g())}case M.TOOL_CALL_START:{let h=yield $e(n,i,p,(C,b,w)=>C.onToolCallStartEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{toolCallId:C,toolCallName:b,parentMessageId:w}=S,F=i.find(E=>E.toolCalls?.some(T=>T.id===C))?.toolCalls?.find(E=>E.id===C);if(F)return F.function.name!==b&&(console.warn(`TOOL_CALL_START: tool call '${C}' already exists with name '${F.function.name}' \u2014 updating it to '${b}'`),F.function.name=b,m({messages:i})),g();let I=cB(i,w,C);I.toolCalls??(I.toolCalls=[]),I.toolCalls.push({id:C,type:"function",function:{name:b,arguments:""}}),m({messages:i})}return g()}case M.TOOL_CALL_ARGS:{let{toolCallId:h,delta:C}=S,b=i.find(I=>I.toolCalls?.some(E=>E.id===h));if(!b)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let w=b.toolCalls?.find(I=>I.id===h);if(!w)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let F=yield $e(n,i,p,(I,E,T)=>{let P=w.function.arguments,D=w.function.name,G={};try{G=Rm(P)}catch{}return I.onToolCallArgsEvent?.({event:S,messages:E,state:T,agent:r,input:e,toolCallBuffer:P,toolCallName:D,partialToolCallArgs:G})});return m(F),F.stopPropagation!==!0&&(w.function.arguments+=C,m({messages:i})),g()}case M.TOOL_CALL_END:{let{toolCallId:h}=S,C=i.find(w=>w.toolCalls?.some(F=>F.id===h));if(!C)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let b=C.toolCalls?.find(w=>w.id===h);return b?(m(yield $e(n,i,p,(w,F,I)=>{let E=b.function.arguments,T=b.function.name,P={};try{P=JSON.parse(E)}catch{}return w.onToolCallEndEvent?.({event:S,messages:F,state:I,agent:r,input:e,toolCallName:T,toolCallArgs:P})})),yield Promise.all(n.map(w=>{w.onNewToolCall?.({toolCall:b,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g())}case M.TOOL_CALL_RESULT:{let h=yield $e(n,i,p,(C,b,w)=>C.onToolCallResultEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:C,toolCallId:b,content:w,role:F}=S,I={id:C,toolCallId:b,role:F||"tool",content:w},E=i.findIndex(T=>T.role==="assistant"&&T.toolCalls?.some(P=>P.id===b));if(E===-1)i.push(I);else{let T=E+1;for(;T<i.length&&i[T].role==="tool";)T++;i.splice(T,0,I)}yield Promise.all(n.map(T=>{T.onNewMessage?.({message:I,messages:i,state:p,agent:r,input:e})})),m({messages:i})}return g()}case M.STATE_SNAPSHOT:{let h=yield $e(n,i,p,(C,b,w)=>C.onStateSnapshotEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{snapshot:C}=S;p=C,m({state:p})}return g()}case M.STATE_DELTA:{let h=yield $e(n,i,p,(C,b,w)=>C.onStateDeltaEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{delta:C}=S;try{p=Zf.applyPatch(p,C,!0,!1).newDocument,m({state:p})}catch(b){let w=b instanceof Error?b.message:String(b);console.warn(`Failed to apply state patch:
36
+ `.indexOf(e)>=0}function Rm(e){for(var t=["topLevel"],r=0,n,o,a,i=function(I){return t.push(I)},p=function(I){return t[t.length-1]=I},f=function(I){n==null&&(n=r,o=t.length,a=I)},m=function(I){I===a&&(n=void 0,o=void 0,a=void 0)},g=function(){return t.pop()},S=function(){return r--},x=function(I){if("0"<=I&&I<="9"){i("number");return}switch(I){case"\"":i("string");return;case"-":i("numberNeedsDigit");return;case"t":i("true");return;case"f":i("false");return;case"n":i("null");return;case"[":i("arrayNeedsValue");return;case"{":i("objectNeedsKey");return}},h=e.length;r<h;r++){var C=e[r];switch(t[t.length-1]){case"topLevel":x(C);break;case"string":switch(C){case"\"":g();break;case"\\":f("stringEscape"),i("stringEscaped");break}break;case"stringEscaped":C==="u"?i("stringUnicode"):(m("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(m("stringEscape"),g());break;case"number":C==="."?p("numberNeedsDigit"):C==="e"||C==="E"?p("numberNeedsExponent"):(C<"0"||C>"9")&&(S(),g());break;case"numberNeedsDigit":p("number");break;case"numberNeedsExponent":p(C==="+"||C==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(C<"a"||C>"z")&&(S(),g());break;case"arrayNeedsValue":C==="]"?g():qE(C)||(m("collectionItem"),p("arrayNeedsComma"),x(C));break;case"arrayNeedsComma":C==="]"?g():C===","&&(f("collectionItem"),p("arrayNeedsValue"));break;case"objectNeedsKey":C==="}"?g():C==="\""&&(f("collectionItem"),p("objectNeedsColon"),i("string"));break;case"objectNeedsColon":C===":"&&p("objectNeedsValue");break;case"objectNeedsValue":qE(C)||(m("collectionItem"),p("objectNeedsComma"),x(C));break;case"objectNeedsComma":C==="}"?g():C===","&&(f("collectionItem"),p("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var b=[n!=null?e.slice(0,n):e],w=function(I){return b.push(I.slice(e.length-e.lastIndexOf(I[0])))},F=t.length-1;F>=0;F--)switch(t[F]){case"string":b.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":b.push("0");break;case"true":w("true");break;case"false":w("false");break;case"null":w("null");break;case"arrayNeedsValue":case"arrayNeedsComma":b.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":b.push("}");break}return b.join("")}d();c();l();u();d();c();l();u();d();c();l();u();function VE(){let e=this.buf,t=this.pos,r=0,n=0;for(let a=0;a<28;a+=7){let i=e[t++];if(r|=(i&127)<<a,(i&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}let o=e[t++];if(r|=(o&15)<<28,n=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}for(let a=3;a<=31;a+=7){let i=e[t++];if(n|=(i&127)<<a,(i&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}throw new Error("invalid varint")}var Fm=4294967296;function EA(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function a(i,p){let f=Number(e.slice(i,p));o*=r,n=n*r+f,n>=Fm&&(o=o+(n/Fm|0),n=n%Fm)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?LE(n,o):TA(n,o)}function jE(e,t){let r=TA(e,t),n=r.hi&2147483648;n&&(r=LE(r.lo,r.hi));let o=IA(r.lo,r.hi);return n?"-"+o:o}function IA(e,t){if({lo:e,hi:t}=BQ(e,t),t<=2097151)return String(Fm*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,a=r+n*6777216+o*6710656,i=n+o*8147497,p=o*2,f=1e7;return a>=f&&(i+=Math.floor(a/f),a%=f),i>=f&&(p+=Math.floor(i/f),i%=f),p.toString()+ME(i)+ME(a)}function BQ(e,t){return{lo:e>>>0,hi:t>>>0}}function TA(e,t){return{lo:e|0,hi:t|0}}function LE(e,t){return t=~t,e?e=~e+1:t+=1,TA(e,t)}var ME=e=>{let t=String(e);return"0000000".slice(t.length)+t};function UE(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)===0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}d();c();l();u();var zr=GQ();function GQ(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!y.Deno||!!y.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(i){let p=typeof i=="bigint"?i:BigInt(i);if(p>n||p<r)throw new Error(`invalid int64: ${i}`);return p},uParse(i){let p=typeof i=="bigint"?i:BigInt(i);if(p>a||p<o)throw new Error(`invalid uint64: ${i}`);return p},enc(i){return e.setBigInt64(0,this.parse(i),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(i){return e.setBigInt64(0,this.uParse(i),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(i,p){return e.setInt32(0,i,!0),e.setInt32(4,p,!0),e.getBigInt64(0,!0)},uDec(i,p){return e.setInt32(0,i,!0),e.setInt32(4,p,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),QE(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),BE(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),QE(r),EA(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),BE(r),EA(r)},dec(r,n){return jE(r,n)},uDec(r,n){return IA(r,n)}}}function QE(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function BE(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}d();c();l();u();var PA;function $Q(e){var t;PA=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:OA(e.encodeUtf8.bind(e))})}function kA(){if(!PA){let e=y;if(!e.TextEncoder||!e.TextDecoder)throw new Error("encoding API missing: install TextEncoder and TextDecoder on globalThis");let t=new e.TextEncoder,r=new e.TextDecoder,n,o={encodeUtf8(i){return t.encode(i)},decodeUtf8(i,p){return p?(n||(n=new e.TextDecoder("utf-8",{fatal:!0})),n.decode(i)):r.decode(i)},checkUtf8(i){try{return encodeURIComponent(i),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let a=String.prototype.isWellFormed;a&&(o.checkUtf8=i=>a.call(i)),$Q(o)}return PA}function OA(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var $o;(function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"})($o||($o={}));var HQ=34028234663852886e22,zQ=-34028234663852886e22,WQ=4294967295,KQ=2147483647,YQ=-2147483648,Pe=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?OA(t):kA().encodeUtf8Into,this.buffer=$E,this.viewCache=XQ,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||JQ;for(;n<r;)n*=2;let o=new Uint8Array(n);this.pos>0&&o.set(this.buffer),this.buffer=o}}view(){let t=this.buffer,r=this.viewCache;if(r.byteLength===t.byteLength)return r;let n=new DataView(t.buffer);return this.viewCache=n,n}finish(){let t=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],t}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(ql),this.buffer[this.pos++]=0,this}join(){let t=this.stackPos.pop();if(t===void 0)throw new Error("invalid state, fork stack empty");let r=this.pos-t-ql,n=_A(r);return n>ql&&(this.ensureCapacity(n-ql),this.buffer.copyWithin(t+n,t+ql,this.pos)),this.pos=t,this.uint32(r),this.pos+=r,this}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if(GE(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(NA(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<=HE){this.ensureCapacity(r+1);let f=this.buffer,m=this.pos;f[m++]=r;let g=0;for(;g<r;g++){let S=t.charCodeAt(g);if(S>127)break;f[m++]=S}if(g==r)return this.pos=m,this}this.ensureCapacity(r*3+5);let n=_A(r),o=this.buffer,a=this.pos,{written:i}=this.encodeUtf8Into(t,o.subarray(a+n)),p=_A(i);return p!=n&&o.copyWithin(a+p,a+n,a+n+i),this.uint32(i),this.pos+=i,this}float(t){return ZQ(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 GE(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return NA(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return NA(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=zr.enc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}fixed64(t){let r=zr.uEnc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}int64(t){let r=zr.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=zr.enc(t),n=r.hi>>31,o=r.lo<<1^n,a=(r.hi<<1|r.lo>>>31)^n;return this.writeVarint64(o,a)}uint64(t){let r=zr.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let p=0;p<28;p=p+7){let f=t>>>p,m=!(!(f>>>7)&&r==0);if(n[o++]=(m?f|128:f)&255,!m)return this.pos=o,this}let a=t>>>28&15|(r&7)<<4,i=r>>3!=0;if(n[o++]=(i?a|128:a)&255,!i)return this.pos=o,this;for(let p=3;p<31;p=p+7){let f=r>>>p,m=!!(f>>>7);if(n[o++]=(m?f|128:f)&255,!m)return this.pos=o,this}return n[o++]=r>>>31&1,this.pos=o,this}},JQ=128,ql=1,$E=new Uint8Array(0),XQ=new DataView($E.buffer),HE=32;function _A(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var ie=class{constructor(t,r=kA().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=VE,this.uint32=UE,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.pos,r=this.uint32(),n=this.pos-t;if(n>5||n==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=r>>>3,a=r&7;if(o<=0||a>5)throw new Error("illegal tag: field no "+o+" wire type "+a);return[o,a]}skip(t,r,n=100){let o=this.pos;switch(t){case $o.Varint:for(;this.buf[this.pos++]&128;);break;case $o.Bit64:this.pos+=4;case $o.Bit32:this.pos+=4;break;case $o.LengthDelimited:let a=this.uint32();this.pos+=a;break;case $o.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[i,p]=this.tag();if(p===$o.EndGroup){if(r!==void 0&&i!==r)throw new Error("invalid end group tag");break}this.skip(p,i,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return this.varint64(),zr.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),zr.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,r=this.varint64Hi,n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,zr.dec(t,r)}bool(){let t=this.buf[this.pos];return t<128?(this.pos++,t!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return zr.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return zr.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){let r=this.bytes(),n=r.length;if(n<=HE){let o=new Array(n);for(let a=0;a<n;a++){let i=r[a];if(i>127)return this.decodeUtf8(r,t);o[a]=i}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(r,t)}};function NA(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>KQ||e<YQ)throw new Error("invalid int32: "+e)}function GE(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>WQ||e<0)throw new Error("invalid uint32: "+e)}function ZQ(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>HQ||e<zQ))throw new Error("invalid float32: "+e)}var eB=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function DA(){return{fields:{}}}var Ml={encode(e,t=new Pe){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&VA.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=DA();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:{if(a!==10)break;let i=VA.decode(r,r.uint32());i.value!==void 0&&(o.fields[i.key]=i.value);continue}}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ml.fromPartial(e??{})},fromPartial(e){let t=DA();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=DA();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 zE(){return{key:"",value:void 0}}var VA={encode(e,t=new Pe){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&ye.encode(ye.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=zE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.key=r.string();continue;case 2:if(a!==18)break;o.value=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return VA.fromPartial(e??{})},fromPartial(e){let t=zE();return t.key=e.key??"",t.value=e.value??void 0,t}};function qA(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var ye={encode(e,t=new Pe){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&Ml.encode(Ml.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Vl.encode(Vl.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=qA();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.nullValue=r.int32();continue;case 2:if(a!==17)break;o.numberValue=r.double();continue;case 3:if(a!==26)break;o.stringValue=r.string();continue;case 4:if(a!==32)break;o.boolValue=r.bool();continue;case 5:if(a!==42)break;o.structValue=Ml.unwrap(Ml.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.listValue=Vl.unwrap(Vl.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ye.fromPartial(e??{})},fromPartial(e){let t=qA();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=qA();if(e===null)t.nullValue=eB.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(y.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new y.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function MA(){return{values:[]}}var Vl={encode(e,t=new Pe){for(let r of e.values)ye.encode(ye.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=MA();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.values.push(ye.unwrap(ye.decode(r,r.uint32())));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Vl.fromPartial(e??{})},fromPartial(e){let t=MA();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=MA();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&y.Array.isArray(e.values)?e.values:e}},tB=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 WE(){return{op:0,path:"",from:void 0,value:void 0}}var Im={encode(e,t=new Pe){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&ye.encode(ye.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=WE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.op=r.int32();continue;case 2:if(a!==18)break;o.path=r.string();continue;case 3:if(a!==26)break;o.from=r.string();continue;case 4:if(a!==34)break;o.value=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Im.fromPartial(e??{})},fromPartial(e){let t=WE();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function KE(){return{id:"",type:"",function:void 0}}var Tm={encode(e,t=new Pe){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&Pm.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=KE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.type=r.string();continue;case 3:if(a!==26)break;o.function=Pm.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Tm.fromPartial(e??{})},fromPartial(e){let t=KE();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?Pm.fromPartial(e.function):void 0,t}};function YE(){return{name:"",arguments:""}}var Pm={encode(e,t=new Pe){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=YE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.name=r.string();continue;case 2:if(a!==18)break;o.arguments=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Pm.fromPartial(e??{})},fromPartial(e){let t=YE();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function JE(){return{value:"",mimeType:""}}var km={encode(e,t=new Pe){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==""&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=JE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.value=r.string();continue;case 2:if(a!==18)break;o.mimeType=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return km.fromPartial(e??{})},fromPartial(e){let t=JE();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function XE(){return{value:"",mimeType:void 0}}var Om={encode(e,t=new Pe){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=XE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.value=r.string();continue;case 2:if(a!==18)break;o.mimeType=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Om.fromPartial(e??{})},fromPartial(e){let t=XE();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function ZE(){return{data:void 0,url:void 0}}var pr={encode(e,t=new Pe){return e.data!==void 0&&km.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Om.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=ZE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.data=km.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.url=Om.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return pr.fromPartial(e??{})},fromPartial(e){let t=ZE();return t.data=e.data!==void 0&&e.data!==null?km.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Om.fromPartial(e.url):void 0,t}};function eI(){return{text:""}}var _m={encode(e,t=new Pe){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=eI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.text=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return _m.fromPartial(e??{})},fromPartial(e){let t=eI();return t.text=e.text??"",t}};function tI(){return{source:void 0,metadata:void 0}}var Nm={encode(e,t=new Pe){return e.source!==void 0&&pr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=tI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=pr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Nm.fromPartial(e??{})},fromPartial(e){let t=tI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function rI(){return{source:void 0,metadata:void 0}}var Dm={encode(e,t=new Pe){return e.source!==void 0&&pr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=rI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=pr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Dm.fromPartial(e??{})},fromPartial(e){let t=rI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function nI(){return{source:void 0,metadata:void 0}}var qm={encode(e,t=new Pe){return e.source!==void 0&&pr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=nI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=pr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return qm.fromPartial(e??{})},fromPartial(e){let t=nI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function oI(){return{source:void 0,metadata:void 0}}var Mm={encode(e,t=new Pe){return e.source!==void 0&&pr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=oI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=pr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Mm.fromPartial(e??{})},fromPartial(e){let t=oI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function aI(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var Vm={encode(e,t=new Pe){return e.text!==void 0&&_m.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Nm.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Dm.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&qm.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Mm.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=aI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.text=_m.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.image=Nm.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.audio=Dm.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.video=qm.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.document=Mm.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Vm.fromPartial(e??{})},fromPartial(e){let t=aI();return t.text=e.text!==void 0&&e.text!==null?_m.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Nm.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Dm.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?qm.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Mm.fromPartial(e.document):void 0,t}};function iI(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var jm={encode(e,t=new Pe){e.id!==""&&t.uint32(10).string(e.id),e.role!==""&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let r of e.toolCalls)Tm.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)Vm.encode(r,t.uint32(66).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=iI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.role=r.string();continue;case 3:if(a!==26)break;o.content=r.string();continue;case 4:if(a!==34)break;o.name=r.string();continue;case 5:if(a!==42)break;o.toolCalls.push(Tm.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.toolCallId=r.string();continue;case 7:if(a!==58)break;o.error=r.string();continue;case 8:if(a!==66)break;o.contentParts.push(Vm.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return jm.fromPartial(e??{})},fromPartial(e){let t=iI();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=>Tm.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>Vm.fromPartial(r))||[],t}};function sI(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0}}var Lm={encode(e,t=new Pe){return e.id!==""&&t.uint32(10).string(e.id),e.reason!==""&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&ye.encode(ye.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(58).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=sI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.reason=r.string();continue;case 3:if(a!==26)break;o.message=r.string();continue;case 4:if(a!==34)break;o.toolCallId=r.string();continue;case 5:if(a!==42)break;o.responseSchema=ye.unwrap(ye.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.expiresAt=r.string();continue;case 7:if(a!==58)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Lm.fromPartial(e??{})},fromPartial(e){let t=sI();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}},rB=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 cI(){return{type:0,timestamp:void 0,rawEvent:void 0}}var Ce={encode(e,t=new Pe){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&ye.encode(ye.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=cI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.type=r.int32();continue;case 2:if(a!==16)break;o.timestamp=lc(r.int64());continue;case 3:if(a!==26)break;o.rawEvent=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ce.fromPartial(e??{})},fromPartial(e){let t=cI();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function uI(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var Um={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=uI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.role=r.string();continue;case 4:if(a!==34)break;o.name=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Um.fromPartial(e??{})},fromPartial(e){let t=uI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function lI(){return{baseEvent:void 0,messageId:"",delta:""}}var Qm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=lI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Qm.fromPartial(e??{})},fromPartial(e){let t=lI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function dI(){return{baseEvent:void 0,messageId:""}}var Bm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=dI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Bm.fromPartial(e??{})},fromPartial(e){let t=dI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function pI(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var Gm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=pI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.toolCallName=r.string();continue;case 4:if(a!==34)break;o.parentMessageId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Gm.fromPartial(e??{})},fromPartial(e){let t=pI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function fI(){return{baseEvent:void 0,toolCallId:"",delta:""}}var $m={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=fI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return $m.fromPartial(e??{})},fromPartial(e){let t=fI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function mI(){return{baseEvent:void 0,toolCallId:""}}var Hm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=mI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Hm.fromPartial(e??{})},fromPartial(e){let t=mI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function gI(){return{baseEvent:void 0,snapshot:void 0}}var zm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&ye.encode(ye.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=gI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.snapshot=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return zm.fromPartial(e??{})},fromPartial(e){let t=gI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function hI(){return{baseEvent:void 0,delta:[]}}var Wm={encode(e,t=new Pe){e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)Im.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=hI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.delta.push(Im.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Wm.fromPartial(e??{})},fromPartial(e){let t=hI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>Im.fromPartial(r))||[],t}};function yI(){return{baseEvent:void 0,messages:[]}}var Km={encode(e,t=new Pe){e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)jm.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=yI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messages.push(jm.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Km.fromPartial(e??{})},fromPartial(e){let t=yI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>jm.fromPartial(r))||[],t}};function SI(){return{baseEvent:void 0,event:void 0,source:void 0}}var Ym={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&ye.encode(ye.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=SI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.event=ye.unwrap(ye.decode(r,r.uint32()));continue;case 3:if(a!==26)break;o.source=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ym.fromPartial(e??{})},fromPartial(e){let t=SI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function vI(){return{baseEvent:void 0,name:"",value:void 0}}var Jm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&ye.encode(ye.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=vI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.name=r.string();continue;case 3:if(a!==26)break;o.value=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Jm.fromPartial(e??{})},fromPartial(e){let t=vI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function AI(){return{baseEvent:void 0,threadId:"",runId:""}}var Xm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=AI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.threadId=r.string();continue;case 3:if(a!==26)break;o.runId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Xm.fromPartial(e??{})},fromPartial(e){let t=AI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function CI(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var ii={encode(e,t=new Pe){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=CI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.provider=r.string();continue;case 2:if(a!==18)break;o.model=r.string();continue;case 3:if(a!==24)break;o.inputTokens=lc(r.int64());continue;case 4:if(a!==32)break;o.outputTokens=lc(r.int64());continue;case 5:if(a!==40)break;o.totalTokens=lc(r.int64());continue;case 6:if(a!==48)break;o.reasoningTokens=lc(r.int64());continue;case 7:if(a!==56)break;o.cachedInputTokens=lc(r.int64());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ii.fromPartial(e??{})},fromPartial(e){let t=CI();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 xI(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var Zm={encode(e,t=new Pe){e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&ye.encode(ye.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)Lm.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)ii.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=xI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.threadId=r.string();continue;case 3:if(a!==26)break;o.runId=r.string();continue;case 4:if(a!==34)break;o.result=ye.unwrap(ye.decode(r,r.uint32()));continue;case 5:if(a!==42)break;o.outcome=r.string();continue;case 6:if(a!==50)break;o.interrupts.push(Lm.decode(r,r.uint32()));continue;case 7:if(a!==58)break;o.usage.push(ii.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Zm.fromPartial(e??{})},fromPartial(e){let t=xI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interrupts=e.interrupts?.map(r=>Lm.fromPartial(r))||[],t.usage=e.usage?.map(r=>ii.fromPartial(r))||[],t}};function bI(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var eg={encode(e,t=new Pe){e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message);for(let r of e.usage)ii.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=bI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.code=r.string();continue;case 3:if(a!==26)break;o.message=r.string();continue;case 4:if(a!==34)break;o.usage.push(ii.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return eg.fromPartial(e??{})},fromPartial(e){let t=bI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>ii.fromPartial(r))||[],t}};function wI(){return{baseEvent:void 0,stepName:""}}var tg={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=wI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return tg.fromPartial(e??{})},fromPartial(e){let t=wI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function RI(){return{baseEvent:void 0,stepName:""}}var rg={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=RI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return rg.fromPartial(e??{})},fromPartial(e){let t=RI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function FI(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var ng={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=FI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.role=r.string();continue;case 4:if(a!==34)break;o.delta=r.string();continue;case 5:if(a!==42)break;o.name=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ng.fromPartial(e??{})},fromPartial(e){let t=FI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t}};function EI(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var og={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=EI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.toolCallName=r.string();continue;case 4:if(a!==34)break;o.parentMessageId=r.string();continue;case 5:if(a!==42)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return og.fromPartial(e??{})},fromPartial(e){let t=EI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function II(){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 TI={encode(e,t=new Pe){return e.textMessageStart!==void 0&&Um.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Qm.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Bm.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Gm.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&$m.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Hm.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&zm.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Wm.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Km.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Ym.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Jm.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Xm.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Zm.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&eg.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&tg.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&rg.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&ng.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&og.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=II();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.textMessageStart=Um.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.textMessageContent=Qm.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.textMessageEnd=Bm.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.toolCallStart=Gm.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.toolCallArgs=$m.decode(r,r.uint32());continue;case 6:if(a!==50)break;o.toolCallEnd=Hm.decode(r,r.uint32());continue;case 7:if(a!==58)break;o.stateSnapshot=zm.decode(r,r.uint32());continue;case 8:if(a!==66)break;o.stateDelta=Wm.decode(r,r.uint32());continue;case 9:if(a!==74)break;o.messagesSnapshot=Km.decode(r,r.uint32());continue;case 10:if(a!==82)break;o.raw=Ym.decode(r,r.uint32());continue;case 11:if(a!==90)break;o.custom=Jm.decode(r,r.uint32());continue;case 12:if(a!==98)break;o.runStarted=Xm.decode(r,r.uint32());continue;case 13:if(a!==106)break;o.runFinished=Zm.decode(r,r.uint32());continue;case 14:if(a!==114)break;o.runError=eg.decode(r,r.uint32());continue;case 15:if(a!==122)break;o.stepStarted=tg.decode(r,r.uint32());continue;case 16:if(a!==130)break;o.stepFinished=rg.decode(r,r.uint32());continue;case 17:if(a!==138)break;o.textMessageChunk=ng.decode(r,r.uint32());continue;case 18:if(a!==146)break;o.toolCallChunk=og.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return TI.fromPartial(e??{})},fromPartial(e){let t=II();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Um.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Qm.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Bm.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Gm.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?$m.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Hm.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?zm.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Wm.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Km.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Ym.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Jm.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Xm.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Zm.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?eg.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?tg.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?rg.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?ng.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?og.fromPartial(e.toolCallChunk):void 0,t}};function lc(e){let t=y.Number(e.toString());if(t>y.Number.MAX_SAFE_INTEGER)throw new y.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<y.Number.MIN_SAFE_INTEGER)throw new y.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var PI=e=>e&&typeof e=="object"?e:void 0;var Em=e=>{let t=PI(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}}}},nB=e=>{let t=PI(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:Em(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:Em(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:Em(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:Em(r.source),metadata:r.metadata}}}};function kI(e){let t=TI.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=rB[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,delete r.baseEvent,r.type===M.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;if(o.role==="user"&&Array.isArray(o.contentParts)){let a=o.contentParts.map(i=>nB(i)).filter(i=>i!==void 0);a.length>0&&(o.content=a)}Array.isArray(o.contentParts)&&o.contentParts.length===0&&(o.contentParts=void 0),o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===M.RUN_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,a=Array.isArray(n.interrupts)?n.interrupts:[];delete n.interrupts,o==="interrupt"?n.outcome={type:"interrupt",interrupts:a}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if((r.type===M.RUN_FINISHED||r.type===M.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===M.STATE_DELTA)for(let n of r.delta)n.op=tB[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]}),$f.parse(r)}var jA="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var aB=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,LA=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(aB);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},OI=e=>e==="*"||e==="x"||e==="X",_I=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},iB=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],sB=(e,t)=>{if(OI(e)||OI(t))return 0;let[r,n]=iB(_I(e),_I(t));return r>n?1:r<n?-1:0},UA=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=sB(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var jl=(e,t)=>{let r=LA(e),n=LA(t),o=r.pop(),a=n.pop(),i=UA(r,n);return i!==0?i:o&&a?UA(o.split("."),a.split(".")):o||a?o?-1:1:0};var je=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function Ll(){return Lo()}function GA(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&GA(t);return e}var NI=512*1024;function DI(e,t,r){let n=0,o=[e,t],a=new WeakSet;for(;o.length>0;){let i=o.pop();if(typeof i=="string"){if(n+=i.length,n>r)return!0}else if(typeof i=="object"&&i){if(a.has(i))continue;if(a.add(i),Array.isArray(i))for(let p=0;p<i.length;p++)o.push(i[p]);else{let p=Object.keys(i);for(let f=0;f<p.length;f++){let m=p[f];if(n+=m.length,n>r)return!0;o.push(i[m])}}}}return!1}function $e(_x140,_x141,_x142,_x143){return _$e.apply(this,arguments)}function _$e(){_$e=_asyncToGenerator(function*(e,t,r,n){let o=typeof process<"u"&&process.env!==void 0,a=o&&!!process.env.VITEST_WORKER_ID,i=o&&!!process.env.VITEST_WORKER_ID,p=i&&!DI(t,r,NI),f=p?je(t):t,m=p?je(r):r,g=!1,S=!1,x;for(let h of e)try{p&&(GA(f),GA(m));let C=yield n(h,f,m);if(C===void 0)continue;let b=!1;if(C.messages!==void 0&&C.messages!==f&&(f=je(C.messages),g=!0,b=!0),C.state!==void 0&&C.state!==m&&(m=je(C.state),S=!0,b=!0),p&&b&&DI(f,m,NI)&&(p=!1),x=C.stopPropagation,x===!0)break}catch(C){if(i&&C instanceof TypeError){if(a)throw C;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",C)}else a||console.error("Subscriber error:",C);continue}return{...(g?{messages:Object.isFrozen(f)?je(f):f}:{}),...(S?{state:Object.isFrozen(m)?je(m):m}:{}),...(x===void 0?{}:{stopPropagation:x})}});return _$e.apply(this,arguments)}function ag(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,r=e.lifecycle??!0,n=e.verbose??!1;return{enabled:t||r,events:t,lifecycle:r,verbose:n}}function Ul(e){if(e instanceof $A)return e;if(e===!0)return new $A(ag(!0))}var $A=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 QA(e){return e.enabled?new $A(e):void 0}function cB(e,t,r){if(t){let o=e.find(i=>i.id===t);if(o?.role==="assistant")return o;o&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${o.role}' message, not assistant \u2014 falling back to toolCallId`);let a={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(a),a}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}var UI=(e,t,r,n,o)=>{let a=Ul(o),i=je(r.messages),p=je(e.state),f={},m=S=>{S.messages!==void 0&&(i=S.messages,f.messages=S.messages),S.state!==void 0&&(p=S.state,f.state=S.state)},g=()=>{let S=je(f);return f={},S.messages!==void 0||S.state!==void 0?ot(S):cm};return t.pipe(bm(/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(S){let x=yield $e(n,i,p,(h,C,b)=>h.onEvent?.({event:S,agent:r,input:e,messages:C,state:b}));if(m(x),x.stopPropagation===!0?a?.event("APPLY","Event dropped:",S,{type:S.type,reason:"stopPropagation by subscriber"}):a?.event("APPLY","Event applied:",S,{type:S.type,subscribers:n.length}),x.stopPropagation===!0)return g();switch(S.type){case M.TEXT_MESSAGE_START:{let h=yield $e(n,i,p,(C,b,w)=>C.onTextMessageStartEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:C,role:b="assistant",name:w}=S;if(!i.find(F=>F.id===C)){let F={id:C,role:b,content:"",...(w!==void 0&&{name:w})};i.push(F),m({messages:i})}}return g()}case M.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:C}=S,b=i.find(F=>F.id===h);if(!b)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield $e(n,i,p,(F,I,E)=>F.onTextMessageContentEvent?.({event:S,messages:I,state:E,agent:r,input:e,textMessageBuffer:typeof b.content=="string"?b.content:""}));return m(w),w.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${C}`,m({messages:i})),g()}case M.TEXT_MESSAGE_END:{let{messageId:h}=S,C=i.find(b=>b.id===h);return C?(m(yield $e(n,i,p,(b,w,F)=>b.onTextMessageEndEvent?.({event:S,messages:w,state:F,agent:r,input:e,textMessageBuffer:typeof C.content=="string"?C.content:""}))),yield Promise.all(n.map(b=>{b.onNewMessage?.({message:C,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g())}case M.TOOL_CALL_START:{let h=yield $e(n,i,p,(C,b,w)=>C.onToolCallStartEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{toolCallId:C,toolCallName:b,parentMessageId:w}=S,F=i.find(E=>E.toolCalls?.some(T=>T.id===C))?.toolCalls?.find(E=>E.id===C);if(F)return F.function.name!==b&&(console.warn(`TOOL_CALL_START: tool call '${C}' already exists with name '${F.function.name}' \u2014 updating it to '${b}'`),F.function.name=b,m({messages:i})),g();let I=cB(i,w,C);I.toolCalls??(I.toolCalls=[]),I.toolCalls.push({id:C,type:"function",function:{name:b,arguments:""}}),m({messages:i})}return g()}case M.TOOL_CALL_ARGS:{let{toolCallId:h,delta:C}=S,b=i.find(I=>I.toolCalls?.some(E=>E.id===h));if(!b)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let w=b.toolCalls?.find(I=>I.id===h);if(!w)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let F=yield $e(n,i,p,(I,E,T)=>{let P=w.function.arguments,D=w.function.name,G={};try{G=Rm(P)}catch{}return I.onToolCallArgsEvent?.({event:S,messages:E,state:T,agent:r,input:e,toolCallBuffer:P,toolCallName:D,partialToolCallArgs:G})});return m(F),F.stopPropagation!==!0&&(w.function.arguments+=C,m({messages:i})),g()}case M.TOOL_CALL_END:{let{toolCallId:h}=S,C=i.find(w=>w.toolCalls?.some(F=>F.id===h));if(!C)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let b=C.toolCalls?.find(w=>w.id===h);return b?(m(yield $e(n,i,p,(w,F,I)=>{let E=b.function.arguments,T=b.function.name,P={};try{P=JSON.parse(E)}catch{}return w.onToolCallEndEvent?.({event:S,messages:F,state:I,agent:r,input:e,toolCallName:T,toolCallArgs:P})})),yield Promise.all(n.map(w=>{w.onNewToolCall?.({toolCall:b,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g())}case M.TOOL_CALL_RESULT:{let h=yield $e(n,i,p,(C,b,w)=>C.onToolCallResultEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:C,toolCallId:b,content:w,role:F}=S,I={id:C,toolCallId:b,role:F||"tool",content:w},E=i.findIndex(T=>T.role==="assistant"&&T.toolCalls?.some(P=>P.id===b));if(E===-1)i.push(I);else{let T=E+1;for(;T<i.length&&i[T].role==="tool";)T++;i.splice(T,0,I)}yield Promise.all(n.map(T=>{T.onNewMessage?.({message:I,messages:i,state:p,agent:r,input:e})})),m({messages:i})}return g()}case M.STATE_SNAPSHOT:{let h=yield $e(n,i,p,(C,b,w)=>C.onStateSnapshotEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{snapshot:C}=S;p=C,m({state:p})}return g()}case M.STATE_DELTA:{let h=yield $e(n,i,p,(C,b,w)=>C.onStateDeltaEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{delta:C}=S;try{p=Zf.applyPatch(p,C,!0,!1).newDocument,m({state:p})}catch(b){let w=b instanceof Error?b.message:String(b);console.warn(`Failed to apply state patch:
37
37
  Current state: ${JSON.stringify(p,null,2)}
38
38
  Patch operations: ${JSON.stringify(C,null,2)}
39
39
  Error: ${w}`)}}return g()}case M.MESSAGES_SNAPSHOT:{let h=yield $e(n,i,p,(C,b,w)=>C.onMessagesSnapshotEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messages:C}=S,b=new Map(C.map(T=>[T.id,T])),w=C.some(T=>T.role==="activity"),F=C.some(T=>T.role==="reasoning"),I=T=>T.role==="activity"&&!w||T.role==="reasoning"&&!F;i=i.filter(T=>I(T)||b.has(T.id)).map(T=>I(T)?T:b.get(T.id));let E=new Set(i.map(T=>T.id));for(let T of C)E.has(T.id)||i.push(T);m({messages:i})}return g()}case M.ACTIVITY_SNAPSHOT:{let h=S,C=i.findIndex(E=>E.id===h.messageId),b=C>=0?i[C]:void 0,w=b?.role==="activity"?b:void 0,F=h.replace??!0,I=yield $e(n,i,p,(E,T,P)=>E.onActivitySnapshotEvent?.({event:h,messages:T,state:P,agent:r,input:e,activityMessage:w,existingMessage:b}));if(m(I),I.stopPropagation!==!0){let E={id:h.messageId,role:"activity",activityType:h.activityType,content:je(h.content)},T;C===-1?(i.push(E),T=E):w?F&&(i[C]={...w,activityType:h.activityType,content:je(h.content)}):F&&(i[C]=E,T=E),m({messages:i}),T&&(yield Promise.all(n.map(P=>P.onNewMessage?.({message:T,messages:i,state:p,agent:r,input:e}))))}return g()}case M.ACTIVITY_DELTA:{let h=S,C=i.findIndex(I=>I.id===h.messageId);if(C===-1)return g();let b=i[C];if(b.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let w=b,F=yield $e(n,i,p,(I,E,T)=>I.onActivityDeltaEvent?.({event:h,messages:E,state:T,agent:r,input:e,activityMessage:w}));if(m(F),F.stopPropagation!==!0)try{let I=je(w.content??{}),E=Zf.applyPatch(I,h.patch??[],!0,!1).newDocument;i[C]={...w,content:je(E),activityType:h.activityType},m({messages:i})}catch(I){let E=I instanceof Error?I.message:String(I);console.warn(`Failed to apply activity patch for '${h.messageId}': ${E}`)}return g()}case M.RAW:return m(yield $e(n,i,p,(h,C,b)=>h.onRawEvent?.({event:S,messages:C,state:b,agent:r,input:e}))),g();case M.CUSTOM:return m(yield $e(n,i,p,(h,C,b)=>h.onCustomEvent?.({event:S,messages:C,state:b,agent:r,input:e}))),g();case M.RUN_STARTED:{let h=yield $e(n,i,p,(C,b,w)=>C.onRunStartedEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let C=S;if(C.input?.messages){for(let b of C.input.messages)i.find(w=>w.id===b.id)||i.push(b);m({messages:i})}}return g()}case M.RUN_FINISHED:{let h=S,C=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},b=yield $e(n,i,p,(w,F,I)=>w.onRunFinishedEvent?.({...C,messages:F,state:I,agent:r,input:e}));return m(b),b.stopPropagation!==!0&&(r.pendingInterrupts=C.outcome==="interrupt"?[...C.interrupts]:[]),g()}case M.RUN_ERROR:return m(yield $e(n,i,p,(h,C,b)=>h.onRunErrorEvent?.({event:S,messages:C,state:b,agent:r,input:e}))),g();case M.STEP_STARTED:return m(yield $e(n,i,p,(h,C,b)=>h.onStepStartedEvent?.({event:S,messages:C,state:b,agent:r,input:e}))),g();case M.STEP_FINISHED:return m(yield $e(n,i,p,(h,C,b)=>h.onStepFinishedEvent?.({event:S,messages:C,state:b,agent:r,input:e}))),g();case M.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case M.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case M.THINKING_START:return g();case M.THINKING_END:return g();case M.THINKING_TEXT_MESSAGE_START:return g();case M.THINKING_TEXT_MESSAGE_CONTENT:return g();case M.THINKING_TEXT_MESSAGE_END:return g();case M.REASONING_START:return m(yield $e(n,i,p,(h,C,b)=>h.onReasoningStartEvent?.({event:S,messages:C,state:b,agent:r,input:e}))),g();case M.REASONING_MESSAGE_START:{let h=yield $e(n,i,p,(C,b,w)=>C.onReasoningMessageStartEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:C}=S;if(!i.find(b=>b.id===C)){let b={id:C,role:"reasoning",content:""};i.push(b),m({messages:i})}}return g()}case M.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:C}=S,b=i.find(F=>F.id===h);if(!b)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield $e(n,i,p,(F,I,E)=>F.onReasoningMessageContentEvent?.({event:S,messages:I,state:E,agent:r,input:e,reasoningMessageBuffer:typeof b.content=="string"?b.content:""}));return m(w),w.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${C}`,m({messages:i})),g()}case M.REASONING_MESSAGE_END:{let{messageId:h}=S,C=i.find(b=>b.id===h);return C?(m(yield $e(n,i,p,(b,w,F)=>b.onReasoningMessageEndEvent?.({event:S,messages:w,state:F,agent:r,input:e,reasoningMessageBuffer:typeof C.content=="string"?C.content:""}))),yield Promise.all(n.map(b=>{b.onNewMessage?.({message:C,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g())}case M.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case M.REASONING_END:return m(yield $e(n,i,p,(h,C,b)=>h.onReasoningEndEvent?.({event:S,messages:C,state:b,agent:r,input:e}))),g();case M.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:C,encryptedValue:b}=S,w=yield $e(n,i,p,(F,I,E)=>F.onReasoningEncryptedValueEvent?.({event:S,messages:I,state:E,agent:r,input:e}));if(m(w),w.stopPropagation!==!0){let F=!1;if(h==="tool-call"){for(let I of i)if(I.role==="assistant"&&I.toolCalls){let E=I.toolCalls.find(T=>T.id===C);if(E){E.encryptedValue=b,F=!0;break}}}else{let I=i.find(E=>E.id===C);I?.role!=="activity"&&I&&(I.encryptedValue=b,F=!0)}F&&(f.messages=i)}return g()}}return S.type,g()});return function(_x144){return _ref57.apply(this,arguments)}}()),bA(),n.length>0?wA({}):S=>S)},BA=e=>t=>{let r=Ul(e),n=new Map,o=new Map,a=!1,i=!1,p=!1,f=new Map,m=!1,g=!1,S=!1,x=()=>{n.clear(),o.clear(),f.clear(),m=!1,g=!1,a=!1,i=!1,S=!0};return t.pipe(nr(h=>{let C=h.type;if(r?.event("VERIFY","Event:",h,{type:h.type}),i)return et(()=>new Xe(`Cannot send event type '${C}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(a&&C!==M.RUN_ERROR&&C!==M.RUN_STARTED)return et(()=>new Xe(`Cannot send event type '${C}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(p){if(C===M.RUN_STARTED){if(S&&!a)return et(()=>new Xe("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));a&&x()}}else if(p=!0,C!==M.RUN_STARTED&&C!==M.RUN_ERROR)return et(()=>new Xe("First event must be 'RUN_STARTED'"));switch(C){case M.TEXT_MESSAGE_START:{let b=h.messageId;return n.has(b)?et(()=>new Xe(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${b}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(n.set(b,!0),ot(h))}case M.TEXT_MESSAGE_CONTENT:{let b=h.messageId;return n.has(b)?ot(h):et(()=>new Xe(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${b}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case M.TEXT_MESSAGE_END:{let b=h.messageId;return n.has(b)?(n.delete(b),ot(h)):et(()=>new Xe(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${b}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case M.TOOL_CALL_START:{let b=h.toolCallId;return o.has(b)?et(()=>new Xe(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${b}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(o.set(b,!0),ot(h))}case M.TOOL_CALL_ARGS:{let b=h.toolCallId;return o.has(b)?ot(h):et(()=>new Xe(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${b}'. Start a tool call with 'TOOL_CALL_START' first.`))}case M.TOOL_CALL_END:{let b=h.toolCallId;return o.has(b)?(o.delete(b),ot(h)):et(()=>new Xe(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${b}'. A 'TOOL_CALL_START' event must be sent first.`))}case M.STEP_STARTED:{let b=h.stepName;return f.has(b)?et(()=>new Xe(`Step "${b}" is already active for 'STEP_STARTED'`)):(f.set(b,!0),ot(h))}case M.STEP_FINISHED:{let b=h.stepName;return f.has(b)?(f.delete(b),ot(h)):et(()=>new Xe(`Cannot send 'STEP_FINISHED' for step "${b}" that was not started`))}case M.RUN_STARTED:return S=!0,ot(h);case M.RUN_FINISHED:if(f.size>0){let b=Array.from(f.keys()).join(", ");return et(()=>new Xe(`Cannot send 'RUN_FINISHED' while steps are still active: ${b}`))}if(n.size>0){let b=Array.from(n.keys()).join(", ");return et(()=>new Xe(`Cannot send 'RUN_FINISHED' while text messages are still active: ${b}`))}if(o.size>0){let b=Array.from(o.keys()).join(", ");return et(()=>new Xe(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${b}`))}return a=!0,ot(h);case M.RUN_ERROR:return i=!0,ot(h);case M.CUSTOM:return ot(h);case M.THINKING_TEXT_MESSAGE_START:return m?g?et(()=>new Xe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(g=!0,ot(h)):et(()=>new Xe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case M.THINKING_TEXT_MESSAGE_CONTENT:return g?ot(h):et(()=>new Xe("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case M.THINKING_TEXT_MESSAGE_END:return g?(g=!1,ot(h)):et(()=>new Xe("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case M.THINKING_START:return m?et(()=>new Xe("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(m=!0,ot(h));case M.THINKING_END:return m?(m=!1,ot(h)):et(()=>new Xe("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return ot(h)}}))},si=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),uB=e=>xm(()=>ni(e())).pipe(RA(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return ni(t.text()).pipe(nr(a=>{let i=a;if(o.includes("application/json"))try{i=JSON.parse(a)}catch{}let p=Error(`HTTP ${t.status}: ${typeof i=="string"?i:JSON.stringify(i)}`);return p.status=t.status,p.payload=i,et(()=>p)}))}let r={type:si.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new Ze(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:a,value:i}=yield n.read();if(a)break;let p={type:si.DATA,data:i};o.next(p)}o.complete()}catch(a){o.error(a)}})(),()=>{n.cancel().catch(a=>{if(a?.name!=="AbortError")throw a})})):et(()=>Error("Failed to getReader() from response"))})),lB=(e,t)=>{let r=Ul(t),n=new yn,o=new TextDecoder("utf-8",{fatal:!1}),a="";e.subscribe({next:p=>{if(p.type!==si.HEADERS&&p.type===si.DATA&&p.data){let f=o.decode(p.data,{stream:!0});a+=f;let m=a.split(/\n\n/);a=m.pop()||"";for(let g of m)i(g)}},error:p=>n.error(p),complete:()=>{a&&(a+=o.decode(),i(a)),n.complete()}});function i(p){let f=p.split(`
@@ -79,4 +79,4 @@ fast-json-patch/module/duplex.mjs:
79
79
  *)
80
80
  */if(__exports!=exports)module.exports=exports;return module.exports});
81
81
 
82
- window.coveoQuanticVersion = '3.44.2';
82
+ window.coveoQuanticVersion = '3.44.3';