@coveo/quantic 3.45.6 → 3.45.7
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.
- package/force-app/main/default/labels/CustomLabels.labels-meta.xml +12 -5
- package/force-app/main/default/lwc/quanticGeneratedAnswer/quanticGeneratedAnswer.js +3 -5
- package/force-app/main/default/lwc/quanticGeneratedAnswer/templates/conversation.html +2 -2
- package/force-app/main/default/lwc/quanticGeneratedAnswer/templates/generatedAnswer.html +8 -10
- package/force-app/main/default/lwc/quanticResultsPerPage/quanticResultsPerPage.js +1 -1
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +16 -16
- package/force-app/main/default/staticresources/coveoheadless/headless.js +18 -18
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +17 -17
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +15 -15
- package/package.json +8 -8
|
@@ -14,32 +14,32 @@ function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessRecommendation",["crypto"],function(_d_0){var d={"crypto":_d_0},r=function(m){if(m in d)return d[m];if(typeof require=="function")return require(m);throw new Error("Cannot find module '"+m+"'")};return f(r)})}else{var gN={"crypto":"crypto"},gReq=function(r){var mod=r in gN?g[gN[r]]:g[r];return mod};g["CoveoHeadlessRecommendation"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var Sw=Object.create;var ci=Object.defineProperty;var bw=Object.getOwnPropertyDescriptor;var Aw=Object.getOwnPropertyNames;var ww=Object.getPrototypeOf,xw=Object.prototype.hasOwnProperty;var Cw=(e,t,r)=>t in e?ci(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var zn=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var Ze=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},ui=(e,t)=>{for(var r in t)ci(e,r,{get:t[r],enumerable:!0})},
|
|
18
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return a=u.done,u},e:function(u){s=!0,i=u},f:function(){try{a||r.return==null||r.return()}finally{if(s)throw i}}}}function Cl(){return Cl=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=Fw(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Cl.apply(null,arguments)}function Wn(e){return Wn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wn(e)}function Pw(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&El(e,t)}function tm(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tm=function(){return!!e})()}function Nw(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kw(e)}function El(e,t){return El=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},El(e,t)}function Fw(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Wn(e))!==null;);return e}function Dw(e,t,r,n){var o=Cl(Wn(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function Mw(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Lw(e){var t=Mw(e,"string");return typeof t=="symbol"?t:t+""}function qw(e,t){if(e){if(typeof e=="string")return Xf(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Xf(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function jw(e){var t;try{t=new Event("abort")}catch{typeof document<"u"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}return t.reason=e,t}function Uw(e){if(e===void 0)if(typeof document>"u")e=new Error("This operation was aborted"),e.name="AbortError";else try{e=new DOMException("signal is aborted without reason"),Object.defineProperty(e,"name",{value:"AbortError"})}catch{e=new Error("This operation was aborted"),e.name="AbortError"}return e}var em=function(){function e(){Rl(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Il(e,[{key:"addEventListener",value:function(r,n,o){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:o})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var o=this.listeners[r],i=0,a=o.length;i<a;i++)if(o[i].callback===n){o.splice(i,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var o=this.listeners[r.type],i=o.slice(),a=function(){var g=i[s];try{g.callback.call(n,r)}catch(v){Promise.resolve().then(function(){throw v})}g.options&&g.options.once&&n.removeEventListener(r.type,g.callback)},s=0,u=i.length;s<u;s++)a();return!r.defaultPrevented}}}])}(),Tl=function(e){function t(){var r;return Rl(this,t),r=Ow(this,t),r.listeners||em.call(r),Object.defineProperty(r,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(r,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(r,"reason",{value:void 0,writable:!0,configurable:!0}),r}return Pw(t,e),Il(t,[{key:"toString",value:function(){return"[object AbortSignal]"}},{key:"dispatchEvent",value:function(n){n.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,n)),Dw(t,"dispatchEvent",this,3)([n])}},{key:"throwIfAborted",value:function(){var n=this.aborted,o=this.reason,i=o===void 0?"Aborted":o;if(n)throw i}}],[{key:"timeout",value:function(n){var o=new Ia;return setTimeout(function(){return o.abort(new DOMException("This signal is timeout in ".concat(n,"ms"),"TimeoutError"))},n),o.signal}},{key:"any",value:function(n){var o=new Ia;function i(){o.abort(this.reason),a()}function a(){var g=Jf(n),v;try{for(g.s();!(v=g.n()).done;){var R=v.value;R.removeEventListener("abort",i)}}catch(h){g.e(h)}finally{g.f()}}var s=Jf(n),u;try{for(s.s();!(u=s.n()).done;){var c=u.value;if(c.aborted){o.abort(c.reason);break}else c.addEventListener("abort",i)}}catch(g){s.e(g)}finally{s.f()}return o.signal}}])}(em),Ia=function(){function e(){Rl(this,e),Object.defineProperty(this,"signal",{value:new Tl,writable:!0,configurable:!0})}return Il(e,[{key:"abort",value:function(r){var n=Uw(r),o=jw(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Ia.prototype[Symbol.toStringTag]="AbortController",Tl.prototype[Symbol.toStringTag]="AbortSignal");function Vw(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function Gw(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,o=n===void 0?r.Request:n,i=t.AbortController,a=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,s=a===void 0?!1:a;if(!Vw({fetch:r,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s}))return{fetch:r,Request:u};var u=o;(u&&!u.prototype.hasOwnProperty("signal")||s)&&(u=function(R,h){var y;h&&h.signal&&(y=h.signal,delete h.signal);var b=new o(R,h);return y&&Object.defineProperty(b,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),b},u.prototype=o.prototype);var c=r,g=function(R,h){var y=u&&u.prototype.isPrototypeOf(R)?R.signal:h?h.signal:void 0;if(y){var b;try{b=new DOMException("Aborted","AbortError")}catch{b=new Error("Aborted"),b.name="AbortError"}if(y.aborted)return Promise.reject(b);var x=new Promise(function(I,N){y.addEventListener("abort",function(){return N(b)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([x,c(R,h)])}return c(R,h)};return{fetch:g,Request:u}}li.AbortController=Ia;li.AbortSignal=Tl;li.abortableFetch=Gw});var rm,l,C,f=zn(()=>{"use strict";rm=jt(_l(),1),l=jt(_l(),1),{fetch:C}=(0,rm.abortableFetch)({fetch})});function kl(e){return typeof e!="string"||e in{}}function Ol(){return Object.create(null)}function im(e){return typeof e=="string"&&!!e.trim()}function Pl(e,t){var r=e.split(";").filter(im),n=r.shift();if(!n)return null;var o=Bw(n),i=o.name,a=o.value;if(t=t?Object.assign({},Ta,t):Ta,kl(i))return null;try{a=t.decodeValues?decodeURIComponent(a):a}catch(u){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",u)}var s=Ol();return s.name=i,s.value=a,r.forEach(function(u){var c=u.split("="),g=c.shift().trim().toLowerCase();if(!kl(g)){var v=c.join("=").trim();if(g==="expires"){var R=new Date(v);Number.isNaN(R.getTime())||(s.expires=R)}else g==="max-age"?/^-?\d+$/.test(v)&&(s.maxAge=parseInt(v,10)):g==="secure"?s.secure=!0:g==="httponly"?s.httpOnly=!0:g==="samesite"?s.sameSite=v:g==="partitioned"?s.partitioned=!0:g&&(s[g]=v)}}),s}function Bw(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:nm(t),value:nm(r)}}function nm(e){for(var t=0,r=e.length;t<r&&om(e.charCodeAt(t));)t+=1;for(;r>t&&om(e.charCodeAt(r-1));)r-=1;return e.substring(t,r)}function om(e){return e===32||e===9}function Kn(e,t){if(t=t?Object.assign({},Ta,t):Ta,!e)return t.map?Ol():[];if(e.headers)if(typeof e.headers.getSetCookie=="function")e=e.headers.getSetCookie();else if(e.headers["set-cookie"])e=e.headers["set-cookie"];else{var r=e.headers[Object.keys(e.headers).find(function(a){return a.toLowerCase()==="set-cookie"})];!r&&e.headers.cookie&&!t.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),e=r}var n=t.split,o=Array.isArray(e);if(n==="auto"&&(n=!o),o||(e=[e]),e=e.filter(im),n&&(e=e.map(_a).flat()),t.map){var i=Ol();return e.reduce(function(a,s){var u=Pl(s,t);return u&&!kl(u.name)&&(a[u.name]=u),a},i)}else return e.map(function(a){return Pl(a,t)}).filter(Boolean)}function _a(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,i,a,s;function u(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function c(){return o=e.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<e.length;){for(n=r,s=!1;u();)if(o=e.charAt(r),o===","){for(i=r,r+=1,u(),a=r;r<e.length&&c();)r+=1;r<e.length&&e.charAt(r)==="="?(s=!0,r=a,t.push(e.substring(n,i)),n=r):r=i+1}else r+=1;(!s||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var Ta,am=zn(()=>{"use strict";m();d();f();p();Ta={decodeValues:!0,map:!1,silent:!1,split:"auto"};Kn.parseSetCookie=Kn;Kn.parse=Kn;Kn.parseString=Pl;Kn.splitCookiesString=_a});function di(e){if($w.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Nl(e){return e.replace(Qw,"")}function pi(e){if(typeof e!="string"||e.length===0)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>127||!Hw(r))return!1}return!0}function Hw(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function cm(e){if(typeof e!="string"||e.trim()!==e)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r===0||r===10||r===13)return!1}return!0}var $w,sm,Qw,um,Yn,Fl,lm,E,pm=zn(()=>{"use strict";m();d();f();p();am();$w=/[^a-z0-9\-#$%&'*+.^_`|~]/i;sm=[`
|
|
19
|
-
`,"\r","\t"," "],Qw=new RegExp(`(^[${sm.join("")}]|$[${sm.join("")}])`,"g");Yn=Symbol("normalizedHeaders"),Fl=Symbol("rawHeaderNames"),lm=", ",E=class dm{constructor(t){this[Yn]={},this[Fl]=new Map,this[um]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof dm||typeof A.Headers<"u"&&t instanceof A.Headers?t.forEach((r,n)=>{this.append(n,r)},this):Array.isArray(t)?t.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(lm):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(lm):n)})}[(um=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}*keys(){for(let[t]of this.entries())yield t}*values(){for(let[,t]of this.entries())yield t}*entries(){let t=Object.keys(this[Yn]).sort((r,n)=>r.localeCompare(n));for(let r of t)if(r==="set-cookie")for(let n of this.getSetCookie())yield[r,n];else yield[r,this.get(r)]}has(t){if(!pi(t))throw new TypeError(`Invalid header name "${t}"`);return this[Yn].hasOwnProperty(di(t))}get(t){if(!pi(t))throw TypeError(`Invalid header name "${t}"`);return this[Yn][di(t)]??null}set(t,r){if(!pi(t)||!cm(r))return;let n=di(t),o=Nl(r);this[Yn][n]=Nl(o),this[Fl].set(n,t)}append(t,r){if(!pi(t)||!cm(r))return;let n=di(t),o=Nl(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!pi(t)||!this.has(t))return;let r=di(t);delete this[Yn][r],this[Fl].delete(r)}forEach(t,r){for(let[n,o]of this.entries())t.call(r,o,n,this)}getSetCookie(){let t=this.get("set-cookie");return t===null?[]:t===""?[""]:_a(t)}}});var m=zn(()=>{"use strict";pm()});var Sm=Ze(gi=>{"use strict";m();d();f();p();var Na=gi&&gi.__assign||function(){return Na=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Na.apply(this,arguments)};Object.defineProperty(gi,"__esModule",{value:!0});var tx={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function rx(e){var t=Na(Na({},tx),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}gi.getSanitizedOptions=rx});var bm=Ze(jl=>{"use strict";m();d();f();p();Object.defineProperty(jl,"__esModule",{value:!0});function nx(e){var t=Math.random()*e;return Math.round(t)}jl.fullJitter=nx});var Am=Ze(Ul=>{"use strict";m();d();f();p();Object.defineProperty(Ul,"__esModule",{value:!0});function ox(e){return e}Ul.noJitter=ox});var wm=Ze(Vl=>{"use strict";m();d();f();p();Object.defineProperty(Vl,"__esModule",{value:!0});var ix=bm(),ax=Am();function sx(e){return e.jitter==="full"?ix.fullJitter:ax.noJitter}Vl.JitterFactory=sx});var Bl=Ze(Gl=>{"use strict";m();d();f();p();Object.defineProperty(Gl,"__esModule",{value:!0});var cx=wm(),ux=function(){function e(t){this.options=t,this.attempt=0}return e.prototype.apply=function(){var t=this;return new Promise(function(r){return setTimeout(r,t.jitteredDelay)})},e.prototype.setAttemptNumber=function(t){this.attempt=t},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){var t=cx.JitterFactory(this.options);return t(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var t=this.options.startingDelay,r=this.options.timeMultiple,n=this.numOfDelayedAttempts,o=t*Math.pow(r,n);return Math.min(o,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();Gl.Delay=ux});var xm=Ze(ar=>{"use strict";m();d();f();p();var lx=ar&&ar.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),dx=ar&&ar.__awaiter||function(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 s(g){try{c(n.next(g))}catch(v){a(v)}}function u(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})},px=ar&&ar.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(ar,"__esModule",{value:!0});var fx=Bl(),mx=function(e){lx(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return dx(this,void 0,void 0,function(){return px(this,function(r){return[2,this.isFirstAttempt?!0:e.prototype.apply.call(this)]})})},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return this.attempt===0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(fx.Delay);ar.SkipFirstDelay=mx});var Cm=Ze(hi=>{"use strict";m();d();f();p();var gx=hi&&hi.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(hi,"__esModule",{value:!0});var hx=Bl(),yx=function(e){gx(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(hx.Delay);hi.AlwaysDelay=yx});var Em=Ze($l=>{"use strict";m();d();f();p();Object.defineProperty($l,"__esModule",{value:!0});var vx=xm(),Sx=Cm();function bx(e,t){var r=Ax(e);return r.setAttemptNumber(t),r}$l.DelayFactory=bx;function Ax(e){return e.delayFirstAttempt?new Sx.AlwaysDelay(e):new vx.SkipFirstDelay(e)}});var Rm=Ze(en=>{"use strict";m();d();f();p();var Ql=en&&en.__awaiter||function(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 s(g){try{c(n.next(g))}catch(v){a(v)}}function u(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})},Hl=en&&en.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(en,"__esModule",{value:!0});var wx=Sm(),xx=Em();function Cx(e,t){return t===void 0&&(t={}),Ql(this,void 0,void 0,function(){var r,n;return Hl(this,function(o){switch(o.label){case 0:return r=wx.getSanitizedOptions(t),n=new Ex(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}en.backOff=Cx;var Ex=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return Ql(this,void 0,void 0,function(){var t,r;return Hl(this,function(n){switch(n.label){case 0:if(this.attemptLimitReached)return[3,7];n.label=1;case 1:return n.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return n.sent(),[4,this.request()];case 3:return[2,n.sent()];case 4:return t=n.sent(),this.attemptNumber++,[4,this.options.retry(t,this.attemptNumber)];case 5:if(r=n.sent(),!r||this.attemptLimitReached)throw t;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}})})},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return Ql(this,void 0,void 0,function(){var t;return Hl(this,function(r){switch(r.label){case 0:return t=xx.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var oc=Ze((hp,yp)=>{"use strict";m();d();f();p();(function(e,t){typeof hp=="object"&&typeof yp<"u"?yp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs=t()})(hp,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",u="week",c="month",g="quarter",v="year",R="date",h="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,x={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(q){var B=["th","st","nd","rd"],j=q%100;return"["+q+(B[(j-20)%10]||B[j]||B[0])+"]"}},I=function(q,B,j){var W=String(q);return!W||W.length>=B?q:""+Array(B+1-W.length).join(j)+q},N={s:I,z:function(q){var B=-q.utcOffset(),j=Math.abs(B),W=Math.floor(j/60),Q=j%60;return(B<=0?"+":"-")+I(W,2,"0")+":"+I(Q,2,"0")},m:function q(B,j){if(B.date()<j.date())return-q(j,B);var W=12*(j.year()-B.year())+(j.month()-B.month()),Q=B.clone().add(W,c),X=j-Q<0,z=B.clone().add(W+(X?-1:1),c);return+(-(W+(j-Q)/(X?Q-z:z-Q))||0)},a:function(q){return q<0?Math.ceil(q)||0:Math.floor(q)},p:function(q){return{M:c,y:v,w:u,d:s,D:R,h:a,m:i,s:o,ms:n,Q:g}[q]||String(q||"").toLowerCase().replace(/s$/,"")},u:function(q){return q===void 0}},_="en",P={};P[_]=x;var w="$isDayjsObject",O=function(q){return q instanceof G||!(!q||!q[w])},k=function q(B,j,W){var Q;if(!B)return _;if(typeof B=="string"){var X=B.toLowerCase();P[X]&&(Q=X),j&&(P[X]=j,Q=X);var z=B.split("-");if(!Q&&z.length>1)return q(z[0])}else{var Z=B.name;P[Z]=B,Q=Z}return!W&&Q&&(_=Q),Q||!W&&_},T=function(q,B){if(O(q))return q.clone();var j=typeof B=="object"?B:{};return j.date=q,j.args=arguments,new G(j)},D=N;D.l=k,D.i=O,D.w=function(q,B){return T(q,{locale:B.$L,utc:B.$u,x:B.$x,$offset:B.$offset})};var G=function(){function q(j){this.$L=k(j.locale,null,!0),this.parse(j),this.$x=this.$x||j.x||{},this[w]=!0}var B=q.prototype;return B.parse=function(j){this.$d=function(W){var Q=W.date,X=W.utc;if(Q===null)return new Date(NaN);if(D.u(Q))return new Date;if(Q instanceof Date)return new Date(Q);if(typeof Q=="string"&&!/Z$/i.test(Q)){var z=Q.match(y);if(z){var Z=z[2]-1||0,se=(z[7]||"0").substring(0,3);return X?new Date(Date.UTC(z[1],Z,z[3]||1,z[4]||0,z[5]||0,z[6]||0,se)):new Date(z[1],Z,z[3]||1,z[4]||0,z[5]||0,z[6]||0,se)}}return new Date(Q)}(j),this.init()},B.init=function(){var j=this.$d;this.$y=j.getFullYear(),this.$M=j.getMonth(),this.$D=j.getDate(),this.$W=j.getDay(),this.$H=j.getHours(),this.$m=j.getMinutes(),this.$s=j.getSeconds(),this.$ms=j.getMilliseconds()},B.$utils=function(){return D},B.isValid=function(){return this.$d.toString()!==h},B.isSame=function(j,W){var Q=T(j);return this.startOf(W)<=Q&&Q<=this.endOf(W)},B.isAfter=function(j,W){return T(j)<this.startOf(W)},B.isBefore=function(j,W){return this.endOf(W)<T(j)},B.$g=function(j,W,Q){return D.u(j)?this[W]:this.set(Q,j)},B.unix=function(){return Math.floor(this.valueOf()/1e3)},B.valueOf=function(){return this.$d.getTime()},B.startOf=function(j,W){var Q=this,X=!!D.u(W)||W,z=D.p(j),Z=function(ve,me){var we=D.w(Q.$u?Date.UTC(Q.$y,me,ve):new Date(Q.$y,me,ve),Q);return X?we:we.endOf(s)},se=function(ve,me){return D.w(Q.toDate()[ve].apply(Q.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(me)),Q)},ye=this.$W,_e=this.$M,Ge=this.$D,Fe="set"+(this.$u?"UTC":"");switch(z){case v:return X?Z(1,0):Z(31,11);case c:return X?Z(1,_e):Z(0,_e+1);case u:var Me=this.$locale().weekStart||0,Le=(ye<Me?ye+7:ye)-Me;return Z(X?Ge-Le:Ge+(6-Le),_e);case s:case R:return se(Fe+"Hours",0);case a:return se(Fe+"Minutes",1);case i:return se(Fe+"Seconds",2);case o:return se(Fe+"Milliseconds",3);default:return this.clone()}},B.endOf=function(j){return this.startOf(j,!1)},B.$set=function(j,W){var Q,X=D.p(j),z="set"+(this.$u?"UTC":""),Z=(Q={},Q[s]=z+"Date",Q[R]=z+"Date",Q[c]=z+"Month",Q[v]=z+"FullYear",Q[a]=z+"Hours",Q[i]=z+"Minutes",Q[o]=z+"Seconds",Q[n]=z+"Milliseconds",Q)[X],se=X===s?this.$D+(W-this.$W):W;if(X===c||X===v){var ye=this.clone().set(R,1);ye.$d[Z](se),ye.init(),this.$d=ye.set(R,Math.min(this.$D,ye.daysInMonth())).$d}else Z&&this.$d[Z](se);return this.init(),this},B.set=function(j,W){return this.clone().$set(j,W)},B.get=function(j){return this[D.p(j)]()},B.add=function(j,W){var Q,X=this;j=Number(j);var z=D.p(W),Z=function(_e){var Ge=T(X);return D.w(Ge.date(Ge.date()+Math.round(_e*j)),X)};if(z===c)return this.set(c,this.$M+j);if(z===v)return this.set(v,this.$y+j);if(z===s)return Z(1);if(z===u)return Z(7);var se=(Q={},Q[i]=t,Q[a]=r,Q[o]=e,Q)[z]||1,ye=this.$d.getTime()+j*se;return D.w(ye,this)},B.subtract=function(j,W){return this.add(-1*j,W)},B.format=function(j){var W=this,Q=this.$locale();if(!this.isValid())return Q.invalidDate||h;var X=j||"YYYY-MM-DDTHH:mm:ssZ",z=D.z(this),Z=this.$H,se=this.$m,ye=this.$M,_e=Q.weekdays,Ge=Q.months,Fe=Q.meridiem,Me=function(me,we,Se,He){return me&&(me[we]||me(W,X))||Se[we].slice(0,He)},Le=function(me){return D.s(Z%12||12,me,"0")},ve=Fe||function(me,we,Se){var He=me<12?"AM":"PM";return Se?He.toLowerCase():He};return X.replace(b,function(me,we){return we||function(Se){switch(Se){case"YY":return String(W.$y).slice(-2);case"YYYY":return D.s(W.$y,4,"0");case"M":return ye+1;case"MM":return D.s(ye+1,2,"0");case"MMM":return Me(Q.monthsShort,ye,Ge,3);case"MMMM":return Me(Ge,ye);case"D":return W.$D;case"DD":return D.s(W.$D,2,"0");case"d":return String(W.$W);case"dd":return Me(Q.weekdaysMin,W.$W,_e,2);case"ddd":return Me(Q.weekdaysShort,W.$W,_e,3);case"dddd":return _e[W.$W];case"H":return String(Z);case"HH":return D.s(Z,2,"0");case"h":return Le(1);case"hh":return Le(2);case"a":return ve(Z,se,!0);case"A":return ve(Z,se,!1);case"m":return String(se);case"mm":return D.s(se,2,"0");case"s":return String(W.$s);case"ss":return D.s(W.$s,2,"0");case"SSS":return D.s(W.$ms,3,"0");case"Z":return z}return null}(me)||z.replace(":","")})},B.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},B.diff=function(j,W,Q){var X,z=this,Z=D.p(W),se=T(j),ye=(se.utcOffset()-this.utcOffset())*t,_e=this-se,Ge=function(){return D.m(z,se)};switch(Z){case v:X=Ge()/12;break;case c:X=Ge();break;case g:X=Ge()/3;break;case u:X=(_e-ye)/6048e5;break;case s:X=(_e-ye)/864e5;break;case a:X=_e/r;break;case i:X=_e/t;break;case o:X=_e/e;break;default:X=_e}return Q?X:D.a(X)},B.daysInMonth=function(){return this.endOf(c).$D},B.$locale=function(){return P[this.$L]},B.locale=function(j,W){if(!j)return this.$L;var Q=this.clone(),X=k(j,W,!0);return X&&(Q.$L=X),Q},B.clone=function(){return D.w(this.$d,this)},B.toDate=function(){return new Date(this.valueOf())},B.toJSON=function(){return this.isValid()?this.toISOString():null},B.toISOString=function(){return this.$d.toISOString()},B.toString=function(){return this.$d.toUTCString()},q}(),M=G.prototype;return T.prototype=M,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",c],["$y",v],["$D",R]].forEach(function(q){M[q[1]]=function(B){return this.$g(B,q[0],q[1])}}),T.extend=function(q,B){return q.$i||(q(B,G,T),q.$i=!0),T},T.locale=k,T.isDayjs=O,T.unix=function(q){return T(1e3*q)},T.en=P[_],T.Ls=P,T.p={},T})});var Ry=Ze((vp,Sp)=>{"use strict";m();d();f();p();(function(e,t){typeof vp=="object"&&typeof Sp<"u"?Sp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_quarterOfYear=t()})(vp,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(s){return this.$utils().u(s)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(s-1))};var i=o.add;o.add=function(s,u){return s=Number(s),this.$utils().p(u)===t?this.add(3*s,e):i.bind(this)(s,u)};var a=o.startOf;o.startOf=function(s,u){var c=this.$utils(),g=!!c.u(u)||u;if(c.p(s)===t){var v=this.quarter()-1;return g?this.month(3*v).startOf(e).startOf("day"):this.month(3*v+2).endOf(e).endOf("day")}return a.bind(this)(s,u)}}})});var Iy=Ze((bp,Ap)=>{"use strict";m();d();f();p();(function(e,t){typeof bp=="object"&&typeof Ap<"u"?Ap.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_customParseFormat=t()})(bp,function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,o=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,a={},s=function(y){return(y=+y)+(y>68?1900:2e3)},u=function(y){return function(b){this[y]=+b}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(b){if(!b||b==="Z")return 0;var x=b.match(/([+-]|\d\d)/g),I=60*x[1]+(+x[2]||0);return I===0?0:x[0]==="+"?-I:I}(y)}],g=function(y){var b=a[y];return b&&(b.indexOf?b:b.s.concat(b.f))},v=function(y,b){var x,I=a.meridiem;if(I){for(var N=1;N<=24;N+=1)if(y.indexOf(I(N,0,b))>-1){x=N>12;break}}else x=y===(b?"pm":"PM");return x},R={A:[i,function(y){this.afternoon=v(y,!1)}],a:[i,function(y){this.afternoon=v(y,!0)}],Q:[r,function(y){this.month=3*(y-1)+1}],S:[r,function(y){this.milliseconds=100*+y}],SS:[n,function(y){this.milliseconds=10*+y}],SSS:[/\d{3}/,function(y){this.milliseconds=+y}],s:[o,u("seconds")],ss:[o,u("seconds")],m:[o,u("minutes")],mm:[o,u("minutes")],H:[o,u("hours")],h:[o,u("hours")],HH:[o,u("hours")],hh:[o,u("hours")],D:[o,u("day")],DD:[n,u("day")],Do:[i,function(y){var b=a.ordinal,x=y.match(/\d+/);if(this.day=x[0],b)for(var I=1;I<=31;I+=1)b(I).replace(/\[|\]/g,"")===y&&(this.day=I)}],w:[o,u("week")],ww:[n,u("week")],M:[o,u("month")],MM:[n,u("month")],MMM:[i,function(y){var b=g("months"),x=(g("monthsShort")||b.map(function(I){return I.slice(0,3)})).indexOf(y)+1;if(x<1)throw new Error;this.month=x%12||x}],MMMM:[i,function(y){var b=g("months").indexOf(y)+1;if(b<1)throw new Error;this.month=b%12||b}],Y:[/[+-]?\d+/,u("year")],YY:[n,function(y){this.year=s(y)}],YYYY:[/\d{4}/,u("year")],Z:c,ZZ:c};function h(y){var b,x;b=y,x=a&&a.formats;for(var I=(y=b.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(T,D,G){var M=G&&G.toUpperCase();return D||x[G]||e[G]||x[M].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(q,B,j){return B||j.slice(1)})})).match(t),N=I.length,_=0;_<N;_+=1){var P=I[_],w=R[P],O=w&&w[0],k=w&&w[1];I[_]=k?{regex:O,parser:k}:P.replace(/^\[|\]$/g,"")}return function(T){for(var D={},G=0,M=0;G<N;G+=1){var q=I[G];if(typeof q=="string")M+=q.length;else{var B=q.regex,j=q.parser,W=T.slice(M),Q=B.exec(W)[0];j.call(D,Q),T=T.replace(Q,"")}}return function(X){var z=X.afternoon;if(z!==void 0){var Z=X.hours;z?Z<12&&(X.hours+=12):Z===12&&(X.hours=0),delete X.afternoon}}(D),D}}return function(y,b,x){x.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(s=y.parseTwoDigitYear);var I=b.prototype,N=I.parse;I.parse=function(_){var P=_.date,w=_.utc,O=_.args;this.$u=w;var k=O[1];if(typeof k=="string"){var T=O[2]===!0,D=O[3]===!0,G=T||D,M=O[2];D&&(M=O[2]),a=this.$locale(),!T&&M&&(a=x.Ls[M]),this.$d=function(W,Q,X,z){try{if(["x","X"].indexOf(Q)>-1)return new Date((Q==="X"?1e3:1)*W);var Z=h(Q)(W),se=Z.year,ye=Z.month,_e=Z.day,Ge=Z.hours,Fe=Z.minutes,Me=Z.seconds,Le=Z.milliseconds,ve=Z.zone,me=Z.week,we=new Date,Se=_e||(se||ye?1:we.getDate()),He=se||we.getFullYear(),Ye=0;se&&!ye||(Ye=ye>0?ye-1:we.getMonth());var Tt,xt=Ge||0,qt=Fe||0,_t=Me||0,ir=Le||0;return ve?new Date(Date.UTC(He,Ye,Se,xt,qt,_t,ir+60*ve.offset*1e3)):X?new Date(Date.UTC(He,Ye,Se,xt,qt,_t,ir)):(Tt=new Date(He,Ye,Se,xt,qt,_t,ir),me&&(Tt=z(Tt).week(me).toDate()),Tt)}catch{return new Date("")}}(P,k,w,x),this.init(),M&&M!==!0&&(this.$L=this.locale(M).$L),G&&P!=this.format(k)&&(this.$d=new Date("")),a={}}else if(k instanceof Array)for(var q=k.length,B=1;B<=q;B+=1){O[1]=k[B-1];var j=x.apply(this,O);if(j.isValid()){this.$d=j.$d,this.$L=j.$L,this.init();break}B===q&&(this.$d=new Date(""))}else N.call(this,_)}}})});var xv=Ze((Mp,Lp)=>{"use strict";m();d();f();p();(function(e,t){typeof Mp=="object"&&typeof Lp<"u"?Lp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_timezone=t()})(Mp,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,o){var i,a=function(g,v,R){R===void 0&&(R={});var h=new Date(g),y=function(b,x){x===void 0&&(x={});var I=x.timeZoneName||"short",N=b+"|"+I,_=t[N];return _||(_=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:b,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:I}),t[N]=_),_}(v,R);return y.formatToParts(h)},s=function(g,v){for(var R=a(g,v),h=[],y=0;y<R.length;y+=1){var b=R[y],x=b.type,I=b.value,N=e[x];N>=0&&(h[N]=parseInt(I,10))}var _=h[3],P=_===24?0:_,w=h[0]+"-"+h[1]+"-"+h[2]+" "+P+":"+h[4]+":"+h[5]+":000",O=+g;return(o.utc(w).valueOf()-(O-=O%1e3))/6e4},u=n.prototype;u.tz=function(g,v){if(g===void 0&&(g=i),!this.isValid())return this;var R,h=this.utcOffset(),y=this.toDate(),b=y.toLocaleString("en-US",{timeZone:g}),x=s(+y,g);if(!Number(x))R=this.utcOffset(0,v);else if(R=o(b,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(x,!0),v){var I=R.utcOffset();R=R.add(h-I,"minute")}return R.$x.$timezone=g,R},u.offsetName=function(g){var v=this.$x.$timezone||o.tz.guess(),R=a(this.valueOf(),v,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return R&&R.value};var c=u.startOf;u.startOf=function(g,v){if(!this.$x||!this.$x.$timezone)return c.call(this,g,v);var R=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return c.call(R,g,v).tz(this.$x.$timezone,!0)},o.tz=function(g,v,R){var h=R&&v,y=R||v||i,b=s(+o(),y);if(typeof g!="string")return o(g).tz(y);var x=o.utc(g,h).valueOf();if(Number.isNaN(x)){var I=o(NaN);return I.$x.$timezone=y,I}var N=function(O,k,T){var D=O-60*k*1e3,G=s(D,T);if(k===G)return[D,k];var M=s(D-=60*(G-k)*1e3,T);return G===M?[D,G]:[O-60*Math.min(G,M)*1e3,Math.max(G,M)]}(x,b,y),_=N[0],P=N[1],w=o(_).utcOffset(P);return w.$x.$timezone=y,w},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var Cv=Ze((qp,jp)=>{"use strict";m();d();f();p();(function(e,t){typeof qp=="object"&&typeof jp<"u"?jp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_utc=t()})(qp,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,i){var a=o.prototype;i.utc=function(h){var y={date:h,utc:!0,args:arguments};return new o(y)},a.utc=function(h){var y=i(this.toDate(),{locale:this.$L,utc:!0});return h?y.add(this.utcOffset(),e):y},a.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var s=a.parse;a.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),s.call(this,h)};var u=a.init;a.init=function(){if(this.$u){var h=this.$d;this.$y=h.getUTCFullYear(),this.$M=h.getUTCMonth(),this.$D=h.getUTCDate(),this.$W=h.getUTCDay(),this.$H=h.getUTCHours(),this.$m=h.getUTCMinutes(),this.$s=h.getUTCSeconds(),this.$ms=h.getUTCMilliseconds()}else u.call(this)};var c=a.utcOffset;a.utcOffset=function(h,y){var b=this.$utils().u;if(b(h))return this.$u?0:b(this.$offset)?c.call(this):this.$offset;if(typeof h=="string"&&(h=function(_){_===void 0&&(_="");var P=_.match(t);if(!P)return null;var w=(""+P[0]).match(r)||["-",0,0],O=w[0],k=60*+w[1]+ +w[2];return k===0?0:O==="+"?k:-k}(h),h===null))return this;var x=Math.abs(h)<=16?60*h:h;if(x===0)return this.utc(y);var I=this.clone();if(y)return I.$offset=x,I.$u=!1,I;var N=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(I=this.local().add(x+N,e)).$offset=x,I.$x.$localOffset=N,I};var g=a.format;a.format=function(h){var y=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,y)},a.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},a.isUTC=function(){return!!this.$u},a.toISOString=function(){return this.toDate().toISOString()},a.toString=function(){return this.toDate().toUTCString()};var v=a.toDate;a.toDate=function(h){return h==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var R=a.diff;a.diff=function(h,y,b){if(h&&this.$u===h.$u)return R.call(this,h,y,b);var x=this.local(),I=i(h).local();return R.call(x,I,y,b)}}})});var SA=Ze((yle,vA)=>{"use strict";m();d();f();p();function KP(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}vA.exports=YP;function YP(e,t,r){var n=r&&r.stringify||KP,o=1;if(typeof e=="object"&&e!==null){var i=t.length+o;if(i===1)return e;var a=new Array(i);a[0]=n(e);for(var s=1;s<i;s++)a[s]=n(t[s]);return a.join(" ")}if(typeof e!="string")return e;var u=t.length;if(u===0)return e;for(var c="",g=1-o,v=-1,R=e&&e.length||0,h=0;h<R;){if(e.charCodeAt(h)===37&&h+1<R){switch(v=v>-1?v:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=u||t[g]==null)break;v<h&&(c+=e.slice(v,h)),c+=Number(t[g]),v=h+2,h++;break;case 105:if(g>=u||t[g]==null)break;v<h&&(c+=e.slice(v,h)),c+=Math.floor(Number(t[g])),v=h+2,h++;break;case 79:case 111:case 106:if(g>=u||t[g]===void 0)break;v<h&&(c+=e.slice(v,h));var y=typeof t[g];if(y==="string"){c+="'"+t[g]+"'",v=h+2,h++;break}if(y==="function"){c+=t[g].name||"<anonymous>",v=h+2,h++;break}c+=n(t[g]),v=h+2,h++;break;case 115:if(g>=u)break;v<h&&(c+=e.slice(v,h)),c+=String(t[g]),v=h+2,h++;break;case 37:v<h&&(c+=e.slice(v,h)),c+="%",v=h+2,h++,g--;break}++g}++h}return v===-1?e:(v<R&&(c+=e.slice(v)),c)}});var RA=Ze((wle,ll)=>{"use strict";m();d();f();p();var bA=SA();ll.exports=Ar;var Aa=dN().console||{},XP={mapHttpRequest:ul,mapHttpResponse:ul,wrapRequestSerializer:Lf,wrapResponseSerializer:Lf,wrapErrorSerializer:Lf,req:ul,res:ul,err:wA,errWithCause:wA};function Xr(e,t){return e==="silent"?1/0:t.levels.values[e]}var Uf=Symbol("pino.logFuncs"),qf=Symbol("pino.hierarchy"),ZP={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function AA(e,t){let r={logger:t,parent:e[qf]};t[qf]=r}function JP(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Aa[o]||Aa[ZP[o]||"log"]||ri}),e[Uf]=n}function eN(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function Ar(e){e=e||{},e.browser=e.browser||{};let t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");let r=e.browser.write||Aa;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=eN(e.browser.serialize,n),i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);let a=Object.keys(e.customLevels||{}),s=["error","fatal","warn","info","debug","trace"].concat(a);typeof r=="function"&&s.forEach(function(b){r[b]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let u=e.level||"info",c=Object.create(r);c.log||(c.log=ri),JP(c,s,r),AA({},c),Object.defineProperty(c,"levelVal",{get:v}),Object.defineProperty(c,"level",{get:R,set:h});let g={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,reportCaller:e.browser.reportCaller,levels:s,timestamp:cN(e),messageKey:e.messageKey||"msg",onChild:e.onChild||ri};c.levels=tN(e),c.level=u,c.isLevelEnabled=function(b){return this.levels.values[b]?this.levels.values[b]>=this.levels.values[this.level]:!1},c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=ri,c.serializers=n,c._serialize=o,c._stdErrSerialize=i,c.child=function(...b){return y.call(this,g,...b)},t&&(c._logEvent=jf());function v(){return Xr(this.level,this)}function R(){return this._level}function h(b){if(b!=="silent"&&!this.levels.values[b])throw Error("unknown level "+b);this._level=b,Bn(this,g,c,"error"),Bn(this,g,c,"fatal"),Bn(this,g,c,"warn"),Bn(this,g,c,"info"),Bn(this,g,c,"debug"),Bn(this,g,c,"trace"),a.forEach(x=>{Bn(this,g,c,x)})}function y(b,x,I){if(!x)throw new Error("missing bindings for child Pino");I=I||{},o&&x.serializers&&(I.serializers=x.serializers);let N=I.serializers;if(o&&N){var _=Object.assign({},n,N),P=e.browser.serialize===!0?Object.keys(_):o;delete x.serializers,Vf([x],P,_,this._stdErrSerialize)}function w(k){this._childLevel=(k._childLevel|0)+1,this.bindings=x,_&&(this.serializers=_,this._serialize=P),t&&(this._logEvent=jf([].concat(k._logEvent.bindings,x)))}w.prototype=this;let O=new w(this);return AA(this,O),O.child=function(...k){return y.call(this,b,...k)},O.level=I.level||this.level,b.onChild(O),O}return c}function tN(e){let t=e.customLevels||{},r=Object.assign({},Ar.levels.values,t),n=Object.assign({},Ar.levels.labels,rN(t));return{values:r,labels:n}}function rN(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}Ar.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Ar.stdSerializers=XP;Ar.stdTimeFunctions=Object.assign({},{nullTime:CA,epochTime:EA,unixTime:uN,isoTime:lN});function nN(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[qf];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Bn(e,t,r,n){if(Object.defineProperty(e,n,{value:Xr(e.level,r)>Xr(n,r)?ri:r[Uf][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===ri){if(!t.transmit)return;let i=t.transmit.level||e.level,a=Xr(i,r);if(Xr(n,r)<a)return}e[n]=iN(e,t,r,n);let o=nN(e);o.length!==0&&(e[n]=oN(o,e[n]))}function oN(e,t){return function(){return t.apply(this,[...e,...arguments])}}function iN(e,t,r,n){return function(o){return function(){let a=t.timestamp(),s=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Aa?Aa:this;for(var c=0;c<s.length;c++)s[c]=arguments[c];var g=!1;if(t.serialize&&(Vf(s,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let v=aN(this,n,s,a,t);if(t.reportCaller&&v&&v.length>0&&v[0]&&typeof v[0]=="object")try{let R=xA();R&&(v[0].caller=R)}catch{}o.call(u,...v)}else{if(t.reportCaller)try{let v=xA();v&&s.push(v)}catch{}o.apply(u,s)}if(t.transmit){let v=t.transmit.level||e._level,R=Xr(v,r),h=Xr(n,r);if(h<R)return;sN(this,{ts:a,methodLevel:n,methodValue:h,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Xr(e._level,r)},s,g)}}}(e[Uf][n])}function aN(e,t,r,n,o){let{level:i,log:a=v=>v}=o.formatters||{},s=r.slice(),u=s[0],c={},g=(e._childLevel|0)+1;if(g<1&&(g=1),n&&(c.time=n),i){let v=i(t,e.levels.values[t]);Object.assign(c,v)}else c.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(u!==null&&typeof u=="object")for(;g--&&typeof s[0]=="object";)Object.assign(c,s.shift());return[a(c),...s]}else{if(u!==null&&typeof u=="object"){for(;g--&&typeof s[0]=="object";)Object.assign(c,s.shift());u=s.length?bA(s.shift(),s):void 0}else typeof u=="string"&&(u=bA(s.shift(),s));return u!==void 0&&(c[o.messageKey]=u),[a(c)]}}function Vf(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=Ar.stdSerializers.err(e[o]);else if(typeof e[o]=="object"&&!Array.isArray(e[o])&&t)for(let i in e[o])t.indexOf(i)>-1&&i in r&&(e[o][i]=r[i](e[o][i]))}function sN(e,t,r,n=!1){let o=t.send,i=t.ts,a=t.methodLevel,s=t.methodValue,u=t.val,c=e._logEvent.bindings;n||Vf(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter(function(g){return c.indexOf(g)===-1}),e._logEvent.level.label=a,e._logEvent.level.value=s,o(a,e._logEvent,u),e._logEvent=jf(c)}function jf(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function wA(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let r in e)t[r]===void 0&&(t[r]=e[r]);return t}function cN(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?CA:EA}function ul(){return{}}function Lf(e){return e}function ri(){}function CA(){return!1}function EA(){return Date.now()}function uN(){return Math.round(Date.now()/1e3)}function lN(){return new Date(Date.now()).toISOString()}function dN(){function e(t){return typeof t<"u"&&t}try{return typeof A<"u"?A:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),A)}catch{return e(self)||e(window)||e(this)||{}}}ll.exports.default=Ar;ll.exports.pino=Ar;function xA(){let e=new Error().stack;if(!e)return null;let t=e.split(`
|
|
20
|
-
`);for(let r=1;r<t.length;r++){let n=t[r].trim();if(/(^at\s+)?(createWrap|LOG|set\s*\(|asObject|Object\.apply|Function\.apply)/.test(n)||n.indexOf("browser.js")!==-1||n.indexOf("node:internal")!==-1||n.indexOf("node_modules")!==-1)continue;let o=n.match(/\((.*?):(\d+):(\d+)\)/);if(o||(o=n.match(/at\s+(.*?):(\d+):(\d+)/)),o){let i=o[1],a=o[2],s=o[3];return i+":"+a+":"+s}}return null}});var dF={};ui(dF,{DefaultFieldsToInclude:()=>
|
|
17
|
+
*/(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessRecommendation",["crypto"],function(_d_0){var d={"crypto":_d_0},r=function(m){if(m in d)return d[m];if(typeof require=="function")return require(m);throw new Error("Cannot find module '"+m+"'")};return f(r)})}else{var gN={"crypto":"crypto"},gReq=function(r){var mod=r in gN?g[gN[r]]:g[r];return mod};g["CoveoHeadlessRecommendation"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var Sw=Object.create;var ci=Object.defineProperty;var bw=Object.getOwnPropertyDescriptor;var Aw=Object.getOwnPropertyNames;var ww=Object.getPrototypeOf,xw=Object.prototype.hasOwnProperty;var Cw=(e,t,r)=>t in e?ci(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var zn=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var Ze=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},ui=(e,t)=>{for(var r in t)ci(e,r,{get:t[r],enumerable:!0})},Kf=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Aw(t))!xw.call(e,o)&&o!==r&&ci(e,o,{get:()=>t[o],enumerable:!(n=bw(t,o))||n.enumerable});return e};var jt=(e,t,r)=>(r=e!=null?Sw(ww(e)):{},Kf(t||!e||!e.__esModule?ci(r,"default",{value:e,enumerable:!0}):r,e)),Ew=e=>Kf(ci({},"__esModule",{value:!0}),e);var ue=(e,t,r)=>Cw(e,typeof t!="symbol"?t+"":t,r);var A,d=zn(()=>{"use strict";A=typeof globalThis<"u"?globalThis:window});function Ra(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ra=function(t){return typeof t}:Ra=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ra(e)}function Tw(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=_w.bind(this))}function _w(e,t){var r=this.event&&this.event.type,n=r==="unload"||r==="beforeunload",o="XMLHttpRequest"in this?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");o.open("POST",e,!n),o.withCredentials=!0,o.setRequestHeader("Accept","*/*"),Rw(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):Iw(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var Rw,Iw,p=zn(()=>{"use strict";Rw=function(t){return typeof t=="string"},Iw=function(t){return t instanceof Blob};Tw.call((typeof window>"u"?"undefined":Ra(window))==="object"?window:{})});var _l=Ze(li=>{"use strict";m();d();f();p();Object.defineProperty(li,"__esModule",{value:!0});function Yf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function kw(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ow(e,t,r){return t=Wn(t),Nw(e,em()?Reflect.construct(t,r||[],Wn(e).constructor):t.apply(e,r))}function Rl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xf(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Lw(n.key),n)}}function Il(e,t,r){return t&&Xf(e.prototype,t),r&&Xf(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Zf(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=qw(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
18
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return a=u.done,u},e:function(u){s=!0,i=u},f:function(){try{a||r.return==null||r.return()}finally{if(s)throw i}}}}function Cl(){return Cl=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=Fw(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Cl.apply(null,arguments)}function Wn(e){return Wn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wn(e)}function Pw(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&El(e,t)}function em(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(em=function(){return!!e})()}function Nw(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kw(e)}function El(e,t){return El=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},El(e,t)}function Fw(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Wn(e))!==null;);return e}function Dw(e,t,r,n){var o=Cl(Wn(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function Mw(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Lw(e){var t=Mw(e,"string");return typeof t=="symbol"?t:t+""}function qw(e,t){if(e){if(typeof e=="string")return Yf(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Yf(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function jw(e){var t;try{t=new Event("abort")}catch{typeof document<"u"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}return t.reason=e,t}function Uw(e){if(e===void 0)if(typeof document>"u")e=new Error("This operation was aborted"),e.name="AbortError";else try{e=new DOMException("signal is aborted without reason"),Object.defineProperty(e,"name",{value:"AbortError"})}catch{e=new Error("This operation was aborted"),e.name="AbortError"}return e}var Jf=function(){function e(){Rl(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Il(e,[{key:"addEventListener",value:function(r,n,o){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:o})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var o=this.listeners[r],i=0,a=o.length;i<a;i++)if(o[i].callback===n){o.splice(i,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var o=this.listeners[r.type],i=o.slice(),a=function(){var g=i[s];try{g.callback.call(n,r)}catch(v){Promise.resolve().then(function(){throw v})}g.options&&g.options.once&&n.removeEventListener(r.type,g.callback)},s=0,u=i.length;s<u;s++)a();return!r.defaultPrevented}}}])}(),Tl=function(e){function t(){var r;return Rl(this,t),r=Ow(this,t),r.listeners||Jf.call(r),Object.defineProperty(r,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(r,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(r,"reason",{value:void 0,writable:!0,configurable:!0}),r}return Pw(t,e),Il(t,[{key:"toString",value:function(){return"[object AbortSignal]"}},{key:"dispatchEvent",value:function(n){n.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,n)),Dw(t,"dispatchEvent",this,3)([n])}},{key:"throwIfAborted",value:function(){var n=this.aborted,o=this.reason,i=o===void 0?"Aborted":o;if(n)throw i}}],[{key:"timeout",value:function(n){var o=new Ia;return setTimeout(function(){return o.abort(new DOMException("This signal is timeout in ".concat(n,"ms"),"TimeoutError"))},n),o.signal}},{key:"any",value:function(n){var o=new Ia;function i(){o.abort(this.reason),a()}function a(){var g=Zf(n),v;try{for(g.s();!(v=g.n()).done;){var R=v.value;R.removeEventListener("abort",i)}}catch(h){g.e(h)}finally{g.f()}}var s=Zf(n),u;try{for(s.s();!(u=s.n()).done;){var c=u.value;if(c.aborted){o.abort(c.reason);break}else c.addEventListener("abort",i)}}catch(g){s.e(g)}finally{s.f()}return o.signal}}])}(Jf),Ia=function(){function e(){Rl(this,e),Object.defineProperty(this,"signal",{value:new Tl,writable:!0,configurable:!0})}return Il(e,[{key:"abort",value:function(r){var n=Uw(r),o=jw(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Ia.prototype[Symbol.toStringTag]="AbortController",Tl.prototype[Symbol.toStringTag]="AbortSignal");function Vw(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function Gw(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,o=n===void 0?r.Request:n,i=t.AbortController,a=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,s=a===void 0?!1:a;if(!Vw({fetch:r,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s}))return{fetch:r,Request:u};var u=o;(u&&!u.prototype.hasOwnProperty("signal")||s)&&(u=function(R,h){var y;h&&h.signal&&(y=h.signal,delete h.signal);var b=new o(R,h);return y&&Object.defineProperty(b,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),b},u.prototype=o.prototype);var c=r,g=function(R,h){var y=u&&u.prototype.isPrototypeOf(R)?R.signal:h?h.signal:void 0;if(y){var b;try{b=new DOMException("Aborted","AbortError")}catch{b=new Error("Aborted"),b.name="AbortError"}if(y.aborted)return Promise.reject(b);var x=new Promise(function(I,N){y.addEventListener("abort",function(){return N(b)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([x,c(R,h)])}return c(R,h)};return{fetch:g,Request:u}}li.AbortController=Ia;li.AbortSignal=Tl;li.abortableFetch=Gw});var tm,l,C,f=zn(()=>{"use strict";tm=jt(_l(),1),l=jt(_l(),1),{fetch:C}=(0,tm.abortableFetch)({fetch})});function rm(e){return typeof e!="string"||e in{}}function kl(){return Object.create(null)}function im(e){return typeof e=="string"&&!!e.trim()}function Ol(e,t){var r=e.split(";").filter(im),n=r.shift();if(!n)return null;var o=Bw(n),i=o.name,a=o.value;if(t=t?Object.assign({},Ta,t):Ta,rm(i))return t.silent||console.warn("set-cookie-parser: dropping cookie due to name:",i),null;try{a=t.decodeValues?decodeURIComponent(a):a}catch(u){t.silent||console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",u)}var s=kl();return s.name=i,s.value=a,r.forEach(function(u){var c=u.split("="),g=c.shift().trim().toLowerCase();if(rm(g)||g==="name"||g==="value"){t.silent||console.warn("set-cookie-parser: ignoring attribute:",u);return}var v=c.join("=").trim();if(g==="expires"){var R=new Date(v);Number.isNaN(R.getTime())?t.silent||console.error("set-cookie-parser: failed to parse expires time:",v):s.expires=R}else g==="max-age"?/^-?\d+$/.test(v)?s.maxAge=parseInt(v,10):t.silent||console.error("set-cookie-parser: failed to parse max-age:",v):g==="secure"?s.secure=!0:g==="httponly"?s.httpOnly=!0:g==="samesite"?s.sameSite=v:g==="partitioned"?s.partitioned=!0:g&&(s[g]=v)}),s}function Bw(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:nm(t),value:nm(r)}}function nm(e){for(var t=0,r=e.length;t<r&&om(e.charCodeAt(t));)t+=1;for(;r>t&&om(e.charCodeAt(r-1));)r-=1;return e.substring(t,r)}function om(e){return e===32||e===9}function Kn(e,t){if(t=t?Object.assign({},Ta,t):Ta,!e)return t.map?kl():[];if(e.headers)if(typeof e.headers.getSetCookie=="function")e=e.headers.getSetCookie();else if(e.headers["set-cookie"])e=e.headers["set-cookie"];else{var r=e.headers[Object.keys(e.headers).find(function(a){return a.toLowerCase()==="set-cookie"})];!r&&e.headers.cookie&&!t.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests."),e=r}var n=t.split,o=Array.isArray(e);if(n==="auto"&&(n=!o),o||(e=[e]),e=e.filter(im),n&&(e=e.map(_a).flat()),t.map){var i=kl();return e.reduce(function(a,s){var u=Ol(s,t);return u&&(a[u.name]=u),a},i)}else return e.map(function(a){return Ol(a,t)}).filter(Boolean)}function _a(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,i,a,s;function u(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function c(){return o=e.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<e.length;){for(n=r,s=!1;u();)if(o=e.charAt(r),o===","){for(i=r,r+=1,u(),a=r;r<e.length&&c();)r+=1;r<e.length&&e.charAt(r)==="="?(s=!0,r=a,t.push(e.substring(n,i)),n=r):r=i+1}else r+=1;(!s||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var Ta,am=zn(()=>{"use strict";m();d();f();p();Ta={decodeValues:!0,map:!1,silent:!1,split:"auto"};Kn.parseSetCookie=Kn;Kn.parse=Kn;Kn.parseString=Ol;Kn.splitCookiesString=_a});function di(e){if($w.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Pl(e){return e.replace(Qw,"")}function pi(e){if(typeof e!="string"||e.length===0)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>127||!Hw(r))return!1}return!0}function Hw(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function cm(e){if(typeof e!="string"||e.trim()!==e)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r===0||r===10||r===13)return!1}return!0}var $w,sm,Qw,um,Yn,Nl,lm,E,pm=zn(()=>{"use strict";m();d();f();p();am();$w=/[^a-z0-9\-#$%&'*+.^_`|~]/i;sm=[`
|
|
19
|
+
`,"\r","\t"," "],Qw=new RegExp(`(^[${sm.join("")}]|$[${sm.join("")}])`,"g");Yn=Symbol("normalizedHeaders"),Nl=Symbol("rawHeaderNames"),lm=", ",E=class dm{constructor(t){this[Yn]={},this[Nl]=new Map,this[um]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof dm||typeof A.Headers<"u"&&t instanceof A.Headers?t.forEach((r,n)=>{this.append(n,r)},this):Array.isArray(t)?t.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(lm):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(lm):n)})}[(um=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}*keys(){for(let[t]of this.entries())yield t}*values(){for(let[,t]of this.entries())yield t}*entries(){let t=Object.keys(this[Yn]).sort((r,n)=>r.localeCompare(n));for(let r of t)if(r==="set-cookie")for(let n of this.getSetCookie())yield[r,n];else yield[r,this.get(r)]}has(t){if(!pi(t))throw new TypeError(`Invalid header name "${t}"`);return this[Yn].hasOwnProperty(di(t))}get(t){if(!pi(t))throw TypeError(`Invalid header name "${t}"`);return this[Yn][di(t)]??null}set(t,r){if(!pi(t)||!cm(r))return;let n=di(t),o=Pl(r);this[Yn][n]=Pl(o),this[Nl].set(n,t)}append(t,r){if(!pi(t)||!cm(r))return;let n=di(t),o=Pl(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!pi(t)||!this.has(t))return;let r=di(t);delete this[Yn][r],this[Nl].delete(r)}forEach(t,r){for(let[n,o]of this.entries())t.call(r,o,n,this)}getSetCookie(){let t=this.get("set-cookie");return t===null?[]:t===""?[""]:_a(t)}}});var m=zn(()=>{"use strict";pm()});var Sm=Ze(gi=>{"use strict";m();d();f();p();var Na=gi&&gi.__assign||function(){return Na=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Na.apply(this,arguments)};Object.defineProperty(gi,"__esModule",{value:!0});var tx={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function rx(e){var t=Na(Na({},tx),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}gi.getSanitizedOptions=rx});var bm=Ze(ql=>{"use strict";m();d();f();p();Object.defineProperty(ql,"__esModule",{value:!0});function nx(e){var t=Math.random()*e;return Math.round(t)}ql.fullJitter=nx});var Am=Ze(jl=>{"use strict";m();d();f();p();Object.defineProperty(jl,"__esModule",{value:!0});function ox(e){return e}jl.noJitter=ox});var wm=Ze(Ul=>{"use strict";m();d();f();p();Object.defineProperty(Ul,"__esModule",{value:!0});var ix=bm(),ax=Am();function sx(e){return e.jitter==="full"?ix.fullJitter:ax.noJitter}Ul.JitterFactory=sx});var Gl=Ze(Vl=>{"use strict";m();d();f();p();Object.defineProperty(Vl,"__esModule",{value:!0});var cx=wm(),ux=function(){function e(t){this.options=t,this.attempt=0}return e.prototype.apply=function(){var t=this;return new Promise(function(r){return setTimeout(r,t.jitteredDelay)})},e.prototype.setAttemptNumber=function(t){this.attempt=t},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){var t=cx.JitterFactory(this.options);return t(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var t=this.options.startingDelay,r=this.options.timeMultiple,n=this.numOfDelayedAttempts,o=t*Math.pow(r,n);return Math.min(o,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();Vl.Delay=ux});var xm=Ze(ar=>{"use strict";m();d();f();p();var lx=ar&&ar.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),dx=ar&&ar.__awaiter||function(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 s(g){try{c(n.next(g))}catch(v){a(v)}}function u(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})},px=ar&&ar.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(ar,"__esModule",{value:!0});var fx=Gl(),mx=function(e){lx(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return dx(this,void 0,void 0,function(){return px(this,function(r){return[2,this.isFirstAttempt?!0:e.prototype.apply.call(this)]})})},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return this.attempt===0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(fx.Delay);ar.SkipFirstDelay=mx});var Cm=Ze(hi=>{"use strict";m();d();f();p();var gx=hi&&hi.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(hi,"__esModule",{value:!0});var hx=Gl(),yx=function(e){gx(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(hx.Delay);hi.AlwaysDelay=yx});var Em=Ze(Bl=>{"use strict";m();d();f();p();Object.defineProperty(Bl,"__esModule",{value:!0});var vx=xm(),Sx=Cm();function bx(e,t){var r=Ax(e);return r.setAttemptNumber(t),r}Bl.DelayFactory=bx;function Ax(e){return e.delayFirstAttempt?new Sx.AlwaysDelay(e):new vx.SkipFirstDelay(e)}});var Rm=Ze(en=>{"use strict";m();d();f();p();var $l=en&&en.__awaiter||function(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 s(g){try{c(n.next(g))}catch(v){a(v)}}function u(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})},Ql=en&&en.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(en,"__esModule",{value:!0});var wx=Sm(),xx=Em();function Cx(e,t){return t===void 0&&(t={}),$l(this,void 0,void 0,function(){var r,n;return Ql(this,function(o){switch(o.label){case 0:return r=wx.getSanitizedOptions(t),n=new Ex(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}en.backOff=Cx;var Ex=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return $l(this,void 0,void 0,function(){var t,r;return Ql(this,function(n){switch(n.label){case 0:if(this.attemptLimitReached)return[3,7];n.label=1;case 1:return n.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return n.sent(),[4,this.request()];case 3:return[2,n.sent()];case 4:return t=n.sent(),this.attemptNumber++,[4,this.options.retry(t,this.attemptNumber)];case 5:if(r=n.sent(),!r||this.attemptLimitReached)throw t;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}})})},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return $l(this,void 0,void 0,function(){var t;return Ql(this,function(r){switch(r.label){case 0:return t=xx.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var oc=Ze((gp,hp)=>{"use strict";m();d();f();p();(function(e,t){typeof gp=="object"&&typeof hp<"u"?hp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs=t()})(gp,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",u="week",c="month",g="quarter",v="year",R="date",h="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,x={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(q){var B=["th","st","nd","rd"],j=q%100;return"["+q+(B[(j-20)%10]||B[j]||B[0])+"]"}},I=function(q,B,j){var W=String(q);return!W||W.length>=B?q:""+Array(B+1-W.length).join(j)+q},N={s:I,z:function(q){var B=-q.utcOffset(),j=Math.abs(B),W=Math.floor(j/60),Q=j%60;return(B<=0?"+":"-")+I(W,2,"0")+":"+I(Q,2,"0")},m:function q(B,j){if(B.date()<j.date())return-q(j,B);var W=12*(j.year()-B.year())+(j.month()-B.month()),Q=B.clone().add(W,c),X=j-Q<0,z=B.clone().add(W+(X?-1:1),c);return+(-(W+(j-Q)/(X?Q-z:z-Q))||0)},a:function(q){return q<0?Math.ceil(q)||0:Math.floor(q)},p:function(q){return{M:c,y:v,w:u,d:s,D:R,h:a,m:i,s:o,ms:n,Q:g}[q]||String(q||"").toLowerCase().replace(/s$/,"")},u:function(q){return q===void 0}},_="en",P={};P[_]=x;var w="$isDayjsObject",O=function(q){return q instanceof G||!(!q||!q[w])},k=function q(B,j,W){var Q;if(!B)return _;if(typeof B=="string"){var X=B.toLowerCase();P[X]&&(Q=X),j&&(P[X]=j,Q=X);var z=B.split("-");if(!Q&&z.length>1)return q(z[0])}else{var Z=B.name;P[Z]=B,Q=Z}return!W&&Q&&(_=Q),Q||!W&&_},T=function(q,B){if(O(q))return q.clone();var j=typeof B=="object"?B:{};return j.date=q,j.args=arguments,new G(j)},D=N;D.l=k,D.i=O,D.w=function(q,B){return T(q,{locale:B.$L,utc:B.$u,x:B.$x,$offset:B.$offset})};var G=function(){function q(j){this.$L=k(j.locale,null,!0),this.parse(j),this.$x=this.$x||j.x||{},this[w]=!0}var B=q.prototype;return B.parse=function(j){this.$d=function(W){var Q=W.date,X=W.utc;if(Q===null)return new Date(NaN);if(D.u(Q))return new Date;if(Q instanceof Date)return new Date(Q);if(typeof Q=="string"&&!/Z$/i.test(Q)){var z=Q.match(y);if(z){var Z=z[2]-1||0,se=(z[7]||"0").substring(0,3);return X?new Date(Date.UTC(z[1],Z,z[3]||1,z[4]||0,z[5]||0,z[6]||0,se)):new Date(z[1],Z,z[3]||1,z[4]||0,z[5]||0,z[6]||0,se)}}return new Date(Q)}(j),this.init()},B.init=function(){var j=this.$d;this.$y=j.getFullYear(),this.$M=j.getMonth(),this.$D=j.getDate(),this.$W=j.getDay(),this.$H=j.getHours(),this.$m=j.getMinutes(),this.$s=j.getSeconds(),this.$ms=j.getMilliseconds()},B.$utils=function(){return D},B.isValid=function(){return this.$d.toString()!==h},B.isSame=function(j,W){var Q=T(j);return this.startOf(W)<=Q&&Q<=this.endOf(W)},B.isAfter=function(j,W){return T(j)<this.startOf(W)},B.isBefore=function(j,W){return this.endOf(W)<T(j)},B.$g=function(j,W,Q){return D.u(j)?this[W]:this.set(Q,j)},B.unix=function(){return Math.floor(this.valueOf()/1e3)},B.valueOf=function(){return this.$d.getTime()},B.startOf=function(j,W){var Q=this,X=!!D.u(W)||W,z=D.p(j),Z=function(ve,me){var we=D.w(Q.$u?Date.UTC(Q.$y,me,ve):new Date(Q.$y,me,ve),Q);return X?we:we.endOf(s)},se=function(ve,me){return D.w(Q.toDate()[ve].apply(Q.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(me)),Q)},ye=this.$W,_e=this.$M,Ge=this.$D,Fe="set"+(this.$u?"UTC":"");switch(z){case v:return X?Z(1,0):Z(31,11);case c:return X?Z(1,_e):Z(0,_e+1);case u:var Me=this.$locale().weekStart||0,Le=(ye<Me?ye+7:ye)-Me;return Z(X?Ge-Le:Ge+(6-Le),_e);case s:case R:return se(Fe+"Hours",0);case a:return se(Fe+"Minutes",1);case i:return se(Fe+"Seconds",2);case o:return se(Fe+"Milliseconds",3);default:return this.clone()}},B.endOf=function(j){return this.startOf(j,!1)},B.$set=function(j,W){var Q,X=D.p(j),z="set"+(this.$u?"UTC":""),Z=(Q={},Q[s]=z+"Date",Q[R]=z+"Date",Q[c]=z+"Month",Q[v]=z+"FullYear",Q[a]=z+"Hours",Q[i]=z+"Minutes",Q[o]=z+"Seconds",Q[n]=z+"Milliseconds",Q)[X],se=X===s?this.$D+(W-this.$W):W;if(X===c||X===v){var ye=this.clone().set(R,1);ye.$d[Z](se),ye.init(),this.$d=ye.set(R,Math.min(this.$D,ye.daysInMonth())).$d}else Z&&this.$d[Z](se);return this.init(),this},B.set=function(j,W){return this.clone().$set(j,W)},B.get=function(j){return this[D.p(j)]()},B.add=function(j,W){var Q,X=this;j=Number(j);var z=D.p(W),Z=function(_e){var Ge=T(X);return D.w(Ge.date(Ge.date()+Math.round(_e*j)),X)};if(z===c)return this.set(c,this.$M+j);if(z===v)return this.set(v,this.$y+j);if(z===s)return Z(1);if(z===u)return Z(7);var se=(Q={},Q[i]=t,Q[a]=r,Q[o]=e,Q)[z]||1,ye=this.$d.getTime()+j*se;return D.w(ye,this)},B.subtract=function(j,W){return this.add(-1*j,W)},B.format=function(j){var W=this,Q=this.$locale();if(!this.isValid())return Q.invalidDate||h;var X=j||"YYYY-MM-DDTHH:mm:ssZ",z=D.z(this),Z=this.$H,se=this.$m,ye=this.$M,_e=Q.weekdays,Ge=Q.months,Fe=Q.meridiem,Me=function(me,we,Se,He){return me&&(me[we]||me(W,X))||Se[we].slice(0,He)},Le=function(me){return D.s(Z%12||12,me,"0")},ve=Fe||function(me,we,Se){var He=me<12?"AM":"PM";return Se?He.toLowerCase():He};return X.replace(b,function(me,we){return we||function(Se){switch(Se){case"YY":return String(W.$y).slice(-2);case"YYYY":return D.s(W.$y,4,"0");case"M":return ye+1;case"MM":return D.s(ye+1,2,"0");case"MMM":return Me(Q.monthsShort,ye,Ge,3);case"MMMM":return Me(Ge,ye);case"D":return W.$D;case"DD":return D.s(W.$D,2,"0");case"d":return String(W.$W);case"dd":return Me(Q.weekdaysMin,W.$W,_e,2);case"ddd":return Me(Q.weekdaysShort,W.$W,_e,3);case"dddd":return _e[W.$W];case"H":return String(Z);case"HH":return D.s(Z,2,"0");case"h":return Le(1);case"hh":return Le(2);case"a":return ve(Z,se,!0);case"A":return ve(Z,se,!1);case"m":return String(se);case"mm":return D.s(se,2,"0");case"s":return String(W.$s);case"ss":return D.s(W.$s,2,"0");case"SSS":return D.s(W.$ms,3,"0");case"Z":return z}return null}(me)||z.replace(":","")})},B.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},B.diff=function(j,W,Q){var X,z=this,Z=D.p(W),se=T(j),ye=(se.utcOffset()-this.utcOffset())*t,_e=this-se,Ge=function(){return D.m(z,se)};switch(Z){case v:X=Ge()/12;break;case c:X=Ge();break;case g:X=Ge()/3;break;case u:X=(_e-ye)/6048e5;break;case s:X=(_e-ye)/864e5;break;case a:X=_e/r;break;case i:X=_e/t;break;case o:X=_e/e;break;default:X=_e}return Q?X:D.a(X)},B.daysInMonth=function(){return this.endOf(c).$D},B.$locale=function(){return P[this.$L]},B.locale=function(j,W){if(!j)return this.$L;var Q=this.clone(),X=k(j,W,!0);return X&&(Q.$L=X),Q},B.clone=function(){return D.w(this.$d,this)},B.toDate=function(){return new Date(this.valueOf())},B.toJSON=function(){return this.isValid()?this.toISOString():null},B.toISOString=function(){return this.$d.toISOString()},B.toString=function(){return this.$d.toUTCString()},q}(),M=G.prototype;return T.prototype=M,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",c],["$y",v],["$D",R]].forEach(function(q){M[q[1]]=function(B){return this.$g(B,q[0],q[1])}}),T.extend=function(q,B){return q.$i||(q(B,G,T),q.$i=!0),T},T.locale=k,T.isDayjs=O,T.unix=function(q){return T(1e3*q)},T.en=P[_],T.Ls=P,T.p={},T})});var Ry=Ze((yp,vp)=>{"use strict";m();d();f();p();(function(e,t){typeof yp=="object"&&typeof vp<"u"?vp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_quarterOfYear=t()})(yp,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(s){return this.$utils().u(s)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(s-1))};var i=o.add;o.add=function(s,u){return s=Number(s),this.$utils().p(u)===t?this.add(3*s,e):i.bind(this)(s,u)};var a=o.startOf;o.startOf=function(s,u){var c=this.$utils(),g=!!c.u(u)||u;if(c.p(s)===t){var v=this.quarter()-1;return g?this.month(3*v).startOf(e).startOf("day"):this.month(3*v+2).endOf(e).endOf("day")}return a.bind(this)(s,u)}}})});var Iy=Ze((Sp,bp)=>{"use strict";m();d();f();p();(function(e,t){typeof Sp=="object"&&typeof bp<"u"?bp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_customParseFormat=t()})(Sp,function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,o=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,a={},s=function(y){return(y=+y)+(y>68?1900:2e3)},u=function(y){return function(b){this[y]=+b}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(b){if(!b||b==="Z")return 0;var x=b.match(/([+-]|\d\d)/g),I=60*x[1]+(+x[2]||0);return I===0?0:x[0]==="+"?-I:I}(y)}],g=function(y){var b=a[y];return b&&(b.indexOf?b:b.s.concat(b.f))},v=function(y,b){var x,I=a.meridiem;if(I){for(var N=1;N<=24;N+=1)if(y.indexOf(I(N,0,b))>-1){x=N>12;break}}else x=y===(b?"pm":"PM");return x},R={A:[i,function(y){this.afternoon=v(y,!1)}],a:[i,function(y){this.afternoon=v(y,!0)}],Q:[r,function(y){this.month=3*(y-1)+1}],S:[r,function(y){this.milliseconds=100*+y}],SS:[n,function(y){this.milliseconds=10*+y}],SSS:[/\d{3}/,function(y){this.milliseconds=+y}],s:[o,u("seconds")],ss:[o,u("seconds")],m:[o,u("minutes")],mm:[o,u("minutes")],H:[o,u("hours")],h:[o,u("hours")],HH:[o,u("hours")],hh:[o,u("hours")],D:[o,u("day")],DD:[n,u("day")],Do:[i,function(y){var b=a.ordinal,x=y.match(/\d+/);if(this.day=x[0],b)for(var I=1;I<=31;I+=1)b(I).replace(/\[|\]/g,"")===y&&(this.day=I)}],w:[o,u("week")],ww:[n,u("week")],M:[o,u("month")],MM:[n,u("month")],MMM:[i,function(y){var b=g("months"),x=(g("monthsShort")||b.map(function(I){return I.slice(0,3)})).indexOf(y)+1;if(x<1)throw new Error;this.month=x%12||x}],MMMM:[i,function(y){var b=g("months").indexOf(y)+1;if(b<1)throw new Error;this.month=b%12||b}],Y:[/[+-]?\d+/,u("year")],YY:[n,function(y){this.year=s(y)}],YYYY:[/\d{4}/,u("year")],Z:c,ZZ:c};function h(y){var b,x;b=y,x=a&&a.formats;for(var I=(y=b.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(T,D,G){var M=G&&G.toUpperCase();return D||x[G]||e[G]||x[M].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(q,B,j){return B||j.slice(1)})})).match(t),N=I.length,_=0;_<N;_+=1){var P=I[_],w=R[P],O=w&&w[0],k=w&&w[1];I[_]=k?{regex:O,parser:k}:P.replace(/^\[|\]$/g,"")}return function(T){for(var D={},G=0,M=0;G<N;G+=1){var q=I[G];if(typeof q=="string")M+=q.length;else{var B=q.regex,j=q.parser,W=T.slice(M),Q=B.exec(W)[0];j.call(D,Q),T=T.replace(Q,"")}}return function(X){var z=X.afternoon;if(z!==void 0){var Z=X.hours;z?Z<12&&(X.hours+=12):Z===12&&(X.hours=0),delete X.afternoon}}(D),D}}return function(y,b,x){x.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(s=y.parseTwoDigitYear);var I=b.prototype,N=I.parse;I.parse=function(_){var P=_.date,w=_.utc,O=_.args;this.$u=w;var k=O[1];if(typeof k=="string"){var T=O[2]===!0,D=O[3]===!0,G=T||D,M=O[2];D&&(M=O[2]),a=this.$locale(),!T&&M&&(a=x.Ls[M]),this.$d=function(W,Q,X,z){try{if(["x","X"].indexOf(Q)>-1)return new Date((Q==="X"?1e3:1)*W);var Z=h(Q)(W),se=Z.year,ye=Z.month,_e=Z.day,Ge=Z.hours,Fe=Z.minutes,Me=Z.seconds,Le=Z.milliseconds,ve=Z.zone,me=Z.week,we=new Date,Se=_e||(se||ye?1:we.getDate()),He=se||we.getFullYear(),Ye=0;se&&!ye||(Ye=ye>0?ye-1:we.getMonth());var Tt,xt=Ge||0,qt=Fe||0,_t=Me||0,ir=Le||0;return ve?new Date(Date.UTC(He,Ye,Se,xt,qt,_t,ir+60*ve.offset*1e3)):X?new Date(Date.UTC(He,Ye,Se,xt,qt,_t,ir)):(Tt=new Date(He,Ye,Se,xt,qt,_t,ir),me&&(Tt=z(Tt).week(me).toDate()),Tt)}catch{return new Date("")}}(P,k,w,x),this.init(),M&&M!==!0&&(this.$L=this.locale(M).$L),G&&P!=this.format(k)&&(this.$d=new Date("")),a={}}else if(k instanceof Array)for(var q=k.length,B=1;B<=q;B+=1){O[1]=k[B-1];var j=x.apply(this,O);if(j.isValid()){this.$d=j.$d,this.$L=j.$L,this.init();break}B===q&&(this.$d=new Date(""))}else N.call(this,_)}}})});var xv=Ze((Dp,Mp)=>{"use strict";m();d();f();p();(function(e,t){typeof Dp=="object"&&typeof Mp<"u"?Mp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_timezone=t()})(Dp,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,o){var i,a=function(g,v,R){R===void 0&&(R={});var h=new Date(g),y=function(b,x){x===void 0&&(x={});var I=x.timeZoneName||"short",N=b+"|"+I,_=t[N];return _||(_=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:b,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:I}),t[N]=_),_}(v,R);return y.formatToParts(h)},s=function(g,v){for(var R=a(g,v),h=[],y=0;y<R.length;y+=1){var b=R[y],x=b.type,I=b.value,N=e[x];N>=0&&(h[N]=parseInt(I,10))}var _=h[3],P=_===24?0:_,w=h[0]+"-"+h[1]+"-"+h[2]+" "+P+":"+h[4]+":"+h[5]+":000",O=+g;return(o.utc(w).valueOf()-(O-=O%1e3))/6e4},u=n.prototype;u.tz=function(g,v){if(g===void 0&&(g=i),!this.isValid())return this;var R,h=this.utcOffset(),y=this.toDate(),b=y.toLocaleString("en-US",{timeZone:g}),x=s(+y,g);if(!Number(x))R=this.utcOffset(0,v);else if(R=o(b,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(x,!0),v){var I=R.utcOffset();R=R.add(h-I,"minute")}return R.$x.$timezone=g,R},u.offsetName=function(g){var v=this.$x.$timezone||o.tz.guess(),R=a(this.valueOf(),v,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return R&&R.value};var c=u.startOf;u.startOf=function(g,v){if(!this.$x||!this.$x.$timezone)return c.call(this,g,v);var R=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return c.call(R,g,v).tz(this.$x.$timezone,!0)},o.tz=function(g,v,R){var h=R&&v,y=R||v||i,b=s(+o(),y);if(typeof g!="string")return o(g).tz(y);var x=o.utc(g,h).valueOf();if(Number.isNaN(x)){var I=o(NaN);return I.$x.$timezone=y,I}var N=function(O,k,T){var D=O-60*k*1e3,G=s(D,T);if(k===G)return[D,k];var M=s(D-=60*(G-k)*1e3,T);return G===M?[D,G]:[O-60*Math.min(G,M)*1e3,Math.max(G,M)]}(x,b,y),_=N[0],P=N[1],w=o(_).utcOffset(P);return w.$x.$timezone=y,w},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var Cv=Ze((Lp,qp)=>{"use strict";m();d();f();p();(function(e,t){typeof Lp=="object"&&typeof qp<"u"?qp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_utc=t()})(Lp,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,i){var a=o.prototype;i.utc=function(h){var y={date:h,utc:!0,args:arguments};return new o(y)},a.utc=function(h){var y=i(this.toDate(),{locale:this.$L,utc:!0});return h?y.add(this.utcOffset(),e):y},a.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var s=a.parse;a.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),s.call(this,h)};var u=a.init;a.init=function(){if(this.$u){var h=this.$d;this.$y=h.getUTCFullYear(),this.$M=h.getUTCMonth(),this.$D=h.getUTCDate(),this.$W=h.getUTCDay(),this.$H=h.getUTCHours(),this.$m=h.getUTCMinutes(),this.$s=h.getUTCSeconds(),this.$ms=h.getUTCMilliseconds()}else u.call(this)};var c=a.utcOffset;a.utcOffset=function(h,y){var b=this.$utils().u;if(b(h))return this.$u?0:b(this.$offset)?c.call(this):this.$offset;if(typeof h=="string"&&(h=function(_){_===void 0&&(_="");var P=_.match(t);if(!P)return null;var w=(""+P[0]).match(r)||["-",0,0],O=w[0],k=60*+w[1]+ +w[2];return k===0?0:O==="+"?k:-k}(h),h===null))return this;var x=Math.abs(h)<=16?60*h:h;if(x===0)return this.utc(y);var I=this.clone();if(y)return I.$offset=x,I.$u=!1,I;var N=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(I=this.local().add(x+N,e)).$offset=x,I.$x.$localOffset=N,I};var g=a.format;a.format=function(h){var y=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,y)},a.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},a.isUTC=function(){return!!this.$u},a.toISOString=function(){return this.toDate().toISOString()},a.toString=function(){return this.toDate().toUTCString()};var v=a.toDate;a.toDate=function(h){return h==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var R=a.diff;a.diff=function(h,y,b){if(h&&this.$u===h.$u)return R.call(this,h,y,b);var x=this.local(),I=i(h).local();return R.call(x,I,y,b)}}})});var SA=Ze((yle,vA)=>{"use strict";m();d();f();p();function KP(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}vA.exports=YP;function YP(e,t,r){var n=r&&r.stringify||KP,o=1;if(typeof e=="object"&&e!==null){var i=t.length+o;if(i===1)return e;var a=new Array(i);a[0]=n(e);for(var s=1;s<i;s++)a[s]=n(t[s]);return a.join(" ")}if(typeof e!="string")return e;var u=t.length;if(u===0)return e;for(var c="",g=1-o,v=-1,R=e&&e.length||0,h=0;h<R;){if(e.charCodeAt(h)===37&&h+1<R){switch(v=v>-1?v:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=u||t[g]==null)break;v<h&&(c+=e.slice(v,h)),c+=Number(t[g]),v=h+2,h++;break;case 105:if(g>=u||t[g]==null)break;v<h&&(c+=e.slice(v,h)),c+=Math.floor(Number(t[g])),v=h+2,h++;break;case 79:case 111:case 106:if(g>=u||t[g]===void 0)break;v<h&&(c+=e.slice(v,h));var y=typeof t[g];if(y==="string"){c+="'"+t[g]+"'",v=h+2,h++;break}if(y==="function"){c+=t[g].name||"<anonymous>",v=h+2,h++;break}c+=n(t[g]),v=h+2,h++;break;case 115:if(g>=u)break;v<h&&(c+=e.slice(v,h)),c+=String(t[g]),v=h+2,h++;break;case 37:v<h&&(c+=e.slice(v,h)),c+="%",v=h+2,h++,g--;break}++g}++h}return v===-1?e:(v<R&&(c+=e.slice(v)),c)}});var RA=Ze((wle,ll)=>{"use strict";m();d();f();p();var bA=SA();ll.exports=Ar;var Aa=dN().console||{},XP={mapHttpRequest:ul,mapHttpResponse:ul,wrapRequestSerializer:Mf,wrapResponseSerializer:Mf,wrapErrorSerializer:Mf,req:ul,res:ul,err:wA,errWithCause:wA};function Xr(e,t){return e==="silent"?1/0:t.levels.values[e]}var jf=Symbol("pino.logFuncs"),Lf=Symbol("pino.hierarchy"),ZP={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function AA(e,t){let r={logger:t,parent:e[Lf]};t[Lf]=r}function JP(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Aa[o]||Aa[ZP[o]||"log"]||ri}),e[jf]=n}function eN(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function Ar(e){e=e||{},e.browser=e.browser||{};let t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");let r=e.browser.write||Aa;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=eN(e.browser.serialize,n),i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);let a=Object.keys(e.customLevels||{}),s=["error","fatal","warn","info","debug","trace"].concat(a);typeof r=="function"&&s.forEach(function(b){r[b]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let u=e.level||"info",c=Object.create(r);c.log||(c.log=ri),JP(c,s,r),AA({},c),Object.defineProperty(c,"levelVal",{get:v}),Object.defineProperty(c,"level",{get:R,set:h});let g={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,reportCaller:e.browser.reportCaller,levels:s,timestamp:cN(e),messageKey:e.messageKey||"msg",onChild:e.onChild||ri};c.levels=tN(e),c.level=u,c.isLevelEnabled=function(b){return this.levels.values[b]?this.levels.values[b]>=this.levels.values[this.level]:!1},c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=ri,c.serializers=n,c._serialize=o,c._stdErrSerialize=i,c.child=function(...b){return y.call(this,g,...b)},t&&(c._logEvent=qf());function v(){return Xr(this.level,this)}function R(){return this._level}function h(b){if(b!=="silent"&&!this.levels.values[b])throw Error("unknown level "+b);this._level=b,Bn(this,g,c,"error"),Bn(this,g,c,"fatal"),Bn(this,g,c,"warn"),Bn(this,g,c,"info"),Bn(this,g,c,"debug"),Bn(this,g,c,"trace"),a.forEach(x=>{Bn(this,g,c,x)})}function y(b,x,I){if(!x)throw new Error("missing bindings for child Pino");I=I||{},o&&x.serializers&&(I.serializers=x.serializers);let N=I.serializers;if(o&&N){var _=Object.assign({},n,N),P=e.browser.serialize===!0?Object.keys(_):o;delete x.serializers,Uf([x],P,_,this._stdErrSerialize)}function w(k){this._childLevel=(k._childLevel|0)+1,this.bindings=x,_&&(this.serializers=_,this._serialize=P),t&&(this._logEvent=qf([].concat(k._logEvent.bindings,x)))}w.prototype=this;let O=new w(this);return AA(this,O),O.child=function(...k){return y.call(this,b,...k)},O.level=I.level||this.level,b.onChild(O),O}return c}function tN(e){let t=e.customLevels||{},r=Object.assign({},Ar.levels.values,t),n=Object.assign({},Ar.levels.labels,rN(t));return{values:r,labels:n}}function rN(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}Ar.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Ar.stdSerializers=XP;Ar.stdTimeFunctions=Object.assign({},{nullTime:CA,epochTime:EA,unixTime:uN,isoTime:lN});function nN(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[Lf];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Bn(e,t,r,n){if(Object.defineProperty(e,n,{value:Xr(e.level,r)>Xr(n,r)?ri:r[jf][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===ri){if(!t.transmit)return;let i=t.transmit.level||e.level,a=Xr(i,r);if(Xr(n,r)<a)return}e[n]=iN(e,t,r,n);let o=nN(e);o.length!==0&&(e[n]=oN(o,e[n]))}function oN(e,t){return function(){return t.apply(this,[...e,...arguments])}}function iN(e,t,r,n){return function(o){return function(){let a=t.timestamp(),s=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Aa?Aa:this;for(var c=0;c<s.length;c++)s[c]=arguments[c];var g=!1;if(t.serialize&&(Uf(s,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let v=aN(this,n,s,a,t);if(t.reportCaller&&v&&v.length>0&&v[0]&&typeof v[0]=="object")try{let R=xA();R&&(v[0].caller=R)}catch{}o.call(u,...v)}else{if(t.reportCaller)try{let v=xA();v&&s.push(v)}catch{}o.apply(u,s)}if(t.transmit){let v=t.transmit.level||e._level,R=Xr(v,r),h=Xr(n,r);if(h<R)return;sN(this,{ts:a,methodLevel:n,methodValue:h,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Xr(e._level,r)},s,g)}}}(e[jf][n])}function aN(e,t,r,n,o){let{level:i,log:a=v=>v}=o.formatters||{},s=r.slice(),u=s[0],c={},g=(e._childLevel|0)+1;if(g<1&&(g=1),n&&(c.time=n),i){let v=i(t,e.levels.values[t]);Object.assign(c,v)}else c.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(u!==null&&typeof u=="object")for(;g--&&typeof s[0]=="object";)Object.assign(c,s.shift());return[a(c),...s]}else{if(u!==null&&typeof u=="object"){for(;g--&&typeof s[0]=="object";)Object.assign(c,s.shift());u=s.length?bA(s.shift(),s):void 0}else typeof u=="string"&&(u=bA(s.shift(),s));return u!==void 0&&(c[o.messageKey]=u),[a(c)]}}function Uf(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=Ar.stdSerializers.err(e[o]);else if(typeof e[o]=="object"&&!Array.isArray(e[o])&&t)for(let i in e[o])t.indexOf(i)>-1&&i in r&&(e[o][i]=r[i](e[o][i]))}function sN(e,t,r,n=!1){let o=t.send,i=t.ts,a=t.methodLevel,s=t.methodValue,u=t.val,c=e._logEvent.bindings;n||Uf(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter(function(g){return c.indexOf(g)===-1}),e._logEvent.level.label=a,e._logEvent.level.value=s,o(a,e._logEvent,u),e._logEvent=qf(c)}function qf(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function wA(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let r in e)t[r]===void 0&&(t[r]=e[r]);return t}function cN(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?CA:EA}function ul(){return{}}function Mf(e){return e}function ri(){}function CA(){return!1}function EA(){return Date.now()}function uN(){return Math.round(Date.now()/1e3)}function lN(){return new Date(Date.now()).toISOString()}function dN(){function e(t){return typeof t<"u"&&t}try{return typeof A<"u"?A:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),A)}catch{return e(self)||e(window)||e(this)||{}}}ll.exports.default=Ar;ll.exports.pino=Ar;function xA(){let e=new Error().stack;if(!e)return null;let t=e.split(`
|
|
20
|
+
`);for(let r=1;r<t.length;r++){let n=t[r].trim();if(/(^at\s+)?(createWrap|LOG|set\s*\(|asObject|Object\.apply|Function\.apply)/.test(n)||n.indexOf("browser.js")!==-1||n.indexOf("node:internal")!==-1||n.indexOf("node_modules")!==-1)continue;let o=n.match(/\((.*?):(\d+):(\d+)\)/);if(o||(o=n.match(/at\s+(.*?):(\d+):(\d+)/)),o){let i=o[1],a=o[2],s=o[3];return i+":"+a+":"+s}}return null}});var dF={};ui(dF,{DefaultFieldsToInclude:()=>Hf,EcommerceDefaultFieldsToInclude:()=>mw,HighlightUtils:()=>Ll,MinimumFieldsToInclude:()=>Al,ResultTemplatesHelpers:()=>Hy,buildContext:()=>MA,buildController:()=>Zr,buildDictionaryFieldContext:()=>LA,buildInteractiveResult:()=>lw,buildRecommendationEngine:()=>NA,buildRecommendationList:()=>cw,buildResultTemplatesManager:()=>yw,getAnalyticsNextApiBaseUrl:()=>Fa,getOrganizationEndpoint:()=>kt,getSampleRecommendationEngineConfiguration:()=>Vf,loadAdvancedSearchQueryActions:()=>YN,loadClickAnalyticsActions:()=>sF,loadConfigurationActions:()=>XN,loadContextActions:()=>JN,loadDebugActions:()=>eF,loadDictionaryFieldContextActions:()=>tF,loadFieldActions:()=>oF,loadPaginationActions:()=>Qf,loadPipelineActions:()=>iF,loadRecommendationActions:()=>aF,loadSearchConfigurationActions:()=>ZN,loadSearchHubActions:()=>lF});module.exports=Ew(dF);m();d();f();p();var Ll={};ui(Ll,{escapeHtml:()=>Xn,getHighlightedSuggestion:()=>ex,highlightString:()=>Jw});m();d();f();p();m();d();f();p();function zw(e,t){let r=`
|
|
21
21
|
The following properties are invalid:
|
|
22
22
|
|
|
23
23
|
${e.join(`
|
|
24
24
|
`)}
|
|
25
25
|
|
|
26
26
|
${t}
|
|
27
|
-
`;return new fi(r)}var fi=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},yt=class{constructor(e){ue(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 zw(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}},qe=class{constructor(e={}){ue(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&ce(e)?"value is required.":null}get default(){return this.baseConfig.default instanceof Function?this.baseConfig.default():this.baseConfig.default}get required(){return this.baseConfig.required===!0}};function Je(e){return e===void 0}function Ww(e){return e===null}function ce(e){return Je(e)||Ww(e)}var fe=class{constructor(e={}){ue(this,"value");this.value=new qe(e)}validate(e){let t=this.value.validate(e);return t||(Kw(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function Kw(e){return Je(e)||fm(e)}function fm(e){return typeof e=="boolean"}var ne=class{constructor(e={}){ue(this,"config");ue(this,"value");this.config=e,this.value=new qe(e)}validate(e){let t=this.value.validate(e);return t||(Yw(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 Yw(e){return Je(e)||mm(e)}function mm(e){return typeof e=="number"&&!Number.isNaN(e)}var Xw=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,H=class{constructor(e={}){ue(this,"value");ue(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new qe(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(Je(e))return null;if(!ka(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&&!(Xw.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 ka(e){return Object.prototype.toString.call(e)==="[object String]"}var re=class{constructor(e={}){ue(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Je(e))return this.config.options.required?"value is required and is currently undefined":null;if(!gm(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ce(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],i=n.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function gm(e){return e!==void 0&&typeof e=="object"}var Ae=class{constructor(e={}){ue(this,"config");ue(this,"value");this.config=e,this.value=new qe(this.config)}validate(e){if(!ce(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ce(e))return null;if(this.config.max!==void 0&&e.length>this.config.max)return`value contains more than ${this.config.max}`;if(this.config.min!==void 0&&e.length<this.config.min)return`value contains less than ${this.config.min}`;if(this.config.each!==void 0){let r="";return e.forEach(n=>{this.config.each.required&&ce(n)&&(r=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(n,this.config.each);o!==null&&(r+=` ${o}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return fm(e)||ka(e)||mm(e)||gm(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function hm(e){return Array.isArray(e)}var Dl=class{constructor(e){ue(this,"config");ue(this,"value");this.config=e,this.value=new qe(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Je(e)||Object.values(this.config.enum).find(n=>n===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();f();p();function ym(e){return Array.isArray(e)}function Oa(e){return e.trim()===""}var Zw=new Set(["1",1,"yes",!0]);function Ml(){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=>Zw.has(r))}function vm(e){let t={};for(let[r,n]of e)t[r]=n;return t}function mi(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Pa(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 Jw(e){if(Oa(e.openingDelimiter)||Oa(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(ce(e.content)||Oa(e.content))return e.content;if(e.highlights.length===0)return Xn(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,s=a+i.length;if(s>t)break;r+=Xn(e.content.slice(n,a)),r+=e.openingDelimiter,r+=Xn(e.content.slice(a,s)),r+=e.closingDelimiter,n=s}return n!==t&&(r+=Xn(e.content.slice(n))),r}function ex(e,t){return e=Xn(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?Ll(n,t.notMatchDelimiters):o?Ll(o,t.exactMatchDelimiters):i?Ll(i,t.correctionDelimiters):r)}function Ll(e,t){return t?t.open+e+t.close:e}function Xn(e){let t={"&":"&","<":"<",">":">","\"":""","'":"'","`":"`"},r=`(?:${Object.keys(t).join("|")})`,n=RegExp(r),o=RegExp(r,"g");return n.test(e)?e.replace(o,i=>t[i]):e}m();d();f();p();var km=jt(Rm(),1);m();d();f();p();var Qt=new Error("Failed to load reducers."),Zn=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."}},tn=class extends Error{constructor(r,n){super();ue(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};m();d();f();p();function Im(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function Tm(e){return typeof e!="object"||!e?!1:Object.values(e).every(Rx)}function Rx(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function _m(e){return e===429}var Ut=class e{static call(t){return _asyncToGenerator(function*(){let r=Ix(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:i,...a}=o,s=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let u=yield C(i,a);if(_m(u.status))throw u;return u});return function s(){return _ref.apply(this,arguments)}}();try{let u=yield(0,km.backOff)(s,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(c){let g=c&&_m(c.status);return g&&(n.info("Platform retrying request"),yield new Promise(v=>setTimeout(v,1e3))),g});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(u.status){case 419:case 401:throw n.info("Platform renewing token"),new Zn;case 404:throw new tn(i,u.status);default:return n.info({response:u,requestInfo:o},"Platform response"),u}}catch(u){return u.message==="Failed to fetch"?new tn(i):u}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:s,...u}=t,c=mi(u);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 c})()}};function kt(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Jn(e,t,r="prod"){return e??kt(t,r)}function wr(e,t="prod"){return`${kt(e,t)}/rest/search/v2`}function Fa(e,t="prod"){return`${kt(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function Ix(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,s=e.method==="POST"||e.method==="PUT",u=Tx(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(s&&{body:u}),signal:a}}function Tx(e,t){return t==="application/x-www-form-urlencoded"?Tm(e)?Im(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();var Da=e=>e;m();d();f();p();m();d();f();p();function Ma(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Ht(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Ma(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Ma(),extendedResults:{},searchAction:void 0}}m();d();f();p();function xr(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Cr=e=>{let{response:t}=e;return t.body?_x(e):kx(t)},_x=e=>Px(e)?Nx(e):Ox(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},kx=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function Ox(e){return e.body.statusCode!==void 0}function Px(e){return e.body.exception!==void 0}var Nx=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();var Er=class{constructor(){ue(this,"currentAbortController",null)}enqueue(t,r){var _this=this;return _asyncToGenerator(function*(){let n=_this.currentAbortController;_this.currentAbortController=new l.AbortController;let o=_this.currentAbortController;n&&(r.warnOnAbort&&r.logger.warn("Cancelling current pending search query"),n.abort());try{return yield t(o?.signal??null)}finally{_this.currentAbortController===o&&(_this.currentAbortController=null)}})()}};m();d();f();p();m();d();f();p();var yi=class{constructor(t){ue(this,"_basePath");ue(this,"_params",{});this._basePath=t}addParam(t,r){this._params={...this.params,[t]:r}}get basePath(){return this._basePath}get params(){return this._params}get hasParams(){return Object.entries(this._params).length}get href(){return this.hasParams?`${this.basePath}?${Object.entries(this.params).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}`:this.basePath}};m();d();f();p();function Om(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var sr=(e,t,r,n)=>{let o=new yi(`${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 Pm=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Ut.call({...sr(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:xr(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Om(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return Fx(a)?{success:a}:{error:Cr({response:r,body:a})}});return function Pm(_x3,_x4){return _ref3.apply(this,arguments)}}();function Fx(e){return typeof e=="string"}m();d();f();p();function Dx(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function Mx(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function La(e,t){if(t&&e.name==="AbortError")return{error:Mx(e)};if(e instanceof tn)return{error:Dx(e)};throw e}var qa=class{constructor(t){ue(this,"options",t);ue(this,"apiCallsQueues",{unknown:new Er,mainSearch:new Er,facetValues:new Er,foldingCollection:new Er,instantResults:new Er})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json","/plan"),requestParams:xr(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return La(r);let n=yield r.json();return qx(n)?{success:n}:{error:Cr({response:r,body:n})}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:xr(t),..._this3.options});if(r instanceof Error)return La(r);let n=yield r.json(),o={response:r,body:n};return Lx(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:Cr(o)}})()}search(t,r){var _this4=this;return _asyncToGenerator(function*(){let n=r?.origin??"unknown",o=yield _this4.apiCallsQueues[n].enqueue(s=>Ut.call({...sr(t,"POST","application/json",""),requestParams:xr(t),requestMetadata:{method:"search",origin:r?.origin},..._this4.options,signal:s??void 0}),{logger:_this4.options.logger,warnOnAbort:!r?.disableAbortWarning});if(o instanceof Error)return La(o,r?.disableAbortWarning);let i=yield o.json(),a={response:o,body:i};return Nm(i)?(a.body=Fm(i),{success:(yield _this4.options.postprocessSearchResponseMiddleware(a)).body}):{error:Cr(a)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json","/facet"),requestParams:xr(t),requestMetadata:{method:"facetSearch"},..._this5.options});if(r instanceof Error)throw r;let n=yield r.json(),o={response:r,body:n};return(yield _this5.options.postprocessFacetSearchResponseMiddleware(o)).body})()}recommendations(t){var _this6=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json",""),requestParams:xr(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if(Nm(n)){let o={response:r,body:n};return o.body=Fm(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:Cr({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return Pm(t,{..._this7.options})})()}fieldDescriptions(t){var _this8=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},..._this8.options});if(r instanceof Error)throw r;let n=yield r.json();return jx(n)?{success:n}:{error:Cr({response:r,body:n})}})()}},ja=e=>e.success!==void 0,vt=e=>e.error!==void 0;function Nm(e){return e.results!==void 0}function Fm(e){let t=Ma();return ce(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function Lx(e){return e.completions!==void 0}function qx(e){return e.preprocessingOutput!==void 0}function jx(e){return e.fields!==void 0}m();d();f();p();var Dm=e=>e,Mm=e=>e,Lm=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();function et(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 Ux=typeof Symbol=="function"&&Symbol.observable||"@@observable",qm=Ux,zl=()=>Math.random().toString(36).substring(7).split("").join("."),Vx={INIT:`@@redux/INIT${zl()}`,REPLACE:`@@redux/REPLACE${zl()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${zl()}`},Ua=Vx;function zt(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 Wl(e,t,r){if(typeof e!="function")throw new Error(et(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(et(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(et(1));return r(Wl)(e,t)}let n=e,o=t,i=new Map,a=i,s=0,u=!1;function c(){a===i&&(a=new Map,i.forEach((x,I)=>{a.set(I,x)}))}function g(){if(u)throw new Error(et(3));return o}function v(x){if(typeof x!="function")throw new Error(et(4));if(u)throw new Error(et(5));let I=!0;c();let N=s++;return a.set(N,x),function(){if(I){if(u)throw new Error(et(6));I=!1,c(),a.delete(N),i=null}}}function R(x){if(!zt(x))throw new Error(et(7));if(typeof x.type>"u")throw new Error(et(8));if(typeof x.type!="string")throw new Error(et(17));if(u)throw new Error(et(9));try{u=!0,o=n(o,x)}finally{u=!1}return(i=a).forEach(N=>{N()}),x}function h(x){if(typeof x!="function")throw new Error(et(10));n=x,R({type:Ua.REPLACE})}function y(){let x=v;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(et(11));function N(){let P=I;P.next&&P.next(g())}return N(),{unsubscribe:x(N)}},[qm](){return this}}}return R({type:Ua.INIT}),{dispatch:R,subscribe:v,getState:g,replaceReducer:h,[qm]:y}}function Gx(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Ua.INIT})>"u")throw new Error(et(12));if(typeof r(void 0,{type:Ua.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(et(13))})}function rn(e){let t=Object.keys(e),r={};for(let a=0;a<t.length;a++){let s=t[a];typeof e[s]=="function"&&(r[s]=e[s])}let n=Object.keys(r),o,i;try{Gx(r)}catch(a){i=a}return function(s={},u){if(i)throw i;let c=!1,g={};for(let v=0;v<n.length;v++){let R=n[v],h=r[R],y=s[R],b=h(y,u);if(typeof b>"u"){let x=u&&u.type;throw new Error(et(14))}g[R]=b,c=c||b!==y}return c=c||n.length!==Object.keys(s).length,c?g:s}}function vi(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function jm(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(et(15))},a={getState:o.getState,dispatch:(u,...c)=>i(u,...c)},s=e.map(u=>u(a));return i=vi(...s)(o.dispatch),{...o,dispatch:i}}}function Si(e){return zt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var nd=Symbol.for("immer-nothing"),bi=Symbol.for("immer-draftable"),Ke=Symbol.for("immer-state");function tt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ct=Object,on=Ct.getPrototypeOf,Ai="constructor",Ri="prototype",Xl="configurable",$a="enumerable",Ga="writable",wi="value",gt=e=>!!e&&!!e[Ke];function lt(e){return e?zm(e)||Ti(e)||!!e[bi]||!!e[Ai]?.[bi]||_i(e)||ro(e):!1}var Bx=Ct[Ri][Ai].toString(),Um=new WeakMap;function zm(e){if(!e||!to(e))return!1;let t=on(e);if(t===null||t===Ct[Ri])return!0;let r=Ct.hasOwnProperty.call(t,Ai)&&t[Ai];if(r===Object)return!0;if(!nn(r))return!1;let n=Um.get(r);return n===void 0&&(n=Function.toString.call(r),Um.set(r,n)),n===Bx}function od(e){return gt(e)||tt(15,e),e[Ke].base_}function Ii(e,t,r=!0){an(e)===0?(r?Reflect.ownKeys(e):Ct.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function an(e){let t=e[Ke];return t?t.type_:Ti(e)?1:_i(e)?2:ro(e)?3:0}var eo=(e,t,r=an(e))=>r===2?e.has(t):Ct[Ri].hasOwnProperty.call(e,t),cr=(e,t,r=an(e))=>r===2?e.get(t):e[t],Qa=(e,t,r,n=an(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function $x(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ti=Array.isArray,_i=e=>e instanceof Map,ro=e=>e instanceof Set,to=e=>typeof e=="object",nn=e=>typeof e=="function",Kl=e=>typeof e=="boolean";function Qx(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Hx=e=>to(e)?e?.[Ke]:null,ur=e=>e.copy_||e.base_;var id=e=>e.modified_?e.copy_:e.base_;function Zl(e,t){if(_i(e))return new Map(e);if(ro(e))return new Set(e);if(Ti(e))return Array[Ri].slice.call(e);let r=zm(e);if(t===!0||t==="class_only"&&!r){let n=Ct.getOwnPropertyDescriptors(e);delete n[Ke];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],s=n[a];s[Ga]===!1&&(s[Ga]=!0,s[Xl]=!0),(s.get||s.set)&&(n[a]={[Xl]:!0,[Ga]:!0,[$a]:s[$a],[wi]:e[a]})}return Ct.create(on(e),n)}else{let n=on(e);if(n!==null&&r)return{...e};let o=Ct.create(n);return Ct.assign(o,e)}}function Xa(e,t=!1){return Za(e)||gt(e)||!lt(e)||(an(e)>1&&Ct.defineProperties(e,{set:Va,add:Va,clear:Va,delete:Va}),Ct.freeze(e),t&&Ii(e,(r,n)=>{Xa(n,!0)},!1)),e}function zx(){tt(2)}var Va={[wi]:zx};function Za(e){return e===null||!to(e)?!0:Ct.isFrozen(e)}var Ha="MapSet",za="Patches",Vm="ArrayMethods",Wa={};function sn(e){let t=Wa[e];return t||tt(0,e),t}var Gm=e=>!!Wa[e];function Wx(e,t){Wa[e]||(Wa[e]=t)}var xi,Wm=()=>xi,Kx=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Gm(Ha)?sn(Ha):void 0,arrayMethodsPlugin_:Gm(Vm)?sn(Vm):void 0});function Bm(e,t){t&&(e.patchPlugin_=sn(za),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Jl(e){ed(e),e.drafts_.forEach(Yx),e.drafts_=null}function ed(e){e===xi&&(xi=e.parent_)}var $m=e=>xi=Kx(xi,e);function Yx(e){let t=e[Ke];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Qm(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[Ke].modified_&&(Jl(t),tt(4)),lt(e)&&(e=Hm(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[Ke].base_,e,t)}else e=Hm(t,r);return Xx(t,e,!0),Jl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==nd?e:void 0}function Hm(e,t){if(Za(t))return t;let r=t[Ke];if(!r)return Ka(t,e.handledSet_,e);if(!Ja(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);Xm(r,e)}return r.copy_}function Xx(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Xa(t,r)}function Km(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ja=(e,t)=>e.scope_===t,Zx=[];function Ym(e,t,r,n){let o=ur(e),i=e.type_;if(n!==void 0&&cr(o,n,i)===t){Qa(o,n,r,i);return}if(!e.draftLocations_){let s=e.draftLocations_=new Map;Ii(o,(u,c)=>{if(gt(c)){let g=s.get(c)||[];g.push(u),s.set(c,g)}})}let a=e.draftLocations_.get(t)??Zx;for(let s of a)Qa(o,s,r,i)}function Jx(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!Ja(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let a=id(i);Ym(e,i.draft_??i,a,r),Xm(i,o)})}function Xm(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)}Km(e)}}function eC(e,t,r){let{scope_:n}=e;if(gt(r)){let o=r[Ke];Ja(o,n)&&o.callbacks_.push(function(){Ba(e);let a=id(o);Ym(e,r,a,t)})}else lt(r)&&e.callbacks_.push(function(){let i=ur(e);e.type_===3?i.has(r)&&Ka(r,n.handledSet_,n):cr(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Ka(cr(e.copy_,t,e.type_),n.handledSet_,n)})}function Ka(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||gt(e)||t.has(e)||!lt(e)||Za(e)||(t.add(e),Ii(e,(n,o)=>{if(gt(o)){let i=o[Ke];if(Ja(i,r)){let a=id(i);Qa(e,n,a,e.type_),Km(i)}}else lt(o)&&Ka(o,t,r)})),e}function tC(e,t){let r=Ti(e),n={type_:r?1:0,scope_:t?t.scope_:Wm(),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=Ya;r&&(o=[n],i=Ci);let{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,[s,n]}var Ya={get(e,t){if(t===Ke)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=ur(e);if(!eo(o,t,e.type_))return nC(e,o,t);let i=o[t];if(e.finalized_||!lt(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Qx(t))return i;if(i===Yl(e.base_,t)||rC(e,t,i)){Ba(e);let a=e.type_===1?+t:t,s=rd(e.scope_,i,e,a);return e.copy_[a]=s}return i},has(e,t){return t in ur(e)},ownKeys(e){return Reflect.ownKeys(ur(e))},set(e,t,r){let n=Zm(ur(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Yl(ur(e),t),i=o?.[Ke];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.delete(t),!0;if($x(r,o)&&(r!==void 0||eo(e.base_,t,e.type_)))return!0;Ba(e),td(e)}return e.copy_[t]===r&&(r!==void 0||eo(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),eC(e,t,r)),!0},deleteProperty(e,t){return Ba(e),Yl(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),td(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=ur(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Ga]:!0,[Xl]:e.type_!==1||t!=="length",[$a]:n[$a],[wi]:r[t]}},defineProperty(){tt(11)},getPrototypeOf(e){return on(e.base_)},setPrototypeOf(){tt(12)}},Ci={};for(let e in Ya){let t=Ya[e];Ci[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Ci.deleteProperty=function(e,t){return Ci.set.call(this,e,t,void 0)};Ci.set=function(e,t,r){return Ya.set.call(this,e[0],t,r,e[0])};function Yl(e,t){let r=e[Ke];return(r?ur(r):e)[t]}function rC(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!lt(r)||r[Ke]?!1:e.baseRefs_.has(r)}function nC(e,t,r){let n=Zm(t,r);return n?wi in n?n[wi]:n.get?.call(e.draft_):void 0}function Zm(e,t){if(!(t in e))return;let r=on(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=on(r)}}function td(e){e.modified_||(e.modified_=!0,e.parent_&&td(e.parent_))}function Ba(e){e.copy_||(e.assigned_=new Map,e.copy_=Zl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var oC=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(nn(t)&&!nn(r)){let i=r;r=t;let a=this;return function(u=i,...c){return a.produce(u,g=>r.call(this,g,...c))}}nn(r)||tt(6),n!==void 0&&!nn(n)&&tt(7);let o;if(lt(t)){let i=$m(this),a=rd(i,t,void 0),s=!0;try{o=r(a),s=!1}finally{s?Jl(i):ed(i)}return Bm(i,n),Qm(o,i)}else if(!t||!to(t)){if(o=r(t),o===void 0&&(o=t),o===nd&&(o=void 0),this.autoFreeze_&&Xa(o,!0),n){let i=[],a=[];sn(za).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:a}),n(i,a)}return o}else tt(1,t)},this.produceWithPatches=(t,r)=>{if(nn(t))return(a,...s)=>this.produceWithPatches(a,u=>t(u,...s));let n,o;return[this.produce(t,r,(a,s)=>{n=a,o=s}),n,o]},Kl(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Kl(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Kl(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){lt(e)||tt(8),gt(e)&&(e=es(e));let t=$m(this),r=rd(t,e,void 0);return r[Ke].isManual_=!0,ed(t),r}finishDraft(e,t){let r=e&&e[Ke];(!r||!r.isManual_)&&tt(9);let{scope_:n}=r;return Bm(n,t),Qm(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=sn(za).applyPatches_;return gt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function rd(e,t,r,n){let[o,i]=_i(t)?sn(Ha).proxyMap_(t,r):ro(t)?sn(Ha).proxySet_(t,r):tC(t,r);return(r?.scope_??Wm()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?Jx(r,i,n):i.callbacks_.push(function(u){u.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:c}=u;i.modified_&&c&&c.generatePatches_(i,[],u)}),o}function es(e){return gt(e)||tt(10,e),Jm(e)}function Jm(e){if(!lt(e)||Za(e))return e;let t=e[Ke],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Zl(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Zl(e,!0);let o=r;return ro(r)&&(r=new Set),Ii(o,(i,a)=>{Qa(r,i,Jm(a))},n),t&&(t.finalized_=!1),r}function eg(){function t(y,b=[]){if(y.key_!==void 0){let x=y.parent_.copy_??y.parent_.base_,I=Hx(cr(x,y.key_)),N=cr(x,y.key_);if(N===void 0||N!==y.draft_&&N!==y.base_&&N!==y.copy_||I!=null&&I.base_!==y.base_)return null;let _=y.parent_.type_===3,P;if(_){let w=y.parent_;P=Array.from(w.drafts_.keys()).indexOf(y.key_)}else P=y.key_;if(!(_&&x.size>P||eo(x,P))||y.parent_.type_===1&&y.parent_.allIndicesReassigned_)return null;b.push(P)}if(y.parent_)return t(y.parent_,b);b.reverse();try{r(y.copy_,b)}catch{return null}return b}function r(y,b){let x=y;for(let I=0;I<b.length-1;I++){let N=b[I];if(x=cr(x,N),!to(x)||x===null)throw new Error(`Cannot resolve path at '${b.join("/")}'`)}return x}let n="replace",o="add",i="remove";function a(y,b,x){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:I,inversePatches_:N}=x;switch(y.type_){case 0:case 2:return u(y,b,I,N);case 1:return s(y,b,I,N);case 3:return c(y,b,I,N)}}function s(y,b,x,I){let{base_:N,assigned_:_}=y,P=y.copy_;P.length<N.length&&([N,P]=[P,N],[x,I]=[I,x]);let w=y.allIndicesReassigned_===!0;for(let O=0;O<N.length;O++){let k=P[O],T=N[O];if((w||_?.get(O.toString()))&&k!==T){let G=k?.[Ke];if(G&&G.modified_)continue;let M=b.concat([O]);x.push({op:n,path:M,value:h(k)}),I.push({op:n,path:M,value:h(T)})}}for(let O=N.length;O<P.length;O++){let k=b.concat([O]);x.push({op:o,path:k,value:h(P[O])})}for(let O=P.length-1;N.length<=O;--O){let k=b.concat([O]);I.push({op:i,path:k})}}function u(y,b,x,I){let{base_:N,copy_:_,type_:P}=y;Ii(y.assigned_,(w,O)=>{let k=cr(N,w,P),T=cr(_,w,P),D=O?eo(N,w)?n:o:i;if(k===T&&D===n)return;let G=b.concat(w);x.push(D===i?{op:D,path:G}:{op:D,path:G,value:h(T)}),I.push(D===o?{op:i,path:G}:D===i?{op:o,path:G,value:h(k)}:{op:n,path:G,value:h(k)})})}function c(y,b,x,I){let{base_:N,copy_:_}=y,P=0;N.forEach(w=>{if(!_.has(w)){let O=b.concat([P]);x.push({op:i,path:O,value:w}),I.unshift({op:o,path:O,value:w})}P++}),P=0,_.forEach(w=>{if(!N.has(w)){let O=b.concat([P]);x.push({op:o,path:O,value:w}),I.unshift({op:i,path:O,value:w})}P++})}function g(y,b,x){let{patches_:I,inversePatches_:N}=x;I.push({op:n,path:[],value:b===nd?void 0:b}),N.push({op:n,path:[],value:y})}function v(y,b){return b.forEach(x=>{let{path:I,op:N}=x,_=y;for(let k=0;k<I.length-1;k++){let T=an(_),D=I[k];typeof D!="string"&&typeof D!="number"&&(D=""+D),(T===0||T===1)&&(D==="__proto__"||D===Ai)&&tt(19),nn(_)&&D===Ri&&tt(19),_=cr(_,D),(_===null||!to(_))&&tt(18,I.join("/"))}let P=an(_),w=R(x.value),O=I[I.length-1];switch(N){case n:switch(P){case 2:return _.set(O,w);case 3:tt(16);default:return _[O]=w}case o:switch(P){case 1:return O==="-"?_.push(w):_.splice(O,0,w);case 2:return _.set(O,w);case 3:return _.add(w);default:return _[O]=w}case i:switch(P){case 1:return _.splice(O,1);case 2:return _.delete(O);case 3:return _.delete(x.value);default:return delete _[O]}default:tt(17,N)}}),y}function R(y){if(!lt(y))return y;if(Ti(y))return y.map(R);if(_i(y))return new Map(Array.from(y.entries()).map(([x,I])=>[x,R(I)]));if(ro(y))return new Set(Array.from(y).map(R));let b=Object.create(on(y));for(let x in y)b[x]=R(y[x]);return eo(y,bi)&&(b[bi]=y[bi]),b}function h(y){return gt(y)?R(y):y}Wx(za,{applyPatches_:v,generatePatches_:a,generateReplacementPatches_:g,getPath:t})}var iC=A.Iterator,jL=typeof iC?.from=="function";var Ei=new oC,cn=Ei.produce,ad=Ei.produceWithPatches.bind(Ei);var sd=Ei.applyPatches.bind(Ei);m();d();f();p();var aC=class{constructor(e){this.value=e}deref(){return this.value}},sC=()=>typeof WeakRef>"u"?aC:WeakRef,rg=sC(),cC=0,ts=1;function ki(){return{s:cC,v:void 0,o:null,p:null}}function uC(e){return e instanceof rg?e.deref():e}function no(e,t={}){let r=ki(),{resultEqualityCheck:n,maxSize:o}=t,i=o!==void 0;if(i&&(!Number.isInteger(o)||o<1))throw new TypeError(`maxSize must be a positive integer, received: ${o}`);let a=null,s=0,u,c=0,g=!1;function v(){s>=o&&(a=r,r=ki(),s=0)}function R(){let h=r,{length:y}=arguments;for(let I=0,N=y;I<N;I++){let _=arguments[I];if(typeof _=="function"||typeof _=="object"&&_!==null){let P=h.o;P===null&&(h.o=P=new WeakMap);let w=P.get(_);w===void 0?(h=ki(),P.set(_,h)):h=w}else{let P=h.p;P===null&&(h.p=P=new Map);let w=P.get(_);w===void 0?(h=ki(),P.set(_,h),s++):h=w}}if(h.s===ts)return h.v;if(a!==null){let I=a;for(let N=0,_=y;N<_;N++){let P=arguments[N],w;if(typeof P=="function"||typeof P=="object"&&P!==null){let O=I.o;w=O!==null?O.get(P):void 0}else{let O=I.p;w=O!==null?O.get(P):void 0}if(w===void 0){I=null;break}I=w}if(I!==null&&I.s===ts){let N=h;return N.s=ts,N.v=I.v,v(),I.v}}let b=h,x=e.apply(null,arguments);if(c++,n){let I=uC(u);I!=null&&n(I,x)&&(x=I,c!==0&&c--),u=typeof x=="object"&&x!==null||typeof x=="function"?new rg(x):x}return b.s=ts,b.v=x,i&&v(),x}return R.clearCache=()=>{r=ki(),a=null,s=0,R.resetResultsCount()},R.resultsCount=()=>c,R.resetResultsCount=()=>{c=0},R}var cd=Symbol("NOT_FOUND");function lC(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function dC(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 tg=e=>Array.isArray(e)?e:[e];function pC(e){let t=Array.isArray(e[0])?e[0]:e;return dC(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function rs(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,a=0,s,u={},c=o.pop();typeof c=="object"&&(u=c,c=o.pop()),lC(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);let g={...r,...u},{memoize:v,memoizeOptions:R=[],argsMemoize:h=no,argsMemoizeOptions:y=[]}=g,b=tg(R),x=tg(y),I=pC(o),N=v(function(){return i++,c.apply(null,arguments)},...b),_=!0,P=h(function(){a++;let{length:O}=I,k=new Array(O);for(let T=0;T<O;T++)k[T]=I[T].apply(null,arguments);return s=N.apply(null,k),s},...x);return Object.assign(P,{resultFunc:c,memoizedResultFunc:N,dependencies:I,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>s,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var ze=rs(no);function fC(e){let t;return{get(r){return t&&e(t.key,r)?t.value:cd},put(r,n){t={key:r,value:n}},findMatchingEntry(r,n){let o=t;return o!==void 0&&n(o.value,r)?o:void 0},clear(){t=void 0}}}function mC(e,t){let r=[];function n(s){let u=r.findIndex(c=>t(c.key,s));if(u>-1){let c=r[u];return u>0&&(r.splice(u,1),r.unshift(c)),c.value}return cd}function o(s,u){r.unshift({key:s,value:u}),r.length>e&&r.pop()}function i(s,u){let c=r,{length:g}=c;for(let v=0;v<g;v++){let R=c[v];if(u(R.value,s))return R}}function a(){r=[]}return{get:n,put:o,findMatchingEntry:i,clear:a}}var gC=(e,t)=>e===t;function hC(e){return function(r,n){if(r===null||n===null||r.length!==n.length)return!1;let{length:o}=r;for(let i=0;i<o;i++)if(!e(r[i],n[i]))return!1;return!0}}function ud(e,t){let r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:n=gC,maxSize:o=1,resultEqualityCheck:i}=r,a=hC(n),s=0,u=o<=1?fC(a):mC(o,a);function c(){let g=u.get(arguments);if(g===cd){if(g=e.apply(null,arguments),s++,i){let v=u.findMatchingEntry(g,i);v&&(g=v.value,s!==0&&s--)}u.put(arguments,g)}return g}return c.clearCache=()=>{u.clear(),c.resetResultsCount()},c.resultsCount=()=>s,c.resetResultsCount=()=>{s=0},c}m();d();f();p();function ng(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var og=ng(),ig=ng;var yC=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?vi:vi.apply(null,arguments)};typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var vC=e=>e&&typeof e.match=="function";function L(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(dt(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=>Si(n)&&n.type===e,r}var fg=class Oi extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Oi.prototype)}static get[Symbol.species](){return Oi}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Oi(...t[0].concat(this)):new Oi(...t.concat(this))}};function ag(e){return lt(e)?cn(e,()=>{}):e}function ns(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function SC(e){return typeof e=="boolean"}var bC=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new fg;return r&&(SC(r)?a.push(og):a.push(ig(r.extraArgument))),a},Pi="RTK_autoBatch",ao=()=>e=>({payload:e,meta:{[Pi]:!0}}),sg=e=>t=>{setTimeout(t,e)},AC=(e,t)=>r=>{let n=!1,o,i,a=()=>{n||(n=!0,cancelAnimationFrame(o),clearTimeout(i),r())};o=e(a),i=setTimeout(a,t)},wC=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,a=!1,s=new Set,u=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?AC(window.requestAnimationFrame,100):sg(10):e.type==="callback"?e.queueNotification:sg(e.timeout),c=()=>{a=!1,i&&(i=!1,s.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let v=()=>o&&g(),R=n.subscribe(v);return s.add(g),()=>{R(),s.delete(g)}},dispatch(g){try{return o=!g?.meta?.[Pi],i=!o,i&&(a||(a=!0,u(c))),n.dispatch(g)}finally{o=!0}}})},xC=e=>function(r){let{autoBatch:n=!0}=r??{},o=new fg(e);return n&&o.push(wC(typeof n=="object"?n:void 0)),o};function mg(e){let t=bC(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:a=void 0,enhancers:s=void 0}=e||{},u;if(typeof r=="function")u=r;else if(zt(r))u=rn(r);else throw new Error(dt(1));let c;typeof n=="function"?c=n(t):c=t();let g=vi;o&&(g=yC({trace:!1,...(typeof o=="object"&&o)}));let v=jm(...c),R=xC(v),h=typeof s=="function"?s(R):R(),y=g(...h);return Wl(u,a,y)}function gg(e){let t={},r=[],n,o={addCase(i,a){let s=typeof i=="string"?i:i.type;if(!s)throw new Error(dt(28));if(s in t)throw new Error(dt(29));return t[s]=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 CC(e){return typeof e=="function"}function Be(e,t){let[r,n,o]=gg(t),i;if(CC(e))i=()=>ag(e());else{let s=ag(e);i=()=>s}function a(s=i(),u){let c=[r[u.type],...n.filter(({matcher:g})=>g(u)).map(({reducer:g})=>g)];return c.filter(g=>!!g).length===0&&(c=[o]),c.reduce((g,v)=>{if(v)if(gt(g)){let R=v(g,u);return R===void 0?g:R}else{if(lt(g))return cn(g,R=>v(R,u));{let R=v(g,u);if(R===void 0){if(g===null)return g;throw new Error(dt(9))}return R}}return g},s)}return a.getInitialState=i,a}var hg=(e,t)=>vC(e)?e.match(t):e(t);function Wt(...e){return t=>e.some(r=>hg(r,t))}function io(...e){return t=>e.every(r=>hg(r,t))}function ss(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 Ni(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function cs(...e){return e.length===0?t=>ss(t,["pending"]):Ni(e)?Wt(...e.map(t=>t.pending)):cs()(e[0])}function ln(...e){return e.length===0?t=>ss(t,["rejected"]):Ni(e)?Wt(...e.map(t=>t.rejected)):ln()(e[0])}function Fi(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?io(ln(...e),t):Ni(e)?io(ln(...e),t):Fi()(e[0])}function lr(...e){return e.length===0?t=>ss(t,["fulfilled"]):Ni(e)?Wt(...e.map(t=>t.fulfilled)):lr()(e[0])}function us(...e){return e.length===0?t=>ss(t,["pending","fulfilled","rejected"]):Ni(e)?Wt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):us()(e[0])}var EC="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Di=(e=21)=>{let t="",r=e;for(;r--;)t+=EC[Math.random()*64|0];return t},RC=["name","message","stack","code"],ld=class{constructor(e,t){ue(this,"payload");ue(this,"meta");ue(this,"_type");this.payload=e,this.meta=t}},cg=class{constructor(e,t){ue(this,"payload");ue(this,"meta");ue(this,"_type");this.payload=e,this.meta=t}},IC=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of RC)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},ug="External signal was aborted",ke=(()=>{function e(t,r,n){let o=L(t+"/fulfilled",(u,c,g,v)=>({payload:u,meta:{...(v||{}),arg:g,requestId:c,requestStatus:"fulfilled"}})),i=L(t+"/pending",(u,c,g)=>({payload:void 0,meta:{...(g||{}),arg:c,requestId:u,requestStatus:"pending"}})),a=L(t+"/rejected",(u,c,g,v,R)=>({payload:v,error:(n&&n.serializeError||IC)(u||"Rejected"),meta:{...(R||{}),arg:g,requestId:c,rejectedWithValue:v!==void 0,requestStatus:"rejected",aborted:u?.name==="AbortError",condition:u?.name==="ConditionError"}}));function s(u,{signal:c}={}){return(g,v,R)=>{let h=n?.idGenerator?n.idGenerator(u):Di(),y=new l.AbortController,b,x;function I(_){x=_,y.abort()}c&&(c.aborted?I(ug):c.addEventListener("abort",()=>I(ug),{once:!0}));let N=_asyncToGenerator(function*(){let _;try{let P=n?.condition?.(u,{getState:v,extra:R});if(_C(P)&&(P=yield P),P===!1)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};if(y.signal.aborted)throw{name:"AbortError",message:x||"Aborted"};let w=new Promise((O,k)=>{b=()=>{k({name:"AbortError",message:x||"Aborted"})},y.signal.addEventListener("abort",b,{once:!0})});g(i(h,u,n?.getPendingMeta?.({requestId:h,arg:u},{getState:v,extra:R}))),_=yield Promise.race([w,Promise.resolve(r(u,{dispatch:g,getState:v,extra:R,requestId:h,signal:y.signal,abort:I,rejectWithValue:(O,k)=>new ld(O,k),fulfillWithValue:(O,k)=>new cg(O,k)})).then(O=>{if(O instanceof ld)throw O;return O instanceof cg?o(O.payload,h,u,O.meta):o(O,h,u)})])}catch(P){_=P instanceof ld?a(null,h,u,P.payload,P.meta):a(P,h,u)}finally{b&&y.signal.removeEventListener("abort",b)}return n&&!n.dispatchConditionRejection&&a.match(_)&&_.meta.condition||g(_),_})();return Object.assign(N,{abort:I,requestId:h,arg:u,unwrap(){return N.then(TC)}})}}return Object.assign(s,{pending:i,rejected:a,fulfilled:o,settled:Wt(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function TC(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function _C(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var yg=Symbol.for("rtk-slice-createasyncthunk"),sq={[yg]:ke};function kC(e,t){return`${e}/${t}`}function OC({creators:e}={}){let t=e?.asyncThunk?.[yg];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(dt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(NC()):n.reducers)||{},s=Object.keys(a),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(_,P){let w=typeof _=="string"?_:_.type;if(!w)throw new Error(dt(12));if(w in u.sliceCaseReducersByType)throw new Error(dt(13));return u.sliceCaseReducersByType[w]=P,c},addMatcher(_,P){return u.sliceMatchers.push({matcher:_,reducer:P}),c},exposeAction(_,P){return u.actionCreators[_]=P,c},exposeCaseReducer(_,P){return u.sliceCaseReducersByName[_]=P,c}};s.forEach(_=>{let P=a[_],w={reducerName:_,type:kC(o,_),createNotation:typeof n.reducers=="function"};DC(P)?LC(w,P,c,t):FC(w,P,c)});function g(){let[_={},P=[],w=void 0]=typeof n.extraReducers=="function"?gg(n.extraReducers):[n.extraReducers],O={..._,...u.sliceCaseReducersByType};return Be(n.initialState,k=>{for(let T in O)k.addCase(T,O[T]);for(let T of u.sliceMatchers)k.addMatcher(T.matcher,T.reducer);for(let T of P)k.addMatcher(T.matcher,T.reducer);w&&k.addDefaultCase(w)})}let v=_=>_,R=new Map,h=new WeakMap,y;function b(_,P){return y||(y=g()),y(_,P)}function x(){return y||(y=g()),y.getInitialState()}function I(_,P=!1){function w(k){let T=k[_];return typeof T>"u"&&P&&(T=ns(h,w,x)),T}function O(k=v){return ns(ns(R,P,()=>new WeakMap),k,()=>{let T={};for(let[D,G]of Object.entries(n.selectors??{}))T[D]=PC(G,k,()=>ns(h,k,x),P);return T})}return{reducerPath:_,getSelectors:O,get selectors(){return O(w)},selectSlice:w}}let N={name:o,reducer:b,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:x,...I(i),injectInto(_,{reducerPath:P,...w}={}){let O=P??i;return _.inject({reducerPath:O,reducer:b},w),{...N,...I(O,!0)}}};return N}}function PC(e,t,r,n){function o(i,...a){let s=t(i);return typeof s>"u"&&n&&(s=r()),e(s,...a)}return o.unwrapped=e,o}var dn=OC();function NC(){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 FC({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!MC(n))throw new Error(dt(17));i=n.reducer,a=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?L(e,a):L(e))}function DC(e){return e._reducerDefinitionType==="asyncThunk"}function MC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function LC({type:e,reducerName:t},r,n,o){if(!o)throw new Error(dt(18));let{payloadCreator:i,fulfilled:a,pending:s,rejected:u,settled:c,options:g}=r,v=o(e,i,g);n.exposeAction(t,v),a&&n.addCase(v.fulfilled,a),s&&n.addCase(v.pending,s),u&&n.addCase(v.rejected,u),c&&n.addMatcher(v.settled,c),n.exposeCaseReducer(t,{fulfilled:a||os,pending:s||os,rejected:u||os,settled:c||os})}function os(){}var qC="task",vg="listener",Sg="completed",fd="cancelled",jC=`task-${fd}`,UC=`task-${Sg}`,dd=`${vg}-${fd}`,VC=`${vg}-${Sg}`,ls=class{constructor(e){ue(this,"code");ue(this,"name","TaskAbortError");ue(this,"message");this.code=e,this.message=`${qC} ${fd} (reason: ${e})`}},md=(e,t)=>{if(typeof e!="function")throw new TypeError(dt(32))},is=()=>{},bg=(e,t=is)=>(e.catch(t),e),Ag=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),un=e=>{if(e.aborted)throw new ls(e.reason)};function wg(e,t){let r=is;return new Promise((n,o)=>{let i=()=>o(new ls(e.reason));if(e.aborted){i();return}r=Ag(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=is})}var GC=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof ls?"cancelled":"rejected",error:r}}finally{t?.()}});return function GC(_x5,_x6){return _ref5.apply(this,arguments)}}(),as=e=>t=>bg(wg(e,t).then(r=>(un(e),r))),xg=e=>{let t=as(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:oo}=Object,lg={},ds="listenerMiddleware",BC=(e,t)=>{let r=n=>Ag(e,()=>n.abort(e.reason));return(n,o)=>{md(n,"taskExecutor");let i=new l.AbortController;r(i);let a=GC(/*#__PURE__*/_asyncToGenerator(function*(){un(e),un(i.signal);let s=yield n({pause:as(i.signal),delay:xg(i.signal),signal:i.signal});return un(i.signal),s}),()=>i.abort(UC));return o?.autoJoin&&t.push(a.catch(is)),{result:as(e)(a),cancel(){i.abort(jC)}}}},$C=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){un(t);let i=()=>{},a=[new Promise((s,u)=>{let c=e({predicate:n,effect:(g,v)=>{v.unsubscribe(),s([g,v.getState(),v.getOriginalState()])}});i=()=>{c(),u()}})];o!=null&&a.push(new Promise(s=>setTimeout(s,o,null)));try{let s=yield wg(t,Promise.race(a));return un(t),s}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>bg(r(n,o))},Cg=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=L(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(dt(21));return md(i,"options.listener"),{predicate:o,type:t,effect:i}},Eg=oo(e=>{let{type:t,predicate:r,effect:n}=Cg(e);return{id:Di(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(dt(22))}}},{withTypes:()=>Eg}),dg=(e,t)=>{let{type:r,effect:n,predicate:o}=Cg(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},pd=e=>{e.pending.forEach(t=>{t.abort(dd)})},QC=(e,t)=>()=>{for(let r of t.keys())pd(r);e.clear()},pg=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Rg=oo(L(`${ds}/add`),{withTypes:()=>Rg}),HC=L(`${ds}/removeAll`),Ig=oo(L(`${ds}/remove`),{withTypes:()=>Ig}),zC=(...e)=>{console.error(`${ds}/error`,...e)},Tg=(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=zC}=e;md(a,"onError");let s=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&pd(h)}),u=h=>{let y=dg(t,h)??Eg(h);return s(y)};oo(u,{withTypes:()=>u});let c=h=>{let y=dg(t,h);return y&&(y.unsubscribe(),h.cancelActive&&pd(y)),!!y};oo(c,{withTypes:()=>c});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,b,x){let I=new l.AbortController,N=$C(u,I.signal),_=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(y,oo({},b,{getOriginalState:x,condition:(P,w)=>N(P,w).then(Boolean),take:N,delay:xg(I.signal),pause:as(I.signal),extra:i,signal:I.signal,fork:BC(I.signal,_),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((P,w,O)=>{P!==I&&(P.abort(dd),O.delete(P))})},cancel:()=>{I.abort(dd),h.pending.delete(I)},throwIfCancelled:()=>{un(I.signal)}})))}catch(P){P instanceof ls||pg(a,P,{raisedBy:"effect"})}finally{yield Promise.all(_),I.abort(VC),o(h),h.pending.delete(I)}});return function g(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),v=QC(t,r);return{middleware:h=>y=>b=>{if(!Si(b))return y(b);if(Rg.match(b))return u(b.payload);if(HC.match(b)){v();return}if(Ig.match(b))return c(b.payload);let x=h.getState(),I=()=>{if(x===lg)throw new Error(dt(23));return x},N;try{if(N=y(b),t.size>0){let _=h.getState(),P=Array.from(t.values());for(let w of P){let O=!1;try{O=w.predicate(b,_,x)}catch(k){O=!1,pg(a,k,{raisedBy:"predicate"})}O&&g(w,b,h,I)}}}finally{x=lg}return N},startListening:u,stopListening:c,clearListeners:v}};function dt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}m();d();f();p();var Y=new H({required:!0,emptyAllowed:!1}),rt=new H({required:!1,emptyAllowed:!1}),nt=new H({required:!0,emptyAllowed:!0}),Sq=new H({required:!1,emptyAllowed:!0}),ps=new Ae({each:Y,required:!0}),_g=new H({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),kg=new H({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),bq=new H({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),dr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),Ot=(e,t)=>{if("required"in t)return{payload:new yt({value:t}).validate({value:e}).value};let o=new re({options:{required:!0},values:t}).validate(e);if(o)throw new fi(o);return{payload:e}},V=(e,t)=>{try{return Ot(e,t)}catch(r){return{payload:e,error:dr(r)}}},Og=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return Ng(e,t,r,o,"Controller initialization error")},Pg=(e,t,r,n)=>{let o=`Check the options of ${n}`;return Ng(e,t,r,o,"Controller initialization error")},Ng=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};m();d();f();p();var so="3.58.1",Fg=["@coveo/atomic","@coveo/quantic"];var gd=()=>rt,Dg=()=>Y,Rr=L("configuration/updateBasicConfiguration",e=>V(e,{accessToken:rt,environment:new H({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:rt})),Kt=L("configuration/updateSearchConfiguration",e=>V(e,{proxyBaseUrl:new H({required:!1,url:!0}),pipeline:new H({required:!1,emptyAllowed:!0}),searchHub:rt,timezone:rt,locale:rt,authenticationProviders:new Ae({required:!1,each:Y})})),WC={enabled:new fe({default:!0}),originContext:gd(),originLevel2:gd(),originLevel3:gd(),proxyBaseUrl:new H({required:!1,url:!0}),runtimeEnvironment:new qe,anonymous:new fe({default:!1}),deviceId:rt,userDisplayName:rt,documentLocation:rt,trackingId:kg,analyticsMode:new H({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new re({options:{required:!1},values:Fg.reduce((e,t)=>(e[t]=_g,e),{})})},co=L("configuration/updateAnalyticsConfiguration",e=>V(e,WC)),uo=L("configuration/analytics/disable"),lo=L("configuration/analytics/enable"),fs=L("configuration/analytics/originlevel2",e=>V(e,{originLevel2:Dg()})),ms=L("configuration/analytics/originlevel3",e=>V(e,{originLevel3:Dg()})),Mg=L("knowledge/setAgentId",e=>V(e,new H({required:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var Lg={q:new H,enableQuerySyntax:new fe,aq:new H,cq:new H,firstResult:new ne({min:0}),numberOfResults:new ne({min:0}),sortCriteria:new H,f:new re,fExcluded:new re,cf:new re,nf:new re,mnf:new re,df:new re,debug:new fe,sf:new re,tab:new H,af:new re};var Ir=L("searchParameters/restore",e=>V(e,Lg)),qg=L("searchParameters/restoreTab",e=>V(e,Y));m();d();f();p();var gs=L("debug/enable"),hs=L("debug/disable");m();d();f();p();var ys=()=>!1;var vs=Be(ys(),e=>{e.addCase(gs,()=>!0).addCase(hs,()=>!1).addCase(Ir,(t,r)=>r.payload.debug??t)});m();d();f();p();var po=L("pipeline/set",e=>V(e,new H({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();var KC=L("history/undo"),YC=L("history/redo"),Yt=L("history/snapshot"),_j=ke("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(KC()),yield t(St())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),kj=ke("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(YC()),yield t(St())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),St=ke("history/change",/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x15,_x16){return _ref1.apply(this,arguments)}}());m();d();f();p();var Tr=()=>"";var fo=Be(Tr(),e=>{e.addCase(po,(t,r)=>r.payload).addCase(St.fulfilled,(t,r)=>r.payload?.pipeline??t).addCase(Kt,(t,r)=>r.payload.pipeline||t)});m();d();f();p();m();d();f();p();var Ss=L("app/setError");m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function XC(){return typeof navigator<"u"}function jg(){try{return typeof localStorage<"u"}catch{return!1}}function Ug(){try{return typeof sessionStorage<"u"}catch{return!1}}function Vg(){return XC()&&navigator.cookieEnabled}m();d();f();p();var pn=class e{static set(t,r,n){let o;n&&(o=new Date,o.setTime(o.getTime()+n)),hd(t,r,o,ZC(window.location.hostname))}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 ZC(e){if(e.indexOf(".")===-1)return;let t=e.split(".");for(let r=2;r<=t.length;r++){let n=t.slice(-r).join(".");if(JC(n))return n}}function JC(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return hd(t,"1",void 0,e),pn.get(t)==="1"}catch{return!1}finally{try{hd(t,"",new Date(0),e)}catch{}}}function hd(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function Gg(){return jg()?localStorage:Vg()?new bs:Ug()?sessionStorage:new yd}var bs=class e{getItem(t){return pn.get(`${e.prefix}${t}`)}removeItem(t){pn.erase(`${e.prefix}${t}`)}setItem(t,r,n){pn.set(`${e.prefix}${t}`,r,n)}};bs.prefix="coveo_";var yd=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var As="__coveo.analytics.history",eE=20,tE=1e3*60,rE=75,ws=class{constructor(t){this.store=t||Gg()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _this9=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this9.cropQueryElement(_this9.stripEmptyQuery(t));let r=yield _this9.getHistoryWithInternalTimeAsync();r!=null?_this9.isValidEntry(t)&&_this9.setHistory([t].concat(r)):_this9.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this0=this;return _asyncToGenerator(function*(){let t=yield _this0.getHistoryWithInternalTimeAsync();return _this0.stripEmptyQueries(_this0.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(As);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this1=this;return _asyncToGenerator(function*(){try{let t=yield _this1.store.getItem(As);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(As,JSON.stringify(t.slice(0,eE)))}catch{}}clear(){try{this.store.removeItem(As)}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,rE)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>tE:!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 fn=class fn extends ws{static getInstance(t){return fn.instance||(fn.instance=new fn(t)),fn.instance}constructor(t){super(t)}};ue(fn,"instance",null);var ht=fn;m();d();f();p();m();d();f();p();var mo=ze(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${so}`));m();d();f();p();m();d();f();p();function pr(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 s(g){try{c(n.next(g))}catch(v){a(v)}}function u(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})}var Ce;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(Ce||(Ce={}));function bd(){return typeof window<"u"}function Fd(){return typeof navigator<"u"}function go(){return typeof document<"u"}function Ad(){try{return typeof localStorage<"u"}catch{return!1}}function nE(){try{return typeof sessionStorage<"u"}catch{return!1}}function eh(){return Fd()&&navigator.cookieEnabled}var oE=[Ce.click,Ce.custom,Ce.search,Ce.view],iE=(e,t)=>oE.indexOf(e)!==-1?Object.assign({language:go()?document.documentElement.lang:"unknown",userAgent:Fd()?navigator.userAgent:"unknown"},t):t,ho=class e{static set(t,r,n){let o;n&&(o=new Date,o.setTime(o.getTime()+n)),wd(t,r,o,aE(window.location.hostname))}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 aE(e){if(e.indexOf(".")===-1)return;let t=e.split(".");for(let r=2;r<=t.length;r++){let n=t.slice(-r).join(".");if(sE(n))return n}}function sE(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return wd(t,"1",void 0,e),ho.get(t)==="1"}catch{return!1}finally{try{wd(t,"",new Date(0),e)}catch{}}}function wd(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function cE(){return Ad()?localStorage:eh()?new Li:nE()?sessionStorage:new vo}var Li=class e{getItem(t){return ho.get(`${e.prefix}${t}`)}removeItem(t){ho.erase(`${e.prefix}${t}`)}setItem(t,r,n){ho.set(`${e.prefix}${t}`,r,n)}};Li.prefix="coveo_";var xd=class{constructor(){this.cookieStorage=new Li}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)}},vo=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},xs="__coveo.analytics.history",uE=20,lE=1e3*60,dE=75,Es=class{constructor(t){this.store=t||cE()}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(xs);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(xs);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(xs,JSON.stringify(t.slice(0,uE)))}catch{}}clear(){try{this.store.removeItem(xs)}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,dE)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>lE:!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 pE=(e,t)=>U(void 0,void 0,void 0,function*(){return e===Ce.view?(yield fE(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),fE=e=>U(void 0,void 0,void 0,function*(){let t=new Es,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),mE=/^(?:[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 Rs(e){return typeof e=="string"&&mE.test(e)}function Bg(e){if(!Rs(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 ot=[];for(let e=0;e<256;++e)ot.push((e+256).toString(16).slice(1));function th(e,t=0){return(ot[e[t+0]]+ot[e[t+1]]+ot[e[t+2]]+ot[e[t+3]]+"-"+ot[e[t+4]]+ot[e[t+5]]+"-"+ot[e[t+6]]+ot[e[t+7]]+"-"+ot[e[t+8]]+ot[e[t+9]]+"-"+ot[e[t+10]]+ot[e[t+11]]+ot[e[t+12]]+ot[e[t+13]]+ot[e[t+14]]+ot[e[t+15]]).toLowerCase()}var gE=new Uint8Array(16);function hE(){return crypto.getRandomValues(gE)}function yE(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 vE="6ba7b810-9dad-11d1-80b4-00c04fd430c8",SE="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function bE(e,t,r,n,o,i){let a=typeof r=="string"?yE(r):r,s=typeof n=="string"?Bg(n):n;if(typeof n=="string"&&(n=Bg(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+a.length);return u.set(s),u.set(a,s.length),u=t(u),u[6]=u[6]&15|e,u[8]=u[8]&63|128,th(u)}function mn(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():AE(e,t,r)}function AE(e,t,r){e=e||{};let n=e.random??e.rng?.()??hE();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 th(n)}function wE(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 vd(e,t){return e<<t|e>>>32-t}function xE(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 s=0;s<i;++s){let u=new Uint32Array(16);for(let c=0;c<16;++c)u[c]=e[s*64+c*4]<<24|e[s*64+c*4+1]<<16|e[s*64+c*4+2]<<8|e[s*64+c*4+3];a[s]=u}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 s=0;s<i;++s){let u=new Uint32Array(80);for(let y=0;y<16;++y)u[y]=a[s][y];for(let y=16;y<80;++y)u[y]=vd(u[y-3]^u[y-8]^u[y-14]^u[y-16],1);let c=r[0],g=r[1],v=r[2],R=r[3],h=r[4];for(let y=0;y<80;++y){let b=Math.floor(y/20),x=vd(c,5)+wE(b,g,v,R)+h+t[b]+u[y]>>>0;h=R,R=v,v=vd(g,30)>>>0,g=c,c=x}r[0]=r[0]+c>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+v>>>0,r[3]=r[3]+R>>>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 Is(e,t,r,n){return bE(80,xE,e,t)}Is.DNS=vE;Is.URL=SE;var rh="2.33.1",$g=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Mi={pageview:"pageview",event:"event"},Ts=class{constructor({client:t,uuidGenerator:r=mn}){this.client=t,this.uuidGenerator=r}},Cd=class extends Ts{constructor({client:t,uuidGenerator:r=mn}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=$g(window.location),this.lastReferrer=go()?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:go()?document.title:"",encoding:go()?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===Mi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===Mi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Mi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Mi.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 $g(window.location)}},_r=class e{constructor(t,r){if(!Rs(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 Rs(i)?new e(i,Number.parseInt(o)*1e3):null}};_r.cvo_cid="cvo_cid";_r.expirationTime=120;var Ed=class extends Ts{constructor({client:t,uuidGenerator:r=mn}){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(_r.cvo_cid,new _r(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Ed.Id="link";var Nt=Object.keys;function Cs(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Sd=128,nh=192,Qg=224,Hg=240;function CE(e){return(e&248)===Hg?4:(e&Hg)===Qg?3:(e&Qg)===nh?2:1}function EE(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&Sd)!=Sd)break;if(r-=3,(n&nh)!=Sd){t-r>=CE(n)*3&&(r=t);break}}return e.substring(0,r)}var Rd={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"},RE=Nt(Rd).map(e=>Rd[e]),IE=[...RE].join("|"),TE=new RegExp(`^(${IE}$)`),_E={svcAction:"svc_action",svcActionData:"svc_action_data"},kE=e=>Nt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=Rd[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),OE=e=>TE.test(e),PE=[OE],zg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Wg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},pt={action:"pa",list:"pal",listSource:"pls"},_s={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},NE=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Id={id:"quoteId",affiliation:"quoteAffiliation"},Td={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},FE={add:pt,bookmark_add:pt,bookmark_remove:pt,click:pt,checkout:pt,checkout_option:pt,detail:pt,impression:pt,remove:pt,refund:Object.assign(Object.assign({},pt),_s),purchase:Object.assign(Object.assign({},pt),_s),quickview:pt,quote:Object.assign(Object.assign({},pt),Id),review:Object.assign(Object.assign({},pt),Td)},DE=Nt(zg).map(e=>zg[e]),ME=Nt(Wg).map(e=>Wg[e]),LE=Nt(pt).map(e=>pt[e]),qE=Nt(_s).map(e=>_s[e]),jE=Nt(Td).map(e=>Td[e]),UE=Nt(Id).map(e=>Id[e]),VE=[...DE,"custom"].join("|"),GE=[...ME,"custom"].join("|"),oh="(pr[0-9]+)",ih="(il[0-9]+pi[0-9]+)",BE=new RegExp(`^${oh}(${VE})$`),$E=new RegExp(`^(${ih}(${GE}))|(il[0-9]+nm)$`),QE=new RegExp(`^(${LE.join("|")})$`),HE=new RegExp(`^(${qE.join("|")})$`),zE=new RegExp(`^${oh}custom$`),WE=new RegExp(`^${ih}custom$`),KE=new RegExp(`^(${[...NE,...jE,...UE].join("|")})$`),YE=e=>BE.test(e),XE=e=>$E.test(e),ZE=e=>QE.test(e),JE=e=>HE.test(e),eR=e=>KE.test(e),tR=[XE,YE,ZE,JE,eR],rR=[zE,WE],nR={anonymizeIp:"aip"},oR={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},iR={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},aR=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],sR=Object.assign(Object.assign(Object.assign(Object.assign({},nR),oR),iR),aR.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),_d=Object.assign(Object.assign({},sR),_E),cR=e=>{let t=!!e.action&&FE[e.action]||{};return Nt(e).reduce((r,n)=>{let o=t[n]||_d[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},uR=Nt(_d).map(e=>_d[e]),lR=e=>uR.indexOf(e)!==-1,dR=e=>e==="custom",pR=e=>[...tR,...PE,lR,dR].some(t=>t(e)),fR=e=>Nt(e).reduce((t,r)=>{let n=mR(r);return n?Object.assign(Object.assign({},t),gR(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),mR=e=>{let t;return[...rR].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},gR=(e,t)=>Nt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),kd=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:s}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),u=this.encodeForEventType(t,s),c=new Blob([u],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(a,c)})}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:s,body:u}=a;o=s||t;try{i=JSON.parse(u)}catch(c){console.error("Unable to process the request body as a JSON string",c)}}return{payload:i,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return 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[Ce.click,Ce.custom,Ce.search,Ce.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}},Od=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()})}},Kg=A.fetch,ks=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():"",s={url:`${n}/analytics/${t}${a}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},u=Object.assign(Object.assign({},s),i?yield i(s,"analyticsFetch"):{}),{url:c}=u,g=pr(u,["url"]),v;try{v=yield Kg(c,g)}catch(R){console.error("An error has occurred when sending the event.",R);return}if(v.ok){let R=yield v.json();return R.visitorId&&o.setCurrentVisitorId(R.visitorId),R}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 Kg(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[Ce.click,Ce.custom,Ce.search,Ce.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"})}},Pd=class{constructor(t,r){Ad()&&eh()?this.storage=new xd:Ad()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new vo),this.client=new ks(t),this.beaconClient=new kd(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}},Nd=class{constructor(t,r){this.storage=r||new vo,this.client=new ks(t)}getClientDependingOnEventType(t){return this.client}},Os=class{constructor(){this.storage=new vo,this.client=new Od}getClientDependingOnEventType(t){return this.client}},hR="xx",yR=e=>e?.startsWith(hR)||!1,vR=`
|
|
27
|
+
`;return new fi(r)}var fi=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},yt=class{constructor(e){ue(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 zw(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}},qe=class{constructor(e={}){ue(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&ce(e)?"value is required.":null}get default(){return this.baseConfig.default instanceof Function?this.baseConfig.default():this.baseConfig.default}get required(){return this.baseConfig.required===!0}};function Je(e){return e===void 0}function Ww(e){return e===null}function ce(e){return Je(e)||Ww(e)}var fe=class{constructor(e={}){ue(this,"value");this.value=new qe(e)}validate(e){let t=this.value.validate(e);return t||(Kw(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function Kw(e){return Je(e)||fm(e)}function fm(e){return typeof e=="boolean"}var ne=class{constructor(e={}){ue(this,"config");ue(this,"value");this.config=e,this.value=new qe(e)}validate(e){let t=this.value.validate(e);return t||(Yw(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 Yw(e){return Je(e)||mm(e)}function mm(e){return typeof e=="number"&&!Number.isNaN(e)}var Xw=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,H=class{constructor(e={}){ue(this,"value");ue(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new qe(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(Je(e))return null;if(!ka(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&&!(Xw.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 ka(e){return Object.prototype.toString.call(e)==="[object String]"}var re=class{constructor(e={}){ue(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Je(e))return this.config.options.required?"value is required and is currently undefined":null;if(!gm(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ce(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],i=n.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function gm(e){return e!==void 0&&typeof e=="object"}var Ae=class{constructor(e={}){ue(this,"config");ue(this,"value");this.config=e,this.value=new qe(this.config)}validate(e){if(!ce(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ce(e))return null;if(this.config.max!==void 0&&e.length>this.config.max)return`value contains more than ${this.config.max}`;if(this.config.min!==void 0&&e.length<this.config.min)return`value contains less than ${this.config.min}`;if(this.config.each!==void 0){let r="";return e.forEach(n=>{this.config.each.required&&ce(n)&&(r=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(n,this.config.each);o!==null&&(r+=` ${o}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return fm(e)||ka(e)||mm(e)||gm(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function hm(e){return Array.isArray(e)}var Fl=class{constructor(e){ue(this,"config");ue(this,"value");this.config=e,this.value=new qe(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Je(e)||Object.values(this.config.enum).find(n=>n===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();f();p();function ym(e){return Array.isArray(e)}function Oa(e){return e.trim()===""}var Zw=new Set(["1",1,"yes",!0]);function Dl(){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=>Zw.has(r))}function vm(e){let t={};for(let[r,n]of e)t[r]=n;return t}function mi(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Pa(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 Jw(e){if(Oa(e.openingDelimiter)||Oa(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(ce(e.content)||Oa(e.content))return e.content;if(e.highlights.length===0)return Xn(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,s=a+i.length;if(s>t)break;r+=Xn(e.content.slice(n,a)),r+=e.openingDelimiter,r+=Xn(e.content.slice(a,s)),r+=e.closingDelimiter,n=s}return n!==t&&(r+=Xn(e.content.slice(n))),r}function ex(e,t){return e=Xn(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?Ml(n,t.notMatchDelimiters):o?Ml(o,t.exactMatchDelimiters):i?Ml(i,t.correctionDelimiters):r)}function Ml(e,t){return t?t.open+e+t.close:e}function Xn(e){let t={"&":"&","<":"<",">":">","\"":""","'":"'","`":"`"},r=`(?:${Object.keys(t).join("|")})`,n=RegExp(r),o=RegExp(r,"g");return n.test(e)?e.replace(o,i=>t[i]):e}m();d();f();p();var km=jt(Rm(),1);m();d();f();p();var Qt=new Error("Failed to load reducers."),Zn=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."}},tn=class extends Error{constructor(r,n){super();ue(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};m();d();f();p();function Im(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function Tm(e){return typeof e!="object"||!e?!1:Object.values(e).every(Rx)}function Rx(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function _m(e){return e===429}var Ut=class e{static call(t){return _asyncToGenerator(function*(){let r=Ix(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:i,...a}=o,s=/*#__PURE__*/function(){var _s2=_asyncToGenerator(function*(){let u=yield C(i,a);if(_m(u.status))throw u;return u});function s(){return _s2.apply(this,arguments)}return s}();try{let u=yield(0,km.backOff)(s,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _retry=_asyncToGenerator(function*(c){let g=c&&_m(c.status);return g&&(n.info("Platform retrying request"),yield new Promise(v=>setTimeout(v,1e3))),g});function retry(_x2){return _retry.apply(this,arguments)}return retry}()});switch(u.status){case 419:case 401:throw n.info("Platform renewing token"),new Zn;case 404:throw new tn(i,u.status);default:return n.info({response:u,requestInfo:o},"Platform response"),u}}catch(u){return u.message==="Failed to fetch"?new tn(i):u}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:s,...u}=t,c=mi(u);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 c})()}};function kt(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Jn(e,t,r="prod"){return e??kt(t,r)}function wr(e,t="prod"){return`${kt(e,t)}/rest/search/v2`}function Fa(e,t="prod"){return`${kt(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function Ix(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,s=e.method==="POST"||e.method==="PUT",u=Tx(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(s&&{body:u}),signal:a}}function Tx(e,t){return t==="application/x-www-form-urlencoded"?Tm(e)?Im(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();var Da=e=>e;m();d();f();p();m();d();f();p();function Ma(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Ht(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Ma(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Ma(),extendedResults:{},searchAction:void 0}}m();d();f();p();function xr(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Cr=e=>{let{response:t}=e;return t.body?_x(e):kx(t)},_x=e=>Px(e)?Nx(e):Ox(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},kx=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function Ox(e){return e.body.statusCode!==void 0}function Px(e){return e.body.exception!==void 0}var Nx=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();var Er=class{constructor(){ue(this,"currentAbortController",null)}enqueue(t,r){var _this=this;return _asyncToGenerator(function*(){let n=_this.currentAbortController;_this.currentAbortController=new l.AbortController;let o=_this.currentAbortController;n&&(r.warnOnAbort&&r.logger.warn("Cancelling current pending search query"),n.abort());try{return yield t(o?.signal??null)}finally{_this.currentAbortController===o&&(_this.currentAbortController=null)}})()}};m();d();f();p();m();d();f();p();var yi=class{constructor(t){ue(this,"_basePath");ue(this,"_params",{});this._basePath=t}addParam(t,r){this._params={...this.params,[t]:r}}get basePath(){return this._basePath}get params(){return this._params}get hasParams(){return Object.entries(this._params).length}get href(){return this.hasParams?`${this.basePath}?${Object.entries(this.params).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}`:this.basePath}};m();d();f();p();function Om(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var sr=(e,t,r,n)=>{let o=new yi(`${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 Pm=/*#__PURE__*/function(){var _Pm=_asyncToGenerator(function*(e,t){let r=yield Ut.call({...sr(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:xr(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Om(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return Fx(a)?{success:a}:{error:Cr({response:r,body:a})}});function Pm(_x3,_x4){return _Pm.apply(this,arguments)}return Pm}();function Fx(e){return typeof e=="string"}m();d();f();p();function Dx(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function Mx(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function La(e,t){if(t&&e.name==="AbortError")return{error:Mx(e)};if(e instanceof tn)return{error:Dx(e)};throw e}var qa=class{constructor(t){ue(this,"options",t);ue(this,"apiCallsQueues",{unknown:new Er,mainSearch:new Er,facetValues:new Er,foldingCollection:new Er,instantResults:new Er})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json","/plan"),requestParams:xr(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return La(r);let n=yield r.json();return qx(n)?{success:n}:{error:Cr({response:r,body:n})}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:xr(t),..._this3.options});if(r instanceof Error)return La(r);let n=yield r.json(),o={response:r,body:n};return Lx(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:Cr(o)}})()}search(t,r){var _this4=this;return _asyncToGenerator(function*(){let n=r?.origin??"unknown",o=yield _this4.apiCallsQueues[n].enqueue(s=>Ut.call({...sr(t,"POST","application/json",""),requestParams:xr(t),requestMetadata:{method:"search",origin:r?.origin},..._this4.options,signal:s??void 0}),{logger:_this4.options.logger,warnOnAbort:!r?.disableAbortWarning});if(o instanceof Error)return La(o,r?.disableAbortWarning);let i=yield o.json(),a={response:o,body:i};return Nm(i)?(a.body=Fm(i),{success:(yield _this4.options.postprocessSearchResponseMiddleware(a)).body}):{error:Cr(a)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json","/facet"),requestParams:xr(t),requestMetadata:{method:"facetSearch"},..._this5.options});if(r instanceof Error)throw r;let n=yield r.json(),o={response:r,body:n};return(yield _this5.options.postprocessFacetSearchResponseMiddleware(o)).body})()}recommendations(t){var _this6=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json",""),requestParams:xr(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if(Nm(n)){let o={response:r,body:n};return o.body=Fm(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:Cr({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return Pm(t,{..._this7.options})})()}fieldDescriptions(t){var _this8=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},..._this8.options});if(r instanceof Error)throw r;let n=yield r.json();return jx(n)?{success:n}:{error:Cr({response:r,body:n})}})()}},ja=e=>e.success!==void 0,vt=e=>e.error!==void 0;function Nm(e){return e.results!==void 0}function Fm(e){let t=Ma();return ce(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function Lx(e){return e.completions!==void 0}function qx(e){return e.preprocessingOutput!==void 0}function jx(e){return e.fields!==void 0}m();d();f();p();var Dm=e=>e,Mm=e=>e,Lm=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();function et(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 Ux=typeof Symbol=="function"&&Symbol.observable||"@@observable",qm=Ux,Hl=()=>Math.random().toString(36).substring(7).split("").join("."),Vx={INIT:`@@redux/INIT${Hl()}`,REPLACE:`@@redux/REPLACE${Hl()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Hl()}`},Ua=Vx;function zt(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 zl(e,t,r){if(typeof e!="function")throw new Error(et(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(et(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(et(1));return r(zl)(e,t)}let n=e,o=t,i=new Map,a=i,s=0,u=!1;function c(){a===i&&(a=new Map,i.forEach((x,I)=>{a.set(I,x)}))}function g(){if(u)throw new Error(et(3));return o}function v(x){if(typeof x!="function")throw new Error(et(4));if(u)throw new Error(et(5));let I=!0;c();let N=s++;return a.set(N,x),function(){if(I){if(u)throw new Error(et(6));I=!1,c(),a.delete(N),i=null}}}function R(x){if(!zt(x))throw new Error(et(7));if(typeof x.type>"u")throw new Error(et(8));if(typeof x.type!="string")throw new Error(et(17));if(u)throw new Error(et(9));try{u=!0,o=n(o,x)}finally{u=!1}return(i=a).forEach(N=>{N()}),x}function h(x){if(typeof x!="function")throw new Error(et(10));n=x,R({type:Ua.REPLACE})}function y(){let x=v;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(et(11));function N(){let P=I;P.next&&P.next(g())}return N(),{unsubscribe:x(N)}},[qm](){return this}}}return R({type:Ua.INIT}),{dispatch:R,subscribe:v,getState:g,replaceReducer:h,[qm]:y}}function Gx(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Ua.INIT})>"u")throw new Error(et(12));if(typeof r(void 0,{type:Ua.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(et(13))})}function rn(e){let t=Object.keys(e),r={};for(let a=0;a<t.length;a++){let s=t[a];typeof e[s]=="function"&&(r[s]=e[s])}let n=Object.keys(r),o,i;try{Gx(r)}catch(a){i=a}return function(s={},u){if(i)throw i;let c=!1,g={};for(let v=0;v<n.length;v++){let R=n[v],h=r[R],y=s[R],b=h(y,u);if(typeof b>"u"){let x=u&&u.type;throw new Error(et(14))}g[R]=b,c=c||b!==y}return c=c||n.length!==Object.keys(s).length,c?g:s}}function vi(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function jm(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(et(15))},a={getState:o.getState,dispatch:(u,...c)=>i(u,...c)},s=e.map(u=>u(a));return i=vi(...s)(o.dispatch),{...o,dispatch:i}}}function Si(e){return zt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var rd=Symbol.for("immer-nothing"),bi=Symbol.for("immer-draftable"),Ke=Symbol.for("immer-state");function tt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ct=Object,on=Ct.getPrototypeOf,Ai="constructor",Ri="prototype",Yl="configurable",$a="enumerable",Ga="writable",wi="value",gt=e=>!!e&&!!e[Ke];function lt(e){return e?zm(e)||Ti(e)||!!e[bi]||!!e[Ai]?.[bi]||_i(e)||ro(e):!1}var Bx=Ct[Ri][Ai].toString(),Um=new WeakMap;function zm(e){if(!e||!to(e))return!1;let t=on(e);if(t===null||t===Ct[Ri])return!0;let r=Ct.hasOwnProperty.call(t,Ai)&&t[Ai];if(r===Object)return!0;if(!nn(r))return!1;let n=Um.get(r);return n===void 0&&(n=Function.toString.call(r),Um.set(r,n)),n===Bx}function nd(e){return gt(e)||tt(15,e),e[Ke].base_}function Ii(e,t,r=!0){an(e)===0?(r?Reflect.ownKeys(e):Ct.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function an(e){let t=e[Ke];return t?t.type_:Ti(e)?1:_i(e)?2:ro(e)?3:0}var eo=(e,t,r=an(e))=>r===2?e.has(t):Ct[Ri].hasOwnProperty.call(e,t),cr=(e,t,r=an(e))=>r===2?e.get(t):e[t],Qa=(e,t,r,n=an(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function $x(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ti=Array.isArray,_i=e=>e instanceof Map,ro=e=>e instanceof Set,to=e=>typeof e=="object",nn=e=>typeof e=="function",Wl=e=>typeof e=="boolean";function Qx(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Hx=e=>to(e)?e?.[Ke]:null,ur=e=>e.copy_||e.base_;var od=e=>e.modified_?e.copy_:e.base_;function Xl(e,t){if(_i(e))return new Map(e);if(ro(e))return new Set(e);if(Ti(e))return Array[Ri].slice.call(e);let r=zm(e);if(t===!0||t==="class_only"&&!r){let n=Ct.getOwnPropertyDescriptors(e);delete n[Ke];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],s=n[a];s[Ga]===!1&&(s[Ga]=!0,s[Yl]=!0),(s.get||s.set)&&(n[a]={[Yl]:!0,[Ga]:!0,[$a]:s[$a],[wi]:e[a]})}return Ct.create(on(e),n)}else{let n=on(e);if(n!==null&&r)return{...e};let o=Ct.create(n);return Ct.assign(o,e)}}function Xa(e,t=!1){return Za(e)||gt(e)||!lt(e)||(an(e)>1&&Ct.defineProperties(e,{set:Va,add:Va,clear:Va,delete:Va}),Ct.freeze(e),t&&Ii(e,(r,n)=>{Xa(n,!0)},!1)),e}function zx(){tt(2)}var Va={[wi]:zx};function Za(e){return e===null||!to(e)?!0:Ct.isFrozen(e)}var Ha="MapSet",za="Patches",Vm="ArrayMethods",Wa={};function sn(e){let t=Wa[e];return t||tt(0,e),t}var Gm=e=>!!Wa[e];function Wx(e,t){Wa[e]||(Wa[e]=t)}var xi,Wm=()=>xi,Kx=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Gm(Ha)?sn(Ha):void 0,arrayMethodsPlugin_:Gm(Vm)?sn(Vm):void 0});function Bm(e,t){t&&(e.patchPlugin_=sn(za),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Zl(e){Jl(e),e.drafts_.forEach(Yx),e.drafts_=null}function Jl(e){e===xi&&(xi=e.parent_)}var $m=e=>xi=Kx(xi,e);function Yx(e){let t=e[Ke];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Qm(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[Ke].modified_&&(Zl(t),tt(4)),lt(e)&&(e=Hm(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[Ke].base_,e,t)}else e=Hm(t,r);return Xx(t,e,!0),Zl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==rd?e:void 0}function Hm(e,t){if(Za(t))return t;let r=t[Ke];if(!r)return Ka(t,e.handledSet_,e);if(!Ja(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);Xm(r,e)}return r.copy_}function Xx(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Xa(t,r)}function Km(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ja=(e,t)=>e.scope_===t,Zx=[];function Ym(e,t,r,n){let o=ur(e),i=e.type_;if(n!==void 0&&cr(o,n,i)===t){Qa(o,n,r,i);return}if(!e.draftLocations_){let s=e.draftLocations_=new Map;Ii(o,(u,c)=>{if(gt(c)){let g=s.get(c)||[];g.push(u),s.set(c,g)}})}let a=e.draftLocations_.get(t)??Zx;for(let s of a)Qa(o,s,r,i)}function Jx(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!Ja(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let a=od(i);Ym(e,i.draft_??i,a,r),Xm(i,o)})}function Xm(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)}Km(e)}}function eC(e,t,r){let{scope_:n}=e;if(gt(r)){let o=r[Ke];Ja(o,n)&&o.callbacks_.push(function(){Ba(e);let a=od(o);Ym(e,r,a,t)})}else lt(r)&&e.callbacks_.push(function(){let i=ur(e);e.type_===3?i.has(r)&&Ka(r,n.handledSet_,n):cr(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Ka(cr(e.copy_,t,e.type_),n.handledSet_,n)})}function Ka(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||gt(e)||t.has(e)||!lt(e)||Za(e)||(t.add(e),Ii(e,(n,o)=>{if(gt(o)){let i=o[Ke];if(Ja(i,r)){let a=od(i);Qa(e,n,a,e.type_),Km(i)}}else lt(o)&&Ka(o,t,r)})),e}function tC(e,t){let r=Ti(e),n={type_:r?1:0,scope_:t?t.scope_:Wm(),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=Ya;r&&(o=[n],i=Ci);let{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,[s,n]}var Ya={get(e,t){if(t===Ke)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=ur(e);if(!eo(o,t,e.type_))return nC(e,o,t);let i=o[t];if(e.finalized_||!lt(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Qx(t))return i;if(i===Kl(e.base_,t)||rC(e,t,i)){Ba(e);let a=e.type_===1?+t:t,s=td(e.scope_,i,e,a);return e.copy_[a]=s}return i},has(e,t){return t in ur(e)},ownKeys(e){return Reflect.ownKeys(ur(e))},set(e,t,r){let n=Zm(ur(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Kl(ur(e),t),i=o?.[Ke];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.delete(t),!0;if($x(r,o)&&(r!==void 0||eo(e.base_,t,e.type_)))return!0;Ba(e),ed(e)}return e.copy_[t]===r&&(r!==void 0||eo(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),eC(e,t,r)),!0},deleteProperty(e,t){return Ba(e),Kl(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),ed(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=ur(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Ga]:!0,[Yl]:e.type_!==1||t!=="length",[$a]:n[$a],[wi]:r[t]}},defineProperty(){tt(11)},getPrototypeOf(e){return on(e.base_)},setPrototypeOf(){tt(12)}},Ci={};for(let e in Ya){let t=Ya[e];Ci[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Ci.deleteProperty=function(e,t){return Ci.set.call(this,e,t,void 0)};Ci.set=function(e,t,r){return Ya.set.call(this,e[0],t,r,e[0])};function Kl(e,t){let r=e[Ke];return(r?ur(r):e)[t]}function rC(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||!lt(r)||r[Ke]?!1:e.baseRefs_.has(r)}function nC(e,t,r){let n=Zm(t,r);return n?wi in n?n[wi]:n.get?.call(e.draft_):void 0}function Zm(e,t){if(!(t in e))return;let r=on(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=on(r)}}function ed(e){e.modified_||(e.modified_=!0,e.parent_&&ed(e.parent_))}function Ba(e){e.copy_||(e.assigned_=new Map,e.copy_=Xl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var oC=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(nn(t)&&!nn(r)){let i=r;r=t;let a=this;return function(u=i,...c){return a.produce(u,g=>r.call(this,g,...c))}}nn(r)||tt(6),n!==void 0&&!nn(n)&&tt(7);let o;if(lt(t)){let i=$m(this),a=td(i,t,void 0),s=!0;try{o=r(a),s=!1}finally{s?Zl(i):Jl(i)}return Bm(i,n),Qm(o,i)}else if(!t||!to(t)){if(o=r(t),o===void 0&&(o=t),o===rd&&(o=void 0),this.autoFreeze_&&Xa(o,!0),n){let i=[],a=[];sn(za).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:a}),n(i,a)}return o}else tt(1,t)},this.produceWithPatches=(t,r)=>{if(nn(t))return(a,...s)=>this.produceWithPatches(a,u=>t(u,...s));let n,o;return[this.produce(t,r,(a,s)=>{n=a,o=s}),n,o]},Wl(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Wl(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Wl(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){lt(e)||tt(8),gt(e)&&(e=es(e));let t=$m(this),r=td(t,e,void 0);return r[Ke].isManual_=!0,Jl(t),r}finishDraft(e,t){let r=e&&e[Ke];(!r||!r.isManual_)&&tt(9);let{scope_:n}=r;return Bm(n,t),Qm(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=sn(za).applyPatches_;return gt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function td(e,t,r,n){let[o,i]=_i(t)?sn(Ha).proxyMap_(t,r):ro(t)?sn(Ha).proxySet_(t,r):tC(t,r);return(r?.scope_??Wm()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?Jx(r,i,n):i.callbacks_.push(function(u){u.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:c}=u;i.modified_&&c&&c.generatePatches_(i,[],u)}),o}function es(e){return gt(e)||tt(10,e),Jm(e)}function Jm(e){if(!lt(e)||Za(e))return e;let t=e[Ke],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Xl(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Xl(e,!0);let o=r;return ro(r)&&(r=new Set),Ii(o,(i,a)=>{Qa(r,i,Jm(a))},n),t&&(t.finalized_=!1),r}function eg(){function t(y,b=[]){if(y.key_!==void 0){let x=y.parent_.copy_??y.parent_.base_,I=Hx(cr(x,y.key_)),N=cr(x,y.key_);if(N===void 0||N!==y.draft_&&N!==y.copy_||I!=null&&I.base_!==y.base_)return null;let _=y.parent_.type_===3,P;if(_){let w=y.parent_;P=Array.from(w.drafts_.keys()).indexOf(y.key_)}else P=y.key_;if(!(_&&x.size>P||eo(x,P))||y.parent_.type_===1&&y.parent_.allIndicesReassigned_)return null;b.push(P)}if(y.parent_)return t(y.parent_,b);b.reverse();try{r(y.copy_,b)}catch{return null}return b}function r(y,b){let x=y;for(let I=0;I<b.length-1;I++){let N=b[I];if(x=cr(x,N),!to(x)||x===null)throw new Error(`Cannot resolve path at '${b.join("/")}'`)}return x}let n="replace",o="add",i="remove";function a(y,b,x){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:I,inversePatches_:N}=x;switch(y.type_){case 0:case 2:return u(y,b,I,N);case 1:return s(y,b,I,N);case 3:return c(y,b,I,N)}}function s(y,b,x,I){let{base_:N,assigned_:_}=y,P=y.copy_;P.length<N.length&&([N,P]=[P,N],[x,I]=[I,x]);let w=y.allIndicesReassigned_===!0;for(let O=0;O<N.length;O++){let k=P[O],T=N[O];if((w||_?.get(O.toString()))&&k!==T){let G=k?.[Ke];if(G&&G.modified_)continue;let M=b.concat([O]);x.push({op:n,path:M,value:h(k)}),I.push({op:n,path:M,value:h(T)})}}for(let O=N.length;O<P.length;O++){let k=b.concat([O]);x.push({op:o,path:k,value:h(P[O])})}for(let O=P.length-1;N.length<=O;--O){let k=b.concat([O]);I.push({op:i,path:k})}}function u(y,b,x,I){let{base_:N,copy_:_,type_:P}=y;Ii(y.assigned_,(w,O)=>{let k=cr(N,w,P),T=cr(_,w,P),D=O?eo(N,w)?n:o:i;if(k===T&&D===n)return;let G=b.concat(w);x.push(D===i?{op:D,path:G}:{op:D,path:G,value:h(T)}),I.push(D===o?{op:i,path:G}:D===i?{op:o,path:G,value:h(k)}:{op:n,path:G,value:h(k)})})}function c(y,b,x,I){let{base_:N,copy_:_}=y,P=0;N.forEach(w=>{if(!_.has(w)){let O=b.concat([P]);x.push({op:i,path:O,value:w}),I.unshift({op:o,path:O,value:w})}P++}),P=0,_.forEach(w=>{if(!N.has(w)){let O=b.concat([P]);x.push({op:o,path:O,value:w}),I.unshift({op:i,path:O,value:w})}P++})}function g(y,b,x){let{patches_:I,inversePatches_:N}=x;I.push({op:n,path:[],value:b===rd?void 0:b}),N.push({op:n,path:[],value:y})}function v(y,b){return b.forEach(x=>{let{path:I,op:N}=x,_=y;for(let k=0;k<I.length-1;k++){let T=an(_),D=I[k];typeof D!="string"&&typeof D!="number"&&(D=""+D),(T===0||T===1)&&(D==="__proto__"||D===Ai)&&tt(19),nn(_)&&D===Ri&&tt(19),_=cr(_,D),(_===null||!to(_))&&tt(18,I.join("/"))}let P=an(_),w=R(x.value),O=I[I.length-1];switch(N){case n:switch(P){case 2:return _.set(O,w);case 3:tt(16);default:return _[O]=w}case o:switch(P){case 1:return O==="-"?_.push(w):_.splice(O,0,w);case 2:return _.set(O,w);case 3:return _.add(w);default:return _[O]=w}case i:switch(P){case 1:return _.splice(O,1);case 2:return _.delete(O);case 3:return _.delete(x.value);default:return delete _[O]}default:tt(17,N)}}),y}function R(y){if(!lt(y))return y;if(Ti(y))return y.map(R);if(_i(y))return new Map(Array.from(y.entries()).map(([x,I])=>[x,R(I)]));if(ro(y))return new Set(Array.from(y).map(R));let b=Object.create(on(y));for(let x in y)b[x]=R(y[x]);return eo(y,bi)&&(b[bi]=y[bi]),b}function h(y){return gt(y)?R(y):y}Wx(za,{applyPatches_:v,generatePatches_:a,generateReplacementPatches_:g,getPath:t})}var iC=A.Iterator,jL=typeof iC?.from=="function";var Ei=new oC,cn=Ei.produce,id=Ei.produceWithPatches.bind(Ei);var ad=Ei.applyPatches.bind(Ei);m();d();f();p();var aC=class{constructor(e){this.value=e}deref(){return this.value}},sC=()=>typeof WeakRef>"u"?aC:WeakRef,rg=sC(),cC=0,ts=1;function ki(){return{s:cC,v:void 0,o:null,p:null}}function uC(e){return e instanceof rg?e.deref():e}function no(e,t={}){let r=ki(),{resultEqualityCheck:n,maxSize:o}=t,i=o!==void 0;if(i&&(!Number.isInteger(o)||o<1))throw new TypeError(`maxSize must be a positive integer, received: ${o}`);let a=null,s=0,u,c=0,g=!1;function v(){s>=o&&(a=r,r=ki(),s=0)}function R(){let h=r,{length:y}=arguments;for(let I=0,N=y;I<N;I++){let _=arguments[I];if(typeof _=="function"||typeof _=="object"&&_!==null){let P=h.o;P===null&&(h.o=P=new WeakMap);let w=P.get(_);w===void 0?(h=ki(),P.set(_,h)):h=w}else{let P=h.p;P===null&&(h.p=P=new Map);let w=P.get(_);w===void 0?(h=ki(),P.set(_,h),s++):h=w}}if(h.s===ts)return h.v;if(a!==null){let I=a;for(let N=0,_=y;N<_;N++){let P=arguments[N],w;if(typeof P=="function"||typeof P=="object"&&P!==null){let O=I.o;w=O!==null?O.get(P):void 0}else{let O=I.p;w=O!==null?O.get(P):void 0}if(w===void 0){I=null;break}I=w}if(I!==null&&I.s===ts){let N=h;return N.s=ts,N.v=I.v,v(),I.v}}let b=h,x=e.apply(null,arguments);if(c++,n){let I=uC(u);I!=null&&n(I,x)&&(x=I,c!==0&&c--),u=typeof x=="object"&&x!==null||typeof x=="function"?new rg(x):x}return b.s=ts,b.v=x,i&&v(),x}return R.clearCache=()=>{r=ki(),a=null,s=0,R.resetResultsCount()},R.resultsCount=()=>c,R.resetResultsCount=()=>{c=0},R}var sd=Symbol("NOT_FOUND");function lC(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function dC(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 tg=e=>Array.isArray(e)?e:[e];function pC(e){let t=Array.isArray(e[0])?e[0]:e;return dC(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function rs(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,a=0,s,u={},c=o.pop();typeof c=="object"&&(u=c,c=o.pop()),lC(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);let g={...r,...u},{memoize:v,memoizeOptions:R=[],argsMemoize:h=no,argsMemoizeOptions:y=[]}=g,b=tg(R),x=tg(y),I=pC(o),N=v(function(){return i++,c.apply(null,arguments)},...b),_=!0,P=h(function(){a++;let{length:O}=I,k=new Array(O);for(let T=0;T<O;T++)k[T]=I[T].apply(null,arguments);return s=N.apply(null,k),s},...x);return Object.assign(P,{resultFunc:c,memoizedResultFunc:N,dependencies:I,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>s,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var ze=rs(no);function fC(e){let t;return{get(r){return t&&e(t.key,r)?t.value:sd},put(r,n){t={key:r,value:n}},findMatchingEntry(r,n){let o=t;return o!==void 0&&n(o.value,r)?o:void 0},clear(){t=void 0}}}function mC(e,t){let r=[];function n(s){let u=r.findIndex(c=>t(c.key,s));if(u>-1){let c=r[u];return u>0&&(r.splice(u,1),r.unshift(c)),c.value}return sd}function o(s,u){r.unshift({key:s,value:u}),r.length>e&&r.pop()}function i(s,u){let c=r,{length:g}=c;for(let v=0;v<g;v++){let R=c[v];if(u(R.value,s))return R}}function a(){r=[]}return{get:n,put:o,findMatchingEntry:i,clear:a}}var gC=(e,t)=>e===t;function hC(e){return function(r,n){if(r===null||n===null||r.length!==n.length)return!1;let{length:o}=r;for(let i=0;i<o;i++)if(!e(r[i],n[i]))return!1;return!0}}function cd(e,t){let r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:n=gC,maxSize:o=1,resultEqualityCheck:i}=r,a=hC(n),s=0,u=o<=1?fC(a):mC(o,a);function c(){let g=u.get(arguments);if(g===sd){if(g=e.apply(null,arguments),s++,i){let v=u.findMatchingEntry(g,i);v&&(g=v.value,s!==0&&s--)}u.put(arguments,g)}return g}return c.clearCache=()=>{u.clear(),c.resetResultsCount()},c.resultsCount=()=>s,c.resetResultsCount=()=>{s=0},c}m();d();f();p();function ng(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var og=ng(),ig=ng;var yC=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?vi:vi.apply(null,arguments)};typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var vC=e=>e&&typeof e.match=="function";function L(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(dt(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=>Si(n)&&n.type===e,r}var fg=class Oi extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Oi.prototype)}static get[Symbol.species](){return Oi}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Oi(...t[0].concat(this)):new Oi(...t.concat(this))}};function ag(e){return lt(e)?cn(e,()=>{}):e}function ns(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function SC(e){return typeof e=="boolean"}var bC=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new fg;return r&&(SC(r)?a.push(og):a.push(ig(r.extraArgument))),a},Pi="RTK_autoBatch",ao=()=>e=>({payload:e,meta:{[Pi]:!0}}),sg=e=>t=>{setTimeout(t,e)},AC=(e,t)=>r=>{let n=!1,o,i,a=()=>{n||(n=!0,cancelAnimationFrame(o),clearTimeout(i),r())};o=e(a),i=setTimeout(a,t)},wC=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,a=!1,s=new Set,u=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?AC(window.requestAnimationFrame,100):sg(10):e.type==="callback"?e.queueNotification:sg(e.timeout),c=()=>{a=!1,i&&(i=!1,s.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let v=()=>o&&g(),R=n.subscribe(v);return s.add(g),()=>{R(),s.delete(g)}},dispatch(g){try{return o=!g?.meta?.[Pi],i=!o,i&&(a||(a=!0,u(c))),n.dispatch(g)}finally{o=!0}}})},xC=e=>function(r){let{autoBatch:n=!0}=r??{},o=new fg(e);return n&&o.push(wC(typeof n=="object"?n:void 0)),o};function mg(e){let t=bC(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:a=void 0,enhancers:s=void 0}=e||{},u;if(typeof r=="function")u=r;else if(zt(r))u=rn(r);else throw new Error(dt(1));let c;typeof n=="function"?c=n(t):c=t();let g=vi;o&&(g=yC({trace:!1,...(typeof o=="object"&&o)}));let v=jm(...c),R=xC(v),h=typeof s=="function"?s(R):R(),y=g(...h);return zl(u,a,y)}function gg(e){let t={},r=[],n,o={addCase(i,a){let s=typeof i=="string"?i:i.type;if(!s)throw new Error(dt(28));if(s in t)throw new Error(dt(29));return t[s]=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 CC(e){return typeof e=="function"}function Be(e,t){let[r,n,o]=gg(t),i;if(CC(e))i=()=>ag(e());else{let s=ag(e);i=()=>s}function a(s=i(),u){let c=[r[u.type],...n.filter(({matcher:g})=>g(u)).map(({reducer:g})=>g)];return c.filter(g=>!!g).length===0&&(c=[o]),c.reduce((g,v)=>{if(v)if(gt(g)){let R=v(g,u);return R===void 0?g:R}else{if(lt(g))return cn(g,R=>v(R,u));{let R=v(g,u);if(R===void 0){if(g===null)return g;throw new Error(dt(9))}return R}}return g},s)}return a.getInitialState=i,a}var hg=(e,t)=>vC(e)?e.match(t):e(t);function Wt(...e){return t=>e.some(r=>hg(r,t))}function io(...e){return t=>e.every(r=>hg(r,t))}function ss(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 Ni(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function cs(...e){return e.length===0?t=>ss(t,["pending"]):Ni(e)?Wt(...e.map(t=>t.pending)):cs()(e[0])}function ln(...e){return e.length===0?t=>ss(t,["rejected"]):Ni(e)?Wt(...e.map(t=>t.rejected)):ln()(e[0])}function Fi(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?io(ln(...e),t):Ni(e)?io(ln(...e),t):Fi()(e[0])}function lr(...e){return e.length===0?t=>ss(t,["fulfilled"]):Ni(e)?Wt(...e.map(t=>t.fulfilled)):lr()(e[0])}function us(...e){return e.length===0?t=>ss(t,["pending","fulfilled","rejected"]):Ni(e)?Wt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):us()(e[0])}var EC="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Di=(e=21)=>{let t="",r=e;for(;r--;)t+=EC[Math.random()*64|0];return t},RC=["name","message","stack","code"],ud=class{constructor(e,t){ue(this,"payload");ue(this,"meta");ue(this,"_type");this.payload=e,this.meta=t}},cg=class{constructor(e,t){ue(this,"payload");ue(this,"meta");ue(this,"_type");this.payload=e,this.meta=t}},IC=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of RC)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},ug="External signal was aborted",ke=(()=>{function e(t,r,n){let o=L(t+"/fulfilled",(u,c,g,v)=>({payload:u,meta:{...(v||{}),arg:g,requestId:c,requestStatus:"fulfilled"}})),i=L(t+"/pending",(u,c,g)=>({payload:void 0,meta:{...(g||{}),arg:c,requestId:u,requestStatus:"pending"}})),a=L(t+"/rejected",(u,c,g,v,R)=>({payload:v,error:(n&&n.serializeError||IC)(u||"Rejected"),meta:{...(R||{}),arg:g,requestId:c,rejectedWithValue:v!==void 0,requestStatus:"rejected",aborted:u?.name==="AbortError",condition:u?.name==="ConditionError"}}));function s(u,{signal:c}={}){return(g,v,R)=>{let h=n?.idGenerator?n.idGenerator(u):Di(),y=new l.AbortController,b,x;function I(_){x=_,y.abort()}c&&(c.aborted?I(ug):c.addEventListener("abort",()=>I(ug),{once:!0}));let N=_asyncToGenerator(function*(){let _;try{let P=n?.condition?.(u,{getState:v,extra:R});if(_C(P)&&(P=yield P),P===!1)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};if(y.signal.aborted)throw{name:"AbortError",message:x||"Aborted"};let w=new Promise((O,k)=>{b=()=>{k({name:"AbortError",message:x||"Aborted"})},y.signal.addEventListener("abort",b,{once:!0})});g(i(h,u,n?.getPendingMeta?.({requestId:h,arg:u},{getState:v,extra:R}))),_=yield Promise.race([w,Promise.resolve(r(u,{dispatch:g,getState:v,extra:R,requestId:h,signal:y.signal,abort:I,rejectWithValue:(O,k)=>new ud(O,k),fulfillWithValue:(O,k)=>new cg(O,k)})).then(O=>{if(O instanceof ud)throw O;return O instanceof cg?o(O.payload,h,u,O.meta):o(O,h,u)})])}catch(P){_=P instanceof ud?a(null,h,u,P.payload,P.meta):a(P,h,u)}finally{b&&y.signal.removeEventListener("abort",b)}return n&&!n.dispatchConditionRejection&&a.match(_)&&_.meta.condition||g(_),_})();return Object.assign(N,{abort:I,requestId:h,arg:u,unwrap(){return N.then(TC)}})}}return Object.assign(s,{pending:i,rejected:a,fulfilled:o,settled:Wt(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function TC(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function _C(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var yg=Symbol.for("rtk-slice-createasyncthunk"),sq={[yg]:ke};function kC(e,t){return`${e}/${t}`}function OC({creators:e}={}){let t=e?.asyncThunk?.[yg];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(dt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(NC()):n.reducers)||{},s=Object.keys(a),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(_,P){let w=typeof _=="string"?_:_.type;if(!w)throw new Error(dt(12));if(w in u.sliceCaseReducersByType)throw new Error(dt(13));return u.sliceCaseReducersByType[w]=P,c},addMatcher(_,P){return u.sliceMatchers.push({matcher:_,reducer:P}),c},exposeAction(_,P){return u.actionCreators[_]=P,c},exposeCaseReducer(_,P){return u.sliceCaseReducersByName[_]=P,c}};s.forEach(_=>{let P=a[_],w={reducerName:_,type:kC(o,_),createNotation:typeof n.reducers=="function"};DC(P)?LC(w,P,c,t):FC(w,P,c)});function g(){let[_={},P=[],w=void 0]=typeof n.extraReducers=="function"?gg(n.extraReducers):[n.extraReducers],O={..._,...u.sliceCaseReducersByType};return Be(n.initialState,k=>{for(let T in O)k.addCase(T,O[T]);for(let T of u.sliceMatchers)k.addMatcher(T.matcher,T.reducer);for(let T of P)k.addMatcher(T.matcher,T.reducer);w&&k.addDefaultCase(w)})}let v=_=>_,R=new Map,h=new WeakMap,y;function b(_,P){return y||(y=g()),y(_,P)}function x(){return y||(y=g()),y.getInitialState()}function I(_,P=!1){function w(k){let T=k[_];return typeof T>"u"&&P&&(T=ns(h,w,x)),T}function O(k=v){return ns(ns(R,P,()=>new WeakMap),k,()=>{let T={};for(let[D,G]of Object.entries(n.selectors??{}))T[D]=PC(G,k,()=>ns(h,k,x),P);return T})}return{reducerPath:_,getSelectors:O,get selectors(){return O(w)},selectSlice:w}}let N={name:o,reducer:b,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:x,...I(i),injectInto(_,{reducerPath:P,...w}={}){let O=P??i;return _.inject({reducerPath:O,reducer:b},w),{...N,...I(O,!0)}}};return N}}function PC(e,t,r,n){function o(i,...a){let s=t(i);return typeof s>"u"&&n&&(s=r()),e(s,...a)}return o.unwrapped=e,o}var dn=OC();function NC(){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 FC({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!MC(n))throw new Error(dt(17));i=n.reducer,a=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?L(e,a):L(e))}function DC(e){return e._reducerDefinitionType==="asyncThunk"}function MC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function LC({type:e,reducerName:t},r,n,o){if(!o)throw new Error(dt(18));let{payloadCreator:i,fulfilled:a,pending:s,rejected:u,settled:c,options:g}=r,v=o(e,i,g);n.exposeAction(t,v),a&&n.addCase(v.fulfilled,a),s&&n.addCase(v.pending,s),u&&n.addCase(v.rejected,u),c&&n.addMatcher(v.settled,c),n.exposeCaseReducer(t,{fulfilled:a||os,pending:s||os,rejected:u||os,settled:c||os})}function os(){}var qC="task",vg="listener",Sg="completed",pd="cancelled",jC=`task-${pd}`,UC=`task-${Sg}`,ld=`${vg}-${pd}`,VC=`${vg}-${Sg}`,ls=class{constructor(e){ue(this,"code");ue(this,"name","TaskAbortError");ue(this,"message");this.code=e,this.message=`${qC} ${pd} (reason: ${e})`}},fd=(e,t)=>{if(typeof e!="function")throw new TypeError(dt(32))},is=()=>{},bg=(e,t=is)=>(e.catch(t),e),Ag=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),un=e=>{if(e.aborted)throw new ls(e.reason)};function wg(e,t){let r=is;return new Promise((n,o)=>{let i=()=>o(new ls(e.reason));if(e.aborted){i();return}r=Ag(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=is})}var GC=/*#__PURE__*/function(){var _GC=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof ls?"cancelled":"rejected",error:r}}finally{t?.()}});function GC(_x5,_x6){return _GC.apply(this,arguments)}return GC}(),as=e=>t=>bg(wg(e,t).then(r=>(un(e),r))),xg=e=>{let t=as(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:oo}=Object,lg={},ds="listenerMiddleware",BC=(e,t)=>{let r=n=>Ag(e,()=>n.abort(e.reason));return(n,o)=>{fd(n,"taskExecutor");let i=new l.AbortController;r(i);let a=GC(/*#__PURE__*/_asyncToGenerator(function*(){un(e),un(i.signal);let s=yield n({pause:as(i.signal),delay:xg(i.signal),signal:i.signal});return un(i.signal),s}),()=>i.abort(UC));return o?.autoJoin&&t.push(a.catch(is)),{result:as(e)(a),cancel(){i.abort(jC)}}}},$C=(e,t)=>{let r=/*#__PURE__*/function(){var _r2=_asyncToGenerator(function*(n,o){un(t);let i=()=>{},a=[new Promise((s,u)=>{let c=e({predicate:n,effect:(g,v)=>{v.unsubscribe(),s([g,v.getState(),v.getOriginalState()])}});i=()=>{c(),u()}})];o!=null&&a.push(new Promise(s=>setTimeout(s,o,null)));try{let s=yield wg(t,Promise.race(a));return un(t),s}finally{i()}});function r(_x7,_x8){return _r2.apply(this,arguments)}return r}();return(n,o)=>bg(r(n,o))},Cg=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=L(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(dt(21));return fd(i,"options.listener"),{predicate:o,type:t,effect:i}},Eg=oo(e=>{let{type:t,predicate:r,effect:n}=Cg(e);return{id:Di(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(dt(22))}}},{withTypes:()=>Eg}),dg=(e,t)=>{let{type:r,effect:n,predicate:o}=Cg(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},dd=e=>{e.pending.forEach(t=>{t.abort(ld)})},QC=(e,t)=>()=>{for(let r of t.keys())dd(r);e.clear()},pg=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Rg=oo(L(`${ds}/add`),{withTypes:()=>Rg}),HC=L(`${ds}/removeAll`),Ig=oo(L(`${ds}/remove`),{withTypes:()=>Ig}),zC=(...e)=>{console.error(`${ds}/error`,...e)},Tg=(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=zC}=e;fd(a,"onError");let s=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&dd(h)}),u=h=>{let y=dg(t,h)??Eg(h);return s(y)};oo(u,{withTypes:()=>u});let c=h=>{let y=dg(t,h);return y&&(y.unsubscribe(),h.cancelActive&&dd(y)),!!y};oo(c,{withTypes:()=>c});let g=/*#__PURE__*/function(){var _g2=_asyncToGenerator(function*(h,y,b,x){let I=new l.AbortController,N=$C(u,I.signal),_=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(y,oo({},b,{getOriginalState:x,condition:(P,w)=>N(P,w).then(Boolean),take:N,delay:xg(I.signal),pause:as(I.signal),extra:i,signal:I.signal,fork:BC(I.signal,_),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((P,w,O)=>{P!==I&&(P.abort(ld),O.delete(P))})},cancel:()=>{I.abort(ld),h.pending.delete(I)},throwIfCancelled:()=>{un(I.signal)}})))}catch(P){P instanceof ls||pg(a,P,{raisedBy:"effect"})}finally{yield Promise.all(_),I.abort(VC),o(h),h.pending.delete(I)}});function g(_x9,_x0,_x1,_x10){return _g2.apply(this,arguments)}return g}(),v=QC(t,r);return{middleware:h=>y=>b=>{if(!Si(b))return y(b);if(Rg.match(b))return u(b.payload);if(HC.match(b)){v();return}if(Ig.match(b))return c(b.payload);let x=h.getState(),I=()=>{if(x===lg)throw new Error(dt(23));return x},N;try{if(N=y(b),t.size>0){let _=h.getState(),P=Array.from(t.values());for(let w of P){let O=!1;try{O=w.predicate(b,_,x)}catch(k){O=!1,pg(a,k,{raisedBy:"predicate"})}O&&g(w,b,h,I)}}}finally{x=lg}return N},startListening:u,stopListening:c,clearListeners:v}};function dt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}m();d();f();p();var Y=new H({required:!0,emptyAllowed:!1}),rt=new H({required:!1,emptyAllowed:!1}),nt=new H({required:!0,emptyAllowed:!0}),Sq=new H({required:!1,emptyAllowed:!0}),ps=new Ae({each:Y,required:!0}),_g=new H({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),kg=new H({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),bq=new H({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),dr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),Ot=(e,t)=>{if("required"in t)return{payload:new yt({value:t}).validate({value:e}).value};let o=new re({options:{required:!0},values:t}).validate(e);if(o)throw new fi(o);return{payload:e}},V=(e,t)=>{try{return Ot(e,t)}catch(r){return{payload:e,error:dr(r)}}},Og=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return Ng(e,t,r,o,"Controller initialization error")},Pg=(e,t,r,n)=>{let o=`Check the options of ${n}`;return Ng(e,t,r,o,"Controller initialization error")},Ng=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};m();d();f();p();var so="3.58.1",Fg=["@coveo/atomic","@coveo/quantic"];var md=()=>rt,Dg=()=>Y,Rr=L("configuration/updateBasicConfiguration",e=>V(e,{accessToken:rt,environment:new H({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:rt})),Kt=L("configuration/updateSearchConfiguration",e=>V(e,{proxyBaseUrl:new H({required:!1,url:!0}),pipeline:new H({required:!1,emptyAllowed:!0}),searchHub:rt,timezone:rt,locale:rt,authenticationProviders:new Ae({required:!1,each:Y})})),WC={enabled:new fe({default:!0}),originContext:md(),originLevel2:md(),originLevel3:md(),proxyBaseUrl:new H({required:!1,url:!0}),runtimeEnvironment:new qe,anonymous:new fe({default:!1}),deviceId:rt,userDisplayName:rt,documentLocation:rt,trackingId:kg,analyticsMode:new H({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new re({options:{required:!1},values:Fg.reduce((e,t)=>(e[t]=_g,e),{})})},co=L("configuration/updateAnalyticsConfiguration",e=>V(e,WC)),uo=L("configuration/analytics/disable"),lo=L("configuration/analytics/enable"),fs=L("configuration/analytics/originlevel2",e=>V(e,{originLevel2:Dg()})),ms=L("configuration/analytics/originlevel3",e=>V(e,{originLevel3:Dg()})),Mg=L("knowledge/setAgentId",e=>V(e,new H({required:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var Lg={q:new H,enableQuerySyntax:new fe,aq:new H,cq:new H,firstResult:new ne({min:0}),numberOfResults:new ne({min:0}),sortCriteria:new H,f:new re,fExcluded:new re,cf:new re,nf:new re,mnf:new re,df:new re,debug:new fe,sf:new re,tab:new H,af:new re};var Ir=L("searchParameters/restore",e=>V(e,Lg)),qg=L("searchParameters/restoreTab",e=>V(e,Y));m();d();f();p();var gs=L("debug/enable"),hs=L("debug/disable");m();d();f();p();var ys=()=>!1;var vs=Be(ys(),e=>{e.addCase(gs,()=>!0).addCase(hs,()=>!1).addCase(Ir,(t,r)=>r.payload.debug??t)});m();d();f();p();var po=L("pipeline/set",e=>V(e,new H({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();var KC=L("history/undo"),YC=L("history/redo"),Yt=L("history/snapshot"),_j=ke("history/back",/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,{dispatch:t}){t(KC()),yield t(St())});return function(_x11,_x12){return _ref3.apply(this,arguments)}}()),kj=ke("history/forward",/*#__PURE__*/function(){var _ref4=_asyncToGenerator(function*(e,{dispatch:t}){t(YC()),yield t(St())});return function(_x13,_x14){return _ref4.apply(this,arguments)}}()),St=ke("history/change",/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x15,_x16){return _ref5.apply(this,arguments)}}());m();d();f();p();var Tr=()=>"";var fo=Be(Tr(),e=>{e.addCase(po,(t,r)=>r.payload).addCase(St.fulfilled,(t,r)=>r.payload?.pipeline??t).addCase(Kt,(t,r)=>r.payload.pipeline||t)});m();d();f();p();m();d();f();p();var Ss=L("app/setError");m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function XC(){return typeof navigator<"u"}function jg(){try{return typeof localStorage<"u"}catch{return!1}}function Ug(){try{return typeof sessionStorage<"u"}catch{return!1}}function Vg(){return XC()&&navigator.cookieEnabled}m();d();f();p();var pn=class e{static set(t,r,n){let o;n&&(o=new Date,o.setTime(o.getTime()+n)),gd(t,r,o,ZC(window.location.hostname))}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 ZC(e){if(e.indexOf(".")===-1)return;let t=e.split(".");for(let r=2;r<=t.length;r++){let n=t.slice(-r).join(".");if(JC(n))return n}}function JC(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return gd(t,"1",void 0,e),pn.get(t)==="1"}catch{return!1}finally{try{gd(t,"",new Date(0),e)}catch{}}}function gd(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function Gg(){return jg()?localStorage:Vg()?new bs:Ug()?sessionStorage:new hd}var bs=class e{getItem(t){return pn.get(`${e.prefix}${t}`)}removeItem(t){pn.erase(`${e.prefix}${t}`)}setItem(t,r,n){pn.set(`${e.prefix}${t}`,r,n)}};bs.prefix="coveo_";var hd=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var As="__coveo.analytics.history",eE=20,tE=1e3*60,rE=75,ws=class{constructor(t){this.store=t||Gg()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _this9=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this9.cropQueryElement(_this9.stripEmptyQuery(t));let r=yield _this9.getHistoryWithInternalTimeAsync();r!=null?_this9.isValidEntry(t)&&_this9.setHistory([t].concat(r)):_this9.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this0=this;return _asyncToGenerator(function*(){let t=yield _this0.getHistoryWithInternalTimeAsync();return _this0.stripEmptyQueries(_this0.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(As);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this1=this;return _asyncToGenerator(function*(){try{let t=yield _this1.store.getItem(As);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(As,JSON.stringify(t.slice(0,eE)))}catch{}}clear(){try{this.store.removeItem(As)}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,rE)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>tE:!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 fn=class fn extends ws{static getInstance(t){return fn.instance||(fn.instance=new fn(t)),fn.instance}constructor(t){super(t)}};ue(fn,"instance",null);var ht=fn;m();d();f();p();m();d();f();p();var mo=ze(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${so}`));m();d();f();p();m();d();f();p();function pr(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 s(g){try{c(n.next(g))}catch(v){a(v)}}function u(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})}var Ce;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(Ce||(Ce={}));function Sd(){return typeof window<"u"}function Nd(){return typeof navigator<"u"}function go(){return typeof document<"u"}function bd(){try{return typeof localStorage<"u"}catch{return!1}}function nE(){try{return typeof sessionStorage<"u"}catch{return!1}}function eh(){return Nd()&&navigator.cookieEnabled}var oE=[Ce.click,Ce.custom,Ce.search,Ce.view],iE=(e,t)=>oE.indexOf(e)!==-1?Object.assign({language:go()?document.documentElement.lang:"unknown",userAgent:Nd()?navigator.userAgent:"unknown"},t):t,ho=class e{static set(t,r,n){let o;n&&(o=new Date,o.setTime(o.getTime()+n)),Ad(t,r,o,aE(window.location.hostname))}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 aE(e){if(e.indexOf(".")===-1)return;let t=e.split(".");for(let r=2;r<=t.length;r++){let n=t.slice(-r).join(".");if(sE(n))return n}}function sE(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return Ad(t,"1",void 0,e),ho.get(t)==="1"}catch{return!1}finally{try{Ad(t,"",new Date(0),e)}catch{}}}function Ad(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function cE(){return bd()?localStorage:eh()?new Li:nE()?sessionStorage:new vo}var Li=class e{getItem(t){return ho.get(`${e.prefix}${t}`)}removeItem(t){ho.erase(`${e.prefix}${t}`)}setItem(t,r,n){ho.set(`${e.prefix}${t}`,r,n)}};Li.prefix="coveo_";var wd=class{constructor(){this.cookieStorage=new Li}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)}},vo=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},xs="__coveo.analytics.history",uE=20,lE=1e3*60,dE=75,Es=class{constructor(t){this.store=t||cE()}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(xs);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(xs);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(xs,JSON.stringify(t.slice(0,uE)))}catch{}}clear(){try{this.store.removeItem(xs)}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,dE)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>lE:!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 pE=(e,t)=>U(void 0,void 0,void 0,function*(){return e===Ce.view?(yield fE(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),fE=e=>U(void 0,void 0,void 0,function*(){let t=new Es,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),mE=/^(?:[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 Rs(e){return typeof e=="string"&&mE.test(e)}function Bg(e){if(!Rs(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 ot=[];for(let e=0;e<256;++e)ot.push((e+256).toString(16).slice(1));function th(e,t=0){return(ot[e[t+0]]+ot[e[t+1]]+ot[e[t+2]]+ot[e[t+3]]+"-"+ot[e[t+4]]+ot[e[t+5]]+"-"+ot[e[t+6]]+ot[e[t+7]]+"-"+ot[e[t+8]]+ot[e[t+9]]+"-"+ot[e[t+10]]+ot[e[t+11]]+ot[e[t+12]]+ot[e[t+13]]+ot[e[t+14]]+ot[e[t+15]]).toLowerCase()}var gE=new Uint8Array(16);function hE(){return crypto.getRandomValues(gE)}function yE(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 vE="6ba7b810-9dad-11d1-80b4-00c04fd430c8",SE="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function bE(e,t,r,n,o,i){let a=typeof r=="string"?yE(r):r,s=typeof n=="string"?Bg(n):n;if(typeof n=="string"&&(n=Bg(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+a.length);return u.set(s),u.set(a,s.length),u=t(u),u[6]=u[6]&15|e,u[8]=u[8]&63|128,th(u)}function mn(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():AE(e,t,r)}function AE(e,t,r){e=e||{};let n=e.random??e.rng?.()??hE();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 th(n)}function wE(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 yd(e,t){return e<<t|e>>>32-t}function xE(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 s=0;s<i;++s){let u=new Uint32Array(16);for(let c=0;c<16;++c)u[c]=e[s*64+c*4]<<24|e[s*64+c*4+1]<<16|e[s*64+c*4+2]<<8|e[s*64+c*4+3];a[s]=u}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 s=0;s<i;++s){let u=new Uint32Array(80);for(let y=0;y<16;++y)u[y]=a[s][y];for(let y=16;y<80;++y)u[y]=yd(u[y-3]^u[y-8]^u[y-14]^u[y-16],1);let c=r[0],g=r[1],v=r[2],R=r[3],h=r[4];for(let y=0;y<80;++y){let b=Math.floor(y/20),x=yd(c,5)+wE(b,g,v,R)+h+t[b]+u[y]>>>0;h=R,R=v,v=yd(g,30)>>>0,g=c,c=x}r[0]=r[0]+c>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+v>>>0,r[3]=r[3]+R>>>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 Is(e,t,r,n){return bE(80,xE,e,t)}Is.DNS=vE;Is.URL=SE;var rh="2.33.1",$g=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Mi={pageview:"pageview",event:"event"},Ts=class{constructor({client:t,uuidGenerator:r=mn}){this.client=t,this.uuidGenerator=r}},xd=class extends Ts{constructor({client:t,uuidGenerator:r=mn}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=$g(window.location),this.lastReferrer=go()?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:go()?document.title:"",encoding:go()?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===Mi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===Mi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Mi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Mi.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 $g(window.location)}},_r=class e{constructor(t,r){if(!Rs(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 Rs(i)?new e(i,Number.parseInt(o)*1e3):null}};_r.cvo_cid="cvo_cid";_r.expirationTime=120;var Cd=class extends Ts{constructor({client:t,uuidGenerator:r=mn}){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(_r.cvo_cid,new _r(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Cd.Id="link";var Nt=Object.keys;function Cs(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var vd=128,nh=192,Qg=224,Hg=240;function CE(e){return(e&248)===Hg?4:(e&Hg)===Qg?3:(e&Qg)===nh?2:1}function EE(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&vd)!=vd)break;if(r-=3,(n&nh)!=vd){t-r>=CE(n)*3&&(r=t);break}}return e.substring(0,r)}var Ed={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"},RE=Nt(Ed).map(e=>Ed[e]),IE=[...RE].join("|"),TE=new RegExp(`^(${IE}$)`),_E={svcAction:"svc_action",svcActionData:"svc_action_data"},kE=e=>Nt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=Ed[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),OE=e=>TE.test(e),PE=[OE],zg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Wg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},pt={action:"pa",list:"pal",listSource:"pls"},_s={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},NE=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Rd={id:"quoteId",affiliation:"quoteAffiliation"},Id={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},FE={add:pt,bookmark_add:pt,bookmark_remove:pt,click:pt,checkout:pt,checkout_option:pt,detail:pt,impression:pt,remove:pt,refund:Object.assign(Object.assign({},pt),_s),purchase:Object.assign(Object.assign({},pt),_s),quickview:pt,quote:Object.assign(Object.assign({},pt),Rd),review:Object.assign(Object.assign({},pt),Id)},DE=Nt(zg).map(e=>zg[e]),ME=Nt(Wg).map(e=>Wg[e]),LE=Nt(pt).map(e=>pt[e]),qE=Nt(_s).map(e=>_s[e]),jE=Nt(Id).map(e=>Id[e]),UE=Nt(Rd).map(e=>Rd[e]),VE=[...DE,"custom"].join("|"),GE=[...ME,"custom"].join("|"),oh="(pr[0-9]+)",ih="(il[0-9]+pi[0-9]+)",BE=new RegExp(`^${oh}(${VE})$`),$E=new RegExp(`^(${ih}(${GE}))|(il[0-9]+nm)$`),QE=new RegExp(`^(${LE.join("|")})$`),HE=new RegExp(`^(${qE.join("|")})$`),zE=new RegExp(`^${oh}custom$`),WE=new RegExp(`^${ih}custom$`),KE=new RegExp(`^(${[...NE,...jE,...UE].join("|")})$`),YE=e=>BE.test(e),XE=e=>$E.test(e),ZE=e=>QE.test(e),JE=e=>HE.test(e),eR=e=>KE.test(e),tR=[XE,YE,ZE,JE,eR],rR=[zE,WE],nR={anonymizeIp:"aip"},oR={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},iR={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},aR=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],sR=Object.assign(Object.assign(Object.assign(Object.assign({},nR),oR),iR),aR.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Td=Object.assign(Object.assign({},sR),_E),cR=e=>{let t=!!e.action&&FE[e.action]||{};return Nt(e).reduce((r,n)=>{let o=t[n]||Td[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},uR=Nt(Td).map(e=>Td[e]),lR=e=>uR.indexOf(e)!==-1,dR=e=>e==="custom",pR=e=>[...tR,...PE,lR,dR].some(t=>t(e)),fR=e=>Nt(e).reduce((t,r)=>{let n=mR(r);return n?Object.assign(Object.assign({},t),gR(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),mR=e=>{let t;return[...rR].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},gR=(e,t)=>Nt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),_d=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:s}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),u=this.encodeForEventType(t,s),c=new Blob([u],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(a,c)})}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:s,body:u}=a;o=s||t;try{i=JSON.parse(u)}catch(c){console.error("Unable to process the request body as a JSON string",c)}}return{payload:i,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return 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[Ce.click,Ce.custom,Ce.search,Ce.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}},kd=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()})}},Kg=A.fetch,ks=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():"",s={url:`${n}/analytics/${t}${a}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},u=Object.assign(Object.assign({},s),i?yield i(s,"analyticsFetch"):{}),{url:c}=u,g=pr(u,["url"]),v;try{v=yield Kg(c,g)}catch(R){console.error("An error has occurred when sending the event.",R);return}if(v.ok){let R=yield v.json();return R.visitorId&&o.setCurrentVisitorId(R.visitorId),R}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 Kg(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[Ce.click,Ce.custom,Ce.search,Ce.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"})}},Od=class{constructor(t,r){bd()&&eh()?this.storage=new wd:bd()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new vo),this.client=new ks(t),this.beaconClient=new _d(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}},Pd=class{constructor(t,r){this.storage=r||new vo,this.client=new ks(t)}getClientDependingOnEventType(t){return this.client}},Os=class{constructor(){this.storage=new vo,this.client=new kd}getClientDependingOnEventType(t){return this.client}},hR="xx",yR=e=>e?.startsWith(hR)||!1,vR=`
|
|
28
28
|
We've detected you're using React Native but have not provided the corresponding runtime,
|
|
29
29
|
for an optimal experience please use the "coveo.analytics/react-native" subpackage.
|
|
30
30
|
Follow the Readme on how to set it up: https://github.com/coveo/coveo.analytics.js#using-react-native
|
|
31
|
-
`;function SR(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var bR=["1",1,"yes",!0];function AR(){let e=[];return bd()&&e.push(window.doNotTrack),Fd()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>bR.indexOf(t)!==-1)}function Ps(e){return e===!0?!1:AR()}var ah="v15",sh={default:"https://analytics.cloud.coveo.com/rest/ua"};function wR(e=sh.default,t=ah,r=!1){if(e=e.replace(/\/$/,""),r)return`${e}/${t}`;let n=e.endsWith("/rest")||e.endsWith("/rest/ua");return`${e}${n?"":"/rest"}/${t}`}var xR="38824e1f-37f5-42d3-8372-a4b8fa9df946",Xt=class{get defaultOptions(){return{endpoint:sh.default,isCustomEndpoint:!1,token:"",version:ah,beforeSendHooks:[],afterSendHooks:[]}}get version(){return rh}constructor(t){if(this.acceptedLinkReferrers=[],!t)throw new Error("You have to pass options to this constructor");this.options=Object.assign(Object.assign({},this.defaultOptions),t),this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[pE,iE].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};let r={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};Ps(this.options.disableBrowserPrivacySignals)?this.runtime=new Os:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(Ce.view,{newEventType:Ce.view,addClientIdParameter:!0}),this.addEventTypeMapping(Ce.click,{newEventType:Ce.click,addClientIdParameter:!0}),this.addEventTypeMapping(Ce.custom,{newEventType:Ce.custom,addClientIdParameter:!0}),this.addEventTypeMapping(Ce.search,{newEventType:Ce.search,addClientIdParameter:!0})}initRuntime(t){return bd()&&go()?new Pd(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(SR()&&console.warn(vR),new Nd(t))}get storage(){return this.runtime.storage}determineVisitorId(){return U(this,void 0,void 0,function*(){try{return bd()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||mn()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),mn()}})}getCurrentVisitorId(){return U(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return U(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return U(this,void 0,void 0,function*(){if(Rs(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(Is(t,Is(r,xR)))}})}getParameters(t,...r){return U(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return U(this,void 0,void 0,function*(){let n=yield this.resolveParameters(t,...r);return yield this.resolvePayloadForParameters(t,n)})}get currentVisitorId(){return typeof(this.visitorId||this.storage.getItem("visitorId"))!="string"&&this.setCurrentVisitorId(mn()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(Ps(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(_r.cvo_cid);if(r==null)return null;let n=_r.fromString(r);return!n||!go()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return U(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:i=!1,addClientIdParameter:a=!1}=this.eventTypeMapping[t]||{};return yield[h=>n.length>0?this.parseVariableArgumentsPayload(n,h):h[0],h=>U(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>U(this,void 0,void 0,function*(){return a?Object.assign(Object.assign({},h),{clientId:yield this.getCurrentVisitorId()}):h}),h=>i?this.ensureAnonymousUserWhenUsingApiKey(h):h,h=>this.beforeSendHooks.reduce((y,b)=>U(this,void 0,void 0,function*(){let x=yield y;return yield b(t,x)}),h)].reduce((h,y)=>U(this,void 0,void 0,function*(){let b=yield h;return yield y(b)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return U(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[v=>this.setTrackingIdIfTrackingIdNotPresent(v),v=>this.removeEmptyPayloadValues(v,t),v=>this.validateParams(v,t),v=>n?cR(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,R)=>U(this,void 0,void 0,function*(){let h=yield v;return yield R(h)}),Promise.resolve(r))})}makeEvent(t,...r){return U(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},o=yield this.resolveParameters(t,...r),i=yield this.resolvePayloadForParameters(t,o);return{eventType:n,payload:i,log:a=>U(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},i),a)}),yield Promise.all(this.afterSendHooks.map(s=>s(t,Object.assign(Object.assign({},o),a)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return U(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return U(this,void 0,void 0,function*(){let t=this.bufferedRequests.shift();if(t){let{eventType:r,payload:n}=t;return this.runtime.getClientDependingOnEventType(r).sendEvent(r,n)}})}clear(){this.storage.removeItem("visitorId"),new Es().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Ce.search,t)})}sendSearchEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=pr(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Ce.click,t)})}sendClickEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=pr(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Ce.custom,t)})}sendCustomEvent(t){return U(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=pr(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Ce.view,t)})}sendViewEvent(t){return U(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return U(this,void 0,void 0,function*(){let r=yield(yield C(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return U(this,void 0,void 0,function*(){return yield(yield C(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,r){this.eventTypeMapping[t]=r}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(r=>typeof r=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,r){let n={};for(let o=0,i=r.length;o<i;o++){let a=r[o];if(typeof a=="string")n[t[o]]=a;else if(typeof a=="object")return Object.assign(Object.assign({},n),a)}return n}isKeyAllowedEmpty(t,r){return({[Ce.search]:["queryText"]}[t]||[]).indexOf(r)!==-1}removeEmptyPayloadValues(t,r){let n=o=>typeof o<"u"&&o!==null&&o!=="";return Object.keys(t).filter(o=>this.isKeyAllowedEmpty(r,o)||n(t[o])).reduce((o,i)=>Object.assign(Object.assign({},o),{[i]:t[i]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(pR(n))return!0;console.log(n,"is not processed by coveoua")}).reduce((n,o)=>Object.assign(Object.assign({},n),{[o]:t[o]}),{})}processCustomParameters(t){let{custom:r}=t,n=pr(t,["custom"]),o={};r&&Cs(r)&&(o=this.lowercaseKeys(r));let i=fR(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=pr(t,["custom"]);if(r&&Cs(r)){let o=this.lowercaseKeys(r);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},o),t.customData)})}else return t}lowercaseKeys(t){let r=Object.keys(t),n={};return r.forEach(o=>{n[o.toLowerCase()]=t[o]}),n}validateParams(t,r){let{anonymizeIp:n}=t,o=pr(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==Ce.view||r==Ce.click||r==Ce.search||r==Ce.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==Ce.view&&(o.location=this.limit(o.location,1024)),(r=="pageview"||r=="event")&&(o.referrer=this.limit(o.referrer,2048),o.location=this.limit(o.location,2048),o.page=this.limit(o.page,2048)),o}ensureAnonymousUserWhenUsingApiKey(t){let{userId:r}=t,n=pr(t,["userId"]);return yR(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=pr(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Cs(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Cs(n.customData)&&(n.customData.hasOwnProperty("context_website")||n.customData.hasOwnProperty("siteName"))&&(n.trackingId=n.customData.context_website||n.customData.siteName),n)}limit(t,r){return typeof t=="string"?EE(t,r):t}get baseUrl(){return wR(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},fr;(function(e){e.contextChanged="contextChanged",e.expandToFullUI="expandToFullUI",e.openUserActions="openUserActions",e.showPrecedingSessions="showPrecedingSessions",e.showFollowingSessions="showFollowingSessions",e.clickViewedDocument="clickViewedDocument",e.clickPageView="clickPageView",e.createArticle="createArticle"})(fr||(fr={}));var $;(function(e){e.interfaceLoad="interfaceLoad",e.interfaceChange="interfaceChange",e.didyoumeanAutomatic="didyoumeanAutomatic",e.didyoumeanClick="didyoumeanClick",e.resultsSort="resultsSort",e.searchboxSubmit="searchboxSubmit",e.searchboxClear="searchboxClear",e.searchboxAsYouType="searchboxAsYouType",e.breadcrumbFacet="breadcrumbFacet",e.breadcrumbResetAll="breadcrumbResetAll",e.documentQuickview="documentQuickview",e.documentOpen="documentOpen",e.omniboxAnalytics="omniboxAnalytics",e.omniboxFromLink="omniboxFromLink",e.searchFromLink="searchFromLink",e.triggerNotify="notify",e.triggerExecute="execute",e.triggerQuery="query",e.undoTriggerQuery="undoQuery",e.triggerRedirect="redirect",e.pagerResize="pagerResize",e.pagerNumber="pagerNumber",e.pagerNext="pagerNext",e.pagerPrevious="pagerPrevious",e.pagerScrolling="pagerScrolling",e.staticFilterClearAll="staticFilterClearAll",e.staticFilterSelect="staticFilterSelect",e.staticFilterDeselect="staticFilterDeselect",e.facetClearAll="facetClearAll",e.facetSearch="facetSearch",e.facetSelect="facetSelect",e.facetSelectAll="facetSelectAll",e.facetDeselect="facetDeselect",e.facetExclude="facetExclude",e.facetUnexclude="facetUnexclude",e.facetUpdateSort="facetUpdateSort",e.facetShowMore="showMoreFacetResults",e.facetShowLess="showLessFacetResults",e.queryError="query",e.queryErrorBack="errorBack",e.queryErrorClear="errorClearQuery",e.queryErrorRetry="errorRetry",e.recommendation="recommendation",e.recommendationInterfaceLoad="recommendationInterfaceLoad",e.recommendationOpen="recommendationOpen",e.likeSmartSnippet="likeSmartSnippet",e.dislikeSmartSnippet="dislikeSmartSnippet",e.expandSmartSnippet="expandSmartSnippet",e.collapseSmartSnippet="collapseSmartSnippet",e.openSmartSnippetFeedbackModal="openSmartSnippetFeedbackModal",e.closeSmartSnippetFeedbackModal="closeSmartSnippetFeedbackModal",e.sendSmartSnippetReason="sendSmartSnippetReason",e.expandSmartSnippetSuggestion="expandSmartSnippetSuggestion",e.collapseSmartSnippetSuggestion="collapseSmartSnippetSuggestion",e.showMoreSmartSnippetSuggestion="showMoreSmartSnippetSuggestion",e.showLessSmartSnippetSuggestion="showLessSmartSnippetSuggestion",e.openSmartSnippetSource="openSmartSnippetSource",e.openSmartSnippetSuggestionSource="openSmartSnippetSuggestionSource",e.openSmartSnippetInlineLink="openSmartSnippetInlineLink",e.openSmartSnippetSuggestionInlineLink="openSmartSnippetSuggestionInlineLink",e.recentQueryClick="recentQueriesClick",e.clearRecentQueries="clearRecentQueries",e.recentResultClick="recentResultClick",e.clearRecentResults="clearRecentResults",e.noResultsBack="noResultsBack",e.showMoreFoldedResults="showMoreFoldedResults",e.showLessFoldedResults="showLessFoldedResults",e.copyToClipboard="copyToClipboard",e.caseSendEmail="Case.SendEmail",e.feedItemTextPost="FeedItem.TextPost",e.caseAttach="caseAttach",e.caseDetach="caseDetach",e.retryGeneratedAnswer="retryGeneratedAnswer",e.likeGeneratedAnswer="likeGeneratedAnswer",e.dislikeGeneratedAnswer="dislikeGeneratedAnswer",e.openGeneratedAnswerSource="openGeneratedAnswerSource",e.generatedAnswerOpenInlineLink="generatedAnswerOpenInlineLink",e.generatedAnswerStreamEnd="generatedAnswerStreamEnd",e.generatedAnswerSourceHover="generatedAnswerSourceHover",e.generatedAnswerCopyToClipboard="generatedAnswerCopyToClipboard",e.generatedAnswerHideAnswers="generatedAnswerHideAnswers",e.generatedAnswerShowAnswers="generatedAnswerShowAnswers",e.generatedAnswerExpand="generatedAnswerExpand",e.generatedAnswerCollapse="generatedAnswerCollapse",e.generatedAnswerFeedbackSubmit="generatedAnswerFeedbackSubmit",e.rephraseGeneratedAnswer="rephraseGeneratedAnswer",e.generatedAnswerFeedbackSubmitV2="generatedAnswerFeedbackSubmitV2",e.generatedAnswerCitationClick="generatedAnswerCitationClick",e.generatedAnswerFollowupOpenSource="generatedAnswerFollowupOpenSource",e.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})($||($={}));var Yg={[$.triggerNotify]:"queryPipelineTriggers",[$.triggerExecute]:"queryPipelineTriggers",[$.triggerQuery]:"queryPipelineTriggers",[$.triggerRedirect]:"queryPipelineTriggers",[$.queryErrorBack]:"errors",[$.queryErrorClear]:"errors",[$.queryErrorRetry]:"errors",[$.pagerNext]:"getMoreResults",[$.pagerPrevious]:"getMoreResults",[$.pagerNumber]:"getMoreResults",[$.pagerResize]:"getMoreResults",[$.pagerScrolling]:"getMoreResults",[$.facetSearch]:"facet",[$.facetShowLess]:"facet",[$.facetShowMore]:"facet",[$.recommendation]:"recommendation",[$.likeSmartSnippet]:"smartSnippet",[$.dislikeSmartSnippet]:"smartSnippet",[$.expandSmartSnippet]:"smartSnippet",[$.collapseSmartSnippet]:"smartSnippet",[$.openSmartSnippetFeedbackModal]:"smartSnippet",[$.closeSmartSnippetFeedbackModal]:"smartSnippet",[$.sendSmartSnippetReason]:"smartSnippet",[$.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.clearRecentQueries]:"recentQueries",[$.recentResultClick]:"recentlyClickedDocuments",[$.clearRecentResults]:"recentlyClickedDocuments",[$.showLessFoldedResults]:"folding",[$.caseDetach]:"case",[$.likeGeneratedAnswer]:"generatedAnswer",[$.dislikeGeneratedAnswer]:"generatedAnswer",[$.openGeneratedAnswerSource]:"generatedAnswer",[$.generatedAnswerOpenInlineLink]:"generatedAnswer",[$.generatedAnswerFollowupOpenSource]:"generatedAnswer",[$.generatedAnswerStreamEnd]:"generatedAnswer",[$.generatedAnswerSourceHover]:"generatedAnswer",[$.generatedAnswerCopyToClipboard]:"generatedAnswer",[$.generatedAnswerHideAnswers]:"generatedAnswer",[$.generatedAnswerShowAnswers]:"generatedAnswer",[$.generatedAnswerExpand]:"generatedAnswer",[$.generatedAnswerCollapse]:"generatedAnswer",[$.generatedAnswerFeedbackSubmit]:"generatedAnswer",[$.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[fr.expandToFullUI]:"interface",[fr.openUserActions]:"User Actions",[fr.showPrecedingSessions]:"User Actions",[fr.showFollowingSessions]:"User Actions",[fr.clickViewedDocument]:"User Actions",[fr.clickPageView]:"User Actions",[fr.createArticle]:"createArticle"},So=class{constructor(){this.runtime=new Os,this.currentVisitorId=""}getPayload(){return Promise.resolve()}getParameters(){return Promise.resolve()}makeEvent(t){return Promise.resolve({eventType:t,payload:null,log:()=>Promise.resolve()})}sendEvent(){return Promise.resolve()}makeSearchEvent(){return this.makeEvent(Ce.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(Ce.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(Ce.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(Ce.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return rh}};function CR(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function ER(e){return e.map(t=>t.replace(/;/g,""))}function ch(e){let r=e.join(";");return r.length<=256?r:ch(e.slice(1))}var Xg=e=>{let t=ER(e),r=CR(t);return ch(r)};function Zg(e){let t=typeof e.partialQueries=="string"?e.partialQueries:Xg(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:Xg(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Ns=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Ps(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new So:new Xt(t)}disable(){this.coveoAnalyticsClient=new So}enable(){this.coveoAnalyticsClient=new Xt(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent($.interfaceLoad)}logInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent($.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent($.recommendation)}logRecommendation(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent($.recommendationOpen,t,r)}logRecommendationOpen(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent($.staticFilterClearAll,t)}logStaticFilterClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent($.staticFilterSelect,t)}logStaticFilterSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent($.staticFilterDeselect,t)}logStaticFilterDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent($.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return U(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent($.interfaceChange,t)}logInterfaceChange(t){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent($.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent($.didyoumeanClick)}logDidYouMeanClick(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent($.resultsSort,t)}logResultsSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent($.searchboxSubmit)}logSearchboxSubmit(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent($.searchboxClear)}logSearchboxClear(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent($.searchboxAsYouType)}logSearchboxAsYouType(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent($.breadcrumbFacet,t)}logBreadcrumbFacet(t){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent($.breadcrumbResetAll)}logBreadcrumbResetAll(){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent($.documentQuickview,t,r)}logDocumentQuickview(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent($.documentOpen,t,r)}logDocumentOpen(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent($.omniboxAnalytics,Zg(t))}logOmniboxAnalytics(t){return U(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent($.omniboxFromLink,Zg(t))}logOmniboxFromLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent($.searchFromLink)}logSearchFromLink(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent($.triggerNotify,t)}logTriggerNotify(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent($.triggerExecute,t)}logTriggerExecute(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent($.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent($.undoTriggerQuery,t)}logUndoTriggerQuery(t){return U(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent($.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent($.pagerResize,t)}logPagerResize(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent($.pagerNumber,t)}logPagerNumber(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent($.pagerNext,t)}logPagerNext(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent($.pagerPrevious,t)}logPagerPrevious(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent($.pagerScrolling)}logPagerScrolling(){return U(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent($.facetClearAll,t)}logFacetClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent($.facetSearch,t)}logFacetSearch(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent($.facetSelect,t)}logFacetSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent($.facetDeselect,t)}logFacetDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent($.facetExclude,t)}logFacetExclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent($.facetUnexclude,t)}logFacetUnexclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent($.facetSelectAll,t)}logFacetSelectAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent($.facetUpdateSort,t)}logFacetUpdateSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent($.facetShowMore,t)}logFacetShowMore(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent($.facetShowLess,t)}logFacetShowLess(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent($.queryError,t)}logQueryError(t){return U(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorBack);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorBack)})}})}logQueryErrorBack(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorRetry);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorRetry)})}})}logQueryErrorRetry(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorClear);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorClear)})}})}logQueryErrorClear(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent($.likeSmartSnippet)}logLikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent($.dislikeSmartSnippet)}logDislikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent($.expandSmartSnippet)}logExpandSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent($.collapseSmartSnippet)}logCollapseSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent($.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent($.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent($.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent($.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent($.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent($.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent($.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent($.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent($.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent($.copyToClipboard,t,r)}logCopyToClipboard(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent($.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent($.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent($.recentQueryClick)}logRecentQueryClick(){return U(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent($.clearRecentQueries)}logClearRecentQueries(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent($.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent($.clearRecentResults)}logClearRecentResults(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent($.noResultsBack)}logNoResultsBack(){return U(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent($.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent($.showLessFoldedResults)}logShowLessFoldedResults(){return U(this,void 0,void 0,function*(){return(yield this.makeShowLessFoldedResults()).log({searchUID:this.provider.getSearchUID()})})}makeEventDescription(t,r){var n;return{actionCause:r,customData:(n=t.payload)===null||n===void 0?void 0:n.customData}}makeCustomEvent(t,r){return U(this,arguments,void 0,function*(n,o,i=Yg[n]){this.coveoAnalyticsClient.getParameters;let a=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),s=Object.assign(Object.assign({},yield this.getBaseEventRequest(a)),{eventType:i,eventValue:n}),u=yield this.coveoAnalyticsClient.makeCustomEvent(s);return{description:this.makeEventDescription(u,n),log:({searchUID:c})=>u.log({lastSearchQueryUid:c})}})}logCustomEvent(t,r){return U(this,arguments,void 0,function*(n,o,i=Yg[n]){return(yield this.makeCustomEvent(n,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return U(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),i=Object.assign(Object.assign({},yield this.getBaseEventRequest(o)),{eventType:r,eventValue:t}),a=yield this.coveoAnalyticsClient.makeCustomEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:s})=>a.log({lastSearchQueryUid:s})}})}logCustomEventWithType(t,r,n){return U(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return U(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),o=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(o,t),log:({searchUID:i})=>o.log({searchQueryUid:i})}})}makeClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){let i=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),a=yield this.coveoAnalyticsClient.makeClickEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:s})=>a.log({searchQueryUid:s})}})}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return U(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.getOrigins()),this.getSplitTestRun()),{customData:r,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,r;return{originContext:(r=(t=this.provider).getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof Xt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getSplitTestRun(){let t=this.provider.getSplitTestRunName?this.provider.getSplitTestRunName():"",r=this.provider.getSplitTestRunVersion?this.provider.getSplitTestRunVersion():"";return Object.assign(Object.assign({},t&&{splitTestRunName:t}),r&&{splitTestRunVersion:r})}makeLikeGeneratedAnswer(t){return this.makeCustomEvent($.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent($.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent($.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent($.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent($.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent($.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent($.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent($.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent($.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent($.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent($.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent($.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent($.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent($.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent($.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent($.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return U(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent($.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Fs=Object.assign({},Mi),Jg=Object.keys(Fs).map(e=>Fs[e]),yo=class extends Cd{constructor({client:t,uuidGenerator:r=mn}){super({client:t,uuidGenerator:r}),this.ticket={}}getApi(t){let r=super.getApi(t);return r!==null?r:t==="setTicket"?this.setTicket:null}addHooks(){this.addHooksForEvent(),this.addHooksForPageView(),this.addHooksForSVCEvents()}setTicket(t){this.ticket=t}clearPluginData(){this.ticket={}}addHooksForSVCEvents(){this.client.registerBeforeSendEventHook((t,...[r])=>Jg.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Jg.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Fs.pageview,{newEventType:Ce.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Fs.event,{newEventType:Ce.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,r){var n;let o=Object.assign(Object.assign(Object.assign(Object.assign({},this.getLocationInformation(t,r)),this.getDefaultContextInformation(t)),this.action?{svcAction:this.action}:{}),Object.keys((n=this.actionData)!==null&&n!==void 0?n:{}).length>0?{svcActionData:this.actionData}:{}),i=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},i),o),r)}getTicketPayload(){return kE(this.ticket)}};yo.Id="svc";var Ds;(function(e){e.click="click",e.flowStart="flowStart"})(Ds||(Ds={}));var Pt;(function(e){e.enterInterface="ticket_create_start",e.fieldUpdate="ticket_field_update",e.fieldSuggestionClick="ticket_classification_click",e.documentSuggestionClick="documentSuggestionClick",e.documentSuggestionQuickview="documentSuggestionQuickview",e.suggestionRate="suggestion_rate",e.nextCaseStep="ticket_next_stage",e.caseCancelled="ticket_cancel",e.caseSolved="ticket_cancel",e.caseCreated="ticket_create"})(Pt||(Pt={}));var Ms;(function(e){e.quit="Quit",e.solved="Solved"})(Ms||(Ms={}));var Ls=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!Ps(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new Xt(t):new So,this.svc=new yo({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new So,this.svc=new yo({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Xt(this.options),this.svc=new yo({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(Pt.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(Pt.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(Pt.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(Pt.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(Pt.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(Pt.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(Pt.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(Pt.caseCancelled,{reason:Ms.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(Pt.caseSolved,{reason:Ms.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(Pt.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Ds.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Ds.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){var r,n;let o=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:o,language:(r=this.provider)===null||r===void 0?void 0:r.getLanguage(),anonymous:(n=this.provider)===null||n===void 0?void 0:n.getIsAnonymous(),clientId:yield this.getClientId()})})}getClientId(){return this.coveoAnalyticsClient instanceof Xt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,o,i;return{originContext:(r=(t=this.provider)===null||t===void 0?void 0:t.getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:(n=this.provider)===null||n===void 0?void 0:n.getOriginLevel1(),originLevel2:(o=this.provider)===null||o===void 0?void 0:o.getOriginLevel2(),originLevel3:(i=this.provider)===null||i===void 0?void 0:i.getOriginLevel3()}}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){var i,a;let s=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:(a=(i=this.provider)===null||i===void 0?void 0:i.getSearchUID())!==null&&a!==void 0?a:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(s)})}};var uh=e=>new Xt(e).getCurrentVisitorId(),qi=(e,t)=>typeof t=="function"?(...r)=>{let n=mi(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,ji=(e,t)=>(...r)=>{let n=mi(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function qs(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function lh(e){let{activeValue:t,ancestryMap:r}=RR(e);return t?IR(t,r):[]}function RR(e){let t=[...e],r=new Map;for(;t.length>0;){let n=t.shift();if(n.state==="selected")return{activeValue:n,ancestryMap:r};if(r)for(let o of n.children)r.set(o,n);t.unshift(...n.children)}return{}}function IR(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var TR=(e,t)=>e.categoryFacetSet[t]?.request;var Ld=(e,t)=>{let r=TR(e,t);return lh(r?.currentValues??[])};m();d();f();p();function js(){return{}}m();d();f();p();function Us(){return{}}m();d();f();p();function Vs(){return{}}m();d();f();p();function Gs(){return{}}function qd(e){return{facetSet:e.facetSet??Gs(),categoryFacetSet:e.categoryFacetSet??js(),dateFacetSet:e.dateFacetSet??Us(),numericFacetSet:e.numericFacetSet??Vs(),automaticFacetSet:e.automaticFacetSet??qs()}}var jd=e=>{let t=[];return OR(e).forEach((r,n)=>{let o=jR(e,r.facetId),i=LR(r,n+1);if(kR(r)){if(!!!Ld(e,r.facetId).length)return;t.push({...i,...DR(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((a,s)=>{if(a.state==="idle")return;let u=dh(a,s+1,o),c=_R(r)?ph(a):NR(a);t.push({...i,...u,...c})})}),PR(e).forEach((r,n)=>{let o=MR(r,n+1);r.values.forEach((i,a)=>{if(i.state==="idle")return;let s=dh(i,a+1,"specific"),u=ph(i);t.push({...o,...s,...u})})}),t},_R=e=>e.type==="specific",kR=e=>e.type==="hierarchical",OR=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),PR=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),dh=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),NR=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),ph=e=>({displayValue:e.value,value:e.value}),FR=(e,t)=>Ld(e,t).map(n=>n.value).join(";"),DR=(e,t)=>{let n=FR(e,t);return{value:n,valuePosition:1,displayValue:n}},MR=(e,t)=>({title:fh(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),LR=(e,t)=>({title:fh(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),fh=(e,t)=>`${e}_${t}`,qR=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,jR=(e,t)=>{let r=qR(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var Ud=e=>e.configuration.search.locale,mh=e=>e.configuration.search.timezone,gh=e=>e.configuration.accessToken,hh=e=>e.configuration.organizationId,yh=e=>e.configuration.environment,Bs=e=>e.configuration?.knowledge?.agentId,vh=e=>e.configuration.knowledge.debugAgentSession;var je=e=>{if(UR(e)||Vd(e))return e.generatedAnswer?.answerId;if(VR(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},UR=e=>"answer"in e&&"generatedAnswer"in e&&!ce(e.generatedAnswer?.answerConfigurationId),Vd=e=>{let t=Bs(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},VR=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Gd=e=>e.generatedAnswer?.fieldsToIncludeInCitations,kr=e=>e.followUpAnswers?.conversationId,GR=e=>e.generatedAnswer?.citations,BR=e=>e.followUpAnswers?.followUpAnswers,$R=ze(BR,e=>e?.flatMap(t=>t.citations)),QR=(e,t)=>t,bo=ze(GR,$R,QR,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));m();d();f();p();var Et=()=>({q:"",enableQuerySyntax:!1});m();d();f();p();m();d();f();p();var Sh=(r=>(r.Ascending="ascending",r.Descending="descending",r))(Sh||{}),bh=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(bh||{}),Bd=e=>{if(hm(e))return e.map(t=>Bd(t)).join(",");switch(e.by){case"relevancy":case"qre":case"nosort":return e.by;case"date":return`date ${e.order}`;case"field":return`@${e.field} ${e.order}`;default:return""}},Ah=()=>({by:"relevancy"});var xV=new re({values:{by:new Dl({enum:bh,required:!0}),order:new Dl({enum:Sh}),field:new H}});function $s(){return Bd(Ah())}m();d();f();p();m();d();f();p();var Ao=()=>"default";var HR=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},mr=class{constructor(t){ue(this,"getState",t);ue(this,"state");this.state=t()}getLanguage(){return HR(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[i,a]of Object.entries(n)){let s=`context_${i}`;o[s]=a}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=so),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||Ao()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};var Ui=class Ui extends mr{constructor(){super(...arguments);ue(this,"getFacetRequest",r=>this.state.facetSet?.[r]?.request||this.state.categoryFacetSet?.[r]?.request||this.state.dateFacetSet?.[r]?.request||this.state.numericFacetSet?.[r]?.request||this.state.automaticFacetSet?.set[r]?.response)}getFacetState(){return jd(qd(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Ui.fallbackPipelineName}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.resultURIs,numberOfResults:this.numberOfResults}}getSearchUID(){let r=this.getState();return r.search?.searchResponseId||r.search?.response.searchUid||Ht().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Ui.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=je(r);return o&&(n.generativeQuestionAnsweringId=o),n}getFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetValue:n,facetTitle:`${i}_${r}`}}getFacetClearAllMetadata(r){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetTitle:`${o}_${r}`}}getFacetUpdateSortMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,criteria:n,facetTitle:`${i}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${i}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??$s()}}getStaticFilterToggleMetadata(r,n){return{...this.getBaseMetadata(),staticFilterId:r,staticFilterValue:n}}getStaticFilterClearAllMetadata(r){return{...this.getBaseMetadata(),staticFilterId:r}}getUndoTriggerQueryMetadata(r){return{...this.getBaseMetadata(),undoneQuery:r}}getCategoryBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:i,categoryFacetPath:n,categoryFacetTitle:`${i}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let o=this.state.querySuggest?.[r],i=o.completions.map(c=>c.expression),a=o.partialQueries.length-1,s=o.partialQueries[a]||"",u=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(n),partialQuery:s,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:i.length>0?i:"",querySuggestResponseId:u}}getInterfaceChangeMetadata(){return{...this.getBaseMetadata(),interfaceChangeTo:this.state.configuration.analytics.originLevel2}}getOmniboxFromLinkMetadata(r){return{...this.getBaseMetadata(),...r}}getGeneratedAnswerMetadata(){let r=this.getState(),n={};return r.generatedAnswer?.isVisible!==void 0&&(n.showGeneratedAnswer=r.generatedAnswer.isVisible),n}get resultURIs(){return this.results?.map(r=>({documentUri:r.uri,documentUriHash:r.raw.urihash}))}get results(){return this.state.search?.response.results}get queryText(){return this.state.query?.q||Et().q}get responseTime(){return this.state.search?.duration||Ht().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Ht().response.totalCountFiltered}};ue(Ui,"fallbackPipelineName","default");var Or=Ui,wh=({logger:e,getState:t,analyticsClientMiddleware:r=(a,s)=>s,preprocessRequest:n,provider:o,disableBrowserPrivacySignals:i})=>{let a=t(),s=a.configuration.accessToken,u=a.configuration.analytics.apiBaseUrl??kt(a.configuration.organizationId,a.configuration.environment,"analytics"),c=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,v=new Ns({token:s,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:qi(e,n),beforeSendHooks:[ji(e,r),(R,h)=>(e.info({...h,type:R,endpoint:u,token:s},"Analytics request"),h)]},o);return g||v.disable(),v},$d=()=>{let t=ht.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};var Qs=/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield uh(e),clientTimestamp:new Date().toISOString(),documentReferrer:e.originLevel3,originContext:e.originContext,...(t&&{actionCause:t.actionCause,customData:t.customData}),...(t&&!r&&{customData:t.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.documentLocation&&{documentLocation:e.documentLocation}),...(e.deviceId&&{deviceId:e.deviceId}),...($d()&&{pageId:$d()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:mo(e)})}}});return function Qs(_x17,_x18){return _ref10.apply(this,arguments)}}();m();d();f();p();m();d();f();p();m();d();f();p();var wo=()=>({duration:0,error:null,isLoading:!1,id:"Recommendation",recommendations:[],searchUid:"",splitTestRun:"",pipeline:""});var Vi=class extends mr{getPipeline(){return this.state.pipeline||this.state.recommendation?.pipeline||"default"}getSearchEventRequestPayload(){return{queryText:Et().q,responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getSearchUID(){return this.getState().recommendation?.searchUid||wo().searchUid}getSplitTestRunName(){return this.state.recommendation?.splitTestRun}getSplitTestRunVersion(){let t=!!this.getSplitTestRunName(),r=this.state.recommendation?.pipeline||this.state.pipeline||"default";return t?r:void 0}get responseTime(){return this.state.recommendation?.duration||wo().duration}mapResultsToAnalyticsDocument(){return this.state.recommendation?.recommendations.map(t=>({documentUri:t.uri,documentUriHash:t.raw.urihash}))}get numberOfResults(){return this.state.recommendation?.recommendations.length||wo().recommendations.length}};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function xh(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}m();d();f();p();m();d();f();p();m();d();f();p();var Ch=/^(?:[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 zR(e){return typeof e=="string"&&Ch.test(e)}var Qd=zR;m();d();f();p();var it=[];for(let e=0;e<256;++e)it.push((e+256).toString(16).slice(1));function Eh(e,t=0){return(it[e[t+0]]+it[e[t+1]]+it[e[t+2]]+it[e[t+3]]+"-"+it[e[t+4]]+it[e[t+5]]+"-"+it[e[t+6]]+it[e[t+7]]+"-"+it[e[t+8]]+it[e[t+9]]+"-"+it[e[t+10]]+it[e[t+11]]+it[e[t+12]]+it[e[t+13]]+it[e[t+14]]+it[e[t+15]]).toLowerCase()}m();d();f();p();var WR=new Uint8Array(16);function Hd(){return crypto.getRandomValues(WR)}m();d();f();p();function KR(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():YR(e,t,r)}function YR(e,t,r){e=e||{};let n=e.random??e.rng?.()??Hd();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 Eh(n)}var zd=KR;function XR(_x19){return _XR.apply(this,arguments)}function _XR(){_XR=_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 _XR.apply(this,arguments)}var Oh="2.1.3",Wd=128,Ph=192,Rh=224,Ih=240,ZR=248;function JR(e){return(e&ZR)===Ih?4:(e&Ih)===Rh?3:(e&Rh)===Ph?2:1}function eI(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&Wd)!=Wd)break;if(r-=3,(n&Ph)!=Wd){t-r>=JR(n)*3&&(r=t);break}}return e.substring(0,r)}function tI(e){let{trackingId:t}=e;return{trackingId:t}}function rI(e){return(e.source||[]).concat([`relay@${Oh}`])}function Nh(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,a=tI(t),s=r.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:rI(t),clientId:s,userAgent:i(),referrer:Th(n()),location:Th(o())})}function Th(e){return e!==null?eI(e,1024):null}function nI(e,t,r,n){return{...t,meta:Nh(e,r,n)}}var oI="*";function iI(){let e=[];function t({type:u,callback:c}){return e.findIndex(g=>g.type===u&&g.callback===c)}function r(u,c){return u.type==="*"||c===u.type}function n(u){return t(u)<0&&e.push(u),()=>s(u.type,u.callback)}function o(u){e.forEach(c=>{if(r(c,u.meta.type))try{c.callback(u)}catch(g){console.error(g)}})}function i(u){if(u===oI)e.length=0;else for(let c=e.length-1;c>=0;c--)e[c].type===u&&e.splice(c,1)}function a(u){let c=t(u);c>=0&&e.splice(c,1)}function s(u,c){c?a({type:u,callback:c}):i(u)}return{add:n,call:o,remove:s}}function _h({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 aI(e){let t=_h(e);return{get:()=>t,update:r=>{t=_h({...t,...r})}}}var Kd=sI();function sI(){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()}`,s=i?`;domain=${i}`:"";document.cookie=`${e}${r}=${n}${a}${s};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function cI(){return{getItem(e){return Kd.getItem(e)||localStorage.getItem(e)},removeItem(e){Kd.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Kd.setItem(e,t,31556952e3)}}}var kh="visitorId";function uI(){let e=document.referrer;return e===""?null:e}function Yd(){let e=cI();return{runtime:"browser",send:function(){var _ref11=_asyncToGenerator(function*(t,r,n){let o=C(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});xh().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let a=yield o;if(a?.ok){let s;try{s=yield a.json()}catch{return}for(let u of s.events)if(!u.accepted)throw new Error(`Received event was rejected for processing: ${u.errorMessage}`)}else throw new Error(`Error ${a.status}: Failed to send the event(s).`)});return function send(_x20,_x21,_x22){return _ref11.apply(this,arguments)}}(),getReferrer:()=>uI(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(kh);if(t&&Qd(t))return t;let r=zd();return e.setItem(kh,r),r}}}function lI(){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 dI(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function pI(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=dI();return t&&r?{...r,runtime:"custom"}:t&&fI()&&lI()?Yd():n}function fI(){try{return typeof window=="object"}catch{return!1}}function mI(e){return{get:()=>Object.freeze(pI(e))}}function Fh(e){let t=aI(e),r=iI(),n=mI(t);return{emit:function(){var _ref12=_asyncToGenerator(function*(o,i){let a=t.get(),s=n.get(),u=nI(o,i,a,s);return XR({config:a,environment:s,event:u,listenerManager:r})});return function emit(_x23,_x24){return _ref12.apply(this,arguments)}}(),getMeta:o=>Nh(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:Oh}}m();d();f();p();function Dh(){return typeof window<"u"&&typeof document<"u"}var gI=50,hI=rs({memoize:ud,memoizeOptions:{maxSize:gI}}),Gi=hI(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>mo(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},a,s)=>{let u=vI(s);return Fh({mode:i?"emit":"disabled",url:o??Fa(e,t),token:r,trackingId:n??null,source:a,environment:u})}),yI={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref13=_asyncToGenerator(function*(){});return function send(){return _ref13.apply(this,arguments)}}()},vI=e=>{if(!e)return;let t=e();return{...(Dh()?Yd():yI),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();var Bi=class extends mr{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Mh=({logger:e,getState:t,analyticsClientMiddleware:r=(a,s)=>s,preprocessRequest:n,provider:o=new Bi(t),disableBrowserPrivacySignals:i})=>{let a=t(),s=a.configuration.accessToken,u=a.configuration.analytics.apiBaseUrl??kt(a.configuration.organizationId,a.configuration.environment,"analytics"),c=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,v=new Ls({enableAnalytics:g,token:s,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:qi(e,n),beforeSendHooks:[ji(e,r),(R,h)=>(e.info({...h,type:R,endpoint:u,token:s},"Analytics request"),h)]},o);return g||v.disable(),v};m();d();f();p();m();d();f();p();function qh(e,t){return{...new Or(t).getBaseMetadata(),actionCause:e,type:e}}function SI(e){return Object.assign(e,{instantlyCallable:!0})}function bI(e,t){let r=i=>{let a=ke(e,i);return SI(Object.assign(a,{type:a.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(i,{getState:a,extra:s}){let{analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:v}=s;return yield(yield t({getState:a,analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:v})).log({state:a(),extra:s})});return function(_x25,_x26){return _ref14.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref15=_asyncToGenerator(function*({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:u,disableBrowserPrivacySignals:c}){let{description:g,log:v}=yield t({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:u,disableBrowserPrivacySignals:c});return{description:g,action:r(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(R,{getState:h,extra:y}){return yield v({state:h(),extra:y})});return function(_x28,_x29){return _ref16.apply(this,arguments)}}())}});return function prepare(_x27){return _ref15.apply(this,arguments)}}()}),n}var jh=(e,t,r)=>{function n(...o){let i=o.length===1?{...o[0],__legacy__getBuilder:t(o[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:r}:{prefix:o[0],__legacy__getBuilder:t(o[1]),__legacy__provider:o[2],analyticsConfigurator:e,providerClass:r};return xI(i)}return n},AI=e=>e.configuration.analytics.analyticsMode==="legacy",wI=e=>e.configuration.analytics.analyticsMode==="next",xI=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:a})=>(r??(r=s=>new a(s)),bI(e,/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*({getState:s,analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:v}){let R=[],h={log:function(){var _ref18=_asyncToGenerator(function*({state:N}){for(let _ of R)yield _(N)});return function log(_x31){return _ref18.apply(this,arguments)}}()},y=s(),b=i({getState:s,logger:g,analyticsClientMiddleware:u,preprocessRequest:c,disableBrowserPrivacySignals:v,provider:r(s)}),x=yield t(b,s());h.description=x?.description,R.push(/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(N){AI(N)&&(yield CI(x,r,N,g,b.coveoAnalyticsClient))});return function(_x32){return _ref19.apply(this,arguments)}}());let{emit:I}=Gi(y);return R.push(/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(N){if(wI(N)&&o&&n){let _=n(N);yield OI(I,o,_)}});return function(_x33){return _ref20.apply(this,arguments)}}()),h});return function(_x30){return _ref17.apply(this,arguments)}}()));function CI(_x34,_x35,_x36,_x37,_x38){return _CI.apply(this,arguments)}function _CI(){_CI=_asyncToGenerator(function*(e,t,r,n,o){t(()=>r);let i=yield e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:o,response:i},"Analytics response")});return _CI.apply(this,arguments)}var EI=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref21=_asyncToGenerator(function*(i){r(n,o)});return function log(_x39){return _ref21.apply(this,arguments)}}()}),De=jh(e=>wh({...e,provider:e.provider||new Or(e.getState)}),e=>e,Or),IB=jh(Mh,EI("caseAssist"),Bi);var Xd=(e,t)=>{let r=t.recommendation?.recommendations.findIndex(({uniqueId:n})=>e.uniqueId===n)||0;return RI(e,r,t)},Uh=(e,t)=>({sourceName:Gh(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Tr()}),Vh=(e,t)=>({sourceName:Gh(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Tr()});function Gh(e){let t=e.source;return ce(t)?"unknown":t}var Bh=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function RI(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:_I(e),...(Lh(e)?{documentCategory:Lh(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:kI(e),queryPipeline:r.pipeline||Tr()}}function Lh(e){return e.raw?.objecttype||void 0}var Hs=e=>(e.raw.permanentid||console.warn("Missing field permanentid on result. This might cause many issues with your Coveo deployment. See https://docs.coveo.com/en/1913 and https://docs.coveo.com/en/1640 for more information.",e),{contentIDKey:"permanentid",contentIDValue:e.raw.permanentid||""}),$h={urihash:new H,sourcetype:new H,permanentid:new H},Qh={uniqueId:Y,raw:new re({values:$h}),title:Y,uri:Y,clickUri:Y,rankingModifier:new H({required:!1,emptyAllowed:!0})};function II(e){return Object.assign({},...Object.keys($h).map(t=>({[t]:e[t]})))}function TI(e){return Object.assign({},...Object.keys(Qh).map(t=>({[t]:e[t]})),{raw:II(e.raw)})}function _I(e){let t=e.raw.author;return ce(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function kI(e){let t=e.raw.source;return ce(t)?"unknown":t}var Zd=e=>new yt(Qh).validate(TI(e));function OI(_x40,_x41,_x42){return _OI.apply(this,arguments)}function _OI(){_OI=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _OI.apply(this,arguments)}m();d();f();p();var Hh=()=>De("analytics/recommendation/update",e=>e.makeRecommendationInterfaceLoad(),e=>new Vi(e)),zh=()=>({actionCause:"recommendationInterfaceLoad"}),Ws=e=>De({prefix:"analytics/recommendation/open",__legacy__getBuilder:(t,r)=>(Zd(e),t.makeRecommendationOpen(Xd(e,r),Hs(e))),__legacy__provider:t=>new Vi(t),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=Xd(e,t),n=Hs(e);return{responseId:e.searchUid??"",position:r.documentPosition,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.documentTitle,author:r.documentAuthor,url:r.documentUrl}}}});var xo=L("recommendation/set",e=>V(e,{id:Y})),Pr=ke("recommendation/get",/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=Date.now(),a=yield PI(o),s=yield n.recommendations(a),u=Date.now()-i;return vt(s)?r(s.error):{recommendations:s.success.results,analyticsAction:Hh(),duration:u,searchUid:s.success.searchUid,splitTestRun:s.success.splitTestRun,pipeline:s.success.pipeline}});return function(_x43,_x44){return _ref22.apply(this,arguments)}}()),PI=/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??wr(e.configuration.organizationId,e.configuration.environment),recommendation:e.recommendation.id,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,locale:e.configuration.search.locale,actionsHistory:e.configuration.analytics.enabled?ht.getInstance().getHistory():[],...(e.advancedSearchQueries&&{aq:e.advancedSearchQueries.aq,cq:e.advancedSearchQueries.cq}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.context&&{context:e.context.contextValues}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.configuration.analytics.enabled&&(yield NI(e,zh()))),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}),...(e.pagination&&{numberOfResults:e.pagination.numberOfResults})}});return function PI(_x45){return _ref23.apply(this,arguments)}}(),NI=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t){let r=e.configuration.analytics.analyticsMode==="legacy"?void 0:{actionCause:t.actionCause,type:t.actionCause};return yield Qs(e.configuration.analytics,r)});return function NI(_x46,_x47){return _ref24.apply(this,arguments)}}();var Co=Be(wo(),e=>{e.addCase(xo,(t,r)=>{t.id=r.payload.id}).addCase(Pr.rejected,(t,r)=>{t.error=r.payload?r.payload:null,t.isLoading=!1}).addCase(Pr.fulfilled,(t,r)=>{t.error=null,t.recommendations=r.payload.recommendations.map(n=>({...n,searchUid:r.payload.searchUid})),t.duration=r.payload.duration,t.isLoading=!1,t.searchUid=r.payload.searchUid,t.splitTestRun=r.payload.splitTestRun,t.pipeline=r.payload.pipeline}).addCase(Pr.pending,t=>{t.isLoading=!0}).addCase(Ss,(t,r)=>{t.error=r.payload,t.isLoading=!1})});m();d();f();p();var Eo=L("searchHub/set",e=>V(e,new H({required:!0,emptyAllowed:!0})));m();d();f();p();var Ro=Be(Ao(),e=>{e.addCase(Eo,(t,r)=>r.payload).addCase(St.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Kt,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Wh=class extends Error{constructor(t){super(t[0].message);ue(this,"issues");this.name="SchemaError",this.issues=t}};var cp="uninitialized",tp="pending",rp="fulfilled",np="rejected";function Kh(e){return{status:e,isUninitialized:e===cp,isLoading:e===tp,isSuccess:e===rp,isError:e===np}}var Yh=zt;function ly(e,t){if(e===t||!(Yh(e)&&Yh(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),o=r.length===n.length,i=Array.isArray(t)?[]:{};for(let a of r)i[a]=ly(e[a],t[a]),o&&(o=e[a]===i[a]);return o?e:i}function op(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function FI(e){return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function DI(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function up(e){return e!=null}function Xh(e){return[...(e?.values()??[])].filter(up)}function MI(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var LI=e=>e.replace(/\/$/,""),qI=e=>e.replace(/^\//,"");function jI(e,t){if(!e)return t;if(!t)return e;if(FI(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=LI(e),t=qI(t),`${e}${r}${t}`}function Zs(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var ip=()=>new Map,UI=e=>{let t=new l.AbortController;return setTimeout(()=>{let r="signal timed out",n="TimeoutError";t.abort(typeof DOMException<"u"?new DOMException(r,n):Object.assign(new Error(r),{name:n}))},e),t.signal},VI=(...e)=>{for(let r of e)if(r.aborted)return l.AbortSignal.abort(r.reason);let t=new l.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},Zh=(...e)=>C(...e),GI=e=>e.status>=200&&e.status<=299,BI=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Jh(e){if(!zt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var $I=e=>typeof e=="object"&&(zt(e)||Array.isArray(e)||typeof e.toJSON=="function");function dy({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=Zh,paramsSerializer:n,isJsonContentType:o=BI,jsonContentType:i="application/json",jsonReplacer:a,timeout:s,responseHandler:u,validateStatus:c,...g}={}){return typeof C>"u"&&r===Zh&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(R,h,y){let{getState:b,extra:x,endpoint:I,forced:N,type:_}=h,P,{url:w,headers:O=new E(g.headers),params:k=void 0,responseHandler:T=u??"json",validateStatus:D=c??GI,timeout:G=s,...M}=typeof R=="string"?{url:R}:R,q={...g,signal:G?VI(h.signal,UI(G)):h.signal,...M};O=new E(Jh(O)),q.headers=(yield t(O,{getState:b,arg:R,extra:x,endpoint:I,forced:N,type:_,extraOptions:y}))||O;let B=$I(q.body);if(q.body!=null&&!B&&typeof q.body!="string"&&q.headers.delete("content-type"),!q.headers.has("content-type")&&B&&q.headers.set("content-type",i),B&&o(q.headers)&&(q.body=JSON.stringify(q.body,a)),q.headers.has("accept")||(T==="json"?q.headers.set("accept","application/json"):T==="text"&&q.headers.set("accept","text/plain, text/html, */*")),k){let Z=~w.indexOf("?")?"&":"?",se=n?n(k):new URLSearchParams(Jh(k));w+=Z+se}w=jI(e,w);let j=new Request(w,q);P={request:new Request(w,q)};let W;try{W=yield r(j)}catch(Z){return{error:{status:(Z instanceof Error||typeof DOMException<"u"&&Z instanceof DOMException)&&Z.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(Z)},meta:P}}let Q=W.clone();P.response=Q;let X,z="";try{let Z;if(yield Promise.all([v(W,T).then(se=>X=se,se=>Z=se),Q.text().then(se=>z=se,()=>{})]),Z)throw Z}catch(Z){return{error:{status:"PARSING_ERROR",originalStatus:W.status,data:z,error:String(Z)},meta:P}}return D(W,X)?{data:X,meta:P}:{error:{status:W.status,data:X},meta:P}});return function(_x48,_x49,_x50){return _ref25.apply(this,arguments)}}());function v(_x51,_x52){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(R,h){if(typeof h=="function")return h(R);if(h==="content-type"&&(h=o(R.headers)?"json":"text"),h==="json"){let y=yield R.text();return y.length?JSON.parse(y):null}return R.text()});return _v2.apply(this,arguments)}}var Io=class{constructor(e,t=void 0){ue(this,"value");ue(this,"meta");this.value=e,this.meta=t}};function QI(){return _QI.apply(this,arguments)}function _QI(){_QI=_asyncToGenerator(function*(e=0,t=5,r){let n=Math.min(e,t),o=~~((Math.random()+.4)*(300<<n));yield new Promise((i,a)=>{let s=setTimeout(()=>i(),o);if(r){let u=()=>{clearTimeout(s),a(new Error("Aborted"))};r.aborted?(clearTimeout(s),a(new Error("Aborted"))):r.addEventListener("abort",u,{once:!0})}})});return _QI.apply(this,arguments)}function py(e,t){throw Object.assign(new Io({error:e,meta:t}),{throwImmediately:!0})}function Jd(e){e.aborted&&py({status:"CUSTOM_ERROR",error:"Aborted"})}var ey={},HI=(e,t)=>(/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(r,n,o){let[i]=[5,(t||ey).maxRetries,(o||ey).maxRetries].filter(c=>c!==void 0).slice(-1),s={maxRetries:i,backoff:QI,retryCondition:(c,g,{attempt:v})=>v<=i,...t,...o},u=0;for(;;){Jd(n.signal);try{let c=yield e(r,n,o);if(c.error)throw new Io(c);return c}catch(c){if(u++,c.throwImmediately){if(c instanceof Io)return c.value;throw c}if(c instanceof Io){if(!s.retryCondition(c.value.error,r,{attempt:u,baseQueryApi:n,extraOptions:o}))return c.value}else if(u>s.maxRetries)return{error:c};Jd(n.signal);try{yield s.backoff(u,s.maxRetries,n.signal)}catch(g){throw Jd(n.signal),g}}}});return function(_x53,_x54,_x55){return _ref26.apply(this,arguments)}}()),fy=Object.assign(HI,{fail:py}),ec="__rtkq/",zI="online",WI="offline";var my="focused";var lp=L(`${ec}${my}`),gy=L(`${ec}un${my}`),dp=L(`${ec}${zI}`),hy=L(`${ec}${WI}`);var Wi="query",yy="mutation",vy="infinitequery";function tc(e){return e.type===Wi}function KI(e){return e.type===yy}function Qi(e){return e.type===vy}function Js(e){return tc(e)||Qi(e)}function pp(e,t,r,n,o,i){let a=YI(e)?e(t,r,n,o):e;return a?op(a,up,s=>i(Sy(s))):[]}function YI(e){return typeof e=="function"}function Sy(e){return typeof e=="string"?{type:e}:e}function XI(e,t){return e.catch(t)}var To=(e,t)=>e.endpointDefinitions[t],Hi=Symbol("forceQueryFn"),ap=e=>typeof e[Hi]=="function";function ZI({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:a}){let s=w=>a(w)?.runningQueries,u=w=>a(w)?.runningMutations,{unsubscribeQueryResult:c,removeMutationResult:g,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:N,buildInitiateInfiniteQuery:_,buildInitiateMutation:P,getRunningQueryThunk:R,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:b};function R(w,O){return k=>{let T=e({queryArgs:O,endpointDefinition:To(i,w),endpointName:w});return s(k)?.get(T)}}function h(w,O){return k=>u(k)?.get(O)}function y(){return w=>Xh(s(w))}function b(){return w=>Xh(u(w))}function x(w){}function I(w,O){let k=(T,{subscribe:D=!0,forceRefetch:G,subscriptionOptions:M,[Hi]:q,...B}={})=>(j,W)=>{let Q=e({queryArgs:T,endpointDefinition:O,endpointName:w}),X,z={...B,type:Wi,subscribe:D,forceRefetch:G,subscriptionOptions:M,endpointName:w,originalArgs:T,queryCacheKey:Q,[Hi]:q};if(tc(O))X=t(z);else{let{direction:me,initialPageParam:we,refetchCachedPages:Se}=B;X=r({...z,direction:me,initialPageParam:we,refetchCachedPages:Se})}let Z=o.endpoints[w].select(T),se=j(X),ye=Z(W());let{requestId:_e,abort:Ge}=se,Fe=ye.requestId!==_e,Me=s(j)?.get(Q),Le=()=>Z(W()),ve=Object.assign(q?se.then(Le):Fe&&!Me?Promise.resolve(ye):Promise.all([Me,se]).then(Le),{arg:T,requestId:_e,subscriptionOptions:M,queryCacheKey:Q,abort:Ge,unwrap(){return _asyncToGenerator(function*(){let me=yield ve;if(me.isError)throw me.error;return me.data})()},refetch:me=>j(k(T,{subscribe:!1,forceRefetch:!0,...me})),unsubscribe(){D&&j(c({queryCacheKey:Q,requestId:_e}))},updateSubscriptionOptions(me){ve.subscriptionOptions=me,j(v({endpointName:w,requestId:_e,queryCacheKey:Q,options:me}))}});if(!Me&&!Fe&&!q){let me=s(j);me.set(Q,ve),ve.then(()=>{me.delete(Q)})}return ve};return k}function N(w,O){return I(w,O)}function _(w,O){return I(w,O)}function P(w){return(O,{track:k=!0,fixedCacheKey:T}={})=>(D,G)=>{let M=D(n({type:"mutation",endpointName:w,originalArgs:O,track:k,fixedCacheKey:T}));let{requestId:q,abort:B,unwrap:j}=M,W=XI(M.unwrap().then(Z=>({data:Z})),Z=>({error:Z})),Q=()=>{D(g({requestId:q,fixedCacheKey:T}))},X=Object.assign(W,{arg:M.arg,requestId:q,abort:B,unwrap:j,reset:Q}),z=u(D);return z.set(q,X),X.then(()=>{z.delete(q)}),T&&(z.set(T,X),X.then(()=>{z.get(T)===X&&z.delete(T)})),X}}}var by=class extends Wh{constructor(t,r,n,o){super(t);ue(this,"value");ue(this,"schemaName");ue(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},gn=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function hn(_x56,_x57,_x58,_x59){return _hn.apply(this,arguments)}function _hn(){_hn=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new by(o.issues,t,r,n);return o.value});return _hn.apply(this,arguments)}function ty(e){return e}var $i=(e={})=>({...e,[Pi]:!0});function JI({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:a,onSchemaFailure:s,catchSchemaFailure:u,skipSchemaValidation:c}){let g=(M,q,B,j)=>(W,Q)=>{let X=r[M],z=n({queryArgs:q,endpointDefinition:X,endpointName:M});if(W(o.internalActions.queryResultPatched({queryCacheKey:z,patches:B})),!j)return;let Z=o.endpoints[M].select(q)(Q()),se=pp(X.providesTags,Z.data,void 0,q,{},i);W(o.internalActions.updateProvidedBy([{queryCacheKey:z,providedTags:se}]))};function v(M,q,B=0){let j=[q,...M];return B&&j.length>B?j.slice(0,-1):j}function R(M,q,B=0){let j=[...M,q];return B&&j.length>B?j.slice(1):j}let h=(M,q,B,j=!0)=>(W,Q)=>{let X=o.endpoints[M].select(q)(Q()),z={patches:[],inversePatches:[],undo:()=>W(o.util.patchQueryData(M,q,z.inversePatches,j))};if(X.status==="uninitialized")return z;let Z;if("data"in X)if(lt(X.data)){let[se,ye,_e]=ad(X.data,B);z.patches.push(...ye),z.inversePatches.push(..._e),Z=se}else Z=B(X.data),z.patches.push({op:"replace",path:[],value:Z}),z.inversePatches.push({op:"replace",path:[],value:X.data});return z.patches.length===0||W(o.util.patchQueryData(M,q,z.patches,j)),z},y=(M,q,B)=>j=>j(o.endpoints[M].initiate(q,{subscribe:!1,forceRefetch:!0,[Hi]:()=>({data:B})})),b=(M,q)=>M.query&&M[q]?M[q]:ty,x=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(M,{signal:q,abort:B,rejectWithValue:j,fulfillWithValue:W,dispatch:Q,getState:X,extra:z}){let Z=r[M.endpointName],{metaSchema:se,skipSchemaValidation:ye=c}=Z,_e=M.type===Wi;try{let Ge=ty,Fe={signal:q,abort:B,dispatch:Q,getState:X,extra:z,endpoint:M.endpointName,type:M.type,forced:_e?I(M,X()):void 0,queryCacheKey:_e?M.queryCacheKey:void 0},Me=_e?M[Hi]:void 0,Le,ve=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(we,Se,He,Ye){if(Se==null&&we.pages.length)return Promise.resolve({data:we});let Tt=yield me({queryArg:M.originalArgs,pageParam:Se}),xt=Ye?v:R;return{data:{pages:xt(we.pages,Tt.data,He),pageParams:xt(we.pageParams,Se,He)},meta:Tt.meta}});return function ve(_x62,_x63,_x64,_x65){return _ref28.apply(this,arguments)}}();function me(_x66){return _me2.apply(this,arguments)}function _me2(){_me2=_asyncToGenerator(function*(we){let Se,{extraOptions:He,argSchema:Ye,rawResponseSchema:Tt,responseSchema:xt}=Z;if(Ye&&!gn(ye,"arg")&&(we=yield hn(Ye,we,"argSchema",{})),Me?Se=Me():Z.query?(Ge=b(Z,"transformResponse"),Se=yield t(Z.query(we),Fe,He)):Se=yield Z.queryFn(we,Fe,He,ir=>t(ir,Fe,He)),typeof process<"u",Se.error)throw new Io(Se.error,Se.meta);let{data:qt}=Se;Tt&&!gn(ye,"rawResponse")&&(qt=yield hn(Tt,Se.data,"rawResponseSchema",Se.meta));let _t=yield Ge(qt,Se.meta,we);return xt&&!gn(ye,"response")&&(_t=yield hn(xt,_t,"responseSchema",Se.meta)),{...Se,data:_t}});return _me2.apply(this,arguments)}if(_e&&"infiniteQueryOptions"in Z){let{infiniteQueryOptions:we}=Z,{maxPages:Se=1/0}=we,He=M.refetchCachedPages??we.refetchCachedPages??!0,Ye,Tt={pages:[],pageParams:[]},xt=a.selectQueryEntry(X(),M.queryCacheKey)?.data,qt=I(M,X())&&!M.direction||!xt?Tt:xt;if("direction"in M&&M.direction&&qt.pages.length){let _t=M.direction==="backward";Ye=yield ve(qt,(_t?sp:Xs)(we,qt,M.originalArgs),Se,_t)}else{let{initialPageParam:_t=we.initialPageParam}=M,ir=xt?.pageParams??[],xl=ir[0]??_t,Wf=ir.length;if(Ye=yield ve(qt,xl,Se),Me&&(Ye={data:Ye.data.pages[0]}),He)for(let Kf=1;Kf<Wf;Kf++){let vw=Xs(we,Ye.data,M.originalArgs);Ye=yield ve(Ye.data,vw,Se)}}Le=Ye}else Le=yield me(M.originalArgs);return se&&!gn(ye,"meta")&&Le.meta&&(Le.meta=yield hn(se,Le.meta,"metaSchema",Le.meta)),W(Le.data,$i({fulfilledTimeStamp:Date.now(),baseQueryMeta:Le.meta}))}catch(Ge){let Fe=Ge;if(Fe instanceof Io){let Me=b(Z,"transformErrorResponse"),{rawErrorResponseSchema:Le,errorResponseSchema:ve}=Z,{value:me,meta:we}=Fe;try{Le&&!gn(ye,"rawErrorResponse")&&(me=yield hn(Le,me,"rawErrorResponseSchema",we)),se&&!gn(ye,"meta")&&(we=yield hn(se,we,"metaSchema",we));let Se=yield Me(me,we,M.originalArgs);return ve&&!gn(ye,"errorResponse")&&(Se=yield hn(ve,Se,"errorResponseSchema",we)),j(Se,$i({baseQueryMeta:we}))}catch(Se){Fe=Se}}try{if(Fe instanceof by){let Me={endpoint:M.endpointName,arg:M.originalArgs,type:M.type,queryCacheKey:_e?M.queryCacheKey:void 0};Z.onSchemaFailure?.(Fe,Me),s?.(Fe,Me);let{catchSchemaFailure:Le=u}=Z;if(Le)return j(Le(Fe,Me),$i({baseQueryMeta:Fe._bqMeta}))}}catch(Me){Fe=Me}throw typeof process<"u",console.error(Fe),Fe}});return function x(_x60,_x61){return _ref27.apply(this,arguments)}}();function I(M,q){let B=a.selectQueryEntry(q,M.queryCacheKey),j=a.selectConfig(q).refetchOnMountOrArgChange,W=B?.fulfilledTimeStamp,Q=M.forceRefetch??(M.subscribe&&j);return Q?Q===!0||(Number(new Date)-Number(W))/1e3>=Q:!1}let N=()=>ke(`${e}/executeQuery`,x,{getPendingMeta({arg:M}){let q=r[M.endpointName];return $i({startedTimeStamp:Date.now(),...(Qi(q)?{direction:M.direction}:{})})},condition(M,{getState:q}){let B=q(),j=a.selectQueryEntry(B,M.queryCacheKey),W=j?.fulfilledTimeStamp,Q=M.originalArgs,X=j?.originalArgs,z=r[M.endpointName],Z=M.direction;if(ap(M))return!0;if(j?.status==="pending")return!1;if(I(M,B)||tc(z)&&z?.forceRefetch?.({currentArg:Q,previousArg:X,endpointState:j,state:B}))return!0;if(W&&!Z)return!1;if(Z&&Qi(z)){let se=j?.data;if(se?.pages.length){let{infiniteQueryOptions:ye}=z;if((Z==="forward"?Xs:sp)(ye,se,Q)==null)return!1}}return!0},dispatchConditionRejection:!0}),_=N(),P=N(),w=ke(`${e}/executeMutation`,x,{getPendingMeta(){return $i({startedTimeStamp:Date.now()})}}),O=M=>"force"in M,k=M=>"ifOlderThan"in M,T=(M,q,B={})=>(j,W)=>{let Q=O(B)&&B.force,X=k(B)&&B.ifOlderThan,z=(se=!0)=>{let ye={forceRefetch:se,subscribe:!1};return o.endpoints[M].initiate(q,ye)},Z=o.endpoints[M].select(q)(W());if(Q)j(z());else if(X){let se=Z?.fulfilledTimeStamp;if(!se){j(z());return}(Number(new Date)-Number(new Date(se)))/1e3>=X&&j(z())}else j(z(!1))};function D(M){return q=>q?.meta?.arg?.endpointName===M}function G(M,q){return{matchPending:io(cs(M),D(q)),matchFulfilled:io(lr(M),D(q)),matchRejected:io(ln(M),D(q))}}return{queryThunk:_,mutationThunk:w,infiniteQueryThunk:P,prefetch:T,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:G}}function Xs(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function sp(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function Ay(e,t,r,n){return pp(r[e.meta.arg.endpointName][t],lr(e)?e.payload:void 0,Fi(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function ry(e){return gt(e)?es(e):e}function Ks(e,t,r){let n=e[t];n&&r(n)}function zi(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function ny(e,t,r){let n=e[zi(t)];n&&r(n)}var Ys={};function eT({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:a,hasRehydrationInfo:s},assertTagType:u,config:c}){let g=L(`${e}/resetApiState`);function v(k,T,D,G){var M;k[M=T.queryCacheKey]??(k[M]={status:cp,endpointName:T.endpointName}),Ks(k,T.queryCacheKey,q=>{q.status=tp,q.requestId=D&&q.requestId?q.requestId:G.requestId,T.originalArgs!==void 0&&(q.originalArgs=T.originalArgs),q.startedTimeStamp=G.startedTimeStamp;let B=o[G.arg.endpointName];Qi(B)&&"direction"in T&&(q.direction=T.direction)})}function R(k,T,D,G){Ks(k,T.arg.queryCacheKey,M=>{if(M.requestId!==T.requestId&&!G)return;let{merge:q}=o[T.arg.endpointName];if(M.status=rp,q){if(M.data!==void 0){let{fulfilledTimeStamp:B,arg:j,baseQueryMeta:W,requestId:Q}=T;M.data=cn(M.data,X=>q(X,D,{arg:j.originalArgs,baseQueryMeta:W,fulfilledTimeStamp:B,requestId:Q}))}else M.data=D;}else M.data=o[T.arg.endpointName].structuralSharing??!0?ly(gt(M.data)?od(M.data):M.data,D):D;delete M.error,M.fulfilledTimeStamp=T.fulfilledTimeStamp})}let h=dn({name:`${e}/queries`,initialState:Ys,reducers:{removeQueryResult:{reducer(k,{payload:{queryCacheKey:T}}){delete k[T]},prepare:ao()},cacheEntriesUpserted:{reducer(k,T){for(let D of T.payload){let{queryDescription:G,value:M}=D;v(k,G,!0,{arg:G,requestId:T.meta.requestId,startedTimeStamp:T.meta.timestamp}),R(k,{arg:G,requestId:T.meta.requestId,fulfilledTimeStamp:T.meta.timestamp,baseQueryMeta:{}},M,!0)}},prepare:k=>({payload:k.map(T=>{let{endpointName:D,arg:G,value:M}=T,q=o[D];return{queryDescription:{type:Wi,endpointName:D,originalArgs:T.arg,queryCacheKey:n({queryArgs:G,endpointDefinition:q,endpointName:D})},value:M}}),meta:{[Pi]:!0,requestId:Di(),timestamp:Date.now()}})},queryResultPatched:{reducer(k,{payload:{queryCacheKey:T,patches:D}}){Ks(k,T,G=>{G.data=sd(G.data,D.concat())})},prepare:ao()}},extraReducers(k){k.addCase(t.pending,(T,{meta:D,meta:{arg:G}})=>{v(T,G,ap(G),D)}).addCase(t.fulfilled,(T,{meta:D,payload:G})=>{R(T,D,G,ap(D.arg))}).addCase(t.rejected,(T,{meta:{condition:D,arg:G,requestId:M},error:q,payload:B})=>{Ks(T,G.queryCacheKey,j=>{if(!D){if(j.requestId!==M)return;j.status=np,j.error=B??q}})}).addMatcher(s,(T,D)=>{let{queries:G}=a(D);for(let[M,q]of Object.entries(G))(q?.status==="fulfilled"||q?.status==="rejected")&&(T[M]=q)})}}),y=dn({name:`${e}/mutations`,initialState:Ys,reducers:{removeMutationResult:{reducer(k,{payload:T}){let D=zi(T);D in k&&delete k[D]},prepare:ao()}},extraReducers(k){k.addCase(r.pending,(T,{meta:D,meta:{requestId:G,arg:M,startedTimeStamp:q}})=>{M.track&&(T[zi(D)]={requestId:G,status:tp,endpointName:M.endpointName,startedTimeStamp:q})}).addCase(r.fulfilled,(T,{payload:D,meta:G})=>{G.arg.track&&ny(T,G,M=>{M.requestId===G.requestId&&(M.status=rp,M.data=D,M.fulfilledTimeStamp=G.fulfilledTimeStamp)})}).addCase(r.rejected,(T,{payload:D,error:G,meta:M})=>{M.arg.track&&ny(T,M,q=>{q.requestId===M.requestId&&(q.status=np,q.error=D??G)})}).addMatcher(s,(T,D)=>{let{mutations:G}=a(D);for(let[M,q]of Object.entries(G))(q?.status==="fulfilled"||q?.status==="rejected")&&M!==q?.requestId&&(T[M]=q)})}}),b=dn({name:`${e}/invalidation`,initialState:{tags:{},keys:{}},reducers:{updateProvidedBy:{reducer(k,T){var D,G,M;for(let{queryCacheKey:q,providedTags:B}of T.payload){x(k,q);for(let{type:j,id:W}of B){let Q=(G=(D=k.tags)[j]??(D[j]={}))[M=W??"__internal_without_id"]??(G[M]=[]);Q.includes(q)||Q.push(q)}k.keys[q]=B}},prepare:ao()}},extraReducers(k){k.addCase(h.actions.removeQueryResult,(T,{payload:{queryCacheKey:D}})=>{x(T,D)}).addMatcher(s,(T,D)=>{var M,q,B;let{provided:G}=a(D);for(let[j,W]of Object.entries(G.tags??{}))for(let[Q,X]of Object.entries(W)){let z=(q=(M=T.tags)[j]??(M[j]={}))[B=Q??"__internal_without_id"]??(q[B]=[]);for(let Z of X)z.includes(Z)||z.push(Z),T.keys[Z]=G.keys[Z]}}).addMatcher(Wt(lr(t),Fi(t)),(T,D)=>{I(T,[D])}).addMatcher(h.actions.cacheEntriesUpserted.match,(T,D)=>{I(T,D.payload.map(({queryDescription:G,value:M})=>({type:"UNKNOWN",payload:M,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:G}})))})}});function x(k,T){let D=ry(k.keys[T]??[]);for(let G of D){let M=G.type,q=G.id??"__internal_without_id",B=k.tags[M]?.[q];B&&(k.tags[M][q]=ry(B).filter(j=>j!==T))}delete k.keys[T]}function I(k,T){let D=T.map(G=>{let M=Ay(G,"providesTags",o,u),{queryCacheKey:q}=G.meta.arg;return{queryCacheKey:q,providedTags:M}});b.caseReducers.updateProvidedBy(k,b.actions.updateProvidedBy(D))}let N=dn({name:`${e}/subscriptions`,initialState:Ys,reducers:{updateSubscriptionOptions(k,T){},unsubscribeQueryResult(k,T){},internal_getRTKQSubscriptions(){}}}),_=dn({name:`${e}/internalSubscriptions`,initialState:Ys,reducers:{subscriptionsUpdated:{reducer(k,T){return sd(k,T.payload)},prepare:ao()}}}),P=dn({name:`${e}/config`,initialState:{online:MI(),focused:DI(),middlewareRegistered:!1,...c},reducers:{middlewareRegistered(k,{payload:T}){k.middlewareRegistered=k.middlewareRegistered==="conflict"||i!==T?"conflict":!0}},extraReducers:k=>{k.addCase(dp,T=>{T.online=!0}).addCase(hy,T=>{T.online=!1}).addCase(lp,T=>{T.focused=!0}).addCase(gy,T=>{T.focused=!1}).addMatcher(s,T=>({...T}))}}),w=rn({queries:h.reducer,mutations:y.reducer,provided:b.reducer,subscriptions:_.reducer,config:P.reducer});return{reducer:(k,T)=>w(g.match(T)?void 0:k,T),actions:{...P.actions,...h.actions,...N.actions,..._.actions,...y.actions,...b.actions,resetApiState:g}}}var ep=Symbol.for("RTKQ/skipToken"),wy={status:cp},oy=cn(wy,()=>{}),iy=cn(wy,()=>{});function tT({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=_=>oy,o=_=>iy;return{buildQuerySelector:R,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:b,selectCachedArgsForQuery:x,selectApiState:a,selectQueries:s,selectMutations:c,selectQueryEntry:u,selectConfig:g};function i(_){return{..._,...Kh(_.status)}}function a(_){return _[t]}function s(_){return a(_)?.queries}function u(_,P){return s(_)?.[P]}function c(_){return a(_)?.mutations}function g(_){return a(_)?.config}function v(_,P,w){return O=>{if(O===ep)return r(n,w);let k=e({queryArgs:O,endpointDefinition:P,endpointName:_});return r(D=>u(D,k)??oy,w)}}function R(_,P){return v(_,P,i)}function h(_,P){let{infiniteQueryOptions:w}=P;function O(k){let T={...k,...Kh(k.status)},{isLoading:D,isError:G,direction:M}=T,q=M==="forward",B=M==="backward";return{...T,hasNextPage:I(w,T.data,T.originalArgs),hasPreviousPage:N(w,T.data,T.originalArgs),isFetchingNextPage:D&&q,isFetchingPreviousPage:D&&B,isFetchNextPageError:G&&q,isFetchPreviousPageError:G&&B}}return v(_,P,O)}function y(){return _=>{let P;return typeof _=="object"?P=zi(_)??ep:P=_,r(P===ep?o:O=>a(O)?.mutations?.[P]??iy,i)}}function b(_,P){let w=_[t],O=new Set,k=op(P,up,Sy);for(let T of k){let D=w.provided.tags[T.type];if(!D)continue;let G=(T.id!==void 0?D[T.id]:Object.values(D).flat())??[];for(let M of G)O.add(M)}return Array.from(O.values()).flatMap(T=>{let D=w.queries[T];return D?{queryCacheKey:T,endpointName:D.endpointName,originalArgs:D.originalArgs}:[]})}function x(_,P){return op(Object.values(s(_)),w=>w?.endpointName===P&&w.status!=="uninitialized",w=>w.originalArgs)}function I(_,P,w){return P?Xs(_,P,w)!=null:!1}function N(_,P,w){return!P||!_.getPreviousPageParam?!1:sp(_,P,w)!=null}}var ay=WeakMap?new WeakMap:void 0,sy=({endpointName:e,queryArgs:t})=>{let r="",n=ay?.get(t);if(typeof n=="string")r=n;else{let o=JSON.stringify(t,(i,a)=>(a=typeof a=="bigint"?{$bigint:a.toString()}:a,a=zt(a)?Object.keys(a).sort().reduce((s,u)=>(s[u]=a[u],s),{}):a,a));zt(t)&&ay?.set(t,o),r=o}return`${e}(${r})`};function rT(...e){return function(r){let n=no(c=>r.extractRehydrationInfo?.(c,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(c){let g=sy;if(c.endpointDefinition&&"serializeQueryArgs"in c.endpointDefinition){let v=c.endpointDefinition.serializeQueryArgs;g=R=>{let h=v(R);return typeof h=="string"?h:sy({...R,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(c)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(c){c()},apiUid:Di(),extractRehydrationInfo:n,hasRehydrationInfo:no(c=>n(c)!=null)},a={injectEndpoints:u,enhanceEndpoints({addTagTypes:c,endpoints:g}){if(c)for(let v of c)o.tagTypes.includes(v)||o.tagTypes.push(v);if(g)for(let[v,R]of Object.entries(g))typeof R=="function"?R(To(i,v)):Object.assign(To(i,v)||{},R);return a}},s=e.map(c=>c.init(a,o,i));function u(c){let g=c.endpoints({query:v=>({...v,type:Wi}),mutation:v=>({...v,type:yy}),infiniteQuery:v=>({...v,type:vy})});for(let[v,R]of Object.entries(g)){if(c.overrideExisting!==!0&&v in i.endpointDefinitions){if(c.overrideExisting==="throw")throw new Error(dt(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[v]=R;for(let h of s)h.injectEndpoint(v,R)}return a}return a.injectEndpoints({endpoints:r.endpoints})}}function gr(e,...t){return Object.assign(e,...t)}var nT=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,i=null,a=null,{updateSubscriptionOptions:s,unsubscribeQueryResult:u}=e.internalActions,c=(b,x)=>{if(s.match(x)){let{queryCacheKey:N,requestId:_,options:P}=x.payload,w=b.get(N);return w?.has(_)&&w.set(_,P),!0}if(u.match(x)){let{queryCacheKey:N,requestId:_}=x.payload,P=b.get(N);return P&&P.delete(_),!0}if(e.internalActions.removeQueryResult.match(x))return b.delete(x.payload.queryCacheKey),!0;if(t.pending.match(x)){let{meta:{arg:N,requestId:_}}=x,P=Zs(b,N.queryCacheKey,ip);return N.subscribe&&P.set(_,N.subscriptionOptions??P.get(_)??{}),!0}let I=!1;if(t.rejected.match(x)){let{meta:{condition:N,arg:_,requestId:P}}=x;if(N&&_.subscribe){let w=Zs(b,_.queryCacheKey,ip);w.set(P,_.subscriptionOptions??w.get(P)??{}),I=!0}}return I},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:b=>g().get(b)?.size??0,isRequestSubscribed:(b,x)=>!!g()?.get(b)?.get(x)};function y(b){return JSON.parse(JSON.stringify(Object.fromEntries([...b].map(([x,I])=>[x,Object.fromEntries(I)]))))}return(b,x)=>{if(i||(i=y(r.currentSubscriptions)),e.util.resetApiState.match(b))return i={},r.currentSubscriptions.clear(),a=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(b))return[!1,h];let I=c(r.currentSubscriptions,b),N=!0;if(I){a||(a=setTimeout(()=>{let w=y(r.currentSubscriptions),[,O]=ad(i,()=>w);x.next(e.internalActions.subscriptionsUpdated(O)),i=w,a=null},500));let _=typeof b.type=="string"&&!!b.type.startsWith(o),P=t.rejected.match(b)&&b.meta.condition&&!!b.meta.arg.subscribe;N=!_&&!P}return[N,!1]}},oT=2147483647/1e3-1,iT=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:a},getRunningQueryThunk:s,mwApi:u})=>{let{removeQueryResult:c,unsubscribeQueryResult:g,cacheEntriesUpserted:v}=t.internalActions,R=Wt(g.match,r.fulfilled,r.rejected,v.match);function h(_){let P=o.currentSubscriptions.get(_);return P?P.size>0:!1}let y={};function b(_){for(let P of _.values())P?.abort?.()}let x=(_,P)=>{let w=a(P.getState());if(R(_)){let O;if(v.match(_))O=_.payload.map(k=>k.queryDescription.queryCacheKey);else{let{queryCacheKey:k}=g.match(_)?_.payload:_.meta.arg;O=[k]}I(O,P,w)}if(t.util.resetApiState.match(_)){for(let[O,k]of Object.entries(y))k&&clearTimeout(k),delete y[O];b(o.runningQueries),b(o.runningMutations)}if(n.hasRehydrationInfo(_)){let{queries:O}=n.extractRehydrationInfo(_);I(Object.keys(O),P,w)}};function I(_,P,w){let O=P.getState();for(let k of _){let T=i(O,k);T?.endpointName&&N(k,T.endpointName,P,w)}}function N(_,P,w,O){let k=To(n,P)?.keepUnusedDataFor??O.keepUnusedDataFor;if(k===1/0)return;let T=Math.max(0,Math.min(k,oT));if(!h(_)){let D=y[_];D&&clearTimeout(D),y[_]=setTimeout(()=>{if(!h(_)){let G=i(w.getState(),_);G?.endpointName&&w.dispatch(s(G.endpointName,G.originalArgs))?.abort(),w.dispatch(c({queryCacheKey:_}))}delete y[_]},T*1e3)}}return x},cy=new Error("Promise never resolved before cacheEntryRemoved."),aT=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:a,selectApiState:s}})=>{let u=us(n),c=us(o),g=lr(n,o),v={},{removeQueryResult:R,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function b(w,O,k){let T=v[w];T?.valueResolved&&(T.valueResolved({data:O,meta:k}),delete T.valueResolved)}function x(w){let O=v[w];O&&(delete v[w],O.cacheEntryRemoved())}function I(w){let{arg:O,requestId:k}=w.meta,{endpointName:T,originalArgs:D}=O;return[T,D,k]}let N=(w,O,k)=>{let T=_(w);function D(G,M,q,B){let j=a(k,M),W=a(O.getState(),M);!j&&W&&P(G,B,M,O,q)}if(n.pending.match(w)){let[G,M,q]=I(w);D(G,T,q,M)}else if(y.match(w))for(let{queryDescription:G,value:M}of w.payload){let{endpointName:q,originalArgs:B,queryCacheKey:j}=G;D(q,j,w.meta.requestId,B),b(j,M,{})}else if(o.pending.match(w)){if(O.getState()[t].mutations[T]){let[G,M,q]=I(w);P(G,M,T,O,q)}}else if(g(w))b(T,w.payload,w.meta.baseQueryMeta);else if(R.match(w)||h.match(w))x(T);else if(e.util.resetApiState.match(w))for(let G of Object.keys(v))x(G)};function _(w){return u(w)?w.meta.arg.queryCacheKey:c(w)?w.meta.arg.fixedCacheKey??w.meta.requestId:R.match(w)?w.payload.queryCacheKey:h.match(w)?zi(w.payload):""}function P(w,O,k,T,D){let G=To(r,w),M=G?.onCacheEntryAdded;if(!M)return;let q={},B=new Promise(z=>{q.cacheEntryRemoved=z}),j=Promise.race([new Promise(z=>{q.valueResolved=z}),B.then(()=>{throw cy})]);j.catch(()=>{}),v[k]=q;let W=e.endpoints[w].select(Js(G)?O:k),Q=T.dispatch((z,Z,se)=>se),X=M(O,{...T,getCacheEntry:()=>W(T.getState()),requestId:D,extra:Q,updateCachedData:Js(G)?z=>T.dispatch(e.util.updateQueryData(w,O,z)):void 0,cacheDataLoaded:j,cacheEntryRemoved:B});Promise.resolve(X).catch(z=>{if(z!==cy)throw z})}return N},sT=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},cT=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:a,refetchQuery:s,internalState:u})=>{let{removeQueryResult:c}=i.internalActions,g=Wt(lr(n),Fi(n)),v=Wt(lr(o,n),ln(o,n)),R=[],h=0,y=(I,N)=>{(o.pending.match(I)||n.pending.match(I))&&h++,v(I)&&!(o.rejected.match(I)&&I.meta.condition)&&(h=Math.max(0,h-1)),g(I)?x(Ay(I,"invalidatesTags",r,a),N):v(I)?x([],N):i.util.invalidateTags.match(I)&&x(pp(I.payload,void 0,void 0,void 0,void 0,a),N)};function b(){return h>0}function x(I,N){let _=N.getState(),P=_[e];if(R.push(...I),P.config.invalidationBehavior==="delayed"&&b())return;let w=R;if(R=[],w.length===0)return;let O=i.util.selectInvalidatedBy(_,w);t.batch(()=>{let k=Array.from(O.values());for(let{queryCacheKey:T}of k){let D=P.queries[T],G=Zs(u.currentSubscriptions,T,ip);D&&(G.size===0?N.dispatch(c({queryCacheKey:T})):D.status!=="uninitialized"&&N.dispatch(s(D)))}})}return y},uT=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:a}=o,s=new Set,u=null,c=(x,I)=>{(r.internalActions.updateSubscriptionOptions.match(x)||r.internalActions.unsubscribeQueryResult.match(x))&&g(x.payload.queryCacheKey,I),(t.pending.match(x)||t.rejected.match(x)&&x.meta.condition)&&g(x.meta.arg.queryCacheKey,I),(t.fulfilled.match(x)||t.rejected.match(x)&&!x.meta.condition)&&v(x.meta.arg,I),r.util.resetApiState.match(x)&&(y(),u&&(clearTimeout(u),u=null),s.clear())};function g(x,I){s.add(x),u||(u=setTimeout(()=>{for(let N of s)R({queryCacheKey:N},I);s.clear(),u=null},0))}function v({queryCacheKey:x},I){let N=I.getState()[e].queries[x],_=a.get(x);if(!N||N.status==="uninitialized")return;let{lowestPollingInterval:P,skipPollingIfUnfocused:w}=b(_);if(!Number.isFinite(P))return;let O=i.get(x);O?.timeout&&(clearTimeout(O.timeout),O.timeout=void 0);let k=Date.now()+P;i.set(x,{nextPollTimestamp:k,pollingInterval:P,timeout:setTimeout(()=>{let T=I.getState()[e],D=T.queries[x];if(!D||D.status==="uninitialized"){h(x);return}(T.config.focused||!w)&&I.dispatch(n(D)),v({queryCacheKey:x},I)},P)})}function R({queryCacheKey:x},I){let N=I.getState()[e].queries[x],_=a.get(x);if(!N||N.status==="uninitialized")return;let{lowestPollingInterval:P}=b(_);if(!Number.isFinite(P)){h(x);return}let w=i.get(x),O=Date.now()+P;(!w||O<w.nextPollTimestamp)&&v({queryCacheKey:x},I)}function h(x){let I=i.get(x);I?.timeout&&clearTimeout(I.timeout),i.delete(x)}function y(){for(let x of i.keys())h(x)}function b(x=new Map){let I=!1,N=Number.POSITIVE_INFINITY;for(let _ of x.values())_.pollingInterval&&(N=Math.min(_.pollingInterval,N),I=_.skipPollingIfUnfocused||I);return{lowestPollingInterval:N,skipPollingIfUnfocused:I}}return c},lT=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=cs(r,n),i=ln(r,n),a=lr(r,n),s={};return(c,g)=>{if(o(c)){let{requestId:v,arg:{endpointName:R,originalArgs:h}}=c.meta,y=To(t,R),b=y?.onQueryStarted;if(b){let x={},I=new Promise((P,w)=>{x.resolve=P,x.reject=w});I.catch(()=>{}),s[v]=x;let N=e.endpoints[R].select(Js(y)?h:v),_=g.dispatch((P,w,O)=>O);b(h,{...g,getCacheEntry:()=>N(g.getState()),requestId:v,extra:_,updateCachedData:Js(y)?P=>g.dispatch(e.util.updateQueryData(R,h,P)):void 0,queryFulfilled:I})}}else if(a(c)){let{requestId:v,baseQueryMeta:R}=c.meta;s[v]?.resolve({data:c.payload,meta:R}),delete s[v]}else if(i(c)){let{requestId:v,rejectedWithValue:R,baseQueryMeta:h}=c.meta;s[v]?.reject({error:c.payload??c.error,isUnhandledError:!R,meta:h}),delete s[v]}}},dT=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,a=(u,c)=>{lp.match(u)&&s(c,"refetchOnFocus"),dp.match(u)&&s(c,"refetchOnReconnect")};function s(u,c){let g=u.getState()[e],v=g.queries,R=o.currentSubscriptions;t.batch(()=>{for(let h of R.keys()){let y=v[h],b=R.get(h);if(!b||!y)continue;let x=[...b.values()];(x.some(I=>I[c]===!0)||x.every(I=>I[c]===void 0)&&g.config[c])&&(b.size===0?u.dispatch(i({queryCacheKey:h})):y.status!=="uninitialized"&&u.dispatch(n(y)))}})}return a};function pT(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:a}=o,s={invalidateTags:L(`${t}/invalidateTags`)},u=R=>R.type.startsWith(`${t}/`),c=[sT,iT,cT,uT,aT,lT];return{middleware:R=>{let h=!1,y=i(R.dispatch),b={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:u,mwApi:R},x=c.map(_=>_(b)),I=nT(b),N=dT(b);return _=>P=>{if(!Si(P))return _(P);h||(h=!0,R.dispatch(n.internalActions.middlewareRegistered(a)));let w={...R,next:_},O=R.getState(),[k,T]=I(P,w,O),D;if(k?D=_(P):D=T,R.getState()[t]&&(N(P,w,O),u(P)||o.hasRehydrationInfo(P)))for(let G of x)G(P,w,O);return D}},actions:s};function v(R){return e.api.endpoints[R.endpointName].initiate(R.originalArgs,{subscribe:!1,forceRefetch:!0})}}var uy=Symbol(),fT=({createSelector:e=ze}={})=>({name:uy,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:a,refetchOnMountOrArgChange:s,refetchOnFocus:u,refetchOnReconnect:c,invalidationBehavior:g,onSchemaFailure:v,catchSchemaFailure:R,skipSchemaValidation:h},y){eg();let b=ve=>(typeof process<"u",ve);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:dp,onOffline:hy,onFocus:lp,onFocusLost:gy},util:{}});let x=tT({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:N,buildQuerySelector:_,buildInfiniteQuerySelector:P,buildMutationSelector:w}=x;gr(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:N});let{queryThunk:O,infiniteQueryThunk:k,mutationThunk:T,patchQueryData:D,updateQueryData:G,upsertQueryData:M,prefetch:q,buildMatchThunkActions:B}=JI({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:b,selectors:x,onSchemaFailure:v,catchSchemaFailure:R,skipSchemaValidation:h}),{reducer:j,actions:W}=eT({context:y,queryThunk:O,infiniteQueryThunk:k,mutationThunk:T,serializeQueryArgs:i,reducerPath:o,assertTagType:b,config:{refetchOnFocus:u,refetchOnReconnect:c,refetchOnMountOrArgChange:s,keepUnusedDataFor:a,reducerPath:o,invalidationBehavior:g}});gr(t.util,{patchQueryData:D,updateQueryData:G,upsertQueryData:M,prefetch:q,resetApiState:W.resetApiState,upsertQueryEntries:W.cacheEntriesUpserted}),gr(t.internalActions,W);let Q=new WeakMap,X=ve=>Zs(Q,ve,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:z,buildInitiateInfiniteQuery:Z,buildInitiateMutation:se,getRunningMutationThunk:ye,getRunningMutationsThunk:_e,getRunningQueriesThunk:Ge,getRunningQueryThunk:Fe}=ZI({queryThunk:O,mutationThunk:T,infiniteQueryThunk:k,api:t,serializeQueryArgs:i,context:y,getInternalState:X});gr(t.util,{getRunningMutationThunk:ye,getRunningMutationsThunk:_e,getRunningQueryThunk:Fe,getRunningQueriesThunk:Ge});let{middleware:Me,actions:Le}=pT({reducerPath:o,context:y,queryThunk:O,mutationThunk:T,infiniteQueryThunk:k,api:t,assertTagType:b,selectors:x,getRunningQueryThunk:Fe,getInternalState:X});return gr(t.util,Le),gr(t,{reducer:j,middleware:Me}),{name:uy,injectEndpoint(ve,me){var He;let Se=(He=t.endpoints)[ve]??(He[ve]={});tc(me)&&gr(Se,{name:ve,select:_(ve,me),initiate:z(ve,me)},B(O,ve)),KI(me)&&gr(Se,{name:ve,select:w(),initiate:se(ve)},B(T,ve)),Qi(me)&&gr(Se,{name:ve,select:P(ve,me),initiate:Z(ve,me)},B(O,ve))}}}}),xy=rT(fT());m();d();f();p();m();d();f();p();var yn=e=>e.query,Cy=e=>e.query?.enableQuerySyntax;var n$=ze(e=>yn(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,r,n,o)=>({q:e,requestId:t,cannotAnswer:r,analyticsMode:n,actionCause:o})),mT=ze(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();var rc=e=>{if(e==="yes")return!0;if(e==="no")return!1},gT=()=>De("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function hT(e,t){return De({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??je(n),i=bo(n,e);if(!o||!i)return null;let a=kr(n);return r.makeGeneratedAnswerCitationClick(Uh(i,n),{generativeQuestionAnsweringId:o,citationId:i.id,documentId:Bh(i),...(a&&{conversationId:a})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=bo(r,e);return{answerId:t??je(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function yT(e,t,r){return De({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let i=r??je(o),a=bo(o,e);if(!i||!a)return null;let s=kr(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:i,permanentId:a.permanentid,citationId:a.id,citationHoverTimeMs:t,...(s&&{conversationId:s})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=bo(n,e);return{answerId:r??je(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function vT(e,t){return De({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function ST(e){return De({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=kr(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"like"})})}function bT(e){return De({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=kr(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"dislike"})})}var AT=e=>De({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=je(r);return n?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=je(t),{helpful:n,readable:o,documented:i,hallucinationFree:a,correctTopic:s,documentUrl:u,details:c}=e;return{answerId:r??"",helpful:n,details:{readable:rc(o),documented:rc(i),correctTopic:rc(s),hallucinationFree:rc(a)},additionalNotes:c,correctAnswerUrl:u}}}),fp=(e,t,r)=>De({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let i=t??je(o);if(!i)return null;let a=kr(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:r,...(a&&{conversationId:a})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??je(n)??"",answerGenerated:e??!1})}),_o=e=>De({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),wT=()=>De({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"show"})}),xT=()=>De({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"hide"})}),CT=()=>De({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"expand"})}),ET=()=>De({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"collapse"})});function RT(e){return De({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=kr(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"copyToClipboard"})})}function IT(e,t){return De({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=bo(n,e);if(!o)return null;let i=kr(n);return i?r.makeGeneratedAnswerFollowupOpenSource({...Vh(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:i}):null}})}var nc={logCopyGeneratedAnswer:RT,logGeneratedAnswerHideAnswers:xT,logGeneratedAnswerShowAnswers:wT,logGeneratedAnswerStreamEnd:fp,logGeneratedAnswerFeedback:AT,logDislikeGeneratedAnswer:bT,logLikeGeneratedAnswer:ST,logGeneratedAnswerOpenInlineLink:vT,logHoverCitation:yT,logOpenGeneratedAnswerSource:hT,logOpenGeneratedAnswerFollowUpSource:IT,logRetryGeneratedAnswer:gT,logGeneratedAnswerExpand:CT,logGeneratedAnswerCollapse:ET};m();d();f();p();m();d();f();p();var Ey=ze(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:o}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(o&&{lq:o})}});m();d();f();p();var Ki=(e,t,r)=>({analytics:{clientId:t.clientId,clientTimestamp:new Date().toISOString(),documentReferrer:t.referrer,documentLocation:t.location,originContext:e.originContext,...(r&&{actionCause:r.actionCause}),...(r&&{customData:r.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.deviceId&&{deviceId:e.deviceId}),...(e.trackingId&&{trackingId:e.trackingId}),capture:t.capture??t.clientId!=="",source:mo(e)}});m();d();f();p();var mp=e=>e.context;m();d();f();p();var gp=e=>e.pipeline;m();d();f();p();m();d();f();p();var Yi=jt(oc(),1),Oy=jt(Ry(),1);m();d();f();p();var ic=jt(oc(),1),Ty=jt(Iy(),1);ic.default.extend(Ty.default);var _y="YYYY/MM/DD@HH:mm:ss",TT="1401-01-01";function ko(e,t){let r=(0,ic.default)(e,t);return!r.isValid()&&!t?(0,ic.default)(e,_y):r}function ac(e){return e.format(_y)}function ky(e,t){let r=ko(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}`)}wp(r)}function wp(e){if(e.isBefore(TT))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}Yi.default.extend(Oy.default);var Py=["past","now","next"],Ny=["minute","hour","day","week","month","quarter","year"],_T=e=>{let t=e==="now";return{amount:new ne({required:!t,min:1}),unit:new H({required:!t,constrainTo:Ny}),period:new H({required:!0,constrainTo:Py})}};function xp(e){if(typeof e=="string"&&!Nr(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?qy(e):e;new yt(_T(t.period)).validate(t);let r=Dy(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);wp(r)}function Fy(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function Dy(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Yi.default)().subtract(r,n);case"next":return(0,Yi.default)().add(r,n);case"now":return(0,Yi.default)()}}function Xi(e){return ac(Dy(qy(e)))}function My(e){return e.toLocaleLowerCase().split("-")}function Nr(e){let[t,r,n]=My(e);if(t==="now")return!0;if(!Py.includes(t)||!Ny.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function Ly(e){return!!e&&typeof e=="object"&&"period"in e}function qy(e){let[t,r,n]=My(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function jy(e){return e.type==="dateRange"}function Uy(e){return`start${e}`}function Vy(e){return`end${e}`}var Cp=()=>({dateFacetValueMap:{}});function kT(e,t,r){let n=e.start,o=e.end;return Nr(n)&&(n=Xi(n),r.dateFacetValueMap[t][Uy(n)]=e.start),Nr(o)&&(o=Xi(o),r.dateFacetValueMap[t][Vy(o)]=e.end),{...e,start:n,end:o}}function Ep(e,t){if(jy(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>kT(o,r,t))}}return e}function Fr(e){let t=Cp();return{request:{...e,facets:e.facets?.map(n=>Ep(n,t))},mappings:t}}function OT(e,t,r){return{...e,start:r.dateFacetValueMap[t][Uy(e.start)]||e.start,end:r.dateFacetValueMap[t][Vy(e.end)]||e.end}}function PT(e,t){return e.facetId in t.dateFacetValueMap}function NT(e,t){return PT(e,t)?{...e,values:e.values.map(r=>OT(r,e.facetId,t))}:e}function sc(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>NT(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function Dr(e){return Object.values(e).map(t=>t.request)}function Rp(e,t){let r={};e.forEach(i=>{r[i.facetId]=i});let n=[];t.forEach(i=>{i in r&&(n.push(r[i]),delete r[i])});let o=Object.values(r);return[...n,...o]}function Gy(e){return Dr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Ip={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function FT(e){return Dr(e).map(t=>{let r=Ip[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function DT(e){return[...FT(e.facetSet??{}),...Gy(e.numericFacetSet??{}),...Gy(e.dateFacetSet??{}),...Dr(e.categoryFacetSet??{})]}function MT(e){return DT(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function cc(e){return Rp(MT(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();var Mr=/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??wr(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,...(e.configuration.analytics.enabled&&{actionsHistory:ht.getInstance().getHistory()}),...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&(yield Qs(e.configuration.analytics,t))),...(e.excerptLength&&!ce(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function Mr(_x67,_x68){return _ref29.apply(this,arguments)}}();m();d();f();p();var Oo=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??wr(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:t.referrer,timezone:e.configuration.search.timezone,...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&Ki(e.configuration.analytics,t,r)),...(e.excerptLength&&!ce(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});m();d();f();p();var By=ze(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o}));var Lr=/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t,r){let n=_p(e),o=LT(e),i=qT(e),a=e.configuration.analytics.analyticsMode==="legacy"?yield Mr(e,r):Oo(e,t,r);return Fr({...a,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(n&&{cq:n}),...(o.length&&{facets:o}),...(e.pagination&&{numberOfResults:Tp(e),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:i}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Lr(_x69,_x70,_x71){return _ref30.apply(this,arguments)}}();function Tp(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function LT(e){return Rp(UT(e),e.facetOrder??[])}function qT(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(jT).filter(r=>r.currentValues.length>0):void 0}function jT(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function UT(e){return VT(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function VT(e){return[...GT(e.facetSet??{}),...$y(e.numericFacetSet??{}),...$y(e.dateFacetSet??{}),...Dr(e.categoryFacetSet??{})]}function GT(e){return Dr(e).map(t=>{let r=Ip[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function $y(e){return Dr(e).map(t=>{let r=t.currentValues,n=r.some(({state:i})=>i!=="idle"),o=r.some(i=>i.previousState);return t.generateAutomaticRanges&&!n&&!o?{...t,currentValues:[]}:t})}function _p(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=By(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();f();p();m();d();f();p();var Zi=(e,t)=>{let r=e;return ce(r[t])?ce(e.raw[t])?null:e.raw[t]:r[t]},BT=e=>t=>e.every(r=>!ce(Zi(t,r))),$T=e=>t=>e.every(r=>ce(Zi(t,r))),QT=(e,t)=>r=>{let n=Qy(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},HT=(e,t)=>r=>{let n=Qy(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},Qy=(e,t)=>{let r=Zi(t,e);return ym(r)?r:[r]},Hy={getResultProperty:Zi,fieldsMustBeDefined:BT,fieldsMustNotBeDefined:$T,fieldMustMatch:QT,fieldMustNotMatch:HT};var kp=ze(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var Op=e=>e.searchHub;m();d();f();p();var uc=ze(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),qH=ze(e=>e,e=>{let t=uc(e);return t&&e?e[t].expression:""});m();d();f();p();var zy=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var Wy=e=>e.excerptLength?.length;m();d();f();p();var Ky=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var Yy=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};m();d();f();p();var Xy=e=>e.sortCriteria;var Zy=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Jn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function Zy(_x72){return _ref31.apply(this,arguments)}}(),Jy=(e,t)=>{let r=yn(e)?.q,{aq:n,cq:o,dq:i,lq:a}=rv(e),s=mp(e),u=Ki(e.configuration.analytics,t,{actionCause:kp(e)}),c=Op(e),g=gp(e),v=Gd(e)??[],R=tv(e),h=uc(e.tabSet)||"default",y=Ud(e),b=mh(e),x=t.referrer||"",I=Ky(e),N=Xy(e),_=zT(e),P=Wy(e),w=Yy(e),O=zy(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(a&&{lq:a}),...(e.query&&{enableQuerySyntax:Cy(e)}),...(s?.contextValues&&{context:s.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(c?.length&&{searchHub:c}),...(g?.length&&{pipeline:g}),...(R.length&&{facets:R}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(e.pagination&&{numberOfResults:Tp(e),firstResult:e.pagination.firstResult}),tab:h,locale:y,timezone:b,...(e.debug!==void 0&&{debug:e.debug}),referrer:x,..._,...(w??{}),...(P&&{excerptLength:P}),...(O&&{dictionaryFieldContext:O}),sortCriteria:N,...(I&&{facetOptions:I}),...u,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},ev=(e,t)=>{let r=yn(e)?.q,n=tv(e),o=Ki(e.configuration.analytics,t,{actionCause:kp(e)}),i=Ud(e),a=uc(e.tabSet)||"default",s=t.referrer,{aq:u,cq:c}=rv(e),g=Op(e),v=gp(e),R=mp(e),h=Gd(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(v?.length&&{pipeline:v}),...(R?.contextValues&&{context:R.contextValues}),...(u&&{aq:u}),...(c&&{cq:c}),tab:a,referrer:s,...o,locale:i}},tv=e=>cc(e)?.map(t=>Ep(t,Cp())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),zT=e=>({actionsHistory:e.configuration.analytics.enabled?ht.getInstance().getHistory():[]}),rv=e=>{let t=Ey(e),r=_p(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var lc=["searching","thinking","answering"];function dc(e){return e.toLowerCase()}var pc=["search","generic"];m();d();f();p();var nv=["text/plain","text/markdown"];var Po=new H({required:!0}),ov=new H,No=new fe({required:!0}),Pp={id:Po,title:Po,uri:Po,permanentid:Po,clickUri:ov},fc=new H({required:!0,constrainTo:nv}),iv=new H({required:!0,constrainTo:lc}),av=e=>({...e,name:dc(e.name)}),oz=L("generatedAnswer/setIsVisible",e=>V(e,No)),mc=L("generatedAnswer/setAnswerId",e=>V(e,Y)),iz=L("generatedAnswer/setAnswerGenerationMode",e=>V(e,new H({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),az=L("generatedAnswer/setIsEnabled",e=>V(e,No)),ea=L("generatedAnswer/updateMessage",e=>V(e,{textDelta:Po})),ta=L("generatedAnswer/updateCitations",e=>V(e,{citations:new Ae({required:!0,each:new re({values:Pp})})})),ra=L("generatedAnswer/updateError",e=>V(e,{message:ov,code:new ne({min:0})})),gc=L("generatedAnswer/resetAnswer"),sz=L("generatedAnswer/like"),cz=L("generatedAnswer/dislike"),uz=L("generatedAnswer/feedbackModal/open"),lz=L("generatedAnswer/expand"),dz=L("generatedAnswer/collapse"),pz=L("generatedAnswer/setId",e=>V(e,{id:new H({required:!0})})),fz=L("generatedAnswer/feedbackModal/close"),mz=L("generatedAnswer/sendFeedback"),qr=L("generatedAnswer/setIsLoading",e=>V(e,No)),Ji=L("generatedAnswer/setIsStreaming",e=>V(e,No)),na=L("generatedAnswer/setAnswerContentFormat",e=>V(e,fc)),gz=L("generatedAnswer/updateResponseFormat",e=>V(e,{contentFormat:new Ae({each:fc,default:["text/plain"]})})),hz=L("knowledge/updateAnswerConfigurationId",e=>V(e,Po)),yz=L("generatedAnswer/registerFieldsToIncludeInCitations",e=>V(e,ps)),Np=L("generatedAnswer/setIsAnswerGenerated",e=>V(e,No)),oa=L("generatedAnswer/setCannotAnswer",e=>V(e,No)),WT=L("generatedAnswer/setAnswerApiQueryParams",e=>V(e,new re({}))),sv=L("generatedAnswer/startStep",e=>V(av(e),{name:iv,startedAt:new ne({min:0,required:!0})})),cv=L("generatedAnswer/finishStep",e=>V(av(e),{name:iv,finishedAt:new ne({min:0,required:!0})})),uv=L("generatedAnswer/startToolCall",e=>V(e,{toolCallName:Y,startedAt:new ne({min:0,required:!0}),toolCallId:Y})),lv=L("generatedAnswer/finishToolCall",e=>V(e,{finishedAt:new ne({min:0,required:!0}),toolCallId:Y})),hc=L("generatedAnswer/toolCallArgs",e=>V(e,{toolCallId:Y,args:new re({options:{required:!0}}),type:new H({required:!0,constrainTo:pc})})),vz=ke("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:i}=t,{generatedAnswerAnalyticsClient:a}=o,{search:s}=i(),{queryExecuted:u}=s,{setAbortControllerRef:c}=e,g=yield Zy(r),v=(y,b)=>{switch(y){case"genqa.headerMessageType":{let x=JSON.parse(b);n(na(x.contentFormat));break}case"genqa.messageType":n(ea(JSON.parse(b)));break;case"genqa.citationsType":n(ta(JSON.parse(b)));break;case"genqa.endOfStreamType":{let x=JSON.parse(b).answerGenerated,{answerId:I,answer:N}=i().generatedAnswer,P=u.length!==0&&!x,w=!N?.trim();n(oa(P)),n(Ji(!1)),n(Np(x)),n((a??nc).logGeneratedAnswerStreamEnd(x,I,x?w:void 0)),n(_o());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${y}"`)}};n(qr(!0));let R=y=>y.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:y=>{R(g)&&(n(qr(!1)),y.payload&&y.payloadType&&v(y.payloadType,y.payload))},abort:y=>{R(g)&&n(ra(y))},close:()=>{R(g)&&n(Ji(!1))},resetAnswer:()=>{R(g)&&n(gc())}});h?c(h):n(qr(!1))});return function(_x73,_x74){return _ref32.apply(this,arguments)}}()),Sz=ke("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(gc());let i=t();if(i.generatedAnswer.isEnabled===!1){o.warn("[WARNING] The generateAnswer action was dispatched while the generated answer is disabled. No answer will be generated. Enable the generated answer before dispatching generateAnswer.");return}if(i.generatedAnswer.answerConfigurationId){let a=Jy(i,n);r(WT(a)),yield r(dv(a))}else o.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.")});return function(_x75,_x76){return _ref33.apply(this,arguments)}}());m();d();f();p();m();d();f();p();function fv(_x77,_x78){return _fv.apply(this,arguments)}function _fv(){_fv=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _fv.apply(this,arguments)}function mv(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=YT(t,a);let s=t.length,u=0;for(;r<s;){o&&(t[r]===10&&(u=++r),o=!1);let c=-1;for(;r<s&&c===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-u);break;case 13:o=!0,c=r;break;case 10:c=r;break}if(c===-1)break;e(t.subarray(u,c),n),u=r,n=-1}u===s?t=void 0:u!==0&&(t=t.subarray(u),r-=u)}}function gv(e,t,r){let n=pv(),o=new TextDecoder;return function(a,s){if(a.length===0)r?.(n),n=pv();else if(s>0){let u=o.decode(a.subarray(0,s)),c=s+(a[s+1]===32?2:1),g=o.decode(a.subarray(c));switch(u){case"data":n.data=n.data?`${n.data}
|
|
32
|
-
${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":KT(g,n,t);break}}}}function KT(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function YT(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function pv(){return{data:"",event:"",id:"",retry:void 0}}var Fp="text/event-stream",XT=1e3,hv="last-event-id";function yv(){return typeof window<"u"}function vv(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:a,openWhenHidden:s,fetch:u,...c}){return new Promise((g,v)=>{let R={...r};R.accept||(R.accept=Fp);let h;function y(){h?.abort(),document.hidden||P()}!s&&yv()&&document.addEventListener("visibilitychange",y);let b=XT,x;function I(){yv()&&document.removeEventListener("visibilitychange",y),clearTimeout(x),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let N=u??C,_=n??ZT;function P(){return _P2.apply(this,arguments)}function _P2(){_P2=_asyncToGenerator(function*(){h=l.AbortController?new l.AbortController:null;try{let w=yield N(e,{...c,headers:R,signal:h?.signal});yield _(w),yield fv(w.body,mv(gv(O=>{O?R[hv]=O:delete R[hv]},O=>{b=O},o))),i?.(),I(),g()}catch(w){if(!h?.signal?.aborted)try{let O=a?.(w)??b;clearTimeout(x),x=setTimeout(P,O)}catch(O){I(),v(O)}}});return _P2.apply(this,arguments)}P()})}function ZT(e){let t=e.headers.get("content-type");if(!t?.startsWith(Fp))throw new Error(`Expected content-type to be ${Fp}, Actual: ${t}`)}m();d();f();p();var JT=/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:i,organizationId:a}=n.configuration,s=n.generatedAnswer.answerConfigurationId,u={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let c=Jn(n.configuration.search?.apiBaseUrl,a,i);return dy({baseUrl:`${c}/rest/organizations/${a}/answer/v1/configs/${s}`,fetchFn:function(){var _ref35=_asyncToGenerator(function*(g){if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let v=g.url,R={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{R[h]=g[h]}),R.duplex="half",R.body=yield g.text(),C(v,R)});return function fetchFn(_x82){return _ref35.apply(this,arguments)}}()})(u,{...t,signal:null},r)}catch(c){return{error:c}}});return function JT(_x79,_x80,_x81){return _ref34.apply(this,arguments)}}(),Sv=xy({reducerPath:"answer",baseQuery:fy(JT,{maxRetries:3}),endpoints:()=>({})});var e0=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},t0=(e,t)=>{let{textDelta:r}=t;if(typeof r!="string")return;let n=e.answer;!n?.trim()&&!r.trim()||(delete e.error,e.answer=n?.trim()?n.concat(r):r)},r0=(e,t)=>{delete e.error,e.citations=t.citations},n0=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},o0=(e,t)=>{let r=t.errorMessage||"Unknown error occurred";e.error={message:r,code:t.code},e.isStreaming=!1,e.isLoading=!1,console.error(`Generated answer error: ${r} (code: ${t.code})`)},i0=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&o0(t,o);let i=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":i.contentFormat&&(e0(t,i),r(na(i.contentFormat)));break;case"genqa.messageType":typeof i.textDelta=="string"&&(t0(t,i),r(ea({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(r0(t,i),r(ta({citations:i.citations})));break;case"genqa.endOfStreamType":{n0(t,i);let a=t.answerId,s=i.answerGenerated??!1,u=s?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(s,a,u)),r(_o());break}}},a0=(e,t,r,n)=>{if(!e||!t||!r)throw new Error("Missing required parameters for answer endpoint");let o=`/rest/organizations/${t}`,i=n?`insight/v1/configs/${n}/answer`:"answer/v1/configs";return`${e}${o}/${i}/${r}/generate`},Dp=Sv.injectEndpoints({overrideExisting:!0,endpoints:e=>({getAnswer:e.query({queryFn:()=>({data:{contentFormat:void 0,answer:void 0,citations:void 0,error:void 0,generated:!1,isStreaming:!0,isLoading:!0}}),serializeQueryArgs:({endpointName:t,queryArgs:r})=>{let{analytics:n,...o}=r;return`${t}(${JSON.stringify(o)})`},onCacheEntryAdded(_x83,_x84){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:i,extra:a}){yield n;let{configuration:s,generatedAnswer:u,insightConfiguration:c}=r(),{generatedAnswerAnalyticsClient:g}=a,{organizationId:v,environment:R,accessToken:h}=s,y=Jn(s.search.apiBaseUrl,v,R),b=a0(y,v,u.answerConfigurationId,c?.insightId);yield vv(b,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${h}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},openWhenHidden:!0,fetch:C,onopen:function(){var _ref36=_asyncToGenerator(function*(x){let I=x.headers.get("x-answer-id");I&&o(N=>{N.answerId=I,i(mc(I))})});return function onopen(_x85){return _ref36.apply(this,arguments)}}(),onmessage:x=>{o(I=>{i0(x,I,i,g??nc)})},onerror:x=>{throw x},onclose:()=>{o(x=>{i(oa(!x.generated))})}})}).apply(this,arguments)}})})}),dv=e=>Dp.endpoints.getAnswer.initiate(e);m();d();f();p();var bv=Be(so,e=>e);m();d();f();p();function s0(e){let t=e.payload?.analyticsAction;return Av(e)&&!ce(t)}function Av(e){return"type"in e}var wv=e=>t=>r=>{let n;s0(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return Av(r)&&(r.type==="search/executeSearch/fullfilled"&&n===void 0&&console.error("No analytics action associated with search:",r),r.type==="recommendation/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with recommendation:",r),r.type==="productRecommendations/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with product recommendation:",r)),n!==void 0&&e.dispatch(n),o};m();d();f();p();m();d();f();p();m();d();f();p();var hW=L("tab/register",e=>{let t=new re({values:{id:Y,expression:nt}});return V(e,t)}),yc=L("tab/updateActiveTab",e=>V(e,Y));m();d();f();p();var vc=jt(oc(),1),Ev=jt(xv(),1),Rv=jt(Cv(),1);vc.default.extend(Rv.default);vc.default.extend(Ev.default);var Iv=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:vc.default.tz.guess(),authenticationProviders:[]},analytics:{enabled:!0,originContext:"Search",originLevel2:"default",originLevel3:"default",anonymous:!1,deviceId:"",userDisplayName:"",documentLocation:"",analyticsMode:"next",source:{}},knowledge:{answerConfigurationId:"",agentId:void 0},environment:"prod"});m();d();f();p();var c0=/(^|; )Coveo-Pendragon=([^;]*)/,u0=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function Tv(){return typeof window>"u"?!1:c0.exec(document.cookie)?.pop()||null}function _v(){return typeof window>"u"?!1:u0.test(document.cookie)}var kv=Be(Iv(),e=>e.addCase(Rr,(t,r)=>{l0(t,r.payload)}).addCase(Kt,(t,r)=>{d0(t,r.payload)}).addCase(co,(t,r)=>{p0(t,r.payload)}).addCase(uo,t=>{t.analytics.enabled=!1}).addCase(lo,t=>{t.analytics.enabled=!0}).addCase(fs,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(ms,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(yc,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(qg,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Ir,(t,r)=>{ce(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Mg,(t,{payload:r})=>{f0(t,r)}));function l0(e,t){ce(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ce(t.organizationId)||(e.organizationId=t.organizationId)}function d0(e,t){ce(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),ce(t.locale)||(e.search.locale=t.locale),ce(t.timezone)||(e.search.timezone=t.timezone),ce(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function p0(e,t){ce(t.enabled)||(e.analytics.enabled=t.enabled),ce(t.originContext)||(e.analytics.originContext=t.originContext),ce(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),ce(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),ce(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),ce(t.trackingId)||(e.analytics.trackingId=t.trackingId),ce(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),ce(t.source)||(e.analytics.source=t.source);try{let r=Tv();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}ce(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),ce(t.anonymous)||(e.analytics.anonymous=t.anonymous),ce(t.deviceId)||(e.analytics.deviceId=t.deviceId),ce(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),ce(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function f0(e,t){e.knowledge.agentId=t;try{_v()&&(e.knowledge.debugAgentSession=!0)}catch{}}var Vt=kv;m();d();f();p();function m0(e){return e.instantlyCallable}var Ov=()=>e=>t=>e(m0(t)?t():t);m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var at=[];for(let e=0;e<256;++e)at.push((e+256).toString(16).slice(1));function Pv(e,t=0){return(at[e[t+0]]+at[e[t+1]]+at[e[t+2]]+at[e[t+3]]+"-"+at[e[t+4]]+at[e[t+5]]+"-"+at[e[t+6]]+at[e[t+7]]+"-"+at[e[t+8]]+at[e[t+9]]+"-"+at[e[t+10]]+at[e[t+11]]+at[e[t+12]]+at[e[t+13]]+at[e[t+14]]+at[e[t+15]]).toLowerCase()}m();d();f();p();var Up,g0=new Uint8Array(16);function Vp(){if(!Up){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Up=crypto.getRandomValues.bind(crypto)}return Up(g0)}m();d();f();p();m();d();f();p();var h0=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Gp={randomUUID:h0};function y0(e,t,r){if(Gp.randomUUID&&!t&&!e)return Gp.randomUUID();e=e||{};let n=e.random??e.rng?.()??Vp();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 Pv(n)}var jr=y0;m();d();f();p();m();d();f();p();var S={};ui(S,{BRAND:()=>B0,DIRTY:()=>Sn,EMPTY_PATH:()=>A0,INVALID:()=>de,NEVER:()=>I_,OK:()=>ft,ParseStatus:()=>st,Schema:()=>xe,ZodAny:()=>Gr,ZodArray:()=>Sr,ZodBigInt:()=>An,ZodBoolean:()=>wn,ZodBranded:()=>aa,ZodCatch:()=>Nn,ZodDate:()=>xn,ZodDefault:()=>Pn,ZodDiscriminatedUnion:()=>Ac,ZodEffects:()=>Mt,ZodEnum:()=>kn,ZodError:()=>bt,ZodFirstPartyTypeKind:()=>pe,ZodFunction:()=>xc,ZodIntersection:()=>In,ZodIssueCode:()=>K,ZodLazy:()=>Tn,ZodLiteral:()=>_n,ZodMap:()=>jo,ZodNaN:()=>Vo,ZodNativeEnum:()=>On,ZodNever:()=>Gt,ZodNull:()=>En,ZodNullable:()=>er,ZodNumber:()=>bn,ZodObject:()=>At,ZodOptional:()=>Ft,ZodParsedType:()=>te,ZodPipeline:()=>sa,ZodPromise:()=>Br,ZodReadonly:()=>Fn,ZodRecord:()=>wc,ZodSchema:()=>xe,ZodSet:()=>Uo,ZodString:()=>Vr,ZodSymbol:()=>Lo,ZodTransformer:()=>Mt,ZodTuple:()=>Jt,ZodType:()=>xe,ZodUndefined:()=>Cn,ZodUnion:()=>Rn,ZodUnknown:()=>vr,ZodVoid:()=>qo,addIssueToContext:()=>ee,any:()=>Z0,array:()=>r_,bigint:()=>z0,boolean:()=>Bv,coerce:()=>R_,custom:()=>Uv,date:()=>W0,datetimeRegex:()=>qv,defaultErrorMap:()=>hr,discriminatedUnion:()=>a_,effect:()=>v_,enum:()=>g_,function:()=>p_,getErrorMap:()=>Fo,getParsedType:()=>Zt,instanceof:()=>Q0,intersection:()=>s_,isAborted:()=>Sc,isAsync:()=>Do,isDirty:()=>bc,isValid:()=>Ur,late:()=>$0,lazy:()=>f_,literal:()=>m_,makeIssue:()=>ia,map:()=>l_,nan:()=>H0,nativeEnum:()=>h_,never:()=>e_,null:()=>X0,nullable:()=>b_,number:()=>Gv,object:()=>n_,objectUtil:()=>Bp,oboolean:()=>E_,onumber:()=>C_,optional:()=>S_,ostring:()=>x_,pipeline:()=>w_,preprocess:()=>A_,promise:()=>y_,quotelessJson:()=>v0,record:()=>u_,set:()=>d_,setErrorMap:()=>b0,strictObject:()=>o_,string:()=>Vv,symbol:()=>K0,transformer:()=>v_,tuple:()=>c_,undefined:()=>Y0,union:()=>i_,unknown:()=>J0,util:()=>Re,void:()=>t_});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Re;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Re||(Re={}));var Bp;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Bp||(Bp={}));var te=Re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zt=e=>{switch(typeof e){case"undefined":return te.undefined;case"string":return te.string;case"number":return Number.isNaN(e)?te.nan:te.number;case"boolean":return te.boolean;case"function":return te.function;case"bigint":return te.bigint;case"symbol":return te.symbol;case"object":return Array.isArray(e)?te.array:e===null?te.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?te.promise:typeof Map<"u"&&e instanceof Map?te.map:typeof Set<"u"&&e instanceof Set?te.set:typeof Date<"u"&&e instanceof Date?te.date:te.object;default:return te.unknown}};var K=Re.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),v0=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),bt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,u=0;for(;u<a.path.length;){let c=a.path[u];u===a.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(r(a))):s[c]=s[c]||{_errors:[]},s=s[c],u++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};bt.create=e=>new bt(e);var S0=(e,t)=>{let r;switch(e.code){case K.invalid_type:e.received===te.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case K.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Re.jsonStringifyReplacer)}`;break;case K.unrecognized_keys:r=`Unrecognized key(s) in object: ${Re.joinValues(e.keys,", ")}`;break;case K.invalid_union:r="Invalid input";break;case K.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Re.joinValues(e.options)}`;break;case K.invalid_enum_value:r=`Invalid enum value. Expected ${Re.joinValues(e.options)}, received '${e.received}'`;break;case K.invalid_arguments:r="Invalid function arguments";break;case K.invalid_return_type:r="Invalid function return type";break;case K.invalid_date:r="Invalid date";break;case K.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Re.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case K.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case K.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case K.custom:r="Invalid input";break;case K.invalid_intersection_types:r="Intersection results could not be merged";break;case K.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case K.not_finite:r="Number must be finite";break;default:r=t.defaultError,Re.assertNever(e)}return{message:r}},hr=S0;var Nv=hr;function b0(e){Nv=e}function Fo(){return Nv}m();d();f();p();var ia=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...(o.path||[])],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",u=n.filter(c=>!!c).slice().reverse();for(let c of u)s=c(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}},A0=[];function ee(e,t){let r=Fo(),n=ia({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===hr?void 0:hr].filter(o=>!!o)});e.common.issues.push(n)}var st=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return de;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let o of r){let i=yield o.key,a=yield o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return de;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},de=Object.freeze({status:"aborted"}),Sn=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),Sc=e=>e.status==="aborted",bc=e=>e.status==="dirty",Ur=e=>e.status==="valid",Do=e=>typeof Promise<"u"&&e instanceof Promise;m();d();f();p();m();d();f();p();var ie;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ie||(ie={}));var Dt=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Fv=(e,t)=>{if(Ur(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new bt(e.common.issues);return this._error=r,this._error}}};function be(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:u}=e;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:u??r??s.defaultError}},description:o}}var xe=class{get description(){return this._def.description}_getType(t){return Zt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Zt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new st,ctx:{common:t.parent.common,data:t.data,parsedType:Zt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Do(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Fv(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Ur(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Ur(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this10=this;return _asyncToGenerator(function*(){let n=yield _this10.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this11=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this11._def.errorMap,parent:null,data:t,parsedType:Zt(t)},o=_this11._parse({data:t,path:n.path,parent:n}),i=yield Do(o)?o:Promise.resolve(o);return Fv(n,i)})()}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:K.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new Mt({schema:this,typeName:pe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Ft.create(this,this._def)}nullable(){return er.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Sr.create(this)}promise(){return Br.create(this,this._def)}or(t){return Rn.create([this,t],this._def)}and(t){return In.create(this,t,this._def)}transform(t){return new Mt({...be(this._def),schema:this,typeName:pe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Pn({...be(this._def),innerType:this,defaultValue:r,typeName:pe.ZodDefault})}brand(){return new aa({typeName:pe.ZodBranded,type:this,...be(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Nn({...be(this._def),innerType:this,catchValue:r,typeName:pe.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return sa.create(this,t)}readonly(){return Fn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},w0=/^c[^\s-]{8,}$/i,x0=/^[0-9a-z]+$/,C0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,E0=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,R0=/^[a-z0-9_-]{21}$/i,I0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,T0=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,_0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,k0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",$p,O0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,P0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,N0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,F0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,D0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,M0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Mv="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",L0=new RegExp(`^${Mv}$`);function Lv(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function q0(e){return new RegExp(`^${Lv(e)}$`)}function qv(e){let t=`${Mv}T${Lv(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function j0(e,t){return!!((t==="v4"||!t)&&O0.test(e)||(t==="v6"||!t)&&N0.test(e))}function U0(e,t){if(!I0.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function V0(e,t){return!!((t==="v4"||!t)&&P0.test(e)||(t==="v6"||!t)&&F0.test(e))}var Vr=class e extends xe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==te.string){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:te.string,received:i.parsedType}),de}let n=new st,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?ee(o,{code:K.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&ee(o,{code:K.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")_0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"email",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")$p||($p=new RegExp(k0,"u")),$p.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"emoji",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")E0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"uuid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")R0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"nanoid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")w0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cuid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")x0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cuid2",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")C0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"ulid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ee(o,{validation:"url",code:K.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"regex",code:K.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?qv(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?L0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?q0(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?T0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"duration",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?j0(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"ip",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?U0(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"jwt",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?V0(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cidr",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?D0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"base64",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?M0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"base64url",code:K.invalid_string,message:i.message}),n.dirty()):Re.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:K.invalid_string,...ie.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ie.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ie.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ie.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ie.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ie.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ie.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ie.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ie.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ie.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ie.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ie.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ie.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ie.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...ie.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...ie.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ie.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ie.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ie.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ie.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ie.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ie.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ie.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ie.errToObj(r)})}nonempty(t){return this.min(1,ie.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Vr.create=e=>new Vr({checks:[],typeName:pe.ZodString,coerce:e?.coerce??!1,...be(e)});function G0(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var bn=class e extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==te.number){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:te.number,received:i.parsedType}),de}let n,o=new st;for(let i of this._def.checks)i.kind==="int"?Re.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{code:K.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?G0(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{code:K.not_finite,message:i.message}),o.dirty()):Re.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ie.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ie.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ie.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ie.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ie.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ie.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ie.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ie.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ie.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ie.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ie.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ie.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ie.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ie.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Re.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};bn.create=e=>new bn({checks:[],typeName:pe.ZodNumber,coerce:e?.coerce||!1,...be(e)});var An=class e extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==te.bigint)return this._getInvalidInput(t);let n,o=new st;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Re.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return ee(r,{code:K.invalid_type,expected:te.bigint,received:r.parsedType}),de}gte(t,r){return this.setLimit("min",t,!0,ie.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ie.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ie.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ie.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ie.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ie.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ie.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ie.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ie.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ie.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};An.create=e=>new An({checks:[],typeName:pe.ZodBigInt,coerce:e?.coerce??!1,...be(e)});var wn=class extends xe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==te.boolean){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.boolean,received:n.parsedType}),de}return ft(t.data)}};wn.create=e=>new wn({typeName:pe.ZodBoolean,coerce:e?.coerce||!1,...be(e)});var xn=class e extends xe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==te.date){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:te.date,received:i.parsedType}),de}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_date}),de}let n=new st,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Re.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:ie.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ie.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};xn.create=e=>new xn({checks:[],coerce:e?.coerce||!1,typeName:pe.ZodDate,...be(e)});var Lo=class extends xe{_parse(t){if(this._getType(t)!==te.symbol){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.symbol,received:n.parsedType}),de}return ft(t.data)}};Lo.create=e=>new Lo({typeName:pe.ZodSymbol,...be(e)});var Cn=class extends xe{_parse(t){if(this._getType(t)!==te.undefined){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.undefined,received:n.parsedType}),de}return ft(t.data)}};Cn.create=e=>new Cn({typeName:pe.ZodUndefined,...be(e)});var En=class extends xe{_parse(t){if(this._getType(t)!==te.null){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.null,received:n.parsedType}),de}return ft(t.data)}};En.create=e=>new En({typeName:pe.ZodNull,...be(e)});var Gr=class extends xe{constructor(){super(...arguments),this._any=!0}_parse(t){return ft(t.data)}};Gr.create=e=>new Gr({typeName:pe.ZodAny,...be(e)});var vr=class extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ft(t.data)}};vr.create=e=>new vr({typeName:pe.ZodUnknown,...be(e)});var Gt=class extends xe{_parse(t){let r=this._getOrReturnCtx(t);return ee(r,{code:K.invalid_type,expected:te.never,received:r.parsedType}),de}};Gt.create=e=>new Gt({typeName:pe.ZodNever,...be(e)});var qo=class extends xe{_parse(t){if(this._getType(t)!==te.undefined){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.void,received:n.parsedType}),de}return ft(t.data)}};qo.create=e=>new qo({typeName:pe.ZodVoid,...be(e)});var Sr=class e extends xe{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==te.array)return ee(r,{code:K.invalid_type,expected:te.array,received:r.parsedType}),de;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(ee(r,{code:a?K.too_big:K.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(ee(r,{code:K.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(ee(r,{code:K.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new Dt(r,a,r.path,s)))).then(a=>st.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Dt(r,a,r.path,s)));return st.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:ie.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ie.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ie.toString(r)}})}nonempty(t){return this.min(1,t)}};Sr.create=(e,t)=>new Sr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:pe.ZodArray,...be(t)});function Mo(e){if(e instanceof At){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Ft.create(Mo(n))}return new At({...e._def,shape:()=>t})}else return e instanceof Sr?new Sr({...e._def,type:Mo(e.element)}):e instanceof Ft?Ft.create(Mo(e.unwrap())):e instanceof er?er.create(Mo(e.unwrap())):e instanceof Jt?Jt.create(e.items.map(t=>Mo(t))):e}var At=class e extends xe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Re.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==te.object){let c=this._getOrReturnCtx(t);return ee(c,{code:K.invalid_type,expected:te.object,received:c.parsedType}),de}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Gt&&this._def.unknownKeys==="strip"))for(let c in o.data)a.includes(c)||s.push(c);let u=[];for(let c of a){let g=i[c],v=o.data[c];u.push({key:{status:"valid",value:c},value:g._parse(new Dt(o,v,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Gt){let c=this._def.unknownKeys;if(c==="passthrough")for(let g of s)u.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(c==="strict")s.length>0&&(ee(o,{code:K.unrecognized_keys,keys:s}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let g of s){let v=o.data[g];u.push({key:{status:"valid",value:g},value:c._parse(new Dt(o,v,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let c=[];for(let g of u){let v=yield g.key,R=yield g.value;c.push({key:v,value:R,alwaysSet:g.alwaysSet})}return c})).then(c=>st.mergeObjectSync(n,c)):st.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(t){return ie.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ie.errToObj(t).message??o}:{message:o}}}:{})})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:pe.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Re.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Re.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Mo(this)}partial(t){let r={};for(let n of Re.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Re.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Ft;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return jv(Re.objectKeys(this.shape))}};At.create=(e,t)=>new At({shape:()=>e,unknownKeys:"strip",catchall:Gt.create(),typeName:pe.ZodObject,...be(t)});At.strictCreate=(e,t)=>new At({shape:()=>e,unknownKeys:"strict",catchall:Gt.create(),typeName:pe.ZodObject,...be(t)});At.lazycreate=(e,t)=>new At({shape:e,unknownKeys:"strip",catchall:Gt.create(),typeName:pe.ZodObject,...be(t)});var Rn=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new bt(s.ctx.common.issues));return ee(r,{code:K.invalid_union,unionErrors:a}),de}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(i){let a={...r,common:{...r.common,issues:[]},parent:null};return{result:yield i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}});return function(_x86){return _ref38.apply(this,arguments)}}())).then(o);{let i,a=[];for(let u of n){let c={...r,common:{...r.common,issues:[]},parent:null},g=u._parseSync({data:r.data,path:r.path,parent:c});if(g.status==="valid")return g;g.status==="dirty"&&!i&&(i={result:g,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(u=>new bt(u));return ee(r,{code:K.invalid_union,unionErrors:s}),de}}get options(){return this._def.options}};Rn.create=(e,t)=>new Rn({options:e,typeName:pe.ZodUnion,...be(t)});var yr=e=>e instanceof Tn?yr(e.schema):e instanceof Mt?yr(e.innerType()):e instanceof _n?[e.value]:e instanceof kn?e.options:e instanceof On?Re.objectValues(e.enum):e instanceof Pn?yr(e._def.innerType):e instanceof Cn?[void 0]:e instanceof En?[null]:e instanceof Ft?[void 0,...yr(e.unwrap())]:e instanceof er?[null,...yr(e.unwrap())]:e instanceof aa||e instanceof Fn?yr(e.unwrap()):e instanceof Nn?yr(e._def.innerType):[],Ac=class e extends xe{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.object)return ee(r,{code:K.invalid_type,expected:te.object,received:r.parsedType}),de;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(ee(r,{code:K.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),de)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=yr(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:pe.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...be(n)})}};function Qp(e,t){let r=Zt(e),n=Zt(t);if(e===t)return{valid:!0,data:e};if(r===te.object&&n===te.object){let o=Re.objectKeys(t),i=Re.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let u=Qp(e[s],t[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===te.array&&n===te.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],u=Qp(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===te.date&&n===te.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var In=class extends xe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(Sc(i)||Sc(a))return de;let s=Qp(i.value,a.value);return s.valid?((bc(i)||bc(a))&&r.dirty(),{status:r.value,value:s.data}):(ee(n,{code:K.invalid_intersection_types}),de)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};In.create=(e,t,r)=>new In({left:e,right:t,typeName:pe.ZodIntersection,...be(r)});var Jt=class e extends xe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.array)return ee(n,{code:K.invalid_type,expected:te.array,received:n.parsedType}),de;if(n.data.length<this._def.items.length)return ee(n,{code:K.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),de;!this._def.rest&&n.data.length>this._def.items.length&&(ee(n,{code:K.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let u=this._def.items[s]||this._def.rest;return u?u._parse(new Dt(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>st.mergeArray(r,a)):st.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Jt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Jt({items:e,typeName:pe.ZodTuple,rest:null,...be(t)})};var wc=class e extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.object)return ee(n,{code:K.invalid_type,expected:te.object,received:n.parsedType}),de;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Dt(n,s,n.path,s)),value:a._parse(new Dt(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?st.mergeObjectAsync(r,o):st.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof xe?new e({keyType:t,valueType:r,typeName:pe.ZodRecord,...be(n)}):new e({keyType:Vr.create(),valueType:t,typeName:pe.ZodRecord,...be(r)})}},jo=class extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.map)return ee(n,{code:K.invalid_type,expected:te.map,received:n.parsedType}),de;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],c)=>({key:o._parse(new Dt(n,s,n.path,[c,"key"])),value:i._parse(new Dt(n,u,n.path,[c,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let u of a){let c=yield u.key,g=yield u.value;if(c.status==="aborted"||g.status==="aborted")return de;(c.status==="dirty"||g.status==="dirty")&&r.dirty(),s.set(c.value,g.value)}return{status:r.value,value:s}}))}else{let s=new Map;for(let u of a){let c=u.key,g=u.value;if(c.status==="aborted"||g.status==="aborted")return de;(c.status==="dirty"||g.status==="dirty")&&r.dirty(),s.set(c.value,g.value)}return{status:r.value,value:s}}}};jo.create=(e,t,r)=>new jo({valueType:t,keyType:e,typeName:pe.ZodMap,...be(r)});var Uo=class e extends xe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.set)return ee(n,{code:K.invalid_type,expected:te.set,received:n.parsedType}),de;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ee(n,{code:K.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(ee(n,{code:K.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(u){let c=new Set;for(let g of u){if(g.status==="aborted")return de;g.status==="dirty"&&r.dirty(),c.add(g.value)}return{status:r.value,value:c}}let s=[...n.data.values()].map((u,c)=>i._parse(new Dt(n,u,n.path,c)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:ie.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ie.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Uo.create=(e,t)=>new Uo({valueType:e,minSize:null,maxSize:null,typeName:pe.ZodSet,...be(t)});var xc=class e extends xe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.function)return ee(r,{code:K.invalid_type,expected:te.function,received:r.parsedType}),de;function n(s,u){return ia({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Fo(),hr].filter(c=>!!c),issueData:{code:K.invalid_arguments,argumentsError:u}})}function o(s,u){return ia({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Fo(),hr].filter(c=>!!c),issueData:{code:K.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Br){let s=this;return ft(/*#__PURE__*/_asyncToGenerator(function*(...u){let c=new bt([]),g=yield s._def.args.parseAsync(u,i).catch(h=>{throw c.addIssue(n(u,h)),c}),v=yield Reflect.apply(a,this,g);return yield s._def.returns._def.type.parseAsync(v,i).catch(h=>{throw c.addIssue(o(v,h)),c})}))}else{let s=this;return ft(function(...u){let c=s._def.args.safeParse(u,i);if(!c.success)throw new bt([n(u,c.error)]);let g=Reflect.apply(a,this,c.data),v=s._def.returns.safeParse(g,i);if(!v.success)throw new bt([o(g,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Jt.create(t).rest(vr.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Jt.create([]).rest(vr.create()),returns:r||vr.create(),typeName:pe.ZodFunction,...be(n)})}},Tn=class extends xe{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Tn.create=(e,t)=>new Tn({getter:e,typeName:pe.ZodLazy,...be(t)});var _n=class extends xe{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return ee(r,{received:r.data,code:K.invalid_literal,expected:this._def.value}),de}return{status:"valid",value:t.data}}get value(){return this._def.value}};_n.create=(e,t)=>new _n({value:e,typeName:pe.ZodLiteral,...be(t)});function jv(e,t){return new kn({values:e,typeName:pe.ZodEnum,...be(t)})}var kn=class e extends xe{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return ee(r,{expected:Re.joinValues(n),received:r.parsedType,code:K.invalid_type}),de}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return ee(r,{received:r.data,code:K.invalid_enum_value,options:n}),de}return ft(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};kn.create=jv;var On=class extends xe{_parse(t){let r=Re.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==te.string&&n.parsedType!==te.number){let o=Re.objectValues(r);return ee(n,{expected:Re.joinValues(o),received:n.parsedType,code:K.invalid_type}),de}if(this._cache||(this._cache=new Set(Re.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Re.objectValues(r);return ee(n,{received:n.data,code:K.invalid_enum_value,options:o}),de}return ft(t.data)}get enum(){return this._def.values}};On.create=(e,t)=>new On({values:e,typeName:pe.ZodNativeEnum,...be(t)});var Br=class extends xe{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.promise&&r.common.async===!1)return ee(r,{code:K.invalid_type,expected:te.promise,received:r.parsedType}),de;let n=r.parsedType===te.promise?r.data:Promise.resolve(r.data);return ft(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Br.create=(e,t)=>new Br({type:e,typeName:pe.ZodPromise,...be(t)});var Mt=class extends xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===pe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this12=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{ee(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(/*#__PURE__*/function(){var _ref41=_asyncToGenerator(function*(s){if(r.value==="aborted")return de;let u=yield _this12._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?de:u.status==="dirty"?Sn(u.value):r.value==="dirty"?Sn(u.value):u});return function(_x87){return _ref41.apply(this,arguments)}}());{if(r.value==="aborted")return de;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?de:s.status==="dirty"?Sn(s.value):r.value==="dirty"?Sn(s.value):s}}if(o.type==="refinement"){let a=s=>{let u=o.refinement(s,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?de:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?de:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ur(a))return de;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Ur(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):de);Re.assertNever(o)}};Mt.create=(e,t,r)=>new Mt({schema:e,typeName:pe.ZodEffects,effect:t,...be(r)});Mt.createWithPreprocess=(e,t,r)=>new Mt({schema:t,effect:{type:"preprocess",transform:e},typeName:pe.ZodEffects,...be(r)});var Ft=class extends xe{_parse(t){return this._getType(t)===te.undefined?ft(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ft.create=(e,t)=>new Ft({innerType:e,typeName:pe.ZodOptional,...be(t)});var er=class extends xe{_parse(t){return this._getType(t)===te.null?ft(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};er.create=(e,t)=>new er({innerType:e,typeName:pe.ZodNullable,...be(t)});var Pn=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===te.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Pn.create=(e,t)=>new Pn({innerType:e,typeName:pe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...be(t)});var Nn=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Do(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new bt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Nn.create=(e,t)=>new Nn({innerType:e,typeName:pe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...be(t)});var Vo=class extends xe{_parse(t){if(this._getType(t)!==te.nan){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.nan,received:n.parsedType}),de}return{status:"valid",value:t.data}}};Vo.create=e=>new Vo({typeName:pe.ZodNaN,...be(e)});var B0=Symbol("zod_brand"),aa=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},sa=class e extends xe{_parse(t){var _this13=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let i=yield _this13._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?de:i.status==="dirty"?(r.dirty(),Sn(i.value)):_this13._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?de:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:pe.ZodPipeline})}},Fn=class extends xe{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Ur(o)&&(o.value=Object.freeze(o.value)),o);return Do(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Fn.create=(e,t)=>new Fn({innerType:e,typeName:pe.ZodReadonly,...be(t)});function Dv(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Uv(e,t={},r){return e?Gr.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=Dv(t,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=Dv(t,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):Gr.create()}var $0={object:At.lazycreate},pe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(pe||(pe={}));var Q0=(e,t={message:`Input not instance of ${e.name}`})=>Uv(r=>r instanceof e,t),Vv=Vr.create,Gv=bn.create,H0=Vo.create,z0=An.create,Bv=wn.create,W0=xn.create,K0=Lo.create,Y0=Cn.create,X0=En.create,Z0=Gr.create,J0=vr.create,e_=Gt.create,t_=qo.create,r_=Sr.create,n_=At.create,o_=At.strictCreate,i_=Rn.create,a_=Ac.create,s_=In.create,c_=Jt.create,u_=wc.create,l_=jo.create,d_=Uo.create,p_=xc.create,f_=Tn.create,m_=_n.create,g_=kn.create,h_=On.create,y_=Br.create,v_=Mt.create,S_=Ft.create,b_=er.create,A_=Mt.createWithPreprocess,w_=sa.create,x_=()=>Vv().optional(),C_=()=>Gv().optional(),E_=()=>Bv().optional(),R_={string:e=>Vr.create({...e,coerce:!0}),number:e=>bn.create({...e,coerce:!0}),boolean:e=>wn.create({...e,coerce:!0}),bigint:e=>An.create({...e,coerce:!0}),date:e=>xn.create({...e,coerce:!0})};var I_=de;var T_=S.record(S.any()),Dn=T_.optional();function $v(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var __=S.object({name:S.string(),arguments:S.string()}),k_=S.object({id:S.string(),type:S.literal("function"),function:__,encryptedValue:S.string().optional(),metadata:Dn}),Cc=S.object({id:S.string(),role:S.string(),content:S.string().optional(),name:S.string().optional(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Dn}),O_=S.object({type:S.literal("text"),text:S.string()}),P_=S.object({type:S.literal("data"),value:S.string(),mimeType:S.string()}),N_=S.object({type:S.literal("url"),value:S.string(),mimeType:S.string().optional()}),Ec=S.discriminatedUnion("type",[P_,N_]),F_=S.object({type:S.literal("image"),source:Ec,metadata:S.unknown().optional()}),D_=S.object({type:S.literal("audio"),source:Ec,metadata:S.unknown().optional()}),M_=S.object({type:S.literal("video"),source:Ec,metadata:S.unknown().optional()}),L_=S.object({type:S.literal("document"),source:Ec,metadata:S.unknown().optional()});var Qv=S.object({type:S.literal("binary"),mimeType:S.string(),id:S.string().optional(),url:S.string().optional(),data:S.string().optional(),filename:S.string().optional()}),Hv=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:S.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},z8=Qv.superRefine((e,t)=>{Hv(e,t)}),q_=S.discriminatedUnion("type",[O_,F_,D_,M_,L_,Qv]),j_=q_.superRefine((e,t)=>{e.type==="binary"&&Hv(e,t)}),U_=Cc.extend({role:S.literal("developer"),content:S.string()}),V_=Cc.extend({role:S.literal("system"),content:S.string()}),G_=Cc.extend({role:S.literal("assistant"),content:S.string().optional(),toolCalls:S.array(k_).optional()}),B_=Cc.extend({role:S.literal("user"),content:S.union([S.string(),S.array(j_)])}),$_=S.object({id:S.string(),content:S.string(),role:S.literal("tool"),toolCallId:S.string(),error:S.string().optional(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Dn}),Q_=S.object({id:S.string(),role:S.literal("activity"),activityType:S.string(),content:S.record(S.any()),subagentRunId:S.string().optional(),metadata:Dn}),H_=S.object({id:S.string(),role:S.literal("reasoning"),content:S.string(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Dn}),zv=S.discriminatedUnion("role",[U_,V_,G_,B_,$_,Q_,H_]),W8=S.union([S.literal("developer"),S.literal("system"),S.literal("assistant"),S.literal("user"),S.literal("tool"),S.literal("activity"),S.literal("reasoning")]),z_=S.object({description:S.string(),value:S.string()}),Wv=S.object({name:S.string(),description:S.string(),parameters:S.any(),metadata:S.record(S.any()).optional()}),W_=S.object({id:S.string(),reason:S.string(),message:S.string().optional(),toolCallId:S.string().optional(),responseSchema:S.record(S.any()).optional(),expiresAt:S.string().optional(),metadata:S.record(S.any()).optional(),subagentRunId:S.string().optional()}),K_=S.object({interruptId:S.string(),status:S.enum(["resolved","cancelled"]),payload:S.any().optional(),metadata:Dn}),Y_=S.object({threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),state:S.any().transform(e=>e??void 0),messages:S.array(zv),tools:S.array(Wv),context:S.array(z_),forwardedProps:S.any(),resume:S.array(K_).optional()}),X_=S.any(),ge=class extends Error{constructor(e){super(e)}},Hp=class extends ge{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},Z_=S.object({name:S.string(),description:S.string().optional()}),J_=S.object({name:S.string().optional(),type:S.string().optional(),description:S.string().optional(),version:S.string().optional(),provider:S.string().optional(),documentationUrl:S.string().optional(),metadata:S.record(S.unknown()).optional()}),ek=S.object({streaming:S.boolean().optional(),websocket:S.boolean().optional(),httpBinary:S.boolean().optional(),pushNotifications:S.boolean().optional(),resumable:S.boolean().optional()}),tk=S.object({supported:S.boolean().optional(),items:S.array(Wv).optional(),parallelCalls:S.boolean().optional(),clientProvided:S.boolean().optional()}),rk=S.object({structuredOutput:S.boolean().optional(),supportedMimeTypes:S.array(S.string()).optional()}),nk=S.object({snapshots:S.boolean().optional(),deltas:S.boolean().optional(),memory:S.boolean().optional(),persistentState:S.boolean().optional()}),ok=S.object({supported:S.boolean().optional(),delegation:S.boolean().optional(),handoffs:S.boolean().optional(),subAgents:S.array(Z_).optional()}),ik=S.object({supported:S.boolean().optional(),streaming:S.boolean().optional(),encrypted:S.boolean().optional()}),ak=S.object({image:S.boolean().optional(),audio:S.boolean().optional(),video:S.boolean().optional(),pdf:S.boolean().optional(),file:S.boolean().optional()}),sk=S.object({image:S.boolean().optional(),audio:S.boolean().optional()}),ck=S.object({input:ak.optional(),output:sk.optional()}),uk=S.object({codeExecution:S.boolean().optional(),sandboxed:S.boolean().optional(),maxIterations:S.number().optional(),maxExecutionTime:S.number().optional()}),lk=S.object({supported:S.boolean().optional(),approvals:S.boolean().optional(),interventions:S.boolean().optional(),feedback:S.boolean().optional(),interrupts:S.boolean().optional(),approveWithEdits:S.boolean().optional()}),K8=S.object({identity:J_.optional(),transport:ek.optional(),tools:tk.optional(),output:rk.optional(),state:nk.optional(),multiAgent:ok.optional(),reasoning:ik.optional(),multimodal:ck.optional(),execution:uk.optional(),humanInTheLoop:lk.optional(),custom:S.record(S.unknown()).optional()}),Kv=S.union([S.literal("developer"),S.literal("system"),S.literal("assistant"),S.literal("user")]),F=function(e){return e.TEXT_MESSAGE_START="TEXT_MESSAGE_START",e.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",e.TEXT_MESSAGE_END="TEXT_MESSAGE_END",e.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",e.TOOL_CALL_START="TOOL_CALL_START",e.TOOL_CALL_ARGS="TOOL_CALL_ARGS",e.TOOL_CALL_END="TOOL_CALL_END",e.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",e.TOOL_CALL_RESULT="TOOL_CALL_RESULT",e.THINKING_START="THINKING_START",e.THINKING_END="THINKING_END",e.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",e.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",e.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",e.STATE_SNAPSHOT="STATE_SNAPSHOT",e.STATE_DELTA="STATE_DELTA",e.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",e.ACTIVITY_SNAPSHOT="ACTIVITY_SNAPSHOT",e.ACTIVITY_DELTA="ACTIVITY_DELTA",e.RAW="RAW",e.CUSTOM="CUSTOM",e.RUN_STARTED="RUN_STARTED",e.RUN_FINISHED="RUN_FINISHED",e.RUN_ERROR="RUN_ERROR",e.STEP_STARTED="STEP_STARTED",e.STEP_FINISHED="STEP_FINISHED",e.REASONING_START="REASONING_START",e.REASONING_MESSAGE_START="REASONING_MESSAGE_START",e.REASONING_MESSAGE_CONTENT="REASONING_MESSAGE_CONTENT",e.REASONING_MESSAGE_END="REASONING_MESSAGE_END",e.REASONING_MESSAGE_CHUNK="REASONING_MESSAGE_CHUNK",e.REASONING_END="REASONING_END",e.REASONING_ENCRYPTED_VALUE="REASONING_ENCRYPTED_VALUE",e.SUBAGENT_STARTED="SUBAGENT_STARTED",e.SUBAGENT_FINISHED="SUBAGENT_FINISHED",e.SUBAGENT_ERROR="SUBAGENT_ERROR",e}({}),Ie=S.object({type:S.nativeEnum(F),timestamp:S.number().optional(),rawEvent:S.any().optional(),metadata:Dn}).passthrough(),dk=Ie.extend({type:S.literal(F.TEXT_MESSAGE_START),messageId:S.string(),role:Kv.default("assistant"),name:S.string().optional(),subagentRunId:S.string().optional()}),Yv=Ie.extend({type:S.literal(F.TEXT_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),pk=Ie.extend({type:S.literal(F.TEXT_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),fk=Ie.extend({type:S.literal(F.TEXT_MESSAGE_CHUNK),messageId:S.string().optional(),role:Kv.optional(),delta:S.string().optional(),name:S.string().optional(),subagentRunId:S.string().optional()}),mk=Ie.extend({type:S.literal(F.THINKING_TEXT_MESSAGE_START)}),gk=Yv.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:S.literal(F.THINKING_TEXT_MESSAGE_CONTENT)}),hk=Ie.extend({type:S.literal(F.THINKING_TEXT_MESSAGE_END)}),yk=Ie.extend({type:S.literal(F.TOOL_CALL_START),toolCallId:S.string(),toolCallName:S.string(),parentMessageId:S.string().nullable().optional().transform(e=>e??void 0),subagentRunId:S.string().optional()}),vk=Ie.extend({type:S.literal(F.TOOL_CALL_ARGS),toolCallId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),Sk=Ie.extend({type:S.literal(F.TOOL_CALL_END),toolCallId:S.string(),subagentRunId:S.string().optional()}),bk=Ie.extend({messageId:S.string(),type:S.literal(F.TOOL_CALL_RESULT),toolCallId:S.string(),content:S.string(),role:S.literal("tool").optional(),subagentRunId:S.string().optional()}),Ak=Ie.extend({type:S.literal(F.TOOL_CALL_CHUNK),toolCallId:S.string().optional(),toolCallName:S.string().optional(),parentMessageId:S.string().nullable().optional().transform(e=>e??void 0),delta:S.string().optional(),subagentRunId:S.string().optional()}),wk=Ie.extend({type:S.literal(F.THINKING_START),title:S.string().optional()}),xk=Ie.extend({type:S.literal(F.THINKING_END)}),Ck=Ie.extend({type:S.literal(F.STATE_SNAPSHOT),snapshot:X_,subagentRunId:S.string().optional()}),Ek=Ie.extend({type:S.literal(F.STATE_DELTA),delta:S.array(S.any()),subagentRunId:S.string().optional()}),Rk=Ie.extend({type:S.literal(F.MESSAGES_SNAPSHOT),messages:S.array(zv)}),Ik=Ie.extend({type:S.literal(F.ACTIVITY_SNAPSHOT),messageId:S.string(),activityType:S.string(),content:S.record(S.any()),replace:S.boolean().optional().default(!0),subagentRunId:S.string().optional()}),Tk=Ie.extend({type:S.literal(F.ACTIVITY_DELTA),messageId:S.string(),activityType:S.string(),patch:S.array(S.any()),subagentRunId:S.string().optional()}),_k=Ie.extend({type:S.literal(F.RAW),event:S.any(),source:S.string().optional(),subagentRunId:S.string().optional()}),kk=Ie.extend({type:S.literal(F.CUSTOM),name:S.string(),value:S.any(),subagentRunId:S.string().optional()}),Ok=Ie.extend({type:S.literal(F.RUN_STARTED),threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),input:Y_.optional()}),Pk=S.object({type:S.literal("success")}).strict(),Nk=S.object({type:S.literal("interrupt"),interrupts:S.array(W_).min(1)}).strict(),Fk=S.discriminatedUnion("type",[Pk,Nk]),Xv=S.object({provider:S.string().optional(),model:S.string().optional(),inputTokens:S.number().int().nonnegative().optional(),outputTokens:S.number().int().nonnegative().optional(),totalTokens:S.number().int().nonnegative().optional(),reasoningTokens:S.number().int().nonnegative().optional(),cachedInputTokens:S.number().int().nonnegative().optional()}),Dk=Ie.extend({type:S.literal(F.RUN_FINISHED),threadId:S.string(),runId:S.string(),result:S.any().optional(),outcome:Fk.nullable().optional().transform(e=>e??void 0),usage:S.array(Xv).optional()}),Mk=Ie.extend({type:S.literal(F.RUN_ERROR),message:S.string(),code:S.string().optional(),usage:S.array(Xv).optional()}),Lk=Ie.extend({type:S.literal(F.STEP_STARTED),stepName:S.string(),subagentRunId:S.string().optional()}),qk=Ie.extend({type:S.literal(F.STEP_FINISHED),stepName:S.string(),subagentRunId:S.string().optional()}),jk=S.union([S.literal("tool-call"),S.literal("message")]),Uk=Ie.extend({type:S.literal(F.REASONING_START),messageId:S.string(),subagentRunId:S.string().optional()}),Vk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_START),messageId:S.string(),role:S.literal("reasoning"),subagentRunId:S.string().optional()}),Gk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),Bk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),$k=Ie.extend({type:S.literal(F.REASONING_MESSAGE_CHUNK),messageId:S.string().optional(),delta:S.string().optional(),subagentRunId:S.string().optional()}),Qk=Ie.extend({type:S.literal(F.REASONING_END),messageId:S.string(),subagentRunId:S.string().optional()}),Hk=Ie.extend({type:S.literal(F.REASONING_ENCRYPTED_VALUE),subtype:jk,entityId:S.string(),encryptedValue:S.string(),subagentRunId:S.string().optional()}),zk=Ie.extend({type:S.literal(F.SUBAGENT_STARTED),subagentRunId:S.string(),name:S.string(),description:S.string().optional(),parentSubagentRunId:S.string().optional(),parentToolCallId:S.string().optional(),parentMessageId:S.string().optional()}),Wk=S.object({type:S.literal("success")}).strict(),Kk=S.object({type:S.literal("suspended"),interruptIds:S.array(S.string()).optional()}).strict(),Yk=S.discriminatedUnion("type",[Wk,Kk]),Xk=Ie.extend({type:S.literal(F.SUBAGENT_FINISHED),subagentRunId:S.string(),result:S.any().optional(),outcome:Yk.optional()}),Zk=Ie.extend({type:S.literal(F.SUBAGENT_ERROR),subagentRunId:S.string(),message:S.string(),code:S.string().optional()}),Rc=S.discriminatedUnion("type",[dk,Yv,pk,fk,wk,xk,mk,gk,hk,yk,vk,Sk,Ak,bk,Ck,Ek,Rk,Ik,Tk,_k,kk,Ok,Dk,Mk,Lk,qk,Uk,Vk,Gk,Bk,$k,Qk,Hk,zk,Xk,Zk]);m();d();f();p();var zp={};ui(zp,{JsonPatchError:()=>$e,_areEquals:()=>la,applyOperation:()=>Mn,applyPatch:()=>Nc,applyReducer:()=>nO,deepClone:()=>tO,getValueByPointer:()=>Oc,validate:()=>Jv,validator:()=>Pc});m();d();f();p();m();d();f();p();var Jk=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),eO=Object.prototype.hasOwnProperty;function Tc(e,t){return eO.call(e,t)}function _c(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var o in e)Tc(e,o)&&n.push(o);return n}function ct(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function kc(e){for(var t=0,r=e.length,n;t<r;){if(n=e.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0}function tr(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function ca(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Ic(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Ic(e[t]))return!0}else if(typeof e=="object"){for(var n=_c(e),o=n.length,i=0;i<o;i++)if(Ic(e[n[i]]))return!0}}return!1}function Zv(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
|
|
33
|
-
`)}var ua=function(e){Jk(t,e);function t(r,n,o,i,a){var s=this.constructor,u=e.call(this,Zv(r,{name:n,index:o,operation:i,tree:a}))||this;return u.name=n,u.index=o,u.operation=i,u.tree=a,Object.setPrototypeOf(u,s.prototype),u.message=Zv(r,{name:n,index:o,operation:i,tree:a}),u}return t}(Error);var $e=ua,tO=ct,Go={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=Oc(r,this.path);n&&(n=ct(n));var o=Mn(r,{op:"remove",path:this.from}).removed;return Mn(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Oc(r,this.from);return Mn(r,{op:"add",path:this.path,value:ct(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:la(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},rO={add:function(e,t,r){return kc(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:Go.move,copy:Go.copy,test:Go.test,_get:Go._get};function Oc(e,t){if(t=="")return e;var r={op:"_get",path:t};return Mn(e,r),r.value}function Mn(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):Pc(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=Oc(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=la(e,t.value),a.test===!1)throw new $e("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 $e("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{n||(e=ct(e));var s=t.path||"",u=s.split("/"),c=e,g=1,v=u.length,R=void 0,h=void 0,y=void 0;for(typeof r=="function"?y=r:y=Pc;;){if(h=u[g],h&&h.indexOf("~")!=-1&&(h=ca(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&u[g-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&R===void 0&&(c[h]===void 0?R=u.slice(0,g).join("/"):g==v-1&&(R=t.path),R!==void 0&&y(t,0,e,R)),g++,Array.isArray(c)){if(h==="-")h=c.length;else{if(r&&!kc(h))throw new $e("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);kc(h)&&(h=~~h)}if(g>=v){if(r&&t.op==="add"&&h>c.length)throw new $e("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=rO[t.op].call(t,c,h,e);if(a.test===!1)throw new $e("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(g>=v){var a=Go[t.op].call(t,c,h,e);if(a.test===!1)throw new $e("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(c=c[h],r&&g<v&&(!c||typeof c!="object"))throw new $e("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function Nc(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new $e("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=ct(e));for(var i=new Array(t.length),a=0,s=t.length;a<s;a++)i[a]=Mn(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function nO(e,t,r){var n=Mn(e,t);if(n.test===!1)throw new $e("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Pc(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new $e("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Go[e.op]){if(typeof e.path!="string")throw new $e("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new $e("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 $e("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 $e("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")&&Ic(e.value))throw new $e("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 $e("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 $e("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},s=Jv([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new $e("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new $e("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function Jv(e,t,r){try{if(!Array.isArray(e))throw new $e("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Nc(ct(t),ct(e),r||!0);else{r=r||Pc;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof $e)return o;throw o}}function la(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(!la(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var s=Object.keys(e);if(i=s.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(s[o]))return!1;for(o=i;o--!==0;)if(a=s[o],!la(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var Xp={};ui(Xp,{compare:()=>dO,generate:()=>Wp,observe:()=>lO,unobserve:()=>uO});m();d();f();p();var Kp=new WeakMap,oO=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),iO=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function aO(e){return Kp.get(e)}function sO(e,t){return e.observers.get(t)}function cO(e,t){e.observers.delete(t.callback)}function uO(e,t){t.unobserve()}function lO(e,t){var r=[],n,o=aO(e);if(!o)o=new oO(e),Kp.set(e,o);else{var i=sO(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=ct(e),t){n.callback=t,n.next=null;var a=function(){Wp(n)},s=function(){clearTimeout(n.next),n.next=setTimeout(a)};typeof window<"u"&&(window.addEventListener("mouseup",s),window.addEventListener("keyup",s),window.addEventListener("mousedown",s),window.addEventListener("keydown",s),window.addEventListener("change",s))}return n.patches=r,n.object=e,n.unobserve=function(){Wp(n),clearTimeout(n.next),cO(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",s),window.removeEventListener("keyup",s),window.removeEventListener("mousedown",s),window.removeEventListener("keydown",s),window.removeEventListener("change",s))},o.observers.set(t,new iO(t,n)),n}function Wp(e,t){t===void 0&&(t=!1);var r=Kp.get(e.object);Yp(r.value,e.object,e.patches,"",t),e.patches.length&&Nc(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Yp(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=_c(t),a=_c(e),s=!1,u=!1,c=a.length-1;c>=0;c--){var g=a[c],v=e[g];if(Tc(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var R=t[g];typeof v=="object"&&v!=null&&typeof R=="object"&&R!=null&&Array.isArray(v)===Array.isArray(R)?Yp(v,R,r,n+"/"+tr(g),o):v!==R&&(s=!0,o&&r.push({op:"test",path:n+"/"+tr(g),value:ct(v)}),r.push({op:"replace",path:n+"/"+tr(g),value:ct(R)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+tr(g),value:ct(v)}),r.push({op:"remove",path:n+"/"+tr(g)}),u=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),s=!0)}if(!(!u&&i.length==a.length))for(var c=0;c<i.length;c++){var g=i[c];!Tc(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+tr(g),value:ct(t[g])})}}}function dO(e,t,r){r===void 0&&(r=!1);var n=[];return Yp(e,t,n,"",r),n}var Fc=Object.assign({},zp,Xp,{JsonPatchError:ua,deepClone:ct,escapePathComponent:tr,unescapePathComponent:ca});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Zp=function(e,t){return Zp=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])},Zp(e,t)};function rr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Zp(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function eS(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 s(g){try{c(n.next(g))}catch(v){a(v)}}function u(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})}function Dc(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=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function br(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 Bo(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(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function $o(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 Ln(e){return this instanceof Ln?(this.v=e,this):new Ln(e)}function tS(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),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(h){return function(y){return Promise.resolve(y).then(h,v)}}function s(h,y){n[h]&&(o[h]=function(b){return new Promise(function(x,I){i.push([h,b,x,I])>1||u(h,b)})},y&&(o[h]=y(o[h])))}function u(h,y){try{c(n[h](y))}catch(b){R(i[0][3],b)}}function c(h){h.value instanceof Ln?Promise.resolve(h.value.v).then(g,v):R(i[0][2],h)}function g(h){u("next",h)}function v(h){u("throw",h)}function R(h,y){h(y),i.shift(),i.length&&u(i[0][0],i[0][1])}}function rS(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 br=="function"?br(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(s,u){a=e[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(c){i({value:c,done:s})},a)}}m();d();f();p();function Ee(e){return typeof e=="function"}m();d();f();p();m();d();f();p();m();d();f();p();function Qo(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 Mc=Qo(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
31
|
+
`;function SR(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var bR=["1",1,"yes",!0];function AR(){let e=[];return Sd()&&e.push(window.doNotTrack),Nd()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>bR.indexOf(t)!==-1)}function Ps(e){return e===!0?!1:AR()}var ah="v15",sh={default:"https://analytics.cloud.coveo.com/rest/ua"};function wR(e=sh.default,t=ah,r=!1){if(e=e.replace(/\/$/,""),r)return`${e}/${t}`;let n=e.endsWith("/rest")||e.endsWith("/rest/ua");return`${e}${n?"":"/rest"}/${t}`}var xR="38824e1f-37f5-42d3-8372-a4b8fa9df946",Xt=class{get defaultOptions(){return{endpoint:sh.default,isCustomEndpoint:!1,token:"",version:ah,beforeSendHooks:[],afterSendHooks:[]}}get version(){return rh}constructor(t){if(this.acceptedLinkReferrers=[],!t)throw new Error("You have to pass options to this constructor");this.options=Object.assign(Object.assign({},this.defaultOptions),t),this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[pE,iE].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};let r={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};Ps(this.options.disableBrowserPrivacySignals)?this.runtime=new Os:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(Ce.view,{newEventType:Ce.view,addClientIdParameter:!0}),this.addEventTypeMapping(Ce.click,{newEventType:Ce.click,addClientIdParameter:!0}),this.addEventTypeMapping(Ce.custom,{newEventType:Ce.custom,addClientIdParameter:!0}),this.addEventTypeMapping(Ce.search,{newEventType:Ce.search,addClientIdParameter:!0})}initRuntime(t){return Sd()&&go()?new Od(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(SR()&&console.warn(vR),new Pd(t))}get storage(){return this.runtime.storage}determineVisitorId(){return U(this,void 0,void 0,function*(){try{return Sd()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||mn()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),mn()}})}getCurrentVisitorId(){return U(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return U(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return U(this,void 0,void 0,function*(){if(Rs(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(Is(t,Is(r,xR)))}})}getParameters(t,...r){return U(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return U(this,void 0,void 0,function*(){let n=yield this.resolveParameters(t,...r);return yield this.resolvePayloadForParameters(t,n)})}get currentVisitorId(){return typeof(this.visitorId||this.storage.getItem("visitorId"))!="string"&&this.setCurrentVisitorId(mn()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(Ps(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(_r.cvo_cid);if(r==null)return null;let n=_r.fromString(r);return!n||!go()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return U(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:i=!1,addClientIdParameter:a=!1}=this.eventTypeMapping[t]||{};return yield[h=>n.length>0?this.parseVariableArgumentsPayload(n,h):h[0],h=>U(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>U(this,void 0,void 0,function*(){return a?Object.assign(Object.assign({},h),{clientId:yield this.getCurrentVisitorId()}):h}),h=>i?this.ensureAnonymousUserWhenUsingApiKey(h):h,h=>this.beforeSendHooks.reduce((y,b)=>U(this,void 0,void 0,function*(){let x=yield y;return yield b(t,x)}),h)].reduce((h,y)=>U(this,void 0,void 0,function*(){let b=yield h;return yield y(b)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return U(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[v=>this.setTrackingIdIfTrackingIdNotPresent(v),v=>this.removeEmptyPayloadValues(v,t),v=>this.validateParams(v,t),v=>n?cR(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,R)=>U(this,void 0,void 0,function*(){let h=yield v;return yield R(h)}),Promise.resolve(r))})}makeEvent(t,...r){return U(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},o=yield this.resolveParameters(t,...r),i=yield this.resolvePayloadForParameters(t,o);return{eventType:n,payload:i,log:a=>U(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},i),a)}),yield Promise.all(this.afterSendHooks.map(s=>s(t,Object.assign(Object.assign({},o),a)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return U(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return U(this,void 0,void 0,function*(){let t=this.bufferedRequests.shift();if(t){let{eventType:r,payload:n}=t;return this.runtime.getClientDependingOnEventType(r).sendEvent(r,n)}})}clear(){this.storage.removeItem("visitorId"),new Es().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Ce.search,t)})}sendSearchEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=pr(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Ce.click,t)})}sendClickEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=pr(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Ce.custom,t)})}sendCustomEvent(t){return U(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=pr(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Ce.view,t)})}sendViewEvent(t){return U(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return U(this,void 0,void 0,function*(){let r=yield(yield C(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return U(this,void 0,void 0,function*(){return yield(yield C(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,r){this.eventTypeMapping[t]=r}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(r=>typeof r=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,r){let n={};for(let o=0,i=r.length;o<i;o++){let a=r[o];if(typeof a=="string")n[t[o]]=a;else if(typeof a=="object")return Object.assign(Object.assign({},n),a)}return n}isKeyAllowedEmpty(t,r){return({[Ce.search]:["queryText"]}[t]||[]).indexOf(r)!==-1}removeEmptyPayloadValues(t,r){let n=o=>typeof o<"u"&&o!==null&&o!=="";return Object.keys(t).filter(o=>this.isKeyAllowedEmpty(r,o)||n(t[o])).reduce((o,i)=>Object.assign(Object.assign({},o),{[i]:t[i]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(pR(n))return!0;console.log(n,"is not processed by coveoua")}).reduce((n,o)=>Object.assign(Object.assign({},n),{[o]:t[o]}),{})}processCustomParameters(t){let{custom:r}=t,n=pr(t,["custom"]),o={};r&&Cs(r)&&(o=this.lowercaseKeys(r));let i=fR(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=pr(t,["custom"]);if(r&&Cs(r)){let o=this.lowercaseKeys(r);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},o),t.customData)})}else return t}lowercaseKeys(t){let r=Object.keys(t),n={};return r.forEach(o=>{n[o.toLowerCase()]=t[o]}),n}validateParams(t,r){let{anonymizeIp:n}=t,o=pr(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==Ce.view||r==Ce.click||r==Ce.search||r==Ce.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==Ce.view&&(o.location=this.limit(o.location,1024)),(r=="pageview"||r=="event")&&(o.referrer=this.limit(o.referrer,2048),o.location=this.limit(o.location,2048),o.page=this.limit(o.page,2048)),o}ensureAnonymousUserWhenUsingApiKey(t){let{userId:r}=t,n=pr(t,["userId"]);return yR(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=pr(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Cs(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Cs(n.customData)&&(n.customData.hasOwnProperty("context_website")||n.customData.hasOwnProperty("siteName"))&&(n.trackingId=n.customData.context_website||n.customData.siteName),n)}limit(t,r){return typeof t=="string"?EE(t,r):t}get baseUrl(){return wR(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},fr;(function(e){e.contextChanged="contextChanged",e.expandToFullUI="expandToFullUI",e.openUserActions="openUserActions",e.showPrecedingSessions="showPrecedingSessions",e.showFollowingSessions="showFollowingSessions",e.clickViewedDocument="clickViewedDocument",e.clickPageView="clickPageView",e.createArticle="createArticle"})(fr||(fr={}));var $;(function(e){e.interfaceLoad="interfaceLoad",e.interfaceChange="interfaceChange",e.didyoumeanAutomatic="didyoumeanAutomatic",e.didyoumeanClick="didyoumeanClick",e.resultsSort="resultsSort",e.searchboxSubmit="searchboxSubmit",e.searchboxClear="searchboxClear",e.searchboxAsYouType="searchboxAsYouType",e.breadcrumbFacet="breadcrumbFacet",e.breadcrumbResetAll="breadcrumbResetAll",e.documentQuickview="documentQuickview",e.documentOpen="documentOpen",e.omniboxAnalytics="omniboxAnalytics",e.omniboxFromLink="omniboxFromLink",e.searchFromLink="searchFromLink",e.triggerNotify="notify",e.triggerExecute="execute",e.triggerQuery="query",e.undoTriggerQuery="undoQuery",e.triggerRedirect="redirect",e.pagerResize="pagerResize",e.pagerNumber="pagerNumber",e.pagerNext="pagerNext",e.pagerPrevious="pagerPrevious",e.pagerScrolling="pagerScrolling",e.staticFilterClearAll="staticFilterClearAll",e.staticFilterSelect="staticFilterSelect",e.staticFilterDeselect="staticFilterDeselect",e.facetClearAll="facetClearAll",e.facetSearch="facetSearch",e.facetSelect="facetSelect",e.facetSelectAll="facetSelectAll",e.facetDeselect="facetDeselect",e.facetExclude="facetExclude",e.facetUnexclude="facetUnexclude",e.facetUpdateSort="facetUpdateSort",e.facetShowMore="showMoreFacetResults",e.facetShowLess="showLessFacetResults",e.queryError="query",e.queryErrorBack="errorBack",e.queryErrorClear="errorClearQuery",e.queryErrorRetry="errorRetry",e.recommendation="recommendation",e.recommendationInterfaceLoad="recommendationInterfaceLoad",e.recommendationOpen="recommendationOpen",e.likeSmartSnippet="likeSmartSnippet",e.dislikeSmartSnippet="dislikeSmartSnippet",e.expandSmartSnippet="expandSmartSnippet",e.collapseSmartSnippet="collapseSmartSnippet",e.openSmartSnippetFeedbackModal="openSmartSnippetFeedbackModal",e.closeSmartSnippetFeedbackModal="closeSmartSnippetFeedbackModal",e.sendSmartSnippetReason="sendSmartSnippetReason",e.expandSmartSnippetSuggestion="expandSmartSnippetSuggestion",e.collapseSmartSnippetSuggestion="collapseSmartSnippetSuggestion",e.showMoreSmartSnippetSuggestion="showMoreSmartSnippetSuggestion",e.showLessSmartSnippetSuggestion="showLessSmartSnippetSuggestion",e.openSmartSnippetSource="openSmartSnippetSource",e.openSmartSnippetSuggestionSource="openSmartSnippetSuggestionSource",e.openSmartSnippetInlineLink="openSmartSnippetInlineLink",e.openSmartSnippetSuggestionInlineLink="openSmartSnippetSuggestionInlineLink",e.recentQueryClick="recentQueriesClick",e.clearRecentQueries="clearRecentQueries",e.recentResultClick="recentResultClick",e.clearRecentResults="clearRecentResults",e.noResultsBack="noResultsBack",e.showMoreFoldedResults="showMoreFoldedResults",e.showLessFoldedResults="showLessFoldedResults",e.copyToClipboard="copyToClipboard",e.caseSendEmail="Case.SendEmail",e.feedItemTextPost="FeedItem.TextPost",e.caseAttach="caseAttach",e.caseDetach="caseDetach",e.retryGeneratedAnswer="retryGeneratedAnswer",e.likeGeneratedAnswer="likeGeneratedAnswer",e.dislikeGeneratedAnswer="dislikeGeneratedAnswer",e.openGeneratedAnswerSource="openGeneratedAnswerSource",e.generatedAnswerOpenInlineLink="generatedAnswerOpenInlineLink",e.generatedAnswerStreamEnd="generatedAnswerStreamEnd",e.generatedAnswerSourceHover="generatedAnswerSourceHover",e.generatedAnswerCopyToClipboard="generatedAnswerCopyToClipboard",e.generatedAnswerHideAnswers="generatedAnswerHideAnswers",e.generatedAnswerShowAnswers="generatedAnswerShowAnswers",e.generatedAnswerExpand="generatedAnswerExpand",e.generatedAnswerCollapse="generatedAnswerCollapse",e.generatedAnswerFeedbackSubmit="generatedAnswerFeedbackSubmit",e.rephraseGeneratedAnswer="rephraseGeneratedAnswer",e.generatedAnswerFeedbackSubmitV2="generatedAnswerFeedbackSubmitV2",e.generatedAnswerCitationClick="generatedAnswerCitationClick",e.generatedAnswerFollowupOpenSource="generatedAnswerFollowupOpenSource",e.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})($||($={}));var Yg={[$.triggerNotify]:"queryPipelineTriggers",[$.triggerExecute]:"queryPipelineTriggers",[$.triggerQuery]:"queryPipelineTriggers",[$.triggerRedirect]:"queryPipelineTriggers",[$.queryErrorBack]:"errors",[$.queryErrorClear]:"errors",[$.queryErrorRetry]:"errors",[$.pagerNext]:"getMoreResults",[$.pagerPrevious]:"getMoreResults",[$.pagerNumber]:"getMoreResults",[$.pagerResize]:"getMoreResults",[$.pagerScrolling]:"getMoreResults",[$.facetSearch]:"facet",[$.facetShowLess]:"facet",[$.facetShowMore]:"facet",[$.recommendation]:"recommendation",[$.likeSmartSnippet]:"smartSnippet",[$.dislikeSmartSnippet]:"smartSnippet",[$.expandSmartSnippet]:"smartSnippet",[$.collapseSmartSnippet]:"smartSnippet",[$.openSmartSnippetFeedbackModal]:"smartSnippet",[$.closeSmartSnippetFeedbackModal]:"smartSnippet",[$.sendSmartSnippetReason]:"smartSnippet",[$.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.clearRecentQueries]:"recentQueries",[$.recentResultClick]:"recentlyClickedDocuments",[$.clearRecentResults]:"recentlyClickedDocuments",[$.showLessFoldedResults]:"folding",[$.caseDetach]:"case",[$.likeGeneratedAnswer]:"generatedAnswer",[$.dislikeGeneratedAnswer]:"generatedAnswer",[$.openGeneratedAnswerSource]:"generatedAnswer",[$.generatedAnswerOpenInlineLink]:"generatedAnswer",[$.generatedAnswerFollowupOpenSource]:"generatedAnswer",[$.generatedAnswerStreamEnd]:"generatedAnswer",[$.generatedAnswerSourceHover]:"generatedAnswer",[$.generatedAnswerCopyToClipboard]:"generatedAnswer",[$.generatedAnswerHideAnswers]:"generatedAnswer",[$.generatedAnswerShowAnswers]:"generatedAnswer",[$.generatedAnswerExpand]:"generatedAnswer",[$.generatedAnswerCollapse]:"generatedAnswer",[$.generatedAnswerFeedbackSubmit]:"generatedAnswer",[$.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[fr.expandToFullUI]:"interface",[fr.openUserActions]:"User Actions",[fr.showPrecedingSessions]:"User Actions",[fr.showFollowingSessions]:"User Actions",[fr.clickViewedDocument]:"User Actions",[fr.clickPageView]:"User Actions",[fr.createArticle]:"createArticle"},So=class{constructor(){this.runtime=new Os,this.currentVisitorId=""}getPayload(){return Promise.resolve()}getParameters(){return Promise.resolve()}makeEvent(t){return Promise.resolve({eventType:t,payload:null,log:()=>Promise.resolve()})}sendEvent(){return Promise.resolve()}makeSearchEvent(){return this.makeEvent(Ce.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(Ce.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(Ce.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(Ce.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return rh}};function CR(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function ER(e){return e.map(t=>t.replace(/;/g,""))}function ch(e){let r=e.join(";");return r.length<=256?r:ch(e.slice(1))}var Xg=e=>{let t=ER(e),r=CR(t);return ch(r)};function Zg(e){let t=typeof e.partialQueries=="string"?e.partialQueries:Xg(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:Xg(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Ns=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Ps(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new So:new Xt(t)}disable(){this.coveoAnalyticsClient=new So}enable(){this.coveoAnalyticsClient=new Xt(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent($.interfaceLoad)}logInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent($.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent($.recommendation)}logRecommendation(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent($.recommendationOpen,t,r)}logRecommendationOpen(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent($.staticFilterClearAll,t)}logStaticFilterClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent($.staticFilterSelect,t)}logStaticFilterSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent($.staticFilterDeselect,t)}logStaticFilterDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent($.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return U(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent($.interfaceChange,t)}logInterfaceChange(t){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent($.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent($.didyoumeanClick)}logDidYouMeanClick(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent($.resultsSort,t)}logResultsSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent($.searchboxSubmit)}logSearchboxSubmit(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent($.searchboxClear)}logSearchboxClear(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent($.searchboxAsYouType)}logSearchboxAsYouType(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent($.breadcrumbFacet,t)}logBreadcrumbFacet(t){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent($.breadcrumbResetAll)}logBreadcrumbResetAll(){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent($.documentQuickview,t,r)}logDocumentQuickview(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent($.documentOpen,t,r)}logDocumentOpen(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent($.omniboxAnalytics,Zg(t))}logOmniboxAnalytics(t){return U(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent($.omniboxFromLink,Zg(t))}logOmniboxFromLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent($.searchFromLink)}logSearchFromLink(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent($.triggerNotify,t)}logTriggerNotify(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent($.triggerExecute,t)}logTriggerExecute(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent($.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent($.undoTriggerQuery,t)}logUndoTriggerQuery(t){return U(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent($.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent($.pagerResize,t)}logPagerResize(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent($.pagerNumber,t)}logPagerNumber(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent($.pagerNext,t)}logPagerNext(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent($.pagerPrevious,t)}logPagerPrevious(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent($.pagerScrolling)}logPagerScrolling(){return U(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent($.facetClearAll,t)}logFacetClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent($.facetSearch,t)}logFacetSearch(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent($.facetSelect,t)}logFacetSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent($.facetDeselect,t)}logFacetDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent($.facetExclude,t)}logFacetExclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent($.facetUnexclude,t)}logFacetUnexclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent($.facetSelectAll,t)}logFacetSelectAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent($.facetUpdateSort,t)}logFacetUpdateSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent($.facetShowMore,t)}logFacetShowMore(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent($.facetShowLess,t)}logFacetShowLess(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent($.queryError,t)}logQueryError(t){return U(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorBack);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorBack)})}})}logQueryErrorBack(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorRetry);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorRetry)})}})}logQueryErrorRetry(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorClear);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorClear)})}})}logQueryErrorClear(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent($.likeSmartSnippet)}logLikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent($.dislikeSmartSnippet)}logDislikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent($.expandSmartSnippet)}logExpandSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent($.collapseSmartSnippet)}logCollapseSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent($.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent($.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent($.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent($.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent($.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent($.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent($.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent($.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent($.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent($.copyToClipboard,t,r)}logCopyToClipboard(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent($.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent($.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent($.recentQueryClick)}logRecentQueryClick(){return U(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent($.clearRecentQueries)}logClearRecentQueries(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent($.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent($.clearRecentResults)}logClearRecentResults(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent($.noResultsBack)}logNoResultsBack(){return U(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent($.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent($.showLessFoldedResults)}logShowLessFoldedResults(){return U(this,void 0,void 0,function*(){return(yield this.makeShowLessFoldedResults()).log({searchUID:this.provider.getSearchUID()})})}makeEventDescription(t,r){var n;return{actionCause:r,customData:(n=t.payload)===null||n===void 0?void 0:n.customData}}makeCustomEvent(t,r){return U(this,arguments,void 0,function*(n,o,i=Yg[n]){this.coveoAnalyticsClient.getParameters;let a=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),s=Object.assign(Object.assign({},yield this.getBaseEventRequest(a)),{eventType:i,eventValue:n}),u=yield this.coveoAnalyticsClient.makeCustomEvent(s);return{description:this.makeEventDescription(u,n),log:({searchUID:c})=>u.log({lastSearchQueryUid:c})}})}logCustomEvent(t,r){return U(this,arguments,void 0,function*(n,o,i=Yg[n]){return(yield this.makeCustomEvent(n,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return U(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),i=Object.assign(Object.assign({},yield this.getBaseEventRequest(o)),{eventType:r,eventValue:t}),a=yield this.coveoAnalyticsClient.makeCustomEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:s})=>a.log({lastSearchQueryUid:s})}})}logCustomEventWithType(t,r,n){return U(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return U(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),o=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(o,t),log:({searchUID:i})=>o.log({searchQueryUid:i})}})}makeClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){let i=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),a=yield this.coveoAnalyticsClient.makeClickEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:s})=>a.log({searchQueryUid:s})}})}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return U(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.getOrigins()),this.getSplitTestRun()),{customData:r,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,r;return{originContext:(r=(t=this.provider).getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof Xt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getSplitTestRun(){let t=this.provider.getSplitTestRunName?this.provider.getSplitTestRunName():"",r=this.provider.getSplitTestRunVersion?this.provider.getSplitTestRunVersion():"";return Object.assign(Object.assign({},t&&{splitTestRunName:t}),r&&{splitTestRunVersion:r})}makeLikeGeneratedAnswer(t){return this.makeCustomEvent($.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent($.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent($.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent($.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent($.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent($.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent($.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent($.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent($.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent($.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent($.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent($.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent($.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent($.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent($.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent($.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return U(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent($.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Fs=Object.assign({},Mi),Jg=Object.keys(Fs).map(e=>Fs[e]),yo=class extends xd{constructor({client:t,uuidGenerator:r=mn}){super({client:t,uuidGenerator:r}),this.ticket={}}getApi(t){let r=super.getApi(t);return r!==null?r:t==="setTicket"?this.setTicket:null}addHooks(){this.addHooksForEvent(),this.addHooksForPageView(),this.addHooksForSVCEvents()}setTicket(t){this.ticket=t}clearPluginData(){this.ticket={}}addHooksForSVCEvents(){this.client.registerBeforeSendEventHook((t,...[r])=>Jg.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Jg.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Fs.pageview,{newEventType:Ce.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Fs.event,{newEventType:Ce.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,r){var n;let o=Object.assign(Object.assign(Object.assign(Object.assign({},this.getLocationInformation(t,r)),this.getDefaultContextInformation(t)),this.action?{svcAction:this.action}:{}),Object.keys((n=this.actionData)!==null&&n!==void 0?n:{}).length>0?{svcActionData:this.actionData}:{}),i=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},i),o),r)}getTicketPayload(){return kE(this.ticket)}};yo.Id="svc";var Ds;(function(e){e.click="click",e.flowStart="flowStart"})(Ds||(Ds={}));var Pt;(function(e){e.enterInterface="ticket_create_start",e.fieldUpdate="ticket_field_update",e.fieldSuggestionClick="ticket_classification_click",e.documentSuggestionClick="documentSuggestionClick",e.documentSuggestionQuickview="documentSuggestionQuickview",e.suggestionRate="suggestion_rate",e.nextCaseStep="ticket_next_stage",e.caseCancelled="ticket_cancel",e.caseSolved="ticket_cancel",e.caseCreated="ticket_create"})(Pt||(Pt={}));var Ms;(function(e){e.quit="Quit",e.solved="Solved"})(Ms||(Ms={}));var Ls=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!Ps(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new Xt(t):new So,this.svc=new yo({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new So,this.svc=new yo({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Xt(this.options),this.svc=new yo({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(Pt.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(Pt.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(Pt.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(Pt.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(Pt.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(Pt.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(Pt.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(Pt.caseCancelled,{reason:Ms.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(Pt.caseSolved,{reason:Ms.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(Pt.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Ds.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Ds.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){var r,n;let o=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:o,language:(r=this.provider)===null||r===void 0?void 0:r.getLanguage(),anonymous:(n=this.provider)===null||n===void 0?void 0:n.getIsAnonymous(),clientId:yield this.getClientId()})})}getClientId(){return this.coveoAnalyticsClient instanceof Xt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,o,i;return{originContext:(r=(t=this.provider)===null||t===void 0?void 0:t.getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:(n=this.provider)===null||n===void 0?void 0:n.getOriginLevel1(),originLevel2:(o=this.provider)===null||o===void 0?void 0:o.getOriginLevel2(),originLevel3:(i=this.provider)===null||i===void 0?void 0:i.getOriginLevel3()}}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){var i,a;let s=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:(a=(i=this.provider)===null||i===void 0?void 0:i.getSearchUID())!==null&&a!==void 0?a:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(s)})}};var uh=e=>new Xt(e).getCurrentVisitorId(),qi=(e,t)=>typeof t=="function"?(...r)=>{let n=mi(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,ji=(e,t)=>(...r)=>{let n=mi(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function qs(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function lh(e){let{activeValue:t,ancestryMap:r}=RR(e);return t?IR(t,r):[]}function RR(e){let t=[...e],r=new Map;for(;t.length>0;){let n=t.shift();if(n.state==="selected")return{activeValue:n,ancestryMap:r};if(r)for(let o of n.children)r.set(o,n);t.unshift(...n.children)}return{}}function IR(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var TR=(e,t)=>e.categoryFacetSet[t]?.request;var Md=(e,t)=>{let r=TR(e,t);return lh(r?.currentValues??[])};m();d();f();p();function js(){return{}}m();d();f();p();function Us(){return{}}m();d();f();p();function Vs(){return{}}m();d();f();p();function Gs(){return{}}function Ld(e){return{facetSet:e.facetSet??Gs(),categoryFacetSet:e.categoryFacetSet??js(),dateFacetSet:e.dateFacetSet??Us(),numericFacetSet:e.numericFacetSet??Vs(),automaticFacetSet:e.automaticFacetSet??qs()}}var qd=e=>{let t=[];return OR(e).forEach((r,n)=>{let o=jR(e,r.facetId),i=LR(r,n+1);if(kR(r)){if(!!!Md(e,r.facetId).length)return;t.push({...i,...DR(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((a,s)=>{if(a.state==="idle")return;let u=dh(a,s+1,o),c=_R(r)?ph(a):NR(a);t.push({...i,...u,...c})})}),PR(e).forEach((r,n)=>{let o=MR(r,n+1);r.values.forEach((i,a)=>{if(i.state==="idle")return;let s=dh(i,a+1,"specific"),u=ph(i);t.push({...o,...s,...u})})}),t},_R=e=>e.type==="specific",kR=e=>e.type==="hierarchical",OR=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),PR=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),dh=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),NR=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),ph=e=>({displayValue:e.value,value:e.value}),FR=(e,t)=>Md(e,t).map(n=>n.value).join(";"),DR=(e,t)=>{let n=FR(e,t);return{value:n,valuePosition:1,displayValue:n}},MR=(e,t)=>({title:fh(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),LR=(e,t)=>({title:fh(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),fh=(e,t)=>`${e}_${t}`,qR=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,jR=(e,t)=>{let r=qR(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var jd=e=>e.configuration.search.locale,mh=e=>e.configuration.search.timezone,gh=e=>e.configuration.accessToken,hh=e=>e.configuration.organizationId,yh=e=>e.configuration.environment,Bs=e=>e.configuration?.knowledge?.agentId,vh=e=>e.configuration.knowledge.debugAgentSession;var je=e=>{if(UR(e)||Ud(e))return e.generatedAnswer?.answerId;if(VR(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},UR=e=>"answer"in e&&"generatedAnswer"in e&&!ce(e.generatedAnswer?.answerConfigurationId),Ud=e=>{let t=Bs(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},VR=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Vd=e=>e.generatedAnswer?.fieldsToIncludeInCitations,kr=e=>e.followUpAnswers?.conversationId,GR=e=>e.generatedAnswer?.citations,BR=e=>e.followUpAnswers?.followUpAnswers,$R=ze(BR,e=>e?.flatMap(t=>t.citations)),QR=(e,t)=>t,bo=ze(GR,$R,QR,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));m();d();f();p();var Et=()=>({q:"",enableQuerySyntax:!1});m();d();f();p();m();d();f();p();var Sh=(r=>(r.Ascending="ascending",r.Descending="descending",r))(Sh||{}),bh=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(bh||{}),Gd=e=>{if(hm(e))return e.map(t=>Gd(t)).join(",");switch(e.by){case"relevancy":case"qre":case"nosort":return e.by;case"date":return`date ${e.order}`;case"field":return`@${e.field} ${e.order}`;default:return""}},Ah=()=>({by:"relevancy"});var xV=new re({values:{by:new Fl({enum:bh,required:!0}),order:new Fl({enum:Sh}),field:new H}});function $s(){return Gd(Ah())}m();d();f();p();m();d();f();p();var Ao=()=>"default";var HR=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},mr=class{constructor(t){ue(this,"getState",t);ue(this,"state");this.state=t()}getLanguage(){return HR(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[i,a]of Object.entries(n)){let s=`context_${i}`;o[s]=a}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=so),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||Ao()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};var Ui=class Ui extends mr{constructor(){super(...arguments);ue(this,"getFacetRequest",r=>this.state.facetSet?.[r]?.request||this.state.categoryFacetSet?.[r]?.request||this.state.dateFacetSet?.[r]?.request||this.state.numericFacetSet?.[r]?.request||this.state.automaticFacetSet?.set[r]?.response)}getFacetState(){return qd(Ld(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Ui.fallbackPipelineName}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.resultURIs,numberOfResults:this.numberOfResults}}getSearchUID(){let r=this.getState();return r.search?.searchResponseId||r.search?.response.searchUid||Ht().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Ui.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=je(r);return o&&(n.generativeQuestionAnsweringId=o),n}getFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetValue:n,facetTitle:`${i}_${r}`}}getFacetClearAllMetadata(r){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetTitle:`${o}_${r}`}}getFacetUpdateSortMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,criteria:n,facetTitle:`${i}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${i}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??$s()}}getStaticFilterToggleMetadata(r,n){return{...this.getBaseMetadata(),staticFilterId:r,staticFilterValue:n}}getStaticFilterClearAllMetadata(r){return{...this.getBaseMetadata(),staticFilterId:r}}getUndoTriggerQueryMetadata(r){return{...this.getBaseMetadata(),undoneQuery:r}}getCategoryBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:i,categoryFacetPath:n,categoryFacetTitle:`${i}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let o=this.state.querySuggest?.[r],i=o.completions.map(c=>c.expression),a=o.partialQueries.length-1,s=o.partialQueries[a]||"",u=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(n),partialQuery:s,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:i.length>0?i:"",querySuggestResponseId:u}}getInterfaceChangeMetadata(){return{...this.getBaseMetadata(),interfaceChangeTo:this.state.configuration.analytics.originLevel2}}getOmniboxFromLinkMetadata(r){return{...this.getBaseMetadata(),...r}}getGeneratedAnswerMetadata(){let r=this.getState(),n={};return r.generatedAnswer?.isVisible!==void 0&&(n.showGeneratedAnswer=r.generatedAnswer.isVisible),n}get resultURIs(){return this.results?.map(r=>({documentUri:r.uri,documentUriHash:r.raw.urihash}))}get results(){return this.state.search?.response.results}get queryText(){return this.state.query?.q||Et().q}get responseTime(){return this.state.search?.duration||Ht().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Ht().response.totalCountFiltered}};ue(Ui,"fallbackPipelineName","default");var Or=Ui,wh=({logger:e,getState:t,analyticsClientMiddleware:r=(a,s)=>s,preprocessRequest:n,provider:o,disableBrowserPrivacySignals:i})=>{let a=t(),s=a.configuration.accessToken,u=a.configuration.analytics.apiBaseUrl??kt(a.configuration.organizationId,a.configuration.environment,"analytics"),c=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,v=new Ns({token:s,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:qi(e,n),beforeSendHooks:[ji(e,r),(R,h)=>(e.info({...h,type:R,endpoint:u,token:s},"Analytics request"),h)]},o);return g||v.disable(),v},Bd=()=>{let t=ht.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};var Qs=/*#__PURE__*/function(){var _Qs=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield uh(e),clientTimestamp:new Date().toISOString(),documentReferrer:e.originLevel3,originContext:e.originContext,...(t&&{actionCause:t.actionCause,customData:t.customData}),...(t&&!r&&{customData:t.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.documentLocation&&{documentLocation:e.documentLocation}),...(e.deviceId&&{deviceId:e.deviceId}),...(Bd()&&{pageId:Bd()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:mo(e)})}}});function Qs(_x17,_x18){return _Qs.apply(this,arguments)}return Qs}();m();d();f();p();m();d();f();p();m();d();f();p();var wo=()=>({duration:0,error:null,isLoading:!1,id:"Recommendation",recommendations:[],searchUid:"",splitTestRun:"",pipeline:""});var Vi=class extends mr{getPipeline(){return this.state.pipeline||this.state.recommendation?.pipeline||"default"}getSearchEventRequestPayload(){return{queryText:Et().q,responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getSearchUID(){return this.getState().recommendation?.searchUid||wo().searchUid}getSplitTestRunName(){return this.state.recommendation?.splitTestRun}getSplitTestRunVersion(){let t=!!this.getSplitTestRunName(),r=this.state.recommendation?.pipeline||this.state.pipeline||"default";return t?r:void 0}get responseTime(){return this.state.recommendation?.duration||wo().duration}mapResultsToAnalyticsDocument(){return this.state.recommendation?.recommendations.map(t=>({documentUri:t.uri,documentUriHash:t.raw.urihash}))}get numberOfResults(){return this.state.recommendation?.recommendations.length||wo().recommendations.length}};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function xh(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}m();d();f();p();m();d();f();p();m();d();f();p();var Ch=/^(?:[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 zR(e){return typeof e=="string"&&Ch.test(e)}var $d=zR;m();d();f();p();var it=[];for(let e=0;e<256;++e)it.push((e+256).toString(16).slice(1));function Eh(e,t=0){return(it[e[t+0]]+it[e[t+1]]+it[e[t+2]]+it[e[t+3]]+"-"+it[e[t+4]]+it[e[t+5]]+"-"+it[e[t+6]]+it[e[t+7]]+"-"+it[e[t+8]]+it[e[t+9]]+"-"+it[e[t+10]]+it[e[t+11]]+it[e[t+12]]+it[e[t+13]]+it[e[t+14]]+it[e[t+15]]).toLowerCase()}m();d();f();p();var WR=new Uint8Array(16);function Qd(){return crypto.getRandomValues(WR)}m();d();f();p();function KR(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():YR(e,t,r)}function YR(e,t,r){e=e||{};let n=e.random??e.rng?.()??Qd();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 Eh(n)}var Hd=KR;function XR(_x19){return _XR.apply(this,arguments)}function _XR(){_XR=_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 _XR.apply(this,arguments)}var Oh="2.1.3",zd=128,Ph=192,Rh=224,Ih=240,ZR=248;function JR(e){return(e&ZR)===Ih?4:(e&Ih)===Rh?3:(e&Rh)===Ph?2:1}function eI(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&zd)!=zd)break;if(r-=3,(n&Ph)!=zd){t-r>=JR(n)*3&&(r=t);break}}return e.substring(0,r)}function tI(e){let{trackingId:t}=e;return{trackingId:t}}function rI(e){return(e.source||[]).concat([`relay@${Oh}`])}function Nh(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,a=tI(t),s=r.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:rI(t),clientId:s,userAgent:i(),referrer:Th(n()),location:Th(o())})}function Th(e){return e!==null?eI(e,1024):null}function nI(e,t,r,n){return{...t,meta:Nh(e,r,n)}}var oI="*";function iI(){let e=[];function t({type:u,callback:c}){return e.findIndex(g=>g.type===u&&g.callback===c)}function r(u,c){return u.type==="*"||c===u.type}function n(u){return t(u)<0&&e.push(u),()=>s(u.type,u.callback)}function o(u){e.forEach(c=>{if(r(c,u.meta.type))try{c.callback(u)}catch(g){console.error(g)}})}function i(u){if(u===oI)e.length=0;else for(let c=e.length-1;c>=0;c--)e[c].type===u&&e.splice(c,1)}function a(u){let c=t(u);c>=0&&e.splice(c,1)}function s(u,c){c?a({type:u,callback:c}):i(u)}return{add:n,call:o,remove:s}}function _h({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 aI(e){let t=_h(e);return{get:()=>t,update:r=>{t=_h({...t,...r})}}}var Wd=sI();function sI(){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()}`,s=i?`;domain=${i}`:"";document.cookie=`${e}${r}=${n}${a}${s};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function cI(){return{getItem(e){return Wd.getItem(e)||localStorage.getItem(e)},removeItem(e){Wd.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Wd.setItem(e,t,31556952e3)}}}var kh="visitorId";function uI(){let e=document.referrer;return e===""?null:e}function Kd(){let e=cI();return{runtime:"browser",send:function(){var _send=_asyncToGenerator(function*(t,r,n){let o=C(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});xh().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let a=yield o;if(a?.ok){let s;try{s=yield a.json()}catch{return}for(let u of s.events)if(!u.accepted)throw new Error(`Received event was rejected for processing: ${u.errorMessage}`)}else throw new Error(`Error ${a.status}: Failed to send the event(s).`)});function send(_x20,_x21,_x22){return _send.apply(this,arguments)}return send}(),getReferrer:()=>uI(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(kh);if(t&&$d(t))return t;let r=Hd();return e.setItem(kh,r),r}}}function lI(){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 dI(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function pI(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=dI();return t&&r?{...r,runtime:"custom"}:t&&fI()&&lI()?Kd():n}function fI(){try{return typeof window=="object"}catch{return!1}}function mI(e){return{get:()=>Object.freeze(pI(e))}}function Fh(e){let t=aI(e),r=iI(),n=mI(t);return{emit:function(){var _emit=_asyncToGenerator(function*(o,i){let a=t.get(),s=n.get(),u=nI(o,i,a,s);return XR({config:a,environment:s,event:u,listenerManager:r})});function emit(_x23,_x24){return _emit.apply(this,arguments)}return emit}(),getMeta:o=>Nh(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:Oh}}m();d();f();p();function Dh(){return typeof window<"u"&&typeof document<"u"}var gI=50,hI=rs({memoize:cd,memoizeOptions:{maxSize:gI}}),Gi=hI(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>mo(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},a,s)=>{let u=vI(s);return Fh({mode:i?"emit":"disabled",url:o??Fa(e,t),token:r,trackingId:n??null,source:a,environment:u})}),yI={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _send2=_asyncToGenerator(function*(){});function send(){return _send2.apply(this,arguments)}return send}()},vI=e=>{if(!e)return;let t=e();return{...(Dh()?Kd():yI),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();var Bi=class extends mr{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Mh=({logger:e,getState:t,analyticsClientMiddleware:r=(a,s)=>s,preprocessRequest:n,provider:o=new Bi(t),disableBrowserPrivacySignals:i})=>{let a=t(),s=a.configuration.accessToken,u=a.configuration.analytics.apiBaseUrl??kt(a.configuration.organizationId,a.configuration.environment,"analytics"),c=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,v=new Ls({enableAnalytics:g,token:s,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:qi(e,n),beforeSendHooks:[ji(e,r),(R,h)=>(e.info({...h,type:R,endpoint:u,token:s},"Analytics request"),h)]},o);return g||v.disable(),v};m();d();f();p();m();d();f();p();function qh(e,t){return{...new Or(t).getBaseMetadata(),actionCause:e,type:e}}function SI(e){return Object.assign(e,{instantlyCallable:!0})}function bI(e,t){let r=i=>{let a=ke(e,i);return SI(Object.assign(a,{type:a.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref6=_asyncToGenerator(function*(i,{getState:a,extra:s}){let{analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:v}=s;return yield(yield t({getState:a,analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:v})).log({state:a(),extra:s})});return function(_x25,_x26){return _ref6.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _prepare=_asyncToGenerator(function*({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:u,disableBrowserPrivacySignals:c}){let{description:g,log:v}=yield t({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:u,disableBrowserPrivacySignals:c});return{description:g,action:r(/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(R,{getState:h,extra:y}){return yield v({state:h(),extra:y})});return function(_x28,_x29){return _ref7.apply(this,arguments)}}())}});function prepare(_x27){return _prepare.apply(this,arguments)}return prepare}()}),n}var jh=(e,t,r)=>{function n(...o){let i=o.length===1?{...o[0],__legacy__getBuilder:t(o[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:r}:{prefix:o[0],__legacy__getBuilder:t(o[1]),__legacy__provider:o[2],analyticsConfigurator:e,providerClass:r};return xI(i)}return n},AI=e=>e.configuration.analytics.analyticsMode==="legacy",wI=e=>e.configuration.analytics.analyticsMode==="next",xI=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:a})=>(r??(r=s=>new a(s)),bI(e,/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*({getState:s,analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:v}){let R=[],h={log:function(){var _log=_asyncToGenerator(function*({state:N}){for(let _ of R)yield _(N)});function log(_x31){return _log.apply(this,arguments)}return log}()},y=s(),b=i({getState:s,logger:g,analyticsClientMiddleware:u,preprocessRequest:c,disableBrowserPrivacySignals:v,provider:r(s)}),x=yield t(b,s());h.description=x?.description,R.push(/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(N){AI(N)&&(yield CI(x,r,N,g,b.coveoAnalyticsClient))});return function(_x32){return _ref9.apply(this,arguments)}}());let{emit:I}=Gi(y);return R.push(/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(N){if(wI(N)&&o&&n){let _=n(N);yield OI(I,o,_)}});return function(_x33){return _ref0.apply(this,arguments)}}()),h});return function(_x30){return _ref8.apply(this,arguments)}}()));function CI(_x34,_x35,_x36,_x37,_x38){return _CI.apply(this,arguments)}function _CI(){_CI=_asyncToGenerator(function*(e,t,r,n,o){t(()=>r);let i=yield e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:o,response:i},"Analytics response")});return _CI.apply(this,arguments)}var EI=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _log2=_asyncToGenerator(function*(i){r(n,o)});function log(_x39){return _log2.apply(this,arguments)}return log}()}),De=jh(e=>wh({...e,provider:e.provider||new Or(e.getState)}),e=>e,Or),IB=jh(Mh,EI("caseAssist"),Bi);var Yd=(e,t)=>{let r=t.recommendation?.recommendations.findIndex(({uniqueId:n})=>e.uniqueId===n)||0;return RI(e,r,t)},Uh=(e,t)=>({sourceName:Gh(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Tr()}),Vh=(e,t)=>({sourceName:Gh(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Tr()});function Gh(e){let t=e.source;return ce(t)?"unknown":t}var Bh=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function RI(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:_I(e),...(Lh(e)?{documentCategory:Lh(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:kI(e),queryPipeline:r.pipeline||Tr()}}function Lh(e){return e.raw?.objecttype||void 0}var Hs=e=>(e.raw.permanentid||console.warn("Missing field permanentid on result. This might cause many issues with your Coveo deployment. See https://docs.coveo.com/en/1913 and https://docs.coveo.com/en/1640 for more information.",e),{contentIDKey:"permanentid",contentIDValue:e.raw.permanentid||""}),$h={urihash:new H,sourcetype:new H,permanentid:new H},Qh={uniqueId:Y,raw:new re({values:$h}),title:Y,uri:Y,clickUri:Y,rankingModifier:new H({required:!1,emptyAllowed:!0})};function II(e){return Object.assign({},...Object.keys($h).map(t=>({[t]:e[t]})))}function TI(e){return Object.assign({},...Object.keys(Qh).map(t=>({[t]:e[t]})),{raw:II(e.raw)})}function _I(e){let t=e.raw.author;return ce(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function kI(e){let t=e.raw.source;return ce(t)?"unknown":t}var Xd=e=>new yt(Qh).validate(TI(e));function OI(_x40,_x41,_x42){return _OI.apply(this,arguments)}function _OI(){_OI=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _OI.apply(this,arguments)}m();d();f();p();var Hh=()=>De("analytics/recommendation/update",e=>e.makeRecommendationInterfaceLoad(),e=>new Vi(e)),zh=()=>({actionCause:"recommendationInterfaceLoad"}),Ws=e=>De({prefix:"analytics/recommendation/open",__legacy__getBuilder:(t,r)=>(Xd(e),t.makeRecommendationOpen(Yd(e,r),Hs(e))),__legacy__provider:t=>new Vi(t),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=Yd(e,t),n=Hs(e);return{responseId:e.searchUid??"",position:r.documentPosition,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.documentTitle,author:r.documentAuthor,url:r.documentUrl}}}});var xo=L("recommendation/set",e=>V(e,{id:Y})),Pr=ke("recommendation/get",/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=Date.now(),a=yield PI(o),s=yield n.recommendations(a),u=Date.now()-i;return vt(s)?r(s.error):{recommendations:s.success.results,analyticsAction:Hh(),duration:u,searchUid:s.success.searchUid,splitTestRun:s.success.splitTestRun,pipeline:s.success.pipeline}});return function(_x43,_x44){return _ref1.apply(this,arguments)}}()),PI=/*#__PURE__*/function(){var _PI=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??wr(e.configuration.organizationId,e.configuration.environment),recommendation:e.recommendation.id,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,locale:e.configuration.search.locale,actionsHistory:e.configuration.analytics.enabled?ht.getInstance().getHistory():[],...(e.advancedSearchQueries&&{aq:e.advancedSearchQueries.aq,cq:e.advancedSearchQueries.cq}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.context&&{context:e.context.contextValues}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.configuration.analytics.enabled&&(yield NI(e,zh()))),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}),...(e.pagination&&{numberOfResults:e.pagination.numberOfResults})}});function PI(_x45){return _PI.apply(this,arguments)}return PI}(),NI=/*#__PURE__*/function(){var _NI=_asyncToGenerator(function*(e,t){let r=e.configuration.analytics.analyticsMode==="legacy"?void 0:{actionCause:t.actionCause,type:t.actionCause};return yield Qs(e.configuration.analytics,r)});function NI(_x46,_x47){return _NI.apply(this,arguments)}return NI}();var Co=Be(wo(),e=>{e.addCase(xo,(t,r)=>{t.id=r.payload.id}).addCase(Pr.rejected,(t,r)=>{t.error=r.payload?r.payload:null,t.isLoading=!1}).addCase(Pr.fulfilled,(t,r)=>{t.error=null,t.recommendations=r.payload.recommendations.map(n=>({...n,searchUid:r.payload.searchUid})),t.duration=r.payload.duration,t.isLoading=!1,t.searchUid=r.payload.searchUid,t.splitTestRun=r.payload.splitTestRun,t.pipeline=r.payload.pipeline}).addCase(Pr.pending,t=>{t.isLoading=!0}).addCase(Ss,(t,r)=>{t.error=r.payload,t.isLoading=!1})});m();d();f();p();var Eo=L("searchHub/set",e=>V(e,new H({required:!0,emptyAllowed:!0})));m();d();f();p();var Ro=Be(Ao(),e=>{e.addCase(Eo,(t,r)=>r.payload).addCase(St.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Kt,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Wh=class extends Error{constructor(t){super(t[0].message);ue(this,"issues");this.name="SchemaError",this.issues=t}};var sp="uninitialized",ep="pending",tp="fulfilled",rp="rejected";function Kh(e){return{status:e,isUninitialized:e===sp,isLoading:e===ep,isSuccess:e===tp,isError:e===rp}}var Yh=zt;function ly(e,t){if(e===t||!(Yh(e)&&Yh(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),o=r.length===n.length,i=Array.isArray(t)?[]:{};for(let a of r)i[a]=ly(e[a],t[a]),o&&(o=e[a]===i[a]);return o?e:i}function np(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function FI(e){return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function DI(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function cp(e){return e!=null}function Xh(e){return[...(e?.values()??[])].filter(cp)}function MI(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var LI=e=>e.replace(/\/$/,""),qI=e=>e.replace(/^\//,"");function jI(e,t){if(!e)return t;if(!t)return e;if(FI(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=LI(e),t=qI(t),`${e}${r}${t}`}function Zs(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var op=()=>new Map,UI=e=>{let t=new l.AbortController;return setTimeout(()=>{let r="signal timed out",n="TimeoutError";t.abort(typeof DOMException<"u"?new DOMException(r,n):Object.assign(new Error(r),{name:n}))},e),t.signal},VI=(...e)=>{for(let r of e)if(r.aborted)return l.AbortSignal.abort(r.reason);let t=new l.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},Zh=(...e)=>C(...e),GI=e=>e.status>=200&&e.status<=299,BI=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Jh(e){if(!zt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var $I=e=>typeof e=="object"&&(zt(e)||Array.isArray(e)||typeof e.toJSON=="function");function dy({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=Zh,paramsSerializer:n,isJsonContentType:o=BI,jsonContentType:i="application/json",jsonReplacer:a,timeout:s,responseHandler:u,validateStatus:c,...g}={}){return typeof C>"u"&&r===Zh&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(R,h,y){let{getState:b,extra:x,endpoint:I,forced:N,type:_}=h,P,{url:w,headers:O=new E(g.headers),params:k=void 0,responseHandler:T=u??"json",validateStatus:D=c??GI,timeout:G=s,...M}=typeof R=="string"?{url:R}:R,q={...g,signal:G?VI(h.signal,UI(G)):h.signal,...M};O=new E(Jh(O)),q.headers=(yield t(O,{getState:b,arg:R,extra:x,endpoint:I,forced:N,type:_,extraOptions:y}))||O;let B=$I(q.body);if(q.body!=null&&!B&&typeof q.body!="string"&&q.headers.delete("content-type"),!q.headers.has("content-type")&&B&&q.headers.set("content-type",i),B&&o(q.headers)&&(q.body=JSON.stringify(q.body,a)),q.headers.has("accept")||(T==="json"?q.headers.set("accept","application/json"):T==="text"&&q.headers.set("accept","text/plain, text/html, */*")),k){let Z=~w.indexOf("?")?"&":"?",se=n?n(k):new URLSearchParams(Jh(k));w+=Z+se}w=jI(e,w);let j=new Request(w,q);P={request:new Request(w,q)};let W;try{W=yield r(j)}catch(Z){return{error:{status:(Z instanceof Error||typeof DOMException<"u"&&Z instanceof DOMException)&&Z.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(Z)},meta:P}}let Q=W.clone();P.response=Q;let X,z="";try{let Z;if(yield Promise.all([v(W,T).then(se=>X=se,se=>Z=se),Q.text().then(se=>z=se,()=>{})]),Z)throw Z}catch(Z){return{error:{status:"PARSING_ERROR",originalStatus:W.status,data:z,error:String(Z)},meta:P}}return D(W,X)?{data:X,meta:P}:{error:{status:W.status,data:X},meta:P}});return function(_x48,_x49,_x50){return _ref10.apply(this,arguments)}}());function v(_x51,_x52){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(R,h){if(typeof h=="function")return h(R);if(h==="content-type"&&(h=o(R.headers)?"json":"text"),h==="json"){let y=yield R.text();return y.length?JSON.parse(y):null}return R.text()});return _v2.apply(this,arguments)}}var Io=class{constructor(e,t=void 0){ue(this,"value");ue(this,"meta");this.value=e,this.meta=t}};function QI(){return _QI.apply(this,arguments)}function _QI(){_QI=_asyncToGenerator(function*(e=0,t=5,r){let n=Math.min(e,t),o=~~((Math.random()+.4)*(300<<n));yield new Promise((i,a)=>{let s=setTimeout(()=>i(),o);if(r){let u=()=>{clearTimeout(s),a(new Error("Aborted"))};r.aborted?(clearTimeout(s),a(new Error("Aborted"))):r.addEventListener("abort",u,{once:!0})}})});return _QI.apply(this,arguments)}function py(e,t){throw Object.assign(new Io({error:e,meta:t}),{throwImmediately:!0})}function Zd(e){e.aborted&&py({status:"CUSTOM_ERROR",error:"Aborted"})}var ey={},HI=(e,t)=>(/*#__PURE__*/function(){var _ref11=_asyncToGenerator(function*(r,n,o){let[i]=[5,(t||ey).maxRetries,(o||ey).maxRetries].filter(c=>c!==void 0).slice(-1),s={maxRetries:i,backoff:QI,retryCondition:(c,g,{attempt:v})=>v<=i,...t,...o},u=0;for(;;){Zd(n.signal);try{let c=yield e(r,n,o);if(c.error)throw new Io(c);return c}catch(c){if(u++,c.throwImmediately){if(c instanceof Io)return c.value;throw c}if(c instanceof Io){if(!s.retryCondition(c.value.error,r,{attempt:u,baseQueryApi:n,extraOptions:o}))return c.value}else if(u>s.maxRetries)return{error:c};Zd(n.signal);try{yield s.backoff(u,s.maxRetries,n.signal)}catch(g){throw Zd(n.signal),g}}}});return function(_x53,_x54,_x55){return _ref11.apply(this,arguments)}}()),fy=Object.assign(HI,{fail:py}),ec="__rtkq/",zI="online",WI="offline";var my="focused";var up=L(`${ec}${my}`),gy=L(`${ec}un${my}`),lp=L(`${ec}${zI}`),hy=L(`${ec}${WI}`);var Wi="query",yy="mutation",vy="infinitequery";function tc(e){return e.type===Wi}function KI(e){return e.type===yy}function Qi(e){return e.type===vy}function Js(e){return tc(e)||Qi(e)}function dp(e,t,r,n,o,i){let a=YI(e)?e(t,r,n,o):e;return a?np(a,cp,s=>i(Sy(s))):[]}function YI(e){return typeof e=="function"}function Sy(e){return typeof e=="string"?{type:e}:e}function XI(e,t){return e.catch(t)}var To=(e,t)=>e.endpointDefinitions[t],Hi=Symbol("forceQueryFn"),ip=e=>typeof e[Hi]=="function";function ZI({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:a}){let s=w=>a(w)?.runningQueries,u=w=>a(w)?.runningMutations,{unsubscribeQueryResult:c,removeMutationResult:g,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:N,buildInitiateInfiniteQuery:_,buildInitiateMutation:P,getRunningQueryThunk:R,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:b};function R(w,O){return k=>{let T=e({queryArgs:O,endpointDefinition:To(i,w),endpointName:w});return s(k)?.get(T)}}function h(w,O){return k=>u(k)?.get(O)}function y(){return w=>Xh(s(w))}function b(){return w=>Xh(u(w))}function x(w){}function I(w,O){let k=(T,{subscribe:D=!0,forceRefetch:G,subscriptionOptions:M,[Hi]:q,...B}={})=>(j,W)=>{let Q=e({queryArgs:T,endpointDefinition:O,endpointName:w}),X,z={...B,type:Wi,subscribe:D,forceRefetch:G,subscriptionOptions:M,endpointName:w,originalArgs:T,queryCacheKey:Q,[Hi]:q};if(tc(O))X=t(z);else{let{direction:me,initialPageParam:we,refetchCachedPages:Se}=B;X=r({...z,direction:me,initialPageParam:we,refetchCachedPages:Se})}let Z=o.endpoints[w].select(T),se=j(X),ye=Z(W());let{requestId:_e,abort:Ge}=se,Fe=ye.requestId!==_e,Me=s(j)?.get(Q),Le=()=>Z(W()),ve=Object.assign(q?se.then(Le):Fe&&!Me?Promise.resolve(ye):Promise.all([Me,se]).then(Le),{arg:T,requestId:_e,subscriptionOptions:M,queryCacheKey:Q,abort:Ge,unwrap(){return _asyncToGenerator(function*(){let me=yield ve;if(me.isError)throw me.error;return me.data})()},refetch:me=>j(k(T,{subscribe:!1,forceRefetch:!0,...me})),unsubscribe(){D&&j(c({queryCacheKey:Q,requestId:_e}))},updateSubscriptionOptions(me){ve.subscriptionOptions=me,j(v({endpointName:w,requestId:_e,queryCacheKey:Q,options:me}))}});if(!Me&&!Fe&&!q){let me=s(j);me.set(Q,ve),ve.then(()=>{me.delete(Q)})}return ve};return k}function N(w,O){return I(w,O)}function _(w,O){return I(w,O)}function P(w){return(O,{track:k=!0,fixedCacheKey:T}={})=>(D,G)=>{let M=D(n({type:"mutation",endpointName:w,originalArgs:O,track:k,fixedCacheKey:T}));let{requestId:q,abort:B,unwrap:j}=M,W=XI(M.unwrap().then(Z=>({data:Z})),Z=>({error:Z})),Q=()=>{D(g({requestId:q,fixedCacheKey:T}))},X=Object.assign(W,{arg:M.arg,requestId:q,abort:B,unwrap:j,reset:Q}),z=u(D);return z.set(q,X),X.then(()=>{z.delete(q)}),T&&(z.set(T,X),X.then(()=>{z.get(T)===X&&z.delete(T)})),X}}}var by=class extends Wh{constructor(t,r,n,o){super(t);ue(this,"value");ue(this,"schemaName");ue(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},gn=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function hn(_x56,_x57,_x58,_x59){return _hn.apply(this,arguments)}function _hn(){_hn=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new by(o.issues,t,r,n);return o.value});return _hn.apply(this,arguments)}function ty(e){return e}var $i=(e={})=>({...e,[Pi]:!0});function JI({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:a,onSchemaFailure:s,catchSchemaFailure:u,skipSchemaValidation:c}){let g=(M,q,B,j)=>(W,Q)=>{let X=r[M],z=n({queryArgs:q,endpointDefinition:X,endpointName:M});if(W(o.internalActions.queryResultPatched({queryCacheKey:z,patches:B})),!j)return;let Z=o.endpoints[M].select(q)(Q()),se=dp(X.providesTags,Z.data,void 0,q,{},i);W(o.internalActions.updateProvidedBy([{queryCacheKey:z,providedTags:se}]))};function v(M,q,B=0){let j=[q,...M];return B&&j.length>B?j.slice(0,-1):j}function R(M,q,B=0){let j=[...M,q];return B&&j.length>B?j.slice(1):j}let h=(M,q,B,j=!0)=>(W,Q)=>{let X=o.endpoints[M].select(q)(Q()),z={patches:[],inversePatches:[],undo:()=>W(o.util.patchQueryData(M,q,z.inversePatches,j))};if(X.status==="uninitialized")return z;let Z;if("data"in X)if(lt(X.data)){let[se,ye,_e]=id(X.data,B);z.patches.push(...ye),z.inversePatches.push(..._e),Z=se}else Z=B(X.data),z.patches.push({op:"replace",path:[],value:Z}),z.inversePatches.push({op:"replace",path:[],value:X.data});return z.patches.length===0||W(o.util.patchQueryData(M,q,z.patches,j)),z},y=(M,q,B)=>j=>j(o.endpoints[M].initiate(q,{subscribe:!1,forceRefetch:!0,[Hi]:()=>({data:B})})),b=(M,q)=>M.query&&M[q]?M[q]:ty,x=/*#__PURE__*/function(){var _x62=_asyncToGenerator(function*(M,{signal:q,abort:B,rejectWithValue:j,fulfillWithValue:W,dispatch:Q,getState:X,extra:z}){let Z=r[M.endpointName],{metaSchema:se,skipSchemaValidation:ye=c}=Z,_e=M.type===Wi;try{let Ge=ty,Fe={signal:q,abort:B,dispatch:Q,getState:X,extra:z,endpoint:M.endpointName,type:M.type,forced:_e?I(M,X()):void 0,queryCacheKey:_e?M.queryCacheKey:void 0},Me=_e?M[Hi]:void 0,Le,ve=/*#__PURE__*/function(){var _ve=_asyncToGenerator(function*(we,Se,He,Ye){if(Se==null&&we.pages.length)return Promise.resolve({data:we});let Tt=yield me({queryArg:M.originalArgs,pageParam:Se}),xt=Ye?v:R;return{data:{pages:xt(we.pages,Tt.data,He),pageParams:xt(we.pageParams,Se,He)},meta:Tt.meta}});function ve(_x63,_x64,_x65,_x66){return _ve.apply(this,arguments)}return ve}();function me(_x67){return _me2.apply(this,arguments)}function _me2(){_me2=_asyncToGenerator(function*(we){let Se,{extraOptions:He,argSchema:Ye,rawResponseSchema:Tt,responseSchema:xt}=Z;if(Ye&&!gn(ye,"arg")&&(we=yield hn(Ye,we,"argSchema",{})),Me?Se=Me():Z.query?(Ge=b(Z,"transformResponse"),Se=yield t(Z.query(we),Fe,He)):Se=yield Z.queryFn(we,Fe,He,ir=>t(ir,Fe,He)),typeof process<"u",Se.error)throw new Io(Se.error,Se.meta);let{data:qt}=Se;Tt&&!gn(ye,"rawResponse")&&(qt=yield hn(Tt,Se.data,"rawResponseSchema",Se.meta));let _t=yield Ge(qt,Se.meta,we);return xt&&!gn(ye,"response")&&(_t=yield hn(xt,_t,"responseSchema",Se.meta)),{...Se,data:_t}});return _me2.apply(this,arguments)}if(_e&&"infiniteQueryOptions"in Z){let{infiniteQueryOptions:we}=Z,{maxPages:Se=1/0}=we,He=M.refetchCachedPages??we.refetchCachedPages??!0,Ye,Tt={pages:[],pageParams:[]},xt=a.selectQueryEntry(X(),M.queryCacheKey)?.data,qt=I(M,X())&&!M.direction||!xt?Tt:xt;if("direction"in M&&M.direction&&qt.pages.length){let _t=M.direction==="backward";Ye=yield ve(qt,(_t?ap:Xs)(we,qt,M.originalArgs),Se,_t)}else{let{initialPageParam:_t=we.initialPageParam}=M,ir=xt?.pageParams??[],xl=ir[0]??_t,zf=ir.length;if(Ye=yield ve(qt,xl,Se),Me&&(Ye={data:Ye.data.pages[0]}),He)for(let Wf=1;Wf<zf;Wf++){let vw=Xs(we,Ye.data,M.originalArgs);Ye=yield ve(Ye.data,vw,Se)}}Le=Ye}else Le=yield me(M.originalArgs);return se&&!gn(ye,"meta")&&Le.meta&&(Le.meta=yield hn(se,Le.meta,"metaSchema",Le.meta)),W(Le.data,$i({fulfilledTimeStamp:Date.now(),baseQueryMeta:Le.meta}))}catch(Ge){let Fe=Ge;if(Fe instanceof Io){let Me=b(Z,"transformErrorResponse"),{rawErrorResponseSchema:Le,errorResponseSchema:ve}=Z,{value:me,meta:we}=Fe;try{Le&&!gn(ye,"rawErrorResponse")&&(me=yield hn(Le,me,"rawErrorResponseSchema",we)),se&&!gn(ye,"meta")&&(we=yield hn(se,we,"metaSchema",we));let Se=yield Me(me,we,M.originalArgs);return ve&&!gn(ye,"errorResponse")&&(Se=yield hn(ve,Se,"errorResponseSchema",we)),j(Se,$i({baseQueryMeta:we}))}catch(Se){Fe=Se}}try{if(Fe instanceof by){let Me={endpoint:M.endpointName,arg:M.originalArgs,type:M.type,queryCacheKey:_e?M.queryCacheKey:void 0};Z.onSchemaFailure?.(Fe,Me),s?.(Fe,Me);let{catchSchemaFailure:Le=u}=Z;if(Le)return j(Le(Fe,Me),$i({baseQueryMeta:Fe._bqMeta}))}}catch(Me){Fe=Me}throw typeof process<"u",console.error(Fe),Fe}});function x(_x60,_x61){return _x62.apply(this,arguments)}return x}();function I(M,q){let B=a.selectQueryEntry(q,M.queryCacheKey),j=a.selectConfig(q).refetchOnMountOrArgChange,W=B?.fulfilledTimeStamp,Q=M.forceRefetch??(M.subscribe&&j);return Q?Q===!0||(Number(new Date)-Number(W))/1e3>=Q:!1}let N=()=>ke(`${e}/executeQuery`,x,{getPendingMeta({arg:M}){let q=r[M.endpointName];return $i({startedTimeStamp:Date.now(),...(Qi(q)?{direction:M.direction}:{})})},condition(M,{getState:q}){let B=q(),j=a.selectQueryEntry(B,M.queryCacheKey),W=j?.fulfilledTimeStamp,Q=M.originalArgs,X=j?.originalArgs,z=r[M.endpointName],Z=M.direction;if(ip(M))return!0;if(j?.status==="pending")return!1;if(I(M,B)||tc(z)&&z?.forceRefetch?.({currentArg:Q,previousArg:X,endpointState:j,state:B}))return!0;if(W&&!Z)return!1;if(Z&&Qi(z)){let se=j?.data;if(se?.pages.length){let{infiniteQueryOptions:ye}=z;if((Z==="forward"?Xs:ap)(ye,se,Q)==null)return!1}}return!0},dispatchConditionRejection:!0}),_=N(),P=N(),w=ke(`${e}/executeMutation`,x,{getPendingMeta(){return $i({startedTimeStamp:Date.now()})}}),O=M=>"force"in M,k=M=>"ifOlderThan"in M,T=(M,q,B={})=>(j,W)=>{let Q=O(B)&&B.force,X=k(B)&&B.ifOlderThan,z=(se=!0)=>{let ye={forceRefetch:se,subscribe:!1};return o.endpoints[M].initiate(q,ye)},Z=o.endpoints[M].select(q)(W());if(Q)j(z());else if(X){let se=Z?.fulfilledTimeStamp;if(!se){j(z());return}(Number(new Date)-Number(new Date(se)))/1e3>=X&&j(z())}else j(z(!1))};function D(M){return q=>q?.meta?.arg?.endpointName===M}function G(M,q){return{matchPending:io(cs(M),D(q)),matchFulfilled:io(lr(M),D(q)),matchRejected:io(ln(M),D(q))}}return{queryThunk:_,mutationThunk:w,infiniteQueryThunk:P,prefetch:T,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:G}}function Xs(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function ap(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function Ay(e,t,r,n){return dp(r[e.meta.arg.endpointName][t],lr(e)?e.payload:void 0,Fi(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function ry(e){return gt(e)?es(e):e}function Ks(e,t,r){let n=e[t];n&&r(n)}function zi(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function ny(e,t,r){let n=e[zi(t)];n&&r(n)}var Ys={};function eT({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:a,hasRehydrationInfo:s},assertTagType:u,config:c}){let g=L(`${e}/resetApiState`);function v(k,T,D,G){var M;k[M=T.queryCacheKey]??(k[M]={status:sp,endpointName:T.endpointName}),Ks(k,T.queryCacheKey,q=>{q.status=ep,q.requestId=D&&q.requestId?q.requestId:G.requestId,T.originalArgs!==void 0&&(q.originalArgs=T.originalArgs),q.startedTimeStamp=G.startedTimeStamp;let B=o[G.arg.endpointName];Qi(B)&&"direction"in T&&(q.direction=T.direction)})}function R(k,T,D,G){Ks(k,T.arg.queryCacheKey,M=>{if(M.requestId!==T.requestId&&!G)return;let{merge:q}=o[T.arg.endpointName];if(M.status=tp,q){if(M.data!==void 0){let{fulfilledTimeStamp:B,arg:j,baseQueryMeta:W,requestId:Q}=T;M.data=cn(M.data,X=>q(X,D,{arg:j.originalArgs,baseQueryMeta:W,fulfilledTimeStamp:B,requestId:Q}))}else M.data=D;}else M.data=o[T.arg.endpointName].structuralSharing??!0?ly(gt(M.data)?nd(M.data):M.data,D):D;delete M.error,M.fulfilledTimeStamp=T.fulfilledTimeStamp})}let h=dn({name:`${e}/queries`,initialState:Ys,reducers:{removeQueryResult:{reducer(k,{payload:{queryCacheKey:T}}){delete k[T]},prepare:ao()},cacheEntriesUpserted:{reducer(k,T){for(let D of T.payload){let{queryDescription:G,value:M}=D;v(k,G,!0,{arg:G,requestId:T.meta.requestId,startedTimeStamp:T.meta.timestamp}),R(k,{arg:G,requestId:T.meta.requestId,fulfilledTimeStamp:T.meta.timestamp,baseQueryMeta:{}},M,!0)}},prepare:k=>({payload:k.map(T=>{let{endpointName:D,arg:G,value:M}=T,q=o[D];return{queryDescription:{type:Wi,endpointName:D,originalArgs:T.arg,queryCacheKey:n({queryArgs:G,endpointDefinition:q,endpointName:D})},value:M}}),meta:{[Pi]:!0,requestId:Di(),timestamp:Date.now()}})},queryResultPatched:{reducer(k,{payload:{queryCacheKey:T,patches:D}}){Ks(k,T,G=>{G.data=ad(G.data,D.concat())})},prepare:ao()}},extraReducers(k){k.addCase(t.pending,(T,{meta:D,meta:{arg:G}})=>{v(T,G,ip(G),D)}).addCase(t.fulfilled,(T,{meta:D,payload:G})=>{R(T,D,G,ip(D.arg))}).addCase(t.rejected,(T,{meta:{condition:D,arg:G,requestId:M},error:q,payload:B})=>{Ks(T,G.queryCacheKey,j=>{if(!D){if(j.requestId!==M)return;j.status=rp,j.error=B??q}})}).addMatcher(s,(T,D)=>{let{queries:G}=a(D);for(let[M,q]of Object.entries(G))(q?.status==="fulfilled"||q?.status==="rejected")&&(T[M]=q)})}}),y=dn({name:`${e}/mutations`,initialState:Ys,reducers:{removeMutationResult:{reducer(k,{payload:T}){let D=zi(T);D in k&&delete k[D]},prepare:ao()}},extraReducers(k){k.addCase(r.pending,(T,{meta:D,meta:{requestId:G,arg:M,startedTimeStamp:q}})=>{M.track&&(T[zi(D)]={requestId:G,status:ep,endpointName:M.endpointName,startedTimeStamp:q})}).addCase(r.fulfilled,(T,{payload:D,meta:G})=>{G.arg.track&&ny(T,G,M=>{M.requestId===G.requestId&&(M.status=tp,M.data=D,M.fulfilledTimeStamp=G.fulfilledTimeStamp)})}).addCase(r.rejected,(T,{payload:D,error:G,meta:M})=>{M.arg.track&&ny(T,M,q=>{q.requestId===M.requestId&&(q.status=rp,q.error=D??G)})}).addMatcher(s,(T,D)=>{let{mutations:G}=a(D);for(let[M,q]of Object.entries(G))(q?.status==="fulfilled"||q?.status==="rejected")&&M!==q?.requestId&&(T[M]=q)})}}),b=dn({name:`${e}/invalidation`,initialState:{tags:{},keys:{}},reducers:{updateProvidedBy:{reducer(k,T){var D,G,M;for(let{queryCacheKey:q,providedTags:B}of T.payload){x(k,q);for(let{type:j,id:W}of B){let Q=(G=(D=k.tags)[j]??(D[j]={}))[M=W??"__internal_without_id"]??(G[M]=[]);Q.includes(q)||Q.push(q)}k.keys[q]=B}},prepare:ao()}},extraReducers(k){k.addCase(h.actions.removeQueryResult,(T,{payload:{queryCacheKey:D}})=>{x(T,D)}).addMatcher(s,(T,D)=>{var M,q,B;let{provided:G}=a(D);for(let[j,W]of Object.entries(G.tags??{}))for(let[Q,X]of Object.entries(W)){let z=(q=(M=T.tags)[j]??(M[j]={}))[B=Q??"__internal_without_id"]??(q[B]=[]);for(let Z of X)z.includes(Z)||z.push(Z),T.keys[Z]=G.keys[Z]}}).addMatcher(Wt(lr(t),Fi(t)),(T,D)=>{I(T,[D])}).addMatcher(h.actions.cacheEntriesUpserted.match,(T,D)=>{I(T,D.payload.map(({queryDescription:G,value:M})=>({type:"UNKNOWN",payload:M,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:G}})))})}});function x(k,T){let D=ry(k.keys[T]??[]);for(let G of D){let M=G.type,q=G.id??"__internal_without_id",B=k.tags[M]?.[q];B&&(k.tags[M][q]=ry(B).filter(j=>j!==T))}delete k.keys[T]}function I(k,T){let D=T.map(G=>{let M=Ay(G,"providesTags",o,u),{queryCacheKey:q}=G.meta.arg;return{queryCacheKey:q,providedTags:M}});b.caseReducers.updateProvidedBy(k,b.actions.updateProvidedBy(D))}let N=dn({name:`${e}/subscriptions`,initialState:Ys,reducers:{updateSubscriptionOptions(k,T){},unsubscribeQueryResult(k,T){},internal_getRTKQSubscriptions(){}}}),_=dn({name:`${e}/internalSubscriptions`,initialState:Ys,reducers:{subscriptionsUpdated:{reducer(k,T){return ad(k,T.payload)},prepare:ao()}}}),P=dn({name:`${e}/config`,initialState:{online:MI(),focused:DI(),middlewareRegistered:!1,...c},reducers:{middlewareRegistered(k,{payload:T}){k.middlewareRegistered=k.middlewareRegistered==="conflict"||i!==T?"conflict":!0}},extraReducers:k=>{k.addCase(lp,T=>{T.online=!0}).addCase(hy,T=>{T.online=!1}).addCase(up,T=>{T.focused=!0}).addCase(gy,T=>{T.focused=!1}).addMatcher(s,T=>({...T}))}}),w=rn({queries:h.reducer,mutations:y.reducer,provided:b.reducer,subscriptions:_.reducer,config:P.reducer});return{reducer:(k,T)=>w(g.match(T)?void 0:k,T),actions:{...P.actions,...h.actions,...N.actions,..._.actions,...y.actions,...b.actions,resetApiState:g}}}var Jd=Symbol.for("RTKQ/skipToken"),wy={status:sp},oy=cn(wy,()=>{}),iy=cn(wy,()=>{});function tT({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=_=>oy,o=_=>iy;return{buildQuerySelector:R,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:b,selectCachedArgsForQuery:x,selectApiState:a,selectQueries:s,selectMutations:c,selectQueryEntry:u,selectConfig:g};function i(_){return{..._,...Kh(_.status)}}function a(_){return _[t]}function s(_){return a(_)?.queries}function u(_,P){return s(_)?.[P]}function c(_){return a(_)?.mutations}function g(_){return a(_)?.config}function v(_,P,w){return O=>{if(O===Jd)return r(n,w);let k=e({queryArgs:O,endpointDefinition:P,endpointName:_});return r(D=>u(D,k)??oy,w)}}function R(_,P){return v(_,P,i)}function h(_,P){let{infiniteQueryOptions:w}=P;function O(k){let T={...k,...Kh(k.status)},{isLoading:D,isError:G,direction:M}=T,q=M==="forward",B=M==="backward";return{...T,hasNextPage:I(w,T.data,T.originalArgs),hasPreviousPage:N(w,T.data,T.originalArgs),isFetchingNextPage:D&&q,isFetchingPreviousPage:D&&B,isFetchNextPageError:G&&q,isFetchPreviousPageError:G&&B}}return v(_,P,O)}function y(){return _=>{let P;return typeof _=="object"?P=zi(_)??Jd:P=_,r(P===Jd?o:O=>a(O)?.mutations?.[P]??iy,i)}}function b(_,P){let w=_[t],O=new Set,k=np(P,cp,Sy);for(let T of k){let D=w.provided.tags[T.type];if(!D)continue;let G=(T.id!==void 0?D[T.id]:Object.values(D).flat())??[];for(let M of G)O.add(M)}return Array.from(O.values()).flatMap(T=>{let D=w.queries[T];return D?{queryCacheKey:T,endpointName:D.endpointName,originalArgs:D.originalArgs}:[]})}function x(_,P){return np(Object.values(s(_)),w=>w?.endpointName===P&&w.status!=="uninitialized",w=>w.originalArgs)}function I(_,P,w){return P?Xs(_,P,w)!=null:!1}function N(_,P,w){return!P||!_.getPreviousPageParam?!1:ap(_,P,w)!=null}}var ay=WeakMap?new WeakMap:void 0,sy=({endpointName:e,queryArgs:t})=>{let r="",n=ay?.get(t);if(typeof n=="string")r=n;else{let o=JSON.stringify(t,(i,a)=>(a=typeof a=="bigint"?{$bigint:a.toString()}:a,a=zt(a)?Object.keys(a).sort().reduce((s,u)=>(s[u]=a[u],s),{}):a,a));zt(t)&&ay?.set(t,o),r=o}return`${e}(${r})`};function rT(...e){return function(r){let n=no(c=>r.extractRehydrationInfo?.(c,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(c){let g=sy;if(c.endpointDefinition&&"serializeQueryArgs"in c.endpointDefinition){let v=c.endpointDefinition.serializeQueryArgs;g=R=>{let h=v(R);return typeof h=="string"?h:sy({...R,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(c)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(c){c()},apiUid:Di(),extractRehydrationInfo:n,hasRehydrationInfo:no(c=>n(c)!=null)},a={injectEndpoints:u,enhanceEndpoints({addTagTypes:c,endpoints:g}){if(c)for(let v of c)o.tagTypes.includes(v)||o.tagTypes.push(v);if(g)for(let[v,R]of Object.entries(g))typeof R=="function"?R(To(i,v)):Object.assign(To(i,v)||{},R);return a}},s=e.map(c=>c.init(a,o,i));function u(c){let g=c.endpoints({query:v=>({...v,type:Wi}),mutation:v=>({...v,type:yy}),infiniteQuery:v=>({...v,type:vy})});for(let[v,R]of Object.entries(g)){if(c.overrideExisting!==!0&&v in i.endpointDefinitions){if(c.overrideExisting==="throw")throw new Error(dt(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[v]=R;for(let h of s)h.injectEndpoint(v,R)}return a}return a.injectEndpoints({endpoints:r.endpoints})}}function gr(e,...t){return Object.assign(e,...t)}var nT=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,i=null,a=null,{updateSubscriptionOptions:s,unsubscribeQueryResult:u}=e.internalActions,c=(b,x)=>{if(s.match(x)){let{queryCacheKey:N,requestId:_,options:P}=x.payload,w=b.get(N);return w?.has(_)&&w.set(_,P),!0}if(u.match(x)){let{queryCacheKey:N,requestId:_}=x.payload,P=b.get(N);return P&&P.delete(_),!0}if(e.internalActions.removeQueryResult.match(x))return b.delete(x.payload.queryCacheKey),!0;if(t.pending.match(x)){let{meta:{arg:N,requestId:_}}=x,P=Zs(b,N.queryCacheKey,op);return N.subscribe&&P.set(_,N.subscriptionOptions??P.get(_)??{}),!0}let I=!1;if(t.rejected.match(x)){let{meta:{condition:N,arg:_,requestId:P}}=x;if(N&&_.subscribe){let w=Zs(b,_.queryCacheKey,op);w.set(P,_.subscriptionOptions??w.get(P)??{}),I=!0}}return I},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:b=>g().get(b)?.size??0,isRequestSubscribed:(b,x)=>!!g()?.get(b)?.get(x)};function y(b){return JSON.parse(JSON.stringify(Object.fromEntries([...b].map(([x,I])=>[x,Object.fromEntries(I)]))))}return(b,x)=>{if(i||(i=y(r.currentSubscriptions)),e.util.resetApiState.match(b))return i={},r.currentSubscriptions.clear(),a=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(b))return[!1,h];let I=c(r.currentSubscriptions,b),N=!0;if(I){a||(a=setTimeout(()=>{let w=y(r.currentSubscriptions),[,O]=id(i,()=>w);x.next(e.internalActions.subscriptionsUpdated(O)),i=w,a=null},500));let _=typeof b.type=="string"&&!!b.type.startsWith(o),P=t.rejected.match(b)&&b.meta.condition&&!!b.meta.arg.subscribe;N=!_&&!P}return[N,!1]}},oT=2147483647/1e3-1,iT=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:a},getRunningQueryThunk:s,mwApi:u})=>{let{removeQueryResult:c,unsubscribeQueryResult:g,cacheEntriesUpserted:v}=t.internalActions,R=Wt(g.match,r.fulfilled,r.rejected,v.match);function h(_){let P=o.currentSubscriptions.get(_);return P?P.size>0:!1}let y={};function b(_){for(let P of _.values())P?.abort?.()}let x=(_,P)=>{let w=a(P.getState());if(R(_)){let O;if(v.match(_))O=_.payload.map(k=>k.queryDescription.queryCacheKey);else{let{queryCacheKey:k}=g.match(_)?_.payload:_.meta.arg;O=[k]}I(O,P,w)}if(t.util.resetApiState.match(_)){for(let[O,k]of Object.entries(y))k&&clearTimeout(k),delete y[O];b(o.runningQueries),b(o.runningMutations)}if(n.hasRehydrationInfo(_)){let{queries:O}=n.extractRehydrationInfo(_);I(Object.keys(O),P,w)}};function I(_,P,w){let O=P.getState();for(let k of _){let T=i(O,k);T?.endpointName&&N(k,T.endpointName,P,w)}}function N(_,P,w,O){let k=To(n,P)?.keepUnusedDataFor??O.keepUnusedDataFor;if(k===1/0)return;let T=Math.max(0,Math.min(k,oT));if(!h(_)){let D=y[_];D&&clearTimeout(D),y[_]=setTimeout(()=>{if(!h(_)){let G=i(w.getState(),_);G?.endpointName&&w.dispatch(s(G.endpointName,G.originalArgs))?.abort(),w.dispatch(c({queryCacheKey:_}))}delete y[_]},T*1e3)}}return x},cy=new Error("Promise never resolved before cacheEntryRemoved."),aT=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:a,selectApiState:s}})=>{let u=us(n),c=us(o),g=lr(n,o),v={},{removeQueryResult:R,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function b(w,O,k){let T=v[w];T?.valueResolved&&(T.valueResolved({data:O,meta:k}),delete T.valueResolved)}function x(w){let O=v[w];O&&(delete v[w],O.cacheEntryRemoved())}function I(w){let{arg:O,requestId:k}=w.meta,{endpointName:T,originalArgs:D}=O;return[T,D,k]}let N=(w,O,k)=>{let T=_(w);function D(G,M,q,B){let j=a(k,M),W=a(O.getState(),M);!j&&W&&P(G,B,M,O,q)}if(n.pending.match(w)){let[G,M,q]=I(w);D(G,T,q,M)}else if(y.match(w))for(let{queryDescription:G,value:M}of w.payload){let{endpointName:q,originalArgs:B,queryCacheKey:j}=G;D(q,j,w.meta.requestId,B),b(j,M,{})}else if(o.pending.match(w)){if(O.getState()[t].mutations[T]){let[G,M,q]=I(w);P(G,M,T,O,q)}}else if(g(w))b(T,w.payload,w.meta.baseQueryMeta);else if(R.match(w)||h.match(w))x(T);else if(e.util.resetApiState.match(w))for(let G of Object.keys(v))x(G)};function _(w){return u(w)?w.meta.arg.queryCacheKey:c(w)?w.meta.arg.fixedCacheKey??w.meta.requestId:R.match(w)?w.payload.queryCacheKey:h.match(w)?zi(w.payload):""}function P(w,O,k,T,D){let G=To(r,w),M=G?.onCacheEntryAdded;if(!M)return;let q={},B=new Promise(z=>{q.cacheEntryRemoved=z}),j=Promise.race([new Promise(z=>{q.valueResolved=z}),B.then(()=>{throw cy})]);j.catch(()=>{}),v[k]=q;let W=e.endpoints[w].select(Js(G)?O:k),Q=T.dispatch((z,Z,se)=>se),X=M(O,{...T,getCacheEntry:()=>W(T.getState()),requestId:D,extra:Q,updateCachedData:Js(G)?z=>T.dispatch(e.util.updateQueryData(w,O,z)):void 0,cacheDataLoaded:j,cacheEntryRemoved:B});Promise.resolve(X).catch(z=>{if(z!==cy)throw z})}return N},sT=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},cT=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:a,refetchQuery:s,internalState:u})=>{let{removeQueryResult:c}=i.internalActions,g=Wt(lr(n),Fi(n)),v=Wt(lr(o,n),ln(o,n)),R=[],h=0,y=(I,N)=>{(o.pending.match(I)||n.pending.match(I))&&h++,v(I)&&!(o.rejected.match(I)&&I.meta.condition)&&(h=Math.max(0,h-1)),g(I)?x(Ay(I,"invalidatesTags",r,a),N):v(I)?x([],N):i.util.invalidateTags.match(I)&&x(dp(I.payload,void 0,void 0,void 0,void 0,a),N)};function b(){return h>0}function x(I,N){let _=N.getState(),P=_[e];if(R.push(...I),P.config.invalidationBehavior==="delayed"&&b())return;let w=R;if(R=[],w.length===0)return;let O=i.util.selectInvalidatedBy(_,w);t.batch(()=>{let k=Array.from(O.values());for(let{queryCacheKey:T}of k){let D=P.queries[T],G=Zs(u.currentSubscriptions,T,op);D&&(G.size===0?N.dispatch(c({queryCacheKey:T})):D.status!=="uninitialized"&&N.dispatch(s(D)))}})}return y},uT=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:a}=o,s=new Set,u=null,c=(x,I)=>{(r.internalActions.updateSubscriptionOptions.match(x)||r.internalActions.unsubscribeQueryResult.match(x))&&g(x.payload.queryCacheKey,I),(t.pending.match(x)||t.rejected.match(x)&&x.meta.condition)&&g(x.meta.arg.queryCacheKey,I),(t.fulfilled.match(x)||t.rejected.match(x)&&!x.meta.condition)&&v(x.meta.arg,I),r.util.resetApiState.match(x)&&(y(),u&&(clearTimeout(u),u=null),s.clear())};function g(x,I){s.add(x),u||(u=setTimeout(()=>{for(let N of s)R({queryCacheKey:N},I);s.clear(),u=null},0))}function v({queryCacheKey:x},I){let N=I.getState()[e].queries[x],_=a.get(x);if(!N||N.status==="uninitialized")return;let{lowestPollingInterval:P,skipPollingIfUnfocused:w}=b(_);if(!Number.isFinite(P))return;let O=i.get(x);O?.timeout&&(clearTimeout(O.timeout),O.timeout=void 0);let k=Date.now()+P;i.set(x,{nextPollTimestamp:k,pollingInterval:P,timeout:setTimeout(()=>{let T=I.getState()[e],D=T.queries[x];if(!D||D.status==="uninitialized"){h(x);return}(T.config.focused||!w)&&I.dispatch(n(D)),v({queryCacheKey:x},I)},P)})}function R({queryCacheKey:x},I){let N=I.getState()[e].queries[x],_=a.get(x);if(!N||N.status==="uninitialized")return;let{lowestPollingInterval:P}=b(_);if(!Number.isFinite(P)){h(x);return}let w=i.get(x),O=Date.now()+P;(!w||O<w.nextPollTimestamp)&&v({queryCacheKey:x},I)}function h(x){let I=i.get(x);I?.timeout&&clearTimeout(I.timeout),i.delete(x)}function y(){for(let x of i.keys())h(x)}function b(x=new Map){let I=!1,N=Number.POSITIVE_INFINITY;for(let _ of x.values())_.pollingInterval&&(N=Math.min(_.pollingInterval,N),I=_.skipPollingIfUnfocused||I);return{lowestPollingInterval:N,skipPollingIfUnfocused:I}}return c},lT=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=cs(r,n),i=ln(r,n),a=lr(r,n),s={};return(c,g)=>{if(o(c)){let{requestId:v,arg:{endpointName:R,originalArgs:h}}=c.meta,y=To(t,R),b=y?.onQueryStarted;if(b){let x={},I=new Promise((P,w)=>{x.resolve=P,x.reject=w});I.catch(()=>{}),s[v]=x;let N=e.endpoints[R].select(Js(y)?h:v),_=g.dispatch((P,w,O)=>O);b(h,{...g,getCacheEntry:()=>N(g.getState()),requestId:v,extra:_,updateCachedData:Js(y)?P=>g.dispatch(e.util.updateQueryData(R,h,P)):void 0,queryFulfilled:I})}}else if(a(c)){let{requestId:v,baseQueryMeta:R}=c.meta;s[v]?.resolve({data:c.payload,meta:R}),delete s[v]}else if(i(c)){let{requestId:v,rejectedWithValue:R,baseQueryMeta:h}=c.meta;s[v]?.reject({error:c.payload??c.error,isUnhandledError:!R,meta:h}),delete s[v]}}},dT=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,a=(u,c)=>{up.match(u)&&s(c,"refetchOnFocus"),lp.match(u)&&s(c,"refetchOnReconnect")};function s(u,c){let g=u.getState()[e],v=g.queries,R=o.currentSubscriptions;t.batch(()=>{for(let h of R.keys()){let y=v[h],b=R.get(h);if(!b||!y)continue;let x=[...b.values()];(x.some(I=>I[c]===!0)||x.every(I=>I[c]===void 0)&&g.config[c])&&(b.size===0?u.dispatch(i({queryCacheKey:h})):y.status!=="uninitialized"&&u.dispatch(n(y)))}})}return a};function pT(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:a}=o,s={invalidateTags:L(`${t}/invalidateTags`)},u=R=>R.type.startsWith(`${t}/`),c=[sT,iT,cT,uT,aT,lT];return{middleware:R=>{let h=!1,y=i(R.dispatch),b={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:u,mwApi:R},x=c.map(_=>_(b)),I=nT(b),N=dT(b);return _=>P=>{if(!Si(P))return _(P);h||(h=!0,R.dispatch(n.internalActions.middlewareRegistered(a)));let w={...R,next:_},O=R.getState(),[k,T]=I(P,w,O),D;if(k?D=_(P):D=T,R.getState()[t]&&(N(P,w,O),u(P)||o.hasRehydrationInfo(P)))for(let G of x)G(P,w,O);return D}},actions:s};function v(R){return e.api.endpoints[R.endpointName].initiate(R.originalArgs,{subscribe:!1,forceRefetch:!0})}}var uy=Symbol(),fT=({createSelector:e=ze}={})=>({name:uy,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:a,refetchOnMountOrArgChange:s,refetchOnFocus:u,refetchOnReconnect:c,invalidationBehavior:g,onSchemaFailure:v,catchSchemaFailure:R,skipSchemaValidation:h},y){eg();let b=ve=>(typeof process<"u",ve);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:lp,onOffline:hy,onFocus:up,onFocusLost:gy},util:{}});let x=tT({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:N,buildQuerySelector:_,buildInfiniteQuerySelector:P,buildMutationSelector:w}=x;gr(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:N});let{queryThunk:O,infiniteQueryThunk:k,mutationThunk:T,patchQueryData:D,updateQueryData:G,upsertQueryData:M,prefetch:q,buildMatchThunkActions:B}=JI({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:b,selectors:x,onSchemaFailure:v,catchSchemaFailure:R,skipSchemaValidation:h}),{reducer:j,actions:W}=eT({context:y,queryThunk:O,infiniteQueryThunk:k,mutationThunk:T,serializeQueryArgs:i,reducerPath:o,assertTagType:b,config:{refetchOnFocus:u,refetchOnReconnect:c,refetchOnMountOrArgChange:s,keepUnusedDataFor:a,reducerPath:o,invalidationBehavior:g}});gr(t.util,{patchQueryData:D,updateQueryData:G,upsertQueryData:M,prefetch:q,resetApiState:W.resetApiState,upsertQueryEntries:W.cacheEntriesUpserted}),gr(t.internalActions,W);let Q=new WeakMap,X=ve=>Zs(Q,ve,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:z,buildInitiateInfiniteQuery:Z,buildInitiateMutation:se,getRunningMutationThunk:ye,getRunningMutationsThunk:_e,getRunningQueriesThunk:Ge,getRunningQueryThunk:Fe}=ZI({queryThunk:O,mutationThunk:T,infiniteQueryThunk:k,api:t,serializeQueryArgs:i,context:y,getInternalState:X});gr(t.util,{getRunningMutationThunk:ye,getRunningMutationsThunk:_e,getRunningQueryThunk:Fe,getRunningQueriesThunk:Ge});let{middleware:Me,actions:Le}=pT({reducerPath:o,context:y,queryThunk:O,mutationThunk:T,infiniteQueryThunk:k,api:t,assertTagType:b,selectors:x,getRunningQueryThunk:Fe,getInternalState:X});return gr(t.util,Le),gr(t,{reducer:j,middleware:Me}),{name:uy,injectEndpoint(ve,me){var He;let Se=(He=t.endpoints)[ve]??(He[ve]={});tc(me)&&gr(Se,{name:ve,select:_(ve,me),initiate:z(ve,me)},B(O,ve)),KI(me)&&gr(Se,{name:ve,select:w(),initiate:se(ve)},B(T,ve)),Qi(me)&&gr(Se,{name:ve,select:P(ve,me),initiate:Z(ve,me)},B(O,ve))}}}}),xy=rT(fT());m();d();f();p();m();d();f();p();var yn=e=>e.query,Cy=e=>e.query?.enableQuerySyntax;var n$=ze(e=>yn(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,r,n,o)=>({q:e,requestId:t,cannotAnswer:r,analyticsMode:n,actionCause:o})),mT=ze(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();var rc=e=>{if(e==="yes")return!0;if(e==="no")return!1},gT=()=>De("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function hT(e,t){return De({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??je(n),i=bo(n,e);if(!o||!i)return null;let a=kr(n);return r.makeGeneratedAnswerCitationClick(Uh(i,n),{generativeQuestionAnsweringId:o,citationId:i.id,documentId:Bh(i),...(a&&{conversationId:a})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=bo(r,e);return{answerId:t??je(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function yT(e,t,r){return De({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let i=r??je(o),a=bo(o,e);if(!i||!a)return null;let s=kr(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:i,permanentId:a.permanentid,citationId:a.id,citationHoverTimeMs:t,...(s&&{conversationId:s})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=bo(n,e);return{answerId:r??je(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function vT(e,t){return De({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function ST(e){return De({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=kr(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"like"})})}function bT(e){return De({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=kr(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"dislike"})})}var AT=e=>De({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=je(r);return n?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=je(t),{helpful:n,readable:o,documented:i,hallucinationFree:a,correctTopic:s,documentUrl:u,details:c}=e;return{answerId:r??"",helpful:n,details:{readable:rc(o),documented:rc(i),correctTopic:rc(s),hallucinationFree:rc(a)},additionalNotes:c,correctAnswerUrl:u}}}),pp=(e,t,r)=>De({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let i=t??je(o);if(!i)return null;let a=kr(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:r,...(a&&{conversationId:a})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??je(n)??"",answerGenerated:e??!1})}),_o=e=>De({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),wT=()=>De({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"show"})}),xT=()=>De({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"hide"})}),CT=()=>De({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"expand"})}),ET=()=>De({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"collapse"})});function RT(e){return De({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=kr(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"copyToClipboard"})})}function IT(e,t){return De({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=bo(n,e);if(!o)return null;let i=kr(n);return i?r.makeGeneratedAnswerFollowupOpenSource({...Vh(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:i}):null}})}var nc={logCopyGeneratedAnswer:RT,logGeneratedAnswerHideAnswers:xT,logGeneratedAnswerShowAnswers:wT,logGeneratedAnswerStreamEnd:pp,logGeneratedAnswerFeedback:AT,logDislikeGeneratedAnswer:bT,logLikeGeneratedAnswer:ST,logGeneratedAnswerOpenInlineLink:vT,logHoverCitation:yT,logOpenGeneratedAnswerSource:hT,logOpenGeneratedAnswerFollowUpSource:IT,logRetryGeneratedAnswer:gT,logGeneratedAnswerExpand:CT,logGeneratedAnswerCollapse:ET};m();d();f();p();m();d();f();p();var Ey=ze(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:o}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(o&&{lq:o})}});m();d();f();p();var Ki=(e,t,r)=>({analytics:{clientId:t.clientId,clientTimestamp:new Date().toISOString(),documentReferrer:t.referrer,documentLocation:t.location,originContext:e.originContext,...(r&&{actionCause:r.actionCause}),...(r&&{customData:r.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.deviceId&&{deviceId:e.deviceId}),...(e.trackingId&&{trackingId:e.trackingId}),capture:t.capture??t.clientId!=="",source:mo(e)}});m();d();f();p();var fp=e=>e.context;m();d();f();p();var mp=e=>e.pipeline;m();d();f();p();m();d();f();p();var Yi=jt(oc(),1),Oy=jt(Ry(),1);m();d();f();p();var ic=jt(oc(),1),Ty=jt(Iy(),1);ic.default.extend(Ty.default);var _y="YYYY/MM/DD@HH:mm:ss",TT="1401-01-01";function ko(e,t){let r=(0,ic.default)(e,t);return!r.isValid()&&!t?(0,ic.default)(e,_y):r}function ac(e){return e.format(_y)}function ky(e,t){let r=ko(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}`)}Ap(r)}function Ap(e){if(e.isBefore(TT))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}Yi.default.extend(Oy.default);var Py=["past","now","next"],Ny=["minute","hour","day","week","month","quarter","year"],_T=e=>{let t=e==="now";return{amount:new ne({required:!t,min:1}),unit:new H({required:!t,constrainTo:Ny}),period:new H({required:!0,constrainTo:Py})}};function wp(e){if(typeof e=="string"&&!Nr(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?qy(e):e;new yt(_T(t.period)).validate(t);let r=Dy(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);Ap(r)}function Fy(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function Dy(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Yi.default)().subtract(r,n);case"next":return(0,Yi.default)().add(r,n);case"now":return(0,Yi.default)()}}function Xi(e){return ac(Dy(qy(e)))}function My(e){return e.toLocaleLowerCase().split("-")}function Nr(e){let[t,r,n]=My(e);if(t==="now")return!0;if(!Py.includes(t)||!Ny.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function Ly(e){return!!e&&typeof e=="object"&&"period"in e}function qy(e){let[t,r,n]=My(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function jy(e){return e.type==="dateRange"}function Uy(e){return`start${e}`}function Vy(e){return`end${e}`}var xp=()=>({dateFacetValueMap:{}});function kT(e,t,r){let n=e.start,o=e.end;return Nr(n)&&(n=Xi(n),r.dateFacetValueMap[t][Uy(n)]=e.start),Nr(o)&&(o=Xi(o),r.dateFacetValueMap[t][Vy(o)]=e.end),{...e,start:n,end:o}}function Cp(e,t){if(jy(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>kT(o,r,t))}}return e}function Fr(e){let t=xp();return{request:{...e,facets:e.facets?.map(n=>Cp(n,t))},mappings:t}}function OT(e,t,r){return{...e,start:r.dateFacetValueMap[t][Uy(e.start)]||e.start,end:r.dateFacetValueMap[t][Vy(e.end)]||e.end}}function PT(e,t){return e.facetId in t.dateFacetValueMap}function NT(e,t){return PT(e,t)?{...e,values:e.values.map(r=>OT(r,e.facetId,t))}:e}function sc(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>NT(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function Dr(e){return Object.values(e).map(t=>t.request)}function Ep(e,t){let r={};e.forEach(i=>{r[i.facetId]=i});let n=[];t.forEach(i=>{i in r&&(n.push(r[i]),delete r[i])});let o=Object.values(r);return[...n,...o]}function Gy(e){return Dr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Rp={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function FT(e){return Dr(e).map(t=>{let r=Rp[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function DT(e){return[...FT(e.facetSet??{}),...Gy(e.numericFacetSet??{}),...Gy(e.dateFacetSet??{}),...Dr(e.categoryFacetSet??{})]}function MT(e){return DT(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function cc(e){return Ep(MT(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();var Mr=/*#__PURE__*/function(){var _Mr=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??wr(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,...(e.configuration.analytics.enabled&&{actionsHistory:ht.getInstance().getHistory()}),...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&(yield Qs(e.configuration.analytics,t))),...(e.excerptLength&&!ce(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});function Mr(_x68,_x69){return _Mr.apply(this,arguments)}return Mr}();m();d();f();p();var Oo=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??wr(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:t.referrer,timezone:e.configuration.search.timezone,...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&Ki(e.configuration.analytics,t,r)),...(e.excerptLength&&!ce(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});m();d();f();p();var By=ze(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o}));var Lr=/*#__PURE__*/function(){var _Lr=_asyncToGenerator(function*(e,t,r){let n=Tp(e),o=LT(e),i=qT(e),a=e.configuration.analytics.analyticsMode==="legacy"?yield Mr(e,r):Oo(e,t,r);return Fr({...a,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(n&&{cq:n}),...(o.length&&{facets:o}),...(e.pagination&&{numberOfResults:Ip(e),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:i}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});function Lr(_x70,_x71,_x72){return _Lr.apply(this,arguments)}return Lr}();function Ip(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function LT(e){return Ep(UT(e),e.facetOrder??[])}function qT(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(jT).filter(r=>r.currentValues.length>0):void 0}function jT(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function UT(e){return VT(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function VT(e){return[...GT(e.facetSet??{}),...$y(e.numericFacetSet??{}),...$y(e.dateFacetSet??{}),...Dr(e.categoryFacetSet??{})]}function GT(e){return Dr(e).map(t=>{let r=Rp[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function $y(e){return Dr(e).map(t=>{let r=t.currentValues,n=r.some(({state:i})=>i!=="idle"),o=r.some(i=>i.previousState);return t.generateAutomaticRanges&&!n&&!o?{...t,currentValues:[]}:t})}function Tp(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=By(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();f();p();m();d();f();p();var Zi=(e,t)=>{let r=e;return ce(r[t])?ce(e.raw[t])?null:e.raw[t]:r[t]},BT=e=>t=>e.every(r=>!ce(Zi(t,r))),$T=e=>t=>e.every(r=>ce(Zi(t,r))),QT=(e,t)=>r=>{let n=Qy(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},HT=(e,t)=>r=>{let n=Qy(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},Qy=(e,t)=>{let r=Zi(t,e);return ym(r)?r:[r]},Hy={getResultProperty:Zi,fieldsMustBeDefined:BT,fieldsMustNotBeDefined:$T,fieldMustMatch:QT,fieldMustNotMatch:HT};var _p=ze(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var kp=e=>e.searchHub;m();d();f();p();var uc=ze(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),qH=ze(e=>e,e=>{let t=uc(e);return t&&e?e[t].expression:""});m();d();f();p();var zy=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var Wy=e=>e.excerptLength?.length;m();d();f();p();var Ky=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var Yy=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};m();d();f();p();var Xy=e=>e.sortCriteria;var Zy=/*#__PURE__*/function(){var _Zy=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Jn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});function Zy(_x73){return _Zy.apply(this,arguments)}return Zy}(),Jy=(e,t)=>{let r=yn(e)?.q,{aq:n,cq:o,dq:i,lq:a}=rv(e),s=fp(e),u=Ki(e.configuration.analytics,t,{actionCause:_p(e)}),c=kp(e),g=mp(e),v=Vd(e)??[],R=tv(e),h=uc(e.tabSet)||"default",y=jd(e),b=mh(e),x=t.referrer||"",I=Ky(e),N=Xy(e),_=zT(e),P=Wy(e),w=Yy(e),O=zy(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(a&&{lq:a}),...(e.query&&{enableQuerySyntax:Cy(e)}),...(s?.contextValues&&{context:s.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(c?.length&&{searchHub:c}),...(g?.length&&{pipeline:g}),...(R.length&&{facets:R}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(e.pagination&&{numberOfResults:Ip(e),firstResult:e.pagination.firstResult}),tab:h,locale:y,timezone:b,...(e.debug!==void 0&&{debug:e.debug}),referrer:x,..._,...(w??{}),...(P&&{excerptLength:P}),...(O&&{dictionaryFieldContext:O}),sortCriteria:N,...(I&&{facetOptions:I}),...u,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},ev=(e,t)=>{let r=yn(e)?.q,n=tv(e),o=Ki(e.configuration.analytics,t,{actionCause:_p(e)}),i=jd(e),a=uc(e.tabSet)||"default",s=t.referrer,{aq:u,cq:c}=rv(e),g=kp(e),v=mp(e),R=fp(e),h=Vd(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(v?.length&&{pipeline:v}),...(R?.contextValues&&{context:R.contextValues}),...(u&&{aq:u}),...(c&&{cq:c}),tab:a,referrer:s,...o,locale:i}},tv=e=>cc(e)?.map(t=>Cp(t,xp())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),zT=e=>({actionsHistory:e.configuration.analytics.enabled?ht.getInstance().getHistory():[]}),rv=e=>{let t=Ey(e),r=Tp(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var lc=["searching","thinking","answering"];function dc(e){return e.toLowerCase()}var pc=["search","generic"];m();d();f();p();var nv=["text/plain","text/markdown"];var Po=new H({required:!0}),ov=new H,No=new fe({required:!0}),Op={id:Po,title:Po,uri:Po,permanentid:Po,clickUri:ov},fc=new H({required:!0,constrainTo:nv}),iv=new H({required:!0,constrainTo:lc}),av=e=>({...e,name:dc(e.name)}),oz=L("generatedAnswer/setIsVisible",e=>V(e,No)),mc=L("generatedAnswer/setAnswerId",e=>V(e,Y)),iz=L("generatedAnswer/setAnswerGenerationMode",e=>V(e,new H({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),az=L("generatedAnswer/setIsEnabled",e=>V(e,No)),ea=L("generatedAnswer/updateMessage",e=>V(e,{textDelta:Po})),ta=L("generatedAnswer/updateCitations",e=>V(e,{citations:new Ae({required:!0,each:new re({values:Op})})})),ra=L("generatedAnswer/updateError",e=>V(e,{message:ov,code:new ne({min:0})})),gc=L("generatedAnswer/resetAnswer"),sz=L("generatedAnswer/like"),cz=L("generatedAnswer/dislike"),uz=L("generatedAnswer/feedbackModal/open"),lz=L("generatedAnswer/expand"),dz=L("generatedAnswer/collapse"),pz=L("generatedAnswer/setId",e=>V(e,{id:new H({required:!0})})),fz=L("generatedAnswer/feedbackModal/close"),mz=L("generatedAnswer/sendFeedback"),qr=L("generatedAnswer/setIsLoading",e=>V(e,No)),Ji=L("generatedAnswer/setIsStreaming",e=>V(e,No)),na=L("generatedAnswer/setAnswerContentFormat",e=>V(e,fc)),gz=L("generatedAnswer/updateResponseFormat",e=>V(e,{contentFormat:new Ae({each:fc,default:["text/plain"]})})),hz=L("knowledge/updateAnswerConfigurationId",e=>V(e,Po)),yz=L("generatedAnswer/registerFieldsToIncludeInCitations",e=>V(e,ps)),Pp=L("generatedAnswer/setIsAnswerGenerated",e=>V(e,No)),oa=L("generatedAnswer/setCannotAnswer",e=>V(e,No)),WT=L("generatedAnswer/setAnswerApiQueryParams",e=>V(e,new re({}))),sv=L("generatedAnswer/startStep",e=>V(av(e),{name:iv,startedAt:new ne({min:0,required:!0})})),cv=L("generatedAnswer/finishStep",e=>V(av(e),{name:iv,finishedAt:new ne({min:0,required:!0})})),uv=L("generatedAnswer/startToolCall",e=>V(e,{toolCallName:Y,startedAt:new ne({min:0,required:!0}),toolCallId:Y})),lv=L("generatedAnswer/finishToolCall",e=>V(e,{finishedAt:new ne({min:0,required:!0}),toolCallId:Y})),hc=L("generatedAnswer/toolCallArgs",e=>V(e,{toolCallId:Y,args:new re({options:{required:!0}}),type:new H({required:!0,constrainTo:pc})})),vz=ke("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:i}=t,{generatedAnswerAnalyticsClient:a}=o,{search:s}=i(),{queryExecuted:u}=s,{setAbortControllerRef:c}=e,g=yield Zy(r),v=(y,b)=>{switch(y){case"genqa.headerMessageType":{let x=JSON.parse(b);n(na(x.contentFormat));break}case"genqa.messageType":n(ea(JSON.parse(b)));break;case"genqa.citationsType":n(ta(JSON.parse(b)));break;case"genqa.endOfStreamType":{let x=JSON.parse(b).answerGenerated,{answerId:I,answer:N}=i().generatedAnswer,P=u.length!==0&&!x,w=!N?.trim();n(oa(P)),n(Ji(!1)),n(Pp(x)),n((a??nc).logGeneratedAnswerStreamEnd(x,I,x?w:void 0)),n(_o());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${y}"`)}};n(qr(!0));let R=y=>y.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:y=>{R(g)&&(n(qr(!1)),y.payload&&y.payloadType&&v(y.payloadType,y.payload))},abort:y=>{R(g)&&n(ra(y))},close:()=>{R(g)&&n(Ji(!1))},resetAnswer:()=>{R(g)&&n(gc())}});h?c(h):n(qr(!1))});return function(_x74,_x75){return _ref12.apply(this,arguments)}}()),Sz=ke("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(gc());let i=t();if(i.generatedAnswer.isEnabled===!1){o.warn("[WARNING] The generateAnswer action was dispatched while the generated answer is disabled. No answer will be generated. Enable the generated answer before dispatching generateAnswer.");return}if(i.generatedAnswer.answerConfigurationId){let a=Jy(i,n);r(WT(a)),yield r(dv(a))}else o.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.")});return function(_x76,_x77){return _ref13.apply(this,arguments)}}());m();d();f();p();m();d();f();p();function fv(_x78,_x79){return _fv.apply(this,arguments)}function _fv(){_fv=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _fv.apply(this,arguments)}function mv(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=YT(t,a);let s=t.length,u=0;for(;r<s;){o&&(t[r]===10&&(u=++r),o=!1);let c=-1;for(;r<s&&c===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-u);break;case 13:o=!0,c=r;break;case 10:c=r;break}if(c===-1)break;e(t.subarray(u,c),n),u=r,n=-1}u===s?t=void 0:u!==0&&(t=t.subarray(u),r-=u)}}function gv(e,t,r){let n=pv(),o=new TextDecoder;return function(a,s){if(a.length===0)r?.(n),n=pv();else if(s>0){let u=o.decode(a.subarray(0,s)),c=s+(a[s+1]===32?2:1),g=o.decode(a.subarray(c));switch(u){case"data":n.data=n.data?`${n.data}
|
|
32
|
+
${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":KT(g,n,t);break}}}}function KT(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function YT(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function pv(){return{data:"",event:"",id:"",retry:void 0}}var Np="text/event-stream",XT=1e3,hv="last-event-id";function yv(){return typeof window<"u"}function vv(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:a,openWhenHidden:s,fetch:u,...c}){return new Promise((g,v)=>{let R={...r};R.accept||(R.accept=Np);let h;function y(){h?.abort(),document.hidden||P()}!s&&yv()&&document.addEventListener("visibilitychange",y);let b=XT,x;function I(){yv()&&document.removeEventListener("visibilitychange",y),clearTimeout(x),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let N=u??C,_=n??ZT;function P(){return _P2.apply(this,arguments)}function _P2(){_P2=_asyncToGenerator(function*(){h=l.AbortController?new l.AbortController:null;try{let w=yield N(e,{...c,headers:R,signal:h?.signal});yield _(w),yield fv(w.body,mv(gv(O=>{O?R[hv]=O:delete R[hv]},O=>{b=O},o))),i?.(),I(),g()}catch(w){if(!h?.signal?.aborted)try{let O=a?.(w)??b;clearTimeout(x),x=setTimeout(P,O)}catch(O){I(),v(O)}}});return _P2.apply(this,arguments)}P()})}function ZT(e){let t=e.headers.get("content-type");if(!t?.startsWith(Np))throw new Error(`Expected content-type to be ${Np}, Actual: ${t}`)}m();d();f();p();var JT=/*#__PURE__*/function(){var _JT=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:i,organizationId:a}=n.configuration,s=n.generatedAnswer.answerConfigurationId,u={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let c=Jn(n.configuration.search?.apiBaseUrl,a,i);return dy({baseUrl:`${c}/rest/organizations/${a}/answer/v1/configs/${s}`,fetchFn:function(){var _fetchFn=_asyncToGenerator(function*(g){if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let v=g.url,R={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{R[h]=g[h]}),R.duplex="half",R.body=yield g.text(),C(v,R)});function fetchFn(_x83){return _fetchFn.apply(this,arguments)}return fetchFn}()})(u,{...t,signal:null},r)}catch(c){return{error:c}}});function JT(_x80,_x81,_x82){return _JT.apply(this,arguments)}return JT}(),Sv=xy({reducerPath:"answer",baseQuery:fy(JT,{maxRetries:3}),endpoints:()=>({})});var e0=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},t0=(e,t)=>{let{textDelta:r}=t;if(typeof r!="string")return;let n=e.answer;!n?.trim()&&!r.trim()||(delete e.error,e.answer=n?.trim()?n.concat(r):r)},r0=(e,t)=>{delete e.error,e.citations=t.citations},n0=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},o0=(e,t)=>{let r=t.errorMessage||"Unknown error occurred";e.error={message:r,code:t.code},e.isStreaming=!1,e.isLoading=!1,console.error(`Generated answer error: ${r} (code: ${t.code})`)},i0=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&o0(t,o);let i=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":i.contentFormat&&(e0(t,i),r(na(i.contentFormat)));break;case"genqa.messageType":typeof i.textDelta=="string"&&(t0(t,i),r(ea({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(r0(t,i),r(ta({citations:i.citations})));break;case"genqa.endOfStreamType":{n0(t,i);let a=t.answerId,s=i.answerGenerated??!1,u=s?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(s,a,u)),r(_o());break}}},a0=(e,t,r,n)=>{if(!e||!t||!r)throw new Error("Missing required parameters for answer endpoint");let o=`/rest/organizations/${t}`,i=n?`insight/v1/configs/${n}/answer`:"answer/v1/configs";return`${e}${o}/${i}/${r}/generate`},Fp=Sv.injectEndpoints({overrideExisting:!0,endpoints:e=>({getAnswer:e.query({queryFn:()=>({data:{contentFormat:void 0,answer:void 0,citations:void 0,error:void 0,generated:!1,isStreaming:!0,isLoading:!0}}),serializeQueryArgs:({endpointName:t,queryArgs:r})=>{let{analytics:n,...o}=r;return`${t}(${JSON.stringify(o)})`},onCacheEntryAdded(_x84,_x85){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:i,extra:a}){yield n;let{configuration:s,generatedAnswer:u,insightConfiguration:c}=r(),{generatedAnswerAnalyticsClient:g}=a,{organizationId:v,environment:R,accessToken:h}=s,y=Jn(s.search.apiBaseUrl,v,R),b=a0(y,v,u.answerConfigurationId,c?.insightId);yield vv(b,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${h}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},openWhenHidden:!0,fetch:C,onopen:function(){var _onopen=_asyncToGenerator(function*(x){let I=x.headers.get("x-answer-id");I&&o(N=>{N.answerId=I,i(mc(I))})});function onopen(_x86){return _onopen.apply(this,arguments)}return onopen}(),onmessage:x=>{o(I=>{i0(x,I,i,g??nc)})},onerror:x=>{throw x},onclose:()=>{o(x=>{i(oa(!x.generated))})}})}).apply(this,arguments)}})})}),dv=e=>Fp.endpoints.getAnswer.initiate(e);m();d();f();p();var bv=Be(so,e=>e);m();d();f();p();function s0(e){let t=e.payload?.analyticsAction;return Av(e)&&!ce(t)}function Av(e){return"type"in e}var wv=e=>t=>r=>{let n;s0(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return Av(r)&&(r.type==="search/executeSearch/fullfilled"&&n===void 0&&console.error("No analytics action associated with search:",r),r.type==="recommendation/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with recommendation:",r),r.type==="productRecommendations/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with product recommendation:",r)),n!==void 0&&e.dispatch(n),o};m();d();f();p();m();d();f();p();m();d();f();p();var hW=L("tab/register",e=>{let t=new re({values:{id:Y,expression:nt}});return V(e,t)}),yc=L("tab/updateActiveTab",e=>V(e,Y));m();d();f();p();var vc=jt(oc(),1),Ev=jt(xv(),1),Rv=jt(Cv(),1);vc.default.extend(Rv.default);vc.default.extend(Ev.default);var Iv=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:vc.default.tz.guess(),authenticationProviders:[]},analytics:{enabled:!0,originContext:"Search",originLevel2:"default",originLevel3:"default",anonymous:!1,deviceId:"",userDisplayName:"",documentLocation:"",analyticsMode:"next",source:{}},knowledge:{answerConfigurationId:"",agentId:void 0},environment:"prod"});m();d();f();p();var c0=/(^|; )Coveo-Pendragon=([^;]*)/,u0=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function Tv(){return typeof window>"u"?!1:c0.exec(document.cookie)?.pop()||null}function _v(){return typeof window>"u"?!1:u0.test(document.cookie)}var kv=Be(Iv(),e=>e.addCase(Rr,(t,r)=>{l0(t,r.payload)}).addCase(Kt,(t,r)=>{d0(t,r.payload)}).addCase(co,(t,r)=>{p0(t,r.payload)}).addCase(uo,t=>{t.analytics.enabled=!1}).addCase(lo,t=>{t.analytics.enabled=!0}).addCase(fs,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(ms,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(yc,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(qg,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Ir,(t,r)=>{ce(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Mg,(t,{payload:r})=>{f0(t,r)}));function l0(e,t){ce(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ce(t.organizationId)||(e.organizationId=t.organizationId)}function d0(e,t){ce(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),ce(t.locale)||(e.search.locale=t.locale),ce(t.timezone)||(e.search.timezone=t.timezone),ce(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function p0(e,t){ce(t.enabled)||(e.analytics.enabled=t.enabled),ce(t.originContext)||(e.analytics.originContext=t.originContext),ce(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),ce(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),ce(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),ce(t.trackingId)||(e.analytics.trackingId=t.trackingId),ce(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),ce(t.source)||(e.analytics.source=t.source);try{let r=Tv();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}ce(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),ce(t.anonymous)||(e.analytics.anonymous=t.anonymous),ce(t.deviceId)||(e.analytics.deviceId=t.deviceId),ce(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),ce(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function f0(e,t){e.knowledge.agentId=t;try{_v()&&(e.knowledge.debugAgentSession=!0)}catch{}}var Vt=kv;m();d();f();p();function m0(e){return e.instantlyCallable}var Ov=()=>e=>t=>e(m0(t)?t():t);m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var at=[];for(let e=0;e<256;++e)at.push((e+256).toString(16).slice(1));function Pv(e,t=0){return(at[e[t+0]]+at[e[t+1]]+at[e[t+2]]+at[e[t+3]]+"-"+at[e[t+4]]+at[e[t+5]]+"-"+at[e[t+6]]+at[e[t+7]]+"-"+at[e[t+8]]+at[e[t+9]]+"-"+at[e[t+10]]+at[e[t+11]]+at[e[t+12]]+at[e[t+13]]+at[e[t+14]]+at[e[t+15]]).toLowerCase()}m();d();f();p();var jp,g0=new Uint8Array(16);function Up(){if(!jp){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");jp=crypto.getRandomValues.bind(crypto)}return jp(g0)}m();d();f();p();m();d();f();p();var h0=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Vp={randomUUID:h0};function y0(e,t,r){if(Vp.randomUUID&&!t&&!e)return Vp.randomUUID();e=e||{};let n=e.random??e.rng?.()??Up();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 Pv(n)}var jr=y0;m();d();f();p();m();d();f();p();var S={};ui(S,{BRAND:()=>B0,DIRTY:()=>Sn,EMPTY_PATH:()=>A0,INVALID:()=>de,NEVER:()=>I_,OK:()=>ft,ParseStatus:()=>st,Schema:()=>xe,ZodAny:()=>Gr,ZodArray:()=>Sr,ZodBigInt:()=>An,ZodBoolean:()=>wn,ZodBranded:()=>aa,ZodCatch:()=>Nn,ZodDate:()=>xn,ZodDefault:()=>Pn,ZodDiscriminatedUnion:()=>Ac,ZodEffects:()=>Mt,ZodEnum:()=>kn,ZodError:()=>bt,ZodFirstPartyTypeKind:()=>pe,ZodFunction:()=>xc,ZodIntersection:()=>In,ZodIssueCode:()=>K,ZodLazy:()=>Tn,ZodLiteral:()=>_n,ZodMap:()=>jo,ZodNaN:()=>Vo,ZodNativeEnum:()=>On,ZodNever:()=>Gt,ZodNull:()=>En,ZodNullable:()=>er,ZodNumber:()=>bn,ZodObject:()=>At,ZodOptional:()=>Ft,ZodParsedType:()=>te,ZodPipeline:()=>sa,ZodPromise:()=>Br,ZodReadonly:()=>Fn,ZodRecord:()=>wc,ZodSchema:()=>xe,ZodSet:()=>Uo,ZodString:()=>Vr,ZodSymbol:()=>Lo,ZodTransformer:()=>Mt,ZodTuple:()=>Jt,ZodType:()=>xe,ZodUndefined:()=>Cn,ZodUnion:()=>Rn,ZodUnknown:()=>vr,ZodVoid:()=>qo,addIssueToContext:()=>ee,any:()=>Z0,array:()=>r_,bigint:()=>z0,boolean:()=>Bv,coerce:()=>R_,custom:()=>Uv,date:()=>W0,datetimeRegex:()=>qv,defaultErrorMap:()=>hr,discriminatedUnion:()=>a_,effect:()=>v_,enum:()=>g_,function:()=>p_,getErrorMap:()=>Fo,getParsedType:()=>Zt,instanceof:()=>Q0,intersection:()=>s_,isAborted:()=>Sc,isAsync:()=>Do,isDirty:()=>bc,isValid:()=>Ur,late:()=>$0,lazy:()=>f_,literal:()=>m_,makeIssue:()=>ia,map:()=>l_,nan:()=>H0,nativeEnum:()=>h_,never:()=>e_,null:()=>X0,nullable:()=>b_,number:()=>Gv,object:()=>n_,objectUtil:()=>Gp,oboolean:()=>E_,onumber:()=>C_,optional:()=>S_,ostring:()=>x_,pipeline:()=>w_,preprocess:()=>A_,promise:()=>y_,quotelessJson:()=>v0,record:()=>u_,set:()=>d_,setErrorMap:()=>b0,strictObject:()=>o_,string:()=>Vv,symbol:()=>K0,transformer:()=>v_,tuple:()=>c_,undefined:()=>Y0,union:()=>i_,unknown:()=>J0,util:()=>Re,void:()=>t_});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Re;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Re||(Re={}));var Gp;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Gp||(Gp={}));var te=Re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zt=e=>{switch(typeof e){case"undefined":return te.undefined;case"string":return te.string;case"number":return Number.isNaN(e)?te.nan:te.number;case"boolean":return te.boolean;case"function":return te.function;case"bigint":return te.bigint;case"symbol":return te.symbol;case"object":return Array.isArray(e)?te.array:e===null?te.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?te.promise:typeof Map<"u"&&e instanceof Map?te.map:typeof Set<"u"&&e instanceof Set?te.set:typeof Date<"u"&&e instanceof Date?te.date:te.object;default:return te.unknown}};var K=Re.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),v0=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),bt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,u=0;for(;u<a.path.length;){let c=a.path[u];u===a.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(r(a))):s[c]=s[c]||{_errors:[]},s=s[c],u++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};bt.create=e=>new bt(e);var S0=(e,t)=>{let r;switch(e.code){case K.invalid_type:e.received===te.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case K.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Re.jsonStringifyReplacer)}`;break;case K.unrecognized_keys:r=`Unrecognized key(s) in object: ${Re.joinValues(e.keys,", ")}`;break;case K.invalid_union:r="Invalid input";break;case K.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Re.joinValues(e.options)}`;break;case K.invalid_enum_value:r=`Invalid enum value. Expected ${Re.joinValues(e.options)}, received '${e.received}'`;break;case K.invalid_arguments:r="Invalid function arguments";break;case K.invalid_return_type:r="Invalid function return type";break;case K.invalid_date:r="Invalid date";break;case K.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Re.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case K.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case K.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case K.custom:r="Invalid input";break;case K.invalid_intersection_types:r="Intersection results could not be merged";break;case K.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case K.not_finite:r="Number must be finite";break;default:r=t.defaultError,Re.assertNever(e)}return{message:r}},hr=S0;var Nv=hr;function b0(e){Nv=e}function Fo(){return Nv}m();d();f();p();var ia=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...(o.path||[])],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",u=n.filter(c=>!!c).slice().reverse();for(let c of u)s=c(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}},A0=[];function ee(e,t){let r=Fo(),n=ia({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===hr?void 0:hr].filter(o=>!!o)});e.common.issues.push(n)}var st=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return de;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let o of r){let i=yield o.key,a=yield o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return de;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},de=Object.freeze({status:"aborted"}),Sn=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),Sc=e=>e.status==="aborted",bc=e=>e.status==="dirty",Ur=e=>e.status==="valid",Do=e=>typeof Promise<"u"&&e instanceof Promise;m();d();f();p();m();d();f();p();var ie;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ie||(ie={}));var Dt=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Fv=(e,t)=>{if(Ur(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new bt(e.common.issues);return this._error=r,this._error}}};function be(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:u}=e;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:u??r??s.defaultError}},description:o}}var xe=class{get description(){return this._def.description}_getType(t){return Zt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Zt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new st,ctx:{common:t.parent.common,data:t.data,parsedType:Zt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Do(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Fv(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Ur(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Ur(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this10=this;return _asyncToGenerator(function*(){let n=yield _this10.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this11=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this11._def.errorMap,parent:null,data:t,parsedType:Zt(t)},o=_this11._parse({data:t,path:n.path,parent:n}),i=yield Do(o)?o:Promise.resolve(o);return Fv(n,i)})()}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:K.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new Mt({schema:this,typeName:pe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Ft.create(this,this._def)}nullable(){return er.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Sr.create(this)}promise(){return Br.create(this,this._def)}or(t){return Rn.create([this,t],this._def)}and(t){return In.create(this,t,this._def)}transform(t){return new Mt({...be(this._def),schema:this,typeName:pe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Pn({...be(this._def),innerType:this,defaultValue:r,typeName:pe.ZodDefault})}brand(){return new aa({typeName:pe.ZodBranded,type:this,...be(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Nn({...be(this._def),innerType:this,catchValue:r,typeName:pe.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return sa.create(this,t)}readonly(){return Fn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},w0=/^c[^\s-]{8,}$/i,x0=/^[0-9a-z]+$/,C0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,E0=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,R0=/^[a-z0-9_-]{21}$/i,I0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,T0=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,_0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,k0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Bp,O0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,P0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,N0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,F0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,D0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,M0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Mv="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",L0=new RegExp(`^${Mv}$`);function Lv(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function q0(e){return new RegExp(`^${Lv(e)}$`)}function qv(e){let t=`${Mv}T${Lv(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function j0(e,t){return!!((t==="v4"||!t)&&O0.test(e)||(t==="v6"||!t)&&N0.test(e))}function U0(e,t){if(!I0.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function V0(e,t){return!!((t==="v4"||!t)&&P0.test(e)||(t==="v6"||!t)&&F0.test(e))}var Vr=class e extends xe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==te.string){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:te.string,received:i.parsedType}),de}let n=new st,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?ee(o,{code:K.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&ee(o,{code:K.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")_0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"email",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Bp||(Bp=new RegExp(k0,"u")),Bp.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"emoji",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")E0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"uuid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")R0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"nanoid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")w0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cuid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")x0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cuid2",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")C0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"ulid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ee(o,{validation:"url",code:K.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"regex",code:K.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?qv(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?L0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?q0(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?T0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"duration",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?j0(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"ip",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?U0(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"jwt",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?V0(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cidr",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?D0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"base64",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?M0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"base64url",code:K.invalid_string,message:i.message}),n.dirty()):Re.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:K.invalid_string,...ie.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ie.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ie.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ie.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ie.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ie.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ie.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ie.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ie.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ie.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ie.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ie.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ie.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ie.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...ie.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...ie.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ie.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ie.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ie.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ie.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ie.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ie.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ie.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ie.errToObj(r)})}nonempty(t){return this.min(1,ie.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Vr.create=e=>new Vr({checks:[],typeName:pe.ZodString,coerce:e?.coerce??!1,...be(e)});function G0(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var bn=class e extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==te.number){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:te.number,received:i.parsedType}),de}let n,o=new st;for(let i of this._def.checks)i.kind==="int"?Re.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{code:K.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?G0(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{code:K.not_finite,message:i.message}),o.dirty()):Re.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ie.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ie.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ie.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ie.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ie.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ie.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ie.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ie.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ie.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ie.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ie.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ie.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ie.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ie.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Re.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};bn.create=e=>new bn({checks:[],typeName:pe.ZodNumber,coerce:e?.coerce||!1,...be(e)});var An=class e extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==te.bigint)return this._getInvalidInput(t);let n,o=new st;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Re.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return ee(r,{code:K.invalid_type,expected:te.bigint,received:r.parsedType}),de}gte(t,r){return this.setLimit("min",t,!0,ie.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ie.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ie.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ie.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ie.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ie.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ie.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ie.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ie.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ie.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};An.create=e=>new An({checks:[],typeName:pe.ZodBigInt,coerce:e?.coerce??!1,...be(e)});var wn=class extends xe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==te.boolean){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.boolean,received:n.parsedType}),de}return ft(t.data)}};wn.create=e=>new wn({typeName:pe.ZodBoolean,coerce:e?.coerce||!1,...be(e)});var xn=class e extends xe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==te.date){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:te.date,received:i.parsedType}),de}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_date}),de}let n=new st,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Re.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:ie.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ie.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};xn.create=e=>new xn({checks:[],coerce:e?.coerce||!1,typeName:pe.ZodDate,...be(e)});var Lo=class extends xe{_parse(t){if(this._getType(t)!==te.symbol){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.symbol,received:n.parsedType}),de}return ft(t.data)}};Lo.create=e=>new Lo({typeName:pe.ZodSymbol,...be(e)});var Cn=class extends xe{_parse(t){if(this._getType(t)!==te.undefined){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.undefined,received:n.parsedType}),de}return ft(t.data)}};Cn.create=e=>new Cn({typeName:pe.ZodUndefined,...be(e)});var En=class extends xe{_parse(t){if(this._getType(t)!==te.null){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.null,received:n.parsedType}),de}return ft(t.data)}};En.create=e=>new En({typeName:pe.ZodNull,...be(e)});var Gr=class extends xe{constructor(){super(...arguments),this._any=!0}_parse(t){return ft(t.data)}};Gr.create=e=>new Gr({typeName:pe.ZodAny,...be(e)});var vr=class extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ft(t.data)}};vr.create=e=>new vr({typeName:pe.ZodUnknown,...be(e)});var Gt=class extends xe{_parse(t){let r=this._getOrReturnCtx(t);return ee(r,{code:K.invalid_type,expected:te.never,received:r.parsedType}),de}};Gt.create=e=>new Gt({typeName:pe.ZodNever,...be(e)});var qo=class extends xe{_parse(t){if(this._getType(t)!==te.undefined){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.void,received:n.parsedType}),de}return ft(t.data)}};qo.create=e=>new qo({typeName:pe.ZodVoid,...be(e)});var Sr=class e extends xe{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==te.array)return ee(r,{code:K.invalid_type,expected:te.array,received:r.parsedType}),de;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(ee(r,{code:a?K.too_big:K.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(ee(r,{code:K.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(ee(r,{code:K.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new Dt(r,a,r.path,s)))).then(a=>st.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Dt(r,a,r.path,s)));return st.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:ie.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ie.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ie.toString(r)}})}nonempty(t){return this.min(1,t)}};Sr.create=(e,t)=>new Sr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:pe.ZodArray,...be(t)});function Mo(e){if(e instanceof At){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Ft.create(Mo(n))}return new At({...e._def,shape:()=>t})}else return e instanceof Sr?new Sr({...e._def,type:Mo(e.element)}):e instanceof Ft?Ft.create(Mo(e.unwrap())):e instanceof er?er.create(Mo(e.unwrap())):e instanceof Jt?Jt.create(e.items.map(t=>Mo(t))):e}var At=class e extends xe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Re.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==te.object){let c=this._getOrReturnCtx(t);return ee(c,{code:K.invalid_type,expected:te.object,received:c.parsedType}),de}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Gt&&this._def.unknownKeys==="strip"))for(let c in o.data)a.includes(c)||s.push(c);let u=[];for(let c of a){let g=i[c],v=o.data[c];u.push({key:{status:"valid",value:c},value:g._parse(new Dt(o,v,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Gt){let c=this._def.unknownKeys;if(c==="passthrough")for(let g of s)u.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(c==="strict")s.length>0&&(ee(o,{code:K.unrecognized_keys,keys:s}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let g of s){let v=o.data[g];u.push({key:{status:"valid",value:g},value:c._parse(new Dt(o,v,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let c=[];for(let g of u){let v=yield g.key,R=yield g.value;c.push({key:v,value:R,alwaysSet:g.alwaysSet})}return c})).then(c=>st.mergeObjectSync(n,c)):st.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(t){return ie.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ie.errToObj(t).message??o}:{message:o}}}:{})})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:pe.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Re.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Re.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Mo(this)}partial(t){let r={};for(let n of Re.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Re.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Ft;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return jv(Re.objectKeys(this.shape))}};At.create=(e,t)=>new At({shape:()=>e,unknownKeys:"strip",catchall:Gt.create(),typeName:pe.ZodObject,...be(t)});At.strictCreate=(e,t)=>new At({shape:()=>e,unknownKeys:"strict",catchall:Gt.create(),typeName:pe.ZodObject,...be(t)});At.lazycreate=(e,t)=>new At({shape:e,unknownKeys:"strip",catchall:Gt.create(),typeName:pe.ZodObject,...be(t)});var Rn=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new bt(s.ctx.common.issues));return ee(r,{code:K.invalid_union,unionErrors:a}),de}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(i){let a={...r,common:{...r.common,issues:[]},parent:null};return{result:yield i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}});return function(_x87){return _ref15.apply(this,arguments)}}())).then(o);{let i,a=[];for(let u of n){let c={...r,common:{...r.common,issues:[]},parent:null},g=u._parseSync({data:r.data,path:r.path,parent:c});if(g.status==="valid")return g;g.status==="dirty"&&!i&&(i={result:g,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(u=>new bt(u));return ee(r,{code:K.invalid_union,unionErrors:s}),de}}get options(){return this._def.options}};Rn.create=(e,t)=>new Rn({options:e,typeName:pe.ZodUnion,...be(t)});var yr=e=>e instanceof Tn?yr(e.schema):e instanceof Mt?yr(e.innerType()):e instanceof _n?[e.value]:e instanceof kn?e.options:e instanceof On?Re.objectValues(e.enum):e instanceof Pn?yr(e._def.innerType):e instanceof Cn?[void 0]:e instanceof En?[null]:e instanceof Ft?[void 0,...yr(e.unwrap())]:e instanceof er?[null,...yr(e.unwrap())]:e instanceof aa||e instanceof Fn?yr(e.unwrap()):e instanceof Nn?yr(e._def.innerType):[],Ac=class e extends xe{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.object)return ee(r,{code:K.invalid_type,expected:te.object,received:r.parsedType}),de;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(ee(r,{code:K.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),de)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=yr(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:pe.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...be(n)})}};function $p(e,t){let r=Zt(e),n=Zt(t);if(e===t)return{valid:!0,data:e};if(r===te.object&&n===te.object){let o=Re.objectKeys(t),i=Re.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let u=$p(e[s],t[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===te.array&&n===te.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],u=$p(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===te.date&&n===te.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var In=class extends xe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(Sc(i)||Sc(a))return de;let s=$p(i.value,a.value);return s.valid?((bc(i)||bc(a))&&r.dirty(),{status:r.value,value:s.data}):(ee(n,{code:K.invalid_intersection_types}),de)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};In.create=(e,t,r)=>new In({left:e,right:t,typeName:pe.ZodIntersection,...be(r)});var Jt=class e extends xe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.array)return ee(n,{code:K.invalid_type,expected:te.array,received:n.parsedType}),de;if(n.data.length<this._def.items.length)return ee(n,{code:K.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),de;!this._def.rest&&n.data.length>this._def.items.length&&(ee(n,{code:K.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let u=this._def.items[s]||this._def.rest;return u?u._parse(new Dt(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>st.mergeArray(r,a)):st.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Jt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Jt({items:e,typeName:pe.ZodTuple,rest:null,...be(t)})};var wc=class e extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.object)return ee(n,{code:K.invalid_type,expected:te.object,received:n.parsedType}),de;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Dt(n,s,n.path,s)),value:a._parse(new Dt(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?st.mergeObjectAsync(r,o):st.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof xe?new e({keyType:t,valueType:r,typeName:pe.ZodRecord,...be(n)}):new e({keyType:Vr.create(),valueType:t,typeName:pe.ZodRecord,...be(r)})}},jo=class extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.map)return ee(n,{code:K.invalid_type,expected:te.map,received:n.parsedType}),de;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],c)=>({key:o._parse(new Dt(n,s,n.path,[c,"key"])),value:i._parse(new Dt(n,u,n.path,[c,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let u of a){let c=yield u.key,g=yield u.value;if(c.status==="aborted"||g.status==="aborted")return de;(c.status==="dirty"||g.status==="dirty")&&r.dirty(),s.set(c.value,g.value)}return{status:r.value,value:s}}))}else{let s=new Map;for(let u of a){let c=u.key,g=u.value;if(c.status==="aborted"||g.status==="aborted")return de;(c.status==="dirty"||g.status==="dirty")&&r.dirty(),s.set(c.value,g.value)}return{status:r.value,value:s}}}};jo.create=(e,t,r)=>new jo({valueType:t,keyType:e,typeName:pe.ZodMap,...be(r)});var Uo=class e extends xe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.set)return ee(n,{code:K.invalid_type,expected:te.set,received:n.parsedType}),de;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ee(n,{code:K.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(ee(n,{code:K.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(u){let c=new Set;for(let g of u){if(g.status==="aborted")return de;g.status==="dirty"&&r.dirty(),c.add(g.value)}return{status:r.value,value:c}}let s=[...n.data.values()].map((u,c)=>i._parse(new Dt(n,u,n.path,c)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:ie.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ie.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Uo.create=(e,t)=>new Uo({valueType:e,minSize:null,maxSize:null,typeName:pe.ZodSet,...be(t)});var xc=class e extends xe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.function)return ee(r,{code:K.invalid_type,expected:te.function,received:r.parsedType}),de;function n(s,u){return ia({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Fo(),hr].filter(c=>!!c),issueData:{code:K.invalid_arguments,argumentsError:u}})}function o(s,u){return ia({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Fo(),hr].filter(c=>!!c),issueData:{code:K.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Br){let s=this;return ft(/*#__PURE__*/_asyncToGenerator(function*(...u){let c=new bt([]),g=yield s._def.args.parseAsync(u,i).catch(h=>{throw c.addIssue(n(u,h)),c}),v=yield Reflect.apply(a,this,g);return yield s._def.returns._def.type.parseAsync(v,i).catch(h=>{throw c.addIssue(o(v,h)),c})}))}else{let s=this;return ft(function(...u){let c=s._def.args.safeParse(u,i);if(!c.success)throw new bt([n(u,c.error)]);let g=Reflect.apply(a,this,c.data),v=s._def.returns.safeParse(g,i);if(!v.success)throw new bt([o(g,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Jt.create(t).rest(vr.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Jt.create([]).rest(vr.create()),returns:r||vr.create(),typeName:pe.ZodFunction,...be(n)})}},Tn=class extends xe{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Tn.create=(e,t)=>new Tn({getter:e,typeName:pe.ZodLazy,...be(t)});var _n=class extends xe{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return ee(r,{received:r.data,code:K.invalid_literal,expected:this._def.value}),de}return{status:"valid",value:t.data}}get value(){return this._def.value}};_n.create=(e,t)=>new _n({value:e,typeName:pe.ZodLiteral,...be(t)});function jv(e,t){return new kn({values:e,typeName:pe.ZodEnum,...be(t)})}var kn=class e extends xe{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return ee(r,{expected:Re.joinValues(n),received:r.parsedType,code:K.invalid_type}),de}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return ee(r,{received:r.data,code:K.invalid_enum_value,options:n}),de}return ft(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};kn.create=jv;var On=class extends xe{_parse(t){let r=Re.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==te.string&&n.parsedType!==te.number){let o=Re.objectValues(r);return ee(n,{expected:Re.joinValues(o),received:n.parsedType,code:K.invalid_type}),de}if(this._cache||(this._cache=new Set(Re.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Re.objectValues(r);return ee(n,{received:n.data,code:K.invalid_enum_value,options:o}),de}return ft(t.data)}get enum(){return this._def.values}};On.create=(e,t)=>new On({values:e,typeName:pe.ZodNativeEnum,...be(t)});var Br=class extends xe{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.promise&&r.common.async===!1)return ee(r,{code:K.invalid_type,expected:te.promise,received:r.parsedType}),de;let n=r.parsedType===te.promise?r.data:Promise.resolve(r.data);return ft(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Br.create=(e,t)=>new Br({type:e,typeName:pe.ZodPromise,...be(t)});var Mt=class extends xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===pe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this12=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{ee(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(/*#__PURE__*/function(){var _ref18=_asyncToGenerator(function*(s){if(r.value==="aborted")return de;let u=yield _this12._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?de:u.status==="dirty"?Sn(u.value):r.value==="dirty"?Sn(u.value):u});return function(_x88){return _ref18.apply(this,arguments)}}());{if(r.value==="aborted")return de;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?de:s.status==="dirty"?Sn(s.value):r.value==="dirty"?Sn(s.value):s}}if(o.type==="refinement"){let a=s=>{let u=o.refinement(s,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?de:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?de:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ur(a))return de;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Ur(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):de);Re.assertNever(o)}};Mt.create=(e,t,r)=>new Mt({schema:e,typeName:pe.ZodEffects,effect:t,...be(r)});Mt.createWithPreprocess=(e,t,r)=>new Mt({schema:t,effect:{type:"preprocess",transform:e},typeName:pe.ZodEffects,...be(r)});var Ft=class extends xe{_parse(t){return this._getType(t)===te.undefined?ft(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ft.create=(e,t)=>new Ft({innerType:e,typeName:pe.ZodOptional,...be(t)});var er=class extends xe{_parse(t){return this._getType(t)===te.null?ft(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};er.create=(e,t)=>new er({innerType:e,typeName:pe.ZodNullable,...be(t)});var Pn=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===te.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Pn.create=(e,t)=>new Pn({innerType:e,typeName:pe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...be(t)});var Nn=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Do(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new bt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Nn.create=(e,t)=>new Nn({innerType:e,typeName:pe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...be(t)});var Vo=class extends xe{_parse(t){if(this._getType(t)!==te.nan){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.nan,received:n.parsedType}),de}return{status:"valid",value:t.data}}};Vo.create=e=>new Vo({typeName:pe.ZodNaN,...be(e)});var B0=Symbol("zod_brand"),aa=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},sa=class e extends xe{_parse(t){var _this13=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let i=yield _this13._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?de:i.status==="dirty"?(r.dirty(),Sn(i.value)):_this13._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?de:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:pe.ZodPipeline})}},Fn=class extends xe{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Ur(o)&&(o.value=Object.freeze(o.value)),o);return Do(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Fn.create=(e,t)=>new Fn({innerType:e,typeName:pe.ZodReadonly,...be(t)});function Dv(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Uv(e,t={},r){return e?Gr.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=Dv(t,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=Dv(t,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):Gr.create()}var $0={object:At.lazycreate},pe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(pe||(pe={}));var Q0=(e,t={message:`Input not instance of ${e.name}`})=>Uv(r=>r instanceof e,t),Vv=Vr.create,Gv=bn.create,H0=Vo.create,z0=An.create,Bv=wn.create,W0=xn.create,K0=Lo.create,Y0=Cn.create,X0=En.create,Z0=Gr.create,J0=vr.create,e_=Gt.create,t_=qo.create,r_=Sr.create,n_=At.create,o_=At.strictCreate,i_=Rn.create,a_=Ac.create,s_=In.create,c_=Jt.create,u_=wc.create,l_=jo.create,d_=Uo.create,p_=xc.create,f_=Tn.create,m_=_n.create,g_=kn.create,h_=On.create,y_=Br.create,v_=Mt.create,S_=Ft.create,b_=er.create,A_=Mt.createWithPreprocess,w_=sa.create,x_=()=>Vv().optional(),C_=()=>Gv().optional(),E_=()=>Bv().optional(),R_={string:e=>Vr.create({...e,coerce:!0}),number:e=>bn.create({...e,coerce:!0}),boolean:e=>wn.create({...e,coerce:!0}),bigint:e=>An.create({...e,coerce:!0}),date:e=>xn.create({...e,coerce:!0})};var I_=de;var T_=S.record(S.any()),Dn=T_.optional();function $v(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var __=S.object({name:S.string(),arguments:S.string()}),k_=S.object({id:S.string(),type:S.literal("function"),function:__,encryptedValue:S.string().optional(),metadata:Dn}),Cc=S.object({id:S.string(),role:S.string(),content:S.string().optional(),name:S.string().optional(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Dn}),O_=S.object({type:S.literal("text"),text:S.string()}),P_=S.object({type:S.literal("data"),value:S.string(),mimeType:S.string()}),N_=S.object({type:S.literal("url"),value:S.string(),mimeType:S.string().optional()}),Ec=S.discriminatedUnion("type",[P_,N_]),F_=S.object({type:S.literal("image"),source:Ec,metadata:S.unknown().optional()}),D_=S.object({type:S.literal("audio"),source:Ec,metadata:S.unknown().optional()}),M_=S.object({type:S.literal("video"),source:Ec,metadata:S.unknown().optional()}),L_=S.object({type:S.literal("document"),source:Ec,metadata:S.unknown().optional()});var Qv=S.object({type:S.literal("binary"),mimeType:S.string(),id:S.string().optional(),url:S.string().optional(),data:S.string().optional(),filename:S.string().optional()}),Hv=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:S.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},z8=Qv.superRefine((e,t)=>{Hv(e,t)}),q_=S.discriminatedUnion("type",[O_,F_,D_,M_,L_,Qv]),j_=q_.superRefine((e,t)=>{e.type==="binary"&&Hv(e,t)}),U_=Cc.extend({role:S.literal("developer"),content:S.string()}),V_=Cc.extend({role:S.literal("system"),content:S.string()}),G_=Cc.extend({role:S.literal("assistant"),content:S.string().optional(),toolCalls:S.array(k_).optional()}),B_=Cc.extend({role:S.literal("user"),content:S.union([S.string(),S.array(j_)])}),$_=S.object({id:S.string(),content:S.string(),role:S.literal("tool"),toolCallId:S.string(),error:S.string().optional(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Dn}),Q_=S.object({id:S.string(),role:S.literal("activity"),activityType:S.string(),content:S.record(S.any()),subagentRunId:S.string().optional(),metadata:Dn}),H_=S.object({id:S.string(),role:S.literal("reasoning"),content:S.string(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Dn}),zv=S.discriminatedUnion("role",[U_,V_,G_,B_,$_,Q_,H_]),W8=S.union([S.literal("developer"),S.literal("system"),S.literal("assistant"),S.literal("user"),S.literal("tool"),S.literal("activity"),S.literal("reasoning")]),z_=S.object({description:S.string(),value:S.string()}),Wv=S.object({name:S.string(),description:S.string(),parameters:S.any(),metadata:S.record(S.any()).optional()}),W_=S.object({id:S.string(),reason:S.string(),message:S.string().optional(),toolCallId:S.string().optional(),responseSchema:S.record(S.any()).optional(),expiresAt:S.string().optional(),metadata:S.record(S.any()).optional(),subagentRunId:S.string().optional()}),K_=S.object({interruptId:S.string(),status:S.enum(["resolved","cancelled"]),payload:S.any().optional(),metadata:Dn}),Y_=S.object({threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),state:S.any().transform(e=>e??void 0),messages:S.array(zv),tools:S.array(Wv),context:S.array(z_),forwardedProps:S.any(),resume:S.array(K_).optional()}),X_=S.any(),ge=class extends Error{constructor(e){super(e)}},Qp=class extends ge{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},Z_=S.object({name:S.string(),description:S.string().optional()}),J_=S.object({name:S.string().optional(),type:S.string().optional(),description:S.string().optional(),version:S.string().optional(),provider:S.string().optional(),documentationUrl:S.string().optional(),metadata:S.record(S.unknown()).optional()}),ek=S.object({streaming:S.boolean().optional(),websocket:S.boolean().optional(),httpBinary:S.boolean().optional(),pushNotifications:S.boolean().optional(),resumable:S.boolean().optional()}),tk=S.object({supported:S.boolean().optional(),items:S.array(Wv).optional(),parallelCalls:S.boolean().optional(),clientProvided:S.boolean().optional()}),rk=S.object({structuredOutput:S.boolean().optional(),supportedMimeTypes:S.array(S.string()).optional()}),nk=S.object({snapshots:S.boolean().optional(),deltas:S.boolean().optional(),memory:S.boolean().optional(),persistentState:S.boolean().optional()}),ok=S.object({supported:S.boolean().optional(),delegation:S.boolean().optional(),handoffs:S.boolean().optional(),subAgents:S.array(Z_).optional()}),ik=S.object({supported:S.boolean().optional(),streaming:S.boolean().optional(),encrypted:S.boolean().optional()}),ak=S.object({image:S.boolean().optional(),audio:S.boolean().optional(),video:S.boolean().optional(),pdf:S.boolean().optional(),file:S.boolean().optional()}),sk=S.object({image:S.boolean().optional(),audio:S.boolean().optional()}),ck=S.object({input:ak.optional(),output:sk.optional()}),uk=S.object({codeExecution:S.boolean().optional(),sandboxed:S.boolean().optional(),maxIterations:S.number().optional(),maxExecutionTime:S.number().optional()}),lk=S.object({supported:S.boolean().optional(),approvals:S.boolean().optional(),interventions:S.boolean().optional(),feedback:S.boolean().optional(),interrupts:S.boolean().optional(),approveWithEdits:S.boolean().optional()}),K8=S.object({identity:J_.optional(),transport:ek.optional(),tools:tk.optional(),output:rk.optional(),state:nk.optional(),multiAgent:ok.optional(),reasoning:ik.optional(),multimodal:ck.optional(),execution:uk.optional(),humanInTheLoop:lk.optional(),custom:S.record(S.unknown()).optional()}),Kv=S.union([S.literal("developer"),S.literal("system"),S.literal("assistant"),S.literal("user")]),F=function(e){return e.TEXT_MESSAGE_START="TEXT_MESSAGE_START",e.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",e.TEXT_MESSAGE_END="TEXT_MESSAGE_END",e.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",e.TOOL_CALL_START="TOOL_CALL_START",e.TOOL_CALL_ARGS="TOOL_CALL_ARGS",e.TOOL_CALL_END="TOOL_CALL_END",e.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",e.TOOL_CALL_RESULT="TOOL_CALL_RESULT",e.THINKING_START="THINKING_START",e.THINKING_END="THINKING_END",e.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",e.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",e.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",e.STATE_SNAPSHOT="STATE_SNAPSHOT",e.STATE_DELTA="STATE_DELTA",e.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",e.ACTIVITY_SNAPSHOT="ACTIVITY_SNAPSHOT",e.ACTIVITY_DELTA="ACTIVITY_DELTA",e.RAW="RAW",e.CUSTOM="CUSTOM",e.RUN_STARTED="RUN_STARTED",e.RUN_FINISHED="RUN_FINISHED",e.RUN_ERROR="RUN_ERROR",e.STEP_STARTED="STEP_STARTED",e.STEP_FINISHED="STEP_FINISHED",e.REASONING_START="REASONING_START",e.REASONING_MESSAGE_START="REASONING_MESSAGE_START",e.REASONING_MESSAGE_CONTENT="REASONING_MESSAGE_CONTENT",e.REASONING_MESSAGE_END="REASONING_MESSAGE_END",e.REASONING_MESSAGE_CHUNK="REASONING_MESSAGE_CHUNK",e.REASONING_END="REASONING_END",e.REASONING_ENCRYPTED_VALUE="REASONING_ENCRYPTED_VALUE",e.SUBAGENT_STARTED="SUBAGENT_STARTED",e.SUBAGENT_FINISHED="SUBAGENT_FINISHED",e.SUBAGENT_ERROR="SUBAGENT_ERROR",e}({}),Ie=S.object({type:S.nativeEnum(F),timestamp:S.number().optional(),rawEvent:S.any().optional(),metadata:Dn}).passthrough(),dk=Ie.extend({type:S.literal(F.TEXT_MESSAGE_START),messageId:S.string(),role:Kv.default("assistant"),name:S.string().optional(),subagentRunId:S.string().optional()}),Yv=Ie.extend({type:S.literal(F.TEXT_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),pk=Ie.extend({type:S.literal(F.TEXT_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),fk=Ie.extend({type:S.literal(F.TEXT_MESSAGE_CHUNK),messageId:S.string().optional(),role:Kv.optional(),delta:S.string().optional(),name:S.string().optional(),subagentRunId:S.string().optional()}),mk=Ie.extend({type:S.literal(F.THINKING_TEXT_MESSAGE_START)}),gk=Yv.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:S.literal(F.THINKING_TEXT_MESSAGE_CONTENT)}),hk=Ie.extend({type:S.literal(F.THINKING_TEXT_MESSAGE_END)}),yk=Ie.extend({type:S.literal(F.TOOL_CALL_START),toolCallId:S.string(),toolCallName:S.string(),parentMessageId:S.string().nullable().optional().transform(e=>e??void 0),subagentRunId:S.string().optional()}),vk=Ie.extend({type:S.literal(F.TOOL_CALL_ARGS),toolCallId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),Sk=Ie.extend({type:S.literal(F.TOOL_CALL_END),toolCallId:S.string(),subagentRunId:S.string().optional()}),bk=Ie.extend({messageId:S.string(),type:S.literal(F.TOOL_CALL_RESULT),toolCallId:S.string(),content:S.string(),role:S.literal("tool").optional(),subagentRunId:S.string().optional()}),Ak=Ie.extend({type:S.literal(F.TOOL_CALL_CHUNK),toolCallId:S.string().optional(),toolCallName:S.string().optional(),parentMessageId:S.string().nullable().optional().transform(e=>e??void 0),delta:S.string().optional(),subagentRunId:S.string().optional()}),wk=Ie.extend({type:S.literal(F.THINKING_START),title:S.string().optional()}),xk=Ie.extend({type:S.literal(F.THINKING_END)}),Ck=Ie.extend({type:S.literal(F.STATE_SNAPSHOT),snapshot:X_,subagentRunId:S.string().optional()}),Ek=Ie.extend({type:S.literal(F.STATE_DELTA),delta:S.array(S.any()),subagentRunId:S.string().optional()}),Rk=Ie.extend({type:S.literal(F.MESSAGES_SNAPSHOT),messages:S.array(zv)}),Ik=Ie.extend({type:S.literal(F.ACTIVITY_SNAPSHOT),messageId:S.string(),activityType:S.string(),content:S.record(S.any()),replace:S.boolean().optional().default(!0),subagentRunId:S.string().optional()}),Tk=Ie.extend({type:S.literal(F.ACTIVITY_DELTA),messageId:S.string(),activityType:S.string(),patch:S.array(S.any()),subagentRunId:S.string().optional()}),_k=Ie.extend({type:S.literal(F.RAW),event:S.any(),source:S.string().optional(),subagentRunId:S.string().optional()}),kk=Ie.extend({type:S.literal(F.CUSTOM),name:S.string(),value:S.any(),subagentRunId:S.string().optional()}),Ok=Ie.extend({type:S.literal(F.RUN_STARTED),threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),input:Y_.optional()}),Pk=S.object({type:S.literal("success")}).strict(),Nk=S.object({type:S.literal("interrupt"),interrupts:S.array(W_).min(1)}).strict(),Fk=S.discriminatedUnion("type",[Pk,Nk]),Xv=S.object({provider:S.string().optional(),model:S.string().optional(),inputTokens:S.number().int().nonnegative().optional(),outputTokens:S.number().int().nonnegative().optional(),totalTokens:S.number().int().nonnegative().optional(),reasoningTokens:S.number().int().nonnegative().optional(),cachedInputTokens:S.number().int().nonnegative().optional()}),Dk=Ie.extend({type:S.literal(F.RUN_FINISHED),threadId:S.string(),runId:S.string(),result:S.any().optional(),outcome:Fk.nullable().optional().transform(e=>e??void 0),usage:S.array(Xv).optional()}),Mk=Ie.extend({type:S.literal(F.RUN_ERROR),message:S.string(),code:S.string().optional(),usage:S.array(Xv).optional()}),Lk=Ie.extend({type:S.literal(F.STEP_STARTED),stepName:S.string(),subagentRunId:S.string().optional()}),qk=Ie.extend({type:S.literal(F.STEP_FINISHED),stepName:S.string(),subagentRunId:S.string().optional()}),jk=S.union([S.literal("tool-call"),S.literal("message")]),Uk=Ie.extend({type:S.literal(F.REASONING_START),messageId:S.string(),subagentRunId:S.string().optional()}),Vk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_START),messageId:S.string(),role:S.literal("reasoning"),subagentRunId:S.string().optional()}),Gk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),Bk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),$k=Ie.extend({type:S.literal(F.REASONING_MESSAGE_CHUNK),messageId:S.string().optional(),delta:S.string().optional(),subagentRunId:S.string().optional()}),Qk=Ie.extend({type:S.literal(F.REASONING_END),messageId:S.string(),subagentRunId:S.string().optional()}),Hk=Ie.extend({type:S.literal(F.REASONING_ENCRYPTED_VALUE),subtype:jk,entityId:S.string(),encryptedValue:S.string(),subagentRunId:S.string().optional()}),zk=Ie.extend({type:S.literal(F.SUBAGENT_STARTED),subagentRunId:S.string(),name:S.string(),description:S.string().optional(),parentSubagentRunId:S.string().optional(),parentToolCallId:S.string().optional(),parentMessageId:S.string().optional()}),Wk=S.object({type:S.literal("success")}).strict(),Kk=S.object({type:S.literal("suspended"),interruptIds:S.array(S.string()).optional()}).strict(),Yk=S.discriminatedUnion("type",[Wk,Kk]),Xk=Ie.extend({type:S.literal(F.SUBAGENT_FINISHED),subagentRunId:S.string(),result:S.any().optional(),outcome:Yk.optional()}),Zk=Ie.extend({type:S.literal(F.SUBAGENT_ERROR),subagentRunId:S.string(),message:S.string(),code:S.string().optional()}),Rc=S.discriminatedUnion("type",[dk,Yv,pk,fk,wk,xk,mk,gk,hk,yk,vk,Sk,Ak,bk,Ck,Ek,Rk,Ik,Tk,_k,kk,Ok,Dk,Mk,Lk,qk,Uk,Vk,Gk,Bk,$k,Qk,Hk,zk,Xk,Zk]);m();d();f();p();var Hp={};ui(Hp,{JsonPatchError:()=>$e,_areEquals:()=>la,applyOperation:()=>Mn,applyPatch:()=>Nc,applyReducer:()=>nO,deepClone:()=>tO,getValueByPointer:()=>Oc,validate:()=>Jv,validator:()=>Pc});m();d();f();p();m();d();f();p();var Jk=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),eO=Object.prototype.hasOwnProperty;function Tc(e,t){return eO.call(e,t)}function _c(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var o in e)Tc(e,o)&&n.push(o);return n}function ct(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function kc(e){for(var t=0,r=e.length,n;t<r;){if(n=e.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0}function tr(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function ca(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Ic(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Ic(e[t]))return!0}else if(typeof e=="object"){for(var n=_c(e),o=n.length,i=0;i<o;i++)if(Ic(e[n[i]]))return!0}}return!1}function Zv(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
|
|
33
|
+
`)}var ua=function(e){Jk(t,e);function t(r,n,o,i,a){var s=this.constructor,u=e.call(this,Zv(r,{name:n,index:o,operation:i,tree:a}))||this;return u.name=n,u.index=o,u.operation=i,u.tree=a,Object.setPrototypeOf(u,s.prototype),u.message=Zv(r,{name:n,index:o,operation:i,tree:a}),u}return t}(Error);var $e=ua,tO=ct,Go={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=Oc(r,this.path);n&&(n=ct(n));var o=Mn(r,{op:"remove",path:this.from}).removed;return Mn(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Oc(r,this.from);return Mn(r,{op:"add",path:this.path,value:ct(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:la(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},rO={add:function(e,t,r){return kc(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:Go.move,copy:Go.copy,test:Go.test,_get:Go._get};function Oc(e,t){if(t=="")return e;var r={op:"_get",path:t};return Mn(e,r),r.value}function Mn(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):Pc(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=Oc(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=la(e,t.value),a.test===!1)throw new $e("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 $e("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{n||(e=ct(e));var s=t.path||"",u=s.split("/"),c=e,g=1,v=u.length,R=void 0,h=void 0,y=void 0;for(typeof r=="function"?y=r:y=Pc;;){if(h=u[g],h&&h.indexOf("~")!=-1&&(h=ca(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&u[g-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&R===void 0&&(c[h]===void 0?R=u.slice(0,g).join("/"):g==v-1&&(R=t.path),R!==void 0&&y(t,0,e,R)),g++,Array.isArray(c)){if(h==="-")h=c.length;else{if(r&&!kc(h))throw new $e("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);kc(h)&&(h=~~h)}if(g>=v){if(r&&t.op==="add"&&h>c.length)throw new $e("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=rO[t.op].call(t,c,h,e);if(a.test===!1)throw new $e("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(g>=v){var a=Go[t.op].call(t,c,h,e);if(a.test===!1)throw new $e("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(c=c[h],r&&g<v&&(!c||typeof c!="object"))throw new $e("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function Nc(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new $e("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=ct(e));for(var i=new Array(t.length),a=0,s=t.length;a<s;a++)i[a]=Mn(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function nO(e,t,r){var n=Mn(e,t);if(n.test===!1)throw new $e("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Pc(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new $e("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Go[e.op]){if(typeof e.path!="string")throw new $e("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new $e("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 $e("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 $e("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")&&Ic(e.value))throw new $e("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 $e("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 $e("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},s=Jv([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new $e("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new $e("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function Jv(e,t,r){try{if(!Array.isArray(e))throw new $e("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Nc(ct(t),ct(e),r||!0);else{r=r||Pc;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof $e)return o;throw o}}function la(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(!la(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var s=Object.keys(e);if(i=s.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(s[o]))return!1;for(o=i;o--!==0;)if(a=s[o],!la(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var Yp={};ui(Yp,{compare:()=>dO,generate:()=>zp,observe:()=>lO,unobserve:()=>uO});m();d();f();p();var Wp=new WeakMap,oO=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),iO=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function aO(e){return Wp.get(e)}function sO(e,t){return e.observers.get(t)}function cO(e,t){e.observers.delete(t.callback)}function uO(e,t){t.unobserve()}function lO(e,t){var r=[],n,o=aO(e);if(!o)o=new oO(e),Wp.set(e,o);else{var i=sO(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=ct(e),t){n.callback=t,n.next=null;var a=function(){zp(n)},s=function(){clearTimeout(n.next),n.next=setTimeout(a)};typeof window<"u"&&(window.addEventListener("mouseup",s),window.addEventListener("keyup",s),window.addEventListener("mousedown",s),window.addEventListener("keydown",s),window.addEventListener("change",s))}return n.patches=r,n.object=e,n.unobserve=function(){zp(n),clearTimeout(n.next),cO(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",s),window.removeEventListener("keyup",s),window.removeEventListener("mousedown",s),window.removeEventListener("keydown",s),window.removeEventListener("change",s))},o.observers.set(t,new iO(t,n)),n}function zp(e,t){t===void 0&&(t=!1);var r=Wp.get(e.object);Kp(r.value,e.object,e.patches,"",t),e.patches.length&&Nc(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Kp(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=_c(t),a=_c(e),s=!1,u=!1,c=a.length-1;c>=0;c--){var g=a[c],v=e[g];if(Tc(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var R=t[g];typeof v=="object"&&v!=null&&typeof R=="object"&&R!=null&&Array.isArray(v)===Array.isArray(R)?Kp(v,R,r,n+"/"+tr(g),o):v!==R&&(s=!0,o&&r.push({op:"test",path:n+"/"+tr(g),value:ct(v)}),r.push({op:"replace",path:n+"/"+tr(g),value:ct(R)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+tr(g),value:ct(v)}),r.push({op:"remove",path:n+"/"+tr(g)}),u=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),s=!0)}if(!(!u&&i.length==a.length))for(var c=0;c<i.length;c++){var g=i[c];!Tc(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+tr(g),value:ct(t[g])})}}}function dO(e,t,r){r===void 0&&(r=!1);var n=[];return Kp(e,t,n,"",r),n}var Fc=Object.assign({},Hp,Yp,{JsonPatchError:ua,deepClone:ct,escapePathComponent:tr,unescapePathComponent:ca});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Xp=function(e,t){return Xp=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])},Xp(e,t)};function rr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Xp(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function eS(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 s(g){try{c(n.next(g))}catch(v){a(v)}}function u(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})}function Dc(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=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function br(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 Bo(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(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function $o(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 Ln(e){return this instanceof Ln?(this.v=e,this):new Ln(e)}function tS(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),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(h){return function(y){return Promise.resolve(y).then(h,v)}}function s(h,y){n[h]&&(o[h]=function(b){return new Promise(function(x,I){i.push([h,b,x,I])>1||u(h,b)})},y&&(o[h]=y(o[h])))}function u(h,y){try{c(n[h](y))}catch(b){R(i[0][3],b)}}function c(h){h.value instanceof Ln?Promise.resolve(h.value.v).then(g,v):R(i[0][2],h)}function g(h){u("next",h)}function v(h){u("throw",h)}function R(h,y){h(y),i.shift(),i.length&&u(i[0][0],i[0][1])}}function rS(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 br=="function"?br(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(s,u){a=e[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(c){i({value:c,done:s})},a)}}m();d();f();p();function Ee(e){return typeof e=="function"}m();d();f();p();m();d();f();p();m();d();f();p();function Qo(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 Mc=Qo(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
34
34
|
`+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
|
|
35
|
-
`):"",this.name="UnsubscriptionError",this.errors=r}});m();d();f();p();function da(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ho=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 s=br(a),u=s.next();!u.done;u=s.next()){var c=u.value;c.remove(this)}}catch(b){t={error:b}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}else a.remove(this);var g=this.initialTeardown;if(Ee(g))try{g()}catch(b){i=b instanceof Mc?b.errors:[b]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var R=br(v),h=R.next();!h.done;h=R.next()){var y=h.value;try{nS(y)}catch(b){i=i??[],b instanceof Mc?i=$o($o([],Bo(i)),Bo(b.errors)):i.push(b)}}}catch(b){n={error:b}}finally{try{h&&!h.done&&(o=R.return)&&o.call(R)}finally{if(n)throw n.error}}}if(i)throw new Mc(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)nS(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)&&da(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&da(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Jp=Ho.EMPTY;function Lc(e){return e instanceof Ho||e&&"closed"in e&&Ee(e.remove)&&Ee(e.add)&&Ee(e.unsubscribe)}function nS(e){Ee(e)?e():e.unsubscribe()}m();d();f();p();var Bt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var zo={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=zo.delegate;return o?.setTimeout?o.setTimeout.apply(o,$o([e,t],Bo(r))):setTimeout.apply(void 0,$o([e,t],Bo(r)))},clearTimeout:function(e){var t=zo.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function qc(e){zo.setTimeout(function(){var t=Bt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function pa(){}m();d();f();p();var oS=function(){return ef("C",void 0,void 0)}();function iS(e){return ef("E",void 0,e)}function aS(e){return ef("N",e,void 0)}function ef(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var qn=null;function Wo(e){if(Bt.useDeprecatedSynchronousErrorHandling){var t=!qn;if(t&&(qn={errorThrown:!1,error:null}),e(),t){var r=qn,n=r.errorThrown,o=r.error;if(qn=null,n)throw o}}else e()}function sS(e){Bt.useDeprecatedSynchronousErrorHandling&&qn&&(qn.errorThrown=!0,qn.error=e)}var fa=function(e){rr(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Lc(r)&&r.add(n)):n.destination=gO,n}return t.create=function(r,n,o){return new Uc(r,n,o)},t.prototype.next=function(r){this.isStopped?rf(aS(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?rf(iS(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?rf(oS,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}(Ho);var pO=Function.prototype.bind;function tf(e,t){return pO.call(e,t)}var fO=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){jc(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){jc(n)}else jc(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){jc(r)}},e}(),Uc=function(e){rr(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(Ee(r)||!r)a={next:r??void 0,error:n??void 0,complete:o??void 0};else{var s;i&&Bt.useDeprecatedNextContext?(s=Object.create(r),s.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&tf(r.next,s),error:r.error&&tf(r.error,s),complete:r.complete&&tf(r.complete,s)}):a=r}return i.destination=new fO(a),i}return t}(fa);function jc(e){Bt.useDeprecatedSynchronousErrorHandling?sS(e):qc(e)}function mO(e){throw e}function rf(e,t){var r=Bt.onStoppedNotification;r&&zo.setTimeout(function(){return r(e,t)})}var gO={closed:!0,next:pa,error:mO,complete:pa};m();d();f();p();var Ko=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function Yo(e){return e}function Vc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return nf(e)}function nf(e){return e.length===0?Yo:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var Ve=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=yO(t)?t:new Uc(t,r,n);return Wo(function(){var a=o,s=a.operator,u=a.source;i.add(s?s.call(i,u):u?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=cS(r),new r(function(o,i){var a=new Uc({next:function(s){try{t(s)}catch(u){i(u),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[Ko]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return nf(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=cS(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 cS(e){var t;return(t=e??Bt.Promise)!==null&&t!==void 0?t:Promise}function hO(e){return e&&Ee(e.next)&&Ee(e.error)&&Ee(e.complete)}function yO(e){return e&&e instanceof fa||hO(e)&&Lc(e)}m();d();f();p();function vO(e){return Ee(e?.lift)}function Qe(e){return function(t){if(vO(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}m();d();f();p();function We(e,t,r,n,o){return new SO(e,t,r,n,o)}var SO=function(e){rr(t,e);function t(r,n,o,i,a,s){var u=e.call(this,r)||this;return u.onFinalize=a,u.shouldUnsubscribe=s,u._next=n?function(c){try{n(c)}catch(g){r.error(g)}}:e.prototype._next,u._error=i?function(c){try{i(c)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=o?function(){try{o()}catch(c){r.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,u}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(fa);m();d();f();p();m();d();f();p();var uS=Qo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var nr=function(e){rr(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 lS(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new uS},t.prototype.next=function(r){var n=this;Wo(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=br(n.currentObservers),s=a.next();!s.done;s=a.next()){var u=s.value;u.next(r)}}catch(c){o={error:c}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;Wo(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;Wo(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,s=o.observers;return i||a?Jp:(this.currentObservers=null,s.push(r),new Ho(function(){n.currentObservers=null,da(s,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 Ve;return r.source=this,r},t.create=function(r,n){return new lS(r,n)},t}(Ve);var lS=function(e){rr(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:Jp},t}(nr);m();d();f();p();m();d();f();p();var of={now:function(){return(of.delegate||Date).now()},delegate:void 0};var Gc=function(e){rr(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=of);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,s=n._timestampProvider,u=n._windowTime;o||(i.push(r),!a&&i.push(s.now()+u)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,i=o._infiniteTimeWindow,a=o._buffer,s=a.slice(),u=0;u<s.length&&!r.closed;u+=i?1:2)r.next(s[u]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,i=r._buffer,a=r._infiniteTimeWindow,s=(a?1:2)*n;if(n<1/0&&s<i.length&&i.splice(0,i.length-s),!a){for(var u=o.now(),c=0,g=1;g<i.length&&i[g]<=u;g+=2)c=g;c&&i.splice(0,c+1)}},t}(nr);m();d();f();p();var Bc=new Ve(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function dS(e){return e&&Ee(e.schedule)}function bO(e){return e[e.length-1]}function pS(e){return dS(bO(e))?e.pop():void 0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var $c=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function Qc(e){return Ee(e?.then)}m();d();f();p();function Hc(e){return Ee(e[Ko])}m();d();f();p();function zc(e){return Symbol.asyncIterator&&Ee(e?.[Symbol.asyncIterator])}m();d();f();p();function Wc(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}m();d();f();p();m();d();f();p();function AO(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Kc=AO();function Yc(e){return Ee(e?.[Kc])}m();d();f();p();function Xc(e){return tS(this,arguments,function(){var r,n,o,i;return Dc(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,Ln(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,Ln(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Ln(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 Zc(e){return Ee(e?.getReader)}function Xe(e){if(e instanceof Ve)return e;if(e!=null){if(Hc(e))return wO(e);if($c(e))return xO(e);if(Qc(e))return CO(e);if(zc(e))return fS(e);if(Yc(e))return EO(e);if(Zc(e))return RO(e)}throw Wc(e)}function wO(e){return new Ve(function(t){var r=e[Ko]();if(Ee(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function xO(e){return new Ve(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function CO(e){return new Ve(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,qc)})}function EO(e){return new Ve(function(t){var r,n;try{for(var o=br(e),i=o.next();!i.done;i=o.next()){var a=i.value;if(t.next(a),t.closed)return}}catch(s){r={error:s}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function fS(e){return new Ve(function(t){IO(e,t).catch(function(r){return t.error(r)})})}function RO(e){return fS(Xc(e))}function IO(e,t){var r,n,o,i;return eS(this,void 0,void 0,function(){var a,s;return Dc(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),r=rS(e),u.label=1;case 1:return[4,r.next()];case 2:if(n=u.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=u.sent(),o={error:s},[3,11];case 6:return u.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}m();d();f();p();m();d();f();p();function Lt(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 Jc(e,t){return t===void 0&&(t=0),Qe(function(r,n){r.subscribe(We(n,function(o){return Lt(n,e,function(){return n.next(o)},t)},function(){return Lt(n,e,function(){return n.complete()},t)},function(o){return Lt(n,e,function(){return n.error(o)},t)}))})}m();d();f();p();function eu(e,t){return t===void 0&&(t=0),Qe(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function mS(e,t){return Xe(e).pipe(eu(t),Jc(t))}m();d();f();p();function gS(e,t){return Xe(e).pipe(eu(t),Jc(t))}m();d();f();p();function hS(e,t){return new Ve(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}m();d();f();p();function yS(e,t){return new Ve(function(r){var n;return Lt(r,t,function(){n=e[Kc](),Lt(r,t,function(){var o,i,a;try{o=n.next(),i=o.value,a=o.done}catch(s){r.error(s);return}a?r.complete():r.next(i)},0,!0)}),function(){return Ee(n?.return)&&n.return()}})}m();d();f();p();function tu(e,t){if(!e)throw new Error("Iterable cannot be null");return new Ve(function(r){Lt(r,t,function(){var n=e[Symbol.asyncIterator]();Lt(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}m();d();f();p();function vS(e,t){return tu(Xc(e),t)}function SS(e,t){if(e!=null){if(Hc(e))return mS(e,t);if($c(e))return hS(e,t);if(Qc(e))return gS(e,t);if(zc(e))return tu(e,t);if(Yc(e))return yS(e,t);if(Zc(e))return vS(e,t)}throw Wc(e)}function jn(e,t){return t?SS(e,t):Xe(e)}function Oe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=pS(e);return jn(e,r)}m();d();f();p();function le(e,t){var r=Ee(e)?e:function(){return e},n=function(o){return o.error(r())};return new Ve(t?function(o){return t.schedule(n,0,o)}:n)}m();d();f();p();m();d();f();p();var bS=Qo(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function ru(e,t){var r=typeof t=="object";return new Promise(function(n,o){var i=!1,a;e.subscribe({next:function(s){a=s,i=!0},error:o,complete:function(){i?n(a):r?n(t.defaultValue):o(new bS)}})})}m();d();f();p();function $r(e,t){return Qe(function(r,n){var o=0;r.subscribe(We(n,function(i){n.next(e.call(t,i,o++))}))})}m();d();f();p();m();d();f();p();m();d();f();p();function AS(e,t,r,n,o,i,a,s){var u=[],c=0,g=0,v=!1,R=function(){v&&!u.length&&!c&&t.complete()},h=function(b){return c<n?y(b):u.push(b)},y=function(b){i&&t.next(b),c++;var x=!1;Xe(r(b,g++)).subscribe(We(t,function(I){o?.(I),i?h(I):t.next(I)},function(){x=!0},void 0,function(){if(x)try{c--;for(var I=function(){var N=u.shift();a?Lt(t,a,function(){return y(N)}):y(N)};u.length&&c<n;)I();R()}catch(N){t.error(N)}}))};return e.subscribe(We(t,h,function(){v=!0,R()})),function(){s?.()}}function wt(e,t,r){return r===void 0&&(r=1/0),Ee(t)?wt(function(n,o){return $r(function(i,a){return t(n,i,o,a)})(Xe(e(n,o)))},r):(typeof t=="number"&&(r=t),Qe(function(n,o){return AS(n,o,e,r)}))}function af(e){return e===void 0&&(e=1/0),wt(Yo,e)}m();d();f();p();function nu(e){return new Ve(function(t){Xe(e()).subscribe(t)})}m();d();f();p();function sf(e,t){return Qe(function(r,n){var o=0;r.subscribe(We(n,function(i){return e.call(t,i,o++)&&n.next(i)}))})}m();d();f();p();function ma(e){return Qe(function(t,r){var n=null,o=!1,i;n=t.subscribe(We(r,void 0,void 0,function(a){i=Xe(e(a,ma(e)(t))),n?(n.unsubscribe(),n=null,i.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(r))})}m();d();f();p();function ou(e,t){return Ee(t)?wt(e,t,1):wt(e,1)}m();d();f();p();function cf(e){return Qe(function(t,r){var n=!1;t.subscribe(We(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}m();d();f();p();function Un(e){return Qe(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function uf(e,t){return Qe(function(r,n){var o=null,i=0,a=!1,s=function(){return a&&!o&&n.complete()};r.subscribe(We(n,function(u){o?.unsubscribe();var c=0,g=i++;Xe(e(u,g)).subscribe(o=We(n,function(v){return n.next(t?t(u,v,g,c++):v)},function(){o=null,s()}))},function(){a=!0,s()}))})}m();d();f();p();function iu(e){return Qe(function(t,r){Xe(e).subscribe(We(r,function(){return r.complete()},pa)),!r.closed&&t.subscribe(r)})}m();d();f();p();function au(e,t,r){var n=Ee(e)||t||r?{next:e,error:t,complete:r}:e;return n?Qe(function(o,i){var a;(a=n.subscribe)===null||a===void 0||a.call(n);var s=!0;o.subscribe(We(i,function(u){var c;(c=n.next)===null||c===void 0||c.call(n,u),i.next(u)},function(){var u;s=!1,(u=n.complete)===null||u===void 0||u.call(n),i.complete()},function(u){var c;s=!1,(c=n.error)===null||c===void 0||c.call(n,u),i.error(u)},function(){var u,c;s&&((u=n.unsubscribe)===null||u===void 0||u.call(n)),(c=n.finalize)===null||c===void 0||c.call(n)}))}):Yo}m();d();f();p();m();d();f();p();function wS(e){return` \r
|
|
36
|
-
`.indexOf(e)>=0}function su(e){for(var t=["topLevel"],r=0,n,o,i,a=function(N){return t.push(N)},s=function(N){return t[t.length-1]=N},u=function(N){n==null&&(n=r,o=t.length,i=N)},c=function(N){N===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},R=function(N){if("0"<=N&&N<="9"){a("number");return}switch(N){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":R(y);break;case"string":switch(y){case"\"":g();break;case"\\":u("stringEscape"),a("stringEscaped");break}break;case"stringEscaped":y==="u"?a("stringUnicode"):(c("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(c("stringEscape"),g());break;case"number":y==="."?s("numberNeedsDigit"):y==="e"||y==="E"?s("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),g());break;case"numberNeedsDigit":s("number");break;case"numberNeedsExponent":s(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),g());break;case"arrayNeedsValue":y==="]"?g():wS(y)||(c("collectionItem"),s("arrayNeedsComma"),R(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(u("collectionItem"),s("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(u("collectionItem"),s("objectNeedsColon"),a("string"));break;case"objectNeedsColon":y===":"&&s("objectNeedsValue");break;case"objectNeedsValue":wS(y)||(c("collectionItem"),s("objectNeedsComma"),R(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(u("collectionItem"),s("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var b=[n!=null?e.slice(0,n):e],x=function(N){return b.push(N.slice(e.length-e.lastIndexOf(N[0])))},I=t.length-1;I>=0;I--)switch(t[I]){case"string":b.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":b.push("0");break;case"true":x("true");break;case"false":x("false");break;case"null":x("null");break;case"arrayNeedsValue":case"arrayNeedsComma":b.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":b.push("}");break}return b.join("")}m();d();f();p();m();d();f();p();m();d();f();p();function CS(){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 cu=4294967296;function lf(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(a,s){let u=Number(e.slice(a,s));o*=r,n=n*r+u,n>=cu&&(o=o+(n/cu|0),n=n%cu)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?RS(n,o):pf(n,o)}function ES(e,t){let r=pf(e,t),n=r.hi&2147483648;n&&(r=RS(r.lo,r.hi));let o=df(r.lo,r.hi);return n?"-"+o:o}function df(e,t){if({lo:e,hi:t}=TO(e,t),t<=2097151)return String(cu*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,s=o*2,u=1e7;return i>=u&&(a+=Math.floor(i/u),i%=u),a>=u&&(s+=Math.floor(a/u),a%=u),s.toString()+xS(a)+xS(i)}function TO(e,t){return{lo:e>>>0,hi:t>>>0}}function pf(e,t){return{lo:e|0,hi:t|0}}function RS(e,t){return t=~t,e?e=~e+1:t+=1,pf(e,t)}var xS=e=>{let t=String(e);return"0000000".slice(t.length)+t};function IS(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)===0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();f();p();var $t=_O();function _O(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!A.Deno||!!A.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 s=typeof a=="bigint"?a:BigInt(a);if(s>n||s<r)throw new Error(`invalid int64: ${a}`);return s},uParse(a){let s=typeof a=="bigint"?a:BigInt(a);if(s>i||s<o)throw new Error(`invalid uint64: ${a}`);return s},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,s){return e.setInt32(0,a,!0),e.setInt32(4,s,!0),e.getBigInt64(0,!0)},uDec(a,s){return e.setInt32(0,a,!0),e.setInt32(4,s,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),TS(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),_S(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),TS(r),lf(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),_S(r),lf(r)},dec(r,n){return ES(r,n)},uDec(r,n){return df(r,n)}}}function TS(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function _S(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var ff;function kO(e){var t;ff=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:gf(e.encodeUtf8.bind(e))})}function mf(){if(!ff){let e=A;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,s){return s?(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)),kO(o)}return ff}function gf(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var Qr;(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"})(Qr||(Qr={}));var OO=4294967295,PO=2147483647,NO=-2147483648,he=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?gf(t):mf().encodeUtf8Into,this.buffer=OS,this.viewCache=DO,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||FO;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(ga),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-ga,n=hf(r);return n>ga&&(this.ensureCapacity(n-ga),this.buffer.copyWithin(t+n,t+ga,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(kS(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(yf(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<=PS){this.ensureCapacity(r+1);let u=this.buffer,c=this.pos;u[c++]=r;let g=0;for(;g<r;g++){let v=t.charCodeAt(g);if(v>127)break;u[c++]=v}if(g==r)return this.pos=c,this}this.ensureCapacity(r*3+5);let n=hf(r),o=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(t,o.subarray(i+n)),s=hf(a);return s!=n&&o.copyWithin(i+s,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(t){return MO(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 kS(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return yf(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return yf(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=$t.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=$t.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=$t.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=$t.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=$t.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let s=0;s<28;s=s+7){let u=t>>>s,c=!(!(u>>>7)&&r==0);if(n[o++]=(c?u|128:u)&255,!c)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 s=3;s<31;s=s+7){let u=r>>>s,c=!!(u>>>7);if(n[o++]=(c?u|128:u)&255,!c)return this.pos=o,this}return n[o++]=r>>>31&1,this.pos=o,this}},FO=128,ga=1,OS=new Uint8Array(0),DO=new DataView(OS.buffer),PS=32;function hf(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var J=class{constructor(t,r=mf().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=CS,this.uint32=IS,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 Qr.Varint:for(;this.buf[this.pos++]&128;);break;case Qr.Bit64:this.pos+=4;case Qr.Bit32:this.pos+=4;break;case Qr.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Qr.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[a,s]=this.tag();if(s===Qr.EndGroup){if(r!==void 0&&a!==r)throw new Error("invalid end group tag");break}this.skip(s,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(),$t.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),$t.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,$t.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 $t.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return $t.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<=PS){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 yf(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>PO||e<NO)throw new Error("invalid int32: "+e)}function kS(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>OO||e<0)throw new Error("invalid uint32: "+e)}function MO(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(Math.fround(e))&&Number.isFinite(e))throw new Error("invalid float32: "+e)}var LO=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function vf(){return{fields:{}}}var ut={encode(e,t=new he){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&Af.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=vf();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=Af.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 ut.fromPartial(e??{})},fromPartial(e){let t=vf();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=vf();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 NS(){return{key:"",value:void 0}}var Af={encode(e,t=new he){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&ae.encode(ae.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=NS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=r.string();continue;case 2:if(i!==18)break;o.value=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Af.fromPartial(e??{})},fromPartial(e){let t=NS();return t.key=e.key??"",t.value=e.value??void 0,t}};function Sf(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var ae={encode(e,t=new he){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&&ut.encode(ut.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&ha.encode(ha.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=Sf();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=ut.unwrap(ut.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=ha.unwrap(ha.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=Sf();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=Sf();if(e===null)t.nullValue=LO.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(A.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new A.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function bf(){return{values:[]}}var ha={encode(e,t=new he){for(let r of e.values)ae.encode(ae.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=bf();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(ae.unwrap(ae.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ha.fromPartial(e??{})},fromPartial(e){let t=bf();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=bf();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&A.Array.isArray(e.values)?e.values:e}},qO=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 FS(){return{op:0,path:"",from:void 0,value:void 0}}var lu={encode(e,t=new he){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&&ae.encode(ae.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=FS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==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=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return lu.fromPartial(e??{})},fromPartial(e){let t=FS();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function DS(){return{id:"",type:"",function:void 0,metadata:void 0}}var du={encode(e,t=new he){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&pu.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&ut.encode(ut.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=DS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.type=r.string();continue;case 3:if(i!==26)break;o.function=pu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.metadata=ut.unwrap(ut.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return du.fromPartial(e??{})},fromPartial(e){let t=DS();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?pu.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function MS(){return{name:"",arguments:""}}var pu={encode(e,t=new he){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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=MS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.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 pu.fromPartial(e??{})},fromPartial(e){let t=MS();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function LS(){return{value:"",mimeType:""}}var fu={encode(e,t=new he){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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=LS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.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 fu.fromPartial(e??{})},fromPartial(e){let t=LS();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function qS(){return{value:"",mimeType:void 0}}var mu={encode(e,t=new he){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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=qS();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 mu.fromPartial(e??{})},fromPartial(e){let t=qS();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function jS(){return{data:void 0,url:void 0}}var Rt={encode(e,t=new he){return e.data!==void 0&&fu.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&mu.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(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!==10)break;o.data=fu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=mu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Rt.fromPartial(e??{})},fromPartial(e){let t=jS();return t.data=e.data!==void 0&&e.data!==null?fu.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?mu.fromPartial(e.url):void 0,t}};function US(){return{text:""}}var gu={encode(e,t=new he){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=US();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return gu.fromPartial(e??{})},fromPartial(e){let t=US();return t.text=e.text??"",t}};function VS(){return{source:void 0,metadata:void 0}}var hu={encode(e,t=new he){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ae.encode(ae.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=VS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return hu.fromPartial(e??{})},fromPartial(e){let t=VS();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function GS(){return{source:void 0,metadata:void 0}}var yu={encode(e,t=new he){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ae.encode(ae.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=GS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return yu.fromPartial(e??{})},fromPartial(e){let t=GS();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function BS(){return{source:void 0,metadata:void 0}}var vu={encode(e,t=new he){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ae.encode(ae.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=BS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vu.fromPartial(e??{})},fromPartial(e){let t=BS();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function $S(){return{source:void 0,metadata:void 0}}var Su={encode(e,t=new he){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ae.encode(ae.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=$S();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Su.fromPartial(e??{})},fromPartial(e){let t=$S();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function QS(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var bu={encode(e,t=new he){return e.text!==void 0&&gu.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&hu.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&yu.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&vu.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Su.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=QS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=gu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=hu.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=yu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=vu.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=Su.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return bu.fromPartial(e??{})},fromPartial(e){let t=QS();return t.text=e.text!==void 0&&e.text!==null?gu.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?hu.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?yu.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?vu.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Su.fromPartial(e.document):void 0,t}};function HS(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var Au={encode(e,t=new he){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)du.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)bu.encode(r,t.uint32(66).fork()).join();return e.metadata!==void 0&&ut.encode(ut.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=HS();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(du.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(bu.decode(r,r.uint32()));continue;case 9:if(i!==74)break;o.metadata=ut.unwrap(ut.decode(r,r.uint32()));continue;case 10:if(i!==82)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Au.fromPartial(e??{})},fromPartial(e){let t=HS();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=>du.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>bu.fromPartial(r))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function zS(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var wu={encode(e,t=new he){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&&ae.encode(ae.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&ae.encode(ae.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(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;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=ae.unwrap(ae.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.expiresAt=r.string();continue;case 7:if(i!==58)break;o.metadata=ae.unwrap(ae.decode(r,r.uint32()));continue;case 8:if(i!==66)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return wu.fromPartial(e??{})},fromPartial(e){let t=zS();return t.id=e.id??"",t.reason=e.reason??"",t.message=e.message??void 0,t.toolCallId=e.toolCallId??void 0,t.responseSchema=e.responseSchema??void 0,t.expiresAt=e.expiresAt??void 0,t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}},jO=function(e){return e[e.TEXT_MESSAGE_START=0]="TEXT_MESSAGE_START",e[e.TEXT_MESSAGE_CONTENT=1]="TEXT_MESSAGE_CONTENT",e[e.TEXT_MESSAGE_END=2]="TEXT_MESSAGE_END",e[e.TOOL_CALL_START=3]="TOOL_CALL_START",e[e.TOOL_CALL_ARGS=4]="TOOL_CALL_ARGS",e[e.TOOL_CALL_END=5]="TOOL_CALL_END",e[e.STATE_SNAPSHOT=6]="STATE_SNAPSHOT",e[e.STATE_DELTA=7]="STATE_DELTA",e[e.MESSAGES_SNAPSHOT=8]="MESSAGES_SNAPSHOT",e[e.RAW=9]="RAW",e[e.CUSTOM=10]="CUSTOM",e[e.RUN_STARTED=11]="RUN_STARTED",e[e.RUN_FINISHED=12]="RUN_FINISHED",e[e.RUN_ERROR=13]="RUN_ERROR",e[e.STEP_STARTED=14]="STEP_STARTED",e[e.STEP_FINISHED=15]="STEP_FINISHED",e[e.SUBAGENT_STARTED=16]="SUBAGENT_STARTED",e[e.SUBAGENT_FINISHED=17]="SUBAGENT_FINISHED",e[e.SUBAGENT_ERROR=18]="SUBAGENT_ERROR",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function WS(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var oe={encode(e,t=new he){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&ae.encode(ae.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&ut.encode(ut.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=WS();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=Xo(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=ae.unwrap(ae.decode(r,r.uint32()));continue;case 4:if(i!==34)break;o.metadata=ut.unwrap(ut.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return oe.fromPartial(e??{})},fromPartial(e){let t=WS();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t.metadata=e.metadata??void 0,t}};function KS(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0,subagentRunId:void 0}}var xu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=KS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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;case 5:if(i!==42)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xu.fromPartial(e??{})},fromPartial(e){let t=KS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function YS(){return{baseEvent:void 0,messageId:"",delta:"",subagentRunId:void 0}}var Cu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=YS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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;case 4:if(i!==34)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Cu.fromPartial(e??{})},fromPartial(e){let t=YS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function XS(){return{baseEvent:void 0,messageId:"",subagentRunId:void 0}}var Eu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=XS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Eu.fromPartial(e??{})},fromPartial(e){let t=XS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function ZS(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0,subagentRunId:void 0}}var Ru={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(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;o.baseEvent=oe.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.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ru.fromPartial(e??{})},fromPartial(e){let t=ZS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function JS(){return{baseEvent:void 0,toolCallId:"",delta:"",subagentRunId:void 0}}var Iu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(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!==10)break;o.baseEvent=oe.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;case 4:if(i!==34)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Iu.fromPartial(e??{})},fromPartial(e){let t=JS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function eb(){return{baseEvent:void 0,toolCallId:"",subagentRunId:void 0}}var Tu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=eb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Tu.fromPartial(e??{})},fromPartial(e){let t=eb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function tb(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var _u={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&ae.encode(ae.wrap(e.snapshot),t.uint32(18).fork()).join(),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=tb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=ae.unwrap(ae.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return _u.fromPartial(e??{})},fromPartial(e){let t=tb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function rb(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var ku={encode(e,t=new he){e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)lu.encode(r,t.uint32(18).fork()).join();return e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=rb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(lu.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ku.fromPartial(e??{})},fromPartial(e){let t=rb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>lu.fromPartial(r))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function nb(){return{baseEvent:void 0,messages:[]}}var Ou={encode(e,t=new he){e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Au.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=nb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(Au.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ou.fromPartial(e??{})},fromPartial(e){let t=nb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Au.fromPartial(r))||[],t}};function ob(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var Pu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&ae.encode(ae.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=ob();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=ae.unwrap(ae.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.source=r.string();continue;case 4:if(i!==34)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Pu.fromPartial(e??{})},fromPartial(e){let t=ob();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function ib(){return{baseEvent:void 0,name:"",value:void 0,subagentRunId:void 0}}var Nu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&ae.encode(ae.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=ib();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=ae.unwrap(ae.decode(r,r.uint32()));continue;case 4:if(i!==34)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Nu.fromPartial(e??{})},fromPartial(e){let t=ib();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function ab(){return{baseEvent:void 0,threadId:"",runId:""}}var Fu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=ab();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Fu.fromPartial(e??{})},fromPartial(e){let t=ab();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function sb(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var Vn={encode(e,t=new he){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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=sb();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=Xo(r.int64());continue;case 4:if(i!==32)break;o.outputTokens=Xo(r.int64());continue;case 5:if(i!==40)break;o.totalTokens=Xo(r.int64());continue;case 6:if(i!==48)break;o.reasoningTokens=Xo(r.int64());continue;case 7:if(i!==56)break;o.cachedInputTokens=Xo(r.int64());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Vn.fromPartial(e??{})},fromPartial(e){let t=sb();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 cb(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var Du={encode(e,t=new he){e.baseEvent!==void 0&&oe.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&&ae.encode(ae.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)wu.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)Vn.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=cb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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=ae.unwrap(ae.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(wu.decode(r,r.uint32()));continue;case 7:if(i!==58)break;o.usage.push(Vn.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Du.fromPartial(e??{})},fromPartial(e){let t=cb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.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=>wu.fromPartial(r))||[],t.usage=e.usage?.map(r=>Vn.fromPartial(r))||[],t}};function ub(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var Mu={encode(e,t=new he){e.baseEvent!==void 0&&oe.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)Vn.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=ub();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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(Vn.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Mu.fromPartial(e??{})},fromPartial(e){let t=ub();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>Vn.fromPartial(r))||[],t}};function lb(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Lu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=lb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Lu.fromPartial(e??{})},fromPartial(e){let t=lb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function db(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var qu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=db();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return qu.fromPartial(e??{})},fromPartial(e){let t=db();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function pb(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var ju={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=pb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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;case 6:if(i!==50)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ju.fromPartial(e??{})},fromPartial(e){let t=pb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function fb(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var Uu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=fb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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;case 6:if(i!==50)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Uu.fromPartial(e??{})},fromPartial(e){let t=fb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function mb(){return{baseEvent:void 0,subagentRunId:"",name:"",description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var Vu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.name!==""&&t.uint32(26).string(e.name),e.description!==void 0&&t.uint32(34).string(e.description),e.parentSubagentRunId!==void 0&&t.uint32(42).string(e.parentSubagentRunId),e.parentToolCallId!==void 0&&t.uint32(50).string(e.parentToolCallId),e.parentMessageId!==void 0&&t.uint32(58).string(e.parentMessageId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=mb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=r.string();continue;case 3:if(i!==26)break;o.name=r.string();continue;case 4:if(i!==34)break;o.description=r.string();continue;case 5:if(i!==42)break;o.parentSubagentRunId=r.string();continue;case 6:if(i!==50)break;o.parentToolCallId=r.string();continue;case 7:if(i!==58)break;o.parentMessageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Vu.fromPartial(e??{})},fromPartial(e){let t=mb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.name=e.name??"",t.description=e.description??void 0,t.parentSubagentRunId=e.parentSubagentRunId??void 0,t.parentToolCallId=e.parentToolCallId??void 0,t.parentMessageId=e.parentMessageId??void 0,t}};function gb(){return{baseEvent:void 0,subagentRunId:"",result:void 0,outcome:"",interruptIds:[]}}var Gu={encode(e,t=new he){e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&ae.encode(ae.wrap(e.result),t.uint32(26).fork()).join(),e.outcome!==""&&t.uint32(34).string(e.outcome);for(let r of e.interruptIds)t.uint32(42).string(r);return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=gb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=r.string();continue;case 3:if(i!==26)break;o.result=ae.unwrap(ae.decode(r,r.uint32()));continue;case 4:if(i!==34)break;o.outcome=r.string();continue;case 5:if(i!==42)break;o.interruptIds.push(r.string());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Gu.fromPartial(e??{})},fromPartial(e){let t=gb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interruptIds=e.interruptIds?.map(r=>r)||[],t}};function hb(){return{baseEvent:void 0,subagentRunId:"",message:"",code:void 0}}var Bu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.message!==""&&t.uint32(26).string(e.message),e.code!==void 0&&t.uint32(34).string(e.code),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=hb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.code=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Bu.fromPartial(e??{})},fromPartial(e){let t=hb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.message=e.message??"",t.code=e.code??void 0,t}};function yb(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0,subagentStarted:void 0,subagentFinished:void 0,subagentError:void 0}}var vb={encode(e,t=new he){return e.textMessageStart!==void 0&&xu.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Cu.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Eu.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Ru.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Iu.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Tu.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&_u.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&ku.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Ou.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Pu.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Nu.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Fu.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Du.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Mu.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Lu.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&qu.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&ju.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Uu.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&Vu.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&Gu.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&Bu.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=yb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=xu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=Cu.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=Eu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=Ru.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=Iu.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=Tu.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=_u.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=ku.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=Ou.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Pu.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Nu.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Fu.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Du.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=Mu.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Lu.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=qu.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=ju.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Uu.decode(r,r.uint32());continue;case 19:if(i!==154)break;o.subagentStarted=Vu.decode(r,r.uint32());continue;case 20:if(i!==162)break;o.subagentFinished=Gu.decode(r,r.uint32());continue;case 21:if(i!==170)break;o.subagentError=Bu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vb.fromPartial(e??{})},fromPartial(e){let t=yb();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?xu.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Cu.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Eu.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Ru.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Iu.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Tu.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?_u.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?ku.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Ou.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Pu.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Nu.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Fu.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Du.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Mu.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Lu.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?qu.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?ju.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Uu.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?Vu.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?Gu.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?Bu.fromPartial(e.subagentError):void 0,t}};function Xo(e){let t=A.Number(e.toString());if(t>A.Number.MAX_SAFE_INTEGER)throw new A.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<A.Number.MIN_SAFE_INTEGER)throw new A.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var Sb=e=>e&&typeof e=="object"?e:void 0;var uu=e=>{let t=Sb(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}}}},UO=e=>{let t=Sb(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:uu(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:uu(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:uu(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:uu(r.source),metadata:r.metadata}}}};function bb(e){let t=vb.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=jO[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.baseEvent.metadata!==void 0&&(r.metadata=r.baseEvent.metadata),delete r.baseEvent,r.type===F.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=>UO(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===F.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===F.SUBAGENT_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,i=Array.isArray(n.interruptIds)?n.interruptIds:[];delete n.interruptIds,o==="suspended"?n.outcome={type:"suspended",...(i.length>0&&{interruptIds:i})}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if((r.type===F.RUN_FINISHED||r.type===F.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===F.STATE_DELTA)for(let n of r.delta)n.op=qO[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]}),Rc.parse(r)}var wf="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var GO=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,xf=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(GO);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Ab=e=>e==="*"||e==="x"||e==="X",wb=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},BO=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],$O=(e,t)=>{if(Ab(e)||Ab(t))return 0;let[r,n]=BO(wb(e),wb(t));return r>n?1:r<n?-1:0},Cf=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=$O(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Zo=(e,t)=>{let r=xf(e),n=xf(t),o=r.pop(),i=n.pop(),a=Cf(r,n);return a!==0?a:o&&i?Cf(o.split("."),i.split(".")):o||i?o?-1:1:0};var Te=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function ya(){return jr()}function If(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&If(t);return e}var xb=512*1024;function Cb(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 s=0;s<a.length;s++)o.push(a[s]);else{let s=Object.keys(a);for(let u=0;u<s.length;u++){let c=s[u];if(n+=c.length,n>r)return!0;o.push(a[c])}}}}return!1}function Pe(_x88,_x89,_x90,_x91){return _Pe.apply(this,arguments)}function _Pe(){_Pe=_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,s=a&&!Cb(t,r,xb),u=s?Te(t):t,c=s?Te(r):r,g=!1,v=!1,R;for(let h of e)try{s&&(If(u),If(c));let y=yield n(h,u,c);if(y===void 0)continue;let b=!1;if(y.messages!==void 0&&y.messages!==u&&(u=Te(y.messages),g=!0,b=!0),y.state!==void 0&&y.state!==c&&(c=Te(y.state),v=!0,b=!0),s&&b&&Cb(u,c,xb)&&(s=!1),R=y.stopPropagation,R===!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(u)?Te(u):u}:{}),...(v?{state:Object.isFrozen(c)?Te(c):c}:{}),...(R===void 0?{}:{stopPropagation:R})}});return _Pe.apply(this,arguments)}function $u(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 va(e){if(e instanceof Tf)return e;if(e===!0)return new Tf($u(!0))}var Tf=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 Ef(e){return e.enabled?new Tf(e):void 0}function QO(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}function It(e,t){return!e||t.metadata===void 0?!1:(e.metadata=$v(e.metadata,Te(t.metadata)),!0)}var Fb=(e,t,r,n,o)=>{let i=va(o),a=Te(r.messages),s=Te(e.state),u={},c=v=>{v.messages!==void 0&&(a=v.messages,u.messages=v.messages),v.state!==void 0&&(s=v.state,u.state=v.state)},g=()=>{let v=Te(u);return u={},v.messages!==void 0||v.state!==void 0?Oe(v):Bc};return t.pipe(ou(/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(v){let R=yield Pe(n,a,s,(h,y,b)=>h.onEvent?.({event:v,agent:r,input:e,messages:y,state:b}));if(c(R),R.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}),R.stopPropagation===!0)return g();switch(v.type){case F.TEXT_MESSAGE_START:{let h=yield Pe(n,a,s,(y,b,x)=>y.onTextMessageStartEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,role:b="assistant",name:x,subagentRunId:I}=v,N=a.find(w=>w.id===y);if(N?.role==="activity")return console.warn(`TEXT_MESSAGE_START: Message '${y}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let _=N;if(!_){let w={id:y,role:b,content:"",...(x!==void 0&&{name:x}),...(I!=null&&{subagentRunId:I})};a.push(w),_=w}let P=It(_,v);(!N||P)&&c({messages:a})}return g()}case F.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,b=a.find(I=>I.id===h);if(!b)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();if(b.role==="activity")return console.warn(`TEXT_MESSAGE_CONTENT: Message '${h}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let x=yield Pe(n,a,s,(I,N,_)=>I.onTextMessageContentEvent?.({event:v,messages:N,state:_,agent:r,input:e,textMessageBuffer:typeof b.content=="string"?b.content:""}));return c(x),x.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${y}`,It(b,v),c({messages:a})),g()}case F.TEXT_MESSAGE_END:{let{messageId:h}=v,y=a.find(x=>x.id===h);if(!y)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g();if(y.role==="activity")return console.warn(`TEXT_MESSAGE_END: Message '${h}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let b=yield Pe(n,a,s,(x,I,N)=>x.onTextMessageEndEvent?.({event:v,messages:I,state:N,agent:r,input:e,textMessageBuffer:typeof y.content=="string"?y.content:""}));return c(b),b.stopPropagation!==!0&&It(y,v)&&c({messages:a}),yield Promise.all(n.map(x=>{x.onNewMessage?.({message:y,messages:a,state:s,agent:r,input:e})})),g()}case F.TOOL_CALL_START:{let h=yield Pe(n,a,s,(y,b,x)=>y.onToolCallStartEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:b,parentMessageId:x,subagentRunId:I}=v,N=a.find(O=>O.toolCalls?.some(k=>k.id===y))?.toolCalls?.find(O=>O.id===y);if(N){let O=N.function.name!==b;return O&&(console.warn(`TOOL_CALL_START: tool call '${y}' already exists with name '${N.function.name}' \u2014 updating it to '${b}'`),N.function.name=b),(It(N,v)||O)&&c({messages:a}),g()}let _=new Set(a.map(O=>O.id)),P=QO(a,x,y);!_.has(P.id)&&I!=null&&P.subagentRunId===void 0&&(P.subagentRunId=I),P.toolCalls??(P.toolCalls=[]);let w={id:y,type:"function",function:{name:b,arguments:""}};P.toolCalls.push(w),It(w,v),c({messages:a})}return g()}case F.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=v,b=a.find(N=>N.toolCalls?.some(_=>_.id===h));if(!b)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let x=b.toolCalls?.find(N=>N.id===h);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=yield Pe(n,a,s,(N,_,P)=>{let w=x.function.arguments,O=x.function.name,k={};try{k=su(w)}catch{}return N.onToolCallArgsEvent?.({event:v,messages:_,state:P,agent:r,input:e,toolCallBuffer:w,toolCallName:O,partialToolCallArgs:k})});return c(I),I.stopPropagation!==!0&&(x.function.arguments+=y,It(x,v),c({messages:a})),g()}case F.TOOL_CALL_END:{let{toolCallId:h}=v,y=a.find(I=>I.toolCalls?.some(N=>N.id===h));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let b=y.toolCalls?.find(I=>I.id===h);if(!b)return console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g();let x=yield Pe(n,a,s,(I,N,_)=>{let P=b.function.arguments,w=b.function.name,O={};try{O=JSON.parse(P)}catch{}return I.onToolCallEndEvent?.({event:v,messages:N,state:_,agent:r,input:e,toolCallName:w,toolCallArgs:O})});return c(x),x.stopPropagation!==!0&&It(b,v)&&c({messages:a}),yield Promise.all(n.map(I=>{I.onNewToolCall?.({toolCall:b,messages:a,state:s,agent:r,input:e})})),g()}case F.TOOL_CALL_RESULT:{let h=yield Pe(n,a,s,(y,b,x)=>y.onToolCallResultEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:b,content:x,role:I,subagentRunId:N}=v,_={id:y,toolCallId:b,role:I||"tool",content:x,...(N!=null&&{subagentRunId:N})};It(_,v);let P=a.findIndex(w=>w.role==="assistant"&&w.toolCalls?.some(O=>O.id===b));if(P===-1)a.push(_);else{let w=P+1;for(;w<a.length&&a[w].role==="tool";)w++;a.splice(w,0,_)}yield Promise.all(n.map(w=>{w.onNewMessage?.({message:_,messages:a,state:s,agent:r,input:e})})),c({messages:a})}return g()}case F.STATE_SNAPSHOT:{let h=yield Pe(n,a,s,(y,b,x)=>y.onStateSnapshotEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{snapshot:y}=v;s=y,c({state:s})}return g()}case F.STATE_DELTA:{let h=yield Pe(n,a,s,(y,b,x)=>y.onStateDeltaEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{delta:y}=v;try{s=Fc.applyPatch(s,y,!0,!1).newDocument,c({state:s})}catch(b){let x=b instanceof Error?b.message:String(b);console.warn(`Failed to apply state patch:
|
|
35
|
+
`):"",this.name="UnsubscriptionError",this.errors=r}});m();d();f();p();function da(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ho=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 s=br(a),u=s.next();!u.done;u=s.next()){var c=u.value;c.remove(this)}}catch(b){t={error:b}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}else a.remove(this);var g=this.initialTeardown;if(Ee(g))try{g()}catch(b){i=b instanceof Mc?b.errors:[b]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var R=br(v),h=R.next();!h.done;h=R.next()){var y=h.value;try{nS(y)}catch(b){i=i??[],b instanceof Mc?i=$o($o([],Bo(i)),Bo(b.errors)):i.push(b)}}}catch(b){n={error:b}}finally{try{h&&!h.done&&(o=R.return)&&o.call(R)}finally{if(n)throw n.error}}}if(i)throw new Mc(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)nS(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)&&da(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&da(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Zp=Ho.EMPTY;function Lc(e){return e instanceof Ho||e&&"closed"in e&&Ee(e.remove)&&Ee(e.add)&&Ee(e.unsubscribe)}function nS(e){Ee(e)?e():e.unsubscribe()}m();d();f();p();var Bt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var zo={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=zo.delegate;return o?.setTimeout?o.setTimeout.apply(o,$o([e,t],Bo(r))):setTimeout.apply(void 0,$o([e,t],Bo(r)))},clearTimeout:function(e){var t=zo.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function qc(e){zo.setTimeout(function(){var t=Bt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function pa(){}m();d();f();p();var oS=function(){return Jp("C",void 0,void 0)}();function iS(e){return Jp("E",void 0,e)}function aS(e){return Jp("N",e,void 0)}function Jp(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var qn=null;function Wo(e){if(Bt.useDeprecatedSynchronousErrorHandling){var t=!qn;if(t&&(qn={errorThrown:!1,error:null}),e(),t){var r=qn,n=r.errorThrown,o=r.error;if(qn=null,n)throw o}}else e()}function sS(e){Bt.useDeprecatedSynchronousErrorHandling&&qn&&(qn.errorThrown=!0,qn.error=e)}var fa=function(e){rr(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Lc(r)&&r.add(n)):n.destination=gO,n}return t.create=function(r,n,o){return new Uc(r,n,o)},t.prototype.next=function(r){this.isStopped?tf(aS(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?tf(iS(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?tf(oS,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}(Ho);var pO=Function.prototype.bind;function ef(e,t){return pO.call(e,t)}var fO=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){jc(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){jc(n)}else jc(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){jc(r)}},e}(),Uc=function(e){rr(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(Ee(r)||!r)a={next:r??void 0,error:n??void 0,complete:o??void 0};else{var s;i&&Bt.useDeprecatedNextContext?(s=Object.create(r),s.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&ef(r.next,s),error:r.error&&ef(r.error,s),complete:r.complete&&ef(r.complete,s)}):a=r}return i.destination=new fO(a),i}return t}(fa);function jc(e){Bt.useDeprecatedSynchronousErrorHandling?sS(e):qc(e)}function mO(e){throw e}function tf(e,t){var r=Bt.onStoppedNotification;r&&zo.setTimeout(function(){return r(e,t)})}var gO={closed:!0,next:pa,error:mO,complete:pa};m();d();f();p();var Ko=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function Yo(e){return e}function Vc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return rf(e)}function rf(e){return e.length===0?Yo:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var Ve=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=yO(t)?t:new Uc(t,r,n);return Wo(function(){var a=o,s=a.operator,u=a.source;i.add(s?s.call(i,u):u?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=cS(r),new r(function(o,i){var a=new Uc({next:function(s){try{t(s)}catch(u){i(u),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[Ko]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return rf(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=cS(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 cS(e){var t;return(t=e??Bt.Promise)!==null&&t!==void 0?t:Promise}function hO(e){return e&&Ee(e.next)&&Ee(e.error)&&Ee(e.complete)}function yO(e){return e&&e instanceof fa||hO(e)&&Lc(e)}m();d();f();p();function vO(e){return Ee(e?.lift)}function Qe(e){return function(t){if(vO(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}m();d();f();p();function We(e,t,r,n,o){return new SO(e,t,r,n,o)}var SO=function(e){rr(t,e);function t(r,n,o,i,a,s){var u=e.call(this,r)||this;return u.onFinalize=a,u.shouldUnsubscribe=s,u._next=n?function(c){try{n(c)}catch(g){r.error(g)}}:e.prototype._next,u._error=i?function(c){try{i(c)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=o?function(){try{o()}catch(c){r.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,u}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(fa);m();d();f();p();m();d();f();p();var uS=Qo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var nr=function(e){rr(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 lS(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new uS},t.prototype.next=function(r){var n=this;Wo(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=br(n.currentObservers),s=a.next();!s.done;s=a.next()){var u=s.value;u.next(r)}}catch(c){o={error:c}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;Wo(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;Wo(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,s=o.observers;return i||a?Zp:(this.currentObservers=null,s.push(r),new Ho(function(){n.currentObservers=null,da(s,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 Ve;return r.source=this,r},t.create=function(r,n){return new lS(r,n)},t}(Ve);var lS=function(e){rr(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:Zp},t}(nr);m();d();f();p();m();d();f();p();var nf={now:function(){return(nf.delegate||Date).now()},delegate:void 0};var Gc=function(e){rr(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=nf);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,s=n._timestampProvider,u=n._windowTime;o||(i.push(r),!a&&i.push(s.now()+u)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,i=o._infiniteTimeWindow,a=o._buffer,s=a.slice(),u=0;u<s.length&&!r.closed;u+=i?1:2)r.next(s[u]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,i=r._buffer,a=r._infiniteTimeWindow,s=(a?1:2)*n;if(n<1/0&&s<i.length&&i.splice(0,i.length-s),!a){for(var u=o.now(),c=0,g=1;g<i.length&&i[g]<=u;g+=2)c=g;c&&i.splice(0,c+1)}},t}(nr);m();d();f();p();var Bc=new Ve(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function dS(e){return e&&Ee(e.schedule)}function bO(e){return e[e.length-1]}function pS(e){return dS(bO(e))?e.pop():void 0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var $c=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function Qc(e){return Ee(e?.then)}m();d();f();p();function Hc(e){return Ee(e[Ko])}m();d();f();p();function zc(e){return Symbol.asyncIterator&&Ee(e?.[Symbol.asyncIterator])}m();d();f();p();function Wc(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}m();d();f();p();m();d();f();p();function AO(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Kc=AO();function Yc(e){return Ee(e?.[Kc])}m();d();f();p();function Xc(e){return tS(this,arguments,function(){var r,n,o,i;return Dc(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,Ln(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,Ln(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Ln(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 Zc(e){return Ee(e?.getReader)}function Xe(e){if(e instanceof Ve)return e;if(e!=null){if(Hc(e))return wO(e);if($c(e))return xO(e);if(Qc(e))return CO(e);if(zc(e))return fS(e);if(Yc(e))return EO(e);if(Zc(e))return RO(e)}throw Wc(e)}function wO(e){return new Ve(function(t){var r=e[Ko]();if(Ee(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function xO(e){return new Ve(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function CO(e){return new Ve(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,qc)})}function EO(e){return new Ve(function(t){var r,n;try{for(var o=br(e),i=o.next();!i.done;i=o.next()){var a=i.value;if(t.next(a),t.closed)return}}catch(s){r={error:s}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function fS(e){return new Ve(function(t){IO(e,t).catch(function(r){return t.error(r)})})}function RO(e){return fS(Xc(e))}function IO(e,t){var r,n,o,i;return eS(this,void 0,void 0,function(){var a,s;return Dc(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),r=rS(e),u.label=1;case 1:return[4,r.next()];case 2:if(n=u.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=u.sent(),o={error:s},[3,11];case 6:return u.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}m();d();f();p();m();d();f();p();function Lt(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 Jc(e,t){return t===void 0&&(t=0),Qe(function(r,n){r.subscribe(We(n,function(o){return Lt(n,e,function(){return n.next(o)},t)},function(){return Lt(n,e,function(){return n.complete()},t)},function(o){return Lt(n,e,function(){return n.error(o)},t)}))})}m();d();f();p();function eu(e,t){return t===void 0&&(t=0),Qe(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function mS(e,t){return Xe(e).pipe(eu(t),Jc(t))}m();d();f();p();function gS(e,t){return Xe(e).pipe(eu(t),Jc(t))}m();d();f();p();function hS(e,t){return new Ve(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}m();d();f();p();function yS(e,t){return new Ve(function(r){var n;return Lt(r,t,function(){n=e[Kc](),Lt(r,t,function(){var o,i,a;try{o=n.next(),i=o.value,a=o.done}catch(s){r.error(s);return}a?r.complete():r.next(i)},0,!0)}),function(){return Ee(n?.return)&&n.return()}})}m();d();f();p();function tu(e,t){if(!e)throw new Error("Iterable cannot be null");return new Ve(function(r){Lt(r,t,function(){var n=e[Symbol.asyncIterator]();Lt(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}m();d();f();p();function vS(e,t){return tu(Xc(e),t)}function SS(e,t){if(e!=null){if(Hc(e))return mS(e,t);if($c(e))return hS(e,t);if(Qc(e))return gS(e,t);if(zc(e))return tu(e,t);if(Yc(e))return yS(e,t);if(Zc(e))return vS(e,t)}throw Wc(e)}function jn(e,t){return t?SS(e,t):Xe(e)}function Oe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=pS(e);return jn(e,r)}m();d();f();p();function le(e,t){var r=Ee(e)?e:function(){return e},n=function(o){return o.error(r())};return new Ve(t?function(o){return t.schedule(n,0,o)}:n)}m();d();f();p();m();d();f();p();var bS=Qo(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function ru(e,t){var r=typeof t=="object";return new Promise(function(n,o){var i=!1,a;e.subscribe({next:function(s){a=s,i=!0},error:o,complete:function(){i?n(a):r?n(t.defaultValue):o(new bS)}})})}m();d();f();p();function $r(e,t){return Qe(function(r,n){var o=0;r.subscribe(We(n,function(i){n.next(e.call(t,i,o++))}))})}m();d();f();p();m();d();f();p();m();d();f();p();function AS(e,t,r,n,o,i,a,s){var u=[],c=0,g=0,v=!1,R=function(){v&&!u.length&&!c&&t.complete()},h=function(b){return c<n?y(b):u.push(b)},y=function(b){i&&t.next(b),c++;var x=!1;Xe(r(b,g++)).subscribe(We(t,function(I){o?.(I),i?h(I):t.next(I)},function(){x=!0},void 0,function(){if(x)try{c--;for(var I=function(){var N=u.shift();a?Lt(t,a,function(){return y(N)}):y(N)};u.length&&c<n;)I();R()}catch(N){t.error(N)}}))};return e.subscribe(We(t,h,function(){v=!0,R()})),function(){s?.()}}function wt(e,t,r){return r===void 0&&(r=1/0),Ee(t)?wt(function(n,o){return $r(function(i,a){return t(n,i,o,a)})(Xe(e(n,o)))},r):(typeof t=="number"&&(r=t),Qe(function(n,o){return AS(n,o,e,r)}))}function of(e){return e===void 0&&(e=1/0),wt(Yo,e)}m();d();f();p();function nu(e){return new Ve(function(t){Xe(e()).subscribe(t)})}m();d();f();p();function af(e,t){return Qe(function(r,n){var o=0;r.subscribe(We(n,function(i){return e.call(t,i,o++)&&n.next(i)}))})}m();d();f();p();function ma(e){return Qe(function(t,r){var n=null,o=!1,i;n=t.subscribe(We(r,void 0,void 0,function(a){i=Xe(e(a,ma(e)(t))),n?(n.unsubscribe(),n=null,i.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(r))})}m();d();f();p();function ou(e,t){return Ee(t)?wt(e,t,1):wt(e,1)}m();d();f();p();function sf(e){return Qe(function(t,r){var n=!1;t.subscribe(We(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}m();d();f();p();function Un(e){return Qe(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function cf(e,t){return Qe(function(r,n){var o=null,i=0,a=!1,s=function(){return a&&!o&&n.complete()};r.subscribe(We(n,function(u){o?.unsubscribe();var c=0,g=i++;Xe(e(u,g)).subscribe(o=We(n,function(v){return n.next(t?t(u,v,g,c++):v)},function(){o=null,s()}))},function(){a=!0,s()}))})}m();d();f();p();function iu(e){return Qe(function(t,r){Xe(e).subscribe(We(r,function(){return r.complete()},pa)),!r.closed&&t.subscribe(r)})}m();d();f();p();function au(e,t,r){var n=Ee(e)||t||r?{next:e,error:t,complete:r}:e;return n?Qe(function(o,i){var a;(a=n.subscribe)===null||a===void 0||a.call(n);var s=!0;o.subscribe(We(i,function(u){var c;(c=n.next)===null||c===void 0||c.call(n,u),i.next(u)},function(){var u;s=!1,(u=n.complete)===null||u===void 0||u.call(n),i.complete()},function(u){var c;s=!1,(c=n.error)===null||c===void 0||c.call(n,u),i.error(u)},function(){var u,c;s&&((u=n.unsubscribe)===null||u===void 0||u.call(n)),(c=n.finalize)===null||c===void 0||c.call(n)}))}):Yo}m();d();f();p();m();d();f();p();function wS(e){return` \r
|
|
36
|
+
`.indexOf(e)>=0}function su(e){for(var t=["topLevel"],r=0,n,o,i,a=function(N){return t.push(N)},s=function(N){return t[t.length-1]=N},u=function(N){n==null&&(n=r,o=t.length,i=N)},c=function(N){N===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},R=function(N){if("0"<=N&&N<="9"){a("number");return}switch(N){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":R(y);break;case"string":switch(y){case"\"":g();break;case"\\":u("stringEscape"),a("stringEscaped");break}break;case"stringEscaped":y==="u"?a("stringUnicode"):(c("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(c("stringEscape"),g());break;case"number":y==="."?s("numberNeedsDigit"):y==="e"||y==="E"?s("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),g());break;case"numberNeedsDigit":s("number");break;case"numberNeedsExponent":s(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),g());break;case"arrayNeedsValue":y==="]"?g():wS(y)||(c("collectionItem"),s("arrayNeedsComma"),R(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(u("collectionItem"),s("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(u("collectionItem"),s("objectNeedsColon"),a("string"));break;case"objectNeedsColon":y===":"&&s("objectNeedsValue");break;case"objectNeedsValue":wS(y)||(c("collectionItem"),s("objectNeedsComma"),R(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(u("collectionItem"),s("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var b=[n!=null?e.slice(0,n):e],x=function(N){return b.push(N.slice(e.length-e.lastIndexOf(N[0])))},I=t.length-1;I>=0;I--)switch(t[I]){case"string":b.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":b.push("0");break;case"true":x("true");break;case"false":x("false");break;case"null":x("null");break;case"arrayNeedsValue":case"arrayNeedsComma":b.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":b.push("}");break}return b.join("")}m();d();f();p();m();d();f();p();m();d();f();p();function CS(){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 cu=4294967296;function uf(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(a,s){let u=Number(e.slice(a,s));o*=r,n=n*r+u,n>=cu&&(o=o+(n/cu|0),n=n%cu)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?RS(n,o):df(n,o)}function ES(e,t){let r=df(e,t),n=r.hi&2147483648;n&&(r=RS(r.lo,r.hi));let o=lf(r.lo,r.hi);return n?"-"+o:o}function lf(e,t){if({lo:e,hi:t}=TO(e,t),t<=2097151)return String(cu*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,s=o*2,u=1e7;return i>=u&&(a+=Math.floor(i/u),i%=u),a>=u&&(s+=Math.floor(a/u),a%=u),s.toString()+xS(a)+xS(i)}function TO(e,t){return{lo:e>>>0,hi:t>>>0}}function df(e,t){return{lo:e|0,hi:t|0}}function RS(e,t){return t=~t,e?e=~e+1:t+=1,df(e,t)}var xS=e=>{let t=String(e);return"0000000".slice(t.length)+t};function IS(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)===0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();f();p();var $t=_O();function _O(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!A.Deno||!!A.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 s=typeof a=="bigint"?a:BigInt(a);if(s>n||s<r)throw new Error(`invalid int64: ${a}`);return s},uParse(a){let s=typeof a=="bigint"?a:BigInt(a);if(s>i||s<o)throw new Error(`invalid uint64: ${a}`);return s},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,s){return e.setInt32(0,a,!0),e.setInt32(4,s,!0),e.getBigInt64(0,!0)},uDec(a,s){return e.setInt32(0,a,!0),e.setInt32(4,s,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),TS(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),_S(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),TS(r),uf(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),_S(r),uf(r)},dec(r,n){return ES(r,n)},uDec(r,n){return lf(r,n)}}}function TS(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function _S(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var pf;function kO(e){var t;pf=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:mf(e.encodeUtf8.bind(e))})}function ff(){if(!pf){let e=A;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,s){return s?(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)),kO(o)}return pf}function mf(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var Qr;(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"})(Qr||(Qr={}));var OO=4294967295,PO=2147483647,NO=-2147483648,he=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?mf(t):ff().encodeUtf8Into,this.buffer=OS,this.viewCache=DO,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||FO;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(ga),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-ga,n=gf(r);return n>ga&&(this.ensureCapacity(n-ga),this.buffer.copyWithin(t+n,t+ga,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(kS(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(hf(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<=PS){this.ensureCapacity(r+1);let u=this.buffer,c=this.pos;u[c++]=r;let g=0;for(;g<r;g++){let v=t.charCodeAt(g);if(v>127)break;u[c++]=v}if(g==r)return this.pos=c,this}this.ensureCapacity(r*3+5);let n=gf(r),o=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(t,o.subarray(i+n)),s=gf(a);return s!=n&&o.copyWithin(i+s,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(t){return MO(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 kS(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return hf(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return hf(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=$t.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=$t.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=$t.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=$t.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=$t.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let s=0;s<28;s=s+7){let u=t>>>s,c=!(!(u>>>7)&&r==0);if(n[o++]=(c?u|128:u)&255,!c)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 s=3;s<31;s=s+7){let u=r>>>s,c=!!(u>>>7);if(n[o++]=(c?u|128:u)&255,!c)return this.pos=o,this}return n[o++]=r>>>31&1,this.pos=o,this}},FO=128,ga=1,OS=new Uint8Array(0),DO=new DataView(OS.buffer),PS=32;function gf(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var J=class{constructor(t,r=ff().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=CS,this.uint32=IS,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 Qr.Varint:for(;this.buf[this.pos++]&128;);break;case Qr.Bit64:this.pos+=4;case Qr.Bit32:this.pos+=4;break;case Qr.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Qr.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[a,s]=this.tag();if(s===Qr.EndGroup){if(r!==void 0&&a!==r)throw new Error("invalid end group tag");break}this.skip(s,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(),$t.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),$t.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,$t.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 $t.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return $t.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<=PS){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 hf(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>PO||e<NO)throw new Error("invalid int32: "+e)}function kS(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>OO||e<0)throw new Error("invalid uint32: "+e)}function MO(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(Math.fround(e))&&Number.isFinite(e))throw new Error("invalid float32: "+e)}var LO=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function yf(){return{fields:{}}}var ut={encode(e,t=new he){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&bf.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=yf();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=bf.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 ut.fromPartial(e??{})},fromPartial(e){let t=yf();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=yf();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 NS(){return{key:"",value:void 0}}var bf={encode(e,t=new he){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&ae.encode(ae.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=NS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=r.string();continue;case 2:if(i!==18)break;o.value=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return bf.fromPartial(e??{})},fromPartial(e){let t=NS();return t.key=e.key??"",t.value=e.value??void 0,t}};function vf(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var ae={encode(e,t=new he){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&&ut.encode(ut.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&ha.encode(ha.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=vf();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=ut.unwrap(ut.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=ha.unwrap(ha.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=vf();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=vf();if(e===null)t.nullValue=LO.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(A.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new A.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function Sf(){return{values:[]}}var ha={encode(e,t=new he){for(let r of e.values)ae.encode(ae.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=Sf();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(ae.unwrap(ae.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ha.fromPartial(e??{})},fromPartial(e){let t=Sf();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=Sf();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&A.Array.isArray(e.values)?e.values:e}},qO=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 FS(){return{op:0,path:"",from:void 0,value:void 0}}var lu={encode(e,t=new he){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&&ae.encode(ae.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=FS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==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=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return lu.fromPartial(e??{})},fromPartial(e){let t=FS();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function DS(){return{id:"",type:"",function:void 0,metadata:void 0}}var du={encode(e,t=new he){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&pu.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&ut.encode(ut.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=DS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.type=r.string();continue;case 3:if(i!==26)break;o.function=pu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.metadata=ut.unwrap(ut.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return du.fromPartial(e??{})},fromPartial(e){let t=DS();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?pu.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function MS(){return{name:"",arguments:""}}var pu={encode(e,t=new he){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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=MS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.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 pu.fromPartial(e??{})},fromPartial(e){let t=MS();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function LS(){return{value:"",mimeType:""}}var fu={encode(e,t=new he){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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=LS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.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 fu.fromPartial(e??{})},fromPartial(e){let t=LS();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function qS(){return{value:"",mimeType:void 0}}var mu={encode(e,t=new he){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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=qS();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 mu.fromPartial(e??{})},fromPartial(e){let t=qS();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function jS(){return{data:void 0,url:void 0}}var Rt={encode(e,t=new he){return e.data!==void 0&&fu.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&mu.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(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!==10)break;o.data=fu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=mu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Rt.fromPartial(e??{})},fromPartial(e){let t=jS();return t.data=e.data!==void 0&&e.data!==null?fu.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?mu.fromPartial(e.url):void 0,t}};function US(){return{text:""}}var gu={encode(e,t=new he){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=US();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return gu.fromPartial(e??{})},fromPartial(e){let t=US();return t.text=e.text??"",t}};function VS(){return{source:void 0,metadata:void 0}}var hu={encode(e,t=new he){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ae.encode(ae.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=VS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return hu.fromPartial(e??{})},fromPartial(e){let t=VS();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function GS(){return{source:void 0,metadata:void 0}}var yu={encode(e,t=new he){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ae.encode(ae.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=GS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return yu.fromPartial(e??{})},fromPartial(e){let t=GS();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function BS(){return{source:void 0,metadata:void 0}}var vu={encode(e,t=new he){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ae.encode(ae.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=BS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vu.fromPartial(e??{})},fromPartial(e){let t=BS();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function $S(){return{source:void 0,metadata:void 0}}var Su={encode(e,t=new he){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ae.encode(ae.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=$S();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Su.fromPartial(e??{})},fromPartial(e){let t=$S();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function QS(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var bu={encode(e,t=new he){return e.text!==void 0&&gu.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&hu.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&yu.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&vu.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Su.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=QS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=gu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=hu.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=yu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=vu.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=Su.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return bu.fromPartial(e??{})},fromPartial(e){let t=QS();return t.text=e.text!==void 0&&e.text!==null?gu.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?hu.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?yu.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?vu.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Su.fromPartial(e.document):void 0,t}};function HS(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var Au={encode(e,t=new he){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)du.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)bu.encode(r,t.uint32(66).fork()).join();return e.metadata!==void 0&&ut.encode(ut.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=HS();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(du.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(bu.decode(r,r.uint32()));continue;case 9:if(i!==74)break;o.metadata=ut.unwrap(ut.decode(r,r.uint32()));continue;case 10:if(i!==82)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Au.fromPartial(e??{})},fromPartial(e){let t=HS();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=>du.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>bu.fromPartial(r))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function zS(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var wu={encode(e,t=new he){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&&ae.encode(ae.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&ae.encode(ae.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(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;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=ae.unwrap(ae.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.expiresAt=r.string();continue;case 7:if(i!==58)break;o.metadata=ae.unwrap(ae.decode(r,r.uint32()));continue;case 8:if(i!==66)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return wu.fromPartial(e??{})},fromPartial(e){let t=zS();return t.id=e.id??"",t.reason=e.reason??"",t.message=e.message??void 0,t.toolCallId=e.toolCallId??void 0,t.responseSchema=e.responseSchema??void 0,t.expiresAt=e.expiresAt??void 0,t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}},jO=function(e){return e[e.TEXT_MESSAGE_START=0]="TEXT_MESSAGE_START",e[e.TEXT_MESSAGE_CONTENT=1]="TEXT_MESSAGE_CONTENT",e[e.TEXT_MESSAGE_END=2]="TEXT_MESSAGE_END",e[e.TOOL_CALL_START=3]="TOOL_CALL_START",e[e.TOOL_CALL_ARGS=4]="TOOL_CALL_ARGS",e[e.TOOL_CALL_END=5]="TOOL_CALL_END",e[e.STATE_SNAPSHOT=6]="STATE_SNAPSHOT",e[e.STATE_DELTA=7]="STATE_DELTA",e[e.MESSAGES_SNAPSHOT=8]="MESSAGES_SNAPSHOT",e[e.RAW=9]="RAW",e[e.CUSTOM=10]="CUSTOM",e[e.RUN_STARTED=11]="RUN_STARTED",e[e.RUN_FINISHED=12]="RUN_FINISHED",e[e.RUN_ERROR=13]="RUN_ERROR",e[e.STEP_STARTED=14]="STEP_STARTED",e[e.STEP_FINISHED=15]="STEP_FINISHED",e[e.SUBAGENT_STARTED=16]="SUBAGENT_STARTED",e[e.SUBAGENT_FINISHED=17]="SUBAGENT_FINISHED",e[e.SUBAGENT_ERROR=18]="SUBAGENT_ERROR",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function WS(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var oe={encode(e,t=new he){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&ae.encode(ae.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&ut.encode(ut.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=WS();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=Xo(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=ae.unwrap(ae.decode(r,r.uint32()));continue;case 4:if(i!==34)break;o.metadata=ut.unwrap(ut.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return oe.fromPartial(e??{})},fromPartial(e){let t=WS();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t.metadata=e.metadata??void 0,t}};function KS(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0,subagentRunId:void 0}}var xu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=KS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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;case 5:if(i!==42)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xu.fromPartial(e??{})},fromPartial(e){let t=KS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function YS(){return{baseEvent:void 0,messageId:"",delta:"",subagentRunId:void 0}}var Cu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=YS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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;case 4:if(i!==34)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Cu.fromPartial(e??{})},fromPartial(e){let t=YS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function XS(){return{baseEvent:void 0,messageId:"",subagentRunId:void 0}}var Eu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=XS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Eu.fromPartial(e??{})},fromPartial(e){let t=XS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function ZS(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0,subagentRunId:void 0}}var Ru={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(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;o.baseEvent=oe.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.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ru.fromPartial(e??{})},fromPartial(e){let t=ZS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function JS(){return{baseEvent:void 0,toolCallId:"",delta:"",subagentRunId:void 0}}var Iu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(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!==10)break;o.baseEvent=oe.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;case 4:if(i!==34)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Iu.fromPartial(e??{})},fromPartial(e){let t=JS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function eb(){return{baseEvent:void 0,toolCallId:"",subagentRunId:void 0}}var Tu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=eb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Tu.fromPartial(e??{})},fromPartial(e){let t=eb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function tb(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var _u={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&ae.encode(ae.wrap(e.snapshot),t.uint32(18).fork()).join(),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=tb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=ae.unwrap(ae.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return _u.fromPartial(e??{})},fromPartial(e){let t=tb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function rb(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var ku={encode(e,t=new he){e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)lu.encode(r,t.uint32(18).fork()).join();return e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=rb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(lu.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ku.fromPartial(e??{})},fromPartial(e){let t=rb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>lu.fromPartial(r))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function nb(){return{baseEvent:void 0,messages:[]}}var Ou={encode(e,t=new he){e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Au.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=nb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(Au.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ou.fromPartial(e??{})},fromPartial(e){let t=nb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Au.fromPartial(r))||[],t}};function ob(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var Pu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&ae.encode(ae.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=ob();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=ae.unwrap(ae.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.source=r.string();continue;case 4:if(i!==34)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Pu.fromPartial(e??{})},fromPartial(e){let t=ob();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function ib(){return{baseEvent:void 0,name:"",value:void 0,subagentRunId:void 0}}var Nu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&ae.encode(ae.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=ib();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=ae.unwrap(ae.decode(r,r.uint32()));continue;case 4:if(i!==34)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Nu.fromPartial(e??{})},fromPartial(e){let t=ib();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function ab(){return{baseEvent:void 0,threadId:"",runId:""}}var Fu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=ab();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Fu.fromPartial(e??{})},fromPartial(e){let t=ab();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function sb(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var Vn={encode(e,t=new he){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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=sb();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=Xo(r.int64());continue;case 4:if(i!==32)break;o.outputTokens=Xo(r.int64());continue;case 5:if(i!==40)break;o.totalTokens=Xo(r.int64());continue;case 6:if(i!==48)break;o.reasoningTokens=Xo(r.int64());continue;case 7:if(i!==56)break;o.cachedInputTokens=Xo(r.int64());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Vn.fromPartial(e??{})},fromPartial(e){let t=sb();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 cb(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var Du={encode(e,t=new he){e.baseEvent!==void 0&&oe.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&&ae.encode(ae.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)wu.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)Vn.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=cb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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=ae.unwrap(ae.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(wu.decode(r,r.uint32()));continue;case 7:if(i!==58)break;o.usage.push(Vn.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Du.fromPartial(e??{})},fromPartial(e){let t=cb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.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=>wu.fromPartial(r))||[],t.usage=e.usage?.map(r=>Vn.fromPartial(r))||[],t}};function ub(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var Mu={encode(e,t=new he){e.baseEvent!==void 0&&oe.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)Vn.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=ub();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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(Vn.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Mu.fromPartial(e??{})},fromPartial(e){let t=ub();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>Vn.fromPartial(r))||[],t}};function lb(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Lu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=lb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Lu.fromPartial(e??{})},fromPartial(e){let t=lb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function db(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var qu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=db();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return qu.fromPartial(e??{})},fromPartial(e){let t=db();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function pb(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var ju={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=pb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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;case 6:if(i!==50)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ju.fromPartial(e??{})},fromPartial(e){let t=pb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function fb(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var Uu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=fb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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;case 6:if(i!==50)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Uu.fromPartial(e??{})},fromPartial(e){let t=fb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function mb(){return{baseEvent:void 0,subagentRunId:"",name:"",description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var Vu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.name!==""&&t.uint32(26).string(e.name),e.description!==void 0&&t.uint32(34).string(e.description),e.parentSubagentRunId!==void 0&&t.uint32(42).string(e.parentSubagentRunId),e.parentToolCallId!==void 0&&t.uint32(50).string(e.parentToolCallId),e.parentMessageId!==void 0&&t.uint32(58).string(e.parentMessageId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=mb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=r.string();continue;case 3:if(i!==26)break;o.name=r.string();continue;case 4:if(i!==34)break;o.description=r.string();continue;case 5:if(i!==42)break;o.parentSubagentRunId=r.string();continue;case 6:if(i!==50)break;o.parentToolCallId=r.string();continue;case 7:if(i!==58)break;o.parentMessageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Vu.fromPartial(e??{})},fromPartial(e){let t=mb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.name=e.name??"",t.description=e.description??void 0,t.parentSubagentRunId=e.parentSubagentRunId??void 0,t.parentToolCallId=e.parentToolCallId??void 0,t.parentMessageId=e.parentMessageId??void 0,t}};function gb(){return{baseEvent:void 0,subagentRunId:"",result:void 0,outcome:"",interruptIds:[]}}var Gu={encode(e,t=new he){e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&ae.encode(ae.wrap(e.result),t.uint32(26).fork()).join(),e.outcome!==""&&t.uint32(34).string(e.outcome);for(let r of e.interruptIds)t.uint32(42).string(r);return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=gb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=r.string();continue;case 3:if(i!==26)break;o.result=ae.unwrap(ae.decode(r,r.uint32()));continue;case 4:if(i!==34)break;o.outcome=r.string();continue;case 5:if(i!==42)break;o.interruptIds.push(r.string());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Gu.fromPartial(e??{})},fromPartial(e){let t=gb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interruptIds=e.interruptIds?.map(r=>r)||[],t}};function hb(){return{baseEvent:void 0,subagentRunId:"",message:"",code:void 0}}var Bu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.message!==""&&t.uint32(26).string(e.message),e.code!==void 0&&t.uint32(34).string(e.code),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=hb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.code=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Bu.fromPartial(e??{})},fromPartial(e){let t=hb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.message=e.message??"",t.code=e.code??void 0,t}};function yb(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0,subagentStarted:void 0,subagentFinished:void 0,subagentError:void 0}}var vb={encode(e,t=new he){return e.textMessageStart!==void 0&&xu.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Cu.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Eu.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Ru.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Iu.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Tu.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&_u.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&ku.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Ou.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Pu.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Nu.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Fu.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Du.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Mu.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Lu.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&qu.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&ju.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Uu.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&Vu.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&Gu.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&Bu.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=yb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=xu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=Cu.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=Eu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=Ru.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=Iu.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=Tu.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=_u.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=ku.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=Ou.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Pu.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Nu.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Fu.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Du.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=Mu.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Lu.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=qu.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=ju.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Uu.decode(r,r.uint32());continue;case 19:if(i!==154)break;o.subagentStarted=Vu.decode(r,r.uint32());continue;case 20:if(i!==162)break;o.subagentFinished=Gu.decode(r,r.uint32());continue;case 21:if(i!==170)break;o.subagentError=Bu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vb.fromPartial(e??{})},fromPartial(e){let t=yb();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?xu.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Cu.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Eu.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Ru.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Iu.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Tu.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?_u.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?ku.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Ou.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Pu.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Nu.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Fu.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Du.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Mu.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Lu.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?qu.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?ju.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Uu.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?Vu.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?Gu.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?Bu.fromPartial(e.subagentError):void 0,t}};function Xo(e){let t=A.Number(e.toString());if(t>A.Number.MAX_SAFE_INTEGER)throw new A.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<A.Number.MIN_SAFE_INTEGER)throw new A.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var Sb=e=>e&&typeof e=="object"?e:void 0;var uu=e=>{let t=Sb(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}}}},UO=e=>{let t=Sb(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:uu(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:uu(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:uu(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:uu(r.source),metadata:r.metadata}}}};function bb(e){let t=vb.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=jO[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.baseEvent.metadata!==void 0&&(r.metadata=r.baseEvent.metadata),delete r.baseEvent,r.type===F.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=>UO(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===F.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===F.SUBAGENT_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,i=Array.isArray(n.interruptIds)?n.interruptIds:[];delete n.interruptIds,o==="suspended"?n.outcome={type:"suspended",...(i.length>0&&{interruptIds:i})}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if((r.type===F.RUN_FINISHED||r.type===F.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===F.STATE_DELTA)for(let n of r.delta)n.op=qO[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]}),Rc.parse(r)}var Af="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var GO=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,wf=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(GO);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Ab=e=>e==="*"||e==="x"||e==="X",wb=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},BO=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],$O=(e,t)=>{if(Ab(e)||Ab(t))return 0;let[r,n]=BO(wb(e),wb(t));return r>n?1:r<n?-1:0},xf=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=$O(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Zo=(e,t)=>{let r=wf(e),n=wf(t),o=r.pop(),i=n.pop(),a=xf(r,n);return a!==0?a:o&&i?xf(o.split("."),i.split(".")):o||i?o?-1:1:0};var Te=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function ya(){return jr()}function Rf(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&Rf(t);return e}var xb=512*1024;function Cb(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 s=0;s<a.length;s++)o.push(a[s]);else{let s=Object.keys(a);for(let u=0;u<s.length;u++){let c=s[u];if(n+=c.length,n>r)return!0;o.push(a[c])}}}}return!1}function Pe(_x89,_x90,_x91,_x92){return _Pe.apply(this,arguments)}function _Pe(){_Pe=_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,s=a&&!Cb(t,r,xb),u=s?Te(t):t,c=s?Te(r):r,g=!1,v=!1,R;for(let h of e)try{s&&(Rf(u),Rf(c));let y=yield n(h,u,c);if(y===void 0)continue;let b=!1;if(y.messages!==void 0&&y.messages!==u&&(u=Te(y.messages),g=!0,b=!0),y.state!==void 0&&y.state!==c&&(c=Te(y.state),v=!0,b=!0),s&&b&&Cb(u,c,xb)&&(s=!1),R=y.stopPropagation,R===!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(u)?Te(u):u}:{}),...(v?{state:Object.isFrozen(c)?Te(c):c}:{}),...(R===void 0?{}:{stopPropagation:R})}});return _Pe.apply(this,arguments)}function $u(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 va(e){if(e instanceof If)return e;if(e===!0)return new If($u(!0))}var If=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 Cf(e){return e.enabled?new If(e):void 0}function QO(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}function It(e,t){return!e||t.metadata===void 0?!1:(e.metadata=$v(e.metadata,Te(t.metadata)),!0)}var Fb=(e,t,r,n,o)=>{let i=va(o),a=Te(r.messages),s=Te(e.state),u={},c=v=>{v.messages!==void 0&&(a=v.messages,u.messages=v.messages),v.state!==void 0&&(s=v.state,u.state=v.state)},g=()=>{let v=Te(u);return u={},v.messages!==void 0||v.state!==void 0?Oe(v):Bc};return t.pipe(ou(/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(v){let R=yield Pe(n,a,s,(h,y,b)=>h.onEvent?.({event:v,agent:r,input:e,messages:y,state:b}));if(c(R),R.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}),R.stopPropagation===!0)return g();switch(v.type){case F.TEXT_MESSAGE_START:{let h=yield Pe(n,a,s,(y,b,x)=>y.onTextMessageStartEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,role:b="assistant",name:x,subagentRunId:I}=v,N=a.find(w=>w.id===y);if(N?.role==="activity")return console.warn(`TEXT_MESSAGE_START: Message '${y}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let _=N;if(!_){let w={id:y,role:b,content:"",...(x!==void 0&&{name:x}),...(I!=null&&{subagentRunId:I})};a.push(w),_=w}let P=It(_,v);(!N||P)&&c({messages:a})}return g()}case F.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,b=a.find(I=>I.id===h);if(!b)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();if(b.role==="activity")return console.warn(`TEXT_MESSAGE_CONTENT: Message '${h}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let x=yield Pe(n,a,s,(I,N,_)=>I.onTextMessageContentEvent?.({event:v,messages:N,state:_,agent:r,input:e,textMessageBuffer:typeof b.content=="string"?b.content:""}));return c(x),x.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${y}`,It(b,v),c({messages:a})),g()}case F.TEXT_MESSAGE_END:{let{messageId:h}=v,y=a.find(x=>x.id===h);if(!y)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g();if(y.role==="activity")return console.warn(`TEXT_MESSAGE_END: Message '${h}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let b=yield Pe(n,a,s,(x,I,N)=>x.onTextMessageEndEvent?.({event:v,messages:I,state:N,agent:r,input:e,textMessageBuffer:typeof y.content=="string"?y.content:""}));return c(b),b.stopPropagation!==!0&&It(y,v)&&c({messages:a}),yield Promise.all(n.map(x=>{x.onNewMessage?.({message:y,messages:a,state:s,agent:r,input:e})})),g()}case F.TOOL_CALL_START:{let h=yield Pe(n,a,s,(y,b,x)=>y.onToolCallStartEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:b,parentMessageId:x,subagentRunId:I}=v,N=a.find(O=>O.toolCalls?.some(k=>k.id===y))?.toolCalls?.find(O=>O.id===y);if(N){let O=N.function.name!==b;return O&&(console.warn(`TOOL_CALL_START: tool call '${y}' already exists with name '${N.function.name}' \u2014 updating it to '${b}'`),N.function.name=b),(It(N,v)||O)&&c({messages:a}),g()}let _=new Set(a.map(O=>O.id)),P=QO(a,x,y);!_.has(P.id)&&I!=null&&P.subagentRunId===void 0&&(P.subagentRunId=I),P.toolCalls??(P.toolCalls=[]);let w={id:y,type:"function",function:{name:b,arguments:""}};P.toolCalls.push(w),It(w,v),c({messages:a})}return g()}case F.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=v,b=a.find(N=>N.toolCalls?.some(_=>_.id===h));if(!b)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let x=b.toolCalls?.find(N=>N.id===h);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=yield Pe(n,a,s,(N,_,P)=>{let w=x.function.arguments,O=x.function.name,k={};try{k=su(w)}catch{}return N.onToolCallArgsEvent?.({event:v,messages:_,state:P,agent:r,input:e,toolCallBuffer:w,toolCallName:O,partialToolCallArgs:k})});return c(I),I.stopPropagation!==!0&&(x.function.arguments+=y,It(x,v),c({messages:a})),g()}case F.TOOL_CALL_END:{let{toolCallId:h}=v,y=a.find(I=>I.toolCalls?.some(N=>N.id===h));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let b=y.toolCalls?.find(I=>I.id===h);if(!b)return console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g();let x=yield Pe(n,a,s,(I,N,_)=>{let P=b.function.arguments,w=b.function.name,O={};try{O=JSON.parse(P)}catch{}return I.onToolCallEndEvent?.({event:v,messages:N,state:_,agent:r,input:e,toolCallName:w,toolCallArgs:O})});return c(x),x.stopPropagation!==!0&&It(b,v)&&c({messages:a}),yield Promise.all(n.map(I=>{I.onNewToolCall?.({toolCall:b,messages:a,state:s,agent:r,input:e})})),g()}case F.TOOL_CALL_RESULT:{let h=yield Pe(n,a,s,(y,b,x)=>y.onToolCallResultEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:b,content:x,role:I,subagentRunId:N}=v,_={id:y,toolCallId:b,role:I||"tool",content:x,...(N!=null&&{subagentRunId:N})};It(_,v);let P=a.findIndex(w=>w.role==="assistant"&&w.toolCalls?.some(O=>O.id===b));if(P===-1)a.push(_);else{let w=P+1;for(;w<a.length&&a[w].role==="tool";)w++;a.splice(w,0,_)}yield Promise.all(n.map(w=>{w.onNewMessage?.({message:_,messages:a,state:s,agent:r,input:e})})),c({messages:a})}return g()}case F.STATE_SNAPSHOT:{let h=yield Pe(n,a,s,(y,b,x)=>y.onStateSnapshotEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{snapshot:y}=v;s=y,c({state:s})}return g()}case F.STATE_DELTA:{let h=yield Pe(n,a,s,(y,b,x)=>y.onStateDeltaEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{delta:y}=v;try{s=Fc.applyPatch(s,y,!0,!1).newDocument,c({state:s})}catch(b){let x=b instanceof Error?b.message:String(b);console.warn(`Failed to apply state patch:
|
|
37
37
|
Current state: ${JSON.stringify(s,null,2)}
|
|
38
38
|
Patch operations: ${JSON.stringify(y,null,2)}
|
|
39
|
-
Error: ${x}`)}}return g()}case F.MESSAGES_SNAPSHOT:{let h=yield Pe(n,a,s,(y,b,x)=>y.onMessagesSnapshotEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messages:y}=v,b=y.map(w=>{if(w.subagentRunId!==null)return w;let O={...w};return delete O.subagentRunId,O}),x=new Map(b.map(w=>[w.id,w])),I=b.some(w=>w.role==="activity"),N=b.some(w=>w.role==="reasoning"),_=w=>w.role==="activity"&&!I||w.role==="reasoning"&&!N;a=a.filter(w=>_(w)||x.has(w.id)).map(w=>_(w)?w:x.get(w.id));let P=new Set(a.map(w=>w.id));for(let w of b)P.has(w.id)||a.push(w);c({messages:a})}return g()}case F.ACTIVITY_SNAPSHOT:{let h=v,y=a.findIndex(_=>_.id===h.messageId),b=y>=0?a[y]:void 0,x=b?.role==="activity"?b:void 0,I=h.replace??!0,N=yield Pe(n,a,s,(_,P,w)=>_.onActivitySnapshotEvent?.({event:h,messages:P,state:w,agent:r,input:e,activityMessage:x,existingMessage:b}));if(c(N),N.stopPropagation!==!0){let _={id:h.messageId,role:"activity",activityType:h.activityType,content:Te(h.content),...(h.subagentRunId!=null&&{subagentRunId:h.subagentRunId})},P,w;y===-1?(a.push(_),P=_,w=_):x?(I&&(a[y]={...x,activityType:h.activityType,content:Te(h.content),subagentRunId:h.subagentRunId},h.subagentRunId??delete a[y].subagentRunId),w=a[y]):I&&(a[y]=_,P=_,w=_),It(w,h),c({messages:a}),P&&(yield Promise.all(n.map(O=>O.onNewMessage?.({message:P,messages:a,state:s,agent:r,input:e}))))}return g()}case F.ACTIVITY_DELTA:{let h=v,y=a.findIndex(N=>N.id===h.messageId);if(y===-1)return g();let b=a[y];if(b.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let x=b,I=yield Pe(n,a,s,(N,_,P)=>N.onActivityDeltaEvent?.({event:h,messages:_,state:P,agent:r,input:e,activityMessage:x}));if(c(I),I.stopPropagation!==!0)try{It(x,h)&&c({messages:a});let N=Te(x.content??{}),_=Fc.applyPatch(N,h.patch??[],!0,!1).newDocument;a[y]={...x,content:Te(_),activityType:h.activityType},c({messages:a})}catch(N){let _=N instanceof Error?N.message:String(N);console.warn(`Failed to apply activity patch for '${h.messageId}': ${_}`)}return g()}case F.RAW:return c(yield Pe(n,a,s,(h,y,b)=>h.onRawEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.CUSTOM:return c(yield Pe(n,a,s,(h,y,b)=>h.onCustomEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.RUN_STARTED:{let h=yield Pe(n,a,s,(y,b,x)=>y.onRunStartedEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let y=v;if(y.input?.messages){for(let b of y.input.messages){let x=b;if(b.subagentRunId===null){let I={...b};delete I.subagentRunId,x=I}a.find(I=>I.id===x.id)||a.push(x)}c({messages:a})}}return g()}case F.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},b=yield Pe(n,a,s,(x,I,N)=>x.onRunFinishedEvent?.({...y,messages:I,state:N,agent:r,input:e}));return c(b),b.stopPropagation!==!0&&(r.pendingInterrupts=y.outcome==="interrupt"?y.interrupts.map(x=>{if(x.subagentRunId!==null)return x;let I={...x};return delete I.subagentRunId,I}):[]),g()}case F.RUN_ERROR:return c(yield Pe(n,a,s,(h,y,b)=>h.onRunErrorEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.STEP_STARTED:return c(yield Pe(n,a,s,(h,y,b)=>h.onStepStartedEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.STEP_FINISHED:return c(yield Pe(n,a,s,(h,y,b)=>h.onStepFinishedEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be transformed before being applied");case F.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be transformed before being applied");case F.THINKING_START:return g();case F.THINKING_END:return g();case F.THINKING_TEXT_MESSAGE_START:return g();case F.THINKING_TEXT_MESSAGE_CONTENT:return g();case F.THINKING_TEXT_MESSAGE_END:return g();case F.REASONING_START:return c(yield Pe(n,a,s,(h,y,b)=>h.onReasoningStartEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.REASONING_MESSAGE_START:{let h=yield Pe(n,a,s,(y,b,x)=>y.onReasoningMessageStartEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,subagentRunId:b}=v,x=a.find(_=>_.id===y),I=x;if(!I){let _={id:y,role:"reasoning",content:"",...(b!=null&&{subagentRunId:b})};a.push(_),I=_}let N=It(I,v);(!x||N)&&c({messages:a})}return g()}case F.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,b=a.find(I=>I.id===h);if(!b)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let x=yield Pe(n,a,s,(I,N,_)=>I.onReasoningMessageContentEvent?.({event:v,messages:N,state:_,agent:r,input:e,reasoningMessageBuffer:typeof b.content=="string"?b.content:""}));return c(x),x.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${y}`,It(b,v),c({messages:a})),g()}case F.REASONING_MESSAGE_END:{let{messageId:h}=v,y=a.find(x=>x.id===h);if(!y)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g();let b=yield Pe(n,a,s,(x,I,N)=>x.onReasoningMessageEndEvent?.({event:v,messages:I,state:N,agent:r,input:e,reasoningMessageBuffer:typeof y.content=="string"?y.content:""}));return c(b),b.stopPropagation!==!0&&It(y,v)&&c({messages:a}),yield Promise.all(n.map(x=>{x.onNewMessage?.({message:y,messages:a,state:s,agent:r,input:e})})),g()}case F.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case F.REASONING_END:return c(yield Pe(n,a,s,(h,y,b)=>h.onReasoningEndEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:y,encryptedValue:b}=v,x=yield Pe(n,a,s,(I,N,_)=>I.onReasoningEncryptedValueEvent?.({event:v,messages:N,state:_,agent:r,input:e}));if(c(x),x.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let N of a)if(N.role==="assistant"&&N.toolCalls){let _=N.toolCalls.find(P=>P.id===y);if(_){_.encryptedValue=b,I=!0;break}}}else{let N=a.find(_=>_.id===y);N?.role!=="activity"&&N&&(N.encryptedValue=b,I=!0)}I&&(u.messages=a)}return g()}case F.SUBAGENT_STARTED:return c(yield Pe(n,a,s,(h,y,b)=>h.onSubagentStartedEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.SUBAGENT_FINISHED:return c(yield Pe(n,a,s,(h,y,b)=>h.onSubagentFinishedEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.SUBAGENT_ERROR:return c(yield Pe(n,a,s,(h,y,b)=>h.onSubagentErrorEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g()}return v.type,g()});return function(_x92){return _ref43.apply(this,arguments)}}()),af(),n.length>0?cf({}):v=>v)},Rf=e=>t=>{let r=va(e),n=new Set,o=new Set,i=new Set,a={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},s=!1,u=!1,c=!1,g=new Map,v=w=>{let O=g.get(w);return O||(O=new Map,g.set(w,O)),O},R=()=>{for(let w of g.values())if(w.size>0)return!0;return!1},h=new Map,y=new Set,b=!1,x=!1,I=!1,N=()=>{n.clear(),o.clear(),i.clear(),a.message.clear(),a.toolCall.clear(),a.activity.clear(),a.reasoning.clear(),g.clear(),h.clear(),y.clear(),b=!1,x=!1,s=!1,u=!1,I=!0},_=(w,O)=>{let k=w??[];if(Array.isArray(k))for(let T of k){if(!T||typeof T.id!="string")continue;if(T.subagentRunId===null)return new ge(`Cannot send a message (id '${T.id}') with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`);let D=T.role==="reasoning"?a.reasoning:T.role==="activity"?a.activity:a.message;(O||!D.has(T.id))&&D.set(T.id,{subagentRunId:T.subagentRunId});for(let G of T.toolCalls??[])G&&typeof G.id=="string"&&(O||!a.toolCall.has(G.id))&&a.toolCall.set(G.id,{subagentRunId:T.subagentRunId??void 0})}},P=(w,O,k,T,D)=>{if(O!==void 0&&k&&k.subagentRunId!==O)return new ge(`Cannot send '${w}': subagentRunId '${O}' does not match the ${T} '${D}' opener's subagent '${k.subagentRunId??"(the parent agent)"}'.`)};return t.pipe(wt(w=>{let O=w.type;if(r?.event("VERIFY","Event:",w,{type:w.type}),u&&O!==F.RUN_STARTED)return le(()=>new ge(`Cannot send event type '${O}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(s&&O!==F.RUN_ERROR&&O!==F.RUN_STARTED)return le(()=>new ge(`Cannot send event type '${O}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(c){if(O===F.RUN_STARTED){if(I&&!s&&!u)return le(()=>new ge("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));(s||u)&&N()}}else if(c=!0,O!==F.RUN_STARTED&&O!==F.RUN_ERROR)return le(()=>new ge("First event must be 'RUN_STARTED'"));if(w.subagentRunId===null)return le(()=>new ge(`Cannot send '${O}' with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`));if(O===F.SUBAGENT_STARTED||O===F.SUBAGENT_FINISHED||O===F.SUBAGENT_ERROR){let k=O===F.SUBAGENT_STARTED?["description","parentSubagentRunId","parentToolCallId","parentMessageId"]:O===F.SUBAGENT_FINISHED?["outcome"]:["code"];for(let D of k)if(w[D]===null)return le(()=>new ge(`Cannot send '${O}' with '${D}: null'. The field is optional \u2014 omit it entirely.`));let T=w.outcome;if(T!=null&&T.type!=="success"&&T.type!=="suspended")return le(()=>new ge(`Cannot send '${O}' with outcome type '${String(T.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(T&&T.interruptIds===null)return le(()=>new ge(`Cannot send '${O}' with 'outcome.interruptIds: null'. The field is optional \u2014 omit it entirely.`));if(T&&Array.isArray(T.interruptIds)&&T.interruptIds.some(D=>typeof D!="string"))return le(()=>new ge(`Cannot send '${O}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(O===F.RUN_FINISHED){let k=w.outcome;if(k?.type==="interrupt"&&Array.isArray(k.interrupts)){for(let T of k.interrupts)if(T&&T.subagentRunId===null)return le(()=>new ge(`Cannot send 'RUN_FINISHED' with an interrupt (id '${T.id}') carrying 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`))}}switch(O){case F.TEXT_MESSAGE_START:{let k=w.messageId;if(n.has(k))return le(()=>new ge(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${k}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let T=a.message.get(k);if(T){let D=P(O,w.subagentRunId,T,"message",k);if(D)return le(()=>D)}return n.add(k),T||a.message.set(k,{subagentRunId:w.subagentRunId}),Oe(w)}case F.TEXT_MESSAGE_CONTENT:{let k=w.messageId;if(!n.has(k))return le(()=>new ge(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${k}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let T=P(O,w.subagentRunId,a.message.get(k),"message",k);return T?le(()=>T):Oe(w)}case F.TEXT_MESSAGE_END:{let k=w.messageId;if(!n.has(k))return le(()=>new ge(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${k}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let T=P(O,w.subagentRunId,a.message.get(k),"message",k);return T?le(()=>T):(n.delete(k),Oe(w))}case F.TOOL_CALL_START:{let k=w.toolCallId;if(o.has(k))return le(()=>new ge(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${k}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let T=w.parentMessageId,D=w.subagentRunId,G;if(T!==void 0){let q=a.message.get(T);if(q){if(D!==void 0&&D!==q.subagentRunId)return le(()=>new ge(`Cannot send 'TOOL_CALL_START': subagentRunId '${D}' does not match its parent message '${T}' owner '${q.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`));G=q}}let M=a.toolCall.get(k);if(M){let q=P(O,D,M,"tool call",k);if(q)return le(()=>q);if(D===void 0&&G&&G.subagentRunId!==M.subagentRunId)return le(()=>new ge(`Cannot send 'TOOL_CALL_START': tool call '${k}' is owned by '${M.subagentRunId??"(the parent agent)"}' but its parent message '${T}' is owned by '${G.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`))}return o.add(k),M||a.toolCall.set(k,D===void 0?G??{subagentRunId:void 0}:{subagentRunId:D}),Oe(w)}case F.TOOL_CALL_ARGS:{let k=w.toolCallId;if(!o.has(k))return le(()=>new ge(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${k}'. Start a tool call with 'TOOL_CALL_START' first.`));let T=P(O,w.subagentRunId,a.toolCall.get(k),"tool call",k);return T?le(()=>T):Oe(w)}case F.TOOL_CALL_END:{let k=w.toolCallId;if(!o.has(k))return le(()=>new ge(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${k}'. A 'TOOL_CALL_START' event must be sent first.`));let T=P(O,w.subagentRunId,a.toolCall.get(k),"tool call",k);return T?le(()=>T):(o.delete(k),Oe(w))}case F.STEP_STARTED:{let k=w.stepName,T=w.subagentRunId;return v(T).has(k)?le(()=>new ge(`Step "${k}" is already active for 'STEP_STARTED'${T===void 0?"":` in subagent '${T}'`}`)):(v(T).set(k,!0),Oe(w))}case F.STEP_FINISHED:{let k=w.stepName,T=w.subagentRunId;if(!v(T).has(k)){let D,G=!1;for(let[M,q]of g)if(M!==T&&q.has(k)){D=M,G=!0;break}return le(G?()=>new ge(`Cannot send 'STEP_FINISHED' for step "${k}" attributed to ${T===void 0?"the parent agent":`subagent '${T}'`}: that step is open under ${D===void 0?"the parent agent":`subagent '${D}'`}. A step must be finished by whoever started it.`):()=>new ge(`Cannot send 'STEP_FINISHED' for step "${k}" that was not started`))}return v(T).delete(k),Oe(w)}case F.ACTIVITY_SNAPSHOT:{let k=w.messageId;return(!a.activity.has(k)||w.replace!==!1)&&a.activity.set(k,{subagentRunId:w.subagentRunId}),Oe(w)}case F.TOOL_CALL_RESULT:{let k=w.messageId;return typeof k=="string"&&a.message.set(k,{subagentRunId:w.subagentRunId}),Oe(w)}case F.REASONING_START:case F.REASONING_MESSAGE_START:{let k=w.messageId,T=a.reasoning.get(k);if(T){let D=P(O,w.subagentRunId,T,"reasoning message",k);if(D)return le(()=>D)}return i.add(k),T||a.reasoning.set(k,{subagentRunId:w.subagentRunId}),Oe(w)}case F.REASONING_MESSAGE_CONTENT:case F.REASONING_MESSAGE_END:case F.REASONING_END:{let k=w.messageId,T=P(O,w.subagentRunId,a.reasoning.get(k),"reasoning message",k);return T?le(()=>T):(O===F.REASONING_END&&i.delete(k),Oe(w))}case F.REASONING_ENCRYPTED_VALUE:{let k=w.entityId,T=w.subtype,D=T==="tool-call"?a.toolCall.get(k):T==="message"?a.message.get(k)??a.reasoning.get(k):a.reasoning.get(k),G=T==="tool-call"?"tool call":T==="message"?"message":"reasoning message",M=P(O,w.subagentRunId,D,G,k);return M?le(()=>M):Oe(w)}case F.ACTIVITY_DELTA:{let k=w.messageId,T=P(O,w.subagentRunId,a.activity.get(k),"activity",k);return T?le(()=>T):Oe(w)}case F.SUBAGENT_STARTED:{if(typeof w.subagentRunId!="string")return le(()=>new ge("Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'."));if(typeof w.name!="string")return le(()=>new ge("Cannot send 'SUBAGENT_STARTED' without a 'name'."));let k=w.subagentRunId,T=w.parentSubagentRunId;return h.has(k)?le(()=>new ge(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):y.has(k)?le(()=>new ge(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):T!==void 0&&!h.has(T)&&!y.has(T)?le(()=>new ge(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${T}' has not been started in this run.`)):(h.set(k,!0),Oe(w))}case F.SUBAGENT_FINISHED:case F.SUBAGENT_ERROR:{if(typeof w.subagentRunId!="string")return le(()=>new ge(`Cannot send '${O}' without a 'subagentRunId'.`));if(O===F.SUBAGENT_ERROR&&typeof w.message!="string")return le(()=>new ge("Cannot send 'SUBAGENT_ERROR' without a 'message'."));let k=w.subagentRunId;return h.has(k)?(h.delete(k),y.add(k),Oe(w)):le(()=>new ge(`Cannot send '${O}': no active subagent found with ID '${k}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case F.MESSAGES_SNAPSHOT:{let k=_(w.messages,!0);if(k)return le(()=>k)}return Oe(w);case F.RUN_STARTED:I=!0;{let k=_((w.input??{}).messages,!1);if(k)return le(()=>k)}return Oe(w);case F.RUN_FINISHED:if(R()){let k=[];for(let[D,G]of g)for(let M of G.keys())k.push(D===void 0?M:`${M} (subagent '${D}')`);let T=k.join(", ");return le(()=>new ge(`Cannot send 'RUN_FINISHED' while steps are still active: ${T}`))}if(n.size>0){let k=Array.from(n.keys()).join(", ");return le(()=>new ge(`Cannot send 'RUN_FINISHED' while text messages are still active: ${k}`))}if(o.size>0){let k=Array.from(o.keys()).join(", ");return le(()=>new ge(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${k}`))}if(h.size>0){let k=Array.from(h.keys()).join(", ");return le(()=>new ge(`Cannot send 'RUN_FINISHED' while subagents are still active: ${k}`))}return s=!0,Oe(w);case F.RUN_ERROR:return u=!0,Oe(w);case F.CUSTOM:return Oe(w);case F.THINKING_TEXT_MESSAGE_START:return b?x?le(()=>new ge("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(x=!0,Oe(w)):le(()=>new ge("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case F.THINKING_TEXT_MESSAGE_CONTENT:return x?Oe(w):le(()=>new ge("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case F.THINKING_TEXT_MESSAGE_END:return x?(x=!1,Oe(w)):le(()=>new ge("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case F.THINKING_START:return b?le(()=>new ge("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(b=!0,Oe(w));case F.THINKING_END:return b?(b=!1,Oe(w)):le(()=>new ge("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Oe(w)}}))},Gn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),HO=e=>nu(()=>jn(e())).pipe(uf(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return jn(t.text()).pipe(wt(i=>{let a=i;if(o.includes("application/json"))try{a=JSON.parse(i)}catch{}let s=Error(`HTTP ${t.status}: ${typeof a=="string"?a:JSON.stringify(a)}`);return s.status=t.status,s.payload=a,le(()=>s)}))}let r={type:Gn.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new Ve(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:a}=yield n.read();if(i)break;let s={type:Gn.DATA,data:a};o.next(s)}o.complete()}catch(i){o.error(i)}})(),()=>{n.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):le(()=>Error("Failed to getReader() from response"))})),zO=(e,t)=>{let r=va(t),n=new nr,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:s=>{if(s.type!==Gn.HEADERS&&s.type===Gn.DATA&&s.data){let u=o.decode(s.data,{stream:!0});i+=u;let c=i.split(/\n\n/);i=c.pop()||"";for(let g of c)a(g)}},error:s=>n.error(s),complete:()=>{i&&(i+=o.decode(),a(i)),n.complete()}});function a(s){let u=s.split(`
|
|
39
|
+
Error: ${x}`)}}return g()}case F.MESSAGES_SNAPSHOT:{let h=yield Pe(n,a,s,(y,b,x)=>y.onMessagesSnapshotEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messages:y}=v,b=y.map(w=>{if(w.subagentRunId!==null)return w;let O={...w};return delete O.subagentRunId,O}),x=new Map(b.map(w=>[w.id,w])),I=b.some(w=>w.role==="activity"),N=b.some(w=>w.role==="reasoning"),_=w=>w.role==="activity"&&!I||w.role==="reasoning"&&!N;a=a.filter(w=>_(w)||x.has(w.id)).map(w=>_(w)?w:x.get(w.id));let P=new Set(a.map(w=>w.id));for(let w of b)P.has(w.id)||a.push(w);c({messages:a})}return g()}case F.ACTIVITY_SNAPSHOT:{let h=v,y=a.findIndex(_=>_.id===h.messageId),b=y>=0?a[y]:void 0,x=b?.role==="activity"?b:void 0,I=h.replace??!0,N=yield Pe(n,a,s,(_,P,w)=>_.onActivitySnapshotEvent?.({event:h,messages:P,state:w,agent:r,input:e,activityMessage:x,existingMessage:b}));if(c(N),N.stopPropagation!==!0){let _={id:h.messageId,role:"activity",activityType:h.activityType,content:Te(h.content),...(h.subagentRunId!=null&&{subagentRunId:h.subagentRunId})},P,w;y===-1?(a.push(_),P=_,w=_):x?(I&&(a[y]={...x,activityType:h.activityType,content:Te(h.content),subagentRunId:h.subagentRunId},h.subagentRunId??delete a[y].subagentRunId),w=a[y]):I&&(a[y]=_,P=_,w=_),It(w,h),c({messages:a}),P&&(yield Promise.all(n.map(O=>O.onNewMessage?.({message:P,messages:a,state:s,agent:r,input:e}))))}return g()}case F.ACTIVITY_DELTA:{let h=v,y=a.findIndex(N=>N.id===h.messageId);if(y===-1)return g();let b=a[y];if(b.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let x=b,I=yield Pe(n,a,s,(N,_,P)=>N.onActivityDeltaEvent?.({event:h,messages:_,state:P,agent:r,input:e,activityMessage:x}));if(c(I),I.stopPropagation!==!0)try{It(x,h)&&c({messages:a});let N=Te(x.content??{}),_=Fc.applyPatch(N,h.patch??[],!0,!1).newDocument;a[y]={...x,content:Te(_),activityType:h.activityType},c({messages:a})}catch(N){let _=N instanceof Error?N.message:String(N);console.warn(`Failed to apply activity patch for '${h.messageId}': ${_}`)}return g()}case F.RAW:return c(yield Pe(n,a,s,(h,y,b)=>h.onRawEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.CUSTOM:return c(yield Pe(n,a,s,(h,y,b)=>h.onCustomEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.RUN_STARTED:{let h=yield Pe(n,a,s,(y,b,x)=>y.onRunStartedEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let y=v;if(y.input?.messages){for(let b of y.input.messages){let x=b;if(b.subagentRunId===null){let I={...b};delete I.subagentRunId,x=I}a.find(I=>I.id===x.id)||a.push(x)}c({messages:a})}}return g()}case F.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},b=yield Pe(n,a,s,(x,I,N)=>x.onRunFinishedEvent?.({...y,messages:I,state:N,agent:r,input:e}));return c(b),b.stopPropagation!==!0&&(r.pendingInterrupts=y.outcome==="interrupt"?y.interrupts.map(x=>{if(x.subagentRunId!==null)return x;let I={...x};return delete I.subagentRunId,I}):[]),g()}case F.RUN_ERROR:return c(yield Pe(n,a,s,(h,y,b)=>h.onRunErrorEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.STEP_STARTED:return c(yield Pe(n,a,s,(h,y,b)=>h.onStepStartedEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.STEP_FINISHED:return c(yield Pe(n,a,s,(h,y,b)=>h.onStepFinishedEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be transformed before being applied");case F.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be transformed before being applied");case F.THINKING_START:return g();case F.THINKING_END:return g();case F.THINKING_TEXT_MESSAGE_START:return g();case F.THINKING_TEXT_MESSAGE_CONTENT:return g();case F.THINKING_TEXT_MESSAGE_END:return g();case F.REASONING_START:return c(yield Pe(n,a,s,(h,y,b)=>h.onReasoningStartEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.REASONING_MESSAGE_START:{let h=yield Pe(n,a,s,(y,b,x)=>y.onReasoningMessageStartEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,subagentRunId:b}=v,x=a.find(_=>_.id===y),I=x;if(!I){let _={id:y,role:"reasoning",content:"",...(b!=null&&{subagentRunId:b})};a.push(_),I=_}let N=It(I,v);(!x||N)&&c({messages:a})}return g()}case F.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,b=a.find(I=>I.id===h);if(!b)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let x=yield Pe(n,a,s,(I,N,_)=>I.onReasoningMessageContentEvent?.({event:v,messages:N,state:_,agent:r,input:e,reasoningMessageBuffer:typeof b.content=="string"?b.content:""}));return c(x),x.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${y}`,It(b,v),c({messages:a})),g()}case F.REASONING_MESSAGE_END:{let{messageId:h}=v,y=a.find(x=>x.id===h);if(!y)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g();let b=yield Pe(n,a,s,(x,I,N)=>x.onReasoningMessageEndEvent?.({event:v,messages:I,state:N,agent:r,input:e,reasoningMessageBuffer:typeof y.content=="string"?y.content:""}));return c(b),b.stopPropagation!==!0&&It(y,v)&&c({messages:a}),yield Promise.all(n.map(x=>{x.onNewMessage?.({message:y,messages:a,state:s,agent:r,input:e})})),g()}case F.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case F.REASONING_END:return c(yield Pe(n,a,s,(h,y,b)=>h.onReasoningEndEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:y,encryptedValue:b}=v,x=yield Pe(n,a,s,(I,N,_)=>I.onReasoningEncryptedValueEvent?.({event:v,messages:N,state:_,agent:r,input:e}));if(c(x),x.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let N of a)if(N.role==="assistant"&&N.toolCalls){let _=N.toolCalls.find(P=>P.id===y);if(_){_.encryptedValue=b,I=!0;break}}}else{let N=a.find(_=>_.id===y);N?.role!=="activity"&&N&&(N.encryptedValue=b,I=!0)}I&&(u.messages=a)}return g()}case F.SUBAGENT_STARTED:return c(yield Pe(n,a,s,(h,y,b)=>h.onSubagentStartedEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.SUBAGENT_FINISHED:return c(yield Pe(n,a,s,(h,y,b)=>h.onSubagentFinishedEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.SUBAGENT_ERROR:return c(yield Pe(n,a,s,(h,y,b)=>h.onSubagentErrorEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g()}return v.type,g()});return function(_x93){return _ref20.apply(this,arguments)}}()),of(),n.length>0?sf({}):v=>v)},Ef=e=>t=>{let r=va(e),n=new Set,o=new Set,i=new Set,a={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},s=!1,u=!1,c=!1,g=new Map,v=w=>{let O=g.get(w);return O||(O=new Map,g.set(w,O)),O},R=()=>{for(let w of g.values())if(w.size>0)return!0;return!1},h=new Map,y=new Set,b=!1,x=!1,I=!1,N=()=>{n.clear(),o.clear(),i.clear(),a.message.clear(),a.toolCall.clear(),a.activity.clear(),a.reasoning.clear(),g.clear(),h.clear(),y.clear(),b=!1,x=!1,s=!1,u=!1,I=!0},_=(w,O)=>{let k=w??[];if(Array.isArray(k))for(let T of k){if(!T||typeof T.id!="string")continue;if(T.subagentRunId===null)return new ge(`Cannot send a message (id '${T.id}') with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`);let D=T.role==="reasoning"?a.reasoning:T.role==="activity"?a.activity:a.message;(O||!D.has(T.id))&&D.set(T.id,{subagentRunId:T.subagentRunId});for(let G of T.toolCalls??[])G&&typeof G.id=="string"&&(O||!a.toolCall.has(G.id))&&a.toolCall.set(G.id,{subagentRunId:T.subagentRunId??void 0})}},P=(w,O,k,T,D)=>{if(O!==void 0&&k&&k.subagentRunId!==O)return new ge(`Cannot send '${w}': subagentRunId '${O}' does not match the ${T} '${D}' opener's subagent '${k.subagentRunId??"(the parent agent)"}'.`)};return t.pipe(wt(w=>{let O=w.type;if(r?.event("VERIFY","Event:",w,{type:w.type}),u&&O!==F.RUN_STARTED)return le(()=>new ge(`Cannot send event type '${O}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(s&&O!==F.RUN_ERROR&&O!==F.RUN_STARTED)return le(()=>new ge(`Cannot send event type '${O}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(c){if(O===F.RUN_STARTED){if(I&&!s&&!u)return le(()=>new ge("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));(s||u)&&N()}}else if(c=!0,O!==F.RUN_STARTED&&O!==F.RUN_ERROR)return le(()=>new ge("First event must be 'RUN_STARTED'"));if(w.subagentRunId===null)return le(()=>new ge(`Cannot send '${O}' with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`));if(O===F.SUBAGENT_STARTED||O===F.SUBAGENT_FINISHED||O===F.SUBAGENT_ERROR){let k=O===F.SUBAGENT_STARTED?["description","parentSubagentRunId","parentToolCallId","parentMessageId"]:O===F.SUBAGENT_FINISHED?["outcome"]:["code"];for(let D of k)if(w[D]===null)return le(()=>new ge(`Cannot send '${O}' with '${D}: null'. The field is optional \u2014 omit it entirely.`));let T=w.outcome;if(T!=null&&T.type!=="success"&&T.type!=="suspended")return le(()=>new ge(`Cannot send '${O}' with outcome type '${String(T.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(T&&T.interruptIds===null)return le(()=>new ge(`Cannot send '${O}' with 'outcome.interruptIds: null'. The field is optional \u2014 omit it entirely.`));if(T&&Array.isArray(T.interruptIds)&&T.interruptIds.some(D=>typeof D!="string"))return le(()=>new ge(`Cannot send '${O}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(O===F.RUN_FINISHED){let k=w.outcome;if(k?.type==="interrupt"&&Array.isArray(k.interrupts)){for(let T of k.interrupts)if(T&&T.subagentRunId===null)return le(()=>new ge(`Cannot send 'RUN_FINISHED' with an interrupt (id '${T.id}') carrying 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`))}}switch(O){case F.TEXT_MESSAGE_START:{let k=w.messageId;if(n.has(k))return le(()=>new ge(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${k}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let T=a.message.get(k);if(T){let D=P(O,w.subagentRunId,T,"message",k);if(D)return le(()=>D)}return n.add(k),T||a.message.set(k,{subagentRunId:w.subagentRunId}),Oe(w)}case F.TEXT_MESSAGE_CONTENT:{let k=w.messageId;if(!n.has(k))return le(()=>new ge(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${k}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let T=P(O,w.subagentRunId,a.message.get(k),"message",k);return T?le(()=>T):Oe(w)}case F.TEXT_MESSAGE_END:{let k=w.messageId;if(!n.has(k))return le(()=>new ge(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${k}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let T=P(O,w.subagentRunId,a.message.get(k),"message",k);return T?le(()=>T):(n.delete(k),Oe(w))}case F.TOOL_CALL_START:{let k=w.toolCallId;if(o.has(k))return le(()=>new ge(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${k}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let T=w.parentMessageId,D=w.subagentRunId,G;if(T!==void 0){let q=a.message.get(T);if(q){if(D!==void 0&&D!==q.subagentRunId)return le(()=>new ge(`Cannot send 'TOOL_CALL_START': subagentRunId '${D}' does not match its parent message '${T}' owner '${q.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`));G=q}}let M=a.toolCall.get(k);if(M){let q=P(O,D,M,"tool call",k);if(q)return le(()=>q);if(D===void 0&&G&&G.subagentRunId!==M.subagentRunId)return le(()=>new ge(`Cannot send 'TOOL_CALL_START': tool call '${k}' is owned by '${M.subagentRunId??"(the parent agent)"}' but its parent message '${T}' is owned by '${G.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`))}return o.add(k),M||a.toolCall.set(k,D===void 0?G??{subagentRunId:void 0}:{subagentRunId:D}),Oe(w)}case F.TOOL_CALL_ARGS:{let k=w.toolCallId;if(!o.has(k))return le(()=>new ge(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${k}'. Start a tool call with 'TOOL_CALL_START' first.`));let T=P(O,w.subagentRunId,a.toolCall.get(k),"tool call",k);return T?le(()=>T):Oe(w)}case F.TOOL_CALL_END:{let k=w.toolCallId;if(!o.has(k))return le(()=>new ge(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${k}'. A 'TOOL_CALL_START' event must be sent first.`));let T=P(O,w.subagentRunId,a.toolCall.get(k),"tool call",k);return T?le(()=>T):(o.delete(k),Oe(w))}case F.STEP_STARTED:{let k=w.stepName,T=w.subagentRunId;return v(T).has(k)?le(()=>new ge(`Step "${k}" is already active for 'STEP_STARTED'${T===void 0?"":` in subagent '${T}'`}`)):(v(T).set(k,!0),Oe(w))}case F.STEP_FINISHED:{let k=w.stepName,T=w.subagentRunId;if(!v(T).has(k)){let D,G=!1;for(let[M,q]of g)if(M!==T&&q.has(k)){D=M,G=!0;break}return le(G?()=>new ge(`Cannot send 'STEP_FINISHED' for step "${k}" attributed to ${T===void 0?"the parent agent":`subagent '${T}'`}: that step is open under ${D===void 0?"the parent agent":`subagent '${D}'`}. A step must be finished by whoever started it.`):()=>new ge(`Cannot send 'STEP_FINISHED' for step "${k}" that was not started`))}return v(T).delete(k),Oe(w)}case F.ACTIVITY_SNAPSHOT:{let k=w.messageId;return(!a.activity.has(k)||w.replace!==!1)&&a.activity.set(k,{subagentRunId:w.subagentRunId}),Oe(w)}case F.TOOL_CALL_RESULT:{let k=w.messageId;return typeof k=="string"&&a.message.set(k,{subagentRunId:w.subagentRunId}),Oe(w)}case F.REASONING_START:case F.REASONING_MESSAGE_START:{let k=w.messageId,T=a.reasoning.get(k);if(T){let D=P(O,w.subagentRunId,T,"reasoning message",k);if(D)return le(()=>D)}return i.add(k),T||a.reasoning.set(k,{subagentRunId:w.subagentRunId}),Oe(w)}case F.REASONING_MESSAGE_CONTENT:case F.REASONING_MESSAGE_END:case F.REASONING_END:{let k=w.messageId,T=P(O,w.subagentRunId,a.reasoning.get(k),"reasoning message",k);return T?le(()=>T):(O===F.REASONING_END&&i.delete(k),Oe(w))}case F.REASONING_ENCRYPTED_VALUE:{let k=w.entityId,T=w.subtype,D=T==="tool-call"?a.toolCall.get(k):T==="message"?a.message.get(k)??a.reasoning.get(k):a.reasoning.get(k),G=T==="tool-call"?"tool call":T==="message"?"message":"reasoning message",M=P(O,w.subagentRunId,D,G,k);return M?le(()=>M):Oe(w)}case F.ACTIVITY_DELTA:{let k=w.messageId,T=P(O,w.subagentRunId,a.activity.get(k),"activity",k);return T?le(()=>T):Oe(w)}case F.SUBAGENT_STARTED:{if(typeof w.subagentRunId!="string")return le(()=>new ge("Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'."));if(typeof w.name!="string")return le(()=>new ge("Cannot send 'SUBAGENT_STARTED' without a 'name'."));let k=w.subagentRunId,T=w.parentSubagentRunId;return h.has(k)?le(()=>new ge(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):y.has(k)?le(()=>new ge(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):T!==void 0&&!h.has(T)&&!y.has(T)?le(()=>new ge(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${T}' has not been started in this run.`)):(h.set(k,!0),Oe(w))}case F.SUBAGENT_FINISHED:case F.SUBAGENT_ERROR:{if(typeof w.subagentRunId!="string")return le(()=>new ge(`Cannot send '${O}' without a 'subagentRunId'.`));if(O===F.SUBAGENT_ERROR&&typeof w.message!="string")return le(()=>new ge("Cannot send 'SUBAGENT_ERROR' without a 'message'."));let k=w.subagentRunId;return h.has(k)?(h.delete(k),y.add(k),Oe(w)):le(()=>new ge(`Cannot send '${O}': no active subagent found with ID '${k}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case F.MESSAGES_SNAPSHOT:{let k=_(w.messages,!0);if(k)return le(()=>k)}return Oe(w);case F.RUN_STARTED:I=!0;{let k=_((w.input??{}).messages,!1);if(k)return le(()=>k)}return Oe(w);case F.RUN_FINISHED:if(R()){let k=[];for(let[D,G]of g)for(let M of G.keys())k.push(D===void 0?M:`${M} (subagent '${D}')`);let T=k.join(", ");return le(()=>new ge(`Cannot send 'RUN_FINISHED' while steps are still active: ${T}`))}if(n.size>0){let k=Array.from(n.keys()).join(", ");return le(()=>new ge(`Cannot send 'RUN_FINISHED' while text messages are still active: ${k}`))}if(o.size>0){let k=Array.from(o.keys()).join(", ");return le(()=>new ge(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${k}`))}if(h.size>0){let k=Array.from(h.keys()).join(", ");return le(()=>new ge(`Cannot send 'RUN_FINISHED' while subagents are still active: ${k}`))}return s=!0,Oe(w);case F.RUN_ERROR:return u=!0,Oe(w);case F.CUSTOM:return Oe(w);case F.THINKING_TEXT_MESSAGE_START:return b?x?le(()=>new ge("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(x=!0,Oe(w)):le(()=>new ge("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case F.THINKING_TEXT_MESSAGE_CONTENT:return x?Oe(w):le(()=>new ge("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case F.THINKING_TEXT_MESSAGE_END:return x?(x=!1,Oe(w)):le(()=>new ge("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case F.THINKING_START:return b?le(()=>new ge("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(b=!0,Oe(w));case F.THINKING_END:return b?(b=!1,Oe(w)):le(()=>new ge("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Oe(w)}}))},Gn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),HO=e=>nu(()=>jn(e())).pipe(cf(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return jn(t.text()).pipe(wt(i=>{let a=i;if(o.includes("application/json"))try{a=JSON.parse(i)}catch{}let s=Error(`HTTP ${t.status}: ${typeof a=="string"?a:JSON.stringify(a)}`);return s.status=t.status,s.payload=a,le(()=>s)}))}let r={type:Gn.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new Ve(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:a}=yield n.read();if(i)break;let s={type:Gn.DATA,data:a};o.next(s)}o.complete()}catch(i){o.error(i)}})(),()=>{n.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):le(()=>Error("Failed to getReader() from response"))})),zO=(e,t)=>{let r=va(t),n=new nr,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:s=>{if(s.type!==Gn.HEADERS&&s.type===Gn.DATA&&s.data){let u=o.decode(s.data,{stream:!0});i+=u;let c=i.split(/\n\n/);i=c.pop()||"";for(let g of c)a(g)}},error:s=>n.error(s),complete:()=>{i&&(i+=o.decode(),a(i)),n.complete()}});function a(s){let u=s.split(`
|
|
40
40
|
`),c=[];for(let g of u)g.startsWith("data:")&&c.push(g.slice(5).replace(/^ /,""));if(c.length>0)try{let g=c.join(`
|
|
41
|
-
`),v=JSON.parse(g);r?.event("SSE","Event received:",v,{type:v.type}),n.next(v)}catch(g){n.error(g)}}return n.asObservable()},WO=e=>{let t=new nr,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==Gn.HEADERS&&o.type===Gn.DATA&&o.data){let i=new Uint8Array(r.length+o.data.length);i.set(r,0),i.set(o.data,r.length),r=i,n()}},error:o=>t.error(o),complete:()=>{if(r.length>0)try{n()}catch{console.warn("Incomplete or invalid protocol buffer data at stream end")}t.complete()}});function n(){for(;r.length>=4;){let o=4+new DataView(r.buffer,r.byteOffset,4).getUint32(0,!1);if(r.length<o)break;try{let i=r.slice(4,o),a=bb(i);t.next(a),r=r.slice(o)}catch(i){let a=i instanceof Error?i.message:String(i);t.error(Error(`Failed to decode protocol buffer message: ${a}`));return}}}return t.asObservable()},KO=(e,t)=>{let r=va(t),n=new nr,o=new Gc,i=!1;return e.subscribe({next:a=>{if(o.next(a),a.type===Gn.HEADERS&&!i){i=!0;let s=a.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:s,parser:s===
|
|
42
|
-
`)},cP=(e,t,r)=>n=>{let o={},i=!0,a=!0,s="",u=null,c=null,g=[],v={},R=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(wt(h=>{switch(h.type){case F.TEXT_MESSAGE_START:{let y=h;return[{type:Ue.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case F.TEXT_MESSAGE_CONTENT:{let y=h;return[{type:Ue.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case F.TEXT_MESSAGE_END:{let y=h;return[{type:Ue.enum.TextMessageEnd,messageId:y.messageId}]}case F.TOOL_CALL_START:{let y=h;return g.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),a=!0,v[y.toolCallId]=y.toolCallName,[{type:Ue.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case F.TOOL_CALL_ARGS:{let y=h,b=g.find(I=>I.id===y.toolCallId);if(!b)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];b.function.arguments+=y.delta;let x=!1;if(c){let I=c.find(N=>N.tool==b.function.name);if(I)try{let N=JSON.parse(su(b.function.arguments));I.tool_argument&&I.tool_argument in N?(R({...o,[I.state_key]:N[I.tool_argument]}),x=!0):I.tool_argument||(R({...o,[I.state_key]:N}),x=!0)}catch{}}return[{type:Ue.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(x?[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]:[])]}case F.TOOL_CALL_END:{let y=h;return[{type:Ue.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case F.TOOL_CALL_RESULT:{let y=h;return[{type:Ue.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:v[y.toolCallId]||"unknown"}]}case F.RAW:return[];case F.CUSTOM:{let y=h;switch(y.name){case"Exit":i=!1;break;case"PredictState":c=y.value;break}return[{type:Ue.enum.MetaEvent,name:y.name,value:y.value}]}case F.STATE_SNAPSHOT:return R(h.snapshot),[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}];case F.STATE_DELTA:{let y=h,b=Fc.applyPatch(o,y.delta,!0,!1);return b?(R(b.newDocument),[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]):[]}case F.MESSAGES_SNAPSHOT:return u=h.messages,[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(u?{messages:u}:{})}),active:!0}];case F.RUN_STARTED:return[];case F.RUN_FINISHED:return u&&(o.messages=u),Object.keys(o).length===0?[]:[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(u?{messages:uP(u)}:{})}),active:!1}];case F.RUN_ERROR:{let y=h;return[{type:Ue.enum.RunError,message:y.message,code:y.code}]}case F.STEP_STARTED:return s=h.stepName,g=[],c=null,[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case F.STEP_FINISHED:return g=[],c=null,[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function uP(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=sP(r.content);if(n){let o={id:r.id,role:r.role,content:n};t.push(o)}if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0)for(let o of r.toolCalls){let i={id:o.id,name:o.function.name,arguments:JSON.parse(o.function.arguments),parentMessageId:r.id};t.push(i)}}else if(r.role==="tool"){let n="unknown";for(let i of e)if(i.role==="assistant"&&i.toolCalls?.length){for(let a of i.toolCalls)if(a.id===r.toolCallId){n=a.function.name;break}}let o={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(o)}return t}var lP=e=>e.kind==="tool"?e.fields.toolCallId:e.fields.messageId,dP=e=>e==="tool"?"toolCallId":"messageId",Jo=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},Qu=e=>t=>{let r=va(e),n=new Map,o=u=>{let c=n.get(u);if(!c)return[];switch(n.delete(u),c.kind){case"text":{let g={type:F.TEXT_MESSAGE_END,messageId:c.fields.messageId,...(c.fields.subagentRunId!=null&&{subagentRunId:c.fields.subagentRunId})};return r?.event("TRANSFORM","TEXT_MESSAGE_END",g,{messageId:g.messageId}),[g]}case"tool":{let g={type:F.TOOL_CALL_END,toolCallId:c.fields.toolCallId,...(c.fields.subagentRunId!=null&&{subagentRunId:c.fields.subagentRunId})};return r?.event("TRANSFORM","TOOL_CALL_END",g,{toolCallId:g.toolCallId}),[g]}case"reasoning":{let g={type:F.REASONING_MESSAGE_END,messageId:c.fields.messageId,...(c.fields.subagentRunId!=null&&{subagentRunId:c.fields.subagentRunId})};return r?.event("TRANSFORM","REASONING_MESSAGE_END",g,{messageId:g.messageId}),[g]}}},i=()=>[...n.keys()].flatMap(u=>o(u)),a=(u,c)=>{for(let[g,v]of n)if(v.kind===u&&lP(v)===c)return{owner:g}},s=(u,c,g,v,R)=>{if(c!==void 0){let y=a(u,c);if(y){if(g!==void 0&&g!==y.owner)throw Error(`Cannot continue ${R} '${c}': chunk subagentRunId '${g}' does not match the open stream's subagent '${y.owner??"(the parent agent)"}'.`);return y.owner}return g}if(g!==void 0)return g;if(n.get(void 0)?.kind===u)return;let h=[...n.entries()].filter(([,y])=>y.kind===u);if(h.length===1)return h[0][0];if(h.length>1)throw Error(`Ambiguous ${v}: it carries neither a ${dP(u)} nor a subagentRunId, but ${h.length} lanes have an open ${R}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(wt(u=>{switch(u.type){case F.TEXT_MESSAGE_START:case F.TEXT_MESSAGE_CONTENT:case F.TEXT_MESSAGE_END:case F.TOOL_CALL_START:case F.TOOL_CALL_ARGS:case F.TOOL_CALL_END:case F.TOOL_CALL_RESULT:case F.STATE_SNAPSHOT:case F.STATE_DELTA:case F.CUSTOM:case F.STEP_STARTED:case F.STEP_FINISHED:case F.THINKING_START:case F.THINKING_END:case F.THINKING_TEXT_MESSAGE_START:case F.THINKING_TEXT_MESSAGE_CONTENT:case F.THINKING_TEXT_MESSAGE_END:case F.REASONING_START:case F.REASONING_MESSAGE_START:case F.REASONING_MESSAGE_CONTENT:case F.REASONING_MESSAGE_END:case F.REASONING_END:return[...o(u.subagentRunId??void 0),u];case F.RUN_STARTED:case F.RUN_FINISHED:case F.RUN_ERROR:case F.MESSAGES_SNAPSHOT:return[...i(),u];case F.RAW:case F.ACTIVITY_SNAPSHOT:case F.ACTIVITY_DELTA:case F.REASONING_ENCRYPTED_VALUE:case F.SUBAGENT_STARTED:return[u];case F.SUBAGENT_FINISHED:case F.SUBAGENT_ERROR:{let c=u.subagentRunId;return c==null?[u]:[...o(c),u]}case F.TEXT_MESSAGE_CHUNK:{let c=u,g=s("text",c.messageId,c.subagentRunId??void 0,"TEXT_MESSAGE_CHUNK","text message"),v=n.get(g),R=[],h;if(v?.kind==="text"&&(c.messageId===void 0||c.messageId===v.fields.messageId))h=v.fields;else{if(R.push(...o(g)),c.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");h={messageId:c.messageId,name:c.name,subagentRunId:c.subagentRunId},n.set(g,{kind:"text",fields:h});let y=Jo({type:F.TEXT_MESSAGE_START,messageId:c.messageId,role:c.role||"assistant",...(c.name!==void 0&&{name:c.name}),...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);R.push(y),r?.event("TRANSFORM","TEXT_MESSAGE_START",y,{messageId:c.messageId})}if(c.delta!==void 0){let y=c.subagentRunId??h.subagentRunId,b=Jo({type:F.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:c.delta,...(y!=null&&{subagentRunId:y})},c);R.push(b),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",b,{messageId:h.messageId})}if(R.length===0&&c.metadata!==void 0){let y=c.subagentRunId??h.subagentRunId;R.push({type:F.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:c.metadata,...(y!=null&&{subagentRunId:y})})}return R}case F.TOOL_CALL_CHUNK:{let c=u,g=s("tool",c.toolCallId,c.subagentRunId??void 0,"TOOL_CALL_CHUNK","tool call"),v=n.get(g),R=[],h;if(v?.kind==="tool"&&(c.toolCallId===void 0||c.toolCallId===v.fields.toolCallId))h=v.fields;else{if(R.push(...o(g)),c.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(c.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");h={toolCallId:c.toolCallId,toolCallName:c.toolCallName,parentMessageId:c.parentMessageId,subagentRunId:c.subagentRunId},n.set(g,{kind:"tool",fields:h});let y=Jo({type:F.TOOL_CALL_START,toolCallId:c.toolCallId,toolCallName:c.toolCallName,parentMessageId:c.parentMessageId,...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);R.push(y),r?.event("TRANSFORM","TOOL_CALL_START",y,{toolCallId:c.toolCallId,toolCallName:c.toolCallName})}if(c.delta!==void 0){let y=c.subagentRunId??h.subagentRunId,b=Jo({type:F.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:c.delta,...(y!=null&&{subagentRunId:y})},c);R.push(b),r?.event("TRANSFORM","TOOL_CALL_ARGS",b,{toolCallId:h.toolCallId})}if(R.length===0&&c.metadata!==void 0){let y=c.subagentRunId??h.subagentRunId;R.push({type:F.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:"",metadata:c.metadata,...(y!=null&&{subagentRunId:y})})}return R}case F.REASONING_MESSAGE_CHUNK:{let c=u,g=s("reasoning",c.messageId,c.subagentRunId??void 0,"REASONING_MESSAGE_CHUNK","reasoning message"),v=n.get(g),R=[],h;if(v?.kind==="reasoning"&&(c.messageId===void 0||c.messageId===v.fields.messageId))h=v.fields;else{if(R.push(...o(g)),c.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");h={messageId:c.messageId,subagentRunId:c.subagentRunId},n.set(g,{kind:"reasoning",fields:h});let y=Jo({type:F.REASONING_MESSAGE_START,messageId:c.messageId,role:"reasoning",...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);R.push(y),r?.event("TRANSFORM","REASONING_MESSAGE_START",y,{messageId:c.messageId})}if(c.delta!==void 0){let y=c.subagentRunId??h.subagentRunId,b=Jo({type:F.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:c.delta,...(y!=null&&{subagentRunId:y})},c);R.push(b),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",b,{messageId:h.messageId})}if(R.length===0&&c.metadata!==void 0){let y=c.subagentRunId??h.subagentRunId;R.push({type:F.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:c.metadata,...(y!=null&&{subagentRunId:y})})}return R}}return u.type,[]}),Un(()=>{i()}))};function pP(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var Sa=class{runNext(e,t){return t.run(e).pipe(Qu(!1))}runNextWithState(e,t){let r=Te(e.messages||[]),n=Te(e.state||{}),o=new Gc;return Fb(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(ou(/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(a=>setTimeout(a,0)),{event:i,messages:Te(r),state:Te(n)}});return function(_x93){return _ref45.apply(this,arguments)}}()))}},fP=class extends Sa{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function mP(e){let t=e.content;if(Array.isArray(t)){let r=t.filter(n=>typeof n=="object"&&!!n&&"type"in n&&n.type==="text"&&typeof n.text=="string").map(n=>n.text).join("");return{...e,content:r}}return typeof t=="string"?e:{...e,content:""}}var gP=class extends Sa{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(mP)};return this.runNext(o,t)}},Eb="THINKING_START",Rb="THINKING_END",Ib="THINKING_TEXT_MESSAGE_START",Tb="THINKING_TEXT_MESSAGE_CONTENT",_b="THINKING_TEXT_MESSAGE_END",hP=class extends Sa{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<"u"&&process.env!==void 0&&process.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe($r(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case Eb:{this.currentReasoningId=ya();let{title:t,...r}=e;return this.warnAboutTransformation(Eb,F.REASONING_START),{...r,type:F.REASONING_START,messageId:this.currentReasoningId}}case Ib:return this.currentMessageId=ya(),this.warnAboutTransformation(Ib,F.REASONING_MESSAGE_START),{...e,type:F.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case Tb:{let{delta:t,...r}=e;return this.warnAboutTransformation(Tb,F.REASONING_MESSAGE_CONTENT),{...r,type:F.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??ya(),delta:t}}case _b:{let t=this.currentMessageId??ya();return this.warnAboutTransformation(_b,F.REASONING_MESSAGE_END),{...e,type:F.REASONING_MESSAGE_END,messageId:t}}case Rb:{let t=this.currentReasoningId??ya();return this.warnAboutTransformation(Rb,F.REASONING_END),{...e,type:F.REASONING_END,messageId:t}}default:return e}}};function yP(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function vP(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function SP(e){let t=yP(e.mimeType);return e.data?{type:t,source:{type:"data",value:e.data,mimeType:e.mimeType},...(e.filename?{metadata:{filename:e.filename}}:{})}:e.url?{type:t,source:{type:"url",value:e.url,mimeType:e.mimeType},...(e.filename?{metadata:{filename:e.filename}}:{})}:e}function bP(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>vP(n)?SP(n):n);return{...e,content:r}}var AP=class extends Sa{run(e,t){let r={...e,messages:e.messages.map(bP)};return this.runNext(r,t)}},kb="SUBAGENT_STARTED",Ob="SUBAGENT_FINISHED",Pb="SUBAGENT_ERROR";function Hu(e){if(e&&typeof e=="object"&&"subagentRunId"in e){let{subagentRunId:t,...r}=e;return r}return e}function Nb(e){return e.map(t=>Hu(t))}var wP=class extends Sa{warnDroppedLifecycleEvent(e){typeof process<"u"&&process.env!==void 0&&process.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let r={...e,messages:(e.messages??[]).map(n=>Hu(n))};return this.runNext(r,t).pipe(au(n=>{let o=n.type;(o===kb||o===Ob||o===Pb)&&this.warnDroppedLifecycleEvent(o)}),sf(n=>{let o=n.type;return o!==kb&&o!==Ob&&o!==Pb}),$r(n=>{let o=Hu(n);if(o.type===F.MESSAGES_SNAPSHOT){let i=o;if(Array.isArray(i.messages))return{...i,messages:Nb(i.messages)}}if(o.type===F.RUN_FINISHED){let i=o;if(i.outcome&&Array.isArray(i.outcome.interrupts))return{...i,outcome:{...i.outcome,interrupts:i.outcome.interrupts.map(a=>Hu(a))}}}if(o.type===F.RUN_STARTED){let i=o;if(i.input&&Array.isArray(i.input.messages))return{...i,input:{...i.input,messages:Nb(i.input.messages)}}}return o}))}},xP="0.0.59",CP=class{get maxVersion(){return xP}get debug(){return this._debug}set debug(e){this._debug=$u(e),this._debugLogger=Ef(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?Ef($u(!0)):void 0:this._debugLogger=e}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:i}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??jr(),this.messages=Te(n??[]),this.state=Te(o??{}),this._debug=$u(i),this._debugLogger=Ef(this._debug),Zo(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new gP),Zo(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new hP),Zo(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new AP),Zo(this.maxVersion,"0.0.57")<=0&&this.middlewares.unshift(new wP)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(r=>typeof r=="function"?new fP(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this14=this;return _asyncToGenerator(function*(){try{_this14.isRunning=!0,_this14.agentId=_this14.agentId??jr();let r=_this14.prepareRunAgentInput(e);_this14.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this14.agentId,threadId:_this14.threadId});let n,o=new Set(_this14.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{u.outcome==="success"&&(n=u.result)}},..._this14.subscribers,t??{}];yield _this14.onInitialize(r,i),_this14.activeRunDetach$=new nr;let a;_this14.activeRunCompletionPromise=new Promise(u=>{a=u}),yield ru(Vc(()=>_this14.middlewares.length===0?_this14.run(r):_this14.middlewares.reduceRight((u,c)=>({run:g=>c.run(g,u),get messages(){return u.messages},get state(){return u.state}}),_this14).run(r),Qu(_this14.debugLogger),Rf(_this14.debugLogger),u=>u.pipe(iu(_this14.activeRunDetach$)),u=>_this14.apply(r,u,i),u=>_this14.processApplyEvents(r,u,i),ma(u=>(_this14.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this14.agentId,error:u instanceof Error?u.message:String(u)}),_this14.isRunning=!1,_this14.onError(r,u,i))),Un(()=>{_this14.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this14.agentId,threadId:_this14.threadId}),_this14.isRunning=!1,_this14.onFinalize(r,i),a?.(),a=void 0,_this14.activeRunCompletionPromise=void 0,_this14.activeRunDetach$=void 0}))(Oe(null)));let s=Te(_this14.messages).filter(u=>!o.has(u.id));return{result:n,newMessages:s}}finally{_this14.isRunning=!1}})()}connect(e){throw new Hp}connectAgent(e,t){var _this15=this;return _asyncToGenerator(function*(){try{_this15.isRunning=!0,_this15.agentId=_this15.agentId??jr();let r=_this15.prepareRunAgentInput(e),n,o=new Set(_this15.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{u.outcome==="success"&&(n=u.result)}},..._this15.subscribers,t??{}];yield _this15.onInitialize(r,i),_this15.activeRunDetach$=new nr;let a;_this15.activeRunCompletionPromise=new Promise(u=>{a=u}),yield ru(Vc(()=>nu(()=>_this15.connect(r)),Qu(_this15.debugLogger),Rf(_this15.debugLogger),u=>u.pipe(iu(_this15.activeRunDetach$)),u=>_this15.apply(r,u,i),u=>_this15.processApplyEvents(r,u,i),ma(u=>(_this15.isRunning=!1,u instanceof Hp?Bc:_this15.onError(r,u,i))),Un(()=>{_this15.isRunning=!1,_this15.onFinalize(r,i),a?.(),a=void 0,_this15.activeRunCompletionPromise=void 0,_this15.activeRunDetach$=void 0}))(Oe(null)),{defaultValue:void 0});let s=Te(_this15.messages).filter(u=>!o.has(u.id));return{result:n,newMessages:s}}finally{_this15.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this16=this;return _asyncToGenerator(function*(){if(!_this16.activeRunDetach$)return;let e=_this16.activeRunCompletionPromise??Promise.resolve();_this16.activeRunDetach$.next(),_this16.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return Fb(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(au(n=>{n.messages&&(this.messages=n.messages,r.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,r.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Te(this.messages);for(let n of t)n.subagentRunId===null&&delete n.subagentRunId;let r=t.filter(n=>n.role!=="activity");return{threadId:this.threadId,runId:e?.runId||jr(),tools:Te(e?.tools??[]),context:Te(e?.context??[]),forwardedProps:Te(e?.forwardedProps??{}),state:Te(this.state),messages:r,...(e?.resume===void 0?{}:{resume:Te(e.resume)})}}onInitialize(e,t){var _this17=this;return _asyncToGenerator(function*(){if(_this17.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(i=>i.interruptId)),o=_this17.pendingInterrupts.map(i=>i.id).filter(i=>!n.has(i));if(o.length>0)throw new ge(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let i of _this17.pendingInterrupts)if(pP(i))throw new ge(`Interrupt ${i.id} expired at ${i.expiresAt}`)}let r=yield Pe(t,_this17.messages,_this17.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this17,input:e}));if(r.messages!==void 0||r.state!==void 0){if(r.messages){_this17.messages=r.messages;for(let n of r.messages)n.subagentRunId===null&&delete n.subagentRunId;e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17,input:e})})}r.state&&(_this17.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this17.state,messages:_this17.messages,agent:_this17,input:e})}))}})()}onError(e,t,r){return jn(Pe(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe($r(n=>{let o=n;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,r.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,r.forEach(i=>{i.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),o.stopPropagation!==!0){let i=String(t);if(!(t.name==="AbortError"||t.message==="Fetch is aborted"||t.message==="signal is aborted without reason"||t.message==="component unmounted"||i==="component unmounted"))throw console.error("Agent execution failed:",t),t}return{}}))}onFinalize(e,t){var _this18=this;return _asyncToGenerator(function*(){let r=yield Pe(t,_this18.messages,_this18.state,(n,o,i)=>n.onRunFinalized?.({messages:o,state:i,agent:_this18,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this18.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this18.messages,state:_this18.state,agent:_this18,input:e})})),r.state!==void 0&&(_this18.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this18.state,messages:_this18.messages,agent:_this18,input:e})})))})()}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=Te(this.messages),e.state=Te(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Te(this.pendingInterrupts),e}addMessage(e){var _this19=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this19.subscribers)yield t.onNewMessage?.({message:e,messages:_this19.messages,state:_this19.state,agent:_this19});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this19.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this19.messages,state:_this19.state,agent:_this19});for(let t of _this19.subscribers)yield t.onMessagesChanged?.({messages:_this19.messages,state:_this19.state,agent:_this19})})()}addMessages(e){var _this20=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this20.subscribers)yield r.onNewMessage?.({message:t,messages:_this20.messages,state:_this20.state,agent:_this20});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this20.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this20.messages,state:_this20.state,agent:_this20})}for(let t of _this20.subscribers)yield t.onMessagesChanged?.({messages:_this20.messages,state:_this20.state,agent:_this20})})()}setMessages(e){var _this21=this;this.messages=Te(e),_asyncToGenerator(function*(){for(let t of _this21.subscribers)yield t.onMessagesChanged?.({messages:_this21.messages,state:_this21.state,agent:_this21})})()}setState(e){var _this22=this;this.state=Te(e),_asyncToGenerator(function*(){for(let t of _this22.subscribers)yield t.onStateChanged?.({messages:_this22.messages,state:_this22.state,agent:_this22})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??jr();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:o=>n.run(o,r),get messages(){return r.messages},get state(){return r.state}}),this).run(t)).pipe(Qu(this.debugLogger),Rf(this.debugLogger),cP(this.threadId,t.runId,this.agentId),r=>r.pipe($r(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}};function EP(e){if(!Array.isArray(e.messages))return e;let t=!1,r=e.messages.map(n=>{if(n.subagentRunId===null){t=!0;let o={...n};return delete o.subagentRunId,o}return n});return t?{...e,messages:r}:e}var Db=class extends CP{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(EP(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new l.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new l.AbortController,this.url=e.url,this.headers=Te(e.headers??{}),this.fetch=e.fetch??((t,r)=>C(t,r))}run(e){return KO(HO(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Te(this.headers??{}),e.fetch=this.fetch;let t=new l.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};m();d();f();p();var Mb=(e,t,r)=>{let n=kt(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let i=`/api/v1/organizations/${t}/agents`;return`${n}${i}/${o}`};var _f=class extends Db{requestInit(t){let{params:r,accessToken:n,recordDebugSession:o}=t.forwardedProps||{},i={...r,...(o&&{recordDebugSession:!0})};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream, application/json"},body:JSON.stringify(i),signal:this.abortController.signal}}},Lb=(e,t,r)=>new _f({url:`${Mb(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var RP=new H({required:!0}),qb=new H({required:!0,constrainTo:lc}),jb=e=>({...e,name:dc(e.name)}),Ub=L("followUpAnswers/setIsEnabled",e=>V(e,new fe({required:!0}))),Vb=L("followUpAnswers/setFollowUpAnswersConversationId",e=>V(e,Y)),Gb=L("followUpAnswers/setFollowUpAnswersConversationToken",e=>V(e,Y)),Bb=L("followUpAnswers/clearFollowUpAnswersConversationToken"),fne=L("followUpAnswers/createFollowUpAnswer",e=>V(e,{question:Y})),mne=L("followUpAnswers/setActiveFollowUpAnswerId",e=>V(e,Y)),gne=L("followUpAnswers/setFollowUpAnswerContentFormat",e=>V(e,{contentFormat:fc,answerId:Y})),hne=L("followUpAnswers/setFollowUpIsLoading",e=>V(e,{isLoading:new fe({required:!0}),answerId:Y})),yne=L("followUpAnswers/setFollowUpIsStreaming",e=>V(e,{isStreaming:new fe({required:!0}),answerId:Y})),vne=L("followUpAnswers/followUpMessageChunkReceived",e=>V(e,{textDelta:RP,answerId:Y})),Sne=L("followUpAnswers/followUpCitationsReceived",e=>V(e,{citations:new Ae({required:!0,each:new re({values:Pp})}),answerId:Y})),bne=L("followUpAnswers/followUpCompleted",e=>V(e,{answerId:Y,cannotAnswer:new fe({required:!1})})),Ane=L("followUpAnswers/followUpFailed",e=>V(e,{message:new H,code:new ne({min:0}),answerId:Y})),wne=L("followUpAnswers/activeFollowUpStartFailed",e=>V(e,{message:new H})),xne=L("followUpAnswers/likeFollowUp",e=>V(e,{answerId:Y})),Cne=L("followUpAnswers/dislikeFollowUp",e=>V(e,{answerId:Y})),Ene=L("followUpAnswers/submitFollowUpFeedback",e=>V(e,{answerId:Y})),$b=L("followUpAnswers/resetFollowUpAnswers"),Rne=L("followUpAnswers/stepStarted",e=>V(jb(e),{answerId:Y,name:qb,startedAt:new ne({min:0,required:!0})})),Ine=L("followUpAnswers/stepFinished",e=>V(jb(e),{answerId:Y,name:qb,finishedAt:new ne({min:0,required:!0})})),Tne=L("followUpAnswers/startToolCall",e=>V(e,{answerId:Y,toolCallName:Y,startedAt:new ne({min:0,required:!0}),toolCallId:Y})),_ne=L("followUpAnswers/finishToolCall",e=>V(e,{answerId:Y,finishedAt:new ne({min:0,required:!0}),toolCallId:Y})),kne=L("followUpAnswers/toolCallArgs",e=>V(e,{answerId:Y,toolCallId:Y,args:new re({options:{required:!0}}),type:new H({required:!0,constrainTo:pc})}));m();d();f();p();var IP={"KNOWLEDGE:SSE_MAX_DURATION_EXCEEDED":1e3,"KNOWLEDGE:SSE_FOLLOW_UP_NOT_SUPPORTED":1001,"KNOWLEDGE:NOT_FOUND":1002,"KNOWLEDGE:SSE_MODELS_NOT_AVAILABLE":1003,"KNOWLEDGE:SSE_INTERNAL_ERROR":1004,"KNOWLEDGE:SSE_TURN_LIMIT_REACHED":1005};function Qb(e){return e?IP[e]??1004:1004}var Hb=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(mc(n.runId)),e(qr(!1)),e(Ji(!0)),e(Vb(n.threadId)),e(Bb())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(sv({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(cv({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onToolCallStartEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:i,toolCallId:a,timestamp:s}=n;e(uv({toolCallId:a,toolCallName:i,startedAt:s??Date.now()}))},onToolCallEndEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,timestamp:a}=n;e(lv({toolCallId:i,finishedAt:a??Date.now()}))},onToolCallArgsEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,delta:a}=n;try{let s=JSON.parse(a);typeof s?.q=="string"?e(hc({toolCallId:i,args:s,type:"search"})):e(hc({toolCallId:i,args:{raw:a},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${a}`),e(hc({toolCallId:i,args:{raw:a},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(ea({textDelta:n.delta})))},onCustomEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{name:i,value:a}=n;switch(i){case"header":{a?.contentFormat&&e(na(a.contentFormat)),typeof a?.followUpEnabled=="boolean"&&e(Ub(a.followUpEnabled)),a?.conversationToken&&e(Gb(a.conversationToken));return}case"citations":{e(ta({citations:a.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=Qb(n.code);e(ra({message:n.message,code:i}))},onRunFinishedEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=n.result?.completionReason==="ANSWERED",a=i?!r:void 0;e(Np(i)),e(oa(!i)),e(Ji(!1)),e(fp(i,t,a)),e(_o())}}};var zb=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _ref50=_asyncToGenerator(function*(n,o,i){t();let a=Bs(n),s=hh(n),u=yh(n),c=gh(n),g=vh(n),v=Lb(a,s,u);e=v;let R=Hb(o),h=ev(n,i());try{o(qr(!0)),yield v.runAgent({forwardedProps:{params:h,accessToken:c,recordDebugSession:g}},R)}catch(y){o(qr(!1)),o(ra({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});return function run(_x94,_x95,_x96){return _ref50.apply(this,arguments)}}(),abortRun:t}};m();d();f();p();m();d();f();p();var zu=L("breadcrumb/deselectAll"),Wb=L("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var Kb=L("facet/updateFacetAutoSelection",e=>V(e,{allow:new fe({required:!0})}));m();d();f();p();m();d();f();p();var Wu=class extends Or{constructor(r){super(r);ue(this,"getState",r)}get activeInstantResultQuery(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].q;return null}get activeInstantResultCache(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].cache[o];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??Et().q}get responseTime(){return this.activeInstantResultCache?.duration??Ht().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??Ht().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var Yb=()=>De("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Wu(e)),Xb=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var kf={id:Y},TP={...kf,q:nt},Uoe=L("instantResults/register",e=>V(e,kf)),Ku=L("instantResults/updateQuery",e=>V(e,TP)),Voe=L("instantResults/clearExpired",e=>V(e,kf));m();d();f();p();var Yu=new ne({required:!0,min:0}),Xu=L("pagination/registerNumberOfResults",e=>V(e,Yu)),Zu=L("pagination/updateNumberOfResults",e=>V(e,Yu)),Ju=L("pagination/registerPage",e=>V(e,Yu)),ei=L("pagination/updatePage",e=>V(e,Yu)),el=L("pagination/nextPage"),tl=L("pagination/previousPage");m();d();f();p();var ti=L("query/updateQuery",e=>V(e,{q:new H,enableQuerySyntax:new fe}));m();d();f();p();m();d();f();p();m();d();f();p();var Hr=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var Of=()=>De("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),zr=e=>De("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||Et().q,aq:r.advancedSearchQueries?.aq||Hr().aq,cq:r.advancedSearchQueries?.cq||Hr().cq,dq:r.advancedSearchQueries?.dq||Hr().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();var Eie=L("didYouMean/enable"),Rie=L("didYouMean/disable"),Iie=L("didYouMean/automaticCorrections/disable"),Tie=L("didYouMean/automaticCorrections/enable"),rl=L("didYouMean/correction",e=>V(e,Y)),_ie=L("didYouMean/automaticCorrections/mode",e=>V(e,new H({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var Pf=()=>De("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var Zb=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function nl(){return{contextValues:{}}}m();d();f();p();function ol(){return{contextValues:{}}}m();d();f();p();function Jb(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function eA(){return[]}m();d();f();p();function ba(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function tA(){return{}}m();d();f();p();function rA(){return{}}m();d();f();p();function nA(){return{}}function or(e){return{context:e.context||nl(),dictionaryFieldContext:e.dictionaryFieldContext||ol(),facetSet:e.facetSet||Gs(),numericFacetSet:e.numericFacetSet||Vs(),dateFacetSet:e.dateFacetSet||Us(),categoryFacetSet:e.categoryFacetSet||js(),automaticFacetSet:e.automaticFacetSet??qs(),pagination:e.pagination||ba(),query:e.query||Et(),tabSet:e.tabSet||nA(),advancedSearchQueries:e.advancedSearchQueries||Hr(),staticFilterSet:e.staticFilterSet||rA(),querySet:e.querySet||tA(),sortCriteria:e.sortCriteria||$s(),pipeline:e.pipeline||Tr(),searchHub:e.searchHub||Ao(),facetOptions:e.facetOptions||Jb(),facetOrder:e.facetOrder??eA(),debug:e.debug??ys()}}m();d();f();p();var tse=new re({values:{undoneQuery:nt},options:{required:!0}}),oA=()=>De("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var il=L("trigger/query/ignore",e=>V(e,new H({emptyAllowed:!0,required:!0}))),al=L("trigger/query/modification",e=>V(e,new re({values:{originalQuery:rt,modification:rt}})));m();d();f();p();var Wr=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=OP(e),n=cc(e),o=_P(e),i=yield Mr(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Fr({...i,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(r&&{cq:r}),...(n.length&&{facets:n}),...(e.pagination&&{numberOfResults:a(),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:o}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Wr(_x97,_x98){return _ref51.apply(this,arguments)}}();function _P(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(kP).filter(r=>r.currentValues.length>0):void 0}function kP(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function OP(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=PP(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function PP(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o})}var Kr=class{constructor(t,r=n=>{this.dispatch(ti({q:n}))}){ue(this,"config",t);ue(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x99,_x100){var _this23=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=sc(yield _this23.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this23.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.processQueryErrorOrContinue(t)??(yield _this24.processQueryCorrectionsOrContinue(t))??(yield _this24.processQueryTriggersOrContinue(t))??_this24.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return vt(t.response)?(this.dispatch(zr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this25=this;return _asyncToGenerator(function*(){let r=_this25.getState(),n=_this25.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:u}=n;if(!o||!i)return null;let c=a.length===0&&s&&s.length!==0,g=!ce(u)&&!ce(u.correctedQuery);if(!c&&!g)return null;let R=c?yield _this25.processLegacyDidYouMeanAutoCorrection(t):_this25.processModernDidYouMeanAutoCorrection(t);return _this25.dispatch(Yt(or(_this25.getState()))),R})()}processLegacyDidYouMeanAutoCorrection(t){var _this26=this;return _asyncToGenerator(function*(){let r=_this26.getCurrentQuery(),n=_this26.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this26.automaticallyRetryQueryWithCorrection(o);return vt(i.response)?(_this26.dispatch(zr(i.response.error)),_this26.rejectWithValue(i.response.error)):(_this26.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this26.dispatch(Yt(or(_this26.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Pf()})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o,analyticsAction:Pf()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let r=this.getState(),n=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,r,n),this.extra)}processQueryTriggersOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this27.getState().triggers?.queryModification.queryToIgnore===n)return _this27.dispatch(il("")),null;_this27.analyticsAction&&(yield _this27.dispatch(_this27.analyticsAction));let i=_this27.getCurrentQuery(),a=yield _this27.automaticallyRetryQueryWithTriggerModification(n);return vt(a.response)?(_this27.dispatch(zr(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(Yt(or(_this27.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:oA()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??Et().enableQuerySyntax},search:{...Ht(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Yt(or(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return ja(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this28=this;return _asyncToGenerator(function*(){_this28.onUpdateQueryForCorrection(t);let r=yield _this28.fetchFromAPI(yield Wr(_this28.getState()),{origin:"mainSearch"});return _this28.dispatch(rl(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this29=this;return _asyncToGenerator(function*(){return _this29.dispatch(al({newQuery:t,originalQuery:_this29.getCurrentQuery()})),_this29.onUpdateQueryForCorrection(t),yield _this29.fetchFromAPI(yield Wr(_this29.getState()),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get analyticsAction(){return this.config.analyticsAction}get rejectWithValue(){return this.config.rejectWithValue}};var tce=ke("search/executeSearch",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield sl(r,t,e)});return function(_x101,_x102){return _ref52.apply(this,arguments)}}()),rce=ke("search/fetchPage",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ff(r,t,e)});return function(_x103,_x104){return _ref53.apply(this,arguments)}}()),nce=ke("search/fetchMoreResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Df(t,r)});return function(_x105,_x106){return _ref54.apply(this,arguments)}}()),oce=ke("search/fetchFacetValues",/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t){let r=t.getState();return yield MP(t,e,r)});return function(_x107,_x108){return _ref55.apply(this,arguments)}}()),ice=ke("search/fetchInstantResults",/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){return Nf(e,t)});return function(_x109,_x110){return _ref56.apply(this,arguments)}}()),NP=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=yield Wr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function NP(_x111,_x112){return _ref57.apply(this,arguments)}}(),FP=/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t,r){let n=yield Mr(e);return Fr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function FP(_x113,_x114,_x115){return _ref58.apply(this,arguments)}}(),DP=/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=yield Wr(e,t);return r.request.numberOfResults=0,r});return function DP(_x116,_x117){return _ref59.apply(this,arguments)}}(),iA=e=>{e.configuration.analytics.enabled&&ht.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Nf(_x118,_x119){return _Nf.apply(this,arguments)}function _Nf(){_Nf=_asyncToGenerator(function*(e,t){V(e,{id:Y,q:Y,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new Kr({...t,analyticsAction:Yb()},c=>{t.dispatch(Ku({q:c,id:e.id}))}),a=yield FP(o,r,n),s=yield i.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),u=yield i.process(s);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,analyticsAction:u.analyticsAction,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return _Nf.apply(this,arguments)}function Ff(_x120,_x121,_x122){return _Ff.apply(this,arguments)}function _Ff(){_Ff=_asyncToGenerator(function*(e,t,r){iA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Kr({...t,analyticsAction:r}),u=yield Wr(e,a),c=yield s.fetchFromAPI(u,{origin:"mainSearch"});return yield s.process(c)});return _Ff.apply(this,arguments)}function Df(_x123,_x124){return _Df.apply(this,arguments)}function _Df(){_Df=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield Of().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new Kr({...e,analyticsAction:Of()}),s=yield NP(t,i),u=yield a.fetchFromAPI(s,{origin:"mainSearch"});return yield a.process(u)});return _Df.apply(this,arguments)}function MP(_x125,_x126,_x127){return _MP.apply(this,arguments)}function _MP(){_MP=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=e.extra,{description:a}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Kr({...e,analyticsAction:t}),u=yield DP(r,a),c=yield s.fetchFromAPI(u,{origin:"facetValues"});return yield s.process(c)});return _MP.apply(this,arguments)}function sl(_x128,_x129,_x130){return _sl.apply(this,arguments)}function _sl(){_sl=_asyncToGenerator(function*(e,t,r){iA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=yield Wr(e,a),u=new Kr({...t,analyticsAction:r}),c=yield u.fetchFromAPI(s,{origin:"mainSearch"});return yield u.process(c)});return _sl.apply(this,arguments)}m();d();f();p();var Yr=class{constructor(t,r=n=>{this.dispatch(ti({q:n}))}){ue(this,"config",t);ue(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x131,_x132){var _this30=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=sc(yield _this30.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this30.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.processQueryErrorOrContinue(t)??(yield _this31.processQueryCorrectionsOrContinue(t))??(yield _this31.processQueryTriggersOrContinue(t))??_this31.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return vt(t.response)?(this.dispatch(zr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this32=this;return _asyncToGenerator(function*(){let r=_this32.getState(),n=_this32.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:u}=n;if(!o)return null;if(!i)return!ce(u)&&!ce(u.correctedQuery)?_this32.processModernDidYouMeanAutoCorrection(t):null;let c=a.length===0&&s&&s.length!==0,g=!ce(u)&&!ce(u.correctedQuery);if(!c&&!g)return null;let R=c?yield _this32.processLegacyDidYouMeanAutoCorrection(t):_this32.processModernDidYouMeanAutoCorrection(t);return _this32.dispatch(Yt(or(_this32.getState()))),R})()}processLegacyDidYouMeanAutoCorrection(t){var _this33=this;return _asyncToGenerator(function*(){let r=_this33.getCurrentQuery(),n=_this33.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this33.automaticallyRetryQueryWithCorrection(o);return vt(i.response)?(_this33.dispatch(zr(i.response.error)),_this33.rejectWithValue(i.response.error)):(_this33.dispatch(Yt(or(_this33.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o}}processQueryTriggersOrContinue(t){var _this34=this;return _asyncToGenerator(function*(){let r=_this34.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this34.getState().triggers?.queryModification.queryToIgnore===n)return _this34.dispatch(il("")),null;let i=_this34.getCurrentQuery(),a=yield _this34.automaticallyRetryQueryWithTriggerModification(n);return vt(a.response)?(_this34.dispatch(zr(a.response.error)),_this34.rejectWithValue(a.response.error)):(_this34.dispatch(Yt(or(_this34.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Yt(or(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return ja(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this35=this;return _asyncToGenerator(function*(){_this35.onUpdateQueryForCorrection(t);let r=_this35.getState(),{actionCause:n}=Zb(),o=yield _this35.fetchFromAPI(yield Lr(r,_this35.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this35.dispatch(rl(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this36=this;return _asyncToGenerator(function*(){return _this36.dispatch(al({newQuery:t,originalQuery:_this36.getCurrentQuery()})),_this36.onUpdateQueryForCorrection(t),yield _this36.fetchFromAPI(yield Lr(_this36.getState(),_this36.extra.navigatorContext),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}};var Qce=ke("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;V(e,{q:new H,enableQuerySyntax:new fe,clearFilters:new fe}),e.clearFilters&&(r(zu()),r(Wb())),r(Kb({allow:!0})),r(ti({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(ei(1))}),Hce=L("search/updateSearchAction"),cl=ke("search/executeSearch",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return sl(r,t,e.legacy);sA(r);let n=e.next?cA(e.next):void 0,o=yield Lr(r,t.extra.navigatorContext,n),i=new Yr({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x133,_x134){return _ref60.apply(this,arguments)}}()),aA=ke("search/fetchPage",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(sA(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Ff(r,t,e.legacy);let n=new Yr({...t,analyticsAction:e.next}),o=yield Lr(r,t.extra.navigatorContext,e.next),i=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(i)});return function(_x135,_x136){return _ref61.apply(this,arguments)}}()),zce=ke("search/fetchMoreResults",/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Df(t,r);let n=qh("browseResults",t.getState),o=new Yr({...t,analyticsAction:n}),i=yield LP(r,t.extra.navigatorContext,n),a=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(a)});return function(_x137,_x138){return _ref62.apply(this,arguments)}}()),Wce=ke("search/fetchFacetValues",/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return sl(r,t,e.legacy);let n=new Yr({...t,analyticsAction:{}}),o=yield jP(r,t.extra.navigatorContext),i=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(i)});return function(_x139,_x140){return _ref63.apply(this,arguments)}}()),Kce=ke("search/fetchInstantResults",/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Nf(e,t);V(e,{id:Y,q:Y,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:n,maxResultsPerQuery:o}=e,i=cA(Xb()),a=yield qP(r,t.extra.navigatorContext,n,o,i),s=new Yr({...t,analyticsAction:i},g=>{t.dispatch(Ku({q:g,id:e.id}))}),u=yield s.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),c=yield s.process(u);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return function(_x141,_x142){return _ref64.apply(this,arguments)}}()),LP=/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t,r){let n=yield Lr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function LP(_x143,_x144,_x145){return _ref65.apply(this,arguments)}}(),qP=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(e,t,r,n,o){let i=Oo(e,t,o);return Fr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function qP(_x146,_x147,_x148,_x149,_x150){return _ref66.apply(this,arguments)}}(),jP=/*#__PURE__*/function(){var _ref67=_asyncToGenerator(function*(e,t,r){let n=yield Lr(e,t,r);return n.request.numberOfResults=0,n});return function jP(_x151,_x152,_x153){return _ref67.apply(this,arguments)}}(),sA=e=>{e.configuration.analytics.enabled&&ht.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},cA=e=>({actionCause:e.actionCause,type:e.actionCause});var uA=e=>{let t=Tg({extra:e}),r=zb();return t.startListening({actionCreator:cl.pending,effect:function(){var _ref68=_asyncToGenerator(function*(n,o){let i=o.getState();if(!Vd(i)||(r.abortRun(),o.dispatch(gc()),o.dispatch($b()),i.generatedAnswer.isEnabled===!1))return;let a=yn(i)?.q;!a||a.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});return function effect(_x154,_x155){return _ref68.apply(this,arguments)}}()}),t};m();d();f();p();var lA=e=>()=>t=>r=>{let n=r;if(!n.error)return t(r);let o=n.error;if(n.payload?.ignored||e.error({error:o,action:r},`Action dispatch error ${n.type}`),n.error.name!=="SchemaValidationError")return t(r)},dA=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var Mf=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:i}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:i}};m();d();f();p();function pA(e,t){let r={...e},n,o=i=>(a,s)=>{let u=i(a,s);return n?n(u,s):u};return{get combinedReducer(){let i=vm(Object.entries(t).filter(([a])=>!(a in r)).map(([a,s])=>[a,()=>s]));return o(rn({...i,...r}))},containsAll(i){return Object.keys(i).every(s=>s in r)},add(i){Object.keys(i).filter(a=>!(a in r)).forEach(a=>{r[a]=i[a]})},addCrossReducer(i){n=i}}}m();d();f();p();m();d();f();p();function UP(e){if(!e||!VP(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),o=decodeURIComponent(n.split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(o)}catch{return null}}function fA(e,t=60){if(!e)return!1;let r=UP(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function VP(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function gA(e,t){let r=0,n=null,o=Pa(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(v,R=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(b){if(!R)throw b;return null}})().finally(()=>{n=null}));let y=yield n;return h&&y&&v.dispatch(Rr({accessToken:y})),y});return function i(_x156){return _ref69.apply(this,arguments)}}(),a=v=>{let R=$P(v.getState());return!!R&&fA(R)},s=/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(v){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(v))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(R){e.warn(R,"Access token renewal failed. A retry will occur if necessary.")}});return function s(_x157){return _ref71.apply(this,arguments)}}(),u=/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(v,R,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),mA(v,R.error),R;!n&&(r++,o());try{yield i(v,!0)}catch(b){e.debug(b,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}v.dispatch(h)});return function u(_x158,_x159,_x160){return _ref72.apply(this,arguments)}}(),c=(v,R,h)=>BP(h)?t?u(v,h,R):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),mA(v,h.error),h):h,g=(v,R,h)=>GP(h)?Promise.resolve(h).then(y=>c(v,R,y)):c(v,R,h);return v=>R=>h=>{if(!(typeof h=="function"))return R(h);let b=()=>g(v,h,R(h));return typeof t=="function"&&a(v)?s(v).then(b):b()}}function GP(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function BP(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Zn().name}function mA(e,t){e.dispatch(Ss({status:401,statusCode:401,message:t.message,type:t.name}))}function $P(e){return e.configuration.accessToken}m();d();f();p();function hA({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return mg({reducer:e,preloadedState:t,devTools:{stateSanitizer:i=>i.history?{...i,history:"<<OMIT>>"}:i,name:o,shouldHotReload:!1},middleware:i=>i({thunk:{extraArgument:n}}).prepend(...r).concat(dA(n.logger))})}function QP(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,disableBrowserPrivacySignals:o,...i}=r??{},a={...i,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})},s=a.analyticsMode!=="next",u=a.analyticsMode==="legacy"&&o===!0;return s&&Ml()&&!u?(t.info("Analytics disabled since doNotTrack is active."),{...a,enabled:!1}):(s&&Ml()&&u&&a.enabled!==!1&&t.warn("Browser privacy signals (Do Not Track and Global Privacy Control) are present but are being ignored because analytics.disableBrowserPrivacySignals is set to true. Legacy analytics events will be sent, and your integration is responsible for privacy compliance."),a)}function yA(e,t){let r={...e.reducers,configuration:Vt,version:bv},n=HP({...e,reducers:r},t,Vt),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(Rr({accessToken:o,environment:i,organizationId:a}));let s=QP(e.configuration,n.logger);return s&&n.dispatch(co(s)),n}function HP(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=pA({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,s={...t,get relay(){return Gi(c.state,o)},get navigatorContext(){return Mf(this.relay,o)}},u=zP(e,s,i),c={addReducers(g){i.containsAll(g)||(i.add(g),u.replaceReducer(i.combinedReducer))},dispatch:u.dispatch,subscribe:u.subscribe,enableAnalytics(){u.dispatch(lo())},disableAnalytics(){u.dispatch(uo())},get state(){return u.getState()},get relay(){return Gi(this.state,o)},get navigatorContext(){return Mf(this.relay,o)},logger:a,store:u};return c}function zP(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=WP(e,t.logger,()=>t.navigatorContext);return hA({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function WP(e,t,r){let{renewAccessToken:n}=e.configuration,o=gA(t,n),i=uA({getNavigatorContext:r});return[Ov,o,lA(t),wv].concat(Dp.middleware,i.middleware,e.middlewares||[])}m();d();f();p();var IA=jt(RA(),1);function TA(e){return(0,IA.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function _A(e,t){let r=pN(e),n=Ot,o=fN(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function pN(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function fN(e){return e.preprocessRequest||Da}m();d();f();p();m();d();f();p();var kA={organizationId:Y,accessToken:Y,name:new H({required:!1,emptyAllowed:!1}),analytics:new re({options:{required:!1},values:{enabled:new fe({required:!1}),originContext:new H({required:!1}),originLevel2:new H({required:!1}),originLevel3:new H({required:!1}),analyticsMode:new H({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new H({required:!1,url:!0}),trackingId:new H({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new fe({required:!1})}}),environment:new H({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function OA(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var PA=new yt({...kA,pipeline:new H({required:!1,emptyAllowed:!0}),searchHub:rt,locale:rt,timezone:rt});function Gf(){return{...OA(),searchHub:"default"}}var mN={debug:vs,pipeline:fo,searchHub:Ro,recommendation:Co};function NA(e){let t=TA(e.loggerOptions);gN(e.configuration,t);let r=hN(e.configuration,t),n={..._A(e.configuration,t),apiClient:r},o={...e,reducers:mN},i=yA(o,n),{pipeline:a,searchHub:s,timezone:u,locale:c,proxyBaseUrl:g}=e.configuration;return i.dispatch(Kt({timezone:u,locale:c,proxyBaseUrl:g})),ce(a)||i.dispatch(po(a)),ce(s)||i.dispatch(Eo(s)),{...i,get state(){return i.state}}}function gN(e,t){try{PA.validate(e)}catch(r){throw t.error(r,"Recommendation engine configuration error"),r}}function hN(e,t){return new qa({logger:t,preprocessRequest:e.preprocessRequest||Da,postprocessSearchResponseMiddleware:e.preprocessSearchResponseMiddleware||Dm,postprocessFacetSearchResponseMiddleware:Mm,postprocessQuerySuggestResponseMiddleware:Lm})}m();d();f();p();m();d();f();p();m();d();f();p();var yN=new Ae({each:Y,required:!0}),FA=(e,t)=>(V(e,Y),ka(t)?V(t,Y):V(t,yN),{payload:{contextKey:e,contextValue:t}}),$n=L("context/set",e=>{for(let[t,r]of Object.entries(e))FA(t,r);return{payload:e}}),Qn=L("context/add",e=>FA(e.contextKey,e.contextValue)),Hn=L("context/remove",e=>V(e,Y));m();d();f();p();var dl=Be(nl(),e=>{e.addCase($n,(t,r)=>{t.contextValues=r.payload}).addCase(Qn,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Hn,(t,r)=>{delete t.contextValues[r.payload]}).addCase(St.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});m();d();f();p();function Zr(e){let t,r=new Map,n=()=>r.size===0,o,i=a=>{try{let s=JSON.stringify(a),u=t!==s;return t=s,u}catch(s){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",s),!0}};return{subscribe(a){a();let s=Symbol();return n()&&(t=JSON.stringify(this.state),o=e.subscribe(()=>{i(this.state)&&r.forEach(u=>u())})),r.set(s,a),()=>{r.delete(s),n()&&(o?.(),o=void 0)}},get state(){return{}}}}m();d();f();p();var vN=["caseId","caseNumber"],SN={caseId:"caseContext",caseNumber:"caseContext"},wa=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${SN[t]} to set this value.}`)}};function Bf(e){return vN.includes(e)}var bN=new yt({values:new re({options:{required:!1}})});function DA(e,t={}){if(!xN(e))throw Qt;let r=Zr(e),{dispatch:n}=e,o=()=>e.state,i=Og(e,bN,t.initialState,"buildContext");return i.values&&n($n(i.values)),{...r,get state(){return{values:o().context.contextValues}},set(a){n($n(a))},...(o().configuration.analytics.analyticsMode==="legacy"?AN(n):wN(n))}}var AN=e=>({add(t,r){e(Qn({contextKey:t,contextValue:r}))},remove(t){e(Hn(t))}}),wN=e=>({add(t,r){if(Bf(t))throw new wa(t);e(Qn({contextKey:t,contextValue:r}))},remove(t){if(Bf(t))throw new wa(t);e(Hn(t))}});function xN(e){return e.addReducers({context:dl}),!0}function MA(e,t){return DA(e,t)}m();d();f();p();m();d();f();p();var ni=L("dictionaryFieldContext/set",e=>{let t=new re({options:{required:!0}}),r=V(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new Ae({each:nt}),i=V(n,o).error;return i?{payload:e,error:i}:{payload:e}}),oi=L("dictionaryFieldContext/add",e=>{let t=new re({options:{required:!0},values:{field:nt,key:nt}});return V(e,t)}),ii=L("dictionaryFieldContext/remove",e=>V(e,nt));m();d();f();p();var pl=Be(ol(),e=>{e.addCase(ni,(t,r)=>{t.contextValues=r.payload}).addCase(oi,(t,r)=>{let{field:n,key:o}=r.payload;t.contextValues[n]=o}).addCase(ii,(t,r)=>{delete t.contextValues[r.payload]}).addCase(St.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.dictionaryFieldContext.contextValues)})});function LA(e){if(!CN(e))throw Qt;let t=Zr(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return{values:n().dictionaryFieldContext.contextValues}},set(o){r(ni(o))},add(o,i){r(oi({field:o,key:i}))},remove(o){r(ii(o))}}}function CN(e){return e.addReducers({dictionaryFieldContext:pl}),!0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var xa={value:Y,numberOfResults:new ne({min:0}),state:Y};m();d();f();p();var Ne=Y;var TN=new ne({min:1,default:8,required:!1}),_N=new ne({min:1,max:20,default:5,required:!1}),kN={desiredCount:_N,numberOfValues:TN},rfe=L("automaticFacet/setOptions",e=>V(e,kN)),nfe=L("automaticFacet/deselectAll",e=>V(e,Ne)),ON=Y,qA=L("automaticFacet/toggleSelectValue",e=>V(e,{field:ON,selection:new re({values:xa})}));m();d();f();p();m();d();f();p();var PN={state:new qe({required:!0}),numberOfResults:new ne({required:!0,min:0}),value:new H({required:!0,emptyAllowed:!0}),path:new Ae({required:!0,each:Y}),moreValuesAvailable:new fe({required:!1})};function $f(e){e.children.forEach(t=>{$f(t)}),Ot({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},PN)}var ai={facetId:Ne,field:Y,tabs:new re({options:{required:!1},values:{included:new Ae({each:new H}),excluded:new Ae({each:new H})}}),activeTab:new H({required:!1}),delimitingCharacter:new H({required:!1,emptyAllowed:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new qe({required:!1}),basePath:new Ae({required:!1,each:Y}),filterByBasePath:new fe({required:!1})};var Afe=L("categoryFacet/register",e=>V(e,ai)),jA=L("categoryFacet/toggleSelectValue",e=>{try{return Ot(e.facetId,Y),$f(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),UA=L("categoryFacet/deselectAll",e=>V(e,ai.facetId)),wfe=L("categoryFacet/updateNumberOfValues",e=>V(e,{facetId:ai.facetId,numberOfValues:ai.numberOfValues})),xfe=L("categoryFacet/updateSortCriterion",e=>V(e,{facetId:ai.facetId,criterion:new qe})),Cfe=L("categoryFacet/updateBasePath",e=>V(e,{facetId:ai.facetId,basePath:new Ae({each:Y})}));m();d();f();p();m();d();f();p();var Ca={facetId:Ne,captions:new re({options:{required:!1}}),numberOfValues:new ne({required:!1,min:1}),query:new H({required:!1,emptyAllowed:!0})};var NN={path:new Ae({required:!0,each:Y}),displayValue:nt,rawValue:nt,count:new ne({required:!0,min:0})},VA=L("categoryFacet/selectSearchResult",e=>V(e,{facetId:Ne,value:new re({values:NN})})),Gfe=L("categoryFacetSearch/register",e=>V(e,Ca));m();d();f();p();var GA={facetId:Ne,value:new re({values:{displayValue:nt,rawValue:nt,count:new ne({required:!0,min:0})}})},Jfe=L("facetSearch/register",e=>V(e,Ca)),eme=L("facetSearch/update",e=>V(e,Ca)),BA=L("facetSearch/toggleSelectValue",e=>V(e,GA)),$A=L("facetSearch/toggleExcludeValue",e=>V(e,GA));m();d();f();p();m();d();f();p();var sme=new H({regex:/^[a-zA-Z0-9-_]+$/}),cme=new H({required:!0}),ume=new Ae({each:new H}),lme=new H,dme=new fe,pme=new fe,fme=new ne({min:0}),FN=new ne({min:1}),mme=new fe({required:!0}),DN=new re,MN=new H,LN={captions:DN,numberOfValues:FN,query:MN},gme=new re({values:LN}),QA=new re({options:{required:!1},values:{type:new H({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new Ae({required:!0,max:25,each:new H({emptyAllowed:!1,required:!0})})}}),hme=new fe,HA=new Ae({min:1,max:25,required:!1,each:new H({emptyAllowed:!1,required:!0})});var qN={facetId:Ne,field:new H({required:!0,emptyAllowed:!0}),tabs:new re({options:{required:!1},values:{included:new Ae({each:new H}),excluded:new Ae({each:new H})}}),activeTab:new H({required:!1}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new qe({required:!1}),resultsMustMatch:new qe({required:!1}),allowedValues:QA,customSort:HA},Tme=L("facet/register",e=>V(e,qN)),zA=L("facet/toggleSelectValue",e=>V(e,{facetId:Ne,selection:new re({values:xa})})),WA=L("facet/toggleExcludeValue",e=>V(e,{facetId:Ne,selection:new re({values:xa})})),fl=L("facet/deselectAll",e=>V(e,Ne)),_me=L("facet/updateSortCriterion",e=>V(e,{facetId:Ne,criterion:new qe({required:!0})})),kme=L("facet/updateNumberOfValues",e=>V(e,{facetId:Ne,numberOfValues:new ne({required:!0,min:1})})),Ome=L("facet/updateIsFieldExpanded",e=>V(e,{facetId:Ne,isFieldExpanded:new fe({required:!0})})),Pme=L("facet/updateFreezeCurrentValues",e=>V(e,{facetId:Ne,freezeCurrentValues:new fe({required:!0})}));m();d();f();p();m();d();f();p();function YA(e){let t=KA(e.start,e),r=KA(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function KA(e,t){let{dateFormat:r}=t;return Ly(e)?(xp(e),Fy(e)):typeof e=="string"&&Nr(e)?(xp(e),e):(ky(e,r),ac(ko(e,r)))}m();d();f();p();var XA=L("rangeFacet/updateSortCriterion",e=>V(e,{facetId:Ne,criterion:new qe({required:!0})}));m();d();f();p();var ml={state:Y,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new fe({required:!0}),numberOfResults:new ne({required:!0,min:0})},gl={start:Y,end:Y,endInclusive:new fe({required:!0}),state:Y,numberOfResults:new ne({required:!0,min:0})};var jN={start:Y,end:Y,endInclusive:new fe({required:!0}),state:Y},UN={facetId:Ne,field:Y,tabs:new re({options:{required:!1},values:{included:new Ae({each:new H}),excluded:new Ae({each:new H})}}),activeTab:new H({required:!1}),currentValues:new Ae({required:!1,each:new re({values:jN})}),generateAutomaticRanges:new fe({required:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new qe({required:!1}),rangeAlgorithm:new qe({required:!1})};function ZA(e){return Nr(e)?Xi(e):e}function JA(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=YA(t);if(ko(ZA(r)).isAfter(ko(ZA(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var vge=L("dateFacet/register",e=>{try{return Ot(e,UN),JA(e),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),ew=L("dateFacet/toggleSelectValue",e=>V(e,{facetId:Ne,selection:new re({values:gl})})),tw=L("dateFacet/toggleExcludeValue",e=>V(e,{facetId:Ne,selection:new re({values:gl})})),rw=L("dateFacet/updateFacetValues",e=>{try{return Ot(e,{facetId:Ne,values:new Ae({each:new re({values:gl})})}),JA({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}});m();d();f();p();var VN={state:Y,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new fe({required:!0})},GN={facetId:Ne,field:Y,tabs:new re({options:{required:!1},values:{included:new Ae({each:new H}),excluded:new Ae({each:new H})}}),activeTab:new H({required:!1}),currentValues:new Ae({required:!1,each:new re({values:VN})}),generateAutomaticRanges:new fe({required:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new qe({required:!1}),rangeAlgorithm:new qe({required:!1})};function nw(e){e.currentValues&&e.currentValues.forEach(({start:t,end:r})=>{if(t>r)throw new Error(`The start value is greater than the end value for the numeric range ${t} to ${r}`)})}var Oge=L("numericFacet/register",e=>{try{return V(e,GN),nw(e),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),ow=L("numericFacet/toggleSelectValue",e=>V(e,{facetId:Ne,selection:new re({values:ml})})),iw=L("numericFacet/toggleExcludeValue",e=>V(e,{facetId:Ne,selection:new re({values:ml})})),aw=L("numericFacet/updateFacetValues",e=>{try{return Ot(e,{facetId:Ne,values:new Ae({each:new re({values:ml})})}),nw({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}});var sw=Be(ba(),e=>{e.addCase(Xu,(t,r)=>{let n=Qf(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=Ea(n,o)}).addCase(Zu,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(yc,t=>{t.firstResult=0}).addCase(Ju,(t,r)=>{let n=r.payload;t.firstResult=Ea(n,t.numberOfResults)}).addCase(ei,(t,r)=>{let n=r.payload;t.firstResult=Ea(n,t.numberOfResults)}).addCase(tl,t=>{let r=Qf(t),n=Math.max(r-1,1);t.firstResult=Ea(n,t.numberOfResults)}).addCase(el,t=>{let r=Qf(t),n=$N(t),o=Math.min(r+1,n);t.firstResult=Ea(o,t.numberOfResults)}).addCase(St.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(Ir,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(cl.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(aA.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(fl,t=>{mt(t)}).addCase(tw,t=>{mt(t)}).addCase(WA,t=>{mt(t)}).addCase(iw,t=>{mt(t)}).addCase($A,t=>{mt(t)}).addCase(zA,t=>{mt(t)}).addCase(UA,t=>{mt(t)}).addCase(jA,t=>{mt(t)}).addCase(VA,t=>{mt(t)}).addCase(ew,t=>{mt(t)}).addCase(ow,t=>{mt(t)}).addCase(zu,t=>{mt(t)}).addCase(rw,t=>{mt(t)}).addCase(aw,t=>{mt(t)}).addCase(BA,t=>{mt(t)}).addCase(qA,t=>{mt(t)})});function mt(e){e.firstResult=ba().firstResult}function Qf(e){let{firstResult:t,numberOfResults:r}=e;return QN(t,r)}function $N(e){let{totalCountFiltered:t,numberOfResults:r}=e;return HN(t,r)}function Ea(e,t){return(e-1)*t}function QN(e,t){return Math.round(e/t)+1}function HN(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function Hf(e){return e.addReducers({pagination:sw}),{nextPage:el,previousPage:tl,registerNumberOfResults:Xu,registerPage:Ju,updateNumberOfResults:Zu,updatePage:ei}}var zN=new yt({id:new H({emptyAllowed:!0,required:!1,default:""}),numberOfRecommendations:new ne({min:0})});function cw(e,t={}){if(!WN(e))throw Qt;let r=Zr(e),{dispatch:n}=e,o=()=>e.state,i=Pg(e,zN,t.options,"buildRecommendationList");return i.id!==""&&n(xo({id:i.id})),i.numberOfRecommendations&&n(Hf(e).updateNumberOfResults(i.numberOfRecommendations)),{...r,refresh(){n(Pr())},get state(){let a=o();return{recommendations:a.recommendation.recommendations,error:a.recommendation.error,isLoading:a.recommendation.isLoading,searchResponseId:a.recommendation.searchUid}}}}function WN(e){return e.addReducers({recommendation:Co,configuration:Vt}),!0}m();d();f();p();m();d();f();p();function uw(e,t,r){if(!KN(e))throw Qt;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:Pa(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function KN(e){return e.addReducers({configuration:Vt}),!0}function lw(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(Ws(t.options.result)))};return uw(e,t,()=>{n()})}m();d();f();p();m();d();f();p();m();d();f();p();var Jr=()=>new H({required:!1,emptyAllowed:!0}),hl=L("advancedSearchQueries/update",e=>V(e,{aq:Jr(),cq:Jr(),lq:Jr(),dq:Jr()})),yl=L("advancedSearchQueries/register",e=>V(e,{aq:Jr(),cq:Jr(),lq:Jr(),dq:Jr()}));var dw=Be(Hr(),e=>{e.addCase(hl,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Je(n)||(t.aq=n,t.aqWasSet=!0),Je(o)||(t.cq=o,t.cqWasSet=!0),Je(i)||(t.lq=i,t.lqWasSet=!0),Je(a)||(t.dq=a,t.dqWasSet=!0)}).addCase(yl,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Je(n)||(t.defaultFilters.aq=n,t.aqWasSet||(t.aq=n)),Je(o)||(t.defaultFilters.cq=o,t.cqWasSet||(t.cq=o)),Je(i)||(t.defaultFilters.lq=i,t.lqWasSet||(t.lq=i)),Je(a)||(t.defaultFilters.dq=a,t.dqWasSet||(t.dq=a))}).addCase(St.fulfilled,(t,r)=>r.payload?.advancedSearchQueries??t).addCase(Ir,(t,r)=>{let{aq:n,cq:o}=r.payload;Je(n)||(t.aq=n,t.aqWasSet=!0),Je(o)||(t.cq=o,t.cqWasSet=!0)})});function YN(e){return e.addReducers({advancedSearchQueries:dw}),{updateAdvancedSearchQueries:hl,registerAdvancedSearchQueries:yl}}m();d();f();p();function XN(e){return e.addReducers({configuration:Vt}),{disableAnalytics:uo,enableAnalytics:lo,setOriginLevel2:fs,setOriginLevel3:ms,updateAnalyticsConfiguration:co,updateBasicConfiguration:Rr}}m();d();f();p();function ZN(e){return e.addReducers({configuration:Vt,pipeline:fo,searchHub:Ro}),{updateSearchConfiguration:Kt}}m();d();f();p();function JN(e){return e.addReducers({context:dl}),{addContext:Qn,removeContext:Hn,setContext:$n}}m();d();f();p();function eF(e){return e.addReducers({debug:vs}),{disableDebug:hs,enableDebug:gs}}m();d();f();p();function tF(e){return e.addReducers({dictionaryFieldContext:pl}),{addContext:oi,removeContext:ii,setContext:ni}}m();d();f();p();m();d();f();p();m();d();f();p();var rF={collectionField:new H({emptyAllowed:!1,required:!1}),parentField:new H({emptyAllowed:!1,required:!1}),childField:new H({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new ne({min:0,required:!1})},pw=L("folding/register",e=>V(e,rF)),eve=ke("folding/loadCollection",/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),a=i.configuration.analytics.analyticsMode==="legacy"?yield Mr(i):Oo(i,o),s=yield n.search({...a,q:nF(i),enableQuerySyntax:!0,cq:`@${i.folding.fields.collection}="${e}"`,filterField:i.folding.fields.collection,childField:i.folding.fields.parent,parentField:i.folding.fields.child,filterFieldRange:100},{origin:"foldingCollection"});return vt(s)?r(s.error):{collectionId:e,results:s.success.results,searchUid:s.success.searchUid,rootResult:i.folding.collections[e].result}});return function(_x161,_x162){return _ref73.apply(this,arguments)}}());function nF(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}m();d();f();p();var fw=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});m();d();f();p();var si=L("fields/registerFieldsToInclude",e=>V(e,ps)),vl=L("fields/fetchall/enable"),Sl=L("fields/fetchall/disable"),bl=ke("fields/fetchDescription",/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:i,environment:a,organizationId:s}=o.configuration,{apiBaseUrl:u}=o.configuration.search,c=yield t.apiClient.fieldDescriptions({accessToken:i,organizationId:s,url:u??wr(s,a)});return vt(c)?n(c.error):c.success.fields});return function(_x163,_x164){return _ref74.apply(this,arguments)}}());m();d();f();p();var Al=["author","language","urihash","objecttype","collection","source","permanentid"],zf=[...Al,"date","filetype","parents"],mw=[...zf,"ec_price","ec_name","ec_description","ec_brand","ec_category","ec_item_group_id","ec_shortdesc","ec_thumbnails","ec_images","ec_promo_price","ec_in_stock","ec_rating"],gw=()=>({fieldsToInclude:Al,fetchAllFields:!1,fieldsDescription:[]});var wl=Be(gw(),e=>e.addCase(si,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(vl,t=>{t.fetchAllFields=!0}).addCase(Sl,t=>{t.fetchAllFields=!1}).addCase(bl.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(pw,(t,{payload:r})=>{let n=fw().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));function oF(e){return e.addReducers({fields:wl}),{registerFieldsToInclude:si,enableFetchAllFields:vl,disableFetchAllFields:Sl,fetchFieldsDescription:bl}}m();d();f();p();function iF(e){return e.addReducers({pipeline:fo}),{setPipeline:po}}m();d();f();p();function aF(e){return e.addReducers({recommendation:Co}),{getRecommendations:Pr,setRecommendationId:xo}}m();d();f();p();function sF(e){return e.addReducers({}),{logRecommendationOpen:Ws}}m();d();f();p();m();d();f();p();var cF=new yt({content:new qe({required:!0}),conditions:new qe({required:!0}),priority:new ne({required:!1,default:0,min:0}),fields:new Ae({required:!1,each:Y})});function hw(){let e=[],t=r=>{let n=cF.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new fi("Each template condition should be a function that takes a Result or Product as an argument and returns a boolean");return n};return{registerTemplates(...r){r.forEach(n=>{let o={...t(n),fields:n.fields||[]};e.push(o)}),e.sort((n,o)=>o.priority-n.priority)},selectTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.content:null},selectLinkTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.linkContent:null}}}function yw(e){if(!uF(e))throw Qt;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=hw();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(si(i))},selectTemplate:r,selectLinkTemplate:n}}function uF(e){return e.addReducers({fields:wl}),!0}m();d();f();p();function lF(e){return e.addReducers({searchHub:Ro}),{setSearchHub:Eo}}/**
|
|
41
|
+
`),v=JSON.parse(g);r?.event("SSE","Event received:",v,{type:v.type}),n.next(v)}catch(g){n.error(g)}}return n.asObservable()},WO=e=>{let t=new nr,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==Gn.HEADERS&&o.type===Gn.DATA&&o.data){let i=new Uint8Array(r.length+o.data.length);i.set(r,0),i.set(o.data,r.length),r=i,n()}},error:o=>t.error(o),complete:()=>{if(r.length>0)try{n()}catch{console.warn("Incomplete or invalid protocol buffer data at stream end")}t.complete()}});function n(){for(;r.length>=4;){let o=4+new DataView(r.buffer,r.byteOffset,4).getUint32(0,!1);if(r.length<o)break;try{let i=r.slice(4,o),a=bb(i);t.next(a),r=r.slice(o)}catch(i){let a=i instanceof Error?i.message:String(i);t.error(Error(`Failed to decode protocol buffer message: ${a}`));return}}}return t.asObservable()},KO=(e,t)=>{let r=va(t),n=new nr,o=new Gc,i=!1;return e.subscribe({next:a=>{if(o.next(a),a.type===Gn.HEADERS&&!i){i=!0;let s=a.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:s,parser:s===Af?"protobuf":"sse"}),s===Af?WO(o).subscribe({next:u=>n.next(u),error:u=>n.error(u),complete:()=>n.complete()}):zO(o,r).subscribe({next:u=>{try{let c=Rc.parse(u);r?.event("HTTP","Event validated:",c,{type:c.type,valid:!0}),n.next(c)}catch(c){r?.event("HTTP","Event invalid:",{json:u,error:String(c)}),n.error(c)}},error:u=>{if(u?.name==="AbortError"){n.next({type:F.RUN_ERROR,message:u.message||"Request aborted",code:"abort",rawEvent:u}),n.complete();return}return n.error(u)},complete:()=>n.complete()})}else i||n.error(Error("No headers event received before data events"))},error:a=>{o.error(a),n.error(a)},complete:()=>{o.complete()}}),n.asObservable()},Ue=S.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),YO=S.enum(["LangGraphInterruptEvent","PredictState","Exit"]),XO=S.object({type:S.literal(Ue.enum.TextMessageStart),messageId:S.string(),parentMessageId:S.string().optional(),role:S.string().optional()}),ZO=S.object({type:S.literal(Ue.enum.TextMessageContent),messageId:S.string(),content:S.string()}),JO=S.object({type:S.literal(Ue.enum.TextMessageEnd),messageId:S.string()}),eP=S.object({type:S.literal(Ue.enum.ActionExecutionStart),actionExecutionId:S.string(),actionName:S.string(),parentMessageId:S.string().optional()}),tP=S.object({type:S.literal(Ue.enum.ActionExecutionArgs),actionExecutionId:S.string(),args:S.string()}),rP=S.object({type:S.literal(Ue.enum.ActionExecutionEnd),actionExecutionId:S.string()}),nP=S.object({type:S.literal(Ue.enum.ActionExecutionResult),actionName:S.string(),actionExecutionId:S.string(),result:S.string()}),oP=S.object({type:S.literal(Ue.enum.AgentStateMessage),threadId:S.string(),agentName:S.string(),nodeName:S.string(),runId:S.string(),active:S.boolean(),role:S.string(),state:S.string(),running:S.boolean()}),iP=S.object({type:S.literal(Ue.enum.MetaEvent),name:YO,value:S.any()}),aP=S.object({type:S.literal(Ue.enum.RunError),message:S.string(),code:S.string().optional()});S.discriminatedUnion("type",[XO,ZO,JO,eP,tP,rP,nP,oP,iP,aP]),S.object({id:S.string(),role:S.string(),content:S.string(),parentMessageId:S.string().optional()}),S.object({id:S.string(),name:S.string(),arguments:S.any(),parentMessageId:S.string().optional()}),S.object({id:S.string(),result:S.any(),actionExecutionId:S.string(),actionName:S.string()});var sP=e=>{if(typeof e=="string")return e;if(!Array.isArray(e))return;let t=e.filter(r=>r.type==="text").map(r=>r.text).filter(r=>r.length>0);if(t.length!==0)return t.join(`
|
|
42
|
+
`)},cP=(e,t,r)=>n=>{let o={},i=!0,a=!0,s="",u=null,c=null,g=[],v={},R=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(wt(h=>{switch(h.type){case F.TEXT_MESSAGE_START:{let y=h;return[{type:Ue.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case F.TEXT_MESSAGE_CONTENT:{let y=h;return[{type:Ue.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case F.TEXT_MESSAGE_END:{let y=h;return[{type:Ue.enum.TextMessageEnd,messageId:y.messageId}]}case F.TOOL_CALL_START:{let y=h;return g.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),a=!0,v[y.toolCallId]=y.toolCallName,[{type:Ue.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case F.TOOL_CALL_ARGS:{let y=h,b=g.find(I=>I.id===y.toolCallId);if(!b)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];b.function.arguments+=y.delta;let x=!1;if(c){let I=c.find(N=>N.tool==b.function.name);if(I)try{let N=JSON.parse(su(b.function.arguments));I.tool_argument&&I.tool_argument in N?(R({...o,[I.state_key]:N[I.tool_argument]}),x=!0):I.tool_argument||(R({...o,[I.state_key]:N}),x=!0)}catch{}}return[{type:Ue.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(x?[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]:[])]}case F.TOOL_CALL_END:{let y=h;return[{type:Ue.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case F.TOOL_CALL_RESULT:{let y=h;return[{type:Ue.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:v[y.toolCallId]||"unknown"}]}case F.RAW:return[];case F.CUSTOM:{let y=h;switch(y.name){case"Exit":i=!1;break;case"PredictState":c=y.value;break}return[{type:Ue.enum.MetaEvent,name:y.name,value:y.value}]}case F.STATE_SNAPSHOT:return R(h.snapshot),[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}];case F.STATE_DELTA:{let y=h,b=Fc.applyPatch(o,y.delta,!0,!1);return b?(R(b.newDocument),[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]):[]}case F.MESSAGES_SNAPSHOT:return u=h.messages,[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(u?{messages:u}:{})}),active:!0}];case F.RUN_STARTED:return[];case F.RUN_FINISHED:return u&&(o.messages=u),Object.keys(o).length===0?[]:[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(u?{messages:uP(u)}:{})}),active:!1}];case F.RUN_ERROR:{let y=h;return[{type:Ue.enum.RunError,message:y.message,code:y.code}]}case F.STEP_STARTED:return s=h.stepName,g=[],c=null,[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case F.STEP_FINISHED:return g=[],c=null,[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function uP(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=sP(r.content);if(n){let o={id:r.id,role:r.role,content:n};t.push(o)}if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0)for(let o of r.toolCalls){let i={id:o.id,name:o.function.name,arguments:JSON.parse(o.function.arguments),parentMessageId:r.id};t.push(i)}}else if(r.role==="tool"){let n="unknown";for(let i of e)if(i.role==="assistant"&&i.toolCalls?.length){for(let a of i.toolCalls)if(a.id===r.toolCallId){n=a.function.name;break}}let o={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(o)}return t}var lP=e=>e.kind==="tool"?e.fields.toolCallId:e.fields.messageId,dP=e=>e==="tool"?"toolCallId":"messageId",Jo=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},Qu=e=>t=>{let r=va(e),n=new Map,o=u=>{let c=n.get(u);if(!c)return[];switch(n.delete(u),c.kind){case"text":{let g={type:F.TEXT_MESSAGE_END,messageId:c.fields.messageId,...(c.fields.subagentRunId!=null&&{subagentRunId:c.fields.subagentRunId})};return r?.event("TRANSFORM","TEXT_MESSAGE_END",g,{messageId:g.messageId}),[g]}case"tool":{let g={type:F.TOOL_CALL_END,toolCallId:c.fields.toolCallId,...(c.fields.subagentRunId!=null&&{subagentRunId:c.fields.subagentRunId})};return r?.event("TRANSFORM","TOOL_CALL_END",g,{toolCallId:g.toolCallId}),[g]}case"reasoning":{let g={type:F.REASONING_MESSAGE_END,messageId:c.fields.messageId,...(c.fields.subagentRunId!=null&&{subagentRunId:c.fields.subagentRunId})};return r?.event("TRANSFORM","REASONING_MESSAGE_END",g,{messageId:g.messageId}),[g]}}},i=()=>[...n.keys()].flatMap(u=>o(u)),a=(u,c)=>{for(let[g,v]of n)if(v.kind===u&&lP(v)===c)return{owner:g}},s=(u,c,g,v,R)=>{if(c!==void 0){let y=a(u,c);if(y){if(g!==void 0&&g!==y.owner)throw Error(`Cannot continue ${R} '${c}': chunk subagentRunId '${g}' does not match the open stream's subagent '${y.owner??"(the parent agent)"}'.`);return y.owner}return g}if(g!==void 0)return g;if(n.get(void 0)?.kind===u)return;let h=[...n.entries()].filter(([,y])=>y.kind===u);if(h.length===1)return h[0][0];if(h.length>1)throw Error(`Ambiguous ${v}: it carries neither a ${dP(u)} nor a subagentRunId, but ${h.length} lanes have an open ${R}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(wt(u=>{switch(u.type){case F.TEXT_MESSAGE_START:case F.TEXT_MESSAGE_CONTENT:case F.TEXT_MESSAGE_END:case F.TOOL_CALL_START:case F.TOOL_CALL_ARGS:case F.TOOL_CALL_END:case F.TOOL_CALL_RESULT:case F.STATE_SNAPSHOT:case F.STATE_DELTA:case F.CUSTOM:case F.STEP_STARTED:case F.STEP_FINISHED:case F.THINKING_START:case F.THINKING_END:case F.THINKING_TEXT_MESSAGE_START:case F.THINKING_TEXT_MESSAGE_CONTENT:case F.THINKING_TEXT_MESSAGE_END:case F.REASONING_START:case F.REASONING_MESSAGE_START:case F.REASONING_MESSAGE_CONTENT:case F.REASONING_MESSAGE_END:case F.REASONING_END:return[...o(u.subagentRunId??void 0),u];case F.RUN_STARTED:case F.RUN_FINISHED:case F.RUN_ERROR:case F.MESSAGES_SNAPSHOT:return[...i(),u];case F.RAW:case F.ACTIVITY_SNAPSHOT:case F.ACTIVITY_DELTA:case F.REASONING_ENCRYPTED_VALUE:case F.SUBAGENT_STARTED:return[u];case F.SUBAGENT_FINISHED:case F.SUBAGENT_ERROR:{let c=u.subagentRunId;return c==null?[u]:[...o(c),u]}case F.TEXT_MESSAGE_CHUNK:{let c=u,g=s("text",c.messageId,c.subagentRunId??void 0,"TEXT_MESSAGE_CHUNK","text message"),v=n.get(g),R=[],h;if(v?.kind==="text"&&(c.messageId===void 0||c.messageId===v.fields.messageId))h=v.fields;else{if(R.push(...o(g)),c.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");h={messageId:c.messageId,name:c.name,subagentRunId:c.subagentRunId},n.set(g,{kind:"text",fields:h});let y=Jo({type:F.TEXT_MESSAGE_START,messageId:c.messageId,role:c.role||"assistant",...(c.name!==void 0&&{name:c.name}),...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);R.push(y),r?.event("TRANSFORM","TEXT_MESSAGE_START",y,{messageId:c.messageId})}if(c.delta!==void 0){let y=c.subagentRunId??h.subagentRunId,b=Jo({type:F.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:c.delta,...(y!=null&&{subagentRunId:y})},c);R.push(b),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",b,{messageId:h.messageId})}if(R.length===0&&c.metadata!==void 0){let y=c.subagentRunId??h.subagentRunId;R.push({type:F.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:c.metadata,...(y!=null&&{subagentRunId:y})})}return R}case F.TOOL_CALL_CHUNK:{let c=u,g=s("tool",c.toolCallId,c.subagentRunId??void 0,"TOOL_CALL_CHUNK","tool call"),v=n.get(g),R=[],h;if(v?.kind==="tool"&&(c.toolCallId===void 0||c.toolCallId===v.fields.toolCallId))h=v.fields;else{if(R.push(...o(g)),c.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(c.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");h={toolCallId:c.toolCallId,toolCallName:c.toolCallName,parentMessageId:c.parentMessageId,subagentRunId:c.subagentRunId},n.set(g,{kind:"tool",fields:h});let y=Jo({type:F.TOOL_CALL_START,toolCallId:c.toolCallId,toolCallName:c.toolCallName,parentMessageId:c.parentMessageId,...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);R.push(y),r?.event("TRANSFORM","TOOL_CALL_START",y,{toolCallId:c.toolCallId,toolCallName:c.toolCallName})}if(c.delta!==void 0){let y=c.subagentRunId??h.subagentRunId,b=Jo({type:F.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:c.delta,...(y!=null&&{subagentRunId:y})},c);R.push(b),r?.event("TRANSFORM","TOOL_CALL_ARGS",b,{toolCallId:h.toolCallId})}if(R.length===0&&c.metadata!==void 0){let y=c.subagentRunId??h.subagentRunId;R.push({type:F.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:"",metadata:c.metadata,...(y!=null&&{subagentRunId:y})})}return R}case F.REASONING_MESSAGE_CHUNK:{let c=u,g=s("reasoning",c.messageId,c.subagentRunId??void 0,"REASONING_MESSAGE_CHUNK","reasoning message"),v=n.get(g),R=[],h;if(v?.kind==="reasoning"&&(c.messageId===void 0||c.messageId===v.fields.messageId))h=v.fields;else{if(R.push(...o(g)),c.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");h={messageId:c.messageId,subagentRunId:c.subagentRunId},n.set(g,{kind:"reasoning",fields:h});let y=Jo({type:F.REASONING_MESSAGE_START,messageId:c.messageId,role:"reasoning",...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);R.push(y),r?.event("TRANSFORM","REASONING_MESSAGE_START",y,{messageId:c.messageId})}if(c.delta!==void 0){let y=c.subagentRunId??h.subagentRunId,b=Jo({type:F.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:c.delta,...(y!=null&&{subagentRunId:y})},c);R.push(b),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",b,{messageId:h.messageId})}if(R.length===0&&c.metadata!==void 0){let y=c.subagentRunId??h.subagentRunId;R.push({type:F.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:c.metadata,...(y!=null&&{subagentRunId:y})})}return R}}return u.type,[]}),Un(()=>{i()}))};function pP(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var Sa=class{runNext(e,t){return t.run(e).pipe(Qu(!1))}runNextWithState(e,t){let r=Te(e.messages||[]),n=Te(e.state||{}),o=new Gc;return Fb(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(ou(/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(a=>setTimeout(a,0)),{event:i,messages:Te(r),state:Te(n)}});return function(_x94){return _ref22.apply(this,arguments)}}()))}},fP=class extends Sa{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function mP(e){let t=e.content;if(Array.isArray(t)){let r=t.filter(n=>typeof n=="object"&&!!n&&"type"in n&&n.type==="text"&&typeof n.text=="string").map(n=>n.text).join("");return{...e,content:r}}return typeof t=="string"?e:{...e,content:""}}var gP=class extends Sa{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(mP)};return this.runNext(o,t)}},Eb="THINKING_START",Rb="THINKING_END",Ib="THINKING_TEXT_MESSAGE_START",Tb="THINKING_TEXT_MESSAGE_CONTENT",_b="THINKING_TEXT_MESSAGE_END",hP=class extends Sa{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<"u"&&process.env!==void 0&&process.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe($r(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case Eb:{this.currentReasoningId=ya();let{title:t,...r}=e;return this.warnAboutTransformation(Eb,F.REASONING_START),{...r,type:F.REASONING_START,messageId:this.currentReasoningId}}case Ib:return this.currentMessageId=ya(),this.warnAboutTransformation(Ib,F.REASONING_MESSAGE_START),{...e,type:F.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case Tb:{let{delta:t,...r}=e;return this.warnAboutTransformation(Tb,F.REASONING_MESSAGE_CONTENT),{...r,type:F.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??ya(),delta:t}}case _b:{let t=this.currentMessageId??ya();return this.warnAboutTransformation(_b,F.REASONING_MESSAGE_END),{...e,type:F.REASONING_MESSAGE_END,messageId:t}}case Rb:{let t=this.currentReasoningId??ya();return this.warnAboutTransformation(Rb,F.REASONING_END),{...e,type:F.REASONING_END,messageId:t}}default:return e}}};function yP(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function vP(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function SP(e){let t=yP(e.mimeType);return e.data?{type:t,source:{type:"data",value:e.data,mimeType:e.mimeType},...(e.filename?{metadata:{filename:e.filename}}:{})}:e.url?{type:t,source:{type:"url",value:e.url,mimeType:e.mimeType},...(e.filename?{metadata:{filename:e.filename}}:{})}:e}function bP(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>vP(n)?SP(n):n);return{...e,content:r}}var AP=class extends Sa{run(e,t){let r={...e,messages:e.messages.map(bP)};return this.runNext(r,t)}},kb="SUBAGENT_STARTED",Ob="SUBAGENT_FINISHED",Pb="SUBAGENT_ERROR";function Hu(e){if(e&&typeof e=="object"&&"subagentRunId"in e){let{subagentRunId:t,...r}=e;return r}return e}function Nb(e){return e.map(t=>Hu(t))}var wP=class extends Sa{warnDroppedLifecycleEvent(e){typeof process<"u"&&process.env!==void 0&&process.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let r={...e,messages:(e.messages??[]).map(n=>Hu(n))};return this.runNext(r,t).pipe(au(n=>{let o=n.type;(o===kb||o===Ob||o===Pb)&&this.warnDroppedLifecycleEvent(o)}),af(n=>{let o=n.type;return o!==kb&&o!==Ob&&o!==Pb}),$r(n=>{let o=Hu(n);if(o.type===F.MESSAGES_SNAPSHOT){let i=o;if(Array.isArray(i.messages))return{...i,messages:Nb(i.messages)}}if(o.type===F.RUN_FINISHED){let i=o;if(i.outcome&&Array.isArray(i.outcome.interrupts))return{...i,outcome:{...i.outcome,interrupts:i.outcome.interrupts.map(a=>Hu(a))}}}if(o.type===F.RUN_STARTED){let i=o;if(i.input&&Array.isArray(i.input.messages))return{...i,input:{...i.input,messages:Nb(i.input.messages)}}}return o}))}},xP="0.0.59",CP=class{get maxVersion(){return xP}get debug(){return this._debug}set debug(e){this._debug=$u(e),this._debugLogger=Cf(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?Cf($u(!0)):void 0:this._debugLogger=e}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:i}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??jr(),this.messages=Te(n??[]),this.state=Te(o??{}),this._debug=$u(i),this._debugLogger=Cf(this._debug),Zo(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new gP),Zo(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new hP),Zo(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new AP),Zo(this.maxVersion,"0.0.57")<=0&&this.middlewares.unshift(new wP)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(r=>typeof r=="function"?new fP(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this14=this;return _asyncToGenerator(function*(){try{_this14.isRunning=!0,_this14.agentId=_this14.agentId??jr();let r=_this14.prepareRunAgentInput(e);_this14.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this14.agentId,threadId:_this14.threadId});let n,o=new Set(_this14.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{u.outcome==="success"&&(n=u.result)}},..._this14.subscribers,t??{}];yield _this14.onInitialize(r,i),_this14.activeRunDetach$=new nr;let a;_this14.activeRunCompletionPromise=new Promise(u=>{a=u}),yield ru(Vc(()=>_this14.middlewares.length===0?_this14.run(r):_this14.middlewares.reduceRight((u,c)=>({run:g=>c.run(g,u),get messages(){return u.messages},get state(){return u.state}}),_this14).run(r),Qu(_this14.debugLogger),Ef(_this14.debugLogger),u=>u.pipe(iu(_this14.activeRunDetach$)),u=>_this14.apply(r,u,i),u=>_this14.processApplyEvents(r,u,i),ma(u=>(_this14.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this14.agentId,error:u instanceof Error?u.message:String(u)}),_this14.isRunning=!1,_this14.onError(r,u,i))),Un(()=>{_this14.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this14.agentId,threadId:_this14.threadId}),_this14.isRunning=!1,_this14.onFinalize(r,i),a?.(),a=void 0,_this14.activeRunCompletionPromise=void 0,_this14.activeRunDetach$=void 0}))(Oe(null)));let s=Te(_this14.messages).filter(u=>!o.has(u.id));return{result:n,newMessages:s}}finally{_this14.isRunning=!1}})()}connect(e){throw new Qp}connectAgent(e,t){var _this15=this;return _asyncToGenerator(function*(){try{_this15.isRunning=!0,_this15.agentId=_this15.agentId??jr();let r=_this15.prepareRunAgentInput(e),n,o=new Set(_this15.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{u.outcome==="success"&&(n=u.result)}},..._this15.subscribers,t??{}];yield _this15.onInitialize(r,i),_this15.activeRunDetach$=new nr;let a;_this15.activeRunCompletionPromise=new Promise(u=>{a=u}),yield ru(Vc(()=>nu(()=>_this15.connect(r)),Qu(_this15.debugLogger),Ef(_this15.debugLogger),u=>u.pipe(iu(_this15.activeRunDetach$)),u=>_this15.apply(r,u,i),u=>_this15.processApplyEvents(r,u,i),ma(u=>(_this15.isRunning=!1,u instanceof Qp?Bc:_this15.onError(r,u,i))),Un(()=>{_this15.isRunning=!1,_this15.onFinalize(r,i),a?.(),a=void 0,_this15.activeRunCompletionPromise=void 0,_this15.activeRunDetach$=void 0}))(Oe(null)),{defaultValue:void 0});let s=Te(_this15.messages).filter(u=>!o.has(u.id));return{result:n,newMessages:s}}finally{_this15.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this16=this;return _asyncToGenerator(function*(){if(!_this16.activeRunDetach$)return;let e=_this16.activeRunCompletionPromise??Promise.resolve();_this16.activeRunDetach$.next(),_this16.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return Fb(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(au(n=>{n.messages&&(this.messages=n.messages,r.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,r.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Te(this.messages);for(let n of t)n.subagentRunId===null&&delete n.subagentRunId;let r=t.filter(n=>n.role!=="activity");return{threadId:this.threadId,runId:e?.runId||jr(),tools:Te(e?.tools??[]),context:Te(e?.context??[]),forwardedProps:Te(e?.forwardedProps??{}),state:Te(this.state),messages:r,...(e?.resume===void 0?{}:{resume:Te(e.resume)})}}onInitialize(e,t){var _this17=this;return _asyncToGenerator(function*(){if(_this17.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(i=>i.interruptId)),o=_this17.pendingInterrupts.map(i=>i.id).filter(i=>!n.has(i));if(o.length>0)throw new ge(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let i of _this17.pendingInterrupts)if(pP(i))throw new ge(`Interrupt ${i.id} expired at ${i.expiresAt}`)}let r=yield Pe(t,_this17.messages,_this17.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this17,input:e}));if(r.messages!==void 0||r.state!==void 0){if(r.messages){_this17.messages=r.messages;for(let n of r.messages)n.subagentRunId===null&&delete n.subagentRunId;e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17,input:e})})}r.state&&(_this17.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this17.state,messages:_this17.messages,agent:_this17,input:e})}))}})()}onError(e,t,r){return jn(Pe(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe($r(n=>{let o=n;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,r.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,r.forEach(i=>{i.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),o.stopPropagation!==!0){let i=String(t);if(!(t.name==="AbortError"||t.message==="Fetch is aborted"||t.message==="signal is aborted without reason"||t.message==="component unmounted"||i==="component unmounted"))throw console.error("Agent execution failed:",t),t}return{}}))}onFinalize(e,t){var _this18=this;return _asyncToGenerator(function*(){let r=yield Pe(t,_this18.messages,_this18.state,(n,o,i)=>n.onRunFinalized?.({messages:o,state:i,agent:_this18,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this18.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this18.messages,state:_this18.state,agent:_this18,input:e})})),r.state!==void 0&&(_this18.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this18.state,messages:_this18.messages,agent:_this18,input:e})})))})()}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=Te(this.messages),e.state=Te(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Te(this.pendingInterrupts),e}addMessage(e){var _this19=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this19.subscribers)yield t.onNewMessage?.({message:e,messages:_this19.messages,state:_this19.state,agent:_this19});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this19.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this19.messages,state:_this19.state,agent:_this19});for(let t of _this19.subscribers)yield t.onMessagesChanged?.({messages:_this19.messages,state:_this19.state,agent:_this19})})()}addMessages(e){var _this20=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this20.subscribers)yield r.onNewMessage?.({message:t,messages:_this20.messages,state:_this20.state,agent:_this20});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this20.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this20.messages,state:_this20.state,agent:_this20})}for(let t of _this20.subscribers)yield t.onMessagesChanged?.({messages:_this20.messages,state:_this20.state,agent:_this20})})()}setMessages(e){var _this21=this;this.messages=Te(e),_asyncToGenerator(function*(){for(let t of _this21.subscribers)yield t.onMessagesChanged?.({messages:_this21.messages,state:_this21.state,agent:_this21})})()}setState(e){var _this22=this;this.state=Te(e),_asyncToGenerator(function*(){for(let t of _this22.subscribers)yield t.onStateChanged?.({messages:_this22.messages,state:_this22.state,agent:_this22})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??jr();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:o=>n.run(o,r),get messages(){return r.messages},get state(){return r.state}}),this).run(t)).pipe(Qu(this.debugLogger),Ef(this.debugLogger),cP(this.threadId,t.runId,this.agentId),r=>r.pipe($r(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}};function EP(e){if(!Array.isArray(e.messages))return e;let t=!1,r=e.messages.map(n=>{if(n.subagentRunId===null){t=!0;let o={...n};return delete o.subagentRunId,o}return n});return t?{...e,messages:r}:e}var Db=class extends CP{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(EP(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new l.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new l.AbortController,this.url=e.url,this.headers=Te(e.headers??{}),this.fetch=e.fetch??((t,r)=>C(t,r))}run(e){return KO(HO(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Te(this.headers??{}),e.fetch=this.fetch;let t=new l.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};m();d();f();p();var Mb=(e,t,r)=>{let n=kt(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let i=`/api/v1/organizations/${t}/agents`;return`${n}${i}/${o}`};var Tf=class extends Db{requestInit(t){let{params:r,accessToken:n,recordDebugSession:o}=t.forwardedProps||{},i={...r,...(o&&{recordDebugSession:!0})};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream, application/json"},body:JSON.stringify(i),signal:this.abortController.signal}}},Lb=(e,t,r)=>new Tf({url:`${Mb(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var RP=new H({required:!0}),qb=new H({required:!0,constrainTo:lc}),jb=e=>({...e,name:dc(e.name)}),Ub=L("followUpAnswers/setIsEnabled",e=>V(e,new fe({required:!0}))),Vb=L("followUpAnswers/setFollowUpAnswersConversationId",e=>V(e,Y)),Gb=L("followUpAnswers/setFollowUpAnswersConversationToken",e=>V(e,Y)),Bb=L("followUpAnswers/clearFollowUpAnswersConversationToken"),fne=L("followUpAnswers/createFollowUpAnswer",e=>V(e,{question:Y})),mne=L("followUpAnswers/setActiveFollowUpAnswerId",e=>V(e,Y)),gne=L("followUpAnswers/setFollowUpAnswerContentFormat",e=>V(e,{contentFormat:fc,answerId:Y})),hne=L("followUpAnswers/setFollowUpIsLoading",e=>V(e,{isLoading:new fe({required:!0}),answerId:Y})),yne=L("followUpAnswers/setFollowUpIsStreaming",e=>V(e,{isStreaming:new fe({required:!0}),answerId:Y})),vne=L("followUpAnswers/followUpMessageChunkReceived",e=>V(e,{textDelta:RP,answerId:Y})),Sne=L("followUpAnswers/followUpCitationsReceived",e=>V(e,{citations:new Ae({required:!0,each:new re({values:Op})}),answerId:Y})),bne=L("followUpAnswers/followUpCompleted",e=>V(e,{answerId:Y,cannotAnswer:new fe({required:!1})})),Ane=L("followUpAnswers/followUpFailed",e=>V(e,{message:new H,code:new ne({min:0}),answerId:Y})),wne=L("followUpAnswers/activeFollowUpStartFailed",e=>V(e,{message:new H})),xne=L("followUpAnswers/likeFollowUp",e=>V(e,{answerId:Y})),Cne=L("followUpAnswers/dislikeFollowUp",e=>V(e,{answerId:Y})),Ene=L("followUpAnswers/submitFollowUpFeedback",e=>V(e,{answerId:Y})),$b=L("followUpAnswers/resetFollowUpAnswers"),Rne=L("followUpAnswers/stepStarted",e=>V(jb(e),{answerId:Y,name:qb,startedAt:new ne({min:0,required:!0})})),Ine=L("followUpAnswers/stepFinished",e=>V(jb(e),{answerId:Y,name:qb,finishedAt:new ne({min:0,required:!0})})),Tne=L("followUpAnswers/startToolCall",e=>V(e,{answerId:Y,toolCallName:Y,startedAt:new ne({min:0,required:!0}),toolCallId:Y})),_ne=L("followUpAnswers/finishToolCall",e=>V(e,{answerId:Y,finishedAt:new ne({min:0,required:!0}),toolCallId:Y})),kne=L("followUpAnswers/toolCallArgs",e=>V(e,{answerId:Y,toolCallId:Y,args:new re({options:{required:!0}}),type:new H({required:!0,constrainTo:pc})}));m();d();f();p();var IP={"KNOWLEDGE:SSE_MAX_DURATION_EXCEEDED":1e3,"KNOWLEDGE:SSE_FOLLOW_UP_NOT_SUPPORTED":1001,"KNOWLEDGE:NOT_FOUND":1002,"KNOWLEDGE:SSE_MODELS_NOT_AVAILABLE":1003,"KNOWLEDGE:SSE_INTERNAL_ERROR":1004,"KNOWLEDGE:SSE_TURN_LIMIT_REACHED":1005};function Qb(e){return e?IP[e]??1004:1004}var Hb=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(mc(n.runId)),e(qr(!1)),e(Ji(!0)),e(Vb(n.threadId)),e(Bb())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(sv({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(cv({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onToolCallStartEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:i,toolCallId:a,timestamp:s}=n;e(uv({toolCallId:a,toolCallName:i,startedAt:s??Date.now()}))},onToolCallEndEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,timestamp:a}=n;e(lv({toolCallId:i,finishedAt:a??Date.now()}))},onToolCallArgsEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,delta:a}=n;try{let s=JSON.parse(a);typeof s?.q=="string"?e(hc({toolCallId:i,args:s,type:"search"})):e(hc({toolCallId:i,args:{raw:a},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${a}`),e(hc({toolCallId:i,args:{raw:a},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(ea({textDelta:n.delta})))},onCustomEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{name:i,value:a}=n;switch(i){case"header":{a?.contentFormat&&e(na(a.contentFormat)),typeof a?.followUpEnabled=="boolean"&&e(Ub(a.followUpEnabled)),a?.conversationToken&&e(Gb(a.conversationToken));return}case"citations":{e(ta({citations:a.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=Qb(n.code);e(ra({message:n.message,code:i}))},onRunFinishedEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=n.result?.completionReason==="ANSWERED",a=i?!r:void 0;e(Pp(i)),e(oa(!i)),e(Ji(!1)),e(pp(i,t,a)),e(_o())}}};var zb=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _run=_asyncToGenerator(function*(n,o,i){t();let a=Bs(n),s=hh(n),u=yh(n),c=gh(n),g=vh(n),v=Lb(a,s,u);e=v;let R=Hb(o),h=ev(n,i());try{o(qr(!0)),yield v.runAgent({forwardedProps:{params:h,accessToken:c,recordDebugSession:g}},R)}catch(y){o(qr(!1)),o(ra({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});function run(_x95,_x96,_x97){return _run.apply(this,arguments)}return run}(),abortRun:t}};m();d();f();p();m();d();f();p();var zu=L("breadcrumb/deselectAll"),Wb=L("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var Kb=L("facet/updateFacetAutoSelection",e=>V(e,{allow:new fe({required:!0})}));m();d();f();p();m();d();f();p();var Wu=class extends Or{constructor(r){super(r);ue(this,"getState",r)}get activeInstantResultQuery(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].q;return null}get activeInstantResultCache(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].cache[o];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??Et().q}get responseTime(){return this.activeInstantResultCache?.duration??Ht().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??Ht().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var Yb=()=>De("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Wu(e)),Xb=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var _f={id:Y},TP={..._f,q:nt},Uoe=L("instantResults/register",e=>V(e,_f)),Ku=L("instantResults/updateQuery",e=>V(e,TP)),Voe=L("instantResults/clearExpired",e=>V(e,_f));m();d();f();p();var Yu=new ne({required:!0,min:0}),Xu=L("pagination/registerNumberOfResults",e=>V(e,Yu)),Zu=L("pagination/updateNumberOfResults",e=>V(e,Yu)),Ju=L("pagination/registerPage",e=>V(e,Yu)),ei=L("pagination/updatePage",e=>V(e,Yu)),el=L("pagination/nextPage"),tl=L("pagination/previousPage");m();d();f();p();var ti=L("query/updateQuery",e=>V(e,{q:new H,enableQuerySyntax:new fe}));m();d();f();p();m();d();f();p();m();d();f();p();var Hr=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var kf=()=>De("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),zr=e=>De("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||Et().q,aq:r.advancedSearchQueries?.aq||Hr().aq,cq:r.advancedSearchQueries?.cq||Hr().cq,dq:r.advancedSearchQueries?.dq||Hr().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();var Eie=L("didYouMean/enable"),Rie=L("didYouMean/disable"),Iie=L("didYouMean/automaticCorrections/disable"),Tie=L("didYouMean/automaticCorrections/enable"),rl=L("didYouMean/correction",e=>V(e,Y)),_ie=L("didYouMean/automaticCorrections/mode",e=>V(e,new H({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var Of=()=>De("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var Zb=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function nl(){return{contextValues:{}}}m();d();f();p();function ol(){return{contextValues:{}}}m();d();f();p();function Jb(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function eA(){return[]}m();d();f();p();function ba(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function tA(){return{}}m();d();f();p();function rA(){return{}}m();d();f();p();function nA(){return{}}function or(e){return{context:e.context||nl(),dictionaryFieldContext:e.dictionaryFieldContext||ol(),facetSet:e.facetSet||Gs(),numericFacetSet:e.numericFacetSet||Vs(),dateFacetSet:e.dateFacetSet||Us(),categoryFacetSet:e.categoryFacetSet||js(),automaticFacetSet:e.automaticFacetSet??qs(),pagination:e.pagination||ba(),query:e.query||Et(),tabSet:e.tabSet||nA(),advancedSearchQueries:e.advancedSearchQueries||Hr(),staticFilterSet:e.staticFilterSet||rA(),querySet:e.querySet||tA(),sortCriteria:e.sortCriteria||$s(),pipeline:e.pipeline||Tr(),searchHub:e.searchHub||Ao(),facetOptions:e.facetOptions||Jb(),facetOrder:e.facetOrder??eA(),debug:e.debug??ys()}}m();d();f();p();var tse=new re({values:{undoneQuery:nt},options:{required:!0}}),oA=()=>De("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var il=L("trigger/query/ignore",e=>V(e,new H({emptyAllowed:!0,required:!0}))),al=L("trigger/query/modification",e=>V(e,new re({values:{originalQuery:rt,modification:rt}})));m();d();f();p();var Wr=/*#__PURE__*/function(){var _Wr=_asyncToGenerator(function*(e,t){let r=OP(e),n=cc(e),o=_P(e),i=yield Mr(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Fr({...i,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(r&&{cq:r}),...(n.length&&{facets:n}),...(e.pagination&&{numberOfResults:a(),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:o}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});function Wr(_x98,_x99){return _Wr.apply(this,arguments)}return Wr}();function _P(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(kP).filter(r=>r.currentValues.length>0):void 0}function kP(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function OP(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=PP(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function PP(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o})}var Kr=class{constructor(t,r=n=>{this.dispatch(ti({q:n}))}){ue(this,"config",t);ue(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x100,_x101){var _this23=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=sc(yield _this23.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this23.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.processQueryErrorOrContinue(t)??(yield _this24.processQueryCorrectionsOrContinue(t))??(yield _this24.processQueryTriggersOrContinue(t))??_this24.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return vt(t.response)?(this.dispatch(zr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this25=this;return _asyncToGenerator(function*(){let r=_this25.getState(),n=_this25.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:u}=n;if(!o||!i)return null;let c=a.length===0&&s&&s.length!==0,g=!ce(u)&&!ce(u.correctedQuery);if(!c&&!g)return null;let R=c?yield _this25.processLegacyDidYouMeanAutoCorrection(t):_this25.processModernDidYouMeanAutoCorrection(t);return _this25.dispatch(Yt(or(_this25.getState()))),R})()}processLegacyDidYouMeanAutoCorrection(t){var _this26=this;return _asyncToGenerator(function*(){let r=_this26.getCurrentQuery(),n=_this26.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this26.automaticallyRetryQueryWithCorrection(o);return vt(i.response)?(_this26.dispatch(zr(i.response.error)),_this26.rejectWithValue(i.response.error)):(_this26.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this26.dispatch(Yt(or(_this26.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Of()})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o,analyticsAction:Of()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let r=this.getState(),n=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,r,n),this.extra)}processQueryTriggersOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this27.getState().triggers?.queryModification.queryToIgnore===n)return _this27.dispatch(il("")),null;_this27.analyticsAction&&(yield _this27.dispatch(_this27.analyticsAction));let i=_this27.getCurrentQuery(),a=yield _this27.automaticallyRetryQueryWithTriggerModification(n);return vt(a.response)?(_this27.dispatch(zr(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(Yt(or(_this27.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:oA()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??Et().enableQuerySyntax},search:{...Ht(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Yt(or(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return ja(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this28=this;return _asyncToGenerator(function*(){_this28.onUpdateQueryForCorrection(t);let r=yield _this28.fetchFromAPI(yield Wr(_this28.getState()),{origin:"mainSearch"});return _this28.dispatch(rl(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this29=this;return _asyncToGenerator(function*(){return _this29.dispatch(al({newQuery:t,originalQuery:_this29.getCurrentQuery()})),_this29.onUpdateQueryForCorrection(t),yield _this29.fetchFromAPI(yield Wr(_this29.getState()),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get analyticsAction(){return this.config.analyticsAction}get rejectWithValue(){return this.config.rejectWithValue}};var tce=ke("search/executeSearch",/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){let r=t.getState();return yield sl(r,t,e)});return function(_x102,_x103){return _ref27.apply(this,arguments)}}()),rce=ke("search/fetchPage",/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Nf(r,t,e)});return function(_x104,_x105){return _ref28.apply(this,arguments)}}()),nce=ke("search/fetchMoreResults",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ff(t,r)});return function(_x106,_x107){return _ref29.apply(this,arguments)}}()),oce=ke("search/fetchFacetValues",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t){let r=t.getState();return yield MP(t,e,r)});return function(_x108,_x109){return _ref30.apply(this,arguments)}}()),ice=ke("search/fetchInstantResults",/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){return Pf(e,t)});return function(_x110,_x111){return _ref31.apply(this,arguments)}}()),NP=/*#__PURE__*/function(){var _NP=_asyncToGenerator(function*(e,t){let r=yield Wr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});function NP(_x112,_x113){return _NP.apply(this,arguments)}return NP}(),FP=/*#__PURE__*/function(){var _FP=_asyncToGenerator(function*(e,t,r){let n=yield Mr(e);return Fr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});function FP(_x114,_x115,_x116){return _FP.apply(this,arguments)}return FP}(),DP=/*#__PURE__*/function(){var _DP=_asyncToGenerator(function*(e,t){let r=yield Wr(e,t);return r.request.numberOfResults=0,r});function DP(_x117,_x118){return _DP.apply(this,arguments)}return DP}(),iA=e=>{e.configuration.analytics.enabled&&ht.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Pf(_x119,_x120){return _Pf.apply(this,arguments)}function _Pf(){_Pf=_asyncToGenerator(function*(e,t){V(e,{id:Y,q:Y,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new Kr({...t,analyticsAction:Yb()},c=>{t.dispatch(Ku({q:c,id:e.id}))}),a=yield FP(o,r,n),s=yield i.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),u=yield i.process(s);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,analyticsAction:u.analyticsAction,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return _Pf.apply(this,arguments)}function Nf(_x121,_x122,_x123){return _Nf.apply(this,arguments)}function _Nf(){_Nf=_asyncToGenerator(function*(e,t,r){iA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Kr({...t,analyticsAction:r}),u=yield Wr(e,a),c=yield s.fetchFromAPI(u,{origin:"mainSearch"});return yield s.process(c)});return _Nf.apply(this,arguments)}function Ff(_x124,_x125){return _Ff.apply(this,arguments)}function _Ff(){_Ff=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield kf().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new Kr({...e,analyticsAction:kf()}),s=yield NP(t,i),u=yield a.fetchFromAPI(s,{origin:"mainSearch"});return yield a.process(u)});return _Ff.apply(this,arguments)}function MP(_x126,_x127,_x128){return _MP.apply(this,arguments)}function _MP(){_MP=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=e.extra,{description:a}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Kr({...e,analyticsAction:t}),u=yield DP(r,a),c=yield s.fetchFromAPI(u,{origin:"facetValues"});return yield s.process(c)});return _MP.apply(this,arguments)}function sl(_x129,_x130,_x131){return _sl.apply(this,arguments)}function _sl(){_sl=_asyncToGenerator(function*(e,t,r){iA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=yield Wr(e,a),u=new Kr({...t,analyticsAction:r}),c=yield u.fetchFromAPI(s,{origin:"mainSearch"});return yield u.process(c)});return _sl.apply(this,arguments)}m();d();f();p();var Yr=class{constructor(t,r=n=>{this.dispatch(ti({q:n}))}){ue(this,"config",t);ue(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x132,_x133){var _this30=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=sc(yield _this30.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this30.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.processQueryErrorOrContinue(t)??(yield _this31.processQueryCorrectionsOrContinue(t))??(yield _this31.processQueryTriggersOrContinue(t))??_this31.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return vt(t.response)?(this.dispatch(zr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this32=this;return _asyncToGenerator(function*(){let r=_this32.getState(),n=_this32.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:u}=n;if(!o)return null;if(!i)return!ce(u)&&!ce(u.correctedQuery)?_this32.processModernDidYouMeanAutoCorrection(t):null;let c=a.length===0&&s&&s.length!==0,g=!ce(u)&&!ce(u.correctedQuery);if(!c&&!g)return null;let R=c?yield _this32.processLegacyDidYouMeanAutoCorrection(t):_this32.processModernDidYouMeanAutoCorrection(t);return _this32.dispatch(Yt(or(_this32.getState()))),R})()}processLegacyDidYouMeanAutoCorrection(t){var _this33=this;return _asyncToGenerator(function*(){let r=_this33.getCurrentQuery(),n=_this33.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this33.automaticallyRetryQueryWithCorrection(o);return vt(i.response)?(_this33.dispatch(zr(i.response.error)),_this33.rejectWithValue(i.response.error)):(_this33.dispatch(Yt(or(_this33.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o}}processQueryTriggersOrContinue(t){var _this34=this;return _asyncToGenerator(function*(){let r=_this34.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this34.getState().triggers?.queryModification.queryToIgnore===n)return _this34.dispatch(il("")),null;let i=_this34.getCurrentQuery(),a=yield _this34.automaticallyRetryQueryWithTriggerModification(n);return vt(a.response)?(_this34.dispatch(zr(a.response.error)),_this34.rejectWithValue(a.response.error)):(_this34.dispatch(Yt(or(_this34.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Yt(or(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return ja(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this35=this;return _asyncToGenerator(function*(){_this35.onUpdateQueryForCorrection(t);let r=_this35.getState(),{actionCause:n}=Zb(),o=yield _this35.fetchFromAPI(yield Lr(r,_this35.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this35.dispatch(rl(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this36=this;return _asyncToGenerator(function*(){return _this36.dispatch(al({newQuery:t,originalQuery:_this36.getCurrentQuery()})),_this36.onUpdateQueryForCorrection(t),yield _this36.fetchFromAPI(yield Lr(_this36.getState(),_this36.extra.navigatorContext),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}};var Qce=ke("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;V(e,{q:new H,enableQuerySyntax:new fe,clearFilters:new fe}),e.clearFilters&&(r(zu()),r(Wb())),r(Kb({allow:!0})),r(ti({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(ei(1))}),Hce=L("search/updateSearchAction"),cl=ke("search/executeSearch",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return sl(r,t,e.legacy);sA(r);let n=e.next?cA(e.next):void 0,o=yield Lr(r,t.extra.navigatorContext,n),i=new Yr({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x134,_x135){return _ref32.apply(this,arguments)}}()),aA=ke("search/fetchPage",/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,t){let r=t.getState();if(sA(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Nf(r,t,e.legacy);let n=new Yr({...t,analyticsAction:e.next}),o=yield Lr(r,t.extra.navigatorContext,e.next),i=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(i)});return function(_x136,_x137){return _ref33.apply(this,arguments)}}()),zce=ke("search/fetchMoreResults",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Ff(t,r);let n=qh("browseResults",t.getState),o=new Yr({...t,analyticsAction:n}),i=yield LP(r,t.extra.navigatorContext,n),a=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(a)});return function(_x138,_x139){return _ref34.apply(this,arguments)}}()),Wce=ke("search/fetchFacetValues",/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return sl(r,t,e.legacy);let n=new Yr({...t,analyticsAction:{}}),o=yield jP(r,t.extra.navigatorContext),i=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(i)});return function(_x140,_x141){return _ref35.apply(this,arguments)}}()),Kce=ke("search/fetchInstantResults",/*#__PURE__*/function(){var _ref36=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Pf(e,t);V(e,{id:Y,q:Y,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:n,maxResultsPerQuery:o}=e,i=cA(Xb()),a=yield qP(r,t.extra.navigatorContext,n,o,i),s=new Yr({...t,analyticsAction:i},g=>{t.dispatch(Ku({q:g,id:e.id}))}),u=yield s.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),c=yield s.process(u);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return function(_x142,_x143){return _ref36.apply(this,arguments)}}()),LP=/*#__PURE__*/function(){var _LP=_asyncToGenerator(function*(e,t,r){let n=yield Lr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});function LP(_x144,_x145,_x146){return _LP.apply(this,arguments)}return LP}(),qP=/*#__PURE__*/function(){var _qP=_asyncToGenerator(function*(e,t,r,n,o){let i=Oo(e,t,o);return Fr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});function qP(_x147,_x148,_x149,_x150,_x151){return _qP.apply(this,arguments)}return qP}(),jP=/*#__PURE__*/function(){var _jP=_asyncToGenerator(function*(e,t,r){let n=yield Lr(e,t,r);return n.request.numberOfResults=0,n});function jP(_x152,_x153,_x154){return _jP.apply(this,arguments)}return jP}(),sA=e=>{e.configuration.analytics.enabled&&ht.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},cA=e=>({actionCause:e.actionCause,type:e.actionCause});var uA=e=>{let t=Tg({extra:e}),r=zb();return t.startListening({actionCreator:cl.pending,effect:function(){var _effect=_asyncToGenerator(function*(n,o){let i=o.getState();if(!Ud(i)||(r.abortRun(),o.dispatch(gc()),o.dispatch($b()),i.generatedAnswer.isEnabled===!1))return;let a=yn(i)?.q;!a||a.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});function effect(_x155,_x156){return _effect.apply(this,arguments)}return effect}()}),t};m();d();f();p();var lA=e=>()=>t=>r=>{let n=r;if(!n.error)return t(r);let o=n.error;if(n.payload?.ignored||e.error({error:o,action:r},`Action dispatch error ${n.type}`),n.error.name!=="SchemaValidationError")return t(r)},dA=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var Df=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:i}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:i}};m();d();f();p();function pA(e,t){let r={...e},n,o=i=>(a,s)=>{let u=i(a,s);return n?n(u,s):u};return{get combinedReducer(){let i=vm(Object.entries(t).filter(([a])=>!(a in r)).map(([a,s])=>[a,()=>s]));return o(rn({...i,...r}))},containsAll(i){return Object.keys(i).every(s=>s in r)},add(i){Object.keys(i).filter(a=>!(a in r)).forEach(a=>{r[a]=i[a]})},addCrossReducer(i){n=i}}}m();d();f();p();m();d();f();p();function UP(e){if(!e||!VP(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),o=decodeURIComponent(n.split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(o)}catch{return null}}function fA(e,t=60){if(!e)return!1;let r=UP(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function VP(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function gA(e,t){let r=0,n=null,o=Pa(()=>{r=0},500),i=/*#__PURE__*/function(){var _i2=_asyncToGenerator(function*(v,R=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(b){if(!R)throw b;return null}})().finally(()=>{n=null}));let y=yield n;return h&&y&&v.dispatch(Rr({accessToken:y})),y});function i(_x157){return _i2.apply(this,arguments)}return i}(),a=v=>{let R=$P(v.getState());return!!R&&fA(R)},s=/*#__PURE__*/function(){var _s3=_asyncToGenerator(function*(v){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(v))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(R){e.warn(R,"Access token renewal failed. A retry will occur if necessary.")}});function s(_x158){return _s3.apply(this,arguments)}return s}(),u=/*#__PURE__*/function(){var _u2=_asyncToGenerator(function*(v,R,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),mA(v,R.error),R;!n&&(r++,o());try{yield i(v,!0)}catch(b){e.debug(b,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}v.dispatch(h)});function u(_x159,_x160,_x161){return _u2.apply(this,arguments)}return u}(),c=(v,R,h)=>BP(h)?t?u(v,h,R):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),mA(v,h.error),h):h,g=(v,R,h)=>GP(h)?Promise.resolve(h).then(y=>c(v,R,y)):c(v,R,h);return v=>R=>h=>{if(!(typeof h=="function"))return R(h);let b=()=>g(v,h,R(h));return typeof t=="function"&&a(v)?s(v).then(b):b()}}function GP(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function BP(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Zn().name}function mA(e,t){e.dispatch(Ss({status:401,statusCode:401,message:t.message,type:t.name}))}function $P(e){return e.configuration.accessToken}m();d();f();p();function hA({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return mg({reducer:e,preloadedState:t,devTools:{stateSanitizer:i=>i.history?{...i,history:"<<OMIT>>"}:i,name:o,shouldHotReload:!1},middleware:i=>i({thunk:{extraArgument:n}}).prepend(...r).concat(dA(n.logger))})}function QP(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,disableBrowserPrivacySignals:o,...i}=r??{},a={...i,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})},s=a.analyticsMode!=="next",u=a.analyticsMode==="legacy"&&o===!0;return s&&Dl()&&!u?(t.info("Analytics disabled since doNotTrack is active."),{...a,enabled:!1}):(s&&Dl()&&u&&a.enabled!==!1&&t.warn("Browser privacy signals (Do Not Track and Global Privacy Control) are present but are being ignored because analytics.disableBrowserPrivacySignals is set to true. Legacy analytics events will be sent, and your integration is responsible for privacy compliance."),a)}function yA(e,t){let r={...e.reducers,configuration:Vt,version:bv},n=HP({...e,reducers:r},t,Vt),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(Rr({accessToken:o,environment:i,organizationId:a}));let s=QP(e.configuration,n.logger);return s&&n.dispatch(co(s)),n}function HP(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=pA({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,s={...t,get relay(){return Gi(c.state,o)},get navigatorContext(){return Df(this.relay,o)}},u=zP(e,s,i),c={addReducers(g){i.containsAll(g)||(i.add(g),u.replaceReducer(i.combinedReducer))},dispatch:u.dispatch,subscribe:u.subscribe,enableAnalytics(){u.dispatch(lo())},disableAnalytics(){u.dispatch(uo())},get state(){return u.getState()},get relay(){return Gi(this.state,o)},get navigatorContext(){return Df(this.relay,o)},logger:a,store:u};return c}function zP(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=WP(e,t.logger,()=>t.navigatorContext);return hA({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function WP(e,t,r){let{renewAccessToken:n}=e.configuration,o=gA(t,n),i=uA({getNavigatorContext:r});return[Ov,o,lA(t),wv].concat(Fp.middleware,i.middleware,e.middlewares||[])}m();d();f();p();var IA=jt(RA(),1);function TA(e){return(0,IA.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function _A(e,t){let r=pN(e),n=Ot,o=fN(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function pN(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function fN(e){return e.preprocessRequest||Da}m();d();f();p();m();d();f();p();var kA={organizationId:Y,accessToken:Y,name:new H({required:!1,emptyAllowed:!1}),analytics:new re({options:{required:!1},values:{enabled:new fe({required:!1}),originContext:new H({required:!1}),originLevel2:new H({required:!1}),originLevel3:new H({required:!1}),analyticsMode:new H({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new H({required:!1,url:!0}),trackingId:new H({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new fe({required:!1})}}),environment:new H({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function OA(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var PA=new yt({...kA,pipeline:new H({required:!1,emptyAllowed:!0}),searchHub:rt,locale:rt,timezone:rt});function Vf(){return{...OA(),searchHub:"default"}}var mN={debug:vs,pipeline:fo,searchHub:Ro,recommendation:Co};function NA(e){let t=TA(e.loggerOptions);gN(e.configuration,t);let r=hN(e.configuration,t),n={..._A(e.configuration,t),apiClient:r},o={...e,reducers:mN},i=yA(o,n),{pipeline:a,searchHub:s,timezone:u,locale:c,proxyBaseUrl:g}=e.configuration;return i.dispatch(Kt({timezone:u,locale:c,proxyBaseUrl:g})),ce(a)||i.dispatch(po(a)),ce(s)||i.dispatch(Eo(s)),{...i,get state(){return i.state}}}function gN(e,t){try{PA.validate(e)}catch(r){throw t.error(r,"Recommendation engine configuration error"),r}}function hN(e,t){return new qa({logger:t,preprocessRequest:e.preprocessRequest||Da,postprocessSearchResponseMiddleware:e.preprocessSearchResponseMiddleware||Dm,postprocessFacetSearchResponseMiddleware:Mm,postprocessQuerySuggestResponseMiddleware:Lm})}m();d();f();p();m();d();f();p();m();d();f();p();var yN=new Ae({each:Y,required:!0}),FA=(e,t)=>(V(e,Y),ka(t)?V(t,Y):V(t,yN),{payload:{contextKey:e,contextValue:t}}),$n=L("context/set",e=>{for(let[t,r]of Object.entries(e))FA(t,r);return{payload:e}}),Qn=L("context/add",e=>FA(e.contextKey,e.contextValue)),Hn=L("context/remove",e=>V(e,Y));m();d();f();p();var dl=Be(nl(),e=>{e.addCase($n,(t,r)=>{t.contextValues=r.payload}).addCase(Qn,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Hn,(t,r)=>{delete t.contextValues[r.payload]}).addCase(St.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});m();d();f();p();function Zr(e){let t,r=new Map,n=()=>r.size===0,o,i=a=>{try{let s=JSON.stringify(a),u=t!==s;return t=s,u}catch(s){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",s),!0}};return{subscribe(a){a();let s=Symbol();return n()&&(t=JSON.stringify(this.state),o=e.subscribe(()=>{i(this.state)&&r.forEach(u=>u())})),r.set(s,a),()=>{r.delete(s),n()&&(o?.(),o=void 0)}},get state(){return{}}}}m();d();f();p();var vN=["caseId","caseNumber"],SN={caseId:"caseContext",caseNumber:"caseContext"},wa=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${SN[t]} to set this value.}`)}};function Gf(e){return vN.includes(e)}var bN=new yt({values:new re({options:{required:!1}})});function DA(e,t={}){if(!xN(e))throw Qt;let r=Zr(e),{dispatch:n}=e,o=()=>e.state,i=Og(e,bN,t.initialState,"buildContext");return i.values&&n($n(i.values)),{...r,get state(){return{values:o().context.contextValues}},set(a){n($n(a))},...(o().configuration.analytics.analyticsMode==="legacy"?AN(n):wN(n))}}var AN=e=>({add(t,r){e(Qn({contextKey:t,contextValue:r}))},remove(t){e(Hn(t))}}),wN=e=>({add(t,r){if(Gf(t))throw new wa(t);e(Qn({contextKey:t,contextValue:r}))},remove(t){if(Gf(t))throw new wa(t);e(Hn(t))}});function xN(e){return e.addReducers({context:dl}),!0}function MA(e,t){return DA(e,t)}m();d();f();p();m();d();f();p();var ni=L("dictionaryFieldContext/set",e=>{let t=new re({options:{required:!0}}),r=V(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new Ae({each:nt}),i=V(n,o).error;return i?{payload:e,error:i}:{payload:e}}),oi=L("dictionaryFieldContext/add",e=>{let t=new re({options:{required:!0},values:{field:nt,key:nt}});return V(e,t)}),ii=L("dictionaryFieldContext/remove",e=>V(e,nt));m();d();f();p();var pl=Be(ol(),e=>{e.addCase(ni,(t,r)=>{t.contextValues=r.payload}).addCase(oi,(t,r)=>{let{field:n,key:o}=r.payload;t.contextValues[n]=o}).addCase(ii,(t,r)=>{delete t.contextValues[r.payload]}).addCase(St.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.dictionaryFieldContext.contextValues)})});function LA(e){if(!CN(e))throw Qt;let t=Zr(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return{values:n().dictionaryFieldContext.contextValues}},set(o){r(ni(o))},add(o,i){r(oi({field:o,key:i}))},remove(o){r(ii(o))}}}function CN(e){return e.addReducers({dictionaryFieldContext:pl}),!0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var xa={value:Y,numberOfResults:new ne({min:0}),state:Y};m();d();f();p();var Ne=Y;var TN=new ne({min:1,default:8,required:!1}),_N=new ne({min:1,max:20,default:5,required:!1}),kN={desiredCount:_N,numberOfValues:TN},rfe=L("automaticFacet/setOptions",e=>V(e,kN)),nfe=L("automaticFacet/deselectAll",e=>V(e,Ne)),ON=Y,qA=L("automaticFacet/toggleSelectValue",e=>V(e,{field:ON,selection:new re({values:xa})}));m();d();f();p();m();d();f();p();var PN={state:new qe({required:!0}),numberOfResults:new ne({required:!0,min:0}),value:new H({required:!0,emptyAllowed:!0}),path:new Ae({required:!0,each:Y}),moreValuesAvailable:new fe({required:!1})};function Bf(e){e.children.forEach(t=>{Bf(t)}),Ot({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},PN)}var ai={facetId:Ne,field:Y,tabs:new re({options:{required:!1},values:{included:new Ae({each:new H}),excluded:new Ae({each:new H})}}),activeTab:new H({required:!1}),delimitingCharacter:new H({required:!1,emptyAllowed:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new qe({required:!1}),basePath:new Ae({required:!1,each:Y}),filterByBasePath:new fe({required:!1})};var Afe=L("categoryFacet/register",e=>V(e,ai)),jA=L("categoryFacet/toggleSelectValue",e=>{try{return Ot(e.facetId,Y),Bf(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),UA=L("categoryFacet/deselectAll",e=>V(e,ai.facetId)),wfe=L("categoryFacet/updateNumberOfValues",e=>V(e,{facetId:ai.facetId,numberOfValues:ai.numberOfValues})),xfe=L("categoryFacet/updateSortCriterion",e=>V(e,{facetId:ai.facetId,criterion:new qe})),Cfe=L("categoryFacet/updateBasePath",e=>V(e,{facetId:ai.facetId,basePath:new Ae({each:Y})}));m();d();f();p();m();d();f();p();var Ca={facetId:Ne,captions:new re({options:{required:!1}}),numberOfValues:new ne({required:!1,min:1}),query:new H({required:!1,emptyAllowed:!0})};var NN={path:new Ae({required:!0,each:Y}),displayValue:nt,rawValue:nt,count:new ne({required:!0,min:0})},VA=L("categoryFacet/selectSearchResult",e=>V(e,{facetId:Ne,value:new re({values:NN})})),Gfe=L("categoryFacetSearch/register",e=>V(e,Ca));m();d();f();p();var GA={facetId:Ne,value:new re({values:{displayValue:nt,rawValue:nt,count:new ne({required:!0,min:0})}})},Jfe=L("facetSearch/register",e=>V(e,Ca)),eme=L("facetSearch/update",e=>V(e,Ca)),BA=L("facetSearch/toggleSelectValue",e=>V(e,GA)),$A=L("facetSearch/toggleExcludeValue",e=>V(e,GA));m();d();f();p();m();d();f();p();var sme=new H({regex:/^[a-zA-Z0-9-_]+$/}),cme=new H({required:!0}),ume=new Ae({each:new H}),lme=new H,dme=new fe,pme=new fe,fme=new ne({min:0}),FN=new ne({min:1}),mme=new fe({required:!0}),DN=new re,MN=new H,LN={captions:DN,numberOfValues:FN,query:MN},gme=new re({values:LN}),QA=new re({options:{required:!1},values:{type:new H({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new Ae({required:!0,max:25,each:new H({emptyAllowed:!1,required:!0})})}}),hme=new fe,HA=new Ae({min:1,max:25,required:!1,each:new H({emptyAllowed:!1,required:!0})});var qN={facetId:Ne,field:new H({required:!0,emptyAllowed:!0}),tabs:new re({options:{required:!1},values:{included:new Ae({each:new H}),excluded:new Ae({each:new H})}}),activeTab:new H({required:!1}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new qe({required:!1}),resultsMustMatch:new qe({required:!1}),allowedValues:QA,customSort:HA},Tme=L("facet/register",e=>V(e,qN)),zA=L("facet/toggleSelectValue",e=>V(e,{facetId:Ne,selection:new re({values:xa})})),WA=L("facet/toggleExcludeValue",e=>V(e,{facetId:Ne,selection:new re({values:xa})})),fl=L("facet/deselectAll",e=>V(e,Ne)),_me=L("facet/updateSortCriterion",e=>V(e,{facetId:Ne,criterion:new qe({required:!0})})),kme=L("facet/updateNumberOfValues",e=>V(e,{facetId:Ne,numberOfValues:new ne({required:!0,min:1})})),Ome=L("facet/updateIsFieldExpanded",e=>V(e,{facetId:Ne,isFieldExpanded:new fe({required:!0})})),Pme=L("facet/updateFreezeCurrentValues",e=>V(e,{facetId:Ne,freezeCurrentValues:new fe({required:!0})}));m();d();f();p();m();d();f();p();function YA(e){let t=KA(e.start,e),r=KA(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function KA(e,t){let{dateFormat:r}=t;return Ly(e)?(wp(e),Fy(e)):typeof e=="string"&&Nr(e)?(wp(e),e):(ky(e,r),ac(ko(e,r)))}m();d();f();p();var XA=L("rangeFacet/updateSortCriterion",e=>V(e,{facetId:Ne,criterion:new qe({required:!0})}));m();d();f();p();var ml={state:Y,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new fe({required:!0}),numberOfResults:new ne({required:!0,min:0})},gl={start:Y,end:Y,endInclusive:new fe({required:!0}),state:Y,numberOfResults:new ne({required:!0,min:0})};var jN={start:Y,end:Y,endInclusive:new fe({required:!0}),state:Y},UN={facetId:Ne,field:Y,tabs:new re({options:{required:!1},values:{included:new Ae({each:new H}),excluded:new Ae({each:new H})}}),activeTab:new H({required:!1}),currentValues:new Ae({required:!1,each:new re({values:jN})}),generateAutomaticRanges:new fe({required:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new qe({required:!1}),rangeAlgorithm:new qe({required:!1})};function ZA(e){return Nr(e)?Xi(e):e}function JA(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=YA(t);if(ko(ZA(r)).isAfter(ko(ZA(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var vge=L("dateFacet/register",e=>{try{return Ot(e,UN),JA(e),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),ew=L("dateFacet/toggleSelectValue",e=>V(e,{facetId:Ne,selection:new re({values:gl})})),tw=L("dateFacet/toggleExcludeValue",e=>V(e,{facetId:Ne,selection:new re({values:gl})})),rw=L("dateFacet/updateFacetValues",e=>{try{return Ot(e,{facetId:Ne,values:new Ae({each:new re({values:gl})})}),JA({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}});m();d();f();p();var VN={state:Y,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new fe({required:!0})},GN={facetId:Ne,field:Y,tabs:new re({options:{required:!1},values:{included:new Ae({each:new H}),excluded:new Ae({each:new H})}}),activeTab:new H({required:!1}),currentValues:new Ae({required:!1,each:new re({values:VN})}),generateAutomaticRanges:new fe({required:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new qe({required:!1}),rangeAlgorithm:new qe({required:!1})};function nw(e){e.currentValues&&e.currentValues.forEach(({start:t,end:r})=>{if(t>r)throw new Error(`The start value is greater than the end value for the numeric range ${t} to ${r}`)})}var Oge=L("numericFacet/register",e=>{try{return V(e,GN),nw(e),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),ow=L("numericFacet/toggleSelectValue",e=>V(e,{facetId:Ne,selection:new re({values:ml})})),iw=L("numericFacet/toggleExcludeValue",e=>V(e,{facetId:Ne,selection:new re({values:ml})})),aw=L("numericFacet/updateFacetValues",e=>{try{return Ot(e,{facetId:Ne,values:new Ae({each:new re({values:ml})})}),nw({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}});var sw=Be(ba(),e=>{e.addCase(Xu,(t,r)=>{let n=$f(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=Ea(n,o)}).addCase(Zu,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(yc,t=>{t.firstResult=0}).addCase(Ju,(t,r)=>{let n=r.payload;t.firstResult=Ea(n,t.numberOfResults)}).addCase(ei,(t,r)=>{let n=r.payload;t.firstResult=Ea(n,t.numberOfResults)}).addCase(tl,t=>{let r=$f(t),n=Math.max(r-1,1);t.firstResult=Ea(n,t.numberOfResults)}).addCase(el,t=>{let r=$f(t),n=$N(t),o=Math.min(r+1,n);t.firstResult=Ea(o,t.numberOfResults)}).addCase(St.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(Ir,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(cl.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(aA.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(fl,t=>{mt(t)}).addCase(tw,t=>{mt(t)}).addCase(WA,t=>{mt(t)}).addCase(iw,t=>{mt(t)}).addCase($A,t=>{mt(t)}).addCase(zA,t=>{mt(t)}).addCase(UA,t=>{mt(t)}).addCase(jA,t=>{mt(t)}).addCase(VA,t=>{mt(t)}).addCase(ew,t=>{mt(t)}).addCase(ow,t=>{mt(t)}).addCase(zu,t=>{mt(t)}).addCase(rw,t=>{mt(t)}).addCase(aw,t=>{mt(t)}).addCase(BA,t=>{mt(t)}).addCase(qA,t=>{mt(t)})});function mt(e){e.firstResult=ba().firstResult}function $f(e){let{firstResult:t,numberOfResults:r}=e;return QN(t,r)}function $N(e){let{totalCountFiltered:t,numberOfResults:r}=e;return HN(t,r)}function Ea(e,t){return(e-1)*t}function QN(e,t){return Math.round(e/t)+1}function HN(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function Qf(e){return e.addReducers({pagination:sw}),{nextPage:el,previousPage:tl,registerNumberOfResults:Xu,registerPage:Ju,updateNumberOfResults:Zu,updatePage:ei}}var zN=new yt({id:new H({emptyAllowed:!0,required:!1,default:""}),numberOfRecommendations:new ne({min:0})});function cw(e,t={}){if(!WN(e))throw Qt;let r=Zr(e),{dispatch:n}=e,o=()=>e.state,i=Pg(e,zN,t.options,"buildRecommendationList");return i.id!==""&&n(xo({id:i.id})),i.numberOfRecommendations&&n(Qf(e).updateNumberOfResults(i.numberOfRecommendations)),{...r,refresh(){n(Pr())},get state(){let a=o();return{recommendations:a.recommendation.recommendations,error:a.recommendation.error,isLoading:a.recommendation.isLoading,searchResponseId:a.recommendation.searchUid}}}}function WN(e){return e.addReducers({recommendation:Co,configuration:Vt}),!0}m();d();f();p();m();d();f();p();function uw(e,t,r){if(!KN(e))throw Qt;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:Pa(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function KN(e){return e.addReducers({configuration:Vt}),!0}function lw(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(Ws(t.options.result)))};return uw(e,t,()=>{n()})}m();d();f();p();m();d();f();p();m();d();f();p();var Jr=()=>new H({required:!1,emptyAllowed:!0}),hl=L("advancedSearchQueries/update",e=>V(e,{aq:Jr(),cq:Jr(),lq:Jr(),dq:Jr()})),yl=L("advancedSearchQueries/register",e=>V(e,{aq:Jr(),cq:Jr(),lq:Jr(),dq:Jr()}));var dw=Be(Hr(),e=>{e.addCase(hl,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Je(n)||(t.aq=n,t.aqWasSet=!0),Je(o)||(t.cq=o,t.cqWasSet=!0),Je(i)||(t.lq=i,t.lqWasSet=!0),Je(a)||(t.dq=a,t.dqWasSet=!0)}).addCase(yl,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Je(n)||(t.defaultFilters.aq=n,t.aqWasSet||(t.aq=n)),Je(o)||(t.defaultFilters.cq=o,t.cqWasSet||(t.cq=o)),Je(i)||(t.defaultFilters.lq=i,t.lqWasSet||(t.lq=i)),Je(a)||(t.defaultFilters.dq=a,t.dqWasSet||(t.dq=a))}).addCase(St.fulfilled,(t,r)=>r.payload?.advancedSearchQueries??t).addCase(Ir,(t,r)=>{let{aq:n,cq:o}=r.payload;Je(n)||(t.aq=n,t.aqWasSet=!0),Je(o)||(t.cq=o,t.cqWasSet=!0)})});function YN(e){return e.addReducers({advancedSearchQueries:dw}),{updateAdvancedSearchQueries:hl,registerAdvancedSearchQueries:yl}}m();d();f();p();function XN(e){return e.addReducers({configuration:Vt}),{disableAnalytics:uo,enableAnalytics:lo,setOriginLevel2:fs,setOriginLevel3:ms,updateAnalyticsConfiguration:co,updateBasicConfiguration:Rr}}m();d();f();p();function ZN(e){return e.addReducers({configuration:Vt,pipeline:fo,searchHub:Ro}),{updateSearchConfiguration:Kt}}m();d();f();p();function JN(e){return e.addReducers({context:dl}),{addContext:Qn,removeContext:Hn,setContext:$n}}m();d();f();p();function eF(e){return e.addReducers({debug:vs}),{disableDebug:hs,enableDebug:gs}}m();d();f();p();function tF(e){return e.addReducers({dictionaryFieldContext:pl}),{addContext:oi,removeContext:ii,setContext:ni}}m();d();f();p();m();d();f();p();m();d();f();p();var rF={collectionField:new H({emptyAllowed:!1,required:!1}),parentField:new H({emptyAllowed:!1,required:!1}),childField:new H({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new ne({min:0,required:!1})},pw=L("folding/register",e=>V(e,rF)),eve=ke("folding/loadCollection",/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),a=i.configuration.analytics.analyticsMode==="legacy"?yield Mr(i):Oo(i,o),s=yield n.search({...a,q:nF(i),enableQuerySyntax:!0,cq:`@${i.folding.fields.collection}="${e}"`,filterField:i.folding.fields.collection,childField:i.folding.fields.parent,parentField:i.folding.fields.child,filterFieldRange:100},{origin:"foldingCollection"});return vt(s)?r(s.error):{collectionId:e,results:s.success.results,searchUid:s.success.searchUid,rootResult:i.folding.collections[e].result}});return function(_x162,_x163){return _ref38.apply(this,arguments)}}());function nF(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}m();d();f();p();var fw=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});m();d();f();p();var si=L("fields/registerFieldsToInclude",e=>V(e,ps)),vl=L("fields/fetchall/enable"),Sl=L("fields/fetchall/disable"),bl=ke("fields/fetchDescription",/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:i,environment:a,organizationId:s}=o.configuration,{apiBaseUrl:u}=o.configuration.search,c=yield t.apiClient.fieldDescriptions({accessToken:i,organizationId:s,url:u??wr(s,a)});return vt(c)?n(c.error):c.success.fields});return function(_x164,_x165){return _ref39.apply(this,arguments)}}());m();d();f();p();var Al=["author","language","urihash","objecttype","collection","source","permanentid"],Hf=[...Al,"date","filetype","parents"],mw=[...Hf,"ec_price","ec_name","ec_description","ec_brand","ec_category","ec_item_group_id","ec_shortdesc","ec_thumbnails","ec_images","ec_promo_price","ec_in_stock","ec_rating"],gw=()=>({fieldsToInclude:Al,fetchAllFields:!1,fieldsDescription:[]});var wl=Be(gw(),e=>e.addCase(si,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(vl,t=>{t.fetchAllFields=!0}).addCase(Sl,t=>{t.fetchAllFields=!1}).addCase(bl.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(pw,(t,{payload:r})=>{let n=fw().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));function oF(e){return e.addReducers({fields:wl}),{registerFieldsToInclude:si,enableFetchAllFields:vl,disableFetchAllFields:Sl,fetchFieldsDescription:bl}}m();d();f();p();function iF(e){return e.addReducers({pipeline:fo}),{setPipeline:po}}m();d();f();p();function aF(e){return e.addReducers({recommendation:Co}),{getRecommendations:Pr,setRecommendationId:xo}}m();d();f();p();function sF(e){return e.addReducers({}),{logRecommendationOpen:Ws}}m();d();f();p();m();d();f();p();var cF=new yt({content:new qe({required:!0}),conditions:new qe({required:!0}),priority:new ne({required:!1,default:0,min:0}),fields:new Ae({required:!1,each:Y})});function hw(){let e=[],t=r=>{let n=cF.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new fi("Each template condition should be a function that takes a Result or Product as an argument and returns a boolean");return n};return{registerTemplates(...r){r.forEach(n=>{let o={...t(n),fields:n.fields||[]};e.push(o)}),e.sort((n,o)=>o.priority-n.priority)},selectTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.content:null},selectLinkTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.linkContent:null}}}function yw(e){if(!uF(e))throw Qt;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=hw();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(si(i))},selectTemplate:r,selectLinkTemplate:n}}function uF(e){return e.addReducers({fields:wl}),!0}m();d();f();p();function lF(e){return e.addReducers({searchHub:Ro}),{setSearchHub:Eo}}/**
|
|
43
43
|
* @license
|
|
44
44
|
*
|
|
45
45
|
* Copyright 2026 Coveo Solutions Inc.
|
|
@@ -70,6 +70,6 @@ fast-json-patch/module/duplex.mjs:
|
|
|
70
70
|
* (c) 2017-2021 Joachim Wester
|
|
71
71
|
* MIT license
|
|
72
72
|
*)
|
|
73
|
-
*/if(__exports!=exports)module.exports=exports;return module.exports})
|
|
73
|
+
*/if(__exports!=exports)module.exports=exports;return module.exports});//# sourceMappingURL=headless.js.map
|
|
74
74
|
|
|
75
|
-
window.coveoQuanticVersion = '3.45.
|
|
75
|
+
window.coveoQuanticVersion = '3.45.7';
|