@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 Do(r)}var Do=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},_e=class{constructor(e){de(this,"definition");this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let i=this.definition[o].validate(r[o]);i&&n.push(`${o}: ${i}`)}if(n.length)throw uO(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}},He=class{constructor(e={}){de(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&J(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 $i(e){return e===void 0}function lO(e){return e===null}function J(e){return $i(e)||lO(e)}var pe=class{constructor(e={}){de(this,"value");this.value=new He(e)}validate(e){let t=this.value.validate(e);return t||(dO(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function dO(e){return $i(e)||Vu(e)}function Vu(e){return typeof e=="boolean"}var ne=class{constructor(e={}){de(this,"config");de(this,"value");this.config=e,this.value=new He(e)}validate(e){let t=this.value.validate(e);return t||(pO(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 pO(e){return $i(e)||aA(e)}function aA(e){return typeof e=="number"&&!Number.isNaN(e)}var fO=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,$=class{constructor(e={}){de(this,"value");de(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new He(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:i}=this.config,a=this.value.validate(e);if(a)return a;if($i(e))return null;if(!Hi(e))return"value is not a string.";if(!t&&!e.length)return"value is an empty string.";if(r)try{new URL(e)}catch{return"value is not a valid URL."}return n&&!n.test(e)?`value did not match provided regex ${n}`:o&&!o.includes(e)?`value should be one of: ${o.join(", ")}.`:i&&!(fO.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 Hi(e){return Object.prototype.toString.call(e)==="[object String]"}var Y=class{constructor(e={}){de(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if($i(e))return this.config.options.required?"value is required and is currently undefined":null;if(!sA(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&J(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],i=n.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function sA(e){return e!==void 0&&typeof e=="object"}var oe=class{constructor(e={}){de(this,"config");de(this,"value");this.config=e,this.value=new He(this.config)}validate(e){if(!J(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(J(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&&J(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 Vu(e)||Hi(e)||aA(e)||sA(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function zi(e){return Array.isArray(e)}var tc=class{constructor(e){de(this,"config");de(this,"value");this.config=e,this.value=new He(e)}validate(e){let t=this.value.validate(e);return t!==null?t:$i(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 ju=(e,t=5)=>e+Math.random().toString(36).substring(2,2+t);function Lu(e){return Array.isArray(e)}function Uu(e){return e.trim()===""}function cA(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}function mO(e){return btoa(encodeURI(e))}function Qu(e,t){let{[e]:r,...n}=t;return n}function Wi(e){return mO(JSON.stringify(e))}var gO=new Set(["1",1,"yes",!0]);function Wg(){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=>gO.has(r))}function uA(e){let t={};for(let[r,n]of e)t[r]=n;return t}function lA(e,t,r){return clearTimeout(t),setTimeout(e,r)}function rc(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Bu(e,t,r={}){let n;return(...o)=>{let i=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,o)},t),i)return e.apply(void 0,o)}}function hO(e){if(Uu(e.openingDelimiter)||Uu(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(J(e.content)||Uu(e.content))return e.content;if(e.highlights.length===0)return Yi(e.content);let t=e.content.length,r="",n=0;for(let o=0;o<e.highlights.length;o++){let i=e.highlights[o],a=i.offset,p=a+i.length;if(p>t)break;r+=Yi(e.content.slice(n,a)),r+=e.openingDelimiter,r+=Yi(e.content.slice(a,p)),r+=e.closingDelimiter,n=p}return n!==t&&(r+=Yi(e.content.slice(n))),r}function Kg(e,t){return e=Yi(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?Yg(n,t.notMatchDelimiters):o?Yg(o,t.exactMatchDelimiters):i?Yg(i,t.correctionDelimiters):r)}function Yg(e,t){return t?t.open+e+t.close:e}function Yi(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,i=>t[i]):e}d();c();l();u();var bA=Fr(SA(),1);d();c();l();u();var ae=new Error("Failed to load reducers."),Ki=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."}},Mo=class extends Error{constructor(r,n){super();de(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 vA(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function AA(e){return typeof e!="object"||!e?!1:Object.values(e).every(QO)}function QO(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function CA(e){return e===429}var Lr=class e{static call(t){return _asyncToGenerator(function*(){let r=BO(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:i,...a}=o,p=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let f=yield A(i,a);if(CA(f.status))throw f;return f});return function p(){return _ref.apply(this,arguments)}}();try{let f=yield(0,bA.backOff)(p,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(m){let g=m&&CA(m.status);return g&&(n.info("Platform retrying request"),yield new Promise(v=>setTimeout(v,1e3))),g});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(f.status){case 419:case 401:throw n.info("Platform renewing token"),new Ki;case 404:throw new Mo(i,f.status);default:return n.info({response:f,requestInfo:o},"Platform response"),f}}catch(f){return f.message==="Failed to fetch"?new Mo(i):f}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:p,...f}=t,m=rc(f);try{let g=yield o(t,n,a);return{...t,...g}}catch(g){i.error(g,"Platform request preprocessing failed. Returning default request options.")}return m})()}};function mt(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Gn(e,t,r="prod"){return e??mt(t,r)}function Kt(e,t="prod"){return`${mt(e,t)}/rest/search/v2`}function $u(e,t="prod"){return`${mt(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function BO(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,p=e.method==="POST"||e.method==="PUT",f=GO(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(p&&{body:f}),signal:a}}function GO(e,t){return t==="application/x-www-form-urlencoded"?AA(e)?vA(e):"":JSON.stringify(e)}d();c();l();u();var ic=Fr(Hu(),1),FA=Fr(xA(),1);d();c();l();u();var zu=Fr(Hu(),1),RA=Fr(wA(),1);zu.default.extend(RA.default);var IA="YYYY/MM/DD@HH:mm:ss",$O="1401-01-01";function Xi(e,t){let r=(0,zu.default)(e,t);return!r.isValid()&&!t?(0,zu.default)(e,IA):r}function Wu(e){return e.format(IA)}function EA(e,t){let r=Xi(e,t);if(!r.isValid()){let n=". Please provide a date format string in the configuration options. See https://day.js.org/docs/en/parse/string-format for more information.",o=` with the format "${t}"`;throw new Error(`Could not parse the provided date "${e}"${t?o:n}`)}ph(r)}function ph(e){if(e.isBefore($O))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}ic.default.extend(FA.default);var TA=["past","now","next"],PA=["minute","hour","day","week","month","quarter","year"],HO=e=>{let t=e==="now";return{amount:new ne({required:!t,min:1}),unit:new $({required:!t,constrainTo:PA}),period:new $({required:!0,constrainTo:TA})}};function Yu(e){if(typeof e=="string"&&!$n(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?fh(e):e;new _e(HO(t.period)).validate(t);let r=OA(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);ph(r)}function kA(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function OA(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,ic.default)().subtract(r,n);case"next":return(0,ic.default)().add(r,n);case"now":return(0,ic.default)()}}function ac(e){return Wu(OA(fh(e)))}function _A(e){return e.toLocaleLowerCase().split("-")}function $n(e){let[t,r,n]=_A(e);if(t==="now")return!0;if(!TA.includes(t)||!PA.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function NA(e){return!!e&&typeof e=="object"&&"period"in e}function fh(e){let[t,r,n]=_A(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}function DA(e){return Yu(e),fh(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function MA(_x3,_x4){return _MA.apply(this,arguments)}function _MA(){_MA=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _MA.apply(this,arguments)}function VA(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=WO(t,a);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 jA(e,t,r){let n=qA(),o=new TextDecoder;return function(a,p){if(a.length===0)r?.(n),n=qA();else if(p>0){let f=o.decode(a.subarray(0,p)),m=p+(a[p+1]===32?2:1),g=o.decode(a.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":zO(g,n,t);break}}}}function zO(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function WO(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function qA(){return{data:"",event:"",id:"",retry:void 0}}var mh="text/event-stream",YO=1e3,LA="last-event-id";function UA(){return typeof window<"u"}function Ku(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:a,openWhenHidden:p,fetch:f,...m}){return new Promise((g,v)=>{let b={...r};b.accept||(b.accept=mh);let h;function y(){h?.abort(),document.hidden||T()}!p&&UA()&&document.addEventListener("visibilitychange",y);let x=YO,w;function I(){UA()&&document.removeEventListener("visibilitychange",y),clearTimeout(w),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let F=f??A,E=n??KO;function T(){return _T2.apply(this,arguments)}function _T2(){_T2=_asyncToGenerator(function*(){h=s.AbortController?new s.AbortController:null;try{let P=yield F(e,{...m,headers:b,signal:h?.signal});yield E(P),yield MA(P.body,VA(jA(q=>{q?b[LA]=q:delete b[LA]},q=>{x=q},o))),i?.(),I(),g()}catch(P){if(!h?.signal?.aborted)try{let q=a?.(P)??x;clearTimeout(w),w=setTimeout(T,q)}catch(q){I(),v(q)}}});return _T2.apply(this,arguments)}T()})}function KO(e){let t=e.headers.get("content-type");if(!t?.startsWith(mh))throw new Error(`Expected content-type to be ${mh}, Actual: ${t}`)}d();c();l();u();var Hn=class{constructor(t){de(this,"_basePath");de(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 XO=(e,t,r)=>new Hn(`${e}/rest/organizations/${t}/machinelearning/streaming/${r}`).href,QA=3,ZO=5e3,JO="text/event-stream",yh=1,gh=class extends Error{},sc=class extends Error{constructor(r){super(r.message);de(this,"payload",r)}},hh=class{constructor(){de(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)}},Xu=class{constructor(t){de(this,"logger");this.logger=t.logger}streamGeneratedAnswer(t,r){let{url:n,organizationId:o,streamId:i,accessToken:a}=t,{write:p,abort:f,close:m,resetAnswer:g}=r,v=new hh;if(!i){this.logger.error("No stream ID found");return}let b=0,h,y=()=>{h&&!v.isActive(h)&&(w?.abort(),g(),I())},x=()=>{v.remove(h),h=lA(y,h,ZO),v.add(h)},w=new s.AbortController,I=()=>Ku(XO(n,o,i),{method:"GET",fetch:A,headers:{Authorization:`Bearer ${a}`,accept:"*/*"},openWhenHidden:!0,signal:w?.signal,onopen(F){return _asyncToGenerator(function*(){if(F.ok&&F.headers.get("content-type")===JO)return;throw F.status>=400&&F.status<500&&F.status!==429?new sc({message:"Error opening stream",code:F.status}):new gh})()},onmessage:F=>{if(w?.signal.aborted)return;let E=JSON.parse(F.data);if(E.finishReason==="ERROR"){v.remove(h),w?.abort(),f({message:E.errorMessage,code:E.statusCode});return}p(E),b=0,E.finishReason==="COMPLETED"?(v.remove(h),m()):x()},onerror:F=>{if(!w?.signal.aborted){if(v.remove(h),F instanceof sc)throw w?.abort(),f(F),F;if(++b>QA){this.logger.info("Maximum retry exceeded.");let E={message:"Failed to complete stream.",code:yh};throw w?.abort(),f(E),new sc(E)}this.logger.info(`Retrying...(${b}/${QA})`),g()}}});return I(),w}};d();c();l();u();var Zu=e=>e;d();c();l();u();d();c();l();u();d();c();l();u();function cc(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Sh=e=>{let{response:t}=e;return t.body?e_(e):t_(t)},e_=e=>n_(e)?o_(e):r_(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},t_=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function r_(e){return e.body.statusCode!==void 0}function n_(e){return e.body.exception!==void 0}var o_=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});d();c();l();u();function BA(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}d();c();l();u();var vh=(e,t,r,n)=>{let o=new Hn(`${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 GA=(e,t)=>{let r=new Hn(`${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},Ah=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Lr.call({...vh(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:cc(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=BA(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return i_(a)?{success:a}:{error:Sh({response:r,body:a})}});return function Ah(_x5,_x6){return _ref3.apply(this,arguments)}}();function i_(e){return typeof e=="string"}d();c();l();u();d();c();l();u();function Zi(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function bt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Zi(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Zi(),extendedResults:{},searchAction:void 0}}d();c();l();u();d();c();l();u();function a_(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function s_(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Ji(e,t){if(t&&e.name==="AbortError")return{error:s_(e)};if(e instanceof Mo)return{error:a_(e)};throw e}var zn=e=>e.success!==void 0,ze=e=>e.error!==void 0;function $A(e){return e.results!==void 0}function HA(e){let t=Zi();return J(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}d();c();l();u();d();c();l();u();var Ch=(e,t)=>`${e.url}/rest/organizations/${e.organizationId}/insight/v1/configs/${e.insightId}${t??""}`,c_=e=>`${e.url}/rest/organizations/${e.organizationId}/machinelearning/user/actions`,uc=(e,t,r,n)=>{u_(e);let o=Ch(e,n);return{accessToken:e.accessToken,method:t,contentType:r,url:o,origin:"insightApiFetch"}},zA=(e,t,r)=>{l_(e);let n=c_(e);return{accessToken:e.accessToken,method:t,contentType:r,url:n,origin:"insightApiFetch"}},bh=e=>{let{insightId:t,...r}=cc(e);return r},WA=e=>{if(!e.url)throw new Error("The 'url' attribute must contain a valid platform URL.");if(!e.organizationId)throw new Error("The 'organizationId' attribute must contain a valid organization ID.");if(!e.accessToken)throw new Error("The 'accessToken' attribute must contain a valid platform access token.")},u_=e=>{if(WA(e),!e.insightId)throw new Error("The 'insightId' attribute must contain a valid Insight Panel configuration ID.")},l_=e=>{if(WA(e),!e.userId)throw new Error("The 'userId' attribute must contain a valid user ID.")};var YA=e=>({...uc(e,"GET","application/json","/interface"),requestParams:{}});d();c();l();u();var KA=e=>({...uc(e,"POST","application/json","/search"),requestParams:bh(e)}),XA=e=>({...uc(e,"POST","application/json","/querysuggest"),requestParams:bh(e)});d();c();l();u();var ZA=e=>({...zA(e,"POST","application/json"),requestParams:{objectId:e.userId}});var Ju=class{constructor(t){de(this,"options",t)}getInterface(t){var _this=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...YA(t),..._this.options});if(r instanceof Error)return Ji(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}query(t,r){var _this2=this;return _asyncToGenerator(function*(){let n=yield Lr.call({...KA(t),requestMetadata:{method:"search",origin:r?.origin},..._this2.options});if(n instanceof Error)return Ji(n);let o=yield n.json();return $A(o)&&(o=HA(o)),n.ok?{success:o}:{error:o}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...XA(t),..._this3.options});if(r instanceof Error)return Ji(r);let n=yield r.json();return n.completions?{success:n}:{error:n}})()}userActions(t){var _this4=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...ZA(t),..._this4.options});if(r instanceof Error)return Ji(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this5=this;return _asyncToGenerator(function*(){return Ah(t,{..._this5.options})})()}};d();c();l();u();d();c();l();u();var H=new $({required:!0,emptyAllowed:!1}),We=new $({required:!1,emptyAllowed:!1}),Ke=new $({required:!0,emptyAllowed:!0}),A4=new $({required:!1,emptyAllowed:!0}),el=new oe({each:H,required:!0}),JA=new $({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),eC=new $({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),C4=new $({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Tr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),mr=(e,t)=>{if("required"in t)return{payload:new _e({value:t}).validate({value:e}).value};let o=new Y({options:{required:!0},values:t}).validate(e);if(o)throw new Do(o);return{payload:e}},_=(e,t)=>{try{return mr(e,t)}catch(r){return{payload:e,error:Tr(r)}}},gr=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return tC(e,t,r,o,"Controller initialization error")},ht=(e,t,r,n)=>{let o=`Check the options of ${n}`;return tC(e,t,r,o,"Controller initialization error")},tC=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};d();c();l();u();d();c();l();u();d();c();l();u();function Ft(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 d_=typeof Symbol=="function"&&Symbol.observable||"@@observable",rC=d_,xh=()=>Math.random().toString(36).substring(7).split("").join("."),p_={INIT:`@@redux/INIT${xh()}`,REPLACE:`@@redux/REPLACE${xh()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${xh()}`},tl=p_;function Ur(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 wh(e,t,r){if(typeof e!="function")throw new Error(Ft(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ft(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ft(1));return r(wh)(e,t)}let n=e,o=t,i=new Map,a=i,p=0,f=!1;function m(){a===i&&(a=new Map,i.forEach((w,I)=>{a.set(I,w)}))}function g(){if(f)throw new Error(Ft(3));return o}function v(w){if(typeof w!="function")throw new Error(Ft(4));if(f)throw new Error(Ft(5));let I=!0;m();let F=p++;return a.set(F,w),function(){if(I){if(f)throw new Error(Ft(6));I=!1,m(),a.delete(F),i=null}}}function b(w){if(!Ur(w))throw new Error(Ft(7));if(typeof w.type>"u")throw new Error(Ft(8));if(typeof w.type!="string")throw new Error(Ft(17));if(f)throw new Error(Ft(9));try{f=!0,o=n(o,w)}finally{f=!1}return(i=a).forEach(F=>{F()}),w}function h(w){if(typeof w!="function")throw new Error(Ft(10));n=w,b({type:tl.REPLACE})}function y(){let w=v;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(Ft(11));function F(){let T=I;T.next&&T.next(g())}return F(),{unsubscribe:w(F)}},[rC](){return this}}}return b({type:tl.INIT}),{dispatch:b,subscribe:v,getState:g,replaceReducer:h,[rC]:y}}function f_(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:tl.INIT})>"u")throw new Error(Ft(12));if(typeof r(void 0,{type:tl.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ft(13))})}function ea(e){let t=Object.keys(e),r={};for(let a=0;a<t.length;a++){let p=t[a];typeof e[p]=="function"&&(r[p]=e[p])}let n=Object.keys(r),o,i;try{f_(r)}catch(a){i=a}return function(p={},f){if(i)throw i;let m=!1,g={};for(let v=0;v<n.length;v++){let b=n[v],h=r[b],y=p[b],x=h(y,f);if(typeof x>"u"){let w=f&&f.type;throw new Error(Ft(14))}g[b]=x,m=m||x!==y}return m=m||n.length!==Object.keys(p).length,m?g:p}}function lc(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function nC(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(Ft(15))},a={getState:o.getState,dispatch:(f,...m)=>i(f,...m)},p=e.map(f=>f(a));return i=lc(...p)(o.dispatch),{...o,dispatch:i}}}function dc(e){return Ur(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var _h=Symbol.for("immer-nothing"),pc=Symbol.for("immer-draftable"),St=Symbol.for("immer-state");function Tt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var sr=Object,jo=sr.getPrototypeOf,fc="constructor",Sc="prototype",Eh="configurable",il="enumerable",nl="writable",mc="value",Ht=e=>!!e&&!!e[St];function Vt(e){return e?dC(e)||Ac(e)||!!e[pc]||!!e[fc]?.[pc]||Cc(e)||bc(e):!1}var m_=sr[Sc][fc].toString(),oC=new WeakMap;function dC(e){if(!e||!ra(e))return!1;let t=jo(e);if(t===null||t===sr[Sc])return!0;let r=sr.hasOwnProperty.call(t,fc)&&t[fc];if(r===Object)return!0;if(!Vo(r))return!1;let n=oC.get(r);return n===void 0&&(n=Function.toString.call(r),oC.set(r,n)),n===m_}function pC(e){return Ht(e)||Tt(15,e),e[St].base_}function vc(e,t,r=!0){Lo(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 Lo(e){let t=e[St];return t?t.type_:Ac(e)?1:Cc(e)?2:bc(e)?3:0}var ta=(e,t,r=Lo(e))=>r===2?e.has(t):sr[Sc].hasOwnProperty.call(e,t),In=(e,t,r=Lo(e))=>r===2?e.get(t):e[t],al=(e,t,r,n=Lo(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function g_(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ac=Array.isArray,Cc=e=>e instanceof Map,bc=e=>e instanceof Set,ra=e=>typeof e=="object",Vo=e=>typeof e=="function",Rh=e=>typeof e=="boolean";function h_(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var y_=e=>ra(e)?e?.[St]:null,En=e=>e.copy_||e.base_;var Nh=e=>e.modified_?e.copy_:e.base_;function Fh(e,t){if(Cc(e))return new Map(e);if(bc(e))return new Set(e);if(Ac(e))return Array[Sc].slice.call(e);let r=dC(e);if(t===!0||t==="class_only"&&!r){let n=sr.getOwnPropertyDescriptors(e);delete n[St];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],p=n[a];p[nl]===!1&&(p[nl]=!0,p[Eh]=!0),(p.get||p.set)&&(n[a]={[Eh]:!0,[nl]:!0,[il]:p[il],[mc]:e[a]})}return sr.create(jo(e),n)}else{let n=jo(e);if(n!==null&&r)return{...e};let o=sr.create(n);return sr.assign(o,e)}}function Dh(e,t=!1){return pl(e)||Ht(e)||!Vt(e)||(Lo(e)>1&&sr.defineProperties(e,{set:rl,add:rl,clear:rl,delete:rl}),sr.freeze(e),t&&vc(e,(r,n)=>{Dh(n,!0)},!1)),e}function S_(){Tt(2)}var rl={[mc]:S_};function pl(e){return e===null||!ra(e)?!0:sr.isFrozen(e)}var sl="MapSet",cl="Patches",iC="ArrayMethods",ul={};function Uo(e){let t=ul[e];return t||Tt(0,e),t}var aC=e=>!!ul[e];function v_(e,t){ul[e]||(ul[e]=t)}var gc,fC=()=>gc,A_=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:aC(sl)?Uo(sl):void 0,arrayMethodsPlugin_:aC(iC)?Uo(iC):void 0});function sC(e,t){t&&(e.patchPlugin_=Uo(cl),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Th(e){Ph(e),e.drafts_.forEach(C_),e.drafts_=null}function Ph(e){e===gc&&(gc=e.parent_)}var cC=e=>gc=A_(gc,e);function C_(e){let t=e[St];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function uC(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[St].modified_&&(Th(t),Tt(4)),Vt(e)&&(e=lC(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[St].base_,e,t)}else e=lC(t,r);return b_(t,e,!0),Th(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==_h?e:void 0}function lC(e,t){if(pl(t))return t;let r=t[St];if(!r)return ll(t,e.handledSet_,e);if(!fl(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);hC(r,e)}return r.copy_}function b_(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Dh(t,r)}function mC(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var fl=(e,t)=>e.scope_===t,x_=[];function gC(e,t,r,n){let o=En(e),i=e.type_;if(n!==void 0&&In(o,n,i)===t){al(o,n,r,i);return}if(!e.draftLocations_){let p=e.draftLocations_=new Map;vc(o,(f,m)=>{if(Ht(m)){let g=p.get(m)||[];g.push(f),p.set(m,g)}})}let a=e.draftLocations_.get(t)??x_;for(let p of a)al(o,p,r,i)}function w_(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!fl(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let a=Nh(i);gC(e,i.draft_??i,a,r),hC(i,o)})}function hC(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)}mC(e)}}function R_(e,t,r){let{scope_:n}=e;if(Ht(r)){let o=r[St];fl(o,n)&&o.callbacks_.push(function(){ol(e);let a=Nh(o);gC(e,r,a,t)})}else Vt(r)&&e.callbacks_.push(function(){let i=En(e);e.type_===3?i.has(r)&&ll(r,n.handledSet_,n):In(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&ll(In(e.copy_,t,e.type_),n.handledSet_,n)})}function ll(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Ht(e)||t.has(e)||!Vt(e)||pl(e)||(t.add(e),vc(e,(n,o)=>{if(Ht(o)){let i=o[St];if(fl(i,r)){let a=Nh(i);al(e,n,a,e.type_),mC(i)}}else Vt(o)&&ll(o,t,r)})),e}function I_(e,t){let r=Ac(e),n={type_:r?1:0,scope_:t?t.scope_:fC(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=n,i=dl;r&&(o=[n],i=hc);let{revoke:a,proxy:p}=Proxy.revocable(o,i);return n.draft_=p,n.revoke_=a,[p,n]}var dl={get(e,t){if(t===St)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=En(e);if(!ta(o,t,e.type_))return F_(e,o,t);let i=o[t];if(e.finalized_||!Vt(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&h_(t))return i;if(i===Ih(e.base_,t)||E_(e,t,i)){ol(e);let a=e.type_===1?+t:t,p=Oh(e.scope_,i,e,a);return e.copy_[a]=p}return i},has(e,t){return t in En(e)},ownKeys(e){return Reflect.ownKeys(En(e))},set(e,t,r){let n=yC(En(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Ih(En(e),t),i=o?.[St];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(g_(r,o)&&(r!==void 0||ta(e.base_,t,e.type_)))return!0;ol(e),kh(e)}return e.copy_[t]===r&&(r!==void 0||ta(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),R_(e,t,r)),!0},deleteProperty(e,t){return ol(e),Ih(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),kh(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=En(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[nl]:!0,[Eh]:e.type_!==1||t!=="length",[il]:n[il],[mc]:r[t]}},defineProperty(){Tt(11)},getPrototypeOf(e){return jo(e.base_)},setPrototypeOf(){Tt(12)}},hc={};for(let e in dl){let t=dl[e];hc[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}hc.deleteProperty=function(e,t){return hc.set.call(this,e,t,void 0)};hc.set=function(e,t,r){return dl.set.call(this,e[0],t,r,e[0])};function Ih(e,t){let r=e[St];return(r?En(r):e)[t]}function E_(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!Vt(r)||r[St]?!1:e.baseRefs_.has(r)}function F_(e,t,r){let n=yC(t,r);return n?mc in n?n[mc]:n.get?.call(e.draft_):void 0}function yC(e,t){if(!(t in e))return;let r=jo(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=jo(r)}}function kh(e){e.modified_||(e.modified_=!0,e.parent_&&kh(e.parent_))}function ol(e){e.copy_||(e.assigned_=new Map,e.copy_=Fh(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var T_=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Vo(t)&&!Vo(r)){let i=r;r=t;let a=this;return function(f=i,...m){return a.produce(f,g=>r.call(this,g,...m))}}Vo(r)||Tt(6),n!==void 0&&!Vo(n)&&Tt(7);let o;if(Vt(t)){let i=cC(this),a=Oh(i,t,void 0),p=!0;try{o=r(a),p=!1}finally{p?Th(i):Ph(i)}return sC(i,n),uC(o,i)}else if(!t||!ra(t)){if(o=r(t),o===void 0&&(o=t),o===_h&&(o=void 0),this.autoFreeze_&&Dh(o,!0),n){let i=[],a=[];Uo(cl).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:a}),n(i,a)}return o}else Tt(1,t)},this.produceWithPatches=(t,r)=>{if(Vo(t))return(a,...p)=>this.produceWithPatches(a,f=>t(f,...p));let n,o;return[this.produce(t,r,(a,p)=>{n=a,o=p}),n,o]},Rh(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Rh(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Rh(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Vt(e)||Tt(8),Ht(e)&&(e=ml(e));let t=cC(this),r=Oh(t,e,void 0);return r[St].isManual_=!0,Ph(t),r}finishDraft(e,t){let r=e&&e[St];(!r||!r.isManual_)&&Tt(9);let{scope_:n}=r;return sC(n,t),uC(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=Uo(cl).applyPatches_;return Ht(e)?n(e,t):this.produce(e,o=>n(o,t))}};function Oh(e,t,r,n){let[o,i]=Cc(t)?Uo(sl).proxyMap_(t,r):bc(t)?Uo(sl).proxySet_(t,r):I_(t,r);return(r?.scope_??fC()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?w_(r,i,n):i.callbacks_.push(function(f){f.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:m}=f;i.modified_&&m&&m.generatePatches_(i,[],f)}),o}function ml(e){return Ht(e)||Tt(10,e),SC(e)}function SC(e){if(!Vt(e)||pl(e))return e;let t=e[St],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Fh(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Fh(e,!0);return vc(r,(o,i)=>{al(r,o,SC(i))},n),t&&(t.finalized_=!1),r}function vC(){function t(y,x=[]){if(y.key_!==void 0){let w=y.parent_.copy_??y.parent_.base_,I=y_(In(w,y.key_)),F=In(w,y.key_);if(F===void 0||F!==y.draft_&&F!==y.base_&&F!==y.copy_||I!=null&&I.base_!==y.base_)return null;let E=y.parent_.type_===3,T;if(E){let P=y.parent_;T=Array.from(P.drafts_.keys()).indexOf(y.key_)}else T=y.key_;if(!(E&&w.size>T||ta(w,T)))return null;x.push(T)}if(y.parent_)return t(y.parent_,x);x.reverse();try{r(y.copy_,x)}catch{return null}return x}function r(y,x){let w=y;for(let I=0;I<x.length-1;I++){let F=x[I];if(w=In(w,F),!ra(w)||w===null)throw new Error(`Cannot resolve path at '${x.join("/")}'`)}return w}let n="replace",o="add",i="remove";function a(y,x,w){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:I,inversePatches_:F}=w;switch(y.type_){case 0:case 2:return f(y,x,I,F);case 1:return p(y,x,I,F);case 3:return m(y,x,I,F)}}function p(y,x,w,I){let{base_:F,assigned_:E}=y,T=y.copy_;T.length<F.length&&([F,T]=[T,F],[w,I]=[I,w]);let P=y.allIndicesReassigned_===!0;for(let q=0;q<F.length;q++){let G=T[q],B=F[q];if((P||E?.get(q.toString()))&&G!==B){let Q=G?.[St];if(Q&&Q.modified_)continue;let L=x.concat([q]);w.push({op:n,path:L,value:h(G)}),I.push({op:n,path:L,value:h(B)})}}for(let q=F.length;q<T.length;q++){let G=x.concat([q]);w.push({op:o,path:G,value:h(T[q])})}for(let q=T.length-1;F.length<=q;--q){let G=x.concat([q]);I.push({op:i,path:G})}}function f(y,x,w,I){let{base_:F,copy_:E,type_:T}=y;vc(y.assigned_,(P,q)=>{let G=In(F,P,T),B=In(E,P,T),j=q?ta(F,P)?n:o:i;if(G===B&&j===n)return;let Q=x.concat(P);w.push(j===i?{op:j,path:Q}:{op:j,path:Q,value:h(B)}),I.push(j===o?{op:i,path:Q}:j===i?{op:o,path:Q,value:h(G)}:{op:n,path:Q,value:h(G)})})}function m(y,x,w,I){let{base_:F,copy_:E}=y,T=0;F.forEach(P=>{if(!E.has(P)){let q=x.concat([T]);w.push({op:i,path:q,value:P}),I.unshift({op:o,path:q,value:P})}T++}),T=0,E.forEach(P=>{if(!F.has(P)){let q=x.concat([T]);w.push({op:o,path:q,value:P}),I.unshift({op:i,path:q,value:P})}T++})}function g(y,x,w){let{patches_:I,inversePatches_:F}=w;I.push({op:n,path:[],value:x===_h?void 0:x}),F.push({op:n,path:[],value:y})}function v(y,x){return x.forEach(w=>{let{path:I,op:F}=w,E=y;for(let G=0;G<I.length-1;G++){let B=Lo(E),j=I[G];typeof j!="string"&&typeof j!="number"&&(j=""+j),(B===0||B===1)&&(j==="__proto__"||j===fc)&&Tt(19),Vo(E)&&j===Sc&&Tt(19),E=In(E,j),(E===null||!ra(E))&&Tt(18,I.join("/"))}let T=Lo(E),P=b(w.value),q=I[I.length-1];switch(F){case n:switch(T){case 2:return E.set(q,P);case 3:Tt(16);default:return E[q]=P}case o:switch(T){case 1:return q==="-"?E.push(P):E.splice(q,0,P);case 2:return E.set(q,P);case 3:return E.add(P);default:return E[q]=P}case i:switch(T){case 1:return E.splice(q,1);case 2:return E.delete(q);case 3:return E.delete(w.value);default:return delete E[q]}default:Tt(17,F)}}),y}function b(y){if(!Vt(y))return y;if(Ac(y))return y.map(b);if(Cc(y))return new Map(Array.from(y.entries()).map(([w,I])=>[w,b(I)]));if(bc(y))return new Set(Array.from(y).map(b));let x=Object.create(jo(y));for(let w in y)x[w]=b(y[w]);return ta(y,pc)&&(x[pc]=y[pc]),x}function h(y){return Ht(y)?b(y):y}v_(cl,{applyPatches_:v,generatePatches_:a,generateReplacementPatches_:g,getPath:t})}var P_=S.Iterator,O4=typeof P_?.from=="function";var yc=new T_,Qo=yc.produce,qh=yc.produceWithPatches.bind(yc);var Mh=yc.applyPatches.bind(yc);d();c();l();u();function k_(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function O_(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 AC=e=>Array.isArray(e)?e:[e];function __(e){let t=Array.isArray(e[0])?e[0]:e;return O_(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function N_(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var D_=class{constructor(e){this.value=e}deref(){return this.value}},q_=()=>typeof WeakRef>"u"?D_:WeakRef,bC=q_(),M_=0,CC=1;function gl(){return{s:M_,v:void 0,o:null,p:null}}function V_(e){return e instanceof bC?e.deref():e}function xc(e,t={}){let r=gl(),{resultEqualityCheck:n}=t,o,i=0;function a(){let p=r,{length:f}=arguments;for(let v=0,b=f;v<b;v++){let h=arguments[v];if(typeof h=="function"||typeof h=="object"&&h!==null){let y=p.o;y===null&&(p.o=y=new WeakMap);let x=y.get(h);x===void 0?(p=gl(),y.set(h,p)):p=x}else{let y=p.p;y===null&&(p.p=y=new Map);let x=y.get(h);x===void 0?(p=gl(),y.set(h,p)):p=x}}let m=p,g;if(p.s===CC)g=p.v;else if(g=e.apply(null,arguments),i++,n){let v=V_(o);v!=null&&n(v,g)&&(g=v,i!==0&&i--),o=typeof g=="object"&&g!==null||typeof g=="function"?new bC(g):g}return m.s=CC,m.v=g,g}return a.clearCache=()=>{r=gl(),a.resetResultsCount()},a.resultsCount=()=>i,a.resetResultsCount=()=>{i=0},a}function j_(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,a=0,p,f={},m=o.pop();typeof m=="object"&&(f=m,m=o.pop()),k_(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);let g={...r,...f},{memoize:v,memoizeOptions:b=[],argsMemoize:h=xc,argsMemoizeOptions:y=[]}=g,x=AC(b),w=AC(y),I=__(o),F=v(function(){return i++,m.apply(null,arguments)},...x),E=!0,T=h(function(){a++;let q=N_(I,arguments);return p=F.apply(null,q),p},...w);return Object.assign(T,{resultFunc:m,memoizedResultFunc:F,dependencies:I,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>p,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var ct=j_(xc);d();c();l();u();function xC(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var wC=xC(),RC=xC;var L_=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?lc:lc.apply(null,arguments)},rW=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},U_=e=>e&&typeof e.match=="function";function k(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(zt(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=>dc(n)&&n.type===e,r}var _C=class wc extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,wc.prototype)}static get[Symbol.species](){return wc}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new wc(...t[0].concat(this)):new wc(...t.concat(this))}};function IC(e){return Vt(e)?Qo(e,()=>{}):e}function hl(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function Q_(e){return typeof e=="boolean"}var B_=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new _C;return r&&(Q_(r)?a.push(wC):a.push(RC(r.extraArgument))),a},Rc="RTK_autoBatch",ia=()=>e=>({payload:e,meta:{[Rc]:!0}}),EC=e=>t=>{setTimeout(t,e)},G_=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(i),clearTimeout(a),r())},i=e(o),a=setTimeout(o,t)},$_=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,a=!1,p=new Set,f=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?G_(window.requestAnimationFrame,100):EC(10):e.type==="callback"?e.queueNotification:EC(e.timeout),m=()=>{a=!1,i&&(i=!1,p.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let v=()=>o&&g(),b=n.subscribe(v);return p.add(g),()=>{b(),p.delete(g)}},dispatch(g){try{return o=!g?.meta?.[Rc],i=!o,i&&(a||(a=!0,f(m))),n.dispatch(g)}finally{o=!0}}})},H_=e=>function(r){let{autoBatch:n=!0}=r??{},o=new _C(e);return n&&o.push($_(typeof n=="object"?n:void 0)),o};function NC(e){let t=B_(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:a=void 0,enhancers:p=void 0}=e||{},f;if(typeof r=="function")f=r;else if(Ur(r))f=ea(r);else throw new Error(zt(1));let m;typeof n=="function"?m=n(t):m=t();let g=lc;o&&(g=L_({trace:!1,...(typeof o=="object"&&o)}));let v=nC(...m),b=H_(v),h=typeof p=="function"?p(b):b(),y=g(...h);return wh(f,a,y)}function DC(e){let t={},r=[],n,o={addCase(i,a){let p=typeof i=="string"?i:i.type;if(!p)throw new Error(zt(28));if(p in t)throw new Error(zt(29));return t[p]=a,o},addAsyncThunk(i,a){return a.pending&&(t[i.pending.type]=a.pending),a.rejected&&(t[i.rejected.type]=a.rejected),a.fulfilled&&(t[i.fulfilled.type]=a.fulfilled),a.settled&&r.push({matcher:i.settled,reducer:a.settled}),o},addMatcher(i,a){return r.push({matcher:i,reducer:a}),o},addDefaultCase(i){return n=i,o}};return e(o),[t,r,n]}function z_(e){return typeof e=="function"}function fe(e,t){let[r,n,o]=DC(t),i;if(z_(e))i=()=>IC(e());else{let p=IC(e);i=()=>p}function a(p=i(),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,v)=>{if(v)if(Ht(g)){let h=v(g,f);return h===void 0?g:h}else{if(Vt(g))return Qo(g,b=>v(b,f));{let b=v(g,f);if(b===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return b}}return g},p)}return a.getInitialState=i,a}var qC=(e,t)=>U_(e)?e.match(t):e(t);function Qr(...e){return t=>e.some(r=>qC(r,t))}function oa(...e){return t=>e.every(r=>qC(r,t))}function Al(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 Ic(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Cl(...e){return e.length===0?t=>Al(t,["pending"]):Ic(e)?Qr(...e.map(t=>t.pending)):Cl()(e[0])}function Go(...e){return e.length===0?t=>Al(t,["rejected"]):Ic(e)?Qr(...e.map(t=>t.rejected)):Go()(e[0])}function Ec(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?oa(Go(...e),t):Ic(e)?oa(Go(...e),t):Ec()(e[0])}function Fn(...e){return e.length===0?t=>Al(t,["fulfilled"]):Ic(e)?Qr(...e.map(t=>t.fulfilled)):Fn()(e[0])}function bl(...e){return e.length===0?t=>Al(t,["pending","fulfilled","rejected"]):Ic(e)?Qr(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):bl()(e[0])}var W_="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Fc=(e=21)=>{let t="",r=e;for(;r--;)t+=W_[Math.random()*64|0];return t},Y_=["name","message","stack","code"],Vh=class{constructor(e,t){de(this,"payload");de(this,"meta");de(this,"_type");this.payload=e,this.meta=t}},FC=class{constructor(e,t){de(this,"payload");de(this,"meta");de(this,"_type");this.payload=e,this.meta=t}},K_=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of Y_)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},TC="External signal was aborted",me=(()=>{function e(t,r,n){let o=k(t+"/fulfilled",(f,m,g,v)=>({payload:f,meta:{...(v||{}),arg:g,requestId:m,requestStatus:"fulfilled"}})),i=k(t+"/pending",(f,m,g)=>({payload:void 0,meta:{...(g||{}),arg:m,requestId:f,requestStatus:"pending"}})),a=k(t+"/rejected",(f,m,g,v,b)=>({payload:v,error:(n&&n.serializeError||K_)(f||"Rejected"),meta:{...(b||{}),arg:g,requestId:m,rejectedWithValue:!!v,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"}}));function p(f,{signal:m}={}){return(g,v,b)=>{let h=n?.idGenerator?n.idGenerator(f):Fc(),y=new s.AbortController,x,w;function I(E){w=E,y.abort()}m&&(m.aborted?I(TC):m.addEventListener("abort",()=>I(TC),{once:!0}));let F=_asyncToGenerator(function*(){let E;try{let P=n?.condition?.(f,{getState:v,extra:b});if(Z_(P)&&(P=yield P),P===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let q=new Promise((G,B)=>{x=()=>{B({name:"AbortError",message:w||"Aborted"})},y.signal.addEventListener("abort",x,{once:!0})});g(i(h,f,n?.getPendingMeta?.({requestId:h,arg:f},{getState:v,extra:b}))),E=yield Promise.race([q,Promise.resolve(r(f,{dispatch:g,getState:v,extra:b,requestId:h,signal:y.signal,abort:I,rejectWithValue:(G,B)=>new Vh(G,B),fulfillWithValue:(G,B)=>new FC(G,B)})).then(G=>{if(G instanceof Vh)throw G;return G instanceof FC?o(G.payload,h,f,G.meta):o(G,h,f)})])}catch(P){E=P instanceof Vh?a(null,h,f,P.payload,P.meta):a(P,h,f)}finally{x&&y.signal.removeEventListener("abort",x)}return n&&!n.dispatchConditionRejection&&a.match(E)&&E.meta.condition||g(E),E})();return Object.assign(F,{abort:I,requestId:h,arg:f,unwrap(){return F.then(X_)}})}}return Object.assign(p,{pending:i,rejected:a,fulfilled:o,settled:Qr(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function X_(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Z_(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var MC=Symbol.for("rtk-slice-createasyncthunk"),oW={[MC]:me};function J_(e,t){return`${e}/${t}`}function e0({creators:e}={}){let t=e?.asyncThunk?.[MC];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(zt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(r0()):n.reducers)||{},p=Object.keys(a),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(E,T){let P=typeof E=="string"?E:E.type;if(!P)throw new Error(zt(12));if(P in f.sliceCaseReducersByType)throw new Error(zt(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=a[E],P={reducerName:E,type:J_(o,E),createNotation:typeof n.reducers=="function"};o0(T)?a0(P,T,m,t):n0(P,T,m)});function g(){let[E={},T=[],P=void 0]=typeof n.extraReducers=="function"?DC(n.extraReducers):[n.extraReducers],q={...E,...f.sliceCaseReducersByType};return fe(n.initialState,G=>{for(let B in q)G.addCase(B,q[B]);for(let B of f.sliceMatchers)G.addMatcher(B.matcher,B.reducer);for(let B of T)G.addMatcher(B.matcher,B.reducer);P&&G.addDefaultCase(P)})}let v=E=>E,b=new Map,h=new WeakMap,y;function x(E,T){return y||(y=g()),y(E,T)}function w(){return y||(y=g()),y.getInitialState()}function I(E,T=!1){function P(G){let B=G[E];return typeof B>"u"&&T&&(B=hl(h,P,w)),B}function q(G=v){let B=hl(b,T,()=>new WeakMap);return hl(B,G,()=>{let j={};for(let[Q,L]of Object.entries(n.selectors??{}))j[Q]=t0(L,G,()=>hl(h,G,w),T);return j})}return{reducerPath:E,getSelectors:q,get selectors(){return q(P)},selectSlice:P}}let F={name:o,reducer:x,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:w,...I(i),injectInto(E,{reducerPath:T,...P}={}){let q=T??i;return E.inject({reducerPath:q,reducer:x},P),{...F,...I(q,!0)}}};return F}}function t0(e,t,r,n){function o(i,...a){let p=t(i);return typeof p>"u"&&n&&(p=r()),e(p,...a)}return o.unwrapped=e,o}var $o=e0();function r0(){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 n0({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!i0(n))throw new Error(zt(17));i=n.reducer,a=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?k(e,a):k(e))}function o0(e){return e._reducerDefinitionType==="asyncThunk"}function i0(e){return e._reducerDefinitionType==="reducerWithPrepare"}function a0({type:e,reducerName:t},r,n,o){if(!o)throw new Error(zt(18));let{payloadCreator:i,fulfilled:a,pending:p,rejected:f,settled:m,options:g}=r,v=o(e,i,g);n.exposeAction(t,v),a&&n.addCase(v.fulfilled,a),p&&n.addCase(v.pending,p),f&&n.addCase(v.rejected,f),m&&n.addMatcher(v.settled,m),n.exposeCaseReducer(t,{fulfilled:a||yl,pending:p||yl,rejected:f||yl,settled:m||yl})}function yl(){}var s0="task",VC="listener",jC="completed",Uh="cancelled",c0=`task-${Uh}`,u0=`task-${jC}`,jh=`${VC}-${Uh}`,l0=`${VC}-${jC}`,xl=class{constructor(e){de(this,"code");de(this,"name","TaskAbortError");de(this,"message");this.code=e,this.message=`${s0} ${Uh} (reason: ${e})`}},Qh=(e,t)=>{if(typeof e!="function")throw new TypeError(zt(32))},Sl=()=>{},LC=(e,t=Sl)=>(e.catch(t),e),UC=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Bo=e=>{if(e.aborted)throw new xl(e.reason)};function QC(e,t){let r=Sl;return new Promise((n,o)=>{let i=()=>o(new xl(e.reason));if(e.aborted){i();return}r=UC(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=Sl})}var d0=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof xl?"cancelled":"rejected",error:r}}finally{t?.()}});return function d0(_x7,_x8){return _ref5.apply(this,arguments)}}(),vl=e=>t=>LC(QC(e,t).then(r=>(Bo(e),r))),BC=e=>{let t=vl(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:na}=Object,PC={},wl="listenerMiddleware",p0=(e,t)=>{let r=n=>UC(e,()=>n.abort(e.reason));return(n,o)=>{Qh(n,"taskExecutor");let i=new s.AbortController;r(i);let a=d0(/*#__PURE__*/_asyncToGenerator(function*(){Bo(e),Bo(i.signal);let p=yield n({pause:vl(i.signal),delay:BC(i.signal),signal:i.signal});return Bo(i.signal),p}),()=>i.abort(u0));return o?.autoJoin&&t.push(a.catch(Sl)),{result:vl(e)(a),cancel(){i.abort(c0)}}}},f0=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){Bo(t);let i=()=>{},p=[new Promise((f,m)=>{let g=e({predicate:n,effect:(v,b)=>{b.unsubscribe(),f([v,b.getState(),b.getOriginalState()])}});i=()=>{g(),m()}})];o!=null&&p.push(new Promise(f=>setTimeout(f,o,null)));try{let f=yield QC(t,Promise.race(p));return Bo(t),f}finally{i()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>LC(r(n,o))},GC=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=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(zt(21));return Qh(i,"options.listener"),{predicate:o,type:t,effect:i}},$C=na(e=>{let{type:t,predicate:r,effect:n}=GC(e);return{id:Fc(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(zt(22))}}},{withTypes:()=>$C}),kC=(e,t)=>{let{type:r,effect:n,predicate:o}=GC(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},Lh=e=>{e.pending.forEach(t=>{t.abort(jh)})},m0=(e,t)=>()=>{for(let r of t.keys())Lh(r);e.clear()},OC=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},HC=na(k(`${wl}/add`),{withTypes:()=>HC}),g0=k(`${wl}/removeAll`),zC=na(k(`${wl}/remove`),{withTypes:()=>zC}),h0=(...e)=>{console.error(`${wl}/error`,...e)},WC=(e={})=>{let t=new Map,r=new Map,n=h=>{let y=r.get(h)??0;r.set(h,y+1)},o=h=>{let y=r.get(h)??1;y===1?r.delete(h):r.set(h,y-1)},{extra:i,onError:a=h0}=e;Qh(a,"onError");let p=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&Lh(h)}),f=h=>{let y=kC(t,h)??$C(h);return p(y)};na(f,{withTypes:()=>f});let m=h=>{let y=kC(t,h);return y&&(y.unsubscribe(),h.cancelActive&&Lh(y)),!!y};na(m,{withTypes:()=>m});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,x,w){let I=new s.AbortController,F=f0(f,I.signal),E=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(y,na({},x,{getOriginalState:w,condition:(T,P)=>F(T,P).then(Boolean),take:F,delay:BC(I.signal),pause:vl(I.signal),extra:i,signal:I.signal,fork:p0(I.signal,E),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((T,P,q)=>{T!==I&&(T.abort(jh),q.delete(T))})},cancel:()=>{I.abort(jh),h.pending.delete(I)},throwIfCancelled:()=>{Bo(I.signal)}})))}catch(T){T instanceof xl||OC(a,T,{raisedBy:"effect"})}finally{yield Promise.all(E),I.abort(l0),o(h),h.pending.delete(I)}});return function g(_x1,_x10,_x11,_x12){return _ref8.apply(this,arguments)}}(),v=m0(t,r);return{middleware:h=>y=>x=>{if(!dc(x))return y(x);if(HC.match(x))return f(x.payload);if(g0.match(x)){v();return}if(zC.match(x))return m(x.payload);let w=h.getState(),I=()=>{if(w===PC)throw new Error(zt(23));return w},F;try{if(F=y(x),t.size>0){let E=h.getState(),T=Array.from(t.values());for(let P of T){let q=!1;try{q=P.predicate(x,E,w)}catch(G){q=!1,OC(a,G,{raisedBy:"predicate"})}q&&g(P,x,h,I)}}}finally{w=PC}return F},startListening:f,stopListening:m,clearListeners:v}};function zt(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 YC(){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 KC=/^(?:[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 y0(e){return typeof e=="string"&&KC.test(e)}var Bh=y0;d();c();l();u();var Pt=[];for(let e=0;e<256;++e)Pt.push((e+256).toString(16).slice(1));function XC(e,t=0){return(Pt[e[t+0]]+Pt[e[t+1]]+Pt[e[t+2]]+Pt[e[t+3]]+"-"+Pt[e[t+4]]+Pt[e[t+5]]+"-"+Pt[e[t+6]]+Pt[e[t+7]]+"-"+Pt[e[t+8]]+Pt[e[t+9]]+"-"+Pt[e[t+10]]+Pt[e[t+11]]+Pt[e[t+12]]+Pt[e[t+13]]+Pt[e[t+14]]+Pt[e[t+15]]).toLowerCase()}d();c();l();u();var S0=new Uint8Array(16);function Gh(){return crypto.getRandomValues(S0)}d();c();l();u();function v0(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():A0(e,t,r)}function A0(e,t,r){e=e||{};let n=e.random??e.rng?.()??Gh();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 XC(n)}var $h=v0;function C0(_x13){return _C2.apply(this,arguments)}function _C2(){_C2=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:i,mode:a}=e;if(a!=="disabled")return n.call(r),t.send(o,i,r)});return _C2.apply(this,arguments)}var nb="2.1.3",Hh=128,ob=192,ZC=224,JC=240,b0=248;function x0(e){return(e&b0)===JC?4:(e&JC)===ZC?3:(e&ZC)===ob?2:1}function w0(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&Hh)!=Hh)break;if(r-=3,(n&ob)!=Hh){t-r>=x0(n)*3&&(r=t);break}}return e.substring(0,r)}function R0(e){let{trackingId:t}=e;return{trackingId:t}}function I0(e){return(e.source||[]).concat([`relay@${nb}`])}function ib(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,a=R0(t),p=r.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:I0(t),clientId:p,userAgent:i(),referrer:eb(n()),location:eb(o())})}function eb(e){return e!==null?w0(e,1024):null}function E0(e,t,r,n){return{...t,meta:ib(e,r,n)}}var F0="*";function T0(){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 i(f){if(f===F0)e.length=0;else for(let m=e.length-1;m>=0;m--)e[m].type===f&&e.splice(m,1)}function a(f){let m=t(f);m>=0&&e.splice(m,1)}function p(f,m){m?a({type:f,callback:m}):i(f)}return{add:n,call:o,remove:p}}function tb({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 P0(e){let t=tb(e);return{get:()=>t,update:r=>{t=tb({...t,...r})}}}var zh=k0();function k0(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,o=document.cookie.split(";");for(let i of o){let a=i.replace(/^\s+/,"");if(a.lastIndexOf(n,0)===0)return a.substring(n.length,a.length)}return null},setItem(r,n,o){let i=t(window.location.hostname),a=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,p=i?`;domain=${i}`:"";document.cookie=`${e}${r}=${n}${a}${p};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function O0(){return{getItem(e){return zh.getItem(e)||localStorage.getItem(e)},removeItem(e){zh.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),zh.setItem(e,t,31556952e3)}}}var rb="visitorId";function _0(){let e=document.referrer;return e===""?null:e}function Wh(){let e=O0();return{runtime:"browser",send:function(){var _ref9=_asyncToGenerator(function*(t,r,n){let o=A(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});YC().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let a=yield o;if(a?.ok){let p;try{p=yield a.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 ${a.status}: Failed to send the event(s).`)});return function send(_x14,_x15,_x16){return _ref9.apply(this,arguments)}}(),getReferrer:()=>_0(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(rb);if(t&&Bh(t))return t;let r=$h();return e.setItem(rb,r),r}}}function N0(){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 D0(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function q0(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=D0();return t&&r?{...r,runtime:"custom"}:t&&M0()&&N0()?Wh():n}function M0(){try{return typeof window=="object"}catch{return!1}}function V0(e){return{get:()=>Object.freeze(q0(e))}}function ab(e){let t=P0(e),r=T0(),n=V0(t);return{emit:function(){var _ref0=_asyncToGenerator(function*(o,i){let a=t.get(),p=n.get(),f=E0(o,i,a,p);return C0({config:a,environment:p,event:f,listenerManager:r})});return function emit(_x17,_x18){return _ref0.apply(this,arguments)}}(),getMeta:o=>ib(o,t.get(),n.get()),on:(o,i)=>r.add({type:o,callback:i}),off:(o,i)=>r.remove(o,i),updateConfig:o=>t.update(o),version:nb}}d();c();l();u();function sb(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var Wn="3.55.3",cb=["@coveo/atomic","@coveo/quantic"];var aa=ct(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Wn}`));var Tc=ct(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>aa(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},a,p)=>{let f=L0(p);return ab({mode:i?"emit":"disabled",url:o??$u(e,t),token:r,trackingId:n??null,source:a,environment:f})}),j0={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref1=_asyncToGenerator(function*(){});return function send(){return _ref1.apply(this,arguments)}}()},L0=e=>{if(!e)return;let t=e();return{...(sb()?Wh():j0),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};d();c();l();u();d();c();l();u();function Br(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 U(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function p(g){try{m(n.next(g))}catch(v){a(v)}}function f(g){try{m(n.throw(g))}catch(v){a(v)}}function m(g){g.done?i(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}var Me;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(Me||(Me={}));function Xh(){return typeof window<"u"}function dy(){return typeof navigator<"u"}function sa(){return typeof document<"u"}function Zh(){try{return typeof localStorage<"u"}catch{return!1}}function U0(){try{return typeof sessionStorage<"u"}catch{return!1}}function Ab(){return dy()&&navigator.cookieEnabled}var Q0=[Me.click,Me.custom,Me.search,Me.view],B0=(e,t)=>Q0.indexOf(e)!==-1?Object.assign({language:sa()?document.documentElement.lang:"unknown",userAgent:dy()?navigator.userAgent:"unknown"},t):t,kc=class e{static set(t,r,n){var o,i,a,p;n&&(i=new Date,i.setTime(i.getTime()+n)),p=window.location.hostname,p.indexOf(".")===-1?ub(t,r,i):(a=p.split("."),o=a[a.length-2]+"."+a[a.length-1],ub(t,r,i,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function ub(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function G0(){return Zh()?localStorage:Ab()?new Oc:U0()?sessionStorage:new ua}var Oc=class e{getItem(t){return kc.get(`${e.prefix}${t}`)}removeItem(t){kc.erase(`${e.prefix}${t}`)}setItem(t,r,n){kc.set(`${e.prefix}${t}`,r,n)}};Oc.prefix="coveo_";var Jh=class{constructor(){this.cookieStorage=new Oc}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)}},ua=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Rl="__coveo.analytics.history",$0=20,H0=1e3*60,z0=75,El=class{constructor(t){this.store=t||G0()}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 U(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 U(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(Rl);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return U(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(Rl);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Rl,JSON.stringify(t.slice(0,$0)))}catch{}}clear(){try{this.store.removeItem(Rl)}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,z0)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>H0:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var W0=(e,t)=>U(void 0,void 0,void 0,function*(){return e===Me.view?(yield Y0(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),Y0=e=>U(void 0,void 0,void 0,function*(){let t=new El,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),K0=/^(?:[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 Fl(e){return typeof e=="string"&&K0.test(e)}function lb(e){if(!Fl(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 kt=[];for(let e=0;e<256;++e)kt.push((e+256).toString(16).slice(1));function Cb(e,t=0){return(kt[e[t+0]]+kt[e[t+1]]+kt[e[t+2]]+kt[e[t+3]]+"-"+kt[e[t+4]]+kt[e[t+5]]+"-"+kt[e[t+6]]+kt[e[t+7]]+"-"+kt[e[t+8]]+kt[e[t+9]]+"-"+kt[e[t+10]]+kt[e[t+11]]+kt[e[t+12]]+kt[e[t+13]]+kt[e[t+14]]+kt[e[t+15]]).toLowerCase()}var X0=new Uint8Array(16);function Z0(){return crypto.getRandomValues(X0)}function J0(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 eN="6ba7b810-9dad-11d1-80b4-00c04fd430c8",tN="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function rN(e,t,r,n,o,i){let a=typeof r=="string"?J0(r):r,p=typeof n=="string"?lb(n):n;if(typeof n=="string"&&(n=lb(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let f=new Uint8Array(16+a.length);return f.set(p),f.set(a,p.length),f=t(f),f[6]=f[6]&15|e,f[8]=f[8]&63|128,Cb(f)}function Ho(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():nN(e,t,r)}function nN(e,t,r){e=e||{};let n=e.random??e.rng?.()??Z0();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 Cb(n)}function oN(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 Yh(e,t){return e<<t|e>>>32-t}function iN(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,i=Math.ceil(o/16),a=new Array(i);for(let p=0;p<i;++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];a[p]=f}a[i-1][14]=(e.length-1)*8/2**32,a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=(e.length-1)*8&4294967295;for(let p=0;p<i;++p){let f=new Uint32Array(80);for(let y=0;y<16;++y)f[y]=a[p][y];for(let y=16;y<80;++y)f[y]=Yh(f[y-3]^f[y-8]^f[y-14]^f[y-16],1);let m=r[0],g=r[1],v=r[2],b=r[3],h=r[4];for(let y=0;y<80;++y){let x=Math.floor(y/20),w=Yh(m,5)+oN(x,g,v,b)+h+t[x]+f[y]>>>0;h=b,b=v,v=Yh(g,30)>>>0,g=m,m=w}r[0]=r[0]+m>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+v>>>0,r[3]=r[3]+b>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function Tl(e,t,r,n){return rN(80,iN,e,t)}Tl.DNS=eN;Tl.URL=tN;var bb="2.33.0",db=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Pc={pageview:"pageview",event:"event"},Pl=class{constructor({client:t,uuidGenerator:r=Ho}){this.client=t,this.uuidGenerator=r}},ey=class extends Pl{constructor({client:t,uuidGenerator:r=Ho}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=db(window.location),this.lastReferrer=sa()?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:sa()?document.title:"",encoding:sa()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},i={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},i),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:i}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=i,t===Pc.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===Pc.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Pc.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Pc.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 db(window.location)}},Yn=class e{constructor(t,r){if(!Fl(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(r/1e3)}toString(){return this.clientId.replace(/-/g,"")+"."+this.creationDate.toString()}get expired(){let t=Math.floor(Date.now()/1e3)-this.creationDate;return t<0||t>e.expirationTime}validate(t,r){return!this.expired&&this.matchReferrer(t,r)}matchReferrer(t,r){try{let n=new URL(t);return r.some(o=>new RegExp(o.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(n.host))}catch{return!1}}static fromString(t){let r=t.split(".");if(r.length!==2)return null;let[n,o]=r;if(n.length!==32||isNaN(parseInt(o)))return null;let i=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return Fl(i)?new e(i,Number.parseInt(o)*1e3):null}};Yn.cvo_cid="cvo_cid";Yn.expirationTime=120;var ty=class extends Pl{constructor({client:t,uuidGenerator:r=Ho}){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 U(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(Yn.cvo_cid,new Yn(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};ty.Id="link";var yr=Object.keys;function Il(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Kh=128,xb=192,pb=224,fb=240;function aN(e){return(e&248)===fb?4:(e&fb)===pb?3:(e&pb)===xb?2:1}function sN(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&Kh)!=Kh)break;if(r-=3,(n&xb)!=Kh){t-r>=aN(n)*3&&(r=t);break}}return e.substring(0,r)}var ry={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"},cN=yr(ry).map(e=>ry[e]),uN=[...cN].join("|"),lN=new RegExp(`^(${uN}$)`),dN={svcAction:"svc_action",svcActionData:"svc_action_data"},pN=e=>yr(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=ry[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),fN=e=>lN.test(e),mN=[fN],mb={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},gb={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},jt={action:"pa",list:"pal",listSource:"pls"},kl={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},gN=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],ny={id:"quoteId",affiliation:"quoteAffiliation"},oy={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},hN={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),kl),purchase:Object.assign(Object.assign({},jt),kl),quickview:jt,quote:Object.assign(Object.assign({},jt),ny),review:Object.assign(Object.assign({},jt),oy)},yN=yr(mb).map(e=>mb[e]),SN=yr(gb).map(e=>gb[e]),vN=yr(jt).map(e=>jt[e]),AN=yr(kl).map(e=>kl[e]),CN=yr(oy).map(e=>oy[e]),bN=yr(ny).map(e=>ny[e]),xN=[...yN,"custom"].join("|"),wN=[...SN,"custom"].join("|"),wb="(pr[0-9]+)",Rb="(il[0-9]+pi[0-9]+)",RN=new RegExp(`^${wb}(${xN})$`),IN=new RegExp(`^(${Rb}(${wN}))|(il[0-9]+nm)$`),EN=new RegExp(`^(${vN.join("|")})$`),FN=new RegExp(`^(${AN.join("|")})$`),TN=new RegExp(`^${wb}custom$`),PN=new RegExp(`^${Rb}custom$`),kN=new RegExp(`^(${[...gN,...CN,...bN].join("|")})$`),ON=e=>RN.test(e),_N=e=>IN.test(e),NN=e=>EN.test(e),DN=e=>FN.test(e),qN=e=>kN.test(e),MN=[_N,ON,NN,DN,qN],VN=[TN,PN],jN={anonymizeIp:"aip"},LN={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},UN={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},QN=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],BN=Object.assign(Object.assign(Object.assign(Object.assign({},jN),LN),UN),QN.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),iy=Object.assign(Object.assign({},BN),dN),GN=e=>{let t=!!e.action&&hN[e.action]||{};return yr(e).reduce((r,n)=>{let o=t[n]||iy[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},$N=yr(iy).map(e=>iy[e]),HN=e=>$N.indexOf(e)!==-1,zN=e=>e==="custom",WN=e=>[...MN,...mN,HN,zN].some(t=>t(e)),YN=e=>yr(e).reduce((t,r)=>{let n=KN(r);return n?Object.assign(Object.assign({},t),XN(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),KN=e=>{let t;return[...VN].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},XN=(e,t)=>yr(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),ay=class{constructor(t){this.opts=t}sendEvent(t,r){return U(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:o}=this.opts,i=yield this.getQueryParamsForEventType(t),{url:a,payload:p}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),f=this.encodeForEventType(t,p),m=new Blob([f],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(a,m)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return U(this,void 0,void 0,function*(){let o=t,i=r;if(n){let a=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:p,body:f}=a;o=p||t;try{i=JSON.parse(f)}catch(m){console.error("Unable to process the request body as a JSON string",m)}}return{payload:i,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return U(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(i=>!!i).join("&")})}isEventTypeLegacy(t){return[Me.click,Me.custom,Me.search,Me.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}},sy=class{sendEvent(t,r){return U(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){return Promise.resolve()})}},hb=S.fetch,Ol=class{constructor(t){this.opts=t}sendEvent(t,r){return U(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:i}=this.opts,a=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",p={url:`${n}/analytics/${t}${a}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},f=Object.assign(Object.assign({},p),i?yield i(p,"analyticsFetch"):{}),{url:m}=f,g=Br(f,["url"]),v;try{v=yield hb(m,g)}catch(b){console.error("An error has occurred when sending the event.",b);return}if(v.ok){let b=yield v.json();return b.visitorId&&o.setCurrentVisitorId(b.visitorId),b}else{try{v.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,v,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield hb(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[Me.click,Me.custom,Me.search,Me.view].indexOf(t)!==-1}getVisitorIdParam(){return U(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"})}},cy=class{constructor(t,r){Zh()&&Ab()?this.storage=new Jh:Zh()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new ua),this.client=new Ol(t),this.beaconClient=new ay(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:i}of n)this.beaconClient.sendEvent(o,i)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},uy=class{constructor(t,r){this.storage=r||new ua,this.client=new Ol(t)}getClientDependingOnEventType(t){return this.client}},_l=class{constructor(){this.storage=new ua,this.client=new sy}getClientDependingOnEventType(t){return this.client}},ZN="xx",JN=e=>e?.startsWith(ZN)||!1,eD=`
28
+ ${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":zO(g,n,t);break}}}}function zO(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function WO(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function qA(){return{data:"",event:"",id:"",retry:void 0}}var mh="text/event-stream",YO=1e3,LA="last-event-id";function UA(){return typeof window<"u"}function Ku(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:a,openWhenHidden:p,fetch:f,...m}){return new Promise((g,v)=>{let b={...r};b.accept||(b.accept=mh);let h;function y(){h?.abort(),document.hidden||T()}!p&&UA()&&document.addEventListener("visibilitychange",y);let x=YO,w;function I(){UA()&&document.removeEventListener("visibilitychange",y),clearTimeout(w),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let F=f??A,E=n??KO;function T(){return _T2.apply(this,arguments)}function _T2(){_T2=_asyncToGenerator(function*(){h=s.AbortController?new s.AbortController:null;try{let P=yield F(e,{...m,headers:b,signal:h?.signal});yield E(P),yield MA(P.body,VA(jA(q=>{q?b[LA]=q:delete b[LA]},q=>{x=q},o))),i?.(),I(),g()}catch(P){if(!h?.signal?.aborted)try{let q=a?.(P)??x;clearTimeout(w),w=setTimeout(T,q)}catch(q){I(),v(q)}}});return _T2.apply(this,arguments)}T()})}function KO(e){let t=e.headers.get("content-type");if(!t?.startsWith(mh))throw new Error(`Expected content-type to be ${mh}, Actual: ${t}`)}d();c();l();u();var Hn=class{constructor(t){de(this,"_basePath");de(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 XO=(e,t,r)=>new Hn(`${e}/rest/organizations/${t}/machinelearning/streaming/${r}`).href,QA=3,ZO=5e3,JO="text/event-stream",yh=1,gh=class extends Error{},sc=class extends Error{constructor(r){super(r.message);de(this,"payload",r)}},hh=class{constructor(){de(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)}},Xu=class{constructor(t){de(this,"logger");this.logger=t.logger}streamGeneratedAnswer(t,r){let{url:n,organizationId:o,streamId:i,accessToken:a}=t,{write:p,abort:f,close:m,resetAnswer:g}=r,v=new hh;if(!i){this.logger.error("No stream ID found");return}let b=0,h,y=()=>{h&&!v.isActive(h)&&(w?.abort(),g(),I())},x=()=>{v.remove(h),h=lA(y,h,ZO),v.add(h)},w=new s.AbortController,I=()=>Ku(XO(n,o,i),{method:"GET",fetch:A,headers:{Authorization:`Bearer ${a}`,accept:"*/*"},openWhenHidden:!0,signal:w?.signal,onopen(F){return _asyncToGenerator(function*(){if(F.ok&&F.headers.get("content-type")===JO)return;throw F.status>=400&&F.status<500&&F.status!==429?new sc({message:"Error opening stream",code:F.status}):new gh})()},onmessage:F=>{if(w?.signal.aborted)return;let E=JSON.parse(F.data);if(E.finishReason==="ERROR"){v.remove(h),w?.abort(),f({message:E.errorMessage,code:E.statusCode});return}p(E),b=0,E.finishReason==="COMPLETED"?(v.remove(h),m()):x()},onerror:F=>{if(!w?.signal.aborted){if(v.remove(h),F instanceof sc)throw w?.abort(),f(F),F;if(++b>QA){this.logger.info("Maximum retry exceeded.");let E={message:"Failed to complete stream.",code:yh};throw w?.abort(),f(E),new sc(E)}this.logger.info(`Retrying...(${b}/${QA})`),g()}}});return I(),w}};d();c();l();u();var Zu=e=>e;d();c();l();u();d();c();l();u();d();c();l();u();function cc(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Sh=e=>{let{response:t}=e;return t.body?e_(e):t_(t)},e_=e=>n_(e)?o_(e):r_(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},t_=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function r_(e){return e.body.statusCode!==void 0}function n_(e){return e.body.exception!==void 0}var o_=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});d();c();l();u();function BA(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}d();c();l();u();var vh=(e,t,r,n)=>{let o=new Hn(`${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 GA=(e,t)=>{let r=new Hn(`${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},Ah=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Lr.call({...vh(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:cc(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=BA(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return i_(a)?{success:a}:{error:Sh({response:r,body:a})}});return function Ah(_x5,_x6){return _ref3.apply(this,arguments)}}();function i_(e){return typeof e=="string"}d();c();l();u();d();c();l();u();function Zi(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function bt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Zi(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Zi(),extendedResults:{},searchAction:void 0}}d();c();l();u();d();c();l();u();function a_(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function s_(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Ji(e,t){if(t&&e.name==="AbortError")return{error:s_(e)};if(e instanceof Mo)return{error:a_(e)};throw e}var zn=e=>e.success!==void 0,ze=e=>e.error!==void 0;function $A(e){return e.results!==void 0}function HA(e){let t=Zi();return J(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}d();c();l();u();d();c();l();u();var Ch=(e,t)=>`${e.url}/rest/organizations/${e.organizationId}/insight/v1/configs/${e.insightId}${t??""}`,c_=e=>`${e.url}/rest/organizations/${e.organizationId}/machinelearning/user/actions`,uc=(e,t,r,n)=>{u_(e);let o=Ch(e,n);return{accessToken:e.accessToken,method:t,contentType:r,url:o,origin:"insightApiFetch"}},zA=(e,t,r)=>{l_(e);let n=c_(e);return{accessToken:e.accessToken,method:t,contentType:r,url:n,origin:"insightApiFetch"}},bh=e=>{let{insightId:t,...r}=cc(e);return r},WA=e=>{if(!e.url)throw new Error("The 'url' attribute must contain a valid platform URL.");if(!e.organizationId)throw new Error("The 'organizationId' attribute must contain a valid organization ID.");if(!e.accessToken)throw new Error("The 'accessToken' attribute must contain a valid platform access token.")},u_=e=>{if(WA(e),!e.insightId)throw new Error("The 'insightId' attribute must contain a valid Insight Panel configuration ID.")},l_=e=>{if(WA(e),!e.userId)throw new Error("The 'userId' attribute must contain a valid user ID.")};var YA=e=>({...uc(e,"GET","application/json","/interface"),requestParams:{}});d();c();l();u();var KA=e=>({...uc(e,"POST","application/json","/search"),requestParams:bh(e)}),XA=e=>({...uc(e,"POST","application/json","/querysuggest"),requestParams:bh(e)});d();c();l();u();var ZA=e=>({...zA(e,"POST","application/json"),requestParams:{objectId:e.userId}});var Ju=class{constructor(t){de(this,"options",t)}getInterface(t){var _this=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...YA(t),..._this.options});if(r instanceof Error)return Ji(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}query(t,r){var _this2=this;return _asyncToGenerator(function*(){let n=yield Lr.call({...KA(t),requestMetadata:{method:"search",origin:r?.origin},..._this2.options});if(n instanceof Error)return Ji(n);let o=yield n.json();return $A(o)&&(o=HA(o)),n.ok?{success:o}:{error:o}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...XA(t),..._this3.options});if(r instanceof Error)return Ji(r);let n=yield r.json();return n.completions?{success:n}:{error:n}})()}userActions(t){var _this4=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...ZA(t),..._this4.options});if(r instanceof Error)return Ji(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this5=this;return _asyncToGenerator(function*(){return Ah(t,{..._this5.options})})()}};d();c();l();u();d();c();l();u();var H=new $({required:!0,emptyAllowed:!1}),We=new $({required:!1,emptyAllowed:!1}),Ke=new $({required:!0,emptyAllowed:!0}),A4=new $({required:!1,emptyAllowed:!0}),el=new oe({each:H,required:!0}),JA=new $({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),eC=new $({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),C4=new $({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Tr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),mr=(e,t)=>{if("required"in t)return{payload:new _e({value:t}).validate({value:e}).value};let o=new Y({options:{required:!0},values:t}).validate(e);if(o)throw new Do(o);return{payload:e}},_=(e,t)=>{try{return mr(e,t)}catch(r){return{payload:e,error:Tr(r)}}},gr=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return tC(e,t,r,o,"Controller initialization error")},ht=(e,t,r,n)=>{let o=`Check the options of ${n}`;return tC(e,t,r,o,"Controller initialization error")},tC=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};d();c();l();u();d();c();l();u();d();c();l();u();function Ft(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 d_=typeof Symbol=="function"&&Symbol.observable||"@@observable",rC=d_,xh=()=>Math.random().toString(36).substring(7).split("").join("."),p_={INIT:`@@redux/INIT${xh()}`,REPLACE:`@@redux/REPLACE${xh()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${xh()}`},tl=p_;function Ur(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 wh(e,t,r){if(typeof e!="function")throw new Error(Ft(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ft(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ft(1));return r(wh)(e,t)}let n=e,o=t,i=new Map,a=i,p=0,f=!1;function m(){a===i&&(a=new Map,i.forEach((w,I)=>{a.set(I,w)}))}function g(){if(f)throw new Error(Ft(3));return o}function v(w){if(typeof w!="function")throw new Error(Ft(4));if(f)throw new Error(Ft(5));let I=!0;m();let F=p++;return a.set(F,w),function(){if(I){if(f)throw new Error(Ft(6));I=!1,m(),a.delete(F),i=null}}}function b(w){if(!Ur(w))throw new Error(Ft(7));if(typeof w.type>"u")throw new Error(Ft(8));if(typeof w.type!="string")throw new Error(Ft(17));if(f)throw new Error(Ft(9));try{f=!0,o=n(o,w)}finally{f=!1}return(i=a).forEach(F=>{F()}),w}function h(w){if(typeof w!="function")throw new Error(Ft(10));n=w,b({type:tl.REPLACE})}function y(){let w=v;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(Ft(11));function F(){let T=I;T.next&&T.next(g())}return F(),{unsubscribe:w(F)}},[rC](){return this}}}return b({type:tl.INIT}),{dispatch:b,subscribe:v,getState:g,replaceReducer:h,[rC]:y}}function f_(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:tl.INIT})>"u")throw new Error(Ft(12));if(typeof r(void 0,{type:tl.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ft(13))})}function ea(e){let t=Object.keys(e),r={};for(let a=0;a<t.length;a++){let p=t[a];typeof e[p]=="function"&&(r[p]=e[p])}let n=Object.keys(r),o,i;try{f_(r)}catch(a){i=a}return function(p={},f){if(i)throw i;let m=!1,g={};for(let v=0;v<n.length;v++){let b=n[v],h=r[b],y=p[b],x=h(y,f);if(typeof x>"u"){let w=f&&f.type;throw new Error(Ft(14))}g[b]=x,m=m||x!==y}return m=m||n.length!==Object.keys(p).length,m?g:p}}function lc(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function nC(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(Ft(15))},a={getState:o.getState,dispatch:(f,...m)=>i(f,...m)},p=e.map(f=>f(a));return i=lc(...p)(o.dispatch),{...o,dispatch:i}}}function dc(e){return Ur(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var _h=Symbol.for("immer-nothing"),pc=Symbol.for("immer-draftable"),St=Symbol.for("immer-state");function Tt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var sr=Object,jo=sr.getPrototypeOf,fc="constructor",Sc="prototype",Eh="configurable",il="enumerable",nl="writable",mc="value",Ht=e=>!!e&&!!e[St];function Vt(e){return e?dC(e)||Ac(e)||!!e[pc]||!!e[fc]?.[pc]||Cc(e)||bc(e):!1}var m_=sr[Sc][fc].toString(),oC=new WeakMap;function dC(e){if(!e||!ra(e))return!1;let t=jo(e);if(t===null||t===sr[Sc])return!0;let r=sr.hasOwnProperty.call(t,fc)&&t[fc];if(r===Object)return!0;if(!Vo(r))return!1;let n=oC.get(r);return n===void 0&&(n=Function.toString.call(r),oC.set(r,n)),n===m_}function pC(e){return Ht(e)||Tt(15,e),e[St].base_}function vc(e,t,r=!0){Lo(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 Lo(e){let t=e[St];return t?t.type_:Ac(e)?1:Cc(e)?2:bc(e)?3:0}var ta=(e,t,r=Lo(e))=>r===2?e.has(t):sr[Sc].hasOwnProperty.call(e,t),In=(e,t,r=Lo(e))=>r===2?e.get(t):e[t],al=(e,t,r,n=Lo(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function g_(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ac=Array.isArray,Cc=e=>e instanceof Map,bc=e=>e instanceof Set,ra=e=>typeof e=="object",Vo=e=>typeof e=="function",Rh=e=>typeof e=="boolean";function h_(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var y_=e=>ra(e)?e?.[St]:null,En=e=>e.copy_||e.base_;var Nh=e=>e.modified_?e.copy_:e.base_;function Fh(e,t){if(Cc(e))return new Map(e);if(bc(e))return new Set(e);if(Ac(e))return Array[Sc].slice.call(e);let r=dC(e);if(t===!0||t==="class_only"&&!r){let n=sr.getOwnPropertyDescriptors(e);delete n[St];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],p=n[a];p[nl]===!1&&(p[nl]=!0,p[Eh]=!0),(p.get||p.set)&&(n[a]={[Eh]:!0,[nl]:!0,[il]:p[il],[mc]:e[a]})}return sr.create(jo(e),n)}else{let n=jo(e);if(n!==null&&r)return{...e};let o=sr.create(n);return sr.assign(o,e)}}function Dh(e,t=!1){return pl(e)||Ht(e)||!Vt(e)||(Lo(e)>1&&sr.defineProperties(e,{set:rl,add:rl,clear:rl,delete:rl}),sr.freeze(e),t&&vc(e,(r,n)=>{Dh(n,!0)},!1)),e}function S_(){Tt(2)}var rl={[mc]:S_};function pl(e){return e===null||!ra(e)?!0:sr.isFrozen(e)}var sl="MapSet",cl="Patches",iC="ArrayMethods",ul={};function Uo(e){let t=ul[e];return t||Tt(0,e),t}var aC=e=>!!ul[e];function v_(e,t){ul[e]||(ul[e]=t)}var gc,fC=()=>gc,A_=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:aC(sl)?Uo(sl):void 0,arrayMethodsPlugin_:aC(iC)?Uo(iC):void 0});function sC(e,t){t&&(e.patchPlugin_=Uo(cl),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Th(e){Ph(e),e.drafts_.forEach(C_),e.drafts_=null}function Ph(e){e===gc&&(gc=e.parent_)}var cC=e=>gc=A_(gc,e);function C_(e){let t=e[St];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function uC(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[St].modified_&&(Th(t),Tt(4)),Vt(e)&&(e=lC(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[St].base_,e,t)}else e=lC(t,r);return b_(t,e,!0),Th(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==_h?e:void 0}function lC(e,t){if(pl(t))return t;let r=t[St];if(!r)return ll(t,e.handledSet_,e);if(!fl(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);hC(r,e)}return r.copy_}function b_(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Dh(t,r)}function mC(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var fl=(e,t)=>e.scope_===t,x_=[];function gC(e,t,r,n){let o=En(e),i=e.type_;if(n!==void 0&&In(o,n,i)===t){al(o,n,r,i);return}if(!e.draftLocations_){let p=e.draftLocations_=new Map;vc(o,(f,m)=>{if(Ht(m)){let g=p.get(m)||[];g.push(f),p.set(m,g)}})}let a=e.draftLocations_.get(t)??x_;for(let p of a)al(o,p,r,i)}function w_(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!fl(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let a=Nh(i);gC(e,i.draft_??i,a,r),hC(i,o)})}function hC(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)}mC(e)}}function R_(e,t,r){let{scope_:n}=e;if(Ht(r)){let o=r[St];fl(o,n)&&o.callbacks_.push(function(){ol(e);let a=Nh(o);gC(e,r,a,t)})}else Vt(r)&&e.callbacks_.push(function(){let i=En(e);e.type_===3?i.has(r)&&ll(r,n.handledSet_,n):In(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&ll(In(e.copy_,t,e.type_),n.handledSet_,n)})}function ll(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Ht(e)||t.has(e)||!Vt(e)||pl(e)||(t.add(e),vc(e,(n,o)=>{if(Ht(o)){let i=o[St];if(fl(i,r)){let a=Nh(i);al(e,n,a,e.type_),mC(i)}}else Vt(o)&&ll(o,t,r)})),e}function I_(e,t){let r=Ac(e),n={type_:r?1:0,scope_:t?t.scope_:fC(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=n,i=dl;r&&(o=[n],i=hc);let{revoke:a,proxy:p}=Proxy.revocable(o,i);return n.draft_=p,n.revoke_=a,[p,n]}var dl={get(e,t){if(t===St)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=En(e);if(!ta(o,t,e.type_))return F_(e,o,t);let i=o[t];if(e.finalized_||!Vt(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&h_(t))return i;if(i===Ih(e.base_,t)||E_(e,t,i)){ol(e);let a=e.type_===1?+t:t,p=Oh(e.scope_,i,e,a);return e.copy_[a]=p}return i},has(e,t){return t in En(e)},ownKeys(e){return Reflect.ownKeys(En(e))},set(e,t,r){let n=yC(En(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Ih(En(e),t),i=o?.[St];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(g_(r,o)&&(r!==void 0||ta(e.base_,t,e.type_)))return!0;ol(e),kh(e)}return e.copy_[t]===r&&(r!==void 0||ta(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),R_(e,t,r)),!0},deleteProperty(e,t){return ol(e),Ih(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),kh(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=En(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[nl]:!0,[Eh]:e.type_!==1||t!=="length",[il]:n[il],[mc]:r[t]}},defineProperty(){Tt(11)},getPrototypeOf(e){return jo(e.base_)},setPrototypeOf(){Tt(12)}},hc={};for(let e in dl){let t=dl[e];hc[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}hc.deleteProperty=function(e,t){return hc.set.call(this,e,t,void 0)};hc.set=function(e,t,r){return dl.set.call(this,e[0],t,r,e[0])};function Ih(e,t){let r=e[St];return(r?En(r):e)[t]}function E_(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!Vt(r)||r[St]?!1:e.baseRefs_.has(r)}function F_(e,t,r){let n=yC(t,r);return n?mc in n?n[mc]:n.get?.call(e.draft_):void 0}function yC(e,t){if(!(t in e))return;let r=jo(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=jo(r)}}function kh(e){e.modified_||(e.modified_=!0,e.parent_&&kh(e.parent_))}function ol(e){e.copy_||(e.assigned_=new Map,e.copy_=Fh(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var T_=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Vo(t)&&!Vo(r)){let i=r;r=t;let a=this;return function(f=i,...m){return a.produce(f,g=>r.call(this,g,...m))}}Vo(r)||Tt(6),n!==void 0&&!Vo(n)&&Tt(7);let o;if(Vt(t)){let i=cC(this),a=Oh(i,t,void 0),p=!0;try{o=r(a),p=!1}finally{p?Th(i):Ph(i)}return sC(i,n),uC(o,i)}else if(!t||!ra(t)){if(o=r(t),o===void 0&&(o=t),o===_h&&(o=void 0),this.autoFreeze_&&Dh(o,!0),n){let i=[],a=[];Uo(cl).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:a}),n(i,a)}return o}else Tt(1,t)},this.produceWithPatches=(t,r)=>{if(Vo(t))return(a,...p)=>this.produceWithPatches(a,f=>t(f,...p));let n,o;return[this.produce(t,r,(a,p)=>{n=a,o=p}),n,o]},Rh(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Rh(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Rh(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Vt(e)||Tt(8),Ht(e)&&(e=ml(e));let t=cC(this),r=Oh(t,e,void 0);return r[St].isManual_=!0,Ph(t),r}finishDraft(e,t){let r=e&&e[St];(!r||!r.isManual_)&&Tt(9);let{scope_:n}=r;return sC(n,t),uC(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=Uo(cl).applyPatches_;return Ht(e)?n(e,t):this.produce(e,o=>n(o,t))}};function Oh(e,t,r,n){let[o,i]=Cc(t)?Uo(sl).proxyMap_(t,r):bc(t)?Uo(sl).proxySet_(t,r):I_(t,r);return(r?.scope_??fC()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?w_(r,i,n):i.callbacks_.push(function(f){f.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:m}=f;i.modified_&&m&&m.generatePatches_(i,[],f)}),o}function ml(e){return Ht(e)||Tt(10,e),SC(e)}function SC(e){if(!Vt(e)||pl(e))return e;let t=e[St],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Fh(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Fh(e,!0);return vc(r,(o,i)=>{al(r,o,SC(i))},n),t&&(t.finalized_=!1),r}function vC(){function t(y,x=[]){if(y.key_!==void 0){let w=y.parent_.copy_??y.parent_.base_,I=y_(In(w,y.key_)),F=In(w,y.key_);if(F===void 0||F!==y.draft_&&F!==y.base_&&F!==y.copy_||I!=null&&I.base_!==y.base_)return null;let E=y.parent_.type_===3,T;if(E){let P=y.parent_;T=Array.from(P.drafts_.keys()).indexOf(y.key_)}else T=y.key_;if(!(E&&w.size>T||ta(w,T)))return null;x.push(T)}if(y.parent_)return t(y.parent_,x);x.reverse();try{r(y.copy_,x)}catch{return null}return x}function r(y,x){let w=y;for(let I=0;I<x.length-1;I++){let F=x[I];if(w=In(w,F),!ra(w)||w===null)throw new Error(`Cannot resolve path at '${x.join("/")}'`)}return w}let n="replace",o="add",i="remove";function a(y,x,w){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:I,inversePatches_:F}=w;switch(y.type_){case 0:case 2:return f(y,x,I,F);case 1:return p(y,x,I,F);case 3:return m(y,x,I,F)}}function p(y,x,w,I){let{base_:F,assigned_:E}=y,T=y.copy_;T.length<F.length&&([F,T]=[T,F],[w,I]=[I,w]);let P=y.allIndicesReassigned_===!0;for(let q=0;q<F.length;q++){let G=T[q],B=F[q];if((P||E?.get(q.toString()))&&G!==B){let Q=G?.[St];if(Q&&Q.modified_)continue;let L=x.concat([q]);w.push({op:n,path:L,value:h(G)}),I.push({op:n,path:L,value:h(B)})}}for(let q=F.length;q<T.length;q++){let G=x.concat([q]);w.push({op:o,path:G,value:h(T[q])})}for(let q=T.length-1;F.length<=q;--q){let G=x.concat([q]);I.push({op:i,path:G})}}function f(y,x,w,I){let{base_:F,copy_:E,type_:T}=y;vc(y.assigned_,(P,q)=>{let G=In(F,P,T),B=In(E,P,T),j=q?ta(F,P)?n:o:i;if(G===B&&j===n)return;let Q=x.concat(P);w.push(j===i?{op:j,path:Q}:{op:j,path:Q,value:h(B)}),I.push(j===o?{op:i,path:Q}:j===i?{op:o,path:Q,value:h(G)}:{op:n,path:Q,value:h(G)})})}function m(y,x,w,I){let{base_:F,copy_:E}=y,T=0;F.forEach(P=>{if(!E.has(P)){let q=x.concat([T]);w.push({op:i,path:q,value:P}),I.unshift({op:o,path:q,value:P})}T++}),T=0,E.forEach(P=>{if(!F.has(P)){let q=x.concat([T]);w.push({op:o,path:q,value:P}),I.unshift({op:i,path:q,value:P})}T++})}function g(y,x,w){let{patches_:I,inversePatches_:F}=w;I.push({op:n,path:[],value:x===_h?void 0:x}),F.push({op:n,path:[],value:y})}function v(y,x){return x.forEach(w=>{let{path:I,op:F}=w,E=y;for(let G=0;G<I.length-1;G++){let B=Lo(E),j=I[G];typeof j!="string"&&typeof j!="number"&&(j=""+j),(B===0||B===1)&&(j==="__proto__"||j===fc)&&Tt(19),Vo(E)&&j===Sc&&Tt(19),E=In(E,j),(E===null||!ra(E))&&Tt(18,I.join("/"))}let T=Lo(E),P=b(w.value),q=I[I.length-1];switch(F){case n:switch(T){case 2:return E.set(q,P);case 3:Tt(16);default:return E[q]=P}case o:switch(T){case 1:return q==="-"?E.push(P):E.splice(q,0,P);case 2:return E.set(q,P);case 3:return E.add(P);default:return E[q]=P}case i:switch(T){case 1:return E.splice(q,1);case 2:return E.delete(q);case 3:return E.delete(w.value);default:return delete E[q]}default:Tt(17,F)}}),y}function b(y){if(!Vt(y))return y;if(Ac(y))return y.map(b);if(Cc(y))return new Map(Array.from(y.entries()).map(([w,I])=>[w,b(I)]));if(bc(y))return new Set(Array.from(y).map(b));let x=Object.create(jo(y));for(let w in y)x[w]=b(y[w]);return ta(y,pc)&&(x[pc]=y[pc]),x}function h(y){return Ht(y)?b(y):y}v_(cl,{applyPatches_:v,generatePatches_:a,generateReplacementPatches_:g,getPath:t})}var P_=S.Iterator,O4=typeof P_?.from=="function";var yc=new T_,Qo=yc.produce,qh=yc.produceWithPatches.bind(yc);var Mh=yc.applyPatches.bind(yc);d();c();l();u();function k_(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function O_(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 AC=e=>Array.isArray(e)?e:[e];function __(e){let t=Array.isArray(e[0])?e[0]:e;return O_(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function N_(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var D_=class{constructor(e){this.value=e}deref(){return this.value}},q_=()=>typeof WeakRef>"u"?D_:WeakRef,bC=q_(),M_=0,CC=1;function gl(){return{s:M_,v:void 0,o:null,p:null}}function V_(e){return e instanceof bC?e.deref():e}function xc(e,t={}){let r=gl(),{resultEqualityCheck:n}=t,o,i=0;function a(){let p=r,{length:f}=arguments;for(let v=0,b=f;v<b;v++){let h=arguments[v];if(typeof h=="function"||typeof h=="object"&&h!==null){let y=p.o;y===null&&(p.o=y=new WeakMap);let x=y.get(h);x===void 0?(p=gl(),y.set(h,p)):p=x}else{let y=p.p;y===null&&(p.p=y=new Map);let x=y.get(h);x===void 0?(p=gl(),y.set(h,p)):p=x}}let m=p,g;if(p.s===CC)g=p.v;else if(g=e.apply(null,arguments),i++,n){let v=V_(o);v!=null&&n(v,g)&&(g=v,i!==0&&i--),o=typeof g=="object"&&g!==null||typeof g=="function"?new bC(g):g}return m.s=CC,m.v=g,g}return a.clearCache=()=>{r=gl(),a.resetResultsCount()},a.resultsCount=()=>i,a.resetResultsCount=()=>{i=0},a}function j_(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,a=0,p,f={},m=o.pop();typeof m=="object"&&(f=m,m=o.pop()),k_(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);let g={...r,...f},{memoize:v,memoizeOptions:b=[],argsMemoize:h=xc,argsMemoizeOptions:y=[]}=g,x=AC(b),w=AC(y),I=__(o),F=v(function(){return i++,m.apply(null,arguments)},...x),E=!0,T=h(function(){a++;let q=N_(I,arguments);return p=F.apply(null,q),p},...w);return Object.assign(T,{resultFunc:m,memoizedResultFunc:F,dependencies:I,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>p,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var ct=j_(xc);d();c();l();u();function xC(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var wC=xC(),RC=xC;var L_=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?lc:lc.apply(null,arguments)},rW=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},U_=e=>e&&typeof e.match=="function";function k(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(zt(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=>dc(n)&&n.type===e,r}var _C=class wc extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,wc.prototype)}static get[Symbol.species](){return wc}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new wc(...t[0].concat(this)):new wc(...t.concat(this))}};function IC(e){return Vt(e)?Qo(e,()=>{}):e}function hl(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function Q_(e){return typeof e=="boolean"}var B_=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new _C;return r&&(Q_(r)?a.push(wC):a.push(RC(r.extraArgument))),a},Rc="RTK_autoBatch",ia=()=>e=>({payload:e,meta:{[Rc]:!0}}),EC=e=>t=>{setTimeout(t,e)},G_=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(i),clearTimeout(a),r())},i=e(o),a=setTimeout(o,t)},$_=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,a=!1,p=new Set,f=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?G_(window.requestAnimationFrame,100):EC(10):e.type==="callback"?e.queueNotification:EC(e.timeout),m=()=>{a=!1,i&&(i=!1,p.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let v=()=>o&&g(),b=n.subscribe(v);return p.add(g),()=>{b(),p.delete(g)}},dispatch(g){try{return o=!g?.meta?.[Rc],i=!o,i&&(a||(a=!0,f(m))),n.dispatch(g)}finally{o=!0}}})},H_=e=>function(r){let{autoBatch:n=!0}=r??{},o=new _C(e);return n&&o.push($_(typeof n=="object"?n:void 0)),o};function NC(e){let t=B_(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:a=void 0,enhancers:p=void 0}=e||{},f;if(typeof r=="function")f=r;else if(Ur(r))f=ea(r);else throw new Error(zt(1));let m;typeof n=="function"?m=n(t):m=t();let g=lc;o&&(g=L_({trace:!1,...(typeof o=="object"&&o)}));let v=nC(...m),b=H_(v),h=typeof p=="function"?p(b):b(),y=g(...h);return wh(f,a,y)}function DC(e){let t={},r=[],n,o={addCase(i,a){let p=typeof i=="string"?i:i.type;if(!p)throw new Error(zt(28));if(p in t)throw new Error(zt(29));return t[p]=a,o},addAsyncThunk(i,a){return a.pending&&(t[i.pending.type]=a.pending),a.rejected&&(t[i.rejected.type]=a.rejected),a.fulfilled&&(t[i.fulfilled.type]=a.fulfilled),a.settled&&r.push({matcher:i.settled,reducer:a.settled}),o},addMatcher(i,a){return r.push({matcher:i,reducer:a}),o},addDefaultCase(i){return n=i,o}};return e(o),[t,r,n]}function z_(e){return typeof e=="function"}function fe(e,t){let[r,n,o]=DC(t),i;if(z_(e))i=()=>IC(e());else{let p=IC(e);i=()=>p}function a(p=i(),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,v)=>{if(v)if(Ht(g)){let h=v(g,f);return h===void 0?g:h}else{if(Vt(g))return Qo(g,b=>v(b,f));{let b=v(g,f);if(b===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return b}}return g},p)}return a.getInitialState=i,a}var qC=(e,t)=>U_(e)?e.match(t):e(t);function Qr(...e){return t=>e.some(r=>qC(r,t))}function oa(...e){return t=>e.every(r=>qC(r,t))}function Al(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 Ic(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Cl(...e){return e.length===0?t=>Al(t,["pending"]):Ic(e)?Qr(...e.map(t=>t.pending)):Cl()(e[0])}function Go(...e){return e.length===0?t=>Al(t,["rejected"]):Ic(e)?Qr(...e.map(t=>t.rejected)):Go()(e[0])}function Ec(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?oa(Go(...e),t):Ic(e)?oa(Go(...e),t):Ec()(e[0])}function Fn(...e){return e.length===0?t=>Al(t,["fulfilled"]):Ic(e)?Qr(...e.map(t=>t.fulfilled)):Fn()(e[0])}function bl(...e){return e.length===0?t=>Al(t,["pending","fulfilled","rejected"]):Ic(e)?Qr(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):bl()(e[0])}var W_="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Fc=(e=21)=>{let t="",r=e;for(;r--;)t+=W_[Math.random()*64|0];return t},Y_=["name","message","stack","code"],Vh=class{constructor(e,t){de(this,"payload");de(this,"meta");de(this,"_type");this.payload=e,this.meta=t}},FC=class{constructor(e,t){de(this,"payload");de(this,"meta");de(this,"_type");this.payload=e,this.meta=t}},K_=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of Y_)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},TC="External signal was aborted",me=(()=>{function e(t,r,n){let o=k(t+"/fulfilled",(f,m,g,v)=>({payload:f,meta:{...(v||{}),arg:g,requestId:m,requestStatus:"fulfilled"}})),i=k(t+"/pending",(f,m,g)=>({payload:void 0,meta:{...(g||{}),arg:m,requestId:f,requestStatus:"pending"}})),a=k(t+"/rejected",(f,m,g,v,b)=>({payload:v,error:(n&&n.serializeError||K_)(f||"Rejected"),meta:{...(b||{}),arg:g,requestId:m,rejectedWithValue:!!v,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"}}));function p(f,{signal:m}={}){return(g,v,b)=>{let h=n?.idGenerator?n.idGenerator(f):Fc(),y=new s.AbortController,x,w;function I(E){w=E,y.abort()}m&&(m.aborted?I(TC):m.addEventListener("abort",()=>I(TC),{once:!0}));let F=_asyncToGenerator(function*(){let E;try{let P=n?.condition?.(f,{getState:v,extra:b});if(Z_(P)&&(P=yield P),P===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let q=new Promise((G,B)=>{x=()=>{B({name:"AbortError",message:w||"Aborted"})},y.signal.addEventListener("abort",x,{once:!0})});g(i(h,f,n?.getPendingMeta?.({requestId:h,arg:f},{getState:v,extra:b}))),E=yield Promise.race([q,Promise.resolve(r(f,{dispatch:g,getState:v,extra:b,requestId:h,signal:y.signal,abort:I,rejectWithValue:(G,B)=>new Vh(G,B),fulfillWithValue:(G,B)=>new FC(G,B)})).then(G=>{if(G instanceof Vh)throw G;return G instanceof FC?o(G.payload,h,f,G.meta):o(G,h,f)})])}catch(P){E=P instanceof Vh?a(null,h,f,P.payload,P.meta):a(P,h,f)}finally{x&&y.signal.removeEventListener("abort",x)}return n&&!n.dispatchConditionRejection&&a.match(E)&&E.meta.condition||g(E),E})();return Object.assign(F,{abort:I,requestId:h,arg:f,unwrap(){return F.then(X_)}})}}return Object.assign(p,{pending:i,rejected:a,fulfilled:o,settled:Qr(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function X_(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Z_(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var MC=Symbol.for("rtk-slice-createasyncthunk"),oW={[MC]:me};function J_(e,t){return`${e}/${t}`}function e0({creators:e}={}){let t=e?.asyncThunk?.[MC];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(zt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(r0()):n.reducers)||{},p=Object.keys(a),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(E,T){let P=typeof E=="string"?E:E.type;if(!P)throw new Error(zt(12));if(P in f.sliceCaseReducersByType)throw new Error(zt(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=a[E],P={reducerName:E,type:J_(o,E),createNotation:typeof n.reducers=="function"};o0(T)?a0(P,T,m,t):n0(P,T,m)});function g(){let[E={},T=[],P=void 0]=typeof n.extraReducers=="function"?DC(n.extraReducers):[n.extraReducers],q={...E,...f.sliceCaseReducersByType};return fe(n.initialState,G=>{for(let B in q)G.addCase(B,q[B]);for(let B of f.sliceMatchers)G.addMatcher(B.matcher,B.reducer);for(let B of T)G.addMatcher(B.matcher,B.reducer);P&&G.addDefaultCase(P)})}let v=E=>E,b=new Map,h=new WeakMap,y;function x(E,T){return y||(y=g()),y(E,T)}function w(){return y||(y=g()),y.getInitialState()}function I(E,T=!1){function P(G){let B=G[E];return typeof B>"u"&&T&&(B=hl(h,P,w)),B}function q(G=v){let B=hl(b,T,()=>new WeakMap);return hl(B,G,()=>{let j={};for(let[Q,L]of Object.entries(n.selectors??{}))j[Q]=t0(L,G,()=>hl(h,G,w),T);return j})}return{reducerPath:E,getSelectors:q,get selectors(){return q(P)},selectSlice:P}}let F={name:o,reducer:x,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:w,...I(i),injectInto(E,{reducerPath:T,...P}={}){let q=T??i;return E.inject({reducerPath:q,reducer:x},P),{...F,...I(q,!0)}}};return F}}function t0(e,t,r,n){function o(i,...a){let p=t(i);return typeof p>"u"&&n&&(p=r()),e(p,...a)}return o.unwrapped=e,o}var $o=e0();function r0(){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 n0({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!i0(n))throw new Error(zt(17));i=n.reducer,a=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?k(e,a):k(e))}function o0(e){return e._reducerDefinitionType==="asyncThunk"}function i0(e){return e._reducerDefinitionType==="reducerWithPrepare"}function a0({type:e,reducerName:t},r,n,o){if(!o)throw new Error(zt(18));let{payloadCreator:i,fulfilled:a,pending:p,rejected:f,settled:m,options:g}=r,v=o(e,i,g);n.exposeAction(t,v),a&&n.addCase(v.fulfilled,a),p&&n.addCase(v.pending,p),f&&n.addCase(v.rejected,f),m&&n.addMatcher(v.settled,m),n.exposeCaseReducer(t,{fulfilled:a||yl,pending:p||yl,rejected:f||yl,settled:m||yl})}function yl(){}var s0="task",VC="listener",jC="completed",Uh="cancelled",c0=`task-${Uh}`,u0=`task-${jC}`,jh=`${VC}-${Uh}`,l0=`${VC}-${jC}`,xl=class{constructor(e){de(this,"code");de(this,"name","TaskAbortError");de(this,"message");this.code=e,this.message=`${s0} ${Uh} (reason: ${e})`}},Qh=(e,t)=>{if(typeof e!="function")throw new TypeError(zt(32))},Sl=()=>{},LC=(e,t=Sl)=>(e.catch(t),e),UC=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Bo=e=>{if(e.aborted)throw new xl(e.reason)};function QC(e,t){let r=Sl;return new Promise((n,o)=>{let i=()=>o(new xl(e.reason));if(e.aborted){i();return}r=UC(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=Sl})}var d0=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof xl?"cancelled":"rejected",error:r}}finally{t?.()}});return function d0(_x7,_x8){return _ref5.apply(this,arguments)}}(),vl=e=>t=>LC(QC(e,t).then(r=>(Bo(e),r))),BC=e=>{let t=vl(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:na}=Object,PC={},wl="listenerMiddleware",p0=(e,t)=>{let r=n=>UC(e,()=>n.abort(e.reason));return(n,o)=>{Qh(n,"taskExecutor");let i=new s.AbortController;r(i);let a=d0(/*#__PURE__*/_asyncToGenerator(function*(){Bo(e),Bo(i.signal);let p=yield n({pause:vl(i.signal),delay:BC(i.signal),signal:i.signal});return Bo(i.signal),p}),()=>i.abort(u0));return o?.autoJoin&&t.push(a.catch(Sl)),{result:vl(e)(a),cancel(){i.abort(c0)}}}},f0=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){Bo(t);let i=()=>{},p=[new Promise((f,m)=>{let g=e({predicate:n,effect:(v,b)=>{b.unsubscribe(),f([v,b.getState(),b.getOriginalState()])}});i=()=>{g(),m()}})];o!=null&&p.push(new Promise(f=>setTimeout(f,o,null)));try{let f=yield QC(t,Promise.race(p));return Bo(t),f}finally{i()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>LC(r(n,o))},GC=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=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(zt(21));return Qh(i,"options.listener"),{predicate:o,type:t,effect:i}},$C=na(e=>{let{type:t,predicate:r,effect:n}=GC(e);return{id:Fc(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(zt(22))}}},{withTypes:()=>$C}),kC=(e,t)=>{let{type:r,effect:n,predicate:o}=GC(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},Lh=e=>{e.pending.forEach(t=>{t.abort(jh)})},m0=(e,t)=>()=>{for(let r of t.keys())Lh(r);e.clear()},OC=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},HC=na(k(`${wl}/add`),{withTypes:()=>HC}),g0=k(`${wl}/removeAll`),zC=na(k(`${wl}/remove`),{withTypes:()=>zC}),h0=(...e)=>{console.error(`${wl}/error`,...e)},WC=(e={})=>{let t=new Map,r=new Map,n=h=>{let y=r.get(h)??0;r.set(h,y+1)},o=h=>{let y=r.get(h)??1;y===1?r.delete(h):r.set(h,y-1)},{extra:i,onError:a=h0}=e;Qh(a,"onError");let p=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&Lh(h)}),f=h=>{let y=kC(t,h)??$C(h);return p(y)};na(f,{withTypes:()=>f});let m=h=>{let y=kC(t,h);return y&&(y.unsubscribe(),h.cancelActive&&Lh(y)),!!y};na(m,{withTypes:()=>m});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,x,w){let I=new s.AbortController,F=f0(f,I.signal),E=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(y,na({},x,{getOriginalState:w,condition:(T,P)=>F(T,P).then(Boolean),take:F,delay:BC(I.signal),pause:vl(I.signal),extra:i,signal:I.signal,fork:p0(I.signal,E),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((T,P,q)=>{T!==I&&(T.abort(jh),q.delete(T))})},cancel:()=>{I.abort(jh),h.pending.delete(I)},throwIfCancelled:()=>{Bo(I.signal)}})))}catch(T){T instanceof xl||OC(a,T,{raisedBy:"effect"})}finally{yield Promise.all(E),I.abort(l0),o(h),h.pending.delete(I)}});return function g(_x1,_x10,_x11,_x12){return _ref8.apply(this,arguments)}}(),v=m0(t,r);return{middleware:h=>y=>x=>{if(!dc(x))return y(x);if(HC.match(x))return f(x.payload);if(g0.match(x)){v();return}if(zC.match(x))return m(x.payload);let w=h.getState(),I=()=>{if(w===PC)throw new Error(zt(23));return w},F;try{if(F=y(x),t.size>0){let E=h.getState(),T=Array.from(t.values());for(let P of T){let q=!1;try{q=P.predicate(x,E,w)}catch(G){q=!1,OC(a,G,{raisedBy:"predicate"})}q&&g(P,x,h,I)}}}finally{w=PC}return F},startListening:f,stopListening:m,clearListeners:v}};function zt(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 YC(){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 KC=/^(?:[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 y0(e){return typeof e=="string"&&KC.test(e)}var Bh=y0;d();c();l();u();var Pt=[];for(let e=0;e<256;++e)Pt.push((e+256).toString(16).slice(1));function XC(e,t=0){return(Pt[e[t+0]]+Pt[e[t+1]]+Pt[e[t+2]]+Pt[e[t+3]]+"-"+Pt[e[t+4]]+Pt[e[t+5]]+"-"+Pt[e[t+6]]+Pt[e[t+7]]+"-"+Pt[e[t+8]]+Pt[e[t+9]]+"-"+Pt[e[t+10]]+Pt[e[t+11]]+Pt[e[t+12]]+Pt[e[t+13]]+Pt[e[t+14]]+Pt[e[t+15]]).toLowerCase()}d();c();l();u();var S0=new Uint8Array(16);function Gh(){return crypto.getRandomValues(S0)}d();c();l();u();function v0(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():A0(e,t,r)}function A0(e,t,r){e=e||{};let n=e.random??e.rng?.()??Gh();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 XC(n)}var $h=v0;function C0(_x13){return _C2.apply(this,arguments)}function _C2(){_C2=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:i,mode:a}=e;if(a!=="disabled")return n.call(r),t.send(o,i,r)});return _C2.apply(this,arguments)}var nb="2.1.3",Hh=128,ob=192,ZC=224,JC=240,b0=248;function x0(e){return(e&b0)===JC?4:(e&JC)===ZC?3:(e&ZC)===ob?2:1}function w0(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&Hh)!=Hh)break;if(r-=3,(n&ob)!=Hh){t-r>=x0(n)*3&&(r=t);break}}return e.substring(0,r)}function R0(e){let{trackingId:t}=e;return{trackingId:t}}function I0(e){return(e.source||[]).concat([`relay@${nb}`])}function ib(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,a=R0(t),p=r.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:I0(t),clientId:p,userAgent:i(),referrer:eb(n()),location:eb(o())})}function eb(e){return e!==null?w0(e,1024):null}function E0(e,t,r,n){return{...t,meta:ib(e,r,n)}}var F0="*";function T0(){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 i(f){if(f===F0)e.length=0;else for(let m=e.length-1;m>=0;m--)e[m].type===f&&e.splice(m,1)}function a(f){let m=t(f);m>=0&&e.splice(m,1)}function p(f,m){m?a({type:f,callback:m}):i(f)}return{add:n,call:o,remove:p}}function tb({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 P0(e){let t=tb(e);return{get:()=>t,update:r=>{t=tb({...t,...r})}}}var zh=k0();function k0(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,o=document.cookie.split(";");for(let i of o){let a=i.replace(/^\s+/,"");if(a.lastIndexOf(n,0)===0)return a.substring(n.length,a.length)}return null},setItem(r,n,o){let i=t(window.location.hostname),a=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,p=i?`;domain=${i}`:"";document.cookie=`${e}${r}=${n}${a}${p};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function O0(){return{getItem(e){return zh.getItem(e)||localStorage.getItem(e)},removeItem(e){zh.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),zh.setItem(e,t,31556952e3)}}}var rb="visitorId";function _0(){let e=document.referrer;return e===""?null:e}function Wh(){let e=O0();return{runtime:"browser",send:function(){var _ref9=_asyncToGenerator(function*(t,r,n){let o=A(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});YC().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let a=yield o;if(a?.ok){let p;try{p=yield a.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 ${a.status}: Failed to send the event(s).`)});return function send(_x14,_x15,_x16){return _ref9.apply(this,arguments)}}(),getReferrer:()=>_0(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(rb);if(t&&Bh(t))return t;let r=$h();return e.setItem(rb,r),r}}}function N0(){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 D0(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function q0(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=D0();return t&&r?{...r,runtime:"custom"}:t&&M0()&&N0()?Wh():n}function M0(){try{return typeof window=="object"}catch{return!1}}function V0(e){return{get:()=>Object.freeze(q0(e))}}function ab(e){let t=P0(e),r=T0(),n=V0(t);return{emit:function(){var _ref0=_asyncToGenerator(function*(o,i){let a=t.get(),p=n.get(),f=E0(o,i,a,p);return C0({config:a,environment:p,event:f,listenerManager:r})});return function emit(_x17,_x18){return _ref0.apply(this,arguments)}}(),getMeta:o=>ib(o,t.get(),n.get()),on:(o,i)=>r.add({type:o,callback:i}),off:(o,i)=>r.remove(o,i),updateConfig:o=>t.update(o),version:nb}}d();c();l();u();function sb(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var Wn="3.55.4",cb=["@coveo/atomic","@coveo/quantic"];var aa=ct(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Wn}`));var Tc=ct(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>aa(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},a,p)=>{let f=L0(p);return ab({mode:i?"emit":"disabled",url:o??$u(e,t),token:r,trackingId:n??null,source:a,environment:f})}),j0={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref1=_asyncToGenerator(function*(){});return function send(){return _ref1.apply(this,arguments)}}()},L0=e=>{if(!e)return;let t=e();return{...(sb()?Wh():j0),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};d();c();l();u();d();c();l();u();function Br(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 U(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function p(g){try{m(n.next(g))}catch(v){a(v)}}function f(g){try{m(n.throw(g))}catch(v){a(v)}}function m(g){g.done?i(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}var Me;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(Me||(Me={}));function Xh(){return typeof window<"u"}function dy(){return typeof navigator<"u"}function sa(){return typeof document<"u"}function Zh(){try{return typeof localStorage<"u"}catch{return!1}}function U0(){try{return typeof sessionStorage<"u"}catch{return!1}}function Ab(){return dy()&&navigator.cookieEnabled}var Q0=[Me.click,Me.custom,Me.search,Me.view],B0=(e,t)=>Q0.indexOf(e)!==-1?Object.assign({language:sa()?document.documentElement.lang:"unknown",userAgent:dy()?navigator.userAgent:"unknown"},t):t,kc=class e{static set(t,r,n){var o,i,a,p;n&&(i=new Date,i.setTime(i.getTime()+n)),p=window.location.hostname,p.indexOf(".")===-1?ub(t,r,i):(a=p.split("."),o=a[a.length-2]+"."+a[a.length-1],ub(t,r,i,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function ub(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function G0(){return Zh()?localStorage:Ab()?new Oc:U0()?sessionStorage:new ua}var Oc=class e{getItem(t){return kc.get(`${e.prefix}${t}`)}removeItem(t){kc.erase(`${e.prefix}${t}`)}setItem(t,r,n){kc.set(`${e.prefix}${t}`,r,n)}};Oc.prefix="coveo_";var Jh=class{constructor(){this.cookieStorage=new Oc}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)}},ua=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Rl="__coveo.analytics.history",$0=20,H0=1e3*60,z0=75,El=class{constructor(t){this.store=t||G0()}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 U(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 U(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(Rl);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return U(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(Rl);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Rl,JSON.stringify(t.slice(0,$0)))}catch{}}clear(){try{this.store.removeItem(Rl)}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,z0)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>H0:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var W0=(e,t)=>U(void 0,void 0,void 0,function*(){return e===Me.view?(yield Y0(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),Y0=e=>U(void 0,void 0,void 0,function*(){let t=new El,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),K0=/^(?:[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 Fl(e){return typeof e=="string"&&K0.test(e)}function lb(e){if(!Fl(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 kt=[];for(let e=0;e<256;++e)kt.push((e+256).toString(16).slice(1));function Cb(e,t=0){return(kt[e[t+0]]+kt[e[t+1]]+kt[e[t+2]]+kt[e[t+3]]+"-"+kt[e[t+4]]+kt[e[t+5]]+"-"+kt[e[t+6]]+kt[e[t+7]]+"-"+kt[e[t+8]]+kt[e[t+9]]+"-"+kt[e[t+10]]+kt[e[t+11]]+kt[e[t+12]]+kt[e[t+13]]+kt[e[t+14]]+kt[e[t+15]]).toLowerCase()}var X0=new Uint8Array(16);function Z0(){return crypto.getRandomValues(X0)}function J0(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 eN="6ba7b810-9dad-11d1-80b4-00c04fd430c8",tN="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function rN(e,t,r,n,o,i){let a=typeof r=="string"?J0(r):r,p=typeof n=="string"?lb(n):n;if(typeof n=="string"&&(n=lb(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let f=new Uint8Array(16+a.length);return f.set(p),f.set(a,p.length),f=t(f),f[6]=f[6]&15|e,f[8]=f[8]&63|128,Cb(f)}function Ho(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():nN(e,t,r)}function nN(e,t,r){e=e||{};let n=e.random??e.rng?.()??Z0();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 Cb(n)}function oN(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 Yh(e,t){return e<<t|e>>>32-t}function iN(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,i=Math.ceil(o/16),a=new Array(i);for(let p=0;p<i;++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];a[p]=f}a[i-1][14]=(e.length-1)*8/2**32,a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=(e.length-1)*8&4294967295;for(let p=0;p<i;++p){let f=new Uint32Array(80);for(let y=0;y<16;++y)f[y]=a[p][y];for(let y=16;y<80;++y)f[y]=Yh(f[y-3]^f[y-8]^f[y-14]^f[y-16],1);let m=r[0],g=r[1],v=r[2],b=r[3],h=r[4];for(let y=0;y<80;++y){let x=Math.floor(y/20),w=Yh(m,5)+oN(x,g,v,b)+h+t[x]+f[y]>>>0;h=b,b=v,v=Yh(g,30)>>>0,g=m,m=w}r[0]=r[0]+m>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+v>>>0,r[3]=r[3]+b>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function Tl(e,t,r,n){return rN(80,iN,e,t)}Tl.DNS=eN;Tl.URL=tN;var bb="2.33.0",db=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Pc={pageview:"pageview",event:"event"},Pl=class{constructor({client:t,uuidGenerator:r=Ho}){this.client=t,this.uuidGenerator=r}},ey=class extends Pl{constructor({client:t,uuidGenerator:r=Ho}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=db(window.location),this.lastReferrer=sa()?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:sa()?document.title:"",encoding:sa()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},i={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},i),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:i}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=i,t===Pc.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===Pc.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Pc.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Pc.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 db(window.location)}},Yn=class e{constructor(t,r){if(!Fl(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(r/1e3)}toString(){return this.clientId.replace(/-/g,"")+"."+this.creationDate.toString()}get expired(){let t=Math.floor(Date.now()/1e3)-this.creationDate;return t<0||t>e.expirationTime}validate(t,r){return!this.expired&&this.matchReferrer(t,r)}matchReferrer(t,r){try{let n=new URL(t);return r.some(o=>new RegExp(o.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(n.host))}catch{return!1}}static fromString(t){let r=t.split(".");if(r.length!==2)return null;let[n,o]=r;if(n.length!==32||isNaN(parseInt(o)))return null;let i=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return Fl(i)?new e(i,Number.parseInt(o)*1e3):null}};Yn.cvo_cid="cvo_cid";Yn.expirationTime=120;var ty=class extends Pl{constructor({client:t,uuidGenerator:r=Ho}){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 U(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(Yn.cvo_cid,new Yn(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};ty.Id="link";var yr=Object.keys;function Il(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Kh=128,xb=192,pb=224,fb=240;function aN(e){return(e&248)===fb?4:(e&fb)===pb?3:(e&pb)===xb?2:1}function sN(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&Kh)!=Kh)break;if(r-=3,(n&xb)!=Kh){t-r>=aN(n)*3&&(r=t);break}}return e.substring(0,r)}var ry={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"},cN=yr(ry).map(e=>ry[e]),uN=[...cN].join("|"),lN=new RegExp(`^(${uN}$)`),dN={svcAction:"svc_action",svcActionData:"svc_action_data"},pN=e=>yr(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=ry[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),fN=e=>lN.test(e),mN=[fN],mb={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},gb={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},jt={action:"pa",list:"pal",listSource:"pls"},kl={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},gN=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],ny={id:"quoteId",affiliation:"quoteAffiliation"},oy={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},hN={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),kl),purchase:Object.assign(Object.assign({},jt),kl),quickview:jt,quote:Object.assign(Object.assign({},jt),ny),review:Object.assign(Object.assign({},jt),oy)},yN=yr(mb).map(e=>mb[e]),SN=yr(gb).map(e=>gb[e]),vN=yr(jt).map(e=>jt[e]),AN=yr(kl).map(e=>kl[e]),CN=yr(oy).map(e=>oy[e]),bN=yr(ny).map(e=>ny[e]),xN=[...yN,"custom"].join("|"),wN=[...SN,"custom"].join("|"),wb="(pr[0-9]+)",Rb="(il[0-9]+pi[0-9]+)",RN=new RegExp(`^${wb}(${xN})$`),IN=new RegExp(`^(${Rb}(${wN}))|(il[0-9]+nm)$`),EN=new RegExp(`^(${vN.join("|")})$`),FN=new RegExp(`^(${AN.join("|")})$`),TN=new RegExp(`^${wb}custom$`),PN=new RegExp(`^${Rb}custom$`),kN=new RegExp(`^(${[...gN,...CN,...bN].join("|")})$`),ON=e=>RN.test(e),_N=e=>IN.test(e),NN=e=>EN.test(e),DN=e=>FN.test(e),qN=e=>kN.test(e),MN=[_N,ON,NN,DN,qN],VN=[TN,PN],jN={anonymizeIp:"aip"},LN={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},UN={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},QN=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],BN=Object.assign(Object.assign(Object.assign(Object.assign({},jN),LN),UN),QN.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),iy=Object.assign(Object.assign({},BN),dN),GN=e=>{let t=!!e.action&&hN[e.action]||{};return yr(e).reduce((r,n)=>{let o=t[n]||iy[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},$N=yr(iy).map(e=>iy[e]),HN=e=>$N.indexOf(e)!==-1,zN=e=>e==="custom",WN=e=>[...MN,...mN,HN,zN].some(t=>t(e)),YN=e=>yr(e).reduce((t,r)=>{let n=KN(r);return n?Object.assign(Object.assign({},t),XN(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),KN=e=>{let t;return[...VN].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},XN=(e,t)=>yr(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),ay=class{constructor(t){this.opts=t}sendEvent(t,r){return U(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:o}=this.opts,i=yield this.getQueryParamsForEventType(t),{url:a,payload:p}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),f=this.encodeForEventType(t,p),m=new Blob([f],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(a,m)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return U(this,void 0,void 0,function*(){let o=t,i=r;if(n){let a=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:p,body:f}=a;o=p||t;try{i=JSON.parse(f)}catch(m){console.error("Unable to process the request body as a JSON string",m)}}return{payload:i,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return U(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(i=>!!i).join("&")})}isEventTypeLegacy(t){return[Me.click,Me.custom,Me.search,Me.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}},sy=class{sendEvent(t,r){return U(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){return Promise.resolve()})}},hb=S.fetch,Ol=class{constructor(t){this.opts=t}sendEvent(t,r){return U(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:i}=this.opts,a=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",p={url:`${n}/analytics/${t}${a}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},f=Object.assign(Object.assign({},p),i?yield i(p,"analyticsFetch"):{}),{url:m}=f,g=Br(f,["url"]),v;try{v=yield hb(m,g)}catch(b){console.error("An error has occurred when sending the event.",b);return}if(v.ok){let b=yield v.json();return b.visitorId&&o.setCurrentVisitorId(b.visitorId),b}else{try{v.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,v,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield hb(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[Me.click,Me.custom,Me.search,Me.view].indexOf(t)!==-1}getVisitorIdParam(){return U(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"})}},cy=class{constructor(t,r){Zh()&&Ab()?this.storage=new Jh:Zh()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new ua),this.client=new Ol(t),this.beaconClient=new ay(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:i}of n)this.beaconClient.sendEvent(o,i)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},uy=class{constructor(t,r){this.storage=r||new ua,this.client=new Ol(t)}getClientDependingOnEventType(t){return this.client}},_l=class{constructor(){this.storage=new ua,this.client=new sy}getClientDependingOnEventType(t){return this.client}},ZN="xx",JN=e=>e?.startsWith(ZN)||!1,eD=`
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":z
33
33
  `)}var tu=function(e){IL(t,e);function t(r,n,o,i,a){var p=this.constructor,f=e.call(this,PR(r,{name:n,index:o,operation:i,tree:a}))||this;return f.name=n,f.index=o,f.operation=i,f.tree=a,Object.setPrototypeOf(f,p.prototype),f.message=PR(r,{name:n,index:o,operation:i,tree:a}),f}return t}(Error);var dt=tu,FL=Mt,Ja={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=Rp(r,this.path);n&&(n=Mt(n));var o=Ri(r,{op:"remove",path:this.from}).removed;return Ri(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Rp(r,this.from);return Ri(r,{op:"add",path:this.path,value:Mt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:ru(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},TL={add:function(e,t,r){return wp(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:Ja.move,copy:Ja.copy,test:Ja.test,_get:Ja._get};function Rp(e,t){if(t=="")return e;var r={op:"_get",path:t};return Ri(e,r),r.value}function Ri(e,t,r,n,o,i){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),i===void 0&&(i=0),r&&(typeof r=="function"?r(t,0,e,t.path):Ip(t,0)),t.path===""){var a={newDocument:e};if(t.op==="add")return a.newDocument=t.value,a;if(t.op==="replace")return a.newDocument=t.value,a.removed=e,a;if(t.op==="move"||t.op==="copy")return a.newDocument=Rp(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=ru(e,t.value),a.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a.newDocument=e,a}else{if(t.op==="remove")return a.removed=e,a.newDocument=null,a;if(t.op==="_get")return t.value=e,a;if(r)throw new dt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{n||(e=Mt(e));var p=t.path||"",f=p.split("/"),m=e,g=1,v=f.length,b=void 0,h=void 0,y=void 0;for(typeof r=="function"?y=r:y=Ip;;){if(h=f[g],h&&h.indexOf("~")!=-1&&(h=eu(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&f[g-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&b===void 0&&(m[h]===void 0?b=f.slice(0,g).join("/"):g==v-1&&(b=t.path),b!==void 0&&y(t,0,e,b)),g++,Array.isArray(m)){if(h==="-")h=m.length;else{if(r&&!wp(h))throw new dt("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,t,e);wp(h)&&(h=~~h)}if(g>=v){if(r&&t.op==="add"&&h>m.length)throw new dt("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);var a=TL[t.op].call(t,m,h,e);if(a.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(g>=v){var a=Ja[t.op].call(t,m,h,e);if(a.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(m=m[h],r&&g<v&&(!m||typeof m!="object"))throw new dt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function Ep(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new dt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=Mt(e));for(var i=new Array(t.length),a=0,p=t.length;a<p;a++)i[a]=Ri(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function PL(e,t,r){var n=Ri(e,t);if(n.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Ip(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new dt("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Ja[e.op]){if(typeof e.path!="string")throw new dt("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new dt("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 dt("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 dt("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")&&Cp(e.value))throw new dt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var o=e.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new dt("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 dt("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 a={op:"_get",path:e.from,value:void 0},p=kR([a],r);if(p&&p.name==="OPERATION_PATH_UNRESOLVABLE")throw new dt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new dt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function kR(e,t,r){try{if(!Array.isArray(e))throw new dt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Ep(Mt(t),Mt(e),r||!0);else{r=r||Ip;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof dt)return o;throw o}}function ru(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),o,i,a;if(r&&n){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!ru(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var p=Object.keys(e);if(i=p.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(p[o]))return!1;for(o=i;o--!==0;)if(a=p[o],!ru(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var OS={};Xs(OS,{compare:()=>VL,generate:()=>TS,observe:()=>ML,unobserve:()=>qL});d();c();l();u();var PS=new WeakMap,kL=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),OL=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function _L(e){return PS.get(e)}function NL(e,t){return e.observers.get(t)}function DL(e,t){e.observers.delete(t.callback)}function qL(e,t){t.unobserve()}function ML(e,t){var r=[],n,o=_L(e);if(!o)o=new kL(e),PS.set(e,o);else{var i=NL(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=Mt(e),t){n.callback=t,n.next=null;var a=function(){TS(n)},p=function(){clearTimeout(n.next),n.next=setTimeout(a)};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(){TS(n),clearTimeout(n.next),DL(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 OL(t,n)),n}function TS(e,t){t===void 0&&(t=!1);var r=PS.get(e.object);kS(r.value,e.object,e.patches,"",t),e.patches.length&&Ep(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function kS(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=xp(t),a=xp(e),p=!1,f=!1,m=a.length-1;m>=0;m--){var g=a[m],v=e[g];if(bp(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var b=t[g];typeof v=="object"&&v!=null&&typeof b=="object"&&b!=null&&Array.isArray(v)===Array.isArray(b)?kS(v,b,r,n+"/"+on(g),o):v!==b&&(p=!0,o&&r.push({op:"test",path:n+"/"+on(g),value:Mt(v)}),r.push({op:"replace",path:n+"/"+on(g),value:Mt(b)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+on(g),value:Mt(v)}),r.push({op:"remove",path:n+"/"+on(g)}),f=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),p=!0)}if(!(!f&&i.length==a.length))for(var m=0;m<i.length;m++){var g=i[m];!bp(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+on(g),value:Mt(t[g])})}}}function VL(e,t,r){r===void 0&&(r=!1);var n=[];return kS(e,t,n,"",r),n}var Fp=Object.assign({},FS,OS,{JsonPatchError:tu,deepClone:Mt,escapePathComponent:on,unescapePathComponent:eu});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var _S=function(e,t){return _S=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])},_S(e,t)};function an(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");_S(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function OR(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function p(g){try{m(n.next(g))}catch(v){a(v)}}function f(g){try{m(n.throw(g))}catch(v){a(v)}}function m(g){g.done?i(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}function Tp(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=p(0),a.throw=p(1),a.return=p(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function p(m){return function(g){return f([m,g])}}function f(m){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,m[0]&&(r=0)),r;)try{if(n=1,o&&(i=m[0]&2?o.return:m[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,m[1])).done)return i;switch(o=0,i&&(m=[m[0]&2,i.value]),m[0]){case 0:case 1:i=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(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(m[0]===6||m[0]===2)){r=0;continue}if(m[0]===3&&(!i||m[1]>i[0]&&m[1]<i[3])){r.label=m[1];break}if(m[0]===6&&r.label<i[1]){r.label=i[1],i=m;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(m);break}i[2]&&r.ops.pop(),r.trys.pop();continue}m=t.call(e,r)}catch(g){m=[6,g],o=0}finally{n=i=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}}function Vn(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 es(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-->0)&&!(o=n.next()).done;)i.push(o.value)}catch(p){a={error:p}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function ts(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function Ii(e){return this instanceof Ii?(this.v=e,this):new Ii(e)}function _R(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),p("next"),p("throw"),p("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(h){return function(y){return Promise.resolve(y).then(h,v)}}function p(h,y){n[h]&&(o[h]=function(x){return new Promise(function(w,I){i.push([h,x,w,I])>1||f(h,x)})},y&&(o[h]=y(o[h])))}function f(h,y){try{m(n[h](y))}catch(x){b(i[0][3],x)}}function m(h){h.value instanceof Ii?Promise.resolve(h.value.v).then(g,v):b(i[0][2],h)}function g(h){f("next",h)}function v(h){f("throw",h)}function b(h,y){h(y),i.shift(),i.length&&f(i[0][0],i[0][1])}}function NR(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 Vn=="function"?Vn(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(p,f){a=e[i](a),o(p,f,a.done,a.value)})}}function o(i,a,p,f){Promise.resolve(f).then(function(m){i({value:m,done:p})},a)}}d();c();l();u();function Ve(e){return typeof e=="function"}d();c();l();u();d();c();l();u();d();c();l();u();function rs(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 Pp=rs(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 nu(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var ns=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var p=Vn(a),f=p.next();!f.done;f=p.next()){var m=f.value;m.remove(this)}}catch(x){t={error:x}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}else a.remove(this);var g=this.initialTeardown;if(Ve(g))try{g()}catch(x){i=x instanceof Pp?x.errors:[x]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var b=Vn(v),h=b.next();!h.done;h=b.next()){var y=h.value;try{DR(y)}catch(x){i=i??[],x instanceof Pp?i=ts(ts([],es(i)),es(x.errors)):i.push(x)}}}catch(x){n={error:x}}finally{try{h&&!h.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}}if(i)throw new Pp(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)DR(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)&&nu(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&nu(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var NS=ns.EMPTY;function kp(e){return e instanceof ns||e&&"closed"in e&&Ve(e.remove)&&Ve(e.add)&&Ve(e.unsubscribe)}function DR(e){Ve(e)?e():e.unsubscribe()}d();c();l();u();var Nr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};d();c();l();u();d();c();l();u();var os={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=os.delegate;return o?.setTimeout?o.setTimeout.apply(o,ts([e,t],es(r))):setTimeout.apply(void 0,ts([e,t],es(r)))},clearTimeout:function(e){var t=os.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Op(e){os.setTimeout(function(){var t=Nr.onUnhandledError;if(t)t(e);else throw e})}d();c();l();u();function ou(){}d();c();l();u();var qR=function(){return DS("C",void 0,void 0)}();function MR(e){return DS("E",void 0,e)}function VR(e){return DS("N",e,void 0)}function DS(e,t,r){return{kind:e,value:t,error:r}}d();c();l();u();var Ei=null;function is(e){if(Nr.useDeprecatedSynchronousErrorHandling){var t=!Ei;if(t&&(Ei={errorThrown:!1,error:null}),e(),t){var r=Ei,n=r.errorThrown,o=r.error;if(Ei=null,n)throw o}}else e()}function jR(e){Nr.useDeprecatedSynchronousErrorHandling&&Ei&&(Ei.errorThrown=!0,Ei.error=e)}var iu=function(e){an(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,kp(r)&&r.add(n)):n.destination=QL,n}return t.create=function(r,n,o){return new Np(r,n,o)},t.prototype.next=function(r){this.isStopped?MS(VR(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?MS(MR(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?MS(qR,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}(ns);var jL=Function.prototype.bind;function qS(e,t){return jL.call(e,t)}var LL=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){_p(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){_p(n)}else _p(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){_p(r)}},e}(),Np=function(e){an(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(Ve(r)||!r)a={next:r??void 0,error:n??void 0,complete:o??void 0};else{var p;i&&Nr.useDeprecatedNextContext?(p=Object.create(r),p.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&qS(r.next,p),error:r.error&&qS(r.error,p),complete:r.complete&&qS(r.complete,p)}):a=r}return i.destination=new LL(a),i}return t}(iu);function _p(e){Nr.useDeprecatedSynchronousErrorHandling?jR(e):Op(e)}function UL(e){throw e}function MS(e,t){var r=Nr.onStoppedNotification;r&&os.setTimeout(function(){return r(e,t)})}var QL={closed:!0,next:ou,error:UL,complete:ou};d();c();l();u();var as=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();d();c();l();u();d();c();l();u();function ss(e){return e}function Dp(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return VS(e)}function VS(e){return e.length===0?ss:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var at=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var o=this,i=GL(t)?t:new Np(t,r,n);return is(function(){var a=o,p=a.operator,f=a.source;i.add(p?p.call(i,f):f?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=LR(r),new r(function(o,i){var a=new Np({next:function(p){try{t(p)}catch(f){i(f),a.unsubscribe()}},error:i,complete:o});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[as]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return VS(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=LR(t),new t(function(n,o){var i;r.subscribe(function(a){return i=a},function(a){return o(a)},function(){return n(i)})})},e.create=function(t){return new e(t)},e}();function LR(e){var t;return(t=e??Nr.Promise)!==null&&t!==void 0?t:Promise}function BL(e){return e&&Ve(e.next)&&Ve(e.error)&&Ve(e.complete)}function GL(e){return e&&e instanceof iu||BL(e)&&kp(e)}d();c();l();u();function $L(e){return Ve(e?.lift)}function yt(e){return function(t){if($L(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 Rt(e,t,r,n,o){return new HL(e,t,r,n,o)}var HL=function(e){an(t,e);function t(r,n,o,i,a,p){var f=e.call(this,r)||this;return f.onFinalize=a,f.shouldUnsubscribe=p,f._next=n?function(m){try{n(m)}catch(g){r.error(g)}}:e.prototype._next,f._error=i?function(m){try{i(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}(iu);d();c();l();u();d();c();l();u();var UR=rs(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var sn=function(e){an(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 QR(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new UR},t.prototype.next=function(r){var n=this;is(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=Vn(n.currentObservers),p=a.next();!p.done;p=a.next()){var f=p.value;f.next(r)}}catch(m){o={error:m}}finally{try{p&&!p.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;is(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;is(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,a=o.isStopped,p=o.observers;return i||a?NS:(this.currentObservers=null,p.push(r),new ns(function(){n.currentObservers=null,nu(p,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,a=n.isStopped;o?r.error(i):a&&r.complete()},t.prototype.asObservable=function(){var r=new at;return r.source=this,r},t.create=function(r,n){return new QR(r,n)},t}(at);var QR=function(e){an(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:NS},t}(sn);d();c();l();u();d();c();l();u();var jS={now:function(){return(jS.delegate||Date).now()},delegate:void 0};var qp=function(e){an(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=jS);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,a=n._infiniteTimeWindow,p=n._timestampProvider,f=n._windowTime;o||(i.push(r),!a&&i.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,i=o._infiniteTimeWindow,a=o._buffer,p=a.slice(),f=0;f<p.length&&!r.closed;f+=i?1:2)r.next(p[f]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,i=r._buffer,a=r._infiniteTimeWindow,p=(a?1:2)*n;if(n<1/0&&p<i.length&&i.splice(0,i.length-p),!a){for(var f=o.now(),m=0,g=1;g<i.length&&i[g]<=f;g+=2)m=g;m&&i.splice(0,m+1)}},t}(sn);d();c();l();u();var Mp=new at(function(e){return e.complete()});d();c();l();u();d();c();l();u();d();c();l();u();function BR(e){return e&&Ve(e.schedule)}function zL(e){return e[e.length-1]}function GR(e){return BR(zL(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 Vp=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};d();c();l();u();function jp(e){return Ve(e?.then)}d();c();l();u();function Lp(e){return Ve(e[as])}d();c();l();u();function Up(e){return Symbol.asyncIterator&&Ve(e?.[Symbol.asyncIterator])}d();c();l();u();function Qp(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 WL(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Bp=WL();function Gp(e){return Ve(e?.[Bp])}d();c();l();u();function $p(e){return _R(this,arguments,function(){var r,n,o,i;return Tp(this,function(a){switch(a.label){case 0:r=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Ii(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,Ii(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Ii(o)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function Hp(e){return Ve(e?.getReader)}function It(e){if(e instanceof at)return e;if(e!=null){if(Lp(e))return YL(e);if(Vp(e))return KL(e);if(jp(e))return XL(e);if(Up(e))return $R(e);if(Gp(e))return ZL(e);if(Hp(e))return JL(e)}throw Qp(e)}function YL(e){return new at(function(t){var r=e[as]();if(Ve(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function KL(e){return new at(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function XL(e){return new at(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Op)})}function ZL(e){return new at(function(t){var r,n;try{for(var o=Vn(e),i=o.next();!i.done;i=o.next()){var a=i.value;if(t.next(a),t.closed)return}}catch(p){r={error:p}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function $R(e){return new at(function(t){eU(e,t).catch(function(r){return t.error(r)})})}function JL(e){return $R($p(e))}function eU(e,t){var r,n,o,i;return OR(this,void 0,void 0,function(){var a,p;return Tp(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),r=NR(e),f.label=1;case 1:return[4,r.next()];case 2:if(n=f.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),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&&(i=r.return)?[4,i.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 xr(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!o)return i}function zp(e,t){return t===void 0&&(t=0),yt(function(r,n){r.subscribe(Rt(n,function(o){return xr(n,e,function(){return n.next(o)},t)},function(){return xr(n,e,function(){return n.complete()},t)},function(o){return xr(n,e,function(){return n.error(o)},t)}))})}d();c();l();u();function Wp(e,t){return t===void 0&&(t=0),yt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function HR(e,t){return It(e).pipe(Wp(t),zp(t))}d();c();l();u();function zR(e,t){return It(e).pipe(Wp(t),zp(t))}d();c();l();u();function WR(e,t){return new at(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 YR(e,t){return new at(function(r){var n;return xr(r,t,function(){n=e[Bp](),xr(r,t,function(){var o,i,a;try{o=n.next(),i=o.value,a=o.done}catch(p){r.error(p);return}a?r.complete():r.next(i)},0,!0)}),function(){return Ve(n?.return)&&n.return()}})}d();c();l();u();function Yp(e,t){if(!e)throw new Error("Iterable cannot be null");return new at(function(r){xr(r,t,function(){var n=e[Symbol.asyncIterator]();xr(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}d();c();l();u();function KR(e,t){return Yp($p(e),t)}function XR(e,t){if(e!=null){if(Lp(e))return HR(e,t);if(Vp(e))return WR(e,t);if(jp(e))return zR(e,t);if(Up(e))return Yp(e,t);if(Gp(e))return YR(e,t);if(Hp(e))return KR(e,t)}throw Qp(e)}function Fi(e,t){return t?XR(e,t):It(e)}function lt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=GR(e);return Fi(e,r)}d();c();l();u();function st(e,t){var r=Ve(e)?e:function(){return e},n=function(o){return o.error(r())};return new at(t?function(o){return t.schedule(n,0,o)}:n)}d();c();l();u();d();c();l();u();var ZR=rs(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Kp(e,t){var r=typeof t=="object";return new Promise(function(n,o){var i=!1,a;e.subscribe({next:function(p){a=p,i=!0},error:o,complete:function(){i?n(a):r?n(t.defaultValue):o(new ZR)}})})}d();c();l();u();function Ti(e,t){return yt(function(r,n){var o=0;r.subscribe(Rt(n,function(i){n.next(e.call(t,i,o++))}))})}d();c();l();u();d();c();l();u();d();c();l();u();function JR(e,t,r,n,o,i,a,p){var f=[],m=0,g=0,v=!1,b=function(){v&&!f.length&&!m&&t.complete()},h=function(x){return m<n?y(x):f.push(x)},y=function(x){i&&t.next(x),m++;var w=!1;It(r(x,g++)).subscribe(Rt(t,function(I){o?.(I),i?h(I):t.next(I)},function(){w=!0},void 0,function(){if(w)try{m--;for(var I=function(){var F=f.shift();a?xr(t,a,function(){return y(F)}):y(F)};f.length&&m<n;)I();b()}catch(F){t.error(F)}}))};return e.subscribe(Rt(t,h,function(){v=!0,b()})),function(){p?.()}}function rr(e,t,r){return r===void 0&&(r=1/0),Ve(t)?rr(function(n,o){return Ti(function(i,a){return t(n,i,o,a)})(It(e(n,o)))},r):(typeof t=="number"&&(r=t),yt(function(n,o){return JR(n,o,e,r)}))}function LS(e){return e===void 0&&(e=1/0),rr(ss,e)}d();c();l();u();function Xp(e){return new at(function(t){It(e()).subscribe(t)})}d();c();l();u();function au(e){return yt(function(t,r){var n=null,o=!1,i;n=t.subscribe(Rt(r,void 0,void 0,function(a){i=It(e(a,au(e)(t))),n?(n.unsubscribe(),n=null,i.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(r))})}d();c();l();u();function Zp(e,t){return Ve(t)?rr(e,t,1):rr(e,1)}d();c();l();u();function US(e){return yt(function(t,r){var n=!1;t.subscribe(Rt(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}d();c();l();u();function Pi(e){return yt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}d();c();l();u();function QS(e,t){return yt(function(r,n){var o=null,i=0,a=!1,p=function(){return a&&!o&&n.complete()};r.subscribe(Rt(n,function(f){o?.unsubscribe();var m=0,g=i++;It(e(f,g)).subscribe(o=Rt(n,function(v){return n.next(t?t(f,v,g,m++):v)},function(){o=null,p()}))},function(){a=!0,p()}))})}d();c();l();u();function Jp(e){return yt(function(t,r){It(e).subscribe(Rt(r,function(){return r.complete()},ou)),!r.closed&&t.subscribe(r)})}d();c();l();u();function BS(e,t,r){var n=Ve(e)||t||r?{next:e,error:t,complete:r}:e;return n?yt(function(o,i){var a;(a=n.subscribe)===null||a===void 0||a.call(n);var p=!0;o.subscribe(Rt(i,function(f){var m;(m=n.next)===null||m===void 0||m.call(n,f),i.next(f)},function(){var f;p=!1,(f=n.complete)===null||f===void 0||f.call(n),i.complete()},function(f){var m;p=!1,(m=n.error)===null||m===void 0||m.call(n,f),i.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)}))}):ss}d();c();l();u();d();c();l();u();function eI(e){return` \r
36
- `.indexOf(e)>=0}function ef(e){for(var t=["topLevel"],r=0,n,o,i,a=function(F){return t.push(F)},p=function(F){return t[t.length-1]=F},f=function(F){n==null&&(n=r,o=t.length,i=F)},m=function(F){F===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},b=function(F){if("0"<=F&&F<="9"){a("number");return}switch(F){case"\"":a("string");return;case"-":a("numberNeedsDigit");return;case"t":a("true");return;case"f":a("false");return;case"n":a("null");return;case"[":a("arrayNeedsValue");return;case"{":a("objectNeedsKey");return}},h=e.length;r<h;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":b(y);break;case"string":switch(y){case"\"":g();break;case"\\":f("stringEscape"),a("stringEscaped");break}break;case"stringEscaped":y==="u"?a("stringUnicode"):(m("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(m("stringEscape"),g());break;case"number":y==="."?p("numberNeedsDigit"):y==="e"||y==="E"?p("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),g());break;case"numberNeedsDigit":p("number");break;case"numberNeedsExponent":p(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),g());break;case"arrayNeedsValue":y==="]"?g():eI(y)||(m("collectionItem"),p("arrayNeedsComma"),b(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(f("collectionItem"),p("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(f("collectionItem"),p("objectNeedsColon"),a("string"));break;case"objectNeedsColon":y===":"&&p("objectNeedsValue");break;case"objectNeedsValue":eI(y)||(m("collectionItem"),p("objectNeedsComma"),b(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(f("collectionItem"),p("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var x=[n!=null?e.slice(0,n):e],w=function(F){return x.push(F.slice(e.length-e.lastIndexOf(F[0])))},I=t.length-1;I>=0;I--)switch(t[I]){case"string":x.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":x.push("0");break;case"true":w("true");break;case"false":w("false");break;case"null":w("null");break;case"arrayNeedsValue":case"arrayNeedsComma":x.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":x.push("}");break}return x.join("")}d();c();l();u();d();c();l();u();d();c();l();u();function rI(){let e=this.buf,t=this.pos,r=0,n=0;for(let i=0;i<28;i+=7){let a=e[t++];if(r|=(a&127)<<i,(a&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}let o=e[t++];if(r|=(o&15)<<28,n=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}for(let i=3;i<=31;i+=7){let a=e[t++];if(n|=(a&127)<<i,(a&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}throw new Error("invalid varint")}var tf=4294967296;function GS(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(a,p){let f=Number(e.slice(a,p));o*=r,n=n*r+f,n>=tf&&(o=o+(n/tf|0),n=n%tf)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?oI(n,o):HS(n,o)}function nI(e,t){let r=HS(e,t),n=r.hi&2147483648;n&&(r=oI(r.lo,r.hi));let o=$S(r.lo,r.hi);return n?"-"+o:o}function $S(e,t){if({lo:e,hi:t}=tU(e,t),t<=2097151)return String(tf*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,i=r+n*6777216+o*6710656,a=n+o*8147497,p=o*2,f=1e7;return i>=f&&(a+=Math.floor(i/f),i%=f),a>=f&&(p+=Math.floor(a/f),a%=f),p.toString()+tI(a)+tI(i)}function tU(e,t){return{lo:e>>>0,hi:t>>>0}}function HS(e,t){return{lo:e|0,hi:t|0}}function oI(e,t){return t=~t,e?e=~e+1:t+=1,HS(e,t)}var tI=e=>{let t=String(e);return"0000000".slice(t.length)+t};function iI(){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 Dr=rU();function rU(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!S.Deno||!!S.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){let p=typeof a=="bigint"?a:BigInt(a);if(p>n||p<r)throw new Error(`invalid int64: ${a}`);return p},uParse(a){let p=typeof a=="bigint"?a:BigInt(a);if(p>i||p<o)throw new Error(`invalid uint64: ${a}`);return p},enc(a){return e.setBigInt64(0,this.parse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(a){return e.setBigInt64(0,this.uParse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(a,p){return e.setInt32(0,a,!0),e.setInt32(4,p,!0),e.getBigInt64(0,!0)},uDec(a,p){return e.setInt32(0,a,!0),e.setInt32(4,p,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),aI(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),sI(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),aI(r),GS(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),sI(r),GS(r)},dec(r,n){return nI(r,n)},uDec(r,n){return $S(r,n)}}}function aI(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function sI(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}d();c();l();u();var zS=Symbol.for("@bufbuild/protobuf/text-encoding");function nU(e){var t;S[zS]=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:YS(e.encodeUtf8.bind(e))})}function WS(){let e=S;if(!e[zS]){let t=new e.TextEncoder,r=new e.TextDecoder,n,o={encodeUtf8(a){return t.encode(a)},decodeUtf8(a,p){return p?(n||(n=new e.TextDecoder("utf-8",{fatal:!0})),n.decode(a)):r.decode(a)},checkUtf8(a){try{return encodeURIComponent(a),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let i=String.prototype.isWellFormed;i&&(o.checkUtf8=a=>i.call(a)),nU(o)}return e[zS]}function YS(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var yo;(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"})(yo||(yo={}));var oU=34028234663852886e22,iU=-34028234663852886e22,aU=4294967295,sU=2147483647,cU=-2147483648,Oe=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?YS(t):WS().encodeUtf8Into,this.buffer=uI,this.viewCache=lU,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||uU;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(su),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-su,n=KS(r);return n>su&&(this.ensureCapacity(n-su),this.buffer.copyWithin(t+n,t+su,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(cI(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(XS(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<=lI){this.ensureCapacity(r+1);let f=this.buffer,m=this.pos;f[m++]=r;let g=0;for(;g<r;g++){let v=t.charCodeAt(g);if(v>127)break;f[m++]=v}if(g==r)return this.pos=m,this}this.ensureCapacity(r*3+5);let n=KS(r),o=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(t,o.subarray(i+n)),p=KS(a);return p!=n&&o.copyWithin(i+p,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(t){return dU(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 cI(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return XS(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return XS(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=Dr.enc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}fixed64(t){let r=Dr.uEnc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}int64(t){let r=Dr.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=Dr.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return this.writeVarint64(o,i)}uint64(t){let r=Dr.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let 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 i=t>>>28&15|(r&7)<<4,a=r>>3!=0;if(n[o++]=(a?i|128:i)&255,!a)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}},uU=128,su=1,uI=new Uint8Array(0),lU=new DataView(uI.buffer),lI=32;function KS(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var ie=class{constructor(t,r=WS().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=rI,this.uint32=iI,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.pos,r=this.uint32(),n=this.pos-t;if(n>5||n==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=r>>>3,i=r&7;if(o<=0||i>5)throw new Error("illegal tag: field no "+o+" wire type "+i);return[o,i]}skip(t,r,n=100){let o=this.pos;switch(t){case yo.Varint:for(;this.buf[this.pos++]&128;);break;case yo.Bit64:this.pos+=4;case yo.Bit32:this.pos+=4;break;case yo.LengthDelimited:let i=this.uint32();this.pos+=i;break;case yo.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[a,p]=this.tag();if(p===yo.EndGroup){if(r!==void 0&&a!==r)throw new Error("invalid end group tag");break}this.skip(p,a,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return this.varint64(),Dr.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Dr.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,r=this.varint64Hi,n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Dr.dec(t,r)}bool(){let t=this.buf[this.pos];return t<128?(this.pos++,t!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Dr.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Dr.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){let r=this.bytes(),n=r.length;if(n<=lI){let o=new Array(n);for(let i=0;i<n;i++){let a=r[i];if(a>127)return this.decodeUtf8(r,t);o[i]=a}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(r,t)}};function XS(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>sU||e<cU)throw new Error("invalid int32: "+e)}function cI(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>aU||e<0)throw new Error("invalid uint32: "+e)}function dU(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>oU||e<iU))throw new Error("invalid float32: "+e)}var pU=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function ZS(){return{fields:{}}}var cu={encode(e,t=new Oe){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&tv.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=ZS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=tv.decode(r,r.uint32());a.value!==void 0&&(o.fields[a.key]=a.value);continue}}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return cu.fromPartial(e??{})},fromPartial(e){let t=ZS();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=ZS();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 dI(){return{key:"",value:void 0}}var tv={encode(e,t=new Oe){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&Se.encode(Se.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=dI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=r.string();continue;case 2:if(i!==18)break;o.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return tv.fromPartial(e??{})},fromPartial(e){let t=dI();return t.key=e.key??"",t.value=e.value??void 0,t}};function JS(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var Se={encode(e,t=new Oe){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&&cu.encode(cu.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&uu.encode(uu.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=JS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.nullValue=r.int32();continue;case 2:if(i!==17)break;o.numberValue=r.double();continue;case 3:if(i!==26)break;o.stringValue=r.string();continue;case 4:if(i!==32)break;o.boolValue=r.bool();continue;case 5:if(i!==42)break;o.structValue=cu.unwrap(cu.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=uu.unwrap(uu.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Se.fromPartial(e??{})},fromPartial(e){let t=JS();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=JS();if(e===null)t.nullValue=pU.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(S.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new S.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function ev(){return{values:[]}}var uu={encode(e,t=new Oe){for(let r of e.values)Se.encode(Se.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=ev();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(Se.unwrap(Se.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return uu.fromPartial(e??{})},fromPartial(e){let t=ev();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=ev();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&S.Array.isArray(e.values)?e.values:e}},fU=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 pI(){return{op:0,path:"",from:void 0,value:void 0}}var nf={encode(e,t=new Oe){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&&Se.encode(Se.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=pI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.op=r.int32();continue;case 2:if(i!==18)break;o.path=r.string();continue;case 3:if(i!==26)break;o.from=r.string();continue;case 4:if(i!==34)break;o.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return nf.fromPartial(e??{})},fromPartial(e){let t=pI();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function fI(){return{id:"",type:"",function:void 0}}var of={encode(e,t=new Oe){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&af.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=fI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.type=r.string();continue;case 3:if(i!==26)break;o.function=af.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return of.fromPartial(e??{})},fromPartial(e){let t=fI();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?af.fromPartial(e.function):void 0,t}};function mI(){return{name:"",arguments:""}}var af={encode(e,t=new Oe){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=mI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.name=r.string();continue;case 2:if(i!==18)break;o.arguments=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return af.fromPartial(e??{})},fromPartial(e){let t=mI();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function gI(){return{value:"",mimeType:""}}var sf={encode(e,t=new Oe){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=gI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return sf.fromPartial(e??{})},fromPartial(e){let t=gI();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function hI(){return{value:"",mimeType:void 0}}var cf={encode(e,t=new Oe){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=hI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return cf.fromPartial(e??{})},fromPartial(e){let t=hI();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function yI(){return{data:void 0,url:void 0}}var dr={encode(e,t=new Oe){return e.data!==void 0&&sf.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&cf.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=yI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=sf.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=cf.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return dr.fromPartial(e??{})},fromPartial(e){let t=yI();return t.data=e.data!==void 0&&e.data!==null?sf.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?cf.fromPartial(e.url):void 0,t}};function SI(){return{text:""}}var uf={encode(e,t=new Oe){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=SI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return uf.fromPartial(e??{})},fromPartial(e){let t=SI();return t.text=e.text??"",t}};function vI(){return{source:void 0,metadata:void 0}}var lf={encode(e,t=new Oe){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.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=vI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return lf.fromPartial(e??{})},fromPartial(e){let t=vI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function AI(){return{source:void 0,metadata:void 0}}var df={encode(e,t=new Oe){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=AI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return df.fromPartial(e??{})},fromPartial(e){let t=AI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function CI(){return{source:void 0,metadata:void 0}}var pf={encode(e,t=new Oe){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.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=CI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return pf.fromPartial(e??{})},fromPartial(e){let t=CI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function bI(){return{source:void 0,metadata:void 0}}var ff={encode(e,t=new Oe){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.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=bI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ff.fromPartial(e??{})},fromPartial(e){let t=bI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function xI(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var mf={encode(e,t=new Oe){return e.text!==void 0&&uf.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&lf.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&df.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&pf.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&ff.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=xI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=uf.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=lf.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=df.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=pf.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=ff.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return mf.fromPartial(e??{})},fromPartial(e){let t=xI();return t.text=e.text!==void 0&&e.text!==null?uf.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?lf.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?df.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?pf.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?ff.fromPartial(e.document):void 0,t}};function wI(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var gf={encode(e,t=new Oe){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)of.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)mf.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=wI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.role=r.string();continue;case 3:if(i!==26)break;o.content=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue;case 5:if(i!==42)break;o.toolCalls.push(of.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.toolCallId=r.string();continue;case 7:if(i!==58)break;o.error=r.string();continue;case 8:if(i!==66)break;o.contentParts.push(mf.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return gf.fromPartial(e??{})},fromPartial(e){let t=wI();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=>of.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>mf.fromPartial(r))||[],t}};function RI(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0}}var hf={encode(e,t=new Oe){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&&Se.encode(Se.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&Se.encode(Se.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=RI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.reason=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.toolCallId=r.string();continue;case 5:if(i!==42)break;o.responseSchema=Se.unwrap(Se.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.expiresAt=r.string();continue;case 7:if(i!==58)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return hf.fromPartial(e??{})},fromPartial(e){let t=RI();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}},mU=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 II(){return{type:0,timestamp:void 0,rawEvent:void 0}}var Ae={encode(e,t=new Oe){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&Se.encode(Se.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=II();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.type=r.int32();continue;case 2:if(i!==16)break;o.timestamp=cs(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ae.fromPartial(e??{})},fromPartial(e){let t=II();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function EI(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var yf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=EI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return yf.fromPartial(e??{})},fromPartial(e){let t=EI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function FI(){return{baseEvent:void 0,messageId:"",delta:""}}var Sf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=FI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Sf.fromPartial(e??{})},fromPartial(e){let t=FI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function TI(){return{baseEvent:void 0,messageId:""}}var vf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=TI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vf.fromPartial(e??{})},fromPartial(e){let t=TI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function PI(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var Af={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=PI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Af.fromPartial(e??{})},fromPartial(e){let t=PI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function kI(){return{baseEvent:void 0,toolCallId:"",delta:""}}var Cf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=kI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Cf.fromPartial(e??{})},fromPartial(e){let t=kI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function OI(){return{baseEvent:void 0,toolCallId:""}}var bf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=OI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return bf.fromPartial(e??{})},fromPartial(e){let t=OI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function _I(){return{baseEvent:void 0,snapshot:void 0}}var xf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&Se.encode(Se.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=_I();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xf.fromPartial(e??{})},fromPartial(e){let t=_I();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function NI(){return{baseEvent:void 0,delta:[]}}var wf={encode(e,t=new Oe){e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)nf.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=NI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(nf.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return wf.fromPartial(e??{})},fromPartial(e){let t=NI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>nf.fromPartial(r))||[],t}};function DI(){return{baseEvent:void 0,messages:[]}}var Rf={encode(e,t=new Oe){e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)gf.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=DI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(gf.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Rf.fromPartial(e??{})},fromPartial(e){let t=DI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>gf.fromPartial(r))||[],t}};function qI(){return{baseEvent:void 0,event:void 0,source:void 0}}var If={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&Se.encode(Se.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=qI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=Se.unwrap(Se.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.source=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return If.fromPartial(e??{})},fromPartial(e){let t=qI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function MI(){return{baseEvent:void 0,name:"",value:void 0}}var Ef={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&Se.encode(Se.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=MI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ef.fromPartial(e??{})},fromPartial(e){let t=MI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function VI(){return{baseEvent:void 0,threadId:"",runId:""}}var Ff={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=VI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ff.fromPartial(e??{})},fromPartial(e){let t=VI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function jI(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var ki={encode(e,t=new Oe){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=jI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.provider=r.string();continue;case 2:if(i!==18)break;o.model=r.string();continue;case 3:if(i!==24)break;o.inputTokens=cs(r.int64());continue;case 4:if(i!==32)break;o.outputTokens=cs(r.int64());continue;case 5:if(i!==40)break;o.totalTokens=cs(r.int64());continue;case 6:if(i!==48)break;o.reasoningTokens=cs(r.int64());continue;case 7:if(i!==56)break;o.cachedInputTokens=cs(r.int64());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ki.fromPartial(e??{})},fromPartial(e){let t=jI();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 LI(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var Tf={encode(e,t=new Oe){e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&Se.encode(Se.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)hf.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)ki.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=LI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue;case 4:if(i!==34)break;o.result=Se.unwrap(Se.decode(r,r.uint32()));continue;case 5:if(i!==42)break;o.outcome=r.string();continue;case 6:if(i!==50)break;o.interrupts.push(hf.decode(r,r.uint32()));continue;case 7:if(i!==58)break;o.usage.push(ki.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Tf.fromPartial(e??{})},fromPartial(e){let t=LI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interrupts=e.interrupts?.map(r=>hf.fromPartial(r))||[],t.usage=e.usage?.map(r=>ki.fromPartial(r))||[],t}};function UI(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var Pf={encode(e,t=new Oe){e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message);for(let r of e.usage)ki.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=UI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.code=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.usage.push(ki.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Pf.fromPartial(e??{})},fromPartial(e){let t=UI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>ki.fromPartial(r))||[],t}};function QI(){return{baseEvent:void 0,stepName:""}}var kf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=QI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return kf.fromPartial(e??{})},fromPartial(e){let t=QI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function BI(){return{baseEvent:void 0,stepName:""}}var Of={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=BI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Of.fromPartial(e??{})},fromPartial(e){let t=BI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function GI(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var _f={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=GI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.delta=r.string();continue;case 5:if(i!==42)break;o.name=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return _f.fromPartial(e??{})},fromPartial(e){let t=GI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t}};function $I(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var Nf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=$I();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue;case 5:if(i!==42)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Nf.fromPartial(e??{})},fromPartial(e){let t=$I();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function HI(){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 zI={encode(e,t=new Oe){return e.textMessageStart!==void 0&&yf.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Sf.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&vf.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Af.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Cf.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&bf.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&xf.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&wf.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Rf.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&If.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Ef.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Ff.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Tf.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Pf.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&kf.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Of.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&_f.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Nf.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=HI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=yf.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=Sf.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=vf.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=Af.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=Cf.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=bf.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=xf.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=wf.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=Rf.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=If.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Ef.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Ff.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Tf.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=Pf.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=kf.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=Of.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=_f.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Nf.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return zI.fromPartial(e??{})},fromPartial(e){let t=HI();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?yf.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Sf.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?vf.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Af.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Cf.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?bf.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?xf.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?wf.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Rf.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?If.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Ef.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Ff.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Tf.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Pf.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?kf.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Of.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?_f.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Nf.fromPartial(e.toolCallChunk):void 0,t}};function cs(e){let t=S.Number(e.toString());if(t>S.Number.MAX_SAFE_INTEGER)throw new S.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<S.Number.MIN_SAFE_INTEGER)throw new S.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var WI=e=>e&&typeof e=="object"?e:void 0;var rf=e=>{let t=WI(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}}}},gU=e=>{let t=WI(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:rf(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:rf(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:rf(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:rf(r.source),metadata:r.metadata}}}};function YI(e){let t=zI.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=mU[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,delete r.baseEvent,r.type===V.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;if(o.role==="user"&&Array.isArray(o.contentParts)){let i=o.contentParts.map(a=>gU(a)).filter(a=>a!==void 0);i.length>0&&(o.content=i)}Array.isArray(o.contentParts)&&o.contentParts.length===0&&(o.contentParts=void 0),o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===V.RUN_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,i=Array.isArray(n.interrupts)?n.interrupts:[];delete n.interrupts,o==="interrupt"?n.outcome={type:"interrupt",interrupts:i}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if((r.type===V.RUN_FINISHED||r.type===V.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===V.STATE_DELTA)for(let n of r.delta)n.op=fU[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]}),Ap.parse(r)}var rv="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var yU=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,nv=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(yU);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},KI=e=>e==="*"||e==="x"||e==="X",XI=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},SU=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],vU=(e,t)=>{if(KI(e)||KI(t))return 0;let[r,n]=SU(XI(e),XI(t));return r>n?1:r<n?-1:0},ov=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=vU(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var lu=(e,t)=>{let r=nv(e),n=nv(t),o=r.pop(),i=n.pop(),a=ov(r,n);return a!==0?a:o&&i?ov(o.split("."),i.split(".")):o||i?o?-1:1:0};var Qe=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function du(){return po()}function sv(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&sv(t);return e}var ZI=512*1024;function JI(e,t,r){let n=0,o=[e,t],i=new WeakSet;for(;o.length>0;){let a=o.pop();if(typeof a=="string"){if(n+=a.length,n>r)return!0}else if(typeof a=="object"&&a){if(i.has(a))continue;if(i.add(a),Array.isArray(a))for(let p=0;p<a.length;p++)o.push(a[p]);else{let p=Object.keys(a);for(let f=0;f<p.length;f++){let m=p[f];if(n+=m.length,n>r)return!0;o.push(a[m])}}}}return!1}function Ye(_x197,_x198,_x199,_x200){return _Ye.apply(this,arguments)}function _Ye(){_Ye=_asyncToGenerator(function*(e,t,r,n){let o=typeof process<"u"&&process.env!==void 0,i=o&&!!process.env.VITEST_WORKER_ID,a=o&&!!process.env.VITEST_WORKER_ID,p=a&&!JI(t,r,ZI),f=p?Qe(t):t,m=p?Qe(r):r,g=!1,v=!1,b;for(let h of e)try{p&&(sv(f),sv(m));let y=yield n(h,f,m);if(y===void 0)continue;let x=!1;if(y.messages!==void 0&&y.messages!==f&&(f=Qe(y.messages),g=!0,x=!0),y.state!==void 0&&y.state!==m&&(m=Qe(y.state),v=!0,x=!0),p&&x&&JI(f,m,ZI)&&(p=!1),b=y.stopPropagation,b===!0)break}catch(y){if(a&&y instanceof TypeError){if(i)throw y;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",y)}else i||console.error("Subscriber error:",y);continue}return{...(g?{messages:Object.isFrozen(f)?Qe(f):f}:{}),...(v?{state:Object.isFrozen(m)?Qe(m):m}:{}),...(b===void 0?{}:{stopPropagation:b})}});return _Ye.apply(this,arguments)}function Df(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,r=e.lifecycle??!0,n=e.verbose??!1;return{enabled:t||r,events:t,lifecycle:r,verbose:n}}function pu(e){if(e instanceof cv)return e;if(e===!0)return new cv(Df(!0))}var cv=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 iv(e){return e.enabled?new cv(e):void 0}function AU(e,t,r){if(t){let o=e.find(a=>a.id===t);if(o?.role==="assistant")return o;o&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${o.role}' message, not assistant \u2014 falling back to toolCallId`);let i={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(i),i}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}var iE=(e,t,r,n,o)=>{let i=pu(o),a=Qe(r.messages),p=Qe(e.state),f={},m=v=>{v.messages!==void 0&&(a=v.messages,f.messages=v.messages),v.state!==void 0&&(p=v.state,f.state=v.state)},g=()=>{let v=Qe(f);return f={},v.messages!==void 0||v.state!==void 0?lt(v):Mp};return t.pipe(Zp(/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(v){let b=yield Ye(n,a,p,(h,y,x)=>h.onEvent?.({event:v,agent:r,input:e,messages:y,state:x}));if(m(b),b.stopPropagation===!0?i?.event("APPLY","Event dropped:",v,{type:v.type,reason:"stopPropagation by subscriber"}):i?.event("APPLY","Event applied:",v,{type:v.type,subscribers:n.length}),b.stopPropagation===!0)return g();switch(v.type){case V.TEXT_MESSAGE_START:{let h=yield Ye(n,a,p,(y,x,w)=>y.onTextMessageStartEvent?.({event:v,messages:x,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:y,role:x="assistant",name:w}=v;if(!a.find(I=>I.id===y)){let I={id:y,role:x,content:"",...(w!==void 0&&{name:w})};a.push(I),m({messages:a})}}return g()}case V.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,x=a.find(I=>I.id===h);if(!x)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield Ye(n,a,p,(I,F,E)=>I.onTextMessageContentEvent?.({event:v,messages:F,state:E,agent:r,input:e,textMessageBuffer:typeof x.content=="string"?x.content:""}));return m(w),w.stopPropagation!==!0&&(x.content=`${typeof x.content=="string"?x.content:""}${y}`,m({messages:a})),g()}case V.TEXT_MESSAGE_END:{let{messageId:h}=v,y=a.find(x=>x.id===h);return y?(m(yield Ye(n,a,p,(x,w,I)=>x.onTextMessageEndEvent?.({event:v,messages:w,state:I,agent:r,input:e,textMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(x=>{x.onNewMessage?.({message:y,messages:a,state:p,agent:r,input:e})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g())}case V.TOOL_CALL_START:{let h=yield Ye(n,a,p,(y,x,w)=>y.onToolCallStartEvent?.({event:v,messages:x,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:x,parentMessageId:w}=v,I=a.find(E=>E.toolCalls?.some(T=>T.id===y))?.toolCalls?.find(E=>E.id===y);if(I)return I.function.name!==x&&(console.warn(`TOOL_CALL_START: tool call '${y}' already exists with name '${I.function.name}' \u2014 updating it to '${x}'`),I.function.name=x,m({messages:a})),g();let F=AU(a,w,y);F.toolCalls??(F.toolCalls=[]),F.toolCalls.push({id:y,type:"function",function:{name:x,arguments:""}}),m({messages:a})}return g()}case V.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=v,x=a.find(F=>F.toolCalls?.some(E=>E.id===h));if(!x)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let w=x.toolCalls?.find(F=>F.id===h);if(!w)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=yield Ye(n,a,p,(F,E,T)=>{let P=w.function.arguments,q=w.function.name,G={};try{G=ef(P)}catch{}return F.onToolCallArgsEvent?.({event:v,messages:E,state:T,agent:r,input:e,toolCallBuffer:P,toolCallName:q,partialToolCallArgs:G})});return m(I),I.stopPropagation!==!0&&(w.function.arguments+=y,m({messages:a})),g()}case V.TOOL_CALL_END:{let{toolCallId:h}=v,y=a.find(w=>w.toolCalls?.some(I=>I.id===h));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let x=y.toolCalls?.find(w=>w.id===h);return x?(m(yield Ye(n,a,p,(w,I,F)=>{let E=x.function.arguments,T=x.function.name,P={};try{P=JSON.parse(E)}catch{}return w.onToolCallEndEvent?.({event:v,messages:I,state:F,agent:r,input:e,toolCallName:T,toolCallArgs:P})})),yield Promise.all(n.map(w=>{w.onNewToolCall?.({toolCall:x,messages:a,state:p,agent:r,input:e})})),g()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g())}case V.TOOL_CALL_RESULT:{let h=yield Ye(n,a,p,(y,x,w)=>y.onToolCallResultEvent?.({event:v,messages:x,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:x,content:w,role:I}=v,F={id:y,toolCallId:x,role:I||"tool",content:w},E=a.findIndex(T=>T.role==="assistant"&&T.toolCalls?.some(P=>P.id===x));if(E===-1)a.push(F);else{let T=E+1;for(;T<a.length&&a[T].role==="tool";)T++;a.splice(T,0,F)}yield Promise.all(n.map(T=>{T.onNewMessage?.({message:F,messages:a,state:p,agent:r,input:e})})),m({messages:a})}return g()}case V.STATE_SNAPSHOT:{let h=yield Ye(n,a,p,(y,x,w)=>y.onStateSnapshotEvent?.({event:v,messages:x,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{snapshot:y}=v;p=y,m({state:p})}return g()}case V.STATE_DELTA:{let h=yield Ye(n,a,p,(y,x,w)=>y.onStateDeltaEvent?.({event:v,messages:x,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{delta:y}=v;try{p=Fp.applyPatch(p,y,!0,!1).newDocument,m({state:p})}catch(x){let w=x instanceof Error?x.message:String(x);console.warn(`Failed to apply state patch:
36
+ `.indexOf(e)>=0}function ef(e){for(var t=["topLevel"],r=0,n,o,i,a=function(F){return t.push(F)},p=function(F){return t[t.length-1]=F},f=function(F){n==null&&(n=r,o=t.length,i=F)},m=function(F){F===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},b=function(F){if("0"<=F&&F<="9"){a("number");return}switch(F){case"\"":a("string");return;case"-":a("numberNeedsDigit");return;case"t":a("true");return;case"f":a("false");return;case"n":a("null");return;case"[":a("arrayNeedsValue");return;case"{":a("objectNeedsKey");return}},h=e.length;r<h;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":b(y);break;case"string":switch(y){case"\"":g();break;case"\\":f("stringEscape"),a("stringEscaped");break}break;case"stringEscaped":y==="u"?a("stringUnicode"):(m("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(m("stringEscape"),g());break;case"number":y==="."?p("numberNeedsDigit"):y==="e"||y==="E"?p("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),g());break;case"numberNeedsDigit":p("number");break;case"numberNeedsExponent":p(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),g());break;case"arrayNeedsValue":y==="]"?g():eI(y)||(m("collectionItem"),p("arrayNeedsComma"),b(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(f("collectionItem"),p("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(f("collectionItem"),p("objectNeedsColon"),a("string"));break;case"objectNeedsColon":y===":"&&p("objectNeedsValue");break;case"objectNeedsValue":eI(y)||(m("collectionItem"),p("objectNeedsComma"),b(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(f("collectionItem"),p("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var x=[n!=null?e.slice(0,n):e],w=function(F){return x.push(F.slice(e.length-e.lastIndexOf(F[0])))},I=t.length-1;I>=0;I--)switch(t[I]){case"string":x.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":x.push("0");break;case"true":w("true");break;case"false":w("false");break;case"null":w("null");break;case"arrayNeedsValue":case"arrayNeedsComma":x.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":x.push("}");break}return x.join("")}d();c();l();u();d();c();l();u();d();c();l();u();function rI(){let e=this.buf,t=this.pos,r=0,n=0;for(let i=0;i<28;i+=7){let a=e[t++];if(r|=(a&127)<<i,(a&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}let o=e[t++];if(r|=(o&15)<<28,n=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}for(let i=3;i<=31;i+=7){let a=e[t++];if(n|=(a&127)<<i,(a&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}throw new Error("invalid varint")}var tf=4294967296;function GS(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(a,p){let f=Number(e.slice(a,p));o*=r,n=n*r+f,n>=tf&&(o=o+(n/tf|0),n=n%tf)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?oI(n,o):HS(n,o)}function nI(e,t){let r=HS(e,t),n=r.hi&2147483648;n&&(r=oI(r.lo,r.hi));let o=$S(r.lo,r.hi);return n?"-"+o:o}function $S(e,t){if({lo:e,hi:t}=tU(e,t),t<=2097151)return String(tf*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,i=r+n*6777216+o*6710656,a=n+o*8147497,p=o*2,f=1e7;return i>=f&&(a+=Math.floor(i/f),i%=f),a>=f&&(p+=Math.floor(a/f),a%=f),p.toString()+tI(a)+tI(i)}function tU(e,t){return{lo:e>>>0,hi:t>>>0}}function HS(e,t){return{lo:e|0,hi:t|0}}function oI(e,t){return t=~t,e?e=~e+1:t+=1,HS(e,t)}var tI=e=>{let t=String(e);return"0000000".slice(t.length)+t};function iI(){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 Dr=rU();function rU(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!S.Deno||!!S.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){let p=typeof a=="bigint"?a:BigInt(a);if(p>n||p<r)throw new Error(`invalid int64: ${a}`);return p},uParse(a){let p=typeof a=="bigint"?a:BigInt(a);if(p>i||p<o)throw new Error(`invalid uint64: ${a}`);return p},enc(a){return e.setBigInt64(0,this.parse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(a){return e.setBigInt64(0,this.uParse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(a,p){return e.setInt32(0,a,!0),e.setInt32(4,p,!0),e.getBigInt64(0,!0)},uDec(a,p){return e.setInt32(0,a,!0),e.setInt32(4,p,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),aI(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),sI(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),aI(r),GS(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),sI(r),GS(r)},dec(r,n){return nI(r,n)},uDec(r,n){return $S(r,n)}}}function aI(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function sI(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}d();c();l();u();var zS;function nU(e){var t;zS=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:YS(e.encodeUtf8.bind(e))})}function WS(){if(!zS){let e=S;if(!e.TextEncoder||!e.TextDecoder)throw new Error("encoding API missing: install TextEncoder and TextDecoder on globalThis");let t=new e.TextEncoder,r=new e.TextDecoder,n,o={encodeUtf8(a){return t.encode(a)},decodeUtf8(a,p){return p?(n||(n=new e.TextDecoder("utf-8",{fatal:!0})),n.decode(a)):r.decode(a)},checkUtf8(a){try{return encodeURIComponent(a),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let i=String.prototype.isWellFormed;i&&(o.checkUtf8=a=>i.call(a)),nU(o)}return zS}function YS(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var yo;(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"})(yo||(yo={}));var oU=34028234663852886e22,iU=-34028234663852886e22,aU=4294967295,sU=2147483647,cU=-2147483648,Oe=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?YS(t):WS().encodeUtf8Into,this.buffer=uI,this.viewCache=lU,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||uU;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(su),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-su,n=KS(r);return n>su&&(this.ensureCapacity(n-su),this.buffer.copyWithin(t+n,t+su,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(cI(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(XS(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<=lI){this.ensureCapacity(r+1);let f=this.buffer,m=this.pos;f[m++]=r;let g=0;for(;g<r;g++){let v=t.charCodeAt(g);if(v>127)break;f[m++]=v}if(g==r)return this.pos=m,this}this.ensureCapacity(r*3+5);let n=KS(r),o=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(t,o.subarray(i+n)),p=KS(a);return p!=n&&o.copyWithin(i+p,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(t){return dU(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 cI(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return XS(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return XS(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=Dr.enc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}fixed64(t){let r=Dr.uEnc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}int64(t){let r=Dr.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=Dr.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return this.writeVarint64(o,i)}uint64(t){let r=Dr.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let 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 i=t>>>28&15|(r&7)<<4,a=r>>3!=0;if(n[o++]=(a?i|128:i)&255,!a)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}},uU=128,su=1,uI=new Uint8Array(0),lU=new DataView(uI.buffer),lI=32;function KS(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var ie=class{constructor(t,r=WS().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=rI,this.uint32=iI,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.pos,r=this.uint32(),n=this.pos-t;if(n>5||n==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=r>>>3,i=r&7;if(o<=0||i>5)throw new Error("illegal tag: field no "+o+" wire type "+i);return[o,i]}skip(t,r,n=100){let o=this.pos;switch(t){case yo.Varint:for(;this.buf[this.pos++]&128;);break;case yo.Bit64:this.pos+=4;case yo.Bit32:this.pos+=4;break;case yo.LengthDelimited:let i=this.uint32();this.pos+=i;break;case yo.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[a,p]=this.tag();if(p===yo.EndGroup){if(r!==void 0&&a!==r)throw new Error("invalid end group tag");break}this.skip(p,a,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return this.varint64(),Dr.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Dr.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,r=this.varint64Hi,n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Dr.dec(t,r)}bool(){let t=this.buf[this.pos];return t<128?(this.pos++,t!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Dr.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Dr.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){let r=this.bytes(),n=r.length;if(n<=lI){let o=new Array(n);for(let i=0;i<n;i++){let a=r[i];if(a>127)return this.decodeUtf8(r,t);o[i]=a}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(r,t)}};function XS(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>sU||e<cU)throw new Error("invalid int32: "+e)}function cI(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>aU||e<0)throw new Error("invalid uint32: "+e)}function dU(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>oU||e<iU))throw new Error("invalid float32: "+e)}var pU=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function ZS(){return{fields:{}}}var cu={encode(e,t=new Oe){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&tv.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=ZS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=tv.decode(r,r.uint32());a.value!==void 0&&(o.fields[a.key]=a.value);continue}}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return cu.fromPartial(e??{})},fromPartial(e){let t=ZS();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=ZS();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 dI(){return{key:"",value:void 0}}var tv={encode(e,t=new Oe){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&Se.encode(Se.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=dI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=r.string();continue;case 2:if(i!==18)break;o.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return tv.fromPartial(e??{})},fromPartial(e){let t=dI();return t.key=e.key??"",t.value=e.value??void 0,t}};function JS(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var Se={encode(e,t=new Oe){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&&cu.encode(cu.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&uu.encode(uu.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=JS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.nullValue=r.int32();continue;case 2:if(i!==17)break;o.numberValue=r.double();continue;case 3:if(i!==26)break;o.stringValue=r.string();continue;case 4:if(i!==32)break;o.boolValue=r.bool();continue;case 5:if(i!==42)break;o.structValue=cu.unwrap(cu.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=uu.unwrap(uu.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Se.fromPartial(e??{})},fromPartial(e){let t=JS();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=JS();if(e===null)t.nullValue=pU.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(S.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new S.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function ev(){return{values:[]}}var uu={encode(e,t=new Oe){for(let r of e.values)Se.encode(Se.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=ev();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(Se.unwrap(Se.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return uu.fromPartial(e??{})},fromPartial(e){let t=ev();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=ev();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&S.Array.isArray(e.values)?e.values:e}},fU=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 pI(){return{op:0,path:"",from:void 0,value:void 0}}var nf={encode(e,t=new Oe){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&&Se.encode(Se.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=pI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.op=r.int32();continue;case 2:if(i!==18)break;o.path=r.string();continue;case 3:if(i!==26)break;o.from=r.string();continue;case 4:if(i!==34)break;o.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return nf.fromPartial(e??{})},fromPartial(e){let t=pI();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function fI(){return{id:"",type:"",function:void 0}}var of={encode(e,t=new Oe){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&af.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=fI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.type=r.string();continue;case 3:if(i!==26)break;o.function=af.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return of.fromPartial(e??{})},fromPartial(e){let t=fI();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?af.fromPartial(e.function):void 0,t}};function mI(){return{name:"",arguments:""}}var af={encode(e,t=new Oe){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=mI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.name=r.string();continue;case 2:if(i!==18)break;o.arguments=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return af.fromPartial(e??{})},fromPartial(e){let t=mI();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function gI(){return{value:"",mimeType:""}}var sf={encode(e,t=new Oe){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=gI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return sf.fromPartial(e??{})},fromPartial(e){let t=gI();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function hI(){return{value:"",mimeType:void 0}}var cf={encode(e,t=new Oe){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=hI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return cf.fromPartial(e??{})},fromPartial(e){let t=hI();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function yI(){return{data:void 0,url:void 0}}var dr={encode(e,t=new Oe){return e.data!==void 0&&sf.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&cf.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=yI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=sf.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=cf.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return dr.fromPartial(e??{})},fromPartial(e){let t=yI();return t.data=e.data!==void 0&&e.data!==null?sf.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?cf.fromPartial(e.url):void 0,t}};function SI(){return{text:""}}var uf={encode(e,t=new Oe){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=SI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return uf.fromPartial(e??{})},fromPartial(e){let t=SI();return t.text=e.text??"",t}};function vI(){return{source:void 0,metadata:void 0}}var lf={encode(e,t=new Oe){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.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=vI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return lf.fromPartial(e??{})},fromPartial(e){let t=vI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function AI(){return{source:void 0,metadata:void 0}}var df={encode(e,t=new Oe){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=AI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return df.fromPartial(e??{})},fromPartial(e){let t=AI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function CI(){return{source:void 0,metadata:void 0}}var pf={encode(e,t=new Oe){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.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=CI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return pf.fromPartial(e??{})},fromPartial(e){let t=CI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function bI(){return{source:void 0,metadata:void 0}}var ff={encode(e,t=new Oe){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.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=bI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ff.fromPartial(e??{})},fromPartial(e){let t=bI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function xI(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var mf={encode(e,t=new Oe){return e.text!==void 0&&uf.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&lf.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&df.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&pf.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&ff.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=xI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=uf.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=lf.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=df.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=pf.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=ff.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return mf.fromPartial(e??{})},fromPartial(e){let t=xI();return t.text=e.text!==void 0&&e.text!==null?uf.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?lf.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?df.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?pf.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?ff.fromPartial(e.document):void 0,t}};function wI(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var gf={encode(e,t=new Oe){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)of.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)mf.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=wI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.role=r.string();continue;case 3:if(i!==26)break;o.content=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue;case 5:if(i!==42)break;o.toolCalls.push(of.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.toolCallId=r.string();continue;case 7:if(i!==58)break;o.error=r.string();continue;case 8:if(i!==66)break;o.contentParts.push(mf.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return gf.fromPartial(e??{})},fromPartial(e){let t=wI();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=>of.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>mf.fromPartial(r))||[],t}};function RI(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0}}var hf={encode(e,t=new Oe){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&&Se.encode(Se.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&Se.encode(Se.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=RI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.reason=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.toolCallId=r.string();continue;case 5:if(i!==42)break;o.responseSchema=Se.unwrap(Se.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.expiresAt=r.string();continue;case 7:if(i!==58)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return hf.fromPartial(e??{})},fromPartial(e){let t=RI();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}},mU=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 II(){return{type:0,timestamp:void 0,rawEvent:void 0}}var Ae={encode(e,t=new Oe){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&Se.encode(Se.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=II();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.type=r.int32();continue;case 2:if(i!==16)break;o.timestamp=cs(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ae.fromPartial(e??{})},fromPartial(e){let t=II();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function EI(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var yf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=EI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return yf.fromPartial(e??{})},fromPartial(e){let t=EI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function FI(){return{baseEvent:void 0,messageId:"",delta:""}}var Sf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=FI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Sf.fromPartial(e??{})},fromPartial(e){let t=FI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function TI(){return{baseEvent:void 0,messageId:""}}var vf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=TI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vf.fromPartial(e??{})},fromPartial(e){let t=TI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function PI(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var Af={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=PI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Af.fromPartial(e??{})},fromPartial(e){let t=PI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function kI(){return{baseEvent:void 0,toolCallId:"",delta:""}}var Cf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=kI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Cf.fromPartial(e??{})},fromPartial(e){let t=kI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function OI(){return{baseEvent:void 0,toolCallId:""}}var bf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=OI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return bf.fromPartial(e??{})},fromPartial(e){let t=OI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function _I(){return{baseEvent:void 0,snapshot:void 0}}var xf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&Se.encode(Se.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=_I();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xf.fromPartial(e??{})},fromPartial(e){let t=_I();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function NI(){return{baseEvent:void 0,delta:[]}}var wf={encode(e,t=new Oe){e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)nf.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=NI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(nf.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return wf.fromPartial(e??{})},fromPartial(e){let t=NI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>nf.fromPartial(r))||[],t}};function DI(){return{baseEvent:void 0,messages:[]}}var Rf={encode(e,t=new Oe){e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)gf.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=DI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(gf.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Rf.fromPartial(e??{})},fromPartial(e){let t=DI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>gf.fromPartial(r))||[],t}};function qI(){return{baseEvent:void 0,event:void 0,source:void 0}}var If={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&Se.encode(Se.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=qI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=Se.unwrap(Se.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.source=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return If.fromPartial(e??{})},fromPartial(e){let t=qI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function MI(){return{baseEvent:void 0,name:"",value:void 0}}var Ef={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&Se.encode(Se.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=MI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ef.fromPartial(e??{})},fromPartial(e){let t=MI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function VI(){return{baseEvent:void 0,threadId:"",runId:""}}var Ff={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=VI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ff.fromPartial(e??{})},fromPartial(e){let t=VI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function jI(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var ki={encode(e,t=new Oe){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=jI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.provider=r.string();continue;case 2:if(i!==18)break;o.model=r.string();continue;case 3:if(i!==24)break;o.inputTokens=cs(r.int64());continue;case 4:if(i!==32)break;o.outputTokens=cs(r.int64());continue;case 5:if(i!==40)break;o.totalTokens=cs(r.int64());continue;case 6:if(i!==48)break;o.reasoningTokens=cs(r.int64());continue;case 7:if(i!==56)break;o.cachedInputTokens=cs(r.int64());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ki.fromPartial(e??{})},fromPartial(e){let t=jI();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 LI(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var Tf={encode(e,t=new Oe){e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&Se.encode(Se.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)hf.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)ki.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=LI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue;case 4:if(i!==34)break;o.result=Se.unwrap(Se.decode(r,r.uint32()));continue;case 5:if(i!==42)break;o.outcome=r.string();continue;case 6:if(i!==50)break;o.interrupts.push(hf.decode(r,r.uint32()));continue;case 7:if(i!==58)break;o.usage.push(ki.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Tf.fromPartial(e??{})},fromPartial(e){let t=LI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interrupts=e.interrupts?.map(r=>hf.fromPartial(r))||[],t.usage=e.usage?.map(r=>ki.fromPartial(r))||[],t}};function UI(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var Pf={encode(e,t=new Oe){e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message);for(let r of e.usage)ki.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=UI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.code=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.usage.push(ki.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Pf.fromPartial(e??{})},fromPartial(e){let t=UI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>ki.fromPartial(r))||[],t}};function QI(){return{baseEvent:void 0,stepName:""}}var kf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=QI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return kf.fromPartial(e??{})},fromPartial(e){let t=QI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function BI(){return{baseEvent:void 0,stepName:""}}var Of={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=BI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Of.fromPartial(e??{})},fromPartial(e){let t=BI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function GI(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var _f={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=GI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.delta=r.string();continue;case 5:if(i!==42)break;o.name=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return _f.fromPartial(e??{})},fromPartial(e){let t=GI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t}};function $I(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var Nf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=$I();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue;case 5:if(i!==42)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Nf.fromPartial(e??{})},fromPartial(e){let t=$I();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function HI(){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 zI={encode(e,t=new Oe){return e.textMessageStart!==void 0&&yf.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Sf.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&vf.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Af.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Cf.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&bf.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&xf.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&wf.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Rf.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&If.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Ef.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Ff.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Tf.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Pf.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&kf.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Of.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&_f.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Nf.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=HI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=yf.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=Sf.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=vf.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=Af.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=Cf.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=bf.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=xf.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=wf.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=Rf.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=If.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Ef.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Ff.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Tf.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=Pf.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=kf.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=Of.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=_f.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Nf.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return zI.fromPartial(e??{})},fromPartial(e){let t=HI();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?yf.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Sf.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?vf.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Af.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Cf.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?bf.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?xf.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?wf.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Rf.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?If.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Ef.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Ff.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Tf.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Pf.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?kf.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Of.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?_f.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Nf.fromPartial(e.toolCallChunk):void 0,t}};function cs(e){let t=S.Number(e.toString());if(t>S.Number.MAX_SAFE_INTEGER)throw new S.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<S.Number.MIN_SAFE_INTEGER)throw new S.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var WI=e=>e&&typeof e=="object"?e:void 0;var rf=e=>{let t=WI(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}}}},gU=e=>{let t=WI(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:rf(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:rf(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:rf(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:rf(r.source),metadata:r.metadata}}}};function YI(e){let t=zI.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=mU[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,delete r.baseEvent,r.type===V.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;if(o.role==="user"&&Array.isArray(o.contentParts)){let i=o.contentParts.map(a=>gU(a)).filter(a=>a!==void 0);i.length>0&&(o.content=i)}Array.isArray(o.contentParts)&&o.contentParts.length===0&&(o.contentParts=void 0),o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===V.RUN_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,i=Array.isArray(n.interrupts)?n.interrupts:[];delete n.interrupts,o==="interrupt"?n.outcome={type:"interrupt",interrupts:i}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if((r.type===V.RUN_FINISHED||r.type===V.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===V.STATE_DELTA)for(let n of r.delta)n.op=fU[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]}),Ap.parse(r)}var rv="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var yU=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,nv=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(yU);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},KI=e=>e==="*"||e==="x"||e==="X",XI=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},SU=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],vU=(e,t)=>{if(KI(e)||KI(t))return 0;let[r,n]=SU(XI(e),XI(t));return r>n?1:r<n?-1:0},ov=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=vU(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var lu=(e,t)=>{let r=nv(e),n=nv(t),o=r.pop(),i=n.pop(),a=ov(r,n);return a!==0?a:o&&i?ov(o.split("."),i.split(".")):o||i?o?-1:1:0};var Qe=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function du(){return po()}function sv(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&sv(t);return e}var ZI=512*1024;function JI(e,t,r){let n=0,o=[e,t],i=new WeakSet;for(;o.length>0;){let a=o.pop();if(typeof a=="string"){if(n+=a.length,n>r)return!0}else if(typeof a=="object"&&a){if(i.has(a))continue;if(i.add(a),Array.isArray(a))for(let p=0;p<a.length;p++)o.push(a[p]);else{let p=Object.keys(a);for(let f=0;f<p.length;f++){let m=p[f];if(n+=m.length,n>r)return!0;o.push(a[m])}}}}return!1}function Ye(_x197,_x198,_x199,_x200){return _Ye.apply(this,arguments)}function _Ye(){_Ye=_asyncToGenerator(function*(e,t,r,n){let o=typeof process<"u"&&process.env!==void 0,i=o&&!!process.env.VITEST_WORKER_ID,a=o&&!!process.env.VITEST_WORKER_ID,p=a&&!JI(t,r,ZI),f=p?Qe(t):t,m=p?Qe(r):r,g=!1,v=!1,b;for(let h of e)try{p&&(sv(f),sv(m));let y=yield n(h,f,m);if(y===void 0)continue;let x=!1;if(y.messages!==void 0&&y.messages!==f&&(f=Qe(y.messages),g=!0,x=!0),y.state!==void 0&&y.state!==m&&(m=Qe(y.state),v=!0,x=!0),p&&x&&JI(f,m,ZI)&&(p=!1),b=y.stopPropagation,b===!0)break}catch(y){if(a&&y instanceof TypeError){if(i)throw y;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",y)}else i||console.error("Subscriber error:",y);continue}return{...(g?{messages:Object.isFrozen(f)?Qe(f):f}:{}),...(v?{state:Object.isFrozen(m)?Qe(m):m}:{}),...(b===void 0?{}:{stopPropagation:b})}});return _Ye.apply(this,arguments)}function Df(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,r=e.lifecycle??!0,n=e.verbose??!1;return{enabled:t||r,events:t,lifecycle:r,verbose:n}}function pu(e){if(e instanceof cv)return e;if(e===!0)return new cv(Df(!0))}var cv=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 iv(e){return e.enabled?new cv(e):void 0}function AU(e,t,r){if(t){let o=e.find(a=>a.id===t);if(o?.role==="assistant")return o;o&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${o.role}' message, not assistant \u2014 falling back to toolCallId`);let i={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(i),i}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}var iE=(e,t,r,n,o)=>{let i=pu(o),a=Qe(r.messages),p=Qe(e.state),f={},m=v=>{v.messages!==void 0&&(a=v.messages,f.messages=v.messages),v.state!==void 0&&(p=v.state,f.state=v.state)},g=()=>{let v=Qe(f);return f={},v.messages!==void 0||v.state!==void 0?lt(v):Mp};return t.pipe(Zp(/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(v){let b=yield Ye(n,a,p,(h,y,x)=>h.onEvent?.({event:v,agent:r,input:e,messages:y,state:x}));if(m(b),b.stopPropagation===!0?i?.event("APPLY","Event dropped:",v,{type:v.type,reason:"stopPropagation by subscriber"}):i?.event("APPLY","Event applied:",v,{type:v.type,subscribers:n.length}),b.stopPropagation===!0)return g();switch(v.type){case V.TEXT_MESSAGE_START:{let h=yield Ye(n,a,p,(y,x,w)=>y.onTextMessageStartEvent?.({event:v,messages:x,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:y,role:x="assistant",name:w}=v;if(!a.find(I=>I.id===y)){let I={id:y,role:x,content:"",...(w!==void 0&&{name:w})};a.push(I),m({messages:a})}}return g()}case V.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,x=a.find(I=>I.id===h);if(!x)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield Ye(n,a,p,(I,F,E)=>I.onTextMessageContentEvent?.({event:v,messages:F,state:E,agent:r,input:e,textMessageBuffer:typeof x.content=="string"?x.content:""}));return m(w),w.stopPropagation!==!0&&(x.content=`${typeof x.content=="string"?x.content:""}${y}`,m({messages:a})),g()}case V.TEXT_MESSAGE_END:{let{messageId:h}=v,y=a.find(x=>x.id===h);return y?(m(yield Ye(n,a,p,(x,w,I)=>x.onTextMessageEndEvent?.({event:v,messages:w,state:I,agent:r,input:e,textMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(x=>{x.onNewMessage?.({message:y,messages:a,state:p,agent:r,input:e})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g())}case V.TOOL_CALL_START:{let h=yield Ye(n,a,p,(y,x,w)=>y.onToolCallStartEvent?.({event:v,messages:x,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:x,parentMessageId:w}=v,I=a.find(E=>E.toolCalls?.some(T=>T.id===y))?.toolCalls?.find(E=>E.id===y);if(I)return I.function.name!==x&&(console.warn(`TOOL_CALL_START: tool call '${y}' already exists with name '${I.function.name}' \u2014 updating it to '${x}'`),I.function.name=x,m({messages:a})),g();let F=AU(a,w,y);F.toolCalls??(F.toolCalls=[]),F.toolCalls.push({id:y,type:"function",function:{name:x,arguments:""}}),m({messages:a})}return g()}case V.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=v,x=a.find(F=>F.toolCalls?.some(E=>E.id===h));if(!x)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let w=x.toolCalls?.find(F=>F.id===h);if(!w)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=yield Ye(n,a,p,(F,E,T)=>{let P=w.function.arguments,q=w.function.name,G={};try{G=ef(P)}catch{}return F.onToolCallArgsEvent?.({event:v,messages:E,state:T,agent:r,input:e,toolCallBuffer:P,toolCallName:q,partialToolCallArgs:G})});return m(I),I.stopPropagation!==!0&&(w.function.arguments+=y,m({messages:a})),g()}case V.TOOL_CALL_END:{let{toolCallId:h}=v,y=a.find(w=>w.toolCalls?.some(I=>I.id===h));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let x=y.toolCalls?.find(w=>w.id===h);return x?(m(yield Ye(n,a,p,(w,I,F)=>{let E=x.function.arguments,T=x.function.name,P={};try{P=JSON.parse(E)}catch{}return w.onToolCallEndEvent?.({event:v,messages:I,state:F,agent:r,input:e,toolCallName:T,toolCallArgs:P})})),yield Promise.all(n.map(w=>{w.onNewToolCall?.({toolCall:x,messages:a,state:p,agent:r,input:e})})),g()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g())}case V.TOOL_CALL_RESULT:{let h=yield Ye(n,a,p,(y,x,w)=>y.onToolCallResultEvent?.({event:v,messages:x,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:x,content:w,role:I}=v,F={id:y,toolCallId:x,role:I||"tool",content:w},E=a.findIndex(T=>T.role==="assistant"&&T.toolCalls?.some(P=>P.id===x));if(E===-1)a.push(F);else{let T=E+1;for(;T<a.length&&a[T].role==="tool";)T++;a.splice(T,0,F)}yield Promise.all(n.map(T=>{T.onNewMessage?.({message:F,messages:a,state:p,agent:r,input:e})})),m({messages:a})}return g()}case V.STATE_SNAPSHOT:{let h=yield Ye(n,a,p,(y,x,w)=>y.onStateSnapshotEvent?.({event:v,messages:x,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{snapshot:y}=v;p=y,m({state:p})}return g()}case V.STATE_DELTA:{let h=yield Ye(n,a,p,(y,x,w)=>y.onStateDeltaEvent?.({event:v,messages:x,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{delta:y}=v;try{p=Fp.applyPatch(p,y,!0,!1).newDocument,m({state:p})}catch(x){let w=x instanceof Error?x.message:String(x);console.warn(`Failed to apply state patch:
37
37
  Current state: ${JSON.stringify(p,null,2)}
38
38
  Patch operations: ${JSON.stringify(y,null,2)}
39
39
  Error: ${w}`)}}return g()}case V.MESSAGES_SNAPSHOT:{let h=yield Ye(n,a,p,(y,x,w)=>y.onMessagesSnapshotEvent?.({event:v,messages:x,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messages:y}=v,x=new Map(y.map(T=>[T.id,T])),w=y.some(T=>T.role==="activity"),I=y.some(T=>T.role==="reasoning"),F=T=>T.role==="activity"&&!w||T.role==="reasoning"&&!I;a=a.filter(T=>F(T)||x.has(T.id)).map(T=>F(T)?T:x.get(T.id));let E=new Set(a.map(T=>T.id));for(let T of y)E.has(T.id)||a.push(T);m({messages:a})}return g()}case V.ACTIVITY_SNAPSHOT:{let h=v,y=a.findIndex(E=>E.id===h.messageId),x=y>=0?a[y]:void 0,w=x?.role==="activity"?x:void 0,I=h.replace??!0,F=yield Ye(n,a,p,(E,T,P)=>E.onActivitySnapshotEvent?.({event:h,messages:T,state:P,agent:r,input:e,activityMessage:w,existingMessage:x}));if(m(F),F.stopPropagation!==!0){let E={id:h.messageId,role:"activity",activityType:h.activityType,content:Qe(h.content)},T;y===-1?(a.push(E),T=E):w?I&&(a[y]={...w,activityType:h.activityType,content:Qe(h.content)}):I&&(a[y]=E,T=E),m({messages:a}),T&&(yield Promise.all(n.map(P=>P.onNewMessage?.({message:T,messages:a,state:p,agent:r,input:e}))))}return g()}case V.ACTIVITY_DELTA:{let h=v,y=a.findIndex(F=>F.id===h.messageId);if(y===-1)return g();let x=a[y];if(x.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let w=x,I=yield Ye(n,a,p,(F,E,T)=>F.onActivityDeltaEvent?.({event:h,messages:E,state:T,agent:r,input:e,activityMessage:w}));if(m(I),I.stopPropagation!==!0)try{let F=Qe(w.content??{}),E=Fp.applyPatch(F,h.patch??[],!0,!1).newDocument;a[y]={...w,content:Qe(E),activityType:h.activityType},m({messages:a})}catch(F){let E=F instanceof Error?F.message:String(F);console.warn(`Failed to apply activity patch for '${h.messageId}': ${E}`)}return g()}case V.RAW:return m(yield Ye(n,a,p,(h,y,x)=>h.onRawEvent?.({event:v,messages:y,state:x,agent:r,input:e}))),g();case V.CUSTOM:return m(yield Ye(n,a,p,(h,y,x)=>h.onCustomEvent?.({event:v,messages:y,state:x,agent:r,input:e}))),g();case V.RUN_STARTED:{let h=yield Ye(n,a,p,(y,x,w)=>y.onRunStartedEvent?.({event:v,messages:x,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let y=v;if(y.input?.messages){for(let x of y.input.messages)a.find(w=>w.id===x.id)||a.push(x);m({messages:a})}}return g()}case V.RUN_FINISHED:{let h=v,y=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},x=yield Ye(n,a,p,(w,I,F)=>w.onRunFinishedEvent?.({...y,messages:I,state:F,agent:r,input:e}));return m(x),x.stopPropagation!==!0&&(r.pendingInterrupts=y.outcome==="interrupt"?[...y.interrupts]:[]),g()}case V.RUN_ERROR:return m(yield Ye(n,a,p,(h,y,x)=>h.onRunErrorEvent?.({event:v,messages:y,state:x,agent:r,input:e}))),g();case V.STEP_STARTED:return m(yield Ye(n,a,p,(h,y,x)=>h.onStepStartedEvent?.({event:v,messages:y,state:x,agent:r,input:e}))),g();case V.STEP_FINISHED:return m(yield Ye(n,a,p,(h,y,x)=>h.onStepFinishedEvent?.({event:v,messages:y,state:x,agent:r,input:e}))),g();case V.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case V.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case V.THINKING_START:return g();case V.THINKING_END:return g();case V.THINKING_TEXT_MESSAGE_START:return g();case V.THINKING_TEXT_MESSAGE_CONTENT:return g();case V.THINKING_TEXT_MESSAGE_END:return g();case V.REASONING_START:return m(yield Ye(n,a,p,(h,y,x)=>h.onReasoningStartEvent?.({event:v,messages:y,state:x,agent:r,input:e}))),g();case V.REASONING_MESSAGE_START:{let h=yield Ye(n,a,p,(y,x,w)=>y.onReasoningMessageStartEvent?.({event:v,messages:x,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:y}=v;if(!a.find(x=>x.id===y)){let x={id:y,role:"reasoning",content:""};a.push(x),m({messages:a})}}return g()}case V.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,x=a.find(I=>I.id===h);if(!x)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield Ye(n,a,p,(I,F,E)=>I.onReasoningMessageContentEvent?.({event:v,messages:F,state:E,agent:r,input:e,reasoningMessageBuffer:typeof x.content=="string"?x.content:""}));return m(w),w.stopPropagation!==!0&&(x.content=`${typeof x.content=="string"?x.content:""}${y}`,m({messages:a})),g()}case V.REASONING_MESSAGE_END:{let{messageId:h}=v,y=a.find(x=>x.id===h);return y?(m(yield Ye(n,a,p,(x,w,I)=>x.onReasoningMessageEndEvent?.({event:v,messages:w,state:I,agent:r,input:e,reasoningMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(x=>{x.onNewMessage?.({message:y,messages:a,state:p,agent:r,input:e})})),g()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g())}case V.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case V.REASONING_END:return m(yield Ye(n,a,p,(h,y,x)=>h.onReasoningEndEvent?.({event:v,messages:y,state:x,agent:r,input:e}))),g();case V.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:y,encryptedValue:x}=v,w=yield Ye(n,a,p,(I,F,E)=>I.onReasoningEncryptedValueEvent?.({event:v,messages:F,state:E,agent:r,input:e}));if(m(w),w.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let F of a)if(F.role==="assistant"&&F.toolCalls){let E=F.toolCalls.find(T=>T.id===y);if(E){E.encryptedValue=x,I=!0;break}}}else{let F=a.find(E=>E.id===y);F?.role!=="activity"&&F&&(F.encryptedValue=x,I=!0)}I&&(f.messages=a)}return g()}}return v.type,g()});return function(_x201){return _ref76.apply(this,arguments)}}()),LS(),n.length>0?US({}):v=>v)},av=e=>t=>{let r=pu(e),n=new Map,o=new Map,i=!1,a=!1,p=!1,f=new Map,m=!1,g=!1,v=!1,b=()=>{n.clear(),o.clear(),f.clear(),m=!1,g=!1,i=!1,a=!1,v=!0};return t.pipe(rr(h=>{let y=h.type;if(r?.event("VERIFY","Event:",h,{type:h.type}),a)return st(()=>new it(`Cannot send event type '${y}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(i&&y!==V.RUN_ERROR&&y!==V.RUN_STARTED)return st(()=>new it(`Cannot send event type '${y}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(p){if(y===V.RUN_STARTED){if(v&&!i)return st(()=>new it("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));i&&b()}}else if(p=!0,y!==V.RUN_STARTED&&y!==V.RUN_ERROR)return st(()=>new it("First event must be 'RUN_STARTED'"));switch(y){case V.TEXT_MESSAGE_START:{let x=h.messageId;return n.has(x)?st(()=>new it(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${x}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(n.set(x,!0),lt(h))}case V.TEXT_MESSAGE_CONTENT:{let x=h.messageId;return n.has(x)?lt(h):st(()=>new it(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${x}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case V.TEXT_MESSAGE_END:{let x=h.messageId;return n.has(x)?(n.delete(x),lt(h)):st(()=>new it(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${x}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case V.TOOL_CALL_START:{let x=h.toolCallId;return o.has(x)?st(()=>new it(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${x}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(o.set(x,!0),lt(h))}case V.TOOL_CALL_ARGS:{let x=h.toolCallId;return o.has(x)?lt(h):st(()=>new it(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${x}'. Start a tool call with 'TOOL_CALL_START' first.`))}case V.TOOL_CALL_END:{let x=h.toolCallId;return o.has(x)?(o.delete(x),lt(h)):st(()=>new it(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${x}'. A 'TOOL_CALL_START' event must be sent first.`))}case V.STEP_STARTED:{let x=h.stepName;return f.has(x)?st(()=>new it(`Step "${x}" is already active for 'STEP_STARTED'`)):(f.set(x,!0),lt(h))}case V.STEP_FINISHED:{let x=h.stepName;return f.has(x)?(f.delete(x),lt(h)):st(()=>new it(`Cannot send 'STEP_FINISHED' for step "${x}" that was not started`))}case V.RUN_STARTED:return v=!0,lt(h);case V.RUN_FINISHED:if(f.size>0){let x=Array.from(f.keys()).join(", ");return st(()=>new it(`Cannot send 'RUN_FINISHED' while steps are still active: ${x}`))}if(n.size>0){let x=Array.from(n.keys()).join(", ");return st(()=>new it(`Cannot send 'RUN_FINISHED' while text messages are still active: ${x}`))}if(o.size>0){let x=Array.from(o.keys()).join(", ");return st(()=>new it(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${x}`))}return i=!0,lt(h);case V.RUN_ERROR:return a=!0,lt(h);case V.CUSTOM:return lt(h);case V.THINKING_TEXT_MESSAGE_START:return m?g?st(()=>new it("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(g=!0,lt(h)):st(()=>new it("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case V.THINKING_TEXT_MESSAGE_CONTENT:return g?lt(h):st(()=>new it("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case V.THINKING_TEXT_MESSAGE_END:return g?(g=!1,lt(h)):st(()=>new it("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case V.THINKING_START:return m?st(()=>new it("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(m=!0,lt(h));case V.THINKING_END:return m?(m=!1,lt(h)):st(()=>new it("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return lt(h)}}))},Oi=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),CU=e=>Xp(()=>Fi(e())).pipe(QS(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return Fi(t.text()).pipe(rr(i=>{let a=i;if(o.includes("application/json"))try{a=JSON.parse(i)}catch{}let p=Error(`HTTP ${t.status}: ${typeof a=="string"?a:JSON.stringify(a)}`);return p.status=t.status,p.payload=a,st(()=>p)}))}let r={type:Oi.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new at(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:a}=yield n.read();if(i)break;let p={type:Oi.DATA,data:a};o.next(p)}o.complete()}catch(i){o.error(i)}})(),()=>{n.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):st(()=>Error("Failed to getReader() from response"))})),bU=(e,t)=>{let r=pu(t),n=new sn,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:p=>{if(p.type!==Oi.HEADERS&&p.type===Oi.DATA&&p.data){let f=o.decode(p.data,{stream:!0});i+=f;let m=i.split(/\n\n/);i=m.pop()||"";for(let g of m)a(g)}},error:p=>n.error(p),complete:()=>{i&&(i+=o.decode(),a(i)),n.complete()}});function a(p){let f=p.split(`
@@ -76,4 +76,4 @@ fast-json-patch/module/duplex.mjs:
76
76
  *)
77
77
  */if(__exports!=exports)module.exports=exports;return module.exports});
78
78
 
79
- window.coveoQuanticVersion = '3.44.2';
79
+ window.coveoQuanticVersion = '3.44.3';