@coveo/quantic 3.45.2 → 3.45.4
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/docs/out/quantic-docs.json +9 -9
- package/force-app/main/default/labels/CustomLabels.labels-meta.xml +7 -0
- package/force-app/main/default/lwc/quanticSearchBox/quanticSearchBox.js +16 -1
- package/force-app/main/default/lwc/quanticSearchBoxInput/templates/expandableSearchBoxInput.css +1 -1
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/quanticStandaloneSearchBox.js +16 -1
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +15 -15
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/commerce-api-client.d.ts +3 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/commerce-api-params.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/headless.js +17 -17
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +16 -16
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +14 -14
- package/package.json +4 -4
|
@@ -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 vw=Object.create;var
|
|
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 Rl(){return Rl=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=Nw(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Rl.apply(null,arguments)}function zn(e){return zn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zn(e)}function Ow(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&&Il(e,t)}function Xf(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Xf=function(){return!!e})()}function Pw(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 _w(e)}function Il(e,t){return Il=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Il(e,t)}function Nw(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=zn(e))!==null;);return e}function Fw(e,t,r,n){var o=Rl(zn(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function Dw(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 Mw(e){var t=Dw(e,"string");return typeof t=="symbol"?t:t+""}function Lw(e,t){if(e){if(typeof e=="string")return zf(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)?zf(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function qw(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 jw(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 Yf=function(){function e(){Tl(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return _l(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}}}])}(),kl=function(e){function t(){var r;return Tl(this,t),r=kw(this,t),r.listeners||Yf.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 Ow(t,e),_l(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)),Fw(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 Oa;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 Oa;function i(){o.abort(this.reason),a()}function a(){var g=Kf(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=Kf(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}}])}(Yf),Oa=function(){function e(){Tl(this,e),Object.defineProperty(this,"signal",{value:new kl,writable:!0,configurable:!0})}return _l(e,[{key:"abort",value:function(r){var n=jw(r),o=qw(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Oa.prototype[Symbol.toStringTag]="AbortController",kl.prototype[Symbol.toStringTag]="AbortSignal");function Uw(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 Vw(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(!Uw({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,_){y.addEventListener("abort",function(){return _(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=Oa;li.AbortSignal=kl;li.abortableFetch=Vw});var Zf,l,C,f=Hn(()=>{"use strict";Zf=jt(Ol(),1),l=jt(Ol(),1),{fetch:C}=(0,Zf.abortableFetch)({fetch})});function Pl(e){return typeof e!="string"||e in{}}function Nl(){return Object.create(null)}function Jf(e){return typeof e=="string"&&!!e.trim()}function Fl(e,t){var r=e.split(";").filter(Jf),n=r.shift();if(!n)return null;var o=Gw(n),i=o.name,a=o.value;if(t=t?Object.assign({},Pa,t):Pa,Pl(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=Nl();return s.name=i,s.value=a,r.forEach(function(u){var c=u.split("="),g=c.shift().trim().toLowerCase();if(!Pl(g)){var v=c.join("=").trim();if(g==="expires")s.expires=new Date(v);else if(g==="max-age"){var R=parseInt(v,10);Number.isNaN(R)||(s.maxAge=R)}else 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 Gw(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function Wn(e,t){if(t=t?Object.assign({},Pa,t):Pa,!e)return t.map?Nl():[];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(Jf),n&&(e=e.map(Na).flat()),t.map){var i=Nl();return e.reduce(function(a,s){var u=Fl(s,t);return u&&!Pl(u.name)&&(a[u.name]=u),a},i)}else return e.map(function(a){return Fl(a,t)}).filter(Boolean)}function Na(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 Pa,em=Hn(()=>{"use strict";m();d();f();p();Pa={decodeValues:!0,map:!1,silent:!1,split:"auto"};Wn.parseSetCookie=Wn;Wn.parse=Wn;Wn.parseString=Fl;Wn.splitCookiesString=Na});function di(e){if(Bw.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Dl(e){return e.replace($w,"")}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||!Qw(r))return!1}return!0}function Qw(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function rm(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 Bw,tm,$w,nm,Kn,Ml,om,E,am=Hn(()=>{"use strict";m();d();f();p();em();Bw=/[^a-z0-9\-#$%&'*+.^_`|~]/i;tm=[`
|
|
19
|
-
`,"\r","\t"," "],$w=new RegExp(`(^[${tm.join("")}]|$[${tm.join("")}])`,"g");Kn=Symbol("normalizedHeaders"),Ml=Symbol("rawHeaderNames"),om=", ",E=class im{constructor(t){this[Kn]={},this[Ml]=new Map,this[nm]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof im||typeof w.Headers<"u"&&t instanceof w.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(om):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(om):n)})}[(nm=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[Kn]).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[Kn].hasOwnProperty(di(t))}get(t){if(!pi(t))throw TypeError(`Invalid header name "${t}"`);return this[Kn][di(t)]??null}set(t,r){if(!pi(t)||!rm(r))return;let n=di(t),o=Dl(r);this[Kn][n]=Dl(o),this[Ml].set(n,t)}append(t,r){if(!pi(t)||!rm(r))return;let n=di(t),o=Dl(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[Kn][r],this[Ml].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===""?[""]:Na(t)}}});var m=Hn(()=>{"use strict";am()});var fm=Ze(gi=>{"use strict";m();d();f();p();var La=gi&&gi.__assign||function(){return La=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},La.apply(this,arguments)};Object.defineProperty(gi,"__esModule",{value:!0});var ex={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function tx(e){var t=La(La({},ex),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}gi.getSanitizedOptions=tx});var mm=Ze(Vl=>{"use strict";m();d();f();p();Object.defineProperty(Vl,"__esModule",{value:!0});function rx(e){var t=Math.random()*e;return Math.round(t)}Vl.fullJitter=rx});var gm=Ze(Gl=>{"use strict";m();d();f();p();Object.defineProperty(Gl,"__esModule",{value:!0});function nx(e){return e}Gl.noJitter=nx});var hm=Ze(Bl=>{"use strict";m();d();f();p();Object.defineProperty(Bl,"__esModule",{value:!0});var ox=mm(),ix=gm();function ax(e){return e.jitter==="full"?ox.fullJitter:ix.noJitter}Bl.JitterFactory=ax});var Ql=Ze($l=>{"use strict";m();d();f();p();Object.defineProperty($l,"__esModule",{value:!0});var sx=hm(),cx=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=sx.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}();$l.Delay=cx});var ym=Ze(ar=>{"use strict";m();d();f();p();var ux=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)}}(),lx=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())})},dx=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 px=Ql(),fx=function(e){ux(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return lx(this,void 0,void 0,function(){return dx(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}(px.Delay);ar.SkipFirstDelay=fx});var vm=Ze(hi=>{"use strict";m();d();f();p();var mx=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 gx=Ql(),hx=function(e){mx(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(gx.Delay);hi.AlwaysDelay=hx});var Sm=Ze(Hl=>{"use strict";m();d();f();p();Object.defineProperty(Hl,"__esModule",{value:!0});var yx=ym(),vx=vm();function Sx(e,t){var r=bx(e);return r.setAttemptNumber(t),r}Hl.DelayFactory=Sx;function bx(e){return e.delayFirstAttempt?new vx.AlwaysDelay(e):new yx.SkipFirstDelay(e)}});var bm=Ze(tn=>{"use strict";m();d();f();p();var zl=tn&&tn.__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())})},Wl=tn&&tn.__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(tn,"__esModule",{value:!0});var Ax=fm(),wx=Sm();function xx(e,t){return t===void 0&&(t={}),zl(this,void 0,void 0,function(){var r,n;return Wl(this,function(o){switch(o.label){case 0:return r=Ax.getSanitizedOptions(t),n=new Cx(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}tn.backOff=xx;var Cx=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return zl(this,void 0,void 0,function(){var t,r;return Wl(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 zl(this,void 0,void 0,function(){var t;return Wl(this,function(r){switch(r.label){case 0:return t=wx.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var sc=Ze((fp,mp)=>{"use strict";m();d();f();p();(function(e,t){typeof fp=="object"&&typeof mp<"u"?mp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof w<"u"?w:e||self).dayjs=t()})(fp,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(D){var q=["th","st","nd","rd"],U=D%100;return"["+D+(q[(U-20)%10]||q[U]||q[0])+"]"}},I=function(D,q,U){var H=String(D);return!H||H.length>=q?D:""+Array(q+1-H.length).join(U)+D},_={s:I,z:function(D){var q=-D.utcOffset(),U=Math.abs(q),H=Math.floor(U/60),Q=U%60;return(q<=0?"+":"-")+I(H,2,"0")+":"+I(Q,2,"0")},m:function D(q,U){if(q.date()<U.date())return-D(U,q);var H=12*(U.year()-q.year())+(U.month()-q.month()),Q=q.clone().add(H,c),J=U-Q<0,X=q.clone().add(H+(J?-1:1),c);return+(-(H+(U-Q)/(J?Q-X:X-Q))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:c,y:v,w:u,d:s,D:R,h:a,m:i,s:o,ms:n,Q:g}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},T="en",P={};P[T]=x;var A="$isDayjsObject",O=function(D){return D instanceof V||!(!D||!D[A])},k=function D(q,U,H){var Q;if(!q)return T;if(typeof q=="string"){var J=q.toLowerCase();P[J]&&(Q=J),U&&(P[J]=U,Q=J);var X=q.split("-");if(!Q&&X.length>1)return D(X[0])}else{var W=q.name;P[W]=q,Q=W}return!H&&Q&&(T=Q),Q||!H&&T},N=function(D,q){if(O(D))return D.clone();var U=typeof q=="object"?q:{};return U.date=D,U.args=arguments,new V(U)},M=_;M.l=k,M.i=O,M.w=function(D,q){return N(D,{locale:q.$L,utc:q.$u,x:q.$x,$offset:q.$offset})};var V=function(){function D(U){this.$L=k(U.locale,null,!0),this.parse(U),this.$x=this.$x||U.x||{},this[A]=!0}var q=D.prototype;return q.parse=function(U){this.$d=function(H){var Q=H.date,J=H.utc;if(Q===null)return new Date(NaN);if(M.u(Q))return new Date;if(Q instanceof Date)return new Date(Q);if(typeof Q=="string"&&!/Z$/i.test(Q)){var X=Q.match(y);if(X){var W=X[2]-1||0,te=(X[7]||"0").substring(0,3);return J?new Date(Date.UTC(X[1],W,X[3]||1,X[4]||0,X[5]||0,X[6]||0,te)):new Date(X[1],W,X[3]||1,X[4]||0,X[5]||0,X[6]||0,te)}}return new Date(Q)}(U),this.init()},q.init=function(){var U=this.$d;this.$y=U.getFullYear(),this.$M=U.getMonth(),this.$D=U.getDate(),this.$W=U.getDay(),this.$H=U.getHours(),this.$m=U.getMinutes(),this.$s=U.getSeconds(),this.$ms=U.getMilliseconds()},q.$utils=function(){return M},q.isValid=function(){return this.$d.toString()!==h},q.isSame=function(U,H){var Q=N(U);return this.startOf(H)<=Q&&Q<=this.endOf(H)},q.isAfter=function(U,H){return N(U)<this.startOf(H)},q.isBefore=function(U,H){return this.endOf(H)<N(U)},q.$g=function(U,H,Q){return M.u(U)?this[H]:this.set(Q,U)},q.unix=function(){return Math.floor(this.valueOf()/1e3)},q.valueOf=function(){return this.$d.getTime()},q.startOf=function(U,H){var Q=this,J=!!M.u(H)||H,X=M.p(U),W=function(ve,ge){var we=M.w(Q.$u?Date.UTC(Q.$y,ge,ve):new Date(Q.$y,ge,ve),Q);return J?we:we.endOf(s)},te=function(ve,ge){return M.w(Q.toDate()[ve].apply(Q.toDate("s"),(J?[0,0,0,0]:[23,59,59,999]).slice(ge)),Q)},le=this.$W,_e=this.$M,Ve=this.$D,Fe="set"+(this.$u?"UTC":"");switch(X){case v:return J?W(1,0):W(31,11);case c:return J?W(1,_e):W(0,_e+1);case u:var Me=this.$locale().weekStart||0,Le=(le<Me?le+7:le)-Me;return W(J?Ve-Le:Ve+(6-Le),_e);case s:case R:return te(Fe+"Hours",0);case a:return te(Fe+"Minutes",1);case i:return te(Fe+"Seconds",2);case o:return te(Fe+"Milliseconds",3);default:return this.clone()}},q.endOf=function(U){return this.startOf(U,!1)},q.$set=function(U,H){var Q,J=M.p(U),X="set"+(this.$u?"UTC":""),W=(Q={},Q[s]=X+"Date",Q[R]=X+"Date",Q[c]=X+"Month",Q[v]=X+"FullYear",Q[a]=X+"Hours",Q[i]=X+"Minutes",Q[o]=X+"Seconds",Q[n]=X+"Milliseconds",Q)[J],te=J===s?this.$D+(H-this.$W):H;if(J===c||J===v){var le=this.clone().set(R,1);le.$d[W](te),le.init(),this.$d=le.set(R,Math.min(this.$D,le.daysInMonth())).$d}else W&&this.$d[W](te);return this.init(),this},q.set=function(U,H){return this.clone().$set(U,H)},q.get=function(U){return this[M.p(U)]()},q.add=function(U,H){var Q,J=this;U=Number(U);var X=M.p(H),W=function(_e){var Ve=N(J);return M.w(Ve.date(Ve.date()+Math.round(_e*U)),J)};if(X===c)return this.set(c,this.$M+U);if(X===v)return this.set(v,this.$y+U);if(X===s)return W(1);if(X===u)return W(7);var te=(Q={},Q[i]=t,Q[a]=r,Q[o]=e,Q)[X]||1,le=this.$d.getTime()+U*te;return M.w(le,this)},q.subtract=function(U,H){return this.add(-1*U,H)},q.format=function(U){var H=this,Q=this.$locale();if(!this.isValid())return Q.invalidDate||h;var J=U||"YYYY-MM-DDTHH:mm:ssZ",X=M.z(this),W=this.$H,te=this.$m,le=this.$M,_e=Q.weekdays,Ve=Q.months,Fe=Q.meridiem,Me=function(ge,we,Se,He){return ge&&(ge[we]||ge(H,J))||Se[we].slice(0,He)},Le=function(ge){return M.s(W%12||12,ge,"0")},ve=Fe||function(ge,we,Se){var He=ge<12?"AM":"PM";return Se?He.toLowerCase():He};return J.replace(b,function(ge,we){return we||function(Se){switch(Se){case"YY":return String(H.$y).slice(-2);case"YYYY":return M.s(H.$y,4,"0");case"M":return le+1;case"MM":return M.s(le+1,2,"0");case"MMM":return Me(Q.monthsShort,le,Ve,3);case"MMMM":return Me(Ve,le);case"D":return H.$D;case"DD":return M.s(H.$D,2,"0");case"d":return String(H.$W);case"dd":return Me(Q.weekdaysMin,H.$W,_e,2);case"ddd":return Me(Q.weekdaysShort,H.$W,_e,3);case"dddd":return _e[H.$W];case"H":return String(W);case"HH":return M.s(W,2,"0");case"h":return Le(1);case"hh":return Le(2);case"a":return ve(W,te,!0);case"A":return ve(W,te,!1);case"m":return String(te);case"mm":return M.s(te,2,"0");case"s":return String(H.$s);case"ss":return M.s(H.$s,2,"0");case"SSS":return M.s(H.$ms,3,"0");case"Z":return X}return null}(ge)||X.replace(":","")})},q.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},q.diff=function(U,H,Q){var J,X=this,W=M.p(H),te=N(U),le=(te.utcOffset()-this.utcOffset())*t,_e=this-te,Ve=function(){return M.m(X,te)};switch(W){case v:J=Ve()/12;break;case c:J=Ve();break;case g:J=Ve()/3;break;case u:J=(_e-le)/6048e5;break;case s:J=(_e-le)/864e5;break;case a:J=_e/r;break;case i:J=_e/t;break;case o:J=_e/e;break;default:J=_e}return Q?J:M.a(J)},q.daysInMonth=function(){return this.endOf(c).$D},q.$locale=function(){return P[this.$L]},q.locale=function(U,H){if(!U)return this.$L;var Q=this.clone(),J=k(U,H,!0);return J&&(Q.$L=J),Q},q.clone=function(){return M.w(this.$d,this)},q.toDate=function(){return new Date(this.valueOf())},q.toJSON=function(){return this.isValid()?this.toISOString():null},q.toISOString=function(){return this.$d.toISOString()},q.toString=function(){return this.$d.toUTCString()},D}(),j=V.prototype;return N.prototype=j,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",c],["$y",v],["$D",R]].forEach(function(D){j[D[1]]=function(q){return this.$g(q,D[0],D[1])}}),N.extend=function(D,q){return D.$i||(D(q,V,N),D.$i=!0),N},N.locale=k,N.isDayjs=O,N.unix=function(D){return N(1e3*D)},N.en=P[T],N.Ls=P,N.p={},N})});var Cy=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 w<"u"?w:e||self).dayjs_plugin_quarterOfYear=t()})(gp,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 Ey=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 w<"u"?w:e||self).dayjs_plugin_customParseFormat=t()})(yp,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 _=1;_<=24;_+=1)if(y.indexOf(I(_,0,b))>-1){x=_>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(N,M,V){var j=V&&V.toUpperCase();return M||x[V]||e[V]||x[j].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(D,q,U){return q||U.slice(1)})})).match(t),_=I.length,T=0;T<_;T+=1){var P=I[T],A=R[P],O=A&&A[0],k=A&&A[1];I[T]=k?{regex:O,parser:k}:P.replace(/^\[|\]$/g,"")}return function(N){for(var M={},V=0,j=0;V<_;V+=1){var D=I[V];if(typeof D=="string")j+=D.length;else{var q=D.regex,U=D.parser,H=N.slice(j),Q=q.exec(H)[0];U.call(M,Q),N=N.replace(Q,"")}}return function(J){var X=J.afternoon;if(X!==void 0){var W=J.hours;X?W<12&&(J.hours+=12):W===12&&(J.hours=0),delete J.afternoon}}(M),M}}return function(y,b,x){x.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(s=y.parseTwoDigitYear);var I=b.prototype,_=I.parse;I.parse=function(T){var P=T.date,A=T.utc,O=T.args;this.$u=A;var k=O[1];if(typeof k=="string"){var N=O[2]===!0,M=O[3]===!0,V=N||M,j=O[2];M&&(j=O[2]),a=this.$locale(),!N&&j&&(a=x.Ls[j]),this.$d=function(H,Q,J,X){try{if(["x","X"].indexOf(Q)>-1)return new Date((Q==="X"?1e3:1)*H);var W=h(Q)(H),te=W.year,le=W.month,_e=W.day,Ve=W.hours,Fe=W.minutes,Me=W.seconds,Le=W.milliseconds,ve=W.zone,ge=W.week,we=new Date,Se=_e||(te||le?1:we.getDate()),He=te||we.getFullYear(),Ye=0;te&&!le||(Ye=le>0?le-1:we.getMonth());var Lt,xt=Ve||0,Qt=Fe||0,Tt=Me||0,qt=Le||0;return ve?new Date(Date.UTC(He,Ye,Se,xt,Qt,Tt,qt+60*ve.offset*1e3)):J?new Date(Date.UTC(He,Ye,Se,xt,Qt,Tt,qt)):(Lt=new Date(He,Ye,Se,xt,Qt,Tt,qt),ge&&(Lt=X(Lt).week(ge).toDate()),Lt)}catch{return new Date("")}}(P,k,A,x),this.init(),j&&j!==!0&&(this.$L=this.locale(j).$L),V&&P!=this.format(k)&&(this.$d=new Date("")),a={}}else if(k instanceof Array)for(var D=k.length,q=1;q<=D;q+=1){O[1]=k[q-1];var U=x.apply(this,O);if(U.isValid()){this.$d=U.$d,this.$L=U.$L,this.init();break}q===D&&(this.$d=new Date(""))}else _.call(this,T)}}})});var Av=Ze((Np,Fp)=>{"use strict";m();d();f();p();(function(e,t){typeof Np=="object"&&typeof Fp<"u"?Fp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof w<"u"?w:e||self).dayjs_plugin_timezone=t()})(Np,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",_=b+"|"+I,T=t[_];return T||(T=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[_]=T),T}(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,_=e[x];_>=0&&(h[_]=parseInt(I,10))}var T=h[3],P=T===24?0:T,A=h[0]+"-"+h[1]+"-"+h[2]+" "+P+":"+h[4]+":"+h[5]+":000",O=+g;return(o.utc(A).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 _=function(O,k,N){var M=O-60*k*1e3,V=s(M,N);if(k===V)return[M,k];var j=s(M-=60*(V-k)*1e3,N);return V===j?[M,V]:[O-60*Math.min(V,j)*1e3,Math.max(V,j)]}(x,b,y),T=_[0],P=_[1],A=o(T).utcOffset(P);return A.$x.$timezone=y,A},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var wv=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 w<"u"?w:e||self).dayjs_plugin_utc=t()})(Dp,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(T){T===void 0&&(T="");var P=T.match(t);if(!P)return null;var A=(""+P[0]).match(r)||["-",0,0],O=A[0],k=60*+A[1]+ +A[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 _=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(I=this.local().add(x+_,e)).$offset=x,I.$x.$localOffset=_,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 yA=Ze((ble,hA)=>{"use strict";m();d();f();p();function HP(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}hA.exports=zP;function zP(e,t,r){var n=r&&r.stringify||HP,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 CA=Ze((Ele,fl)=>{"use strict";m();d();f();p();var vA=yA();fl.exports=wr;var Ca=cN().console||{},WP={mapHttpRequest:pl,mapHttpResponse:pl,wrapRequestSerializer:Ff,wrapResponseSerializer:Ff,wrapErrorSerializer:Ff,req:pl,res:pl,err:bA,errWithCause:bA};function Zr(e,t){return e==="silent"?1/0:t.levels.values[e]}var Lf=Symbol("pino.logFuncs"),Df=Symbol("pino.hierarchy"),KP={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function SA(e,t){let r={logger:t,parent:e[Df]};t[Df]=r}function YP(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Ca[o]||Ca[KP[o]||"log"]||ti}),e[Lf]=n}function XP(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function wr(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||Ca;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=XP(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=ti),YP(c,s,r),SA({},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:iN(e),messageKey:e.messageKey||"msg",onChild:e.onChild||ti};c.levels=ZP(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=ti,c.serializers=n,c._serialize=o,c._stdErrSerialize=i,c.child=function(...b){return y.call(this,g,...b)},t&&(c._logEvent=Mf());function v(){return Zr(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,Gn(this,g,c,"error"),Gn(this,g,c,"fatal"),Gn(this,g,c,"warn"),Gn(this,g,c,"info"),Gn(this,g,c,"debug"),Gn(this,g,c,"trace"),a.forEach(x=>{Gn(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 _=I.serializers;if(o&&_){var T=Object.assign({},n,_),P=e.browser.serialize===!0?Object.keys(T):o;delete x.serializers,qf([x],P,T,this._stdErrSerialize)}function A(k){this._childLevel=(k._childLevel|0)+1,this.bindings=x,T&&(this.serializers=T,this._serialize=P),t&&(this._logEvent=Mf([].concat(k._logEvent.bindings,x)))}A.prototype=this;let O=new A(this);return SA(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 ZP(e){let t=e.customLevels||{},r=Object.assign({},wr.levels.values,t),n=Object.assign({},wr.levels.labels,JP(t));return{values:r,labels:n}}function JP(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}wr.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"}};wr.stdSerializers=WP;wr.stdTimeFunctions=Object.assign({},{nullTime:wA,epochTime:xA,unixTime:aN,isoTime:sN});function eN(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[Df];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Gn(e,t,r,n){if(Object.defineProperty(e,n,{value:Zr(e.level,r)>Zr(n,r)?ti:r[Lf][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===ti){if(!t.transmit)return;let i=t.transmit.level||e.level,a=Zr(i,r);if(Zr(n,r)<a)return}e[n]=rN(e,t,r,n);let o=eN(e);o.length!==0&&(e[n]=tN(o,e[n]))}function tN(e,t){return function(){return t.apply(this,[...e,...arguments])}}function rN(e,t,r,n){return function(o){return function(){let a=t.timestamp(),s=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Ca?Ca:this;for(var c=0;c<s.length;c++)s[c]=arguments[c];var g=!1;if(t.serialize&&(qf(s,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let v=nN(this,n,s,a,t);if(t.reportCaller&&v&&v.length>0&&v[0]&&typeof v[0]=="object")try{let R=AA();R&&(v[0].caller=R)}catch{}o.call(u,...v)}else{if(t.reportCaller)try{let v=AA();v&&s.push(v)}catch{}o.apply(u,s)}if(t.transmit){let v=t.transmit.level||e._level,R=Zr(v,r),h=Zr(n,r);if(h<R)return;oN(this,{ts:a,methodLevel:n,methodValue:h,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Zr(e._level,r)},s,g)}}}(e[Lf][n])}function nN(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?vA(s.shift(),s):void 0}else typeof u=="string"&&(u=vA(s.shift(),s));return u!==void 0&&(c[o.messageKey]=u),[a(c)]}}function qf(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=wr.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 oN(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||qf(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=Mf(c)}function Mf(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function bA(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 iN(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?wA:xA}function pl(){return{}}function Ff(e){return e}function ti(){}function wA(){return!1}function xA(){return Date.now()}function aN(){return Math.round(Date.now()/1e3)}function sN(){return new Date(Date.now()).toISOString()}function cN(){function e(t){return typeof t<"u"&&t}try{return typeof w<"u"?w:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),w)}catch{return e(self)||e(window)||e(this)||{}}}fl.exports.default=wr;fl.exports.pino=wr;function AA(){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
|
|
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 vw=Object.create;var ui=Object.defineProperty;var Sw=Object.getOwnPropertyDescriptor;var bw=Object.getOwnPropertyNames;var Aw=Object.getPrototypeOf,ww=Object.prototype.hasOwnProperty;var xw=(e,t,r)=>t in e?ui(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}},li=(e,t)=>{for(var r in t)ui(e,r,{get:t[r],enumerable:!0})},Wf=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of bw(t))!ww.call(e,o)&&o!==r&&ui(e,o,{get:()=>t[o],enumerable:!(n=Sw(t,o))||n.enumerable});return e};var jt=(e,t,r)=>(r=e!=null?vw(Aw(e)):{},Wf(t||!e||!e.__esModule?ui(r,"default",{value:e,enumerable:!0}):r,e)),Cw=e=>Wf(ui({},"__esModule",{value:!0}),e);var ue=(e,t,r)=>xw(e,typeof t!="symbol"?t+"":t,r);var w,d=zn(()=>{"use strict";w=typeof globalThis<"u"?globalThis:window});function ka(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ka=function(t){return typeof t}:ka=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ka(e)}function Iw(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=Tw.bind(this))}function Tw(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","*/*"),Ew(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):Rw(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var Ew,Rw,p=zn(()=>{"use strict";Ew=function(t){return typeof t=="string"},Rw=function(t){return t instanceof Blob};Iw.call((typeof window>"u"?"undefined":ka(window))==="object"?window:{})});var Ol=Ze(di=>{"use strict";m();d();f();p();Object.defineProperty(di,"__esModule",{value:!0});function Kf(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 _w(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kw(e,t,r){return t=Wn(t),Pw(e,Jf()?Reflect.construct(t,r||[],Wn(e).constructor):t.apply(e,r))}function Tl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yf(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,Mw(n.key),n)}}function _l(e,t,r){return t&&Yf(e.prototype,t),r&&Yf(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Xf(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Lw(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 Rl(){return Rl=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=Nw(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Rl.apply(null,arguments)}function Wn(e){return Wn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wn(e)}function Ow(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&&Il(e,t)}function Jf(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Jf=function(){return!!e})()}function Pw(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 _w(e)}function Il(e,t){return Il=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Il(e,t)}function Nw(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Wn(e))!==null;);return e}function Fw(e,t,r,n){var o=Rl(Wn(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function Dw(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 Mw(e){var t=Dw(e,"string");return typeof t=="symbol"?t:t+""}function Lw(e,t){if(e){if(typeof e=="string")return Kf(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)?Kf(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function qw(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 jw(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 Zf=function(){function e(){Tl(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return _l(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}}}])}(),kl=function(e){function t(){var r;return Tl(this,t),r=kw(this,t),r.listeners||Zf.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 Ow(t,e),_l(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)),Fw(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 Oa;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 Oa;function i(){o.abort(this.reason),a()}function a(){var g=Xf(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=Xf(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}}])}(Zf),Oa=function(){function e(){Tl(this,e),Object.defineProperty(this,"signal",{value:new kl,writable:!0,configurable:!0})}return _l(e,[{key:"abort",value:function(r){var n=jw(r),o=qw(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Oa.prototype[Symbol.toStringTag]="AbortController",kl.prototype[Symbol.toStringTag]="AbortSignal");function Uw(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 Vw(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(!Uw({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,_){y.addEventListener("abort",function(){return _(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}}di.AbortController=Oa;di.AbortSignal=kl;di.abortableFetch=Vw});var em,l,C,f=zn(()=>{"use strict";em=jt(Ol(),1),l=jt(Ol(),1),{fetch:C}=(0,em.abortableFetch)({fetch})});function Pl(e){return typeof e!="string"||e in{}}function Nl(){return Object.create(null)}function tm(e){return typeof e=="string"&&!!e.trim()}function Fl(e,t){var r=e.split(";").filter(tm),n=r.shift();if(!n)return null;var o=Gw(n),i=o.name,a=o.value;if(t=t?Object.assign({},Pa,t):Pa,Pl(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=Nl();return s.name=i,s.value=a,r.forEach(function(u){var c=u.split("="),g=c.shift().trim().toLowerCase();if(!Pl(g)){var v=c.join("=").trim();if(g==="expires")s.expires=new Date(v);else if(g==="max-age"){var R=parseInt(v,10);Number.isNaN(R)||(s.maxAge=R)}else 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 Gw(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function Kn(e,t){if(t=t?Object.assign({},Pa,t):Pa,!e)return t.map?Nl():[];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(tm),n&&(e=e.map(Na).flat()),t.map){var i=Nl();return e.reduce(function(a,s){var u=Fl(s,t);return u&&!Pl(u.name)&&(a[u.name]=u),a},i)}else return e.map(function(a){return Fl(a,t)}).filter(Boolean)}function Na(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 Pa,rm=zn(()=>{"use strict";m();d();f();p();Pa={decodeValues:!0,map:!1,silent:!1,split:"auto"};Kn.parseSetCookie=Kn;Kn.parse=Kn;Kn.parseString=Fl;Kn.splitCookiesString=Na});function pi(e){if(Bw.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Dl(e){return e.replace($w,"")}function fi(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||!Qw(r))return!1}return!0}function Qw(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function om(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 Bw,nm,$w,im,Yn,Ml,am,E,cm=zn(()=>{"use strict";m();d();f();p();rm();Bw=/[^a-z0-9\-#$%&'*+.^_`|~]/i;nm=[`
|
|
19
|
+
`,"\r","\t"," "],$w=new RegExp(`(^[${nm.join("")}]|$[${nm.join("")}])`,"g");Yn=Symbol("normalizedHeaders"),Ml=Symbol("rawHeaderNames"),am=", ",E=class sm{constructor(t){this[Yn]={},this[Ml]=new Map,this[im]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof sm||typeof w.Headers<"u"&&t instanceof w.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(am):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(am):n)})}[(im=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(!fi(t))throw new TypeError(`Invalid header name "${t}"`);return this[Yn].hasOwnProperty(pi(t))}get(t){if(!fi(t))throw TypeError(`Invalid header name "${t}"`);return this[Yn][pi(t)]??null}set(t,r){if(!fi(t)||!om(r))return;let n=pi(t),o=Dl(r);this[Yn][n]=Dl(o),this[Ml].set(n,t)}append(t,r){if(!fi(t)||!om(r))return;let n=pi(t),o=Dl(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!fi(t)||!this.has(t))return;let r=pi(t);delete this[Yn][r],this[Ml].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===""?[""]:Na(t)}}});var m=zn(()=>{"use strict";cm()});var gm=Ze(hi=>{"use strict";m();d();f();p();var La=hi&&hi.__assign||function(){return La=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},La.apply(this,arguments)};Object.defineProperty(hi,"__esModule",{value:!0});var ex={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function tx(e){var t=La(La({},ex),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}hi.getSanitizedOptions=tx});var hm=Ze(Vl=>{"use strict";m();d();f();p();Object.defineProperty(Vl,"__esModule",{value:!0});function rx(e){var t=Math.random()*e;return Math.round(t)}Vl.fullJitter=rx});var ym=Ze(Gl=>{"use strict";m();d();f();p();Object.defineProperty(Gl,"__esModule",{value:!0});function nx(e){return e}Gl.noJitter=nx});var vm=Ze(Bl=>{"use strict";m();d();f();p();Object.defineProperty(Bl,"__esModule",{value:!0});var ox=hm(),ix=ym();function ax(e){return e.jitter==="full"?ox.fullJitter:ix.noJitter}Bl.JitterFactory=ax});var Ql=Ze($l=>{"use strict";m();d();f();p();Object.defineProperty($l,"__esModule",{value:!0});var sx=vm(),cx=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=sx.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}();$l.Delay=cx});var Sm=Ze(ar=>{"use strict";m();d();f();p();var ux=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)}}(),lx=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())})},dx=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 px=Ql(),fx=function(e){ux(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return lx(this,void 0,void 0,function(){return dx(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}(px.Delay);ar.SkipFirstDelay=fx});var bm=Ze(yi=>{"use strict";m();d();f();p();var mx=yi&&yi.__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(yi,"__esModule",{value:!0});var gx=Ql(),hx=function(e){mx(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(gx.Delay);yi.AlwaysDelay=hx});var Am=Ze(Hl=>{"use strict";m();d();f();p();Object.defineProperty(Hl,"__esModule",{value:!0});var yx=Sm(),vx=bm();function Sx(e,t){var r=bx(e);return r.setAttemptNumber(t),r}Hl.DelayFactory=Sx;function bx(e){return e.delayFirstAttempt?new vx.AlwaysDelay(e):new yx.SkipFirstDelay(e)}});var wm=Ze(tn=>{"use strict";m();d();f();p();var zl=tn&&tn.__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())})},Wl=tn&&tn.__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(tn,"__esModule",{value:!0});var Ax=gm(),wx=Am();function xx(e,t){return t===void 0&&(t={}),zl(this,void 0,void 0,function(){var r,n;return Wl(this,function(o){switch(o.label){case 0:return r=Ax.getSanitizedOptions(t),n=new Cx(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}tn.backOff=xx;var Cx=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return zl(this,void 0,void 0,function(){var t,r;return Wl(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 zl(this,void 0,void 0,function(){var t;return Wl(this,function(r){switch(r.label){case 0:return t=wx.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var sc=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 w<"u"?w: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(D){var q=["th","st","nd","rd"],U=D%100;return"["+D+(q[(U-20)%10]||q[U]||q[0])+"]"}},I=function(D,q,U){var H=String(D);return!H||H.length>=q?D:""+Array(q+1-H.length).join(U)+D},_={s:I,z:function(D){var q=-D.utcOffset(),U=Math.abs(q),H=Math.floor(U/60),Q=U%60;return(q<=0?"+":"-")+I(H,2,"0")+":"+I(Q,2,"0")},m:function D(q,U){if(q.date()<U.date())return-D(U,q);var H=12*(U.year()-q.year())+(U.month()-q.month()),Q=q.clone().add(H,c),J=U-Q<0,X=q.clone().add(H+(J?-1:1),c);return+(-(H+(U-Q)/(J?Q-X:X-Q))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:c,y:v,w:u,d:s,D:R,h:a,m:i,s:o,ms:n,Q:g}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},T="en",P={};P[T]=x;var A="$isDayjsObject",O=function(D){return D instanceof V||!(!D||!D[A])},k=function D(q,U,H){var Q;if(!q)return T;if(typeof q=="string"){var J=q.toLowerCase();P[J]&&(Q=J),U&&(P[J]=U,Q=J);var X=q.split("-");if(!Q&&X.length>1)return D(X[0])}else{var W=q.name;P[W]=q,Q=W}return!H&&Q&&(T=Q),Q||!H&&T},N=function(D,q){if(O(D))return D.clone();var U=typeof q=="object"?q:{};return U.date=D,U.args=arguments,new V(U)},M=_;M.l=k,M.i=O,M.w=function(D,q){return N(D,{locale:q.$L,utc:q.$u,x:q.$x,$offset:q.$offset})};var V=function(){function D(U){this.$L=k(U.locale,null,!0),this.parse(U),this.$x=this.$x||U.x||{},this[A]=!0}var q=D.prototype;return q.parse=function(U){this.$d=function(H){var Q=H.date,J=H.utc;if(Q===null)return new Date(NaN);if(M.u(Q))return new Date;if(Q instanceof Date)return new Date(Q);if(typeof Q=="string"&&!/Z$/i.test(Q)){var X=Q.match(y);if(X){var W=X[2]-1||0,te=(X[7]||"0").substring(0,3);return J?new Date(Date.UTC(X[1],W,X[3]||1,X[4]||0,X[5]||0,X[6]||0,te)):new Date(X[1],W,X[3]||1,X[4]||0,X[5]||0,X[6]||0,te)}}return new Date(Q)}(U),this.init()},q.init=function(){var U=this.$d;this.$y=U.getFullYear(),this.$M=U.getMonth(),this.$D=U.getDate(),this.$W=U.getDay(),this.$H=U.getHours(),this.$m=U.getMinutes(),this.$s=U.getSeconds(),this.$ms=U.getMilliseconds()},q.$utils=function(){return M},q.isValid=function(){return this.$d.toString()!==h},q.isSame=function(U,H){var Q=N(U);return this.startOf(H)<=Q&&Q<=this.endOf(H)},q.isAfter=function(U,H){return N(U)<this.startOf(H)},q.isBefore=function(U,H){return this.endOf(H)<N(U)},q.$g=function(U,H,Q){return M.u(U)?this[H]:this.set(Q,U)},q.unix=function(){return Math.floor(this.valueOf()/1e3)},q.valueOf=function(){return this.$d.getTime()},q.startOf=function(U,H){var Q=this,J=!!M.u(H)||H,X=M.p(U),W=function(ve,ge){var we=M.w(Q.$u?Date.UTC(Q.$y,ge,ve):new Date(Q.$y,ge,ve),Q);return J?we:we.endOf(s)},te=function(ve,ge){return M.w(Q.toDate()[ve].apply(Q.toDate("s"),(J?[0,0,0,0]:[23,59,59,999]).slice(ge)),Q)},le=this.$W,_e=this.$M,Ve=this.$D,Fe="set"+(this.$u?"UTC":"");switch(X){case v:return J?W(1,0):W(31,11);case c:return J?W(1,_e):W(0,_e+1);case u:var Me=this.$locale().weekStart||0,Le=(le<Me?le+7:le)-Me;return W(J?Ve-Le:Ve+(6-Le),_e);case s:case R:return te(Fe+"Hours",0);case a:return te(Fe+"Minutes",1);case i:return te(Fe+"Seconds",2);case o:return te(Fe+"Milliseconds",3);default:return this.clone()}},q.endOf=function(U){return this.startOf(U,!1)},q.$set=function(U,H){var Q,J=M.p(U),X="set"+(this.$u?"UTC":""),W=(Q={},Q[s]=X+"Date",Q[R]=X+"Date",Q[c]=X+"Month",Q[v]=X+"FullYear",Q[a]=X+"Hours",Q[i]=X+"Minutes",Q[o]=X+"Seconds",Q[n]=X+"Milliseconds",Q)[J],te=J===s?this.$D+(H-this.$W):H;if(J===c||J===v){var le=this.clone().set(R,1);le.$d[W](te),le.init(),this.$d=le.set(R,Math.min(this.$D,le.daysInMonth())).$d}else W&&this.$d[W](te);return this.init(),this},q.set=function(U,H){return this.clone().$set(U,H)},q.get=function(U){return this[M.p(U)]()},q.add=function(U,H){var Q,J=this;U=Number(U);var X=M.p(H),W=function(_e){var Ve=N(J);return M.w(Ve.date(Ve.date()+Math.round(_e*U)),J)};if(X===c)return this.set(c,this.$M+U);if(X===v)return this.set(v,this.$y+U);if(X===s)return W(1);if(X===u)return W(7);var te=(Q={},Q[i]=t,Q[a]=r,Q[o]=e,Q)[X]||1,le=this.$d.getTime()+U*te;return M.w(le,this)},q.subtract=function(U,H){return this.add(-1*U,H)},q.format=function(U){var H=this,Q=this.$locale();if(!this.isValid())return Q.invalidDate||h;var J=U||"YYYY-MM-DDTHH:mm:ssZ",X=M.z(this),W=this.$H,te=this.$m,le=this.$M,_e=Q.weekdays,Ve=Q.months,Fe=Q.meridiem,Me=function(ge,we,Se,He){return ge&&(ge[we]||ge(H,J))||Se[we].slice(0,He)},Le=function(ge){return M.s(W%12||12,ge,"0")},ve=Fe||function(ge,we,Se){var He=ge<12?"AM":"PM";return Se?He.toLowerCase():He};return J.replace(b,function(ge,we){return we||function(Se){switch(Se){case"YY":return String(H.$y).slice(-2);case"YYYY":return M.s(H.$y,4,"0");case"M":return le+1;case"MM":return M.s(le+1,2,"0");case"MMM":return Me(Q.monthsShort,le,Ve,3);case"MMMM":return Me(Ve,le);case"D":return H.$D;case"DD":return M.s(H.$D,2,"0");case"d":return String(H.$W);case"dd":return Me(Q.weekdaysMin,H.$W,_e,2);case"ddd":return Me(Q.weekdaysShort,H.$W,_e,3);case"dddd":return _e[H.$W];case"H":return String(W);case"HH":return M.s(W,2,"0");case"h":return Le(1);case"hh":return Le(2);case"a":return ve(W,te,!0);case"A":return ve(W,te,!1);case"m":return String(te);case"mm":return M.s(te,2,"0");case"s":return String(H.$s);case"ss":return M.s(H.$s,2,"0");case"SSS":return M.s(H.$ms,3,"0");case"Z":return X}return null}(ge)||X.replace(":","")})},q.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},q.diff=function(U,H,Q){var J,X=this,W=M.p(H),te=N(U),le=(te.utcOffset()-this.utcOffset())*t,_e=this-te,Ve=function(){return M.m(X,te)};switch(W){case v:J=Ve()/12;break;case c:J=Ve();break;case g:J=Ve()/3;break;case u:J=(_e-le)/6048e5;break;case s:J=(_e-le)/864e5;break;case a:J=_e/r;break;case i:J=_e/t;break;case o:J=_e/e;break;default:J=_e}return Q?J:M.a(J)},q.daysInMonth=function(){return this.endOf(c).$D},q.$locale=function(){return P[this.$L]},q.locale=function(U,H){if(!U)return this.$L;var Q=this.clone(),J=k(U,H,!0);return J&&(Q.$L=J),Q},q.clone=function(){return M.w(this.$d,this)},q.toDate=function(){return new Date(this.valueOf())},q.toJSON=function(){return this.isValid()?this.toISOString():null},q.toISOString=function(){return this.$d.toISOString()},q.toString=function(){return this.$d.toUTCString()},D}(),j=V.prototype;return N.prototype=j,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",c],["$y",v],["$D",R]].forEach(function(D){j[D[1]]=function(q){return this.$g(q,D[0],D[1])}}),N.extend=function(D,q){return D.$i||(D(q,V,N),D.$i=!0),N},N.locale=k,N.isDayjs=O,N.unix=function(D){return N(1e3*D)},N.en=P[T],N.Ls=P,N.p={},N})});var Cy=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 w<"u"?w: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 Ey=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 w<"u"?w: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 _=1;_<=24;_+=1)if(y.indexOf(I(_,0,b))>-1){x=_>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(N,M,V){var j=V&&V.toUpperCase();return M||x[V]||e[V]||x[j].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(D,q,U){return q||U.slice(1)})})).match(t),_=I.length,T=0;T<_;T+=1){var P=I[T],A=R[P],O=A&&A[0],k=A&&A[1];I[T]=k?{regex:O,parser:k}:P.replace(/^\[|\]$/g,"")}return function(N){for(var M={},V=0,j=0;V<_;V+=1){var D=I[V];if(typeof D=="string")j+=D.length;else{var q=D.regex,U=D.parser,H=N.slice(j),Q=q.exec(H)[0];U.call(M,Q),N=N.replace(Q,"")}}return function(J){var X=J.afternoon;if(X!==void 0){var W=J.hours;X?W<12&&(J.hours+=12):W===12&&(J.hours=0),delete J.afternoon}}(M),M}}return function(y,b,x){x.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(s=y.parseTwoDigitYear);var I=b.prototype,_=I.parse;I.parse=function(T){var P=T.date,A=T.utc,O=T.args;this.$u=A;var k=O[1];if(typeof k=="string"){var N=O[2]===!0,M=O[3]===!0,V=N||M,j=O[2];M&&(j=O[2]),a=this.$locale(),!N&&j&&(a=x.Ls[j]),this.$d=function(H,Q,J,X){try{if(["x","X"].indexOf(Q)>-1)return new Date((Q==="X"?1e3:1)*H);var W=h(Q)(H),te=W.year,le=W.month,_e=W.day,Ve=W.hours,Fe=W.minutes,Me=W.seconds,Le=W.milliseconds,ve=W.zone,ge=W.week,we=new Date,Se=_e||(te||le?1:we.getDate()),He=te||we.getFullYear(),Ye=0;te&&!le||(Ye=le>0?le-1:we.getMonth());var Lt,xt=Ve||0,Qt=Fe||0,Tt=Me||0,qt=Le||0;return ve?new Date(Date.UTC(He,Ye,Se,xt,Qt,Tt,qt+60*ve.offset*1e3)):J?new Date(Date.UTC(He,Ye,Se,xt,Qt,Tt,qt)):(Lt=new Date(He,Ye,Se,xt,Qt,Tt,qt),ge&&(Lt=X(Lt).week(ge).toDate()),Lt)}catch{return new Date("")}}(P,k,A,x),this.init(),j&&j!==!0&&(this.$L=this.locale(j).$L),V&&P!=this.format(k)&&(this.$d=new Date("")),a={}}else if(k instanceof Array)for(var D=k.length,q=1;q<=D;q+=1){O[1]=k[q-1];var U=x.apply(this,O);if(U.isValid()){this.$d=U.$d,this.$L=U.$L,this.init();break}q===D&&(this.$d=new Date(""))}else _.call(this,T)}}})});var Av=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 w<"u"?w: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",_=b+"|"+I,T=t[_];return T||(T=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[_]=T),T}(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,_=e[x];_>=0&&(h[_]=parseInt(I,10))}var T=h[3],P=T===24?0:T,A=h[0]+"-"+h[1]+"-"+h[2]+" "+P+":"+h[4]+":"+h[5]+":000",O=+g;return(o.utc(A).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 _=function(O,k,N){var M=O-60*k*1e3,V=s(M,N);if(k===V)return[M,k];var j=s(M-=60*(V-k)*1e3,N);return V===j?[M,V]:[O-60*Math.min(V,j)*1e3,Math.max(V,j)]}(x,b,y),T=_[0],P=_[1],A=o(T).utcOffset(P);return A.$x.$timezone=y,A},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var wv=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 w<"u"?w: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(T){T===void 0&&(T="");var P=T.match(t);if(!P)return null;var A=(""+P[0]).match(r)||["-",0,0],O=A[0],k=60*+A[1]+ +A[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 _=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(I=this.local().add(x+_,e)).$offset=x,I.$x.$localOffset=_,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 yA=Ze((wle,hA)=>{"use strict";m();d();f();p();function WP(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}hA.exports=KP;function KP(e,t,r){var n=r&&r.stringify||WP,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 CA=Ze((Ile,fl)=>{"use strict";m();d();f();p();var vA=yA();fl.exports=wr;var Ca=lN().console||{},YP={mapHttpRequest:pl,mapHttpResponse:pl,wrapRequestSerializer:Mf,wrapResponseSerializer:Mf,wrapErrorSerializer:Mf,req:pl,res:pl,err:bA,errWithCause:bA};function Zr(e,t){return e==="silent"?1/0:t.levels.values[e]}var jf=Symbol("pino.logFuncs"),Lf=Symbol("pino.hierarchy"),XP={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function SA(e,t){let r={logger:t,parent:e[Lf]};t[Lf]=r}function ZP(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Ca[o]||Ca[XP[o]||"log"]||ri}),e[jf]=n}function JP(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function wr(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||Ca;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=JP(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),ZP(c,s,r),SA({},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:sN(e),messageKey:e.messageKey||"msg",onChild:e.onChild||ri};c.levels=eN(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 Zr(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 _=I.serializers;if(o&&_){var T=Object.assign({},n,_),P=e.browser.serialize===!0?Object.keys(T):o;delete x.serializers,Uf([x],P,T,this._stdErrSerialize)}function A(k){this._childLevel=(k._childLevel|0)+1,this.bindings=x,T&&(this.serializers=T,this._serialize=P),t&&(this._logEvent=qf([].concat(k._logEvent.bindings,x)))}A.prototype=this;let O=new A(this);return SA(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 eN(e){let t=e.customLevels||{},r=Object.assign({},wr.levels.values,t),n=Object.assign({},wr.levels.labels,tN(t));return{values:r,labels:n}}function tN(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}wr.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"}};wr.stdSerializers=YP;wr.stdTimeFunctions=Object.assign({},{nullTime:wA,epochTime:xA,unixTime:cN,isoTime:uN});function rN(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:Zr(e.level,r)>Zr(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=Zr(i,r);if(Zr(n,r)<a)return}e[n]=oN(e,t,r,n);let o=rN(e);o.length!==0&&(e[n]=nN(o,e[n]))}function nN(e,t){return function(){return t.apply(this,[...e,...arguments])}}function oN(e,t,r,n){return function(o){return function(){let a=t.timestamp(),s=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Ca?Ca: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=iN(this,n,s,a,t);if(t.reportCaller&&v&&v.length>0&&v[0]&&typeof v[0]=="object")try{let R=AA();R&&(v[0].caller=R)}catch{}o.call(u,...v)}else{if(t.reportCaller)try{let v=AA();v&&s.push(v)}catch{}o.apply(u,s)}if(t.transmit){let v=t.transmit.level||e._level,R=Zr(v,r),h=Zr(n,r);if(h<R)return;aN(this,{ts:a,methodLevel:n,methodValue:h,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Zr(e._level,r)},s,g)}}}(e[jf][n])}function iN(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?vA(s.shift(),s):void 0}else typeof u=="string"&&(u=vA(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]=wr.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 aN(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 bA(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 sN(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?wA:xA}function pl(){return{}}function Mf(e){return e}function ri(){}function wA(){return!1}function xA(){return Date.now()}function cN(){return Math.round(Date.now()/1e3)}function uN(){return new Date(Date.now()).toISOString()}function lN(){function e(t){return typeof t<"u"&&t}try{return typeof w<"u"?w:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),w)}catch{return e(self)||e(window)||e(this)||{}}}fl.exports.default=wr;fl.exports.pino=wr;function AA(){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 lF={};li(lF,{DefaultFieldsToInclude:()=>Hf,EcommerceDefaultFieldsToInclude:()=>pw,HighlightUtils:()=>Ul,MinimumFieldsToInclude:()=>Cl,ResultTemplatesHelpers:()=>$y,buildContext:()=>FA,buildController:()=>Jr,buildDictionaryFieldContext:()=>DA,buildInteractiveResult:()=>cw,buildRecommendationEngine:()=>OA,buildRecommendationList:()=>aw,buildResultTemplatesManager:()=>gw,getAnalyticsNextApiBaseUrl:()=>qa,getOrganizationEndpoint:()=>_t,getSampleRecommendationEngineConfiguration:()=>Vf,loadAdvancedSearchQueryActions:()=>KN,loadClickAnalyticsActions:()=>aF,loadConfigurationActions:()=>YN,loadContextActions:()=>ZN,loadDebugActions:()=>JN,loadDictionaryFieldContextActions:()=>eF,loadFieldActions:()=>nF,loadPaginationActions:()=>Qf,loadPipelineActions:()=>oF,loadRecommendationActions:()=>iF,loadSearchConfigurationActions:()=>XN,loadSearchHubActions:()=>uF});module.exports=Cw(lF);m();d();f();p();var Ul={};li(Ul,{escapeHtml:()=>Xn,getHighlightedSuggestion:()=>Jw,highlightString:()=>Zw});m();d();f();p();m();d();f();p();function Hw(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 Hw(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 zw(e){return e===null}function ce(e){return Je(e)||zw(e)}var me=class{constructor(e={}){ue(this,"value");this.value=new qe(e)}validate(e){let t=this.value.validate(e);return t||(Ww(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function Ww(e){return Je(e)||sm(e)}function sm(e){return typeof e=="boolean"}var oe=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||(Kw(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 Kw(e){return Je(e)||cm(e)}function cm(e){return typeof e=="number"&&!Number.isNaN(e)}var Yw=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,z=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(!Fa(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&&!(Yw.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 Fa(e){return Object.prototype.toString.call(e)==="[object String]"}var ne=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(!um(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 um(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 sm(e)||Fa(e)||cm(e)||um(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function lm(e){return Array.isArray(e)}var Ll=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 dm(e){return Array.isArray(e)}function Da(e){return e.trim()===""}var Xw=new Set(["1",1,"yes",!0]);function ql(){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=>Xw.has(r))}function pm(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 Ma(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 Zw(e){if(Da(e.openingDelimiter)||Da(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(ce(e.content)||Da(e.content))return e.content;if(e.highlights.length===0)return Yn(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+=Yn(e.content.slice(n,a)),r+=e.openingDelimiter,r+=Yn(e.content.slice(a,s)),r+=e.closingDelimiter,n=s}return n!==t&&(r+=Yn(e.content.slice(n))),r}function Jw(e,t){return e=Yn(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?jl(n,t.notMatchDelimiters):o?jl(o,t.exactMatchDelimiters):i?jl(i,t.correctionDelimiters):r)}function jl(e,t){return t?t.open+e+t.close:e}function Yn(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 Cm=jt(bm(),1);m();d();f();p();var Ht=new Error("Failed to load reducers."),Xn=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."}},rn=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 Am(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function wm(e){return typeof e!="object"||!e?!1:Object.values(e).every(Ex)}function Ex(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function xm(e){return e===429}var Ut=class e{static call(t){return _asyncToGenerator(function*(){let r=Rx(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(xm(u.status))throw u;return u});return function s(){return _ref.apply(this,arguments)}}();try{let u=yield(0,Cm.backOff)(s,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(c){let g=c&&xm(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 Xn;case 404:throw new rn(i,u.status);default:return n.info({response:u,requestInfo:o},"Platform response"),u}}catch(u){return u.message==="Failed to fetch"?new rn(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 _t(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Zn(e,t,r="prod"){return e??_t(t,r)}function xr(e,t="prod"){return`${_t(e,t)}/rest/search/v2`}function qa(e,t="prod"){return`${_t(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function Rx(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,s=e.method==="POST"||e.method==="PUT",u=Ix(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(s&&{body:u}),signal:a}}function Ix(e,t){return t==="application/x-www-form-urlencoded"?wm(e)?Am(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();var ja=e=>e;m();d();f();p();m();d();f();p();function Ua(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function zt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Ua(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Ua(),extendedResults:{},searchAction:void 0}}m();d();f();p();function Cr(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Er=e=>{let{response:t}=e;return t.body?Tx(e):_x(t)},Tx=e=>Ox(e)?Px(e):kx(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},_x=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function kx(e){return e.body.statusCode!==void 0}function Ox(e){return e.body.exception!==void 0}var Px=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();var Rr=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 Em(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 Rm=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Ut.call({...sr(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Cr(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Em(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return Nx(a)?{success:a}:{error:Er({response:r,body:a})}});return function Rm(_x3,_x4){return _ref3.apply(this,arguments)}}();function Nx(e){return typeof e=="string"}m();d();f();p();function Fx(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function Dx(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Va(e,t){if(t&&e.name==="AbortError")return{error:Dx(e)};if(e instanceof rn)return{error:Fx(e)};throw e}var Ga=class{constructor(t){ue(this,"options",t);ue(this,"apiCallsQueues",{unknown:new Rr,mainSearch:new Rr,facetValues:new Rr,foldingCollection:new Rr,instantResults:new Rr})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json","/plan"),requestParams:Cr(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return Va(r);let n=yield r.json();return Lx(n)?{success:n}:{error:Er({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:Cr(t),..._this3.options});if(r instanceof Error)return Va(r);let n=yield r.json(),o={response:r,body:n};return Mx(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:Er(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:Cr(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 Va(o,r?.disableAbortWarning);let i=yield o.json(),a={response:o,body:i};return Im(i)?(a.body=Tm(i),{success:(yield _this4.options.postprocessSearchResponseMiddleware(a)).body}):{error:Er(a)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json","/facet"),requestParams:Cr(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:Cr(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if(Im(n)){let o={response:r,body:n};return o.body=Tm(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:Er({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return Rm(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 qx(n)?{success:n}:{error:Er({response:r,body:n})}})()}},Ba=e=>e.success!==void 0,vt=e=>e.error!==void 0;function Im(e){return e.results!==void 0}function Tm(e){let t=Ua();return ce(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function Mx(e){return e.completions!==void 0}function Lx(e){return e.preprocessingOutput!==void 0}function qx(e){return e.fields!==void 0}m();d();f();p();var _m=e=>e,km=e=>e,Om=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 jx=typeof Symbol=="function"&&Symbol.observable||"@@observable",Pm=jx,Kl=()=>Math.random().toString(36).substring(7).split("").join("."),Ux={INIT:`@@redux/INIT${Kl()}`,REPLACE:`@@redux/REPLACE${Kl()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Kl()}`},$a=Ux;function Wt(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 Yl(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(Yl)(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 _=s++;return a.set(_,x),function(){if(I){if(u)throw new Error(et(6));I=!1,c(),a.delete(_),i=null}}}function R(x){if(!Wt(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(_=>{_()}),x}function h(x){if(typeof x!="function")throw new Error(et(10));n=x,R({type:$a.REPLACE})}function y(){let x=v;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(et(11));function _(){let P=I;P.next&&P.next(g())}return _(),{unsubscribe:x(_)}},[Pm](){return this}}}return R({type:$a.INIT}),{dispatch:R,subscribe:v,getState:g,replaceReducer:h,[Pm]:y}}function Vx(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:$a.INIT})>"u")throw new Error(et(12));if(typeof r(void 0,{type:$a.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(et(13))})}function Jn(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{Vx(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 Nm(...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 Wt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var id=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",Jl="configurable",Wa="enumerable",Ha="writable",wi="value",mt=e=>!!e&&!!e[Ke];function lt(e){return e?Vm(e)||Ti(e)||!!e[bi]||!!e[Ai]?.[bi]||_i(e)||ki(e):!1}var Gx=Ct[Ri][Ai].toString(),Fm=new WeakMap;function Vm(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=Fm.get(r);return n===void 0&&(n=Function.toString.call(r),Fm.set(r,n)),n===Gx}function Gm(e){return mt(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:ki(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],Ka=(e,t,r,n=an(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function Bx(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ti=Array.isArray,_i=e=>e instanceof Map,ki=e=>e instanceof Set,to=e=>typeof e=="object",nn=e=>typeof e=="function",Xl=e=>typeof e=="boolean";function $x(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Qx=e=>to(e)?e?.[Ke]:null,ur=e=>e.copy_||e.base_;var ad=e=>e.modified_?e.copy_:e.base_;function ed(e,t){if(_i(e))return new Map(e);if(ki(e))return new Set(e);if(Ti(e))return Array[Ri].slice.call(e);let r=Vm(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[Ha]===!1&&(s[Ha]=!0,s[Jl]=!0),(s.get||s.set)&&(n[a]={[Jl]:!0,[Ha]:!0,[Wa]:s[Wa],[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 sd(e,t=!1){return ts(e)||mt(e)||!lt(e)||(an(e)>1&&Ct.defineProperties(e,{set:Qa,add:Qa,clear:Qa,delete:Qa}),Ct.freeze(e),t&&Ii(e,(r,n)=>{sd(n,!0)},!1)),e}function Hx(){tt(2)}var Qa={[wi]:Hx};function ts(e){return e===null||!to(e)?!0:Ct.isFrozen(e)}var Ya="MapSet",Xa="Patches",Dm="ArrayMethods",Za={};function sn(e){let t=Za[e];return t||tt(0,e),t}var Mm=e=>!!Za[e];function zx(e,t){Za[e]||(Za[e]=t)}var xi,Bm=()=>xi,Wx=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Mm(Ya)?sn(Ya):void 0,arrayMethodsPlugin_:Mm(Dm)?sn(Dm):void 0});function Lm(e,t){t&&(e.patchPlugin_=sn(Xa),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function td(e){rd(e),e.drafts_.forEach(Kx),e.drafts_=null}function rd(e){e===xi&&(xi=e.parent_)}var qm=e=>xi=Wx(xi,e);function Kx(e){let t=e[Ke];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function jm(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[Ke].modified_&&(td(t),tt(4)),lt(e)&&(e=Um(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[Ke].base_,e,t)}else e=Um(t,r);return Yx(t,e,!0),td(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==id?e:void 0}function Um(e,t){if(ts(t))return t;let r=t[Ke];if(!r)return Ja(t,e.handledSet_,e);if(!rs(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);Hm(r,e)}return r.copy_}function Yx(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&sd(t,r)}function $m(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var rs=(e,t)=>e.scope_===t,Xx=[];function Qm(e,t,r,n){let o=ur(e),i=e.type_;if(n!==void 0&&cr(o,n,i)===t){Ka(o,n,r,i);return}if(!e.draftLocations_){let s=e.draftLocations_=new Map;Ii(o,(u,c)=>{if(mt(c)){let g=s.get(c)||[];g.push(u),s.set(c,g)}})}let a=e.draftLocations_.get(t)??Xx;for(let s of a)Ka(o,s,r,i)}function Zx(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!rs(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let a=ad(i);Qm(e,i.draft_??i,a,r),Hm(i,o)})}function Hm(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)}$m(e)}}function Jx(e,t,r){let{scope_:n}=e;if(mt(r)){let o=r[Ke];rs(o,n)&&o.callbacks_.push(function(){za(e);let a=ad(o);Qm(e,r,a,t)})}else lt(r)&&e.callbacks_.push(function(){let i=ur(e);e.type_===3?i.has(r)&&Ja(r,n.handledSet_,n):cr(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Ja(cr(e.copy_,t,e.type_),n.handledSet_,n)})}function Ja(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||mt(e)||t.has(e)||!lt(e)||ts(e)||(t.add(e),Ii(e,(n,o)=>{if(mt(o)){let i=o[Ke];if(rs(i,r)){let a=ad(i);Ka(e,n,a,e.type_),$m(i)}}else lt(o)&&Ja(o,t,r)})),e}function eC(e,t){let r=Ti(e),n={type_:r?1:0,scope_:t?t.scope_:Bm(),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=es;r&&(o=[n],i=Ci);let{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,[s,n]}var es={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 rC(e,o,t);let i=o[t];if(e.finalized_||!lt(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&$x(t))return i;if(i===Zl(e.base_,t)||tC(e,t,i)){za(e);let a=e.type_===1?+t:t,s=od(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=Zl(ur(e),t),i=o?.[Ke];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(Bx(r,o)&&(r!==void 0||eo(e.base_,t,e.type_)))return!0;za(e),nd(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),Jx(e,t,r)),!0},deleteProperty(e,t){return za(e),Zl(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),nd(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&&{[Ha]:!0,[Jl]:e.type_!==1||t!=="length",[Wa]:n[Wa],[wi]:r[t]}},defineProperty(){tt(11)},getPrototypeOf(e){return on(e.base_)},setPrototypeOf(){tt(12)}},Ci={};for(let e in es){let t=es[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 es.set.call(this,e[0],t,r,e[0])};function Zl(e,t){let r=e[Ke];return(r?ur(r):e)[t]}function tC(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!lt(r)||r[Ke]?!1:e.baseRefs_.has(r)}function rC(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 nd(e){e.modified_||(e.modified_=!0,e.parent_&&nd(e.parent_))}function za(e){e.copy_||(e.assigned_=new Map,e.copy_=ed(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var nC=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=qm(this),a=od(i,t,void 0),s=!0;try{o=r(a),s=!1}finally{s?td(i):rd(i)}return Lm(i,n),jm(o,i)}else if(!t||!to(t)){if(o=r(t),o===void 0&&(o=t),o===id&&(o=void 0),this.autoFreeze_&&sd(o,!0),n){let i=[],a=[];sn(Xa).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]},Xl(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Xl(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Xl(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){lt(e)||tt(8),mt(e)&&(e=ns(e));let t=qm(this),r=od(t,e,void 0);return r[Ke].isManual_=!0,rd(t),r}finishDraft(e,t){let r=e&&e[Ke];(!r||!r.isManual_)&&tt(9);let{scope_:n}=r;return Lm(n,t),jm(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(Xa).applyPatches_;return mt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function od(e,t,r,n){let[o,i]=_i(t)?sn(Ya).proxyMap_(t,r):ki(t)?sn(Ya).proxySet_(t,r):eC(t,r);return(r?.scope_??Bm()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?Zx(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 ns(e){return mt(e)||tt(10,e),Wm(e)}function Wm(e){if(!lt(e)||ts(e))return e;let t=e[Ke],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=ed(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=ed(e,!0);return Ii(r,(o,i)=>{Ka(r,o,Wm(i))},n),t&&(t.finalized_=!1),r}function Km(){function t(y,b=[]){if(y.key_!==void 0){let x=y.parent_.copy_??y.parent_.base_,I=Qx(cr(x,y.key_)),_=cr(x,y.key_);if(_===void 0||_!==y.draft_&&_!==y.base_&&_!==y.copy_||I!=null&&I.base_!==y.base_)return null;let T=y.parent_.type_===3,P;if(T){let A=y.parent_;P=Array.from(A.drafts_.keys()).indexOf(y.key_)}else P=y.key_;if(!(T&&x.size>P||eo(x,P)))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 _=b[I];if(x=cr(x,_),!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_:_}=x;switch(y.type_){case 0:case 2:return u(y,b,I,_);case 1:return s(y,b,I,_);case 3:return c(y,b,I,_)}}function s(y,b,x,I){let{base_:_,assigned_:T}=y,P=y.copy_;P.length<_.length&&([_,P]=[P,_],[x,I]=[I,x]);let A=y.allIndicesReassigned_===!0;for(let O=0;O<_.length;O++){let k=P[O],N=_[O];if((A||T?.get(O.toString()))&&k!==N){let V=k?.[Ke];if(V&&V.modified_)continue;let j=b.concat([O]);x.push({op:n,path:j,value:h(k)}),I.push({op:n,path:j,value:h(N)})}}for(let O=_.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;_.length<=O;--O){let k=b.concat([O]);I.push({op:i,path:k})}}function u(y,b,x,I){let{base_:_,copy_:T,type_:P}=y;Ii(y.assigned_,(A,O)=>{let k=cr(_,A,P),N=cr(T,A,P),M=O?eo(_,A)?n:o:i;if(k===N&&M===n)return;let V=b.concat(A);x.push(M===i?{op:M,path:V}:{op:M,path:V,value:h(N)}),I.push(M===o?{op:i,path:V}:M===i?{op:o,path:V,value:h(k)}:{op:n,path:V,value:h(k)})})}function c(y,b,x,I){let{base_:_,copy_:T}=y,P=0;_.forEach(A=>{if(!T.has(A)){let O=b.concat([P]);x.push({op:i,path:O,value:A}),I.unshift({op:o,path:O,value:A})}P++}),P=0,T.forEach(A=>{if(!_.has(A)){let O=b.concat([P]);x.push({op:o,path:O,value:A}),I.unshift({op:i,path:O,value:A})}P++})}function g(y,b,x){let{patches_:I,inversePatches_:_}=x;I.push({op:n,path:[],value:b===id?void 0:b}),_.push({op:n,path:[],value:y})}function v(y,b){return b.forEach(x=>{let{path:I,op:_}=x,T=y;for(let k=0;k<I.length-1;k++){let N=an(T),M=I[k];typeof M!="string"&&typeof M!="number"&&(M=""+M),(N===0||N===1)&&(M==="__proto__"||M===Ai)&&tt(19),nn(T)&&M===Ri&&tt(19),T=cr(T,M),(T===null||!to(T))&&tt(18,I.join("/"))}let P=an(T),A=R(x.value),O=I[I.length-1];switch(_){case n:switch(P){case 2:return T.set(O,A);case 3:tt(16);default:return T[O]=A}case o:switch(P){case 1:return O==="-"?T.push(A):T.splice(O,0,A);case 2:return T.set(O,A);case 3:return T.add(A);default:return T[O]=A}case i:switch(P){case 1:return T.splice(O,1);case 2:return T.delete(O);case 3:return T.delete(x.value);default:return delete T[O]}default:tt(17,_)}}),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(ki(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 mt(y)?R(y):y}zx(Xa,{applyPatches_:v,generatePatches_:a,generateReplacementPatches_:g,getPath:t})}var oC=w.Iterator,ML=typeof oC?.from=="function";var Ei=new nC,cn=Ei.produce,cd=Ei.produceWithPatches.bind(Ei);var ud=Ei.applyPatches.bind(Ei);m();d();f();p();var iC=class{constructor(e){this.value=e}deref(){return this.value}},aC=()=>typeof WeakRef>"u"?iC:WeakRef,Xm=aC(),sC=0,os=1;function Oi(){return{s:sC,v:void 0,o:null,p:null}}function cC(e){return e instanceof Xm?e.deref():e}function ro(e,t={}){let r=Oi(),{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=Oi(),s=0)}function R(){let h=r,{length:y}=arguments;for(let I=0,_=y;I<_;I++){let T=arguments[I];if(typeof T=="function"||typeof T=="object"&&T!==null){let P=h.o;P===null&&(h.o=P=new WeakMap);let A=P.get(T);A===void 0?(h=Oi(),P.set(T,h)):h=A}else{let P=h.p;P===null&&(h.p=P=new Map);let A=P.get(T);A===void 0?(h=Oi(),P.set(T,h),s++):h=A}}if(h.s===os)return h.v;if(a!==null){let I=a;for(let _=0,T=y;_<T;_++){let P=arguments[_],A;if(typeof P=="function"||typeof P=="object"&&P!==null){let O=I.o;A=O!==null?O.get(P):void 0}else{let O=I.p;A=O!==null?O.get(P):void 0}if(A===void 0){I=null;break}I=A}if(I!==null&&I.s===os){let _=h;return _.s=os,_.v=I.v,v(),I.v}}let b=h,x=e.apply(null,arguments);if(c++,n){let I=cC(u);I!=null&&n(I,x)&&(x=I,c!==0&&c--),u=typeof x=="object"&&x!==null||typeof x=="function"?new Xm(x):x}return b.s=os,b.v=x,i&&v(),x}return R.clearCache=()=>{r=Oi(),a=null,s=0,R.resetResultsCount()},R.resultsCount=()=>c,R.resetResultsCount=()=>{c=0},R}var ld=Symbol("NOT_FOUND");function uC(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function lC(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 Ym=e=>Array.isArray(e)?e:[e];function dC(e){let t=Array.isArray(e[0])?e[0]:e;return lC(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function is(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()),uC(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);let g={...r,...u},{memoize:v,memoizeOptions:R=[],argsMemoize:h=ro,argsMemoizeOptions:y=[]}=g,b=Ym(R),x=Ym(y),I=dC(o),_=v(function(){return i++,c.apply(null,arguments)},...b),T=!0,P=h(function(){a++;let{length:O}=I,k=new Array(O);for(let N=0;N<O;N++)k[N]=I[N].apply(null,arguments);return s=_.apply(null,k),s},...x);return Object.assign(P,{resultFunc:c,memoizedResultFunc:_,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=is(ro);function pC(e){let t;return{get(r){return t&&e(t.key,r)?t.value:ld},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 fC(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 ld}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 mC=(e,t)=>e===t;function gC(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 dd(e,t){let r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:n=mC,maxSize:o=1,resultEqualityCheck:i}=r,a=gC(n),s=0,u=o<=1?pC(a):fC(o,a);function c(){let g=u.get(arguments);if(g===ld){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 Zm(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var Jm=Zm(),eg=Zm;var hC=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)},iq=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},yC=e=>e&&typeof e.match=="function";function L(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(gt(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 cg=class Pi extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Pi.prototype)}static get[Symbol.species](){return Pi}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Pi(...t[0].concat(this)):new Pi(...t.concat(this))}};function tg(e){return lt(e)?cn(e,()=>{}):e}function as(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function vC(e){return typeof e=="boolean"}var SC=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new cg;return r&&(vC(r)?a.push(Jm):a.push(eg(r.extraArgument))),a},Ni="RTK_autoBatch",io=()=>e=>({payload:e,meta:{[Ni]:!0}}),rg=e=>t=>{setTimeout(t,e)},bC=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(i),clearTimeout(a),r())},i=e(o),a=setTimeout(o,t)},AC=(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?bC(window.requestAnimationFrame,100):rg(10):e.type==="callback"?e.queueNotification:rg(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?.[Ni],i=!o,i&&(a||(a=!0,u(c))),n.dispatch(g)}finally{o=!0}}})},wC=e=>function(r){let{autoBatch:n=!0}=r??{},o=new cg(e);return n&&o.push(AC(typeof n=="object"?n:void 0)),o};function ug(e){let t=SC(),{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(Wt(r))u=Jn(r);else throw new Error(gt(1));let c;typeof n=="function"?c=n(t):c=t();let g=vi;o&&(g=hC({trace:!1,...(typeof o=="object"&&o)}));let v=Nm(...c),R=wC(v),h=typeof s=="function"?s(R):R(),y=g(...h);return Yl(u,a,y)}function lg(e){let t={},r=[],n,o={addCase(i,a){let s=typeof i=="string"?i:i.type;if(!s)throw new Error(gt(28));if(s in t)throw new Error(gt(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 xC(e){return typeof e=="function"}function Be(e,t){let[r,n,o]=lg(t),i;if(xC(e))i=()=>tg(e());else{let s=tg(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(mt(g)){let h=v(g,u);return h===void 0?g:h}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 Error("A case reducer on a non-draftable value must not return undefined")}return R}}return g},s)}return a.getInitialState=i,a}var dg=(e,t)=>yC(e)?e.match(t):e(t);function Kt(...e){return t=>e.some(r=>dg(r,t))}function oo(...e){return t=>e.every(r=>dg(r,t))}function ls(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 Fi(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function ds(...e){return e.length===0?t=>ls(t,["pending"]):Fi(e)?Kt(...e.map(t=>t.pending)):ds()(e[0])}function ln(...e){return e.length===0?t=>ls(t,["rejected"]):Fi(e)?Kt(...e.map(t=>t.rejected)):ln()(e[0])}function Di(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?oo(ln(...e),t):Fi(e)?oo(ln(...e),t):Di()(e[0])}function lr(...e){return e.length===0?t=>ls(t,["fulfilled"]):Fi(e)?Kt(...e.map(t=>t.fulfilled)):lr()(e[0])}function ps(...e){return e.length===0?t=>ls(t,["pending","fulfilled","rejected"]):Fi(e)?Kt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):ps()(e[0])}var CC="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Mi=(e=21)=>{let t="",r=e;for(;r--;)t+=CC[Math.random()*64|0];return t},EC=["name","message","stack","code"],pd=class{constructor(e,t){ue(this,"payload");ue(this,"meta");ue(this,"_type");this.payload=e,this.meta=t}},ng=class{constructor(e,t){ue(this,"payload");ue(this,"meta");ue(this,"_type");this.payload=e,this.meta=t}},RC=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of EC)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},og="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||RC)(u||"Rejected"),meta:{...(R||{}),arg:g,requestId:c,rejectedWithValue:!!v,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):Mi(),y=new l.AbortController,b,x;function I(T){x=T,y.abort()}c&&(c.aborted?I(og):c.addEventListener("abort",()=>I(og),{once:!0}));let _=_asyncToGenerator(function*(){let T;try{let A=n?.condition?.(u,{getState:v,extra:R});if(TC(A)&&(A=yield A),A===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let O=new Promise((k,N)=>{b=()=>{N({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}))),T=yield Promise.race([O,Promise.resolve(r(u,{dispatch:g,getState:v,extra:R,requestId:h,signal:y.signal,abort:I,rejectWithValue:(k,N)=>new pd(k,N),fulfillWithValue:(k,N)=>new ng(k,N)})).then(k=>{if(k instanceof pd)throw k;return k instanceof ng?o(k.payload,h,u,k.meta):o(k,h,u)})])}catch(A){T=A instanceof pd?a(null,h,u,A.payload,A.meta):a(A,h,u)}finally{b&&y.signal.removeEventListener("abort",b)}return n&&!n.dispatchConditionRejection&&a.match(T)&&T.meta.condition||g(T),T})();return Object.assign(_,{abort:I,requestId:h,arg:u,unwrap(){return _.then(IC)}})}}return Object.assign(s,{pending:i,rejected:a,fulfilled:o,settled:Kt(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function IC(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function TC(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var pg=Symbol.for("rtk-slice-createasyncthunk"),sq={[pg]:ke};function _C(e,t){return`${e}/${t}`}function kC({creators:e}={}){let t=e?.asyncThunk?.[pg];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(gt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(PC()):n.reducers)||{},s=Object.keys(a),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(T,P){let A=typeof T=="string"?T:T.type;if(!A)throw new Error(gt(12));if(A in u.sliceCaseReducersByType)throw new Error(gt(13));return u.sliceCaseReducersByType[A]=P,c},addMatcher(T,P){return u.sliceMatchers.push({matcher:T,reducer:P}),c},exposeAction(T,P){return u.actionCreators[T]=P,c},exposeCaseReducer(T,P){return u.sliceCaseReducersByName[T]=P,c}};s.forEach(T=>{let P=a[T],A={reducerName:T,type:_C(o,T),createNotation:typeof n.reducers=="function"};FC(P)?MC(A,P,c,t):NC(A,P,c)});function g(){let[T={},P=[],A=void 0]=typeof n.extraReducers=="function"?lg(n.extraReducers):[n.extraReducers],O={...T,...u.sliceCaseReducersByType};return Be(n.initialState,k=>{for(let N in O)k.addCase(N,O[N]);for(let N of u.sliceMatchers)k.addMatcher(N.matcher,N.reducer);for(let N of P)k.addMatcher(N.matcher,N.reducer);A&&k.addDefaultCase(A)})}let v=T=>T,R=new Map,h=new WeakMap,y;function b(T,P){return y||(y=g()),y(T,P)}function x(){return y||(y=g()),y.getInitialState()}function I(T,P=!1){function A(k){let N=k[T];return typeof N>"u"&&P&&(N=as(h,A,x)),N}function O(k=v){let N=as(R,P,()=>new WeakMap);return as(N,k,()=>{let M={};for(let[V,j]of Object.entries(n.selectors??{}))M[V]=OC(j,k,()=>as(h,k,x),P);return M})}return{reducerPath:T,getSelectors:O,get selectors(){return O(A)},selectSlice:A}}let _={name:o,reducer:b,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:x,...I(i),injectInto(T,{reducerPath:P,...A}={}){let O=P??i;return T.inject({reducerPath:O,reducer:b},A),{..._,...I(O,!0)}}};return _}}function OC(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=kC();function PC(){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 NC({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!DC(n))throw new Error(gt(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 FC(e){return e._reducerDefinitionType==="asyncThunk"}function DC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function MC({type:e,reducerName:t},r,n,o){if(!o)throw new Error(gt(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||ss,pending:s||ss,rejected:u||ss,settled:c||ss})}function ss(){}var LC="task",fg="listener",mg="completed",gd="cancelled",qC=`task-${gd}`,jC=`task-${mg}`,fd=`${fg}-${gd}`,UC=`${fg}-${mg}`,fs=class{constructor(e){ue(this,"code");ue(this,"name","TaskAbortError");ue(this,"message");this.code=e,this.message=`${LC} ${gd} (reason: ${e})`}},hd=(e,t)=>{if(typeof e!="function")throw new TypeError(gt(32))},cs=()=>{},gg=(e,t=cs)=>(e.catch(t),e),hg=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),un=e=>{if(e.aborted)throw new fs(e.reason)};function yg(e,t){let r=cs;return new Promise((n,o)=>{let i=()=>o(new fs(e.reason));if(e.aborted){i();return}r=hg(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=cs})}var VC=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof fs?"cancelled":"rejected",error:r}}finally{t?.()}});return function VC(_x5,_x6){return _ref5.apply(this,arguments)}}(),us=e=>t=>gg(yg(e,t).then(r=>(un(e),r))),vg=e=>{let t=us(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:no}=Object,ig={},ms="listenerMiddleware",GC=(e,t)=>{let r=n=>hg(e,()=>n.abort(e.reason));return(n,o)=>{hd(n,"taskExecutor");let i=new l.AbortController;r(i);let a=VC(/*#__PURE__*/_asyncToGenerator(function*(){un(e),un(i.signal);let s=yield n({pause:us(i.signal),delay:vg(i.signal),signal:i.signal});return un(i.signal),s}),()=>i.abort(jC));return o?.autoJoin&&t.push(a.catch(cs)),{result:us(e)(a),cancel(){i.abort(qC)}}}},BC=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){un(t);let i=()=>{},s=[new Promise((u,c)=>{let g=e({predicate:n,effect:(v,R)=>{R.unsubscribe(),u([v,R.getState(),R.getOriginalState()])}});i=()=>{g(),c()}})];o!=null&&s.push(new Promise(u=>setTimeout(u,o,null)));try{let u=yield yg(t,Promise.race(s));return un(t),u}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>gg(r(n,o))},Sg=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(gt(21));return hd(i,"options.listener"),{predicate:o,type:t,effect:i}},bg=no(e=>{let{type:t,predicate:r,effect:n}=Sg(e);return{id:Mi(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(gt(22))}}},{withTypes:()=>bg}),ag=(e,t)=>{let{type:r,effect:n,predicate:o}=Sg(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},md=e=>{e.pending.forEach(t=>{t.abort(fd)})},$C=(e,t)=>()=>{for(let r of t.keys())md(r);e.clear()},sg=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Ag=no(L(`${ms}/add`),{withTypes:()=>Ag}),QC=L(`${ms}/removeAll`),wg=no(L(`${ms}/remove`),{withTypes:()=>wg}),HC=(...e)=>{console.error(`${ms}/error`,...e)},xg=(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=HC}=e;hd(a,"onError");let s=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&md(h)}),u=h=>{let y=ag(t,h)??bg(h);return s(y)};no(u,{withTypes:()=>u});let c=h=>{let y=ag(t,h);return y&&(y.unsubscribe(),h.cancelActive&&md(y)),!!y};no(c,{withTypes:()=>c});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,b,x){let I=new l.AbortController,_=BC(u,I.signal),T=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(y,no({},b,{getOriginalState:x,condition:(P,A)=>_(P,A).then(Boolean),take:_,delay:vg(I.signal),pause:us(I.signal),extra:i,signal:I.signal,fork:GC(I.signal,T),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((P,A,O)=>{P!==I&&(P.abort(fd),O.delete(P))})},cancel:()=>{I.abort(fd),h.pending.delete(I)},throwIfCancelled:()=>{un(I.signal)}})))}catch(P){P instanceof fs||sg(a,P,{raisedBy:"effect"})}finally{yield Promise.all(T),I.abort(UC),o(h),h.pending.delete(I)}});return function g(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),v=$C(t,r);return{middleware:h=>y=>b=>{if(!Si(b))return y(b);if(Ag.match(b))return u(b.payload);if(QC.match(b)){v();return}if(wg.match(b))return c(b.payload);let x=h.getState(),I=()=>{if(x===ig)throw new Error(gt(23));return x},_;try{if(_=y(b),t.size>0){let T=h.getState(),P=Array.from(t.values());for(let A of P){let O=!1;try{O=A.predicate(b,T,x)}catch(k){O=!1,sg(a,k,{raisedBy:"predicate"})}O&&g(A,b,h,I)}}}finally{x=ig}return _},startListening:u,stopListening:c,clearListeners:v}};function gt(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 z({required:!0,emptyAllowed:!1}),rt=new z({required:!1,emptyAllowed:!1}),nt=new z({required:!0,emptyAllowed:!0}),Sq=new z({required:!1,emptyAllowed:!0}),gs=new Ae({each:Y,required:!0}),Cg=new z({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Eg=new z({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),bq=new z({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),dr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),kt=(e,t)=>{if("required"in t)return{payload:new yt({value:t}).validate({value:e}).value};let o=new ne({options:{required:!0},values:t}).validate(e);if(o)throw new fi(o);return{payload:e}},B=(e,t)=>{try{return kt(e,t)}catch(r){return{payload:e,error:dr(r)}}},Rg=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return Tg(e,t,r,o,"Controller initialization error")},Ig=(e,t,r,n)=>{let o=`Check the options of ${n}`;return Tg(e,t,r,o,"Controller initialization error")},Tg=(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 ao="3.57.1",_g=["@coveo/atomic","@coveo/quantic"];var yd=()=>rt,kg=()=>Y,Ir=L("configuration/updateBasicConfiguration",e=>B(e,{accessToken:rt,environment:new z({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:rt})),Yt=L("configuration/updateSearchConfiguration",e=>B(e,{proxyBaseUrl:new z({required:!1,url:!0}),pipeline:new z({required:!1,emptyAllowed:!0}),searchHub:rt,timezone:rt,locale:rt,authenticationProviders:new Ae({required:!1,each:Y})})),zC={enabled:new me({default:!0}),originContext:yd(),originLevel2:yd(),originLevel3:yd(),proxyBaseUrl:new z({required:!1,url:!0}),runtimeEnvironment:new qe,anonymous:new me({default:!1}),deviceId:rt,userDisplayName:rt,documentLocation:rt,trackingId:Eg,analyticsMode:new z({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new ne({options:{required:!1},values:_g.reduce((e,t)=>(e[t]=Cg,e),{})})},so=L("configuration/updateAnalyticsConfiguration",e=>B(e,zC)),co=L("configuration/analytics/disable"),uo=L("configuration/analytics/enable"),hs=L("configuration/analytics/originlevel2",e=>B(e,{originLevel2:kg()})),ys=L("configuration/analytics/originlevel3",e=>B(e,{originLevel3:kg()})),Og=L("knowledge/setAgentId",e=>B(e,new z({required:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var Pg={q:new z,enableQuerySyntax:new me,aq:new z,cq:new z,firstResult:new oe({min:0}),numberOfResults:new oe({min:0}),sortCriteria:new z,f:new ne,fExcluded:new ne,cf:new ne,nf:new ne,mnf:new ne,df:new ne,debug:new me,sf:new ne,tab:new z,af:new ne};var Tr=L("searchParameters/restore",e=>B(e,Pg)),Ng=L("searchParameters/restoreTab",e=>B(e,Y));m();d();f();p();var vs=L("debug/enable"),Ss=L("debug/disable");m();d();f();p();var bs=()=>!1;var As=Be(bs(),e=>{e.addCase(vs,()=>!0).addCase(Ss,()=>!1).addCase(Tr,(t,r)=>r.payload.debug??t)});m();d();f();p();var lo=L("pipeline/set",e=>B(e,new z({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();var WC=L("history/undo"),KC=L("history/redo"),Xt=L("history/snapshot"),_j=ke("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(WC()),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(KC()),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 _r=()=>"";var po=Be(_r(),e=>{e.addCase(lo,(t,r)=>r.payload).addCase(St.fulfilled,(t,r)=>r.payload?.pipeline??t).addCase(Yt,(t,r)=>r.payload.pipeline||t)});m();d();f();p();m();d();f();p();var ws=L("app/setError");m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function YC(){return typeof navigator<"u"}function Fg(){try{return typeof localStorage<"u"}catch{return!1}}function Dg(){try{return typeof sessionStorage<"u"}catch{return!1}}function Mg(){return YC()&&navigator.cookieEnabled}m();d();f();p();var fo=class e{static set(t,r,n){var o,i,a,s;n&&(i=new Date,i.setTime(i.getTime()+n)),s=window.location.hostname,s.indexOf(".")===-1?Lg(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],Lg(t,r,i,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function Lg(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function qg(){return Fg()?localStorage:Mg()?new xs:Dg()?sessionStorage:new vd}var xs=class e{getItem(t){return fo.get(`${e.prefix}${t}`)}removeItem(t){fo.erase(`${e.prefix}${t}`)}setItem(t,r,n){fo.set(`${e.prefix}${t}`,r,n)}};xs.prefix="coveo_";var vd=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var Cs="__coveo.analytics.history",XC=20,ZC=1e3*60,JC=75,Es=class{constructor(t){this.store=t||qg()}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(Cs);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this1=this;return _asyncToGenerator(function*(){try{let t=yield _this1.store.getItem(Cs);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(Cs,JSON.stringify(t.slice(0,XC)))}catch{}}clear(){try{this.store.removeItem(Cs)}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,JC)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>ZC:!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 pn=class pn extends Es{static getInstance(t){return pn.instance||(pn.instance=new pn(t)),pn.instance}constructor(t){super(t)}};ue(pn,"instance",null);var ht=pn;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@${ao}`));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 G(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 Ad(){return typeof window<"u"}function Fd(){return typeof navigator<"u"}function go(){return typeof document<"u"}function wd(){try{return typeof localStorage<"u"}catch{return!1}}function eE(){try{return typeof sessionStorage<"u"}catch{return!1}}function Xg(){return Fd()&&navigator.cookieEnabled}var tE=[Ce.click,Ce.custom,Ce.search,Ce.view],rE=(e,t)=>tE.indexOf(e)!==-1?Object.assign({language:go()?document.documentElement.lang:"unknown",userAgent:Fd()?navigator.userAgent:"unknown"},t):t,qi=class e{static set(t,r,n){var o,i,a,s;n&&(i=new Date,i.setTime(i.getTime()+n)),s=window.location.hostname,s.indexOf(".")===-1?jg(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],jg(t,r,i,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function jg(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function nE(){return wd()?localStorage:Xg()?new ji:eE()?sessionStorage:new yo}var ji=class e{getItem(t){return qi.get(`${e.prefix}${t}`)}removeItem(t){qi.erase(`${e.prefix}${t}`)}setItem(t,r,n){qi.set(`${e.prefix}${t}`,r,n)}};ji.prefix="coveo_";var xd=class{constructor(){this.cookieStorage=new ji}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)}},yo=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Rs="__coveo.analytics.history",oE=20,iE=1e3*60,aE=75,Ts=class{constructor(t){this.store=t||nE()}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 G(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 G(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(Rs);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return G(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(Rs);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Rs,JSON.stringify(t.slice(0,oE)))}catch{}}clear(){try{this.store.removeItem(Rs)}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,aE)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>iE:!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 sE=(e,t)=>G(void 0,void 0,void 0,function*(){return e===Ce.view?(yield cE(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),cE=e=>G(void 0,void 0,void 0,function*(){let t=new Ts,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),uE=/^(?:[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 _s(e){return typeof e=="string"&&uE.test(e)}function Ug(e){if(!_s(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 Zg(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 lE=new Uint8Array(16);function dE(){return crypto.getRandomValues(lE)}function pE(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 fE="6ba7b810-9dad-11d1-80b4-00c04fd430c8",mE="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function gE(e,t,r,n,o,i){let a=typeof r=="string"?pE(r):r,s=typeof n=="string"?Ug(n):n;if(typeof n=="string"&&(n=Ug(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,Zg(u)}function fn(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():hE(e,t,r)}function hE(e,t,r){e=e||{};let n=e.random??e.rng?.()??dE();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 Zg(n)}function yE(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 Sd(e,t){return e<<t|e>>>32-t}function vE(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]=Sd(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=Sd(c,5)+yE(b,g,v,R)+h+t[b]+u[y]>>>0;h=R,R=v,v=Sd(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 ks(e,t,r,n){return gE(80,vE,e,t)}ks.DNS=fE;ks.URL=mE;var Jg="2.33.0",Vg=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Li={pageview:"pageview",event:"event"},Os=class{constructor({client:t,uuidGenerator:r=fn}){this.client=t,this.uuidGenerator=r}},Cd=class extends Os{constructor({client:t,uuidGenerator:r=fn}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=Vg(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===Li.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===Li.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Li.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Li.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 Vg(window.location)}},kr=class e{constructor(t,r){if(!_s(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 _s(i)?new e(i,Number.parseInt(o)*1e3):null}};kr.cvo_cid="cvo_cid";kr.expirationTime=120;var Ed=class extends Os{constructor({client:t,uuidGenerator:r=fn}){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 G(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(kr.cvo_cid,new kr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Ed.Id="link";var Pt=Object.keys;function Is(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var bd=128,eh=192,Gg=224,Bg=240;function SE(e){return(e&248)===Bg?4:(e&Bg)===Gg?3:(e&Gg)===eh?2:1}function bE(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&bd)!=bd)break;if(r-=3,(n&eh)!=bd){t-r>=SE(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"},AE=Pt(Rd).map(e=>Rd[e]),wE=[...AE].join("|"),xE=new RegExp(`^(${wE}$)`),CE={svcAction:"svc_action",svcActionData:"svc_action_data"},EE=e=>Pt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=Rd[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),RE=e=>xE.test(e),IE=[RE],$g={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Qg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},dt={action:"pa",list:"pal",listSource:"pls"},Ps={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},TE=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Id={id:"quoteId",affiliation:"quoteAffiliation"},Td={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},_E={add:dt,bookmark_add:dt,bookmark_remove:dt,click:dt,checkout:dt,checkout_option:dt,detail:dt,impression:dt,remove:dt,refund:Object.assign(Object.assign({},dt),Ps),purchase:Object.assign(Object.assign({},dt),Ps),quickview:dt,quote:Object.assign(Object.assign({},dt),Id),review:Object.assign(Object.assign({},dt),Td)},kE=Pt($g).map(e=>$g[e]),OE=Pt(Qg).map(e=>Qg[e]),PE=Pt(dt).map(e=>dt[e]),NE=Pt(Ps).map(e=>Ps[e]),FE=Pt(Td).map(e=>Td[e]),DE=Pt(Id).map(e=>Id[e]),ME=[...kE,"custom"].join("|"),LE=[...OE,"custom"].join("|"),th="(pr[0-9]+)",rh="(il[0-9]+pi[0-9]+)",qE=new RegExp(`^${th}(${ME})$`),jE=new RegExp(`^(${rh}(${LE}))|(il[0-9]+nm)$`),UE=new RegExp(`^(${PE.join("|")})$`),VE=new RegExp(`^(${NE.join("|")})$`),GE=new RegExp(`^${th}custom$`),BE=new RegExp(`^${rh}custom$`),$E=new RegExp(`^(${[...TE,...FE,...DE].join("|")})$`),QE=e=>qE.test(e),HE=e=>jE.test(e),zE=e=>UE.test(e),WE=e=>VE.test(e),KE=e=>$E.test(e),YE=[HE,QE,zE,WE,KE],XE=[GE,BE],ZE={anonymizeIp:"aip"},JE={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},eR={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},tR=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],rR=Object.assign(Object.assign(Object.assign(Object.assign({},ZE),JE),eR),tR.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),_d=Object.assign(Object.assign({},rR),CE),nR=e=>{let t=!!e.action&&_E[e.action]||{};return Pt(e).reduce((r,n)=>{let o=t[n]||_d[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},oR=Pt(_d).map(e=>_d[e]),iR=e=>oR.indexOf(e)!==-1,aR=e=>e==="custom",sR=e=>[...YE,...IE,iR,aR].some(t=>t(e)),cR=e=>Pt(e).reduce((t,r)=>{let n=uR(r);return n?Object.assign(Object.assign({},t),lR(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),uR=e=>{let t;return[...XE].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},lR=(e,t)=>Pt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),kd=class{constructor(t){this.opts=t}sendEvent(t,r){return G(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 G(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 G(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 G(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return G(this,void 0,void 0,function*(){return Promise.resolve()})}},Hg=w.fetch,Ns=class{constructor(t){this.opts=t}sendEvent(t,r){return G(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 Hg(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 G(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield Hg(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[Ce.click,Ce.custom,Ce.search,Ce.view].indexOf(t)!==-1}getVisitorIdParam(){return G(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){wd()&&Xg()?this.storage=new xd:wd()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new yo),this.client=new Ns(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 yo,this.client=new Ns(t)}getClientDependingOnEventType(t){return this.client}},Fs=class{constructor(){this.storage=new yo,this.client=new Od}getClientDependingOnEventType(t){return this.client}},dR="xx",pR=e=>e?.startsWith(dR)||!1,fR=`
|
|
27
|
+
`;return new mi(r)}var mi=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 Hw(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 zw(e){return e===null}function ce(e){return Je(e)||zw(e)}var me=class{constructor(e={}){ue(this,"value");this.value=new qe(e)}validate(e){let t=this.value.validate(e);return t||(Ww(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function Ww(e){return Je(e)||um(e)}function um(e){return typeof e=="boolean"}var oe=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||(Kw(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 Kw(e){return Je(e)||lm(e)}function lm(e){return typeof e=="number"&&!Number.isNaN(e)}var Yw=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,z=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(!Fa(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&&!(Yw.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 Fa(e){return Object.prototype.toString.call(e)==="[object String]"}var ne=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(!dm(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 dm(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 um(e)||Fa(e)||lm(e)||dm(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function pm(e){return Array.isArray(e)}var Ll=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 fm(e){return Array.isArray(e)}function Da(e){return e.trim()===""}var Xw=new Set(["1",1,"yes",!0]);function ql(){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=>Xw.has(r))}function mm(e){let t={};for(let[r,n]of e)t[r]=n;return t}function gi(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Ma(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 Zw(e){if(Da(e.openingDelimiter)||Da(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(ce(e.content)||Da(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 Jw(e,t){return e=Xn(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?jl(n,t.notMatchDelimiters):o?jl(o,t.exactMatchDelimiters):i?jl(i,t.correctionDelimiters):r)}function jl(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 Rm=jt(wm(),1);m();d();f();p();var Ht=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."}},rn=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 xm(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function Cm(e){return typeof e!="object"||!e?!1:Object.values(e).every(Ex)}function Ex(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Em(e){return e===429}var Ut=class e{static call(t){return _asyncToGenerator(function*(){let r=Rx(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(Em(u.status))throw u;return u});return function s(){return _ref.apply(this,arguments)}}();try{let u=yield(0,Rm.backOff)(s,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(c){let g=c&&Em(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 rn(i,u.status);default:return n.info({response:u,requestInfo:o},"Platform response"),u}}catch(u){return u.message==="Failed to fetch"?new rn(i):u}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:s,...u}=t,c=gi(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 _t(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??_t(t,r)}function xr(e,t="prod"){return`${_t(e,t)}/rest/search/v2`}function qa(e,t="prod"){return`${_t(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function Rx(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,s=e.method==="POST"||e.method==="PUT",u=Ix(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(s&&{body:u}),signal:a}}function Ix(e,t){return t==="application/x-www-form-urlencoded"?Cm(e)?xm(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();var ja=e=>e;m();d();f();p();m();d();f();p();function Ua(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function zt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Ua(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Ua(),extendedResults:{},searchAction:void 0}}m();d();f();p();function Cr(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Er=e=>{let{response:t}=e;return t.body?Tx(e):_x(t)},Tx=e=>Ox(e)?Px(e):kx(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},_x=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function kx(e){return e.body.statusCode!==void 0}function Ox(e){return e.body.exception!==void 0}var Px=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();var Rr=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 vi=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 Im(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 vi(`${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 Tm=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Ut.call({...sr(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Cr(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Im(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return Nx(a)?{success:a}:{error:Er({response:r,body:a})}});return function Tm(_x3,_x4){return _ref3.apply(this,arguments)}}();function Nx(e){return typeof e=="string"}m();d();f();p();function Fx(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function Dx(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Va(e,t){if(t&&e.name==="AbortError")return{error:Dx(e)};if(e instanceof rn)return{error:Fx(e)};throw e}var Ga=class{constructor(t){ue(this,"options",t);ue(this,"apiCallsQueues",{unknown:new Rr,mainSearch:new Rr,facetValues:new Rr,foldingCollection:new Rr,instantResults:new Rr})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json","/plan"),requestParams:Cr(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return Va(r);let n=yield r.json();return Lx(n)?{success:n}:{error:Er({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:Cr(t),..._this3.options});if(r instanceof Error)return Va(r);let n=yield r.json(),o={response:r,body:n};return Mx(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:Er(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:Cr(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 Va(o,r?.disableAbortWarning);let i=yield o.json(),a={response:o,body:i};return _m(i)?(a.body=km(i),{success:(yield _this4.options.postprocessSearchResponseMiddleware(a)).body}):{error:Er(a)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json","/facet"),requestParams:Cr(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:Cr(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if(_m(n)){let o={response:r,body:n};return o.body=km(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:Er({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return Tm(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 qx(n)?{success:n}:{error:Er({response:r,body:n})}})()}},Ba=e=>e.success!==void 0,vt=e=>e.error!==void 0;function _m(e){return e.results!==void 0}function km(e){let t=Ua();return ce(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function Mx(e){return e.completions!==void 0}function Lx(e){return e.preprocessingOutput!==void 0}function qx(e){return e.fields!==void 0}m();d();f();p();var Om=e=>e,Pm=e=>e,Nm=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 jx=typeof Symbol=="function"&&Symbol.observable||"@@observable",Fm=jx,Kl=()=>Math.random().toString(36).substring(7).split("").join("."),Ux={INIT:`@@redux/INIT${Kl()}`,REPLACE:`@@redux/REPLACE${Kl()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Kl()}`},$a=Ux;function Wt(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 Yl(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(Yl)(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 _=s++;return a.set(_,x),function(){if(I){if(u)throw new Error(et(6));I=!1,c(),a.delete(_),i=null}}}function R(x){if(!Wt(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(_=>{_()}),x}function h(x){if(typeof x!="function")throw new Error(et(10));n=x,R({type:$a.REPLACE})}function y(){let x=v;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(et(11));function _(){let P=I;P.next&&P.next(g())}return _(),{unsubscribe:x(_)}},[Fm](){return this}}}return R({type:$a.INIT}),{dispatch:R,subscribe:v,getState:g,replaceReducer:h,[Fm]:y}}function Vx(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:$a.INIT})>"u")throw new Error(et(12));if(typeof r(void 0,{type:$a.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(et(13))})}function eo(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{Vx(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 Si(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Dm(...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=Si(...s)(o.dispatch),{...o,dispatch:i}}}function bi(e){return Wt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var id=Symbol.for("immer-nothing"),Ai=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,wi="constructor",Ii="prototype",Jl="configurable",Wa="enumerable",Ha="writable",xi="value",mt=e=>!!e&&!!e[Ke];function lt(e){return e?Bm(e)||_i(e)||!!e[Ai]||!!e[wi]?.[Ai]||ki(e)||Oi(e):!1}var Gx=Ct[Ii][wi].toString(),Mm=new WeakMap;function Bm(e){if(!e||!ro(e))return!1;let t=on(e);if(t===null||t===Ct[Ii])return!0;let r=Ct.hasOwnProperty.call(t,wi)&&t[wi];if(r===Object)return!0;if(!nn(r))return!1;let n=Mm.get(r);return n===void 0&&(n=Function.toString.call(r),Mm.set(r,n)),n===Gx}function $m(e){return mt(e)||tt(15,e),e[Ke].base_}function Ti(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_:_i(e)?1:ki(e)?2:Oi(e)?3:0}var to=(e,t,r=an(e))=>r===2?e.has(t):Ct[Ii].hasOwnProperty.call(e,t),cr=(e,t,r=an(e))=>r===2?e.get(t):e[t],Ka=(e,t,r,n=an(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function Bx(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var _i=Array.isArray,ki=e=>e instanceof Map,Oi=e=>e instanceof Set,ro=e=>typeof e=="object",nn=e=>typeof e=="function",Xl=e=>typeof e=="boolean";function $x(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Qx=e=>ro(e)?e?.[Ke]:null,ur=e=>e.copy_||e.base_;var ad=e=>e.modified_?e.copy_:e.base_;function ed(e,t){if(ki(e))return new Map(e);if(Oi(e))return new Set(e);if(_i(e))return Array[Ii].slice.call(e);let r=Bm(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[Ha]===!1&&(s[Ha]=!0,s[Jl]=!0),(s.get||s.set)&&(n[a]={[Jl]:!0,[Ha]:!0,[Wa]:s[Wa],[xi]: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 sd(e,t=!1){return ts(e)||mt(e)||!lt(e)||(an(e)>1&&Ct.defineProperties(e,{set:Qa,add:Qa,clear:Qa,delete:Qa}),Ct.freeze(e),t&&Ti(e,(r,n)=>{sd(n,!0)},!1)),e}function Hx(){tt(2)}var Qa={[xi]:Hx};function ts(e){return e===null||!ro(e)?!0:Ct.isFrozen(e)}var Ya="MapSet",Xa="Patches",Lm="ArrayMethods",Za={};function sn(e){let t=Za[e];return t||tt(0,e),t}var qm=e=>!!Za[e];function zx(e,t){Za[e]||(Za[e]=t)}var Ci,Qm=()=>Ci,Wx=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:qm(Ya)?sn(Ya):void 0,arrayMethodsPlugin_:qm(Lm)?sn(Lm):void 0});function jm(e,t){t&&(e.patchPlugin_=sn(Xa),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function td(e){rd(e),e.drafts_.forEach(Kx),e.drafts_=null}function rd(e){e===Ci&&(Ci=e.parent_)}var Um=e=>Ci=Wx(Ci,e);function Kx(e){let t=e[Ke];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Vm(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[Ke].modified_&&(td(t),tt(4)),lt(e)&&(e=Gm(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[Ke].base_,e,t)}else e=Gm(t,r);return Yx(t,e,!0),td(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==id?e:void 0}function Gm(e,t){if(ts(t))return t;let r=t[Ke];if(!r)return Ja(t,e.handledSet_,e);if(!rs(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);Wm(r,e)}return r.copy_}function Yx(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&sd(t,r)}function Hm(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var rs=(e,t)=>e.scope_===t,Xx=[];function zm(e,t,r,n){let o=ur(e),i=e.type_;if(n!==void 0&&cr(o,n,i)===t){Ka(o,n,r,i);return}if(!e.draftLocations_){let s=e.draftLocations_=new Map;Ti(o,(u,c)=>{if(mt(c)){let g=s.get(c)||[];g.push(u),s.set(c,g)}})}let a=e.draftLocations_.get(t)??Xx;for(let s of a)Ka(o,s,r,i)}function Zx(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!rs(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let a=ad(i);zm(e,i.draft_??i,a,r),Wm(i,o)})}function Wm(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)}Hm(e)}}function Jx(e,t,r){let{scope_:n}=e;if(mt(r)){let o=r[Ke];rs(o,n)&&o.callbacks_.push(function(){za(e);let a=ad(o);zm(e,r,a,t)})}else lt(r)&&e.callbacks_.push(function(){let i=ur(e);e.type_===3?i.has(r)&&Ja(r,n.handledSet_,n):cr(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Ja(cr(e.copy_,t,e.type_),n.handledSet_,n)})}function Ja(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||mt(e)||t.has(e)||!lt(e)||ts(e)||(t.add(e),Ti(e,(n,o)=>{if(mt(o)){let i=o[Ke];if(rs(i,r)){let a=ad(i);Ka(e,n,a,e.type_),Hm(i)}}else lt(o)&&Ja(o,t,r)})),e}function eC(e,t){let r=_i(e),n={type_:r?1:0,scope_:t?t.scope_:Qm(),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=es;r&&(o=[n],i=Ei);let{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,[s,n]}var es={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(!to(o,t,e.type_))return rC(e,o,t);let i=o[t];if(e.finalized_||!lt(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&$x(t))return i;if(i===Zl(e.base_,t)||tC(e,t,i)){za(e);let a=e.type_===1?+t:t,s=od(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=Km(ur(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Zl(ur(e),t),i=o?.[Ke];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(Bx(r,o)&&(r!==void 0||to(e.base_,t,e.type_)))return!0;za(e),nd(e)}return e.copy_[t]===r&&(r!==void 0||to(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Jx(e,t,r)),!0},deleteProperty(e,t){return za(e),Zl(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),nd(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&&{[Ha]:!0,[Jl]:e.type_!==1||t!=="length",[Wa]:n[Wa],[xi]:r[t]}},defineProperty(){tt(11)},getPrototypeOf(e){return on(e.base_)},setPrototypeOf(){tt(12)}},Ei={};for(let e in es){let t=es[e];Ei[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Ei.deleteProperty=function(e,t){return Ei.set.call(this,e,t,void 0)};Ei.set=function(e,t,r){return es.set.call(this,e[0],t,r,e[0])};function Zl(e,t){let r=e[Ke];return(r?ur(r):e)[t]}function tC(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!lt(r)||r[Ke]?!1:e.baseRefs_.has(r)}function rC(e,t,r){let n=Km(t,r);return n?xi in n?n[xi]:n.get?.call(e.draft_):void 0}function Km(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 nd(e){e.modified_||(e.modified_=!0,e.parent_&&nd(e.parent_))}function za(e){e.copy_||(e.assigned_=new Map,e.copy_=ed(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var nC=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=Um(this),a=od(i,t,void 0),s=!0;try{o=r(a),s=!1}finally{s?td(i):rd(i)}return jm(i,n),Vm(o,i)}else if(!t||!ro(t)){if(o=r(t),o===void 0&&(o=t),o===id&&(o=void 0),this.autoFreeze_&&sd(o,!0),n){let i=[],a=[];sn(Xa).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]},Xl(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Xl(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Xl(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){lt(e)||tt(8),mt(e)&&(e=ns(e));let t=Um(this),r=od(t,e,void 0);return r[Ke].isManual_=!0,rd(t),r}finishDraft(e,t){let r=e&&e[Ke];(!r||!r.isManual_)&&tt(9);let{scope_:n}=r;return jm(n,t),Vm(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(Xa).applyPatches_;return mt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function od(e,t,r,n){let[o,i]=ki(t)?sn(Ya).proxyMap_(t,r):Oi(t)?sn(Ya).proxySet_(t,r):eC(t,r);return(r?.scope_??Qm()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?Zx(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 ns(e){return mt(e)||tt(10,e),Ym(e)}function Ym(e){if(!lt(e)||ts(e))return e;let t=e[Ke],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=ed(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=ed(e,!0);return Ti(r,(o,i)=>{Ka(r,o,Ym(i))},n),t&&(t.finalized_=!1),r}function Xm(){function t(y,b=[]){if(y.key_!==void 0){let x=y.parent_.copy_??y.parent_.base_,I=Qx(cr(x,y.key_)),_=cr(x,y.key_);if(_===void 0||_!==y.draft_&&_!==y.base_&&_!==y.copy_||I!=null&&I.base_!==y.base_)return null;let T=y.parent_.type_===3,P;if(T){let A=y.parent_;P=Array.from(A.drafts_.keys()).indexOf(y.key_)}else P=y.key_;if(!(T&&x.size>P||to(x,P)))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 _=b[I];if(x=cr(x,_),!ro(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_:_}=x;switch(y.type_){case 0:case 2:return u(y,b,I,_);case 1:return s(y,b,I,_);case 3:return c(y,b,I,_)}}function s(y,b,x,I){let{base_:_,assigned_:T}=y,P=y.copy_;P.length<_.length&&([_,P]=[P,_],[x,I]=[I,x]);let A=y.allIndicesReassigned_===!0;for(let O=0;O<_.length;O++){let k=P[O],N=_[O];if((A||T?.get(O.toString()))&&k!==N){let V=k?.[Ke];if(V&&V.modified_)continue;let j=b.concat([O]);x.push({op:n,path:j,value:h(k)}),I.push({op:n,path:j,value:h(N)})}}for(let O=_.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;_.length<=O;--O){let k=b.concat([O]);I.push({op:i,path:k})}}function u(y,b,x,I){let{base_:_,copy_:T,type_:P}=y;Ti(y.assigned_,(A,O)=>{let k=cr(_,A,P),N=cr(T,A,P),M=O?to(_,A)?n:o:i;if(k===N&&M===n)return;let V=b.concat(A);x.push(M===i?{op:M,path:V}:{op:M,path:V,value:h(N)}),I.push(M===o?{op:i,path:V}:M===i?{op:o,path:V,value:h(k)}:{op:n,path:V,value:h(k)})})}function c(y,b,x,I){let{base_:_,copy_:T}=y,P=0;_.forEach(A=>{if(!T.has(A)){let O=b.concat([P]);x.push({op:i,path:O,value:A}),I.unshift({op:o,path:O,value:A})}P++}),P=0,T.forEach(A=>{if(!_.has(A)){let O=b.concat([P]);x.push({op:o,path:O,value:A}),I.unshift({op:i,path:O,value:A})}P++})}function g(y,b,x){let{patches_:I,inversePatches_:_}=x;I.push({op:n,path:[],value:b===id?void 0:b}),_.push({op:n,path:[],value:y})}function v(y,b){return b.forEach(x=>{let{path:I,op:_}=x,T=y;for(let k=0;k<I.length-1;k++){let N=an(T),M=I[k];typeof M!="string"&&typeof M!="number"&&(M=""+M),(N===0||N===1)&&(M==="__proto__"||M===wi)&&tt(19),nn(T)&&M===Ii&&tt(19),T=cr(T,M),(T===null||!ro(T))&&tt(18,I.join("/"))}let P=an(T),A=R(x.value),O=I[I.length-1];switch(_){case n:switch(P){case 2:return T.set(O,A);case 3:tt(16);default:return T[O]=A}case o:switch(P){case 1:return O==="-"?T.push(A):T.splice(O,0,A);case 2:return T.set(O,A);case 3:return T.add(A);default:return T[O]=A}case i:switch(P){case 1:return T.splice(O,1);case 2:return T.delete(O);case 3:return T.delete(x.value);default:return delete T[O]}default:tt(17,_)}}),y}function R(y){if(!lt(y))return y;if(_i(y))return y.map(R);if(ki(y))return new Map(Array.from(y.entries()).map(([x,I])=>[x,R(I)]));if(Oi(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 to(y,Ai)&&(b[Ai]=y[Ai]),b}function h(y){return mt(y)?R(y):y}zx(Xa,{applyPatches_:v,generatePatches_:a,generateReplacementPatches_:g,getPath:t})}var oC=w.Iterator,qL=typeof oC?.from=="function";var Ri=new nC,cn=Ri.produce,cd=Ri.produceWithPatches.bind(Ri);var ud=Ri.applyPatches.bind(Ri);m();d();f();p();var iC=class{constructor(e){this.value=e}deref(){return this.value}},aC=()=>typeof WeakRef>"u"?iC:WeakRef,Jm=aC(),sC=0,os=1;function Pi(){return{s:sC,v:void 0,o:null,p:null}}function cC(e){return e instanceof Jm?e.deref():e}function no(e,t={}){let r=Pi(),{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=Pi(),s=0)}function R(){let h=r,{length:y}=arguments;for(let I=0,_=y;I<_;I++){let T=arguments[I];if(typeof T=="function"||typeof T=="object"&&T!==null){let P=h.o;P===null&&(h.o=P=new WeakMap);let A=P.get(T);A===void 0?(h=Pi(),P.set(T,h)):h=A}else{let P=h.p;P===null&&(h.p=P=new Map);let A=P.get(T);A===void 0?(h=Pi(),P.set(T,h),s++):h=A}}if(h.s===os)return h.v;if(a!==null){let I=a;for(let _=0,T=y;_<T;_++){let P=arguments[_],A;if(typeof P=="function"||typeof P=="object"&&P!==null){let O=I.o;A=O!==null?O.get(P):void 0}else{let O=I.p;A=O!==null?O.get(P):void 0}if(A===void 0){I=null;break}I=A}if(I!==null&&I.s===os){let _=h;return _.s=os,_.v=I.v,v(),I.v}}let b=h,x=e.apply(null,arguments);if(c++,n){let I=cC(u);I!=null&&n(I,x)&&(x=I,c!==0&&c--),u=typeof x=="object"&&x!==null||typeof x=="function"?new Jm(x):x}return b.s=os,b.v=x,i&&v(),x}return R.clearCache=()=>{r=Pi(),a=null,s=0,R.resetResultsCount()},R.resultsCount=()=>c,R.resetResultsCount=()=>{c=0},R}var ld=Symbol("NOT_FOUND");function uC(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function lC(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 Zm=e=>Array.isArray(e)?e:[e];function dC(e){let t=Array.isArray(e[0])?e[0]:e;return lC(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function is(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()),uC(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=Zm(R),x=Zm(y),I=dC(o),_=v(function(){return i++,c.apply(null,arguments)},...b),T=!0,P=h(function(){a++;let{length:O}=I,k=new Array(O);for(let N=0;N<O;N++)k[N]=I[N].apply(null,arguments);return s=_.apply(null,k),s},...x);return Object.assign(P,{resultFunc:c,memoizedResultFunc:_,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=is(no);function pC(e){let t;return{get(r){return t&&e(t.key,r)?t.value:ld},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 fC(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 ld}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 mC=(e,t)=>e===t;function gC(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 dd(e,t){let r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:n=mC,maxSize:o=1,resultEqualityCheck:i}=r,a=gC(n),s=0,u=o<=1?pC(a):fC(o,a);function c(){let g=u.get(arguments);if(g===ld){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 eg(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var tg=eg(),rg=eg;var hC=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Si:Si.apply(null,arguments)},sq=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},yC=e=>e&&typeof e.match=="function";function L(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(gt(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=>bi(n)&&n.type===e,r}var lg=class Ni extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Ni.prototype)}static get[Symbol.species](){return Ni}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Ni(...t[0].concat(this)):new Ni(...t.concat(this))}};function ng(e){return lt(e)?cn(e,()=>{}):e}function as(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function vC(e){return typeof e=="boolean"}var SC=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new lg;return r&&(vC(r)?a.push(tg):a.push(rg(r.extraArgument))),a},Fi="RTK_autoBatch",ao=()=>e=>({payload:e,meta:{[Fi]:!0}}),og=e=>t=>{setTimeout(t,e)},bC=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(i),clearTimeout(a),r())},i=e(o),a=setTimeout(o,t)},AC=(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?bC(window.requestAnimationFrame,100):og(10):e.type==="callback"?e.queueNotification:og(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?.[Fi],i=!o,i&&(a||(a=!0,u(c))),n.dispatch(g)}finally{o=!0}}})},wC=e=>function(r){let{autoBatch:n=!0}=r??{},o=new lg(e);return n&&o.push(AC(typeof n=="object"?n:void 0)),o};function dg(e){let t=SC(),{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(Wt(r))u=eo(r);else throw new Error(gt(1));let c;typeof n=="function"?c=n(t):c=t();let g=Si;o&&(g=hC({trace:!1,...(typeof o=="object"&&o)}));let v=Dm(...c),R=wC(v),h=typeof s=="function"?s(R):R(),y=g(...h);return Yl(u,a,y)}function pg(e){let t={},r=[],n,o={addCase(i,a){let s=typeof i=="string"?i:i.type;if(!s)throw new Error(gt(28));if(s in t)throw new Error(gt(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 xC(e){return typeof e=="function"}function Be(e,t){let[r,n,o]=pg(t),i;if(xC(e))i=()=>ng(e());else{let s=ng(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(mt(g)){let h=v(g,u);return h===void 0?g:h}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 Error("A case reducer on a non-draftable value must not return undefined")}return R}}return g},s)}return a.getInitialState=i,a}var fg=(e,t)=>yC(e)?e.match(t):e(t);function Kt(...e){return t=>e.some(r=>fg(r,t))}function io(...e){return t=>e.every(r=>fg(r,t))}function ls(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 Di(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function ds(...e){return e.length===0?t=>ls(t,["pending"]):Di(e)?Kt(...e.map(t=>t.pending)):ds()(e[0])}function ln(...e){return e.length===0?t=>ls(t,["rejected"]):Di(e)?Kt(...e.map(t=>t.rejected)):ln()(e[0])}function Mi(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?io(ln(...e),t):Di(e)?io(ln(...e),t):Mi()(e[0])}function lr(...e){return e.length===0?t=>ls(t,["fulfilled"]):Di(e)?Kt(...e.map(t=>t.fulfilled)):lr()(e[0])}function ps(...e){return e.length===0?t=>ls(t,["pending","fulfilled","rejected"]):Di(e)?Kt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):ps()(e[0])}var CC="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Li=(e=21)=>{let t="",r=e;for(;r--;)t+=CC[Math.random()*64|0];return t},EC=["name","message","stack","code"],pd=class{constructor(e,t){ue(this,"payload");ue(this,"meta");ue(this,"_type");this.payload=e,this.meta=t}},ig=class{constructor(e,t){ue(this,"payload");ue(this,"meta");ue(this,"_type");this.payload=e,this.meta=t}},RC=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of EC)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},ag="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||RC)(u||"Rejected"),meta:{...(R||{}),arg:g,requestId:c,rejectedWithValue:!!v,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):Li(),y=new l.AbortController,b,x;function I(T){x=T,y.abort()}c&&(c.aborted?I(ag):c.addEventListener("abort",()=>I(ag),{once:!0}));let _=_asyncToGenerator(function*(){let T;try{let A=n?.condition?.(u,{getState:v,extra:R});if(TC(A)&&(A=yield A),A===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let O=new Promise((k,N)=>{b=()=>{N({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}))),T=yield Promise.race([O,Promise.resolve(r(u,{dispatch:g,getState:v,extra:R,requestId:h,signal:y.signal,abort:I,rejectWithValue:(k,N)=>new pd(k,N),fulfillWithValue:(k,N)=>new ig(k,N)})).then(k=>{if(k instanceof pd)throw k;return k instanceof ig?o(k.payload,h,u,k.meta):o(k,h,u)})])}catch(A){T=A instanceof pd?a(null,h,u,A.payload,A.meta):a(A,h,u)}finally{b&&y.signal.removeEventListener("abort",b)}return n&&!n.dispatchConditionRejection&&a.match(T)&&T.meta.condition||g(T),T})();return Object.assign(_,{abort:I,requestId:h,arg:u,unwrap(){return _.then(IC)}})}}return Object.assign(s,{pending:i,rejected:a,fulfilled:o,settled:Kt(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function IC(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function TC(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var mg=Symbol.for("rtk-slice-createasyncthunk"),uq={[mg]:ke};function _C(e,t){return`${e}/${t}`}function kC({creators:e}={}){let t=e?.asyncThunk?.[mg];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(gt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(PC()):n.reducers)||{},s=Object.keys(a),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(T,P){let A=typeof T=="string"?T:T.type;if(!A)throw new Error(gt(12));if(A in u.sliceCaseReducersByType)throw new Error(gt(13));return u.sliceCaseReducersByType[A]=P,c},addMatcher(T,P){return u.sliceMatchers.push({matcher:T,reducer:P}),c},exposeAction(T,P){return u.actionCreators[T]=P,c},exposeCaseReducer(T,P){return u.sliceCaseReducersByName[T]=P,c}};s.forEach(T=>{let P=a[T],A={reducerName:T,type:_C(o,T),createNotation:typeof n.reducers=="function"};FC(P)?MC(A,P,c,t):NC(A,P,c)});function g(){let[T={},P=[],A=void 0]=typeof n.extraReducers=="function"?pg(n.extraReducers):[n.extraReducers],O={...T,...u.sliceCaseReducersByType};return Be(n.initialState,k=>{for(let N in O)k.addCase(N,O[N]);for(let N of u.sliceMatchers)k.addMatcher(N.matcher,N.reducer);for(let N of P)k.addMatcher(N.matcher,N.reducer);A&&k.addDefaultCase(A)})}let v=T=>T,R=new Map,h=new WeakMap,y;function b(T,P){return y||(y=g()),y(T,P)}function x(){return y||(y=g()),y.getInitialState()}function I(T,P=!1){function A(k){let N=k[T];return typeof N>"u"&&P&&(N=as(h,A,x)),N}function O(k=v){let N=as(R,P,()=>new WeakMap);return as(N,k,()=>{let M={};for(let[V,j]of Object.entries(n.selectors??{}))M[V]=OC(j,k,()=>as(h,k,x),P);return M})}return{reducerPath:T,getSelectors:O,get selectors(){return O(A)},selectSlice:A}}let _={name:o,reducer:b,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:x,...I(i),injectInto(T,{reducerPath:P,...A}={}){let O=P??i;return T.inject({reducerPath:O,reducer:b},A),{..._,...I(O,!0)}}};return _}}function OC(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=kC();function PC(){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 NC({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!DC(n))throw new Error(gt(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 FC(e){return e._reducerDefinitionType==="asyncThunk"}function DC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function MC({type:e,reducerName:t},r,n,o){if(!o)throw new Error(gt(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||ss,pending:s||ss,rejected:u||ss,settled:c||ss})}function ss(){}var LC="task",gg="listener",hg="completed",gd="cancelled",qC=`task-${gd}`,jC=`task-${hg}`,fd=`${gg}-${gd}`,UC=`${gg}-${hg}`,fs=class{constructor(e){ue(this,"code");ue(this,"name","TaskAbortError");ue(this,"message");this.code=e,this.message=`${LC} ${gd} (reason: ${e})`}},hd=(e,t)=>{if(typeof e!="function")throw new TypeError(gt(32))},cs=()=>{},yg=(e,t=cs)=>(e.catch(t),e),vg=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),un=e=>{if(e.aborted)throw new fs(e.reason)};function Sg(e,t){let r=cs;return new Promise((n,o)=>{let i=()=>o(new fs(e.reason));if(e.aborted){i();return}r=vg(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=cs})}var VC=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof fs?"cancelled":"rejected",error:r}}finally{t?.()}});return function VC(_x5,_x6){return _ref5.apply(this,arguments)}}(),us=e=>t=>yg(Sg(e,t).then(r=>(un(e),r))),bg=e=>{let t=us(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:oo}=Object,sg={},ms="listenerMiddleware",GC=(e,t)=>{let r=n=>vg(e,()=>n.abort(e.reason));return(n,o)=>{hd(n,"taskExecutor");let i=new l.AbortController;r(i);let a=VC(/*#__PURE__*/_asyncToGenerator(function*(){un(e),un(i.signal);let s=yield n({pause:us(i.signal),delay:bg(i.signal),signal:i.signal});return un(i.signal),s}),()=>i.abort(jC));return o?.autoJoin&&t.push(a.catch(cs)),{result:us(e)(a),cancel(){i.abort(qC)}}}},BC=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){un(t);let i=()=>{},s=[new Promise((u,c)=>{let g=e({predicate:n,effect:(v,R)=>{R.unsubscribe(),u([v,R.getState(),R.getOriginalState()])}});i=()=>{g(),c()}})];o!=null&&s.push(new Promise(u=>setTimeout(u,o,null)));try{let u=yield Sg(t,Promise.race(s));return un(t),u}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>yg(r(n,o))},Ag=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(gt(21));return hd(i,"options.listener"),{predicate:o,type:t,effect:i}},wg=oo(e=>{let{type:t,predicate:r,effect:n}=Ag(e);return{id:Li(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(gt(22))}}},{withTypes:()=>wg}),cg=(e,t)=>{let{type:r,effect:n,predicate:o}=Ag(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},md=e=>{e.pending.forEach(t=>{t.abort(fd)})},$C=(e,t)=>()=>{for(let r of t.keys())md(r);e.clear()},ug=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},xg=oo(L(`${ms}/add`),{withTypes:()=>xg}),QC=L(`${ms}/removeAll`),Cg=oo(L(`${ms}/remove`),{withTypes:()=>Cg}),HC=(...e)=>{console.error(`${ms}/error`,...e)},Eg=(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=HC}=e;hd(a,"onError");let s=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&md(h)}),u=h=>{let y=cg(t,h)??wg(h);return s(y)};oo(u,{withTypes:()=>u});let c=h=>{let y=cg(t,h);return y&&(y.unsubscribe(),h.cancelActive&&md(y)),!!y};oo(c,{withTypes:()=>c});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,b,x){let I=new l.AbortController,_=BC(u,I.signal),T=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(y,oo({},b,{getOriginalState:x,condition:(P,A)=>_(P,A).then(Boolean),take:_,delay:bg(I.signal),pause:us(I.signal),extra:i,signal:I.signal,fork:GC(I.signal,T),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((P,A,O)=>{P!==I&&(P.abort(fd),O.delete(P))})},cancel:()=>{I.abort(fd),h.pending.delete(I)},throwIfCancelled:()=>{un(I.signal)}})))}catch(P){P instanceof fs||ug(a,P,{raisedBy:"effect"})}finally{yield Promise.all(T),I.abort(UC),o(h),h.pending.delete(I)}});return function g(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),v=$C(t,r);return{middleware:h=>y=>b=>{if(!bi(b))return y(b);if(xg.match(b))return u(b.payload);if(QC.match(b)){v();return}if(Cg.match(b))return c(b.payload);let x=h.getState(),I=()=>{if(x===sg)throw new Error(gt(23));return x},_;try{if(_=y(b),t.size>0){let T=h.getState(),P=Array.from(t.values());for(let A of P){let O=!1;try{O=A.predicate(b,T,x)}catch(k){O=!1,ug(a,k,{raisedBy:"predicate"})}O&&g(A,b,h,I)}}}finally{x=sg}return _},startListening:u,stopListening:c,clearListeners:v}};function gt(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 z({required:!0,emptyAllowed:!1}),rt=new z({required:!1,emptyAllowed:!1}),nt=new z({required:!0,emptyAllowed:!0}),Aq=new z({required:!1,emptyAllowed:!0}),gs=new Ae({each:Y,required:!0}),Rg=new z({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Ig=new z({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),wq=new z({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),dr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),kt=(e,t)=>{if("required"in t)return{payload:new yt({value:t}).validate({value:e}).value};let o=new ne({options:{required:!0},values:t}).validate(e);if(o)throw new mi(o);return{payload:e}},B=(e,t)=>{try{return kt(e,t)}catch(r){return{payload:e,error:dr(r)}}},Tg=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return kg(e,t,r,o,"Controller initialization error")},_g=(e,t,r,n)=>{let o=`Check the options of ${n}`;return kg(e,t,r,o,"Controller initialization error")},kg=(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.57.3",Og=["@coveo/atomic","@coveo/quantic"];var yd=()=>rt,Pg=()=>Y,Ir=L("configuration/updateBasicConfiguration",e=>B(e,{accessToken:rt,environment:new z({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:rt})),Yt=L("configuration/updateSearchConfiguration",e=>B(e,{proxyBaseUrl:new z({required:!1,url:!0}),pipeline:new z({required:!1,emptyAllowed:!0}),searchHub:rt,timezone:rt,locale:rt,authenticationProviders:new Ae({required:!1,each:Y})})),zC={enabled:new me({default:!0}),originContext:yd(),originLevel2:yd(),originLevel3:yd(),proxyBaseUrl:new z({required:!1,url:!0}),runtimeEnvironment:new qe,anonymous:new me({default:!1}),deviceId:rt,userDisplayName:rt,documentLocation:rt,trackingId:Ig,analyticsMode:new z({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new ne({options:{required:!1},values:Og.reduce((e,t)=>(e[t]=Rg,e),{})})},co=L("configuration/updateAnalyticsConfiguration",e=>B(e,zC)),uo=L("configuration/analytics/disable"),lo=L("configuration/analytics/enable"),hs=L("configuration/analytics/originlevel2",e=>B(e,{originLevel2:Pg()})),ys=L("configuration/analytics/originlevel3",e=>B(e,{originLevel3:Pg()})),Ng=L("knowledge/setAgentId",e=>B(e,new z({required:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var Fg={q:new z,enableQuerySyntax:new me,aq:new z,cq:new z,firstResult:new oe({min:0}),numberOfResults:new oe({min:0}),sortCriteria:new z,f:new ne,fExcluded:new ne,cf:new ne,nf:new ne,mnf:new ne,df:new ne,debug:new me,sf:new ne,tab:new z,af:new ne};var Tr=L("searchParameters/restore",e=>B(e,Fg)),Dg=L("searchParameters/restoreTab",e=>B(e,Y));m();d();f();p();var vs=L("debug/enable"),Ss=L("debug/disable");m();d();f();p();var bs=()=>!1;var As=Be(bs(),e=>{e.addCase(vs,()=>!0).addCase(Ss,()=>!1).addCase(Tr,(t,r)=>r.payload.debug??t)});m();d();f();p();var po=L("pipeline/set",e=>B(e,new z({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();var WC=L("history/undo"),KC=L("history/redo"),Xt=L("history/snapshot"),Oj=ke("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(WC()),yield t(St())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),Pj=ke("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(KC()),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 _r=()=>"";var fo=Be(_r(),e=>{e.addCase(po,(t,r)=>r.payload).addCase(St.fulfilled,(t,r)=>r.payload?.pipeline??t).addCase(Yt,(t,r)=>r.payload.pipeline||t)});m();d();f();p();m();d();f();p();var ws=L("app/setError");m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function YC(){return typeof navigator<"u"}function Mg(){try{return typeof localStorage<"u"}catch{return!1}}function Lg(){try{return typeof sessionStorage<"u"}catch{return!1}}function qg(){return YC()&&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)),vd(t,r,o,XC(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 XC(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(ZC(n))return n}}function ZC(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return vd(t,"1",void 0,e),pn.get(t)==="1"}catch{return!1}finally{try{vd(t,"",new Date(0),e)}catch{}}}function vd(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function jg(){return Mg()?localStorage:qg()?new xs:Lg()?sessionStorage:new Sd}var xs=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)}};xs.prefix="coveo_";var Sd=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var Cs="__coveo.analytics.history",JC=20,eE=1e3*60,tE=75,Es=class{constructor(t){this.store=t||jg()}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(Cs);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this1=this;return _asyncToGenerator(function*(){try{let t=yield _this1.store.getItem(Cs);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(Cs,JSON.stringify(t.slice(0,JC)))}catch{}}clear(){try{this.store.removeItem(Cs)}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,tE)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>eE:!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 Es{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 G(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 wd(){return typeof window<"u"}function Md(){return typeof navigator<"u"}function go(){return typeof document<"u"}function xd(){try{return typeof localStorage<"u"}catch{return!1}}function rE(){try{return typeof sessionStorage<"u"}catch{return!1}}function Xg(){return Md()&&navigator.cookieEnabled}var nE=[Ce.click,Ce.custom,Ce.search,Ce.view],oE=(e,t)=>nE.indexOf(e)!==-1?Object.assign({language:go()?document.documentElement.lang:"unknown",userAgent:Md()?navigator.userAgent:"unknown"},t):t,ho=class e{static set(t,r,n){let o;n&&(o=new Date,o.setTime(o.getTime()+n)),Cd(t,r,o,iE(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 iE(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(aE(n))return n}}function aE(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return Cd(t,"1",void 0,e),ho.get(t)==="1"}catch{return!1}finally{try{Cd(t,"",new Date(0),e)}catch{}}}function Cd(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function sE(){return xd()?localStorage:Xg()?new ji:rE()?sessionStorage:new vo}var ji=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)}};ji.prefix="coveo_";var Ed=class{constructor(){this.cookieStorage=new ji}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){}},Rs="__coveo.analytics.history",cE=20,uE=1e3*60,lE=75,Ts=class{constructor(t){this.store=t||sE()}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 G(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 G(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(Rs);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return G(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(Rs);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Rs,JSON.stringify(t.slice(0,cE)))}catch{}}clear(){try{this.store.removeItem(Rs)}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,lE)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>uE:!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 dE=(e,t)=>G(void 0,void 0,void 0,function*(){return e===Ce.view?(yield pE(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),pE=e=>G(void 0,void 0,void 0,function*(){let t=new Ts,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),fE=/^(?:[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 _s(e){return typeof e=="string"&&fE.test(e)}function Ug(e){if(!_s(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 Zg(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 mE=new Uint8Array(16);function gE(){return crypto.getRandomValues(mE)}function hE(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 yE="6ba7b810-9dad-11d1-80b4-00c04fd430c8",vE="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function SE(e,t,r,n,o,i){let a=typeof r=="string"?hE(r):r,s=typeof n=="string"?Ug(n):n;if(typeof n=="string"&&(n=Ug(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,Zg(u)}function mn(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():bE(e,t,r)}function bE(e,t,r){e=e||{};let n=e.random??e.rng?.()??gE();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 Zg(n)}function AE(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 bd(e,t){return e<<t|e>>>32-t}function wE(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]=bd(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=bd(c,5)+AE(b,g,v,R)+h+t[b]+u[y]>>>0;h=R,R=v,v=bd(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 ks(e,t,r,n){return SE(80,wE,e,t)}ks.DNS=yE;ks.URL=vE;var Jg="2.33.1",Vg=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,qi={pageview:"pageview",event:"event"},Os=class{constructor({client:t,uuidGenerator:r=mn}){this.client=t,this.uuidGenerator=r}},Rd=class extends Os{constructor({client:t,uuidGenerator:r=mn}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=Vg(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===qi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===qi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===qi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===qi.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 Vg(window.location)}},kr=class e{constructor(t,r){if(!_s(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 _s(i)?new e(i,Number.parseInt(o)*1e3):null}};kr.cvo_cid="cvo_cid";kr.expirationTime=120;var Id=class extends Os{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 G(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(kr.cvo_cid,new kr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Id.Id="link";var Pt=Object.keys;function Is(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Ad=128,eh=192,Gg=224,Bg=240;function xE(e){return(e&248)===Bg?4:(e&Bg)===Gg?3:(e&Gg)===eh?2:1}function CE(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&Ad)!=Ad)break;if(r-=3,(n&eh)!=Ad){t-r>=xE(n)*3&&(r=t);break}}return e.substring(0,r)}var Td={id:"svc_ticket_id",subject:"svc_ticket_subject",description:"svc_ticket_description",category:"svc_ticket_category",productId:"svc_ticket_product_id",custom:"svc_ticket_custom"},EE=Pt(Td).map(e=>Td[e]),RE=[...EE].join("|"),IE=new RegExp(`^(${RE}$)`),TE={svcAction:"svc_action",svcActionData:"svc_action_data"},_E=e=>Pt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=Td[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),kE=e=>IE.test(e),OE=[kE],$g={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Qg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},dt={action:"pa",list:"pal",listSource:"pls"},Ps={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},PE=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],_d={id:"quoteId",affiliation:"quoteAffiliation"},kd={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},NE={add:dt,bookmark_add:dt,bookmark_remove:dt,click:dt,checkout:dt,checkout_option:dt,detail:dt,impression:dt,remove:dt,refund:Object.assign(Object.assign({},dt),Ps),purchase:Object.assign(Object.assign({},dt),Ps),quickview:dt,quote:Object.assign(Object.assign({},dt),_d),review:Object.assign(Object.assign({},dt),kd)},FE=Pt($g).map(e=>$g[e]),DE=Pt(Qg).map(e=>Qg[e]),ME=Pt(dt).map(e=>dt[e]),LE=Pt(Ps).map(e=>Ps[e]),qE=Pt(kd).map(e=>kd[e]),jE=Pt(_d).map(e=>_d[e]),UE=[...FE,"custom"].join("|"),VE=[...DE,"custom"].join("|"),th="(pr[0-9]+)",rh="(il[0-9]+pi[0-9]+)",GE=new RegExp(`^${th}(${UE})$`),BE=new RegExp(`^(${rh}(${VE}))|(il[0-9]+nm)$`),$E=new RegExp(`^(${ME.join("|")})$`),QE=new RegExp(`^(${LE.join("|")})$`),HE=new RegExp(`^${th}custom$`),zE=new RegExp(`^${rh}custom$`),WE=new RegExp(`^(${[...PE,...qE,...jE].join("|")})$`),KE=e=>GE.test(e),YE=e=>BE.test(e),XE=e=>$E.test(e),ZE=e=>QE.test(e),JE=e=>WE.test(e),eR=[YE,KE,XE,ZE,JE],tR=[HE,zE],rR={anonymizeIp:"aip"},nR={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},oR={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},iR=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],aR=Object.assign(Object.assign(Object.assign(Object.assign({},rR),nR),oR),iR.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Od=Object.assign(Object.assign({},aR),TE),sR=e=>{let t=!!e.action&&NE[e.action]||{};return Pt(e).reduce((r,n)=>{let o=t[n]||Od[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},cR=Pt(Od).map(e=>Od[e]),uR=e=>cR.indexOf(e)!==-1,lR=e=>e==="custom",dR=e=>[...eR,...OE,uR,lR].some(t=>t(e)),pR=e=>Pt(e).reduce((t,r)=>{let n=fR(r);return n?Object.assign(Object.assign({},t),mR(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),fR=e=>{let t;return[...tR].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},mR=(e,t)=>Pt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),Pd=class{constructor(t){this.opts=t}sendEvent(t,r){return G(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 G(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 G(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}},Nd=class{sendEvent(t,r){return G(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return G(this,void 0,void 0,function*(){return Promise.resolve()})}},Hg=w.fetch,Ns=class{constructor(t){this.opts=t}sendEvent(t,r){return G(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 Hg(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 G(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield Hg(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[Ce.click,Ce.custom,Ce.search,Ce.view].indexOf(t)!==-1}getVisitorIdParam(){return G(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"})}},Fd=class{constructor(t,r){xd()&&Xg()?this.storage=new Ed:xd()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new vo),this.client=new Ns(t),this.beaconClient=new Pd(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}},Dd=class{constructor(t,r){this.storage=r||new vo,this.client=new Ns(t)}getClientDependingOnEventType(t){return this.client}},Fs=class{constructor(){this.storage=new vo,this.client=new Nd}getClientDependingOnEventType(t){return this.client}},gR="xx",hR=e=>e?.startsWith(gR)||!1,yR=`
|
|
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 mR(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var gR=["1",1,"yes",!0];function hR(){let e=[];return Ad()&&e.push(window.doNotTrack),Fd()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>gR.indexOf(t)!==-1)}function Ds(e){return e===!0?!1:hR()}var nh="v15",oh={default:"https://analytics.cloud.coveo.com/rest/ua"};function yR(e=oh.default,t=nh,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 vR="38824e1f-37f5-42d3-8372-a4b8fa9df946",Zt=class{get defaultOptions(){return{endpoint:oh.default,isCustomEndpoint:!1,token:"",version:nh,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Jg}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=[sE,rE].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};Ds(this.options.disableBrowserPrivacySignals)?this.runtime=new Fs: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 Ad()&&go()?new Pd(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(mR()&&console.warn(fR),new Nd(t))}get storage(){return this.runtime.storage}determineVisitorId(){return G(this,void 0,void 0,function*(){try{return Ad()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||fn()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),fn()}})}getCurrentVisitorId(){return G(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return G(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return G(this,void 0,void 0,function*(){if(_s(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(ks(t,ks(r,vR)))}})}getParameters(t,...r){return G(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return G(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(fn()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(Ds(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(kr.cvo_cid);if(r==null)return null;let n=kr.fromString(r);return!n||!go()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return G(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=>G(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>G(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)=>G(this,void 0,void 0,function*(){let x=yield y;return yield b(t,x)}),h)].reduce((h,y)=>G(this,void 0,void 0,function*(){let b=yield h;return yield y(b)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return G(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?nR(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,R)=>G(this,void 0,void 0,function*(){let h=yield v;return yield R(h)}),Promise.resolve(r))})}makeEvent(t,...r){return G(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=>G(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 G(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return G(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 Ts().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(Ce.search,t)})}sendSearchEvent(t){return G(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 G(this,void 0,void 0,function*(){return this.makeEvent(Ce.click,t)})}sendClickEvent(t){return G(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 G(this,void 0,void 0,function*(){return this.makeEvent(Ce.custom,t)})}sendCustomEvent(t){return G(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 G(this,void 0,void 0,function*(){return this.makeEvent(Ce.view,t)})}sendViewEvent(t){return G(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return G(this,void 0,void 0,function*(){let r=yield(yield C(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return G(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(sR(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&&Is(r)&&(o=this.lowercaseKeys(r));let i=cR(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=pr(t,["custom"]);if(r&&Is(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 pR(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")&&Is(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Is(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"?bE(t,r):t}get baseUrl(){return yR(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 zg={[$.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"},vo=class{constructor(){this.runtime=new Fs,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 Jg}};function SR(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function bR(e){return e.map(t=>t.replace(/;/g,""))}function ih(e){let r=e.join(";");return r.length<=256?r:ih(e.slice(1))}var Wg=e=>{let t=bR(e),r=SR(t);return ih(r)};function Kg(e){let t=typeof e.partialQueries=="string"?e.partialQueries:Wg(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:Wg(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Ms=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Ds(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new vo:new Zt(t)}disable(){this.coveoAnalyticsClient=new vo}enable(){this.coveoAnalyticsClient=new Zt(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent($.interfaceLoad)}logInterfaceLoad(){return G(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent($.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return G(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent($.recommendation)}logRecommendation(){return G(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 G(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 G(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 G(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 G(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 G(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 G(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent($.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return G(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent($.didyoumeanClick)}logDidYouMeanClick(){return G(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 G(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent($.searchboxSubmit)}logSearchboxSubmit(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent($.searchboxClear)}logSearchboxClear(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent($.searchboxAsYouType)}logSearchboxAsYouType(){return G(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 G(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent($.breadcrumbResetAll)}logBreadcrumbResetAll(){return G(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 G(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 G(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent($.omniboxAnalytics,Kg(t))}logOmniboxAnalytics(t){return G(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent($.omniboxFromLink,Kg(t))}logOmniboxFromLink(t){return G(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent($.searchFromLink)}logSearchFromLink(){return G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent($.pagerScrolling)}logPagerScrolling(){return G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return G(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorBack);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorBack)})}})}logQueryErrorBack(){return G(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return G(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorRetry);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorRetry)})}})}logQueryErrorRetry(){return G(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return G(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorClear);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorClear)})}})}logQueryErrorClear(){return G(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent($.likeSmartSnippet)}logLikeSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent($.dislikeSmartSnippet)}logDislikeSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent($.expandSmartSnippet)}logExpandSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent($.collapseSmartSnippet)}logCollapseSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent($.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent($.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return G(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 G(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 G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent($.recentQueryClick)}logRecentQueryClick(){return G(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent($.clearRecentQueries)}logClearRecentQueries(){return G(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 G(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent($.clearRecentResults)}logClearRecentResults(){return G(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent($.noResultsBack)}logNoResultsBack(){return G(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 G(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent($.showLessFoldedResults)}logShowLessFoldedResults(){return G(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 G(this,arguments,void 0,function*(n,o,i=zg[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 G(this,arguments,void 0,function*(n,o,i=zg[n]){return(yield this.makeCustomEvent(n,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return G(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 G(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return G(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 G(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 G(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return G(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 G(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 Zt?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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent($.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return G(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 G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Ls=Object.assign({},Li),Yg=Object.keys(Ls).map(e=>Ls[e]),ho=class extends Cd{constructor({client:t,uuidGenerator:r=fn}){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])=>Yg.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Yg.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Ls.pageview,{newEventType:Ce.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Ls.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 EE(this.ticket)}};ho.Id="svc";var qs;(function(e){e.click="click",e.flowStart="flowStart"})(qs||(qs={}));var Ot;(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"})(Ot||(Ot={}));var js;(function(e){e.quit="Quit",e.solved="Solved"})(js||(js={}));var Us=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!Ds(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new Zt(t):new vo,this.svc=new ho({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new vo,this.svc=new ho({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Zt(this.options),this.svc=new ho({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(Ot.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(Ot.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(Ot.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(Ot.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(Ot.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(Ot.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(Ot.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(Ot.caseCancelled,{reason:js.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(Ot.caseSolved,{reason:js.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(Ot.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",qs.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",qs.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return G(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 Zt?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 G(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 ah=e=>new Zt(e).getCurrentVisitorId(),Ui=(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,Vi=(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 Vs(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function sh(e){let{activeValue:t,ancestryMap:r}=AR(e);return t?wR(t,r):[]}function AR(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 wR(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var xR=(e,t)=>e.categoryFacetSet[t]?.request;var Ld=(e,t)=>{let r=xR(e,t);return sh(r?.currentValues??[])};m();d();f();p();function Gs(){return{}}m();d();f();p();function Bs(){return{}}m();d();f();p();function $s(){return{}}m();d();f();p();function Qs(){return{}}function qd(e){return{facetSet:e.facetSet??Qs(),categoryFacetSet:e.categoryFacetSet??Gs(),dateFacetSet:e.dateFacetSet??Bs(),numericFacetSet:e.numericFacetSet??$s(),automaticFacetSet:e.automaticFacetSet??Vs()}}var jd=e=>{let t=[];return RR(e).forEach((r,n)=>{let o=FR(e,r.facetId),i=PR(r,n+1);if(ER(r)){if(!!!Ld(e,r.facetId).length)return;t.push({...i,...kR(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((a,s)=>{if(a.state==="idle")return;let u=ch(a,s+1,o),c=CR(r)?uh(a):TR(a);t.push({...i,...u,...c})})}),IR(e).forEach((r,n)=>{let o=OR(r,n+1);r.values.forEach((i,a)=>{if(i.state==="idle")return;let s=ch(i,a+1,"specific"),u=uh(i);t.push({...o,...s,...u})})}),t},CR=e=>e.type==="specific",ER=e=>e.type==="hierarchical",RR=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),IR=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),ch=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),TR=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),uh=e=>({displayValue:e.value,value:e.value}),_R=(e,t)=>Ld(e,t).map(n=>n.value).join(";"),kR=(e,t)=>{let n=_R(e,t);return{value:n,valuePosition:1,displayValue:n}},OR=(e,t)=>({title:lh(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),PR=(e,t)=>({title:lh(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),lh=(e,t)=>`${e}_${t}`,NR=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,FR=(e,t)=>{let r=NR(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var Ud=e=>e.configuration.search.locale,dh=e=>e.configuration.search.timezone,ph=e=>e.configuration.accessToken,fh=e=>e.configuration.organizationId,mh=e=>e.configuration.environment,Hs=e=>e.configuration?.knowledge?.agentId,gh=e=>e.configuration.knowledge.debugAgentSession;var je=e=>{if(DR(e)||Vd(e))return e.generatedAnswer?.answerId;if(MR(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},DR=e=>"answer"in e&&"generatedAnswer"in e&&!ce(e.generatedAnswer?.answerConfigurationId),Vd=e=>{let t=Hs(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},MR=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Gd=e=>e.generatedAnswer?.fieldsToIncludeInCitations,Or=e=>e.followUpAnswers?.conversationId,LR=e=>e.generatedAnswer?.citations,qR=e=>e.followUpAnswers?.followUpAnswers,jR=ze(qR,e=>e?.flatMap(t=>t.citations)),UR=(e,t)=>t,So=ze(LR,jR,UR,(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 hh=(r=>(r.Ascending="ascending",r.Descending="descending",r))(hh||{}),yh=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(yh||{}),Bd=e=>{if(lm(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""}},vh=()=>({by:"relevancy"});var xV=new ne({values:{by:new Ll({enum:yh,required:!0}),order:new Ll({enum:hh}),field:new z}});function zs(){return Bd(vh())}m();d();f();p();m();d();f();p();var bo=()=>"default";var VR=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 VR(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=ao),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||bo()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};var Gi=class Gi 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||Gi.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||zt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Gi.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??zs()}}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||zt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||zt().response.totalCountFiltered}};ue(Gi,"fallbackPipelineName","default");var Pr=Gi,Sh=({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??_t(a.configuration.organizationId,a.configuration.environment,"analytics"),c=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,v=new Ms({token:s,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:Ui(e,n),beforeSendHooks:[Vi(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 Ws=/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield ah(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 Ws(_x17,_x18){return _ref10.apply(this,arguments)}}();m();d();f();p();m();d();f();p();m();d();f();p();var Ao=()=>({duration:0,error:null,isLoading:!1,id:"Recommendation",recommendations:[],searchUid:"",splitTestRun:"",pipeline:""});var Bi=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||Ao().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||Ao().duration}mapResultsToAnalyticsDocument(){return this.state.recommendation?.recommendations.map(t=>({documentUri:t.uri,documentUriHash:t.raw.urihash}))}get numberOfResults(){return this.state.recommendation?.recommendations.length||Ao().recommendations.length}};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function bh(){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 Ah=/^(?:[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 GR(e){return typeof e=="string"&&Ah.test(e)}var Qd=GR;m();d();f();p();var it=[];for(let e=0;e<256;++e)it.push((e+256).toString(16).slice(1));function wh(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 BR=new Uint8Array(16);function Hd(){return crypto.getRandomValues(BR)}m();d();f();p();function $R(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():QR(e,t,r)}function QR(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 wh(n)}var zd=$R;function HR(_x19){return _HR.apply(this,arguments)}function _HR(){_HR=_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 _HR.apply(this,arguments)}var Th="2.1.3",Wd=128,_h=192,xh=224,Ch=240,zR=248;function WR(e){return(e&zR)===Ch?4:(e&Ch)===xh?3:(e&xh)===_h?2:1}function KR(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&_h)!=Wd){t-r>=WR(n)*3&&(r=t);break}}return e.substring(0,r)}function YR(e){let{trackingId:t}=e;return{trackingId:t}}function XR(e){return(e.source||[]).concat([`relay@${Th}`])}function kh(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,a=YR(t),s=r.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:XR(t),clientId:s,userAgent:i(),referrer:Eh(n()),location:Eh(o())})}function Eh(e){return e!==null?KR(e,1024):null}function ZR(e,t,r,n){return{...t,meta:kh(e,r,n)}}var JR="*";function eI(){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===JR)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 Rh({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 tI(e){let t=Rh(e);return{get:()=>t,update:r=>{t=Rh({...t,...r})}}}var Kd=rI();function rI(){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 nI(){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 Ih="visitorId";function oI(){let e=document.referrer;return e===""?null:e}function Yd(){let e=nI();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}`}});bh().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:()=>oI(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(Ih);if(t&&Qd(t))return t;let r=zd();return e.setItem(Ih,r),r}}}function iI(){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 aI(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function sI(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=aI();return t&&r?{...r,runtime:"custom"}:t&&cI()&&iI()?Yd():n}function cI(){try{return typeof window=="object"}catch{return!1}}function uI(e){return{get:()=>Object.freeze(sI(e))}}function Oh(e){let t=tI(e),r=eI(),n=uI(t);return{emit:function(){var _ref12=_asyncToGenerator(function*(o,i){let a=t.get(),s=n.get(),u=ZR(o,i,a,s);return HR({config:a,environment:s,event:u,listenerManager:r})});return function emit(_x23,_x24){return _ref12.apply(this,arguments)}}(),getMeta:o=>kh(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:Th}}m();d();f();p();function Ph(){return typeof window<"u"&&typeof document<"u"}var lI=50,dI=is({memoize:dd,memoizeOptions:{maxSize:lI}}),$i=dI(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=fI(s);return Oh({mode:i?"emit":"disabled",url:o??qa(e,t),token:r,trackingId:n??null,source:a,environment:u})}),pI={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref13=_asyncToGenerator(function*(){});return function send(){return _ref13.apply(this,arguments)}}()},fI=e=>{if(!e)return;let t=e();return{...(Ph()?Yd():pI),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();var Qi=class extends mr{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Nh=({logger:e,getState:t,analyticsClientMiddleware:r=(a,s)=>s,preprocessRequest:n,provider:o=new Qi(t),disableBrowserPrivacySignals:i})=>{let a=t(),s=a.configuration.accessToken,u=a.configuration.analytics.apiBaseUrl??_t(a.configuration.organizationId,a.configuration.environment,"analytics"),c=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,v=new Us({enableAnalytics:g,token:s,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:Ui(e,n),beforeSendHooks:[Vi(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 Dh(e,t){return{...new Pr(t).getBaseMetadata(),actionCause:e,type:e}}function mI(e){return Object.assign(e,{instantlyCallable:!0})}function gI(e,t){let r=i=>{let a=ke(e,i);return mI(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 Mh=(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 vI(i)}return n},hI=e=>e.configuration.analytics.analyticsMode==="legacy",yI=e=>e.configuration.analytics.analyticsMode==="next",vI=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:a})=>(r??(r=s=>new a(s)),gI(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:_}){for(let T of R)yield T(_)});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*(_){hI(_)&&(yield SI(x,r,_,g,b.coveoAnalyticsClient))});return function(_x32){return _ref19.apply(this,arguments)}}());let{emit:I}=$i(y);return R.push(/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(_){if(yI(_)&&o&&n){let T=n(_);yield RI(I,o,T)}});return function(_x33){return _ref20.apply(this,arguments)}}()),h});return function(_x30){return _ref17.apply(this,arguments)}}()));function SI(_x34,_x35,_x36,_x37,_x38){return _SI.apply(this,arguments)}function _SI(){_SI=_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 _SI.apply(this,arguments)}var bI=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=Mh(e=>Sh({...e,provider:e.provider||new Pr(e.getState)}),e=>e,Pr),IB=Mh(Nh,bI("caseAssist"),Qi);var Xd=(e,t)=>{let r=t.recommendation?.recommendations.findIndex(({uniqueId:n})=>e.uniqueId===n)||0;return AI(e,r,t)},Lh=(e,t)=>({sourceName:jh(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||_r()}),qh=(e,t)=>({sourceName:jh(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||_r()});function jh(e){let t=e.source;return ce(t)?"unknown":t}var Uh=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function AI(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:CI(e),...(Fh(e)?{documentCategory:Fh(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:EI(e),queryPipeline:r.pipeline||_r()}}function Fh(e){return e.raw?.objecttype||void 0}var Ks=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||""}),Vh={urihash:new z,sourcetype:new z,permanentid:new z},Gh={uniqueId:Y,raw:new ne({values:Vh}),title:Y,uri:Y,clickUri:Y,rankingModifier:new z({required:!1,emptyAllowed:!0})};function wI(e){return Object.assign({},...Object.keys(Vh).map(t=>({[t]:e[t]})))}function xI(e){return Object.assign({},...Object.keys(Gh).map(t=>({[t]:e[t]})),{raw:wI(e.raw)})}function CI(e){let t=e.raw.author;return ce(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function EI(e){let t=e.raw.source;return ce(t)?"unknown":t}var Zd=e=>new yt(Gh).validate(xI(e));function RI(_x40,_x41,_x42){return _RI.apply(this,arguments)}function _RI(){_RI=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _RI.apply(this,arguments)}m();d();f();p();var Bh=()=>De("analytics/recommendation/update",e=>e.makeRecommendationInterfaceLoad(),e=>new Bi(e)),$h=()=>({actionCause:"recommendationInterfaceLoad"}),Xs=e=>De({prefix:"analytics/recommendation/open",__legacy__getBuilder:(t,r)=>(Zd(e),t.makeRecommendationOpen(Xd(e,r),Ks(e))),__legacy__provider:t=>new Bi(t),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=Xd(e,t),n=Ks(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 wo=L("recommendation/set",e=>B(e,{id:Y})),Nr=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 II(o),s=yield n.recommendations(a),u=Date.now()-i;return vt(s)?r(s.error):{recommendations:s.success.results,analyticsAction:Bh(),duration:u,searchUid:s.success.searchUid,splitTestRun:s.success.splitTestRun,pipeline:s.success.pipeline}});return function(_x43,_x44){return _ref22.apply(this,arguments)}}()),II=/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??xr(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 TI(e,$h()))),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}),...(e.pagination&&{numberOfResults:e.pagination.numberOfResults})}});return function II(_x45){return _ref23.apply(this,arguments)}}(),TI=/*#__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 Ws(e.configuration.analytics,r)});return function TI(_x46,_x47){return _ref24.apply(this,arguments)}}();var xo=Be(Ao(),e=>{e.addCase(wo,(t,r)=>{t.id=r.payload.id}).addCase(Nr.rejected,(t,r)=>{t.error=r.payload?r.payload:null,t.isLoading=!1}).addCase(Nr.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(Nr.pending,t=>{t.isLoading=!0}).addCase(ws,(t,r)=>{t.error=r.payload,t.isLoading=!1})});m();d();f();p();var Co=L("searchHub/set",e=>B(e,new z({required:!0,emptyAllowed:!0})));m();d();f();p();var Eo=Be(bo(),e=>{e.addCase(Co,(t,r)=>r.payload).addCase(St.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Yt,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Qh=class extends Error{constructor(t){super(t[0].message);ue(this,"issues");this.name="SchemaError",this.issues=t}};var hr="uninitialized",tp="pending",zi="fulfilled",Wi="rejected";function Hh(e){return{status:e,isUninitialized:e===hr,isLoading:e===tp,isSuccess:e===zi,isError:e===Wi}}var zh=Wt;function sy(e,t){if(e===t||!(zh(e)&&zh(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]=sy(e[a],t[a]),o&&(o=e[a]===i[a]);return o?e:i}function rp(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function _I(e){return new RegExp("(^|:)//").test(e)}function kI(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function ap(e){return e!=null}function Wh(e){return[...(e?.values()??[])].filter(ap)}function OI(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var PI=e=>e.replace(/\/$/,""),NI=e=>e.replace(/^\//,"");function FI(e,t){if(!e)return t;if(!t)return e;if(_I(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=PI(e),t=NI(t),`${e}${r}${t}`}function ec(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var np=()=>new Map,DI=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},MI=(...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},Kh=(...e)=>C(...e),LI=e=>e.status>=200&&e.status<=299,qI=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Yh(e){if(!Wt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var jI=e=>typeof e=="object"&&(Wt(e)||Array.isArray(e)||typeof e.toJSON=="function");function cy({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=Kh,paramsSerializer:n,isJsonContentType:o=qI,jsonContentType:i="application/json",jsonReplacer:a,timeout:s,responseHandler:u,validateStatus:c,...g}={}){return typeof C>"u"&&r===Kh&&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:_,type:T}=h,P,{url:A,headers:O=new E(g.headers),params:k=void 0,responseHandler:N=u??"json",validateStatus:M=c??LI,timeout:V=s,...j}=typeof R=="string"?{url:R}:R,D={...g,signal:V?MI(h.signal,DI(V)):h.signal,...j};O=new E(Yh(O)),D.headers=(yield t(O,{getState:b,arg:R,extra:x,endpoint:I,forced:_,type:T,extraOptions:y}))||O;let q=jI(D.body);if(D.body!=null&&!q&&typeof D.body!="string"&&D.headers.delete("content-type"),!D.headers.has("content-type")&&q&&D.headers.set("content-type",i),q&&o(D.headers)&&(D.body=JSON.stringify(D.body,a)),D.headers.has("accept")||(N==="json"?D.headers.set("accept","application/json"):N==="text"&&D.headers.set("accept","text/plain, text/html, */*")),k){let te=~A.indexOf("?")?"&":"?",le=n?n(k):new URLSearchParams(Yh(k));A+=te+le}A=FI(e,A);let U=new Request(A,D);P={request:new Request(A,D)};let Q;try{Q=yield r(U)}catch(te){return{error:{status:(te instanceof Error||typeof DOMException<"u"&&te instanceof DOMException)&&te.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(te)},meta:P}}let J=Q.clone();P.response=J;let X,W="";try{let te;if(yield Promise.all([v(Q,N).then(le=>X=le,le=>te=le),J.text().then(le=>W=le,()=>{})]),te)throw te}catch(te){return{error:{status:"PARSING_ERROR",originalStatus:Q.status,data:W,error:String(te)},meta:P}}return M(Q,X)?{data:X,meta:P}:{error:{status:Q.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 Ro=class{constructor(e,t=void 0){ue(this,"value");ue(this,"meta");this.value=e,this.meta=t}};function UI(){return _UI.apply(this,arguments)}function _UI(){_UI=_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 _UI.apply(this,arguments)}function uy(e,t){throw Object.assign(new Ro({error:e,meta:t}),{throwImmediately:!0})}function Jd(e){e.aborted&&uy({status:"CUSTOM_ERROR",error:"Aborted"})}var Xh={},VI=(e,t)=>(/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(r,n,o){let i=[5,(t||Xh).maxRetries,(o||Xh).maxRetries].filter(g=>g!==void 0),[a]=i.slice(-1),u={maxRetries:a,backoff:UI,retryCondition:(g,v,{attempt:R})=>R<=a,...t,...o},c=0;for(;;){Jd(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Ro(g);return g}catch(g){if(c++,g.throwImmediately){if(g instanceof Ro)return g.value;throw g}if(g instanceof Ro){if(!u.retryCondition(g.value.error,r,{attempt:c,baseQueryApi:n,extraOptions:o}))return g.value}else if(c>u.maxRetries)return{error:g};Jd(n.signal);try{yield u.backoff(c,u.maxRetries,n.signal)}catch(v){throw Jd(n.signal),v}}}});return function(_x53,_x54,_x55){return _ref26.apply(this,arguments)}}()),ly=Object.assign(VI,{fail:uy}),rc="__rtkq/",GI="online",BI="offline";var dy="focused";var sp=L(`${rc}${dy}`),py=L(`${rc}un${dy}`),cp=L(`${rc}${GI}`),fy=L(`${rc}${BI}`);var Xi="query",my="mutation",gy="infinitequery";function nc(e){return e.type===Xi}function $I(e){return e.type===my}function oc(e){return e.type===gy}function tc(e){return nc(e)||oc(e)}function up(e,t,r,n,o,i){let a=QI(e)?e(t,r,n,o):e;return a?rp(a,ap,s=>i(hy(s))):[]}function QI(e){return typeof e=="function"}function hy(e){return typeof e=="string"?{type:e}:e}function HI(e,t){return e.catch(t)}var Io=(e,t)=>e.endpointDefinitions[t],Ki=Symbol("forceQueryFn"),op=e=>typeof e[Ki]=="function";function zI({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:a}){let s=A=>a(A)?.runningQueries,u=A=>a(A)?.runningMutations,{unsubscribeQueryResult:c,removeMutationResult:g,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:_,buildInitiateInfiniteQuery:T,buildInitiateMutation:P,getRunningQueryThunk:R,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:b};function R(A,O){return k=>{let N=Io(i,A),M=e({queryArgs:O,endpointDefinition:N,endpointName:A});return s(k)?.get(M)}}function h(A,O){return k=>u(k)?.get(O)}function y(){return A=>Wh(s(A))}function b(){return A=>Wh(u(A))}function x(A){}function I(A,O){let k=(N,{subscribe:M=!0,forceRefetch:V,subscriptionOptions:j,[Ki]:D,...q}={})=>(U,H)=>{let Q=e({queryArgs:N,endpointDefinition:O,endpointName:A}),J,X={...q,type:Xi,subscribe:M,forceRefetch:V,subscriptionOptions:j,endpointName:A,originalArgs:N,queryCacheKey:Q,[Ki]:D};if(nc(O))J=t(X);else{let{direction:ge,initialPageParam:we,refetchCachedPages:Se}=q;J=r({...X,direction:ge,initialPageParam:we,refetchCachedPages:Se})}let W=o.endpoints[A].select(N),te=U(J),le=W(H());let{requestId:_e,abort:Ve}=te,Fe=le.requestId!==_e,Me=s(U)?.get(Q),Le=()=>W(H()),ve=Object.assign(D?te.then(Le):Fe&&!Me?Promise.resolve(le):Promise.all([Me,te]).then(Le),{arg:N,requestId:_e,subscriptionOptions:j,queryCacheKey:Q,abort:Ve,unwrap(){return _asyncToGenerator(function*(){let ge=yield ve;if(ge.isError)throw ge.error;return ge.data})()},refetch:ge=>U(k(N,{subscribe:!1,forceRefetch:!0,...ge})),unsubscribe(){M&&U(c({queryCacheKey:Q,requestId:_e}))},updateSubscriptionOptions(ge){ve.subscriptionOptions=ge,U(v({endpointName:A,requestId:_e,queryCacheKey:Q,options:ge}))}});if(!Me&&!Fe&&!D){let ge=s(U);ge.set(Q,ve),ve.then(()=>{ge.delete(Q)})}return ve};return k}function _(A,O){return I(A,O)}function T(A,O){return I(A,O)}function P(A){return(O,{track:k=!0,fixedCacheKey:N}={})=>(M,V)=>{let j=n({type:"mutation",endpointName:A,originalArgs:O,track:k,fixedCacheKey:N}),D=M(j);let{requestId:q,abort:U,unwrap:H}=D,Q=HI(D.unwrap().then(te=>({data:te})),te=>({error:te})),J=()=>{M(g({requestId:q,fixedCacheKey:N}))},X=Object.assign(Q,{arg:D.arg,requestId:q,abort:U,unwrap:H,reset:J}),W=u(M);return W.set(q,X),X.then(()=>{W.delete(q)}),N&&(W.set(N,X),X.then(()=>{W.get(N)===X&&W.delete(N)})),X}}}var yy=class extends Qh{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}},mn=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function gn(_x56,_x57,_x58,_x59){return _gn.apply(this,arguments)}function _gn(){_gn=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new yy(o.issues,t,r,n);return o.value});return _gn.apply(this,arguments)}function Zh(e){return e}var Hi=(e={})=>({...e,[Ni]:!0});function WI({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:a,onSchemaFailure:s,catchSchemaFailure:u,skipSchemaValidation:c}){let g=(j,D,q,U)=>(H,Q)=>{let J=r[j],X=n({queryArgs:D,endpointDefinition:J,endpointName:j});if(H(o.internalActions.queryResultPatched({queryCacheKey:X,patches:q})),!U)return;let W=o.endpoints[j].select(D)(Q()),te=up(J.providesTags,W.data,void 0,D,{},i);H(o.internalActions.updateProvidedBy([{queryCacheKey:X,providedTags:te}]))};function v(j,D,q=0){let U=[D,...j];return q&&U.length>q?U.slice(0,-1):U}function R(j,D,q=0){let U=[...j,D];return q&&U.length>q?U.slice(1):U}let h=(j,D,q,U=!0)=>(H,Q)=>{let X=o.endpoints[j].select(D)(Q()),W={patches:[],inversePatches:[],undo:()=>H(o.util.patchQueryData(j,D,W.inversePatches,U))};if(X.status===hr)return W;let te;if("data"in X)if(lt(X.data)){let[le,_e,Ve]=cd(X.data,q);W.patches.push(..._e),W.inversePatches.push(...Ve),te=le}else te=q(X.data),W.patches.push({op:"replace",path:[],value:te}),W.inversePatches.push({op:"replace",path:[],value:X.data});return W.patches.length===0||H(o.util.patchQueryData(j,D,W.patches,U)),W},y=(j,D,q)=>U=>U(o.endpoints[j].initiate(D,{subscribe:!1,forceRefetch:!0,[Ki]:()=>({data:q})})),b=(j,D)=>j.query&&j[D]?j[D]:Zh,x=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(j,{signal:D,abort:q,rejectWithValue:U,fulfillWithValue:H,dispatch:Q,getState:J,extra:X}){let W=r[j.endpointName],{metaSchema:te,skipSchemaValidation:le=c}=W,_e=j.type===Xi;try{let Ve=Zh,Fe={signal:D,abort:q,dispatch:Q,getState:J,extra:X,endpoint:j.endpointName,type:j.type,forced:_e?I(j,J()):void 0,queryCacheKey:_e?j.queryCacheKey:void 0},Me=_e?j[Ki]: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 Lt={queryArg:j.originalArgs,pageParam:Se},xt=yield ge(Lt),Qt=Ye?v:R;return{data:{pages:Qt(we.pages,xt.data,He),pageParams:Qt(we.pageParams,Se,He)},meta:xt.meta}});return function ve(_x62,_x63,_x64,_x65){return _ref28.apply(this,arguments)}}();function ge(_x66){return _ge.apply(this,arguments)}function _ge(){_ge=_asyncToGenerator(function*(we){let Se,{extraOptions:He,argSchema:Ye,rawResponseSchema:Lt,responseSchema:xt}=W;if(Ye&&!mn(le,"arg")&&(we=yield gn(Ye,we,"argSchema",{})),Me?Se=Me():W.query?(Ve=b(W,"transformResponse"),Se=yield t(W.query(we),Fe,He)):Se=yield W.queryFn(we,Fe,He,qt=>t(qt,Fe,He)),typeof process<"u",Se.error)throw new Ro(Se.error,Se.meta);let{data:Qt}=Se;Lt&&!mn(le,"rawResponse")&&(Qt=yield gn(Lt,Se.data,"rawResponseSchema",Se.meta));let Tt=yield Ve(Qt,Se.meta,we);return xt&&!mn(le,"response")&&(Tt=yield gn(xt,Tt,"responseSchema",Se.meta)),{...Se,data:Tt}});return _ge.apply(this,arguments)}if(_e&&"infiniteQueryOptions"in W){let{infiniteQueryOptions:we}=W,{maxPages:Se=1/0}=we,He=j.refetchCachedPages??we.refetchCachedPages??!0,Ye,Lt={pages:[],pageParams:[]},xt=a.selectQueryEntry(J(),j.queryCacheKey)?.data,Tt=I(j,J())&&!j.direction||!xt?Lt:xt;if("direction"in j&&j.direction&&Tt.pages.length){let qt=j.direction==="backward",_a=(qt?vy:ip)(we,Tt,j.originalArgs);Ye=yield ve(Tt,_a,Se,qt)}else{let{initialPageParam:qt=we.initialPageParam}=j,si=xt?.pageParams??[],_a=si[0]??qt,hw=si.length;if(Ye=yield ve(Tt,_a,Se),Me&&(Ye={data:Ye.data.pages[0]}),He)for(let Qf=1;Qf<hw;Qf++){let yw=ip(we,Ye.data,j.originalArgs);Ye=yield ve(Ye.data,yw,Se)}}Le=Ye}else Le=yield ge(j.originalArgs);return te&&!mn(le,"meta")&&Le.meta&&(Le.meta=yield gn(te,Le.meta,"metaSchema",Le.meta)),H(Le.data,Hi({fulfilledTimeStamp:Date.now(),baseQueryMeta:Le.meta}))}catch(Ve){let Fe=Ve;if(Fe instanceof Ro){let Me=b(W,"transformErrorResponse"),{rawErrorResponseSchema:Le,errorResponseSchema:ve}=W,{value:ge,meta:we}=Fe;try{Le&&!mn(le,"rawErrorResponse")&&(ge=yield gn(Le,ge,"rawErrorResponseSchema",we)),te&&!mn(le,"meta")&&(we=yield gn(te,we,"metaSchema",we));let Se=yield Me(ge,we,j.originalArgs);return ve&&!mn(le,"errorResponse")&&(Se=yield gn(ve,Se,"errorResponseSchema",we)),U(Se,Hi({baseQueryMeta:we}))}catch(Se){Fe=Se}}try{if(Fe instanceof yy){let Me={endpoint:j.endpointName,arg:j.originalArgs,type:j.type,queryCacheKey:_e?j.queryCacheKey:void 0};W.onSchemaFailure?.(Fe,Me),s?.(Fe,Me);let{catchSchemaFailure:Le=u}=W;if(Le)return U(Le(Fe,Me),Hi({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(j,D){let q=a.selectQueryEntry(D,j.queryCacheKey),U=a.selectConfig(D).refetchOnMountOrArgChange,H=q?.fulfilledTimeStamp,Q=j.forceRefetch??(j.subscribe&&U);return Q?Q===!0||(Number(new Date)-Number(H))/1e3>=Q:!1}let _=()=>ke(`${e}/executeQuery`,x,{getPendingMeta({arg:D}){let q=r[D.endpointName];return Hi({startedTimeStamp:Date.now(),...(oc(q)?{direction:D.direction}:{})})},condition(D,{getState:q}){let U=q(),H=a.selectQueryEntry(U,D.queryCacheKey),Q=H?.fulfilledTimeStamp,J=D.originalArgs,X=H?.originalArgs,W=r[D.endpointName],te=D.direction;return op(D)?!0:H?.status==="pending"?!1:I(D,U)||nc(W)&&W?.forceRefetch?.({currentArg:J,previousArg:X,endpointState:H,state:U})?!0:!(Q&&!te)},dispatchConditionRejection:!0}),T=_(),P=_(),A=ke(`${e}/executeMutation`,x,{getPendingMeta(){return Hi({startedTimeStamp:Date.now()})}}),O=j=>"force"in j,k=j=>"ifOlderThan"in j,N=(j,D,q={})=>(U,H)=>{let Q=O(q)&&q.force,J=k(q)&&q.ifOlderThan,X=(te=!0)=>{let le={forceRefetch:te,subscribe:!1};return o.endpoints[j].initiate(D,le)},W=o.endpoints[j].select(D)(H());if(Q)U(X());else if(J){let te=W?.fulfilledTimeStamp;if(!te){U(X());return}(Number(new Date)-Number(new Date(te)))/1e3>=J&&U(X())}else U(X(!1))};function M(j){return D=>D?.meta?.arg?.endpointName===j}function V(j,D){return{matchPending:oo(ds(j),M(D)),matchFulfilled:oo(lr(j),M(D)),matchRejected:oo(ln(j),M(D))}}return{queryThunk:T,mutationThunk:A,infiniteQueryThunk:P,prefetch:N,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:V}}function ip(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function vy(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function Sy(e,t,r,n){return up(r[e.meta.arg.endpointName][t],lr(e)?e.payload:void 0,Di(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function Jh(e){return mt(e)?ns(e):e}function Zs(e,t,r){let n=e[t];n&&r(n)}function Yi(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function ey(e,t,r){let n=e[Yi(t)];n&&r(n)}var Js={};function KI({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(M,V,j,D){var q;M[q=V.queryCacheKey]??(M[q]={status:hr,endpointName:V.endpointName}),Zs(M,V.queryCacheKey,U=>{U.status=tp,U.requestId=j&&U.requestId?U.requestId:D.requestId,V.originalArgs!==void 0&&(U.originalArgs=V.originalArgs),U.startedTimeStamp=D.startedTimeStamp;let H=o[D.arg.endpointName];oc(H)&&"direction"in V&&(U.direction=V.direction)})}function R(M,V,j,D){Zs(M,V.arg.queryCacheKey,q=>{if(q.requestId!==V.requestId&&!D)return;let{merge:U}=o[V.arg.endpointName];if(q.status=zi,U){if(q.data!==void 0){let{fulfilledTimeStamp:H,arg:Q,baseQueryMeta:J,requestId:X}=V,W=cn(q.data,te=>U(te,j,{arg:Q.originalArgs,baseQueryMeta:J,fulfilledTimeStamp:H,requestId:X}));q.data=W}else q.data=j;}else q.data=o[V.arg.endpointName].structuralSharing??!0?sy(mt(q.data)?Gm(q.data):q.data,j):j;delete q.error,q.fulfilledTimeStamp=V.fulfilledTimeStamp})}let h=dn({name:`${e}/queries`,initialState:Js,reducers:{removeQueryResult:{reducer(M,{payload:{queryCacheKey:V}}){delete M[V]},prepare:io()},cacheEntriesUpserted:{reducer(M,V){for(let j of V.payload){let{queryDescription:D,value:q}=j;v(M,D,!0,{arg:D,requestId:V.meta.requestId,startedTimeStamp:V.meta.timestamp}),R(M,{arg:D,requestId:V.meta.requestId,fulfilledTimeStamp:V.meta.timestamp,baseQueryMeta:{}},q,!0)}},prepare:M=>({payload:M.map(D=>{let{endpointName:q,arg:U,value:H}=D,Q=o[q];return{queryDescription:{type:Xi,endpointName:q,originalArgs:D.arg,queryCacheKey:n({queryArgs:U,endpointDefinition:Q,endpointName:q})},value:H}}),meta:{[Ni]:!0,requestId:Mi(),timestamp:Date.now()}})},queryResultPatched:{reducer(M,{payload:{queryCacheKey:V,patches:j}}){Zs(M,V,D=>{D.data=ud(D.data,j.concat())})},prepare:io()}},extraReducers(M){M.addCase(t.pending,(V,{meta:j,meta:{arg:D}})=>{let q=op(D);v(V,D,q,j)}).addCase(t.fulfilled,(V,{meta:j,payload:D})=>{let q=op(j.arg);R(V,j,D,q)}).addCase(t.rejected,(V,{meta:{condition:j,arg:D,requestId:q},error:U,payload:H})=>{Zs(V,D.queryCacheKey,Q=>{if(!j){if(Q.requestId!==q)return;Q.status=Wi,Q.error=H??U}})}).addMatcher(s,(V,j)=>{let{queries:D}=a(j);for(let[q,U]of Object.entries(D))(U?.status===zi||U?.status===Wi)&&(V[q]=U)})}}),y=dn({name:`${e}/mutations`,initialState:Js,reducers:{removeMutationResult:{reducer(M,{payload:V}){let j=Yi(V);j in M&&delete M[j]},prepare:io()}},extraReducers(M){M.addCase(r.pending,(V,{meta:j,meta:{requestId:D,arg:q,startedTimeStamp:U}})=>{q.track&&(V[Yi(j)]={requestId:D,status:tp,endpointName:q.endpointName,startedTimeStamp:U})}).addCase(r.fulfilled,(V,{payload:j,meta:D})=>{D.arg.track&&ey(V,D,q=>{q.requestId===D.requestId&&(q.status=zi,q.data=j,q.fulfilledTimeStamp=D.fulfilledTimeStamp)})}).addCase(r.rejected,(V,{payload:j,error:D,meta:q})=>{q.arg.track&&ey(V,q,U=>{U.requestId===q.requestId&&(U.status=Wi,U.error=j??D)})}).addMatcher(s,(V,j)=>{let{mutations:D}=a(j);for(let[q,U]of Object.entries(D))(U?.status===zi||U?.status===Wi)&&q!==U?.requestId&&(V[q]=U)})}}),b={tags:{},keys:{}},x=dn({name:`${e}/invalidation`,initialState:b,reducers:{updateProvidedBy:{reducer(M,V){var j,D,q;for(let{queryCacheKey:U,providedTags:H}of V.payload){I(M,U);for(let{type:Q,id:J}of H){let X=(D=(j=M.tags)[Q]??(j[Q]={}))[q=J||"__internal_without_id"]??(D[q]=[]);X.includes(U)||X.push(U)}M.keys[U]=H}},prepare:io()}},extraReducers(M){M.addCase(h.actions.removeQueryResult,(V,{payload:{queryCacheKey:j}})=>{I(V,j)}).addMatcher(s,(V,j)=>{var q,U,H;let{provided:D}=a(j);for(let[Q,J]of Object.entries(D.tags??{}))for(let[X,W]of Object.entries(J)){let te=(U=(q=V.tags)[Q]??(q[Q]={}))[H=X||"__internal_without_id"]??(U[H]=[]);for(let le of W)te.includes(le)||te.push(le),V.keys[le]=D.keys[le]}}).addMatcher(Kt(lr(t),Di(t)),(V,j)=>{_(V,[j])}).addMatcher(h.actions.cacheEntriesUpserted.match,(V,j)=>{let D=j.payload.map(({queryDescription:q,value:U})=>({type:"UNKNOWN",payload:U,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:q}}));_(V,D)})}});function I(M,V){let j=Jh(M.keys[V]??[]);for(let D of j){let q=D.type,U=D.id??"__internal_without_id",H=M.tags[q]?.[U];H&&(M.tags[q][U]=Jh(H).filter(Q=>Q!==V))}delete M.keys[V]}function _(M,V){let j=V.map(D=>{let q=Sy(D,"providesTags",o,u),{queryCacheKey:U}=D.meta.arg;return{queryCacheKey:U,providedTags:q}});x.caseReducers.updateProvidedBy(M,x.actions.updateProvidedBy(j))}let T=dn({name:`${e}/subscriptions`,initialState:Js,reducers:{updateSubscriptionOptions(M,V){},unsubscribeQueryResult(M,V){},internal_getRTKQSubscriptions(){}}}),P=dn({name:`${e}/internalSubscriptions`,initialState:Js,reducers:{subscriptionsUpdated:{reducer(M,V){return ud(M,V.payload)},prepare:io()}}}),A=dn({name:`${e}/config`,initialState:{online:OI(),focused:kI(),middlewareRegistered:!1,...c},reducers:{middlewareRegistered(M,{payload:V}){M.middlewareRegistered=M.middlewareRegistered==="conflict"||i!==V?"conflict":!0}},extraReducers:M=>{M.addCase(cp,V=>{V.online=!0}).addCase(fy,V=>{V.online=!1}).addCase(sp,V=>{V.focused=!0}).addCase(py,V=>{V.focused=!1}).addMatcher(s,V=>({...V}))}}),O=Jn({queries:h.reducer,mutations:y.reducer,provided:x.reducer,subscriptions:P.reducer,config:A.reducer}),k=(M,V)=>O(g.match(V)?void 0:M,V),N={...A.actions,...h.actions,...T.actions,...P.actions,...y.actions,...x.actions,resetApiState:g};return{reducer:k,actions:N}}var ep=Symbol.for("RTKQ/skipToken"),by={status:hr},ty=cn(by,()=>{}),ry=cn(by,()=>{});function YI({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=T=>ty,o=T=>ry;return{buildQuerySelector:R,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:b,selectCachedArgsForQuery:x,selectApiState:a,selectQueries:s,selectMutations:c,selectQueryEntry:u,selectConfig:g};function i(T){return{...T,...Hh(T.status)}}function a(T){return T[t]}function s(T){return a(T)?.queries}function u(T,P){return s(T)?.[P]}function c(T){return a(T)?.mutations}function g(T){return a(T)?.config}function v(T,P,A){return O=>{if(O===ep)return r(n,A);let k=e({queryArgs:O,endpointDefinition:P,endpointName:T});return r(M=>u(M,k)??ty,A)}}function R(T,P){return v(T,P,i)}function h(T,P){let{infiniteQueryOptions:A}=P;function O(k){let N={...k,...Hh(k.status)},{isLoading:M,isError:V,direction:j}=N,D=j==="forward",q=j==="backward";return{...N,hasNextPage:I(A,N.data,N.originalArgs),hasPreviousPage:_(A,N.data,N.originalArgs),isFetchingNextPage:M&&D,isFetchingPreviousPage:M&&q,isFetchNextPageError:V&&D,isFetchPreviousPageError:V&&q}}return v(T,P,O)}function y(){return T=>{let P;return typeof T=="object"?P=Yi(T)??ep:P=T,r(P===ep?o:k=>a(k)?.mutations?.[P]??ry,i)}}function b(T,P){let A=T[t],O=new Set,k=rp(P,ap,hy);for(let N of k){let M=A.provided.tags[N.type];if(!M)continue;let V=(N.id!==void 0?M[N.id]:Object.values(M).flat())??[];for(let j of V)O.add(j)}return Array.from(O.values()).flatMap(N=>{let M=A.queries[N];return M?{queryCacheKey:N,endpointName:M.endpointName,originalArgs:M.originalArgs}:[]})}function x(T,P){return rp(Object.values(s(T)),A=>A?.endpointName===P&&A.status!==hr,A=>A.originalArgs)}function I(T,P,A){return P?ip(T,P,A)!=null:!1}function _(T,P,A){return!P||!T.getPreviousPageParam?!1:vy(T,P,A)!=null}}var ny=WeakMap?new WeakMap:void 0,oy=({endpointName:e,queryArgs:t})=>{let r="",n=ny?.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=Wt(a)?Object.keys(a).sort().reduce((s,u)=>(s[u]=a[u],s),{}):a,a));Wt(t)&&ny?.set(t,o),r=o}return`${e}(${r})`};function XI(...e){return function(r){let n=ro(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=oy;if("serializeQueryArgs"in c.endpointDefinition){let v=c.endpointDefinition.serializeQueryArgs;g=R=>{let h=v(R);return typeof h=="string"?h:oy({...R,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(c)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(c){c()},apiUid:Mi(),extractRehydrationInfo:n,hasRehydrationInfo:ro(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(Io(i,v)):Object.assign(Io(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:Xi}),mutation:v=>({...v,type:my}),infiniteQuery:v=>({...v,type:gy})});for(let[v,R]of Object.entries(g)){if(c.overrideExisting!==!0&&v in i.endpointDefinitions){if(c.overrideExisting==="throw")throw new Error(gt(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 ZI=({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:_,requestId:T,options:P}=x.payload,A=b.get(_);return A?.has(T)&&A.set(T,P),!0}if(u.match(x)){let{queryCacheKey:_,requestId:T}=x.payload,P=b.get(_);return P&&P.delete(T),!0}if(e.internalActions.removeQueryResult.match(x))return b.delete(x.payload.queryCacheKey),!0;if(t.pending.match(x)){let{meta:{arg:_,requestId:T}}=x,P=ec(b,_.queryCacheKey,np);return _.subscribe&&P.set(T,_.subscriptionOptions??P.get(T)??{}),!0}let I=!1;if(t.rejected.match(x)){let{meta:{condition:_,arg:T,requestId:P}}=x;if(_&&T.subscribe){let A=ec(b,T.queryCacheKey,np);A.set(P,T.subscriptionOptions??A.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),_=!0;if(I){a||(a=setTimeout(()=>{let A=y(r.currentSubscriptions),[,O]=cd(i,()=>A);x.next(e.internalActions.subscriptionsUpdated(O)),i=A,a=null},500));let T=typeof b.type=="string"&&!!b.type.startsWith(o),P=t.rejected.match(b)&&b.meta.condition&&!!b.meta.arg.subscribe;_=!T&&!P}return[_,!1]}},JI=2147483647/1e3-1,eT=({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=Kt(g.match,r.fulfilled,r.rejected,v.match);function h(T){let P=o.currentSubscriptions.get(T);return P?P.size>0:!1}let y={};function b(T){for(let P of T.values())P?.abort?.()}let x=(T,P)=>{let A=P.getState(),O=a(A);if(R(T)){let k;if(v.match(T))k=T.payload.map(N=>N.queryDescription.queryCacheKey);else{let{queryCacheKey:N}=g.match(T)?T.payload:T.meta.arg;k=[N]}I(k,P,O)}if(t.util.resetApiState.match(T)){for(let[k,N]of Object.entries(y))N&&clearTimeout(N),delete y[k];b(o.runningQueries),b(o.runningMutations)}if(n.hasRehydrationInfo(T)){let{queries:k}=n.extractRehydrationInfo(T);I(Object.keys(k),P,O)}};function I(T,P,A){let O=P.getState();for(let k of T){let N=i(O,k);N?.endpointName&&_(k,N.endpointName,P,A)}}function _(T,P,A,O){let N=Io(n,P)?.keepUnusedDataFor??O.keepUnusedDataFor;if(N===1/0)return;let M=Math.max(0,Math.min(N,JI));if(!h(T)){let V=y[T];V&&clearTimeout(V),y[T]=setTimeout(()=>{if(!h(T)){let j=i(A.getState(),T);j?.endpointName&&A.dispatch(s(j.endpointName,j.originalArgs))?.abort(),A.dispatch(c({queryCacheKey:T}))}delete y[T]},M*1e3)}}return x},iy=new Error("Promise never resolved before cacheEntryRemoved."),tT=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:a,selectApiState:s}})=>{let u=ps(n),c=ps(o),g=lr(n,o),v={},{removeQueryResult:R,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function b(A,O,k){let N=v[A];N?.valueResolved&&(N.valueResolved({data:O,meta:k}),delete N.valueResolved)}function x(A){let O=v[A];O&&(delete v[A],O.cacheEntryRemoved())}function I(A){let{arg:O,requestId:k}=A.meta,{endpointName:N,originalArgs:M}=O;return[N,M,k]}let _=(A,O,k)=>{let N=T(A);function M(V,j,D,q){let U=a(k,j),H=a(O.getState(),j);!U&&H&&P(V,q,j,O,D)}if(n.pending.match(A)){let[V,j,D]=I(A);M(V,N,D,j)}else if(y.match(A))for(let{queryDescription:V,value:j}of A.payload){let{endpointName:D,originalArgs:q,queryCacheKey:U}=V;M(D,U,A.meta.requestId,q),b(U,j,{})}else if(o.pending.match(A)){if(O.getState()[t].mutations[N]){let[j,D,q]=I(A);P(j,D,N,O,q)}}else if(g(A))b(N,A.payload,A.meta.baseQueryMeta);else if(R.match(A)||h.match(A))x(N);else if(e.util.resetApiState.match(A))for(let V of Object.keys(v))x(V)};function T(A){return u(A)?A.meta.arg.queryCacheKey:c(A)?A.meta.arg.fixedCacheKey??A.meta.requestId:R.match(A)?A.payload.queryCacheKey:h.match(A)?Yi(A.payload):""}function P(A,O,k,N,M){let V=Io(r,A),j=V?.onCacheEntryAdded;if(!j)return;let D={},q=new Promise(W=>{D.cacheEntryRemoved=W}),U=Promise.race([new Promise(W=>{D.valueResolved=W}),q.then(()=>{throw iy})]);U.catch(()=>{}),v[k]=D;let H=e.endpoints[A].select(tc(V)?O:k),Q=N.dispatch((W,te,le)=>le),J={...N,getCacheEntry:()=>H(N.getState()),requestId:M,extra:Q,updateCachedData:tc(V)?W=>N.dispatch(e.util.updateQueryData(A,O,W)):void 0,cacheDataLoaded:U,cacheEntryRemoved:q},X=j(O,J);Promise.resolve(X).catch(W=>{if(W!==iy)throw W})}return _},rT=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},nT=({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=Kt(lr(n),Di(n)),v=Kt(lr(o,n),ln(o,n)),R=[],h=0,y=(I,_)=>{(o.pending.match(I)||n.pending.match(I))&&h++,v(I)&&(h=Math.max(0,h-1)),g(I)?x(Sy(I,"invalidatesTags",r,a),_):v(I)?x([],_):i.util.invalidateTags.match(I)&&x(up(I.payload,void 0,void 0,void 0,void 0,a),_)};function b(){return h>0}function x(I,_){let T=_.getState(),P=T[e];if(R.push(...I),P.config.invalidationBehavior==="delayed"&&b())return;let A=R;if(R=[],A.length===0)return;let O=i.util.selectInvalidatedBy(T,A);t.batch(()=>{let k=Array.from(O.values());for(let{queryCacheKey:N}of k){let M=P.queries[N],V=ec(u.currentSubscriptions,N,np);M&&(V.size===0?_.dispatch(c({queryCacheKey:N})):M.status!==hr&&_.dispatch(s(M)))}})}return y},oT=({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 _ of s)R({queryCacheKey:_},I);s.clear(),u=null},0))}function v({queryCacheKey:x},I){let _=I.getState()[e],T=_.queries[x],P=a.get(x);if(!T||T.status===hr)return;let{lowestPollingInterval:A,skipPollingIfUnfocused:O}=b(P);if(!Number.isFinite(A))return;let k=i.get(x);k?.timeout&&(clearTimeout(k.timeout),k.timeout=void 0);let N=Date.now()+A;i.set(x,{nextPollTimestamp:N,pollingInterval:A,timeout:setTimeout(()=>{(_.config.focused||!O)&&I.dispatch(n(T)),v({queryCacheKey:x},I)},A)})}function R({queryCacheKey:x},I){let T=I.getState()[e].queries[x],P=a.get(x);if(!T||T.status===hr)return;let{lowestPollingInterval:A}=b(P);if(!Number.isFinite(A)){h(x);return}let O=i.get(x),k=Date.now()+A;(!O||k<O.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,_=Number.POSITIVE_INFINITY;for(let T of x.values())T.pollingInterval&&(_=Math.min(T.pollingInterval,_),I=T.skipPollingIfUnfocused||I);return{lowestPollingInterval:_,skipPollingIfUnfocused:I}}return c},iT=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=ds(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=Io(t,R),b=y?.onQueryStarted;if(b){let x={},I=new Promise((A,O)=>{x.resolve=A,x.reject=O});I.catch(()=>{}),s[v]=x;let _=e.endpoints[R].select(tc(y)?h:v),T=g.dispatch((A,O,k)=>k),P={...g,getCacheEntry:()=>_(g.getState()),requestId:v,extra:T,updateCachedData:tc(y)?A=>g.dispatch(e.util.updateQueryData(R,h,A)):void 0,queryFulfilled:I};b(h,P)}}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]}}},aT=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,a=(u,c)=>{sp.match(u)&&s(c,"refetchOnFocus"),cp.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(_=>_[c]===!0)||x.every(_=>_[c]===void 0)&&g.config[c])&&(b.size===0?u.dispatch(i({queryCacheKey:h})):y.status!==hr&&u.dispatch(n(y)))}})}return a};function sT(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=[rT,eT,nT,oT,tT,iT];return{middleware:R=>{let h=!1,y=i(R.dispatch),b={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:u,mwApi:R},x=c.map(T=>T(b)),I=ZI(b),_=aT(b);return T=>P=>{if(!Si(P))return T(P);h||(h=!0,R.dispatch(n.internalActions.middlewareRegistered(a)));let A={...R,next:T},O=R.getState(),[k,N]=I(P,A,O),M;if(k?M=T(P):M=N,R.getState()[t]&&(_(P,A,O),u(P)||o.hasRehydrationInfo(P)))for(let V of x)V(P,A,O);return M}},actions:s};function v(R){return e.api.endpoints[R.endpointName].initiate(R.originalArgs,{subscribe:!1,forceRefetch:!0})}}var ay=Symbol(),cT=({createSelector:e=ze}={})=>({name:ay,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){Km();let b=ve=>(typeof process<"u",ve);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:cp,onOffline:fy,onFocus:sp,onFocusLost:py},util:{}});let x=YI({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:_,buildQuerySelector:T,buildInfiniteQuerySelector:P,buildMutationSelector:A}=x;gr(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:_});let{queryThunk:O,infiniteQueryThunk:k,mutationThunk:N,patchQueryData:M,updateQueryData:V,upsertQueryData:j,prefetch:D,buildMatchThunkActions:q}=WI({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:b,selectors:x,onSchemaFailure:v,catchSchemaFailure:R,skipSchemaValidation:h}),{reducer:U,actions:H}=KI({context:y,queryThunk:O,infiniteQueryThunk:k,mutationThunk:N,serializeQueryArgs:i,reducerPath:o,assertTagType:b,config:{refetchOnFocus:u,refetchOnReconnect:c,refetchOnMountOrArgChange:s,keepUnusedDataFor:a,reducerPath:o,invalidationBehavior:g}});gr(t.util,{patchQueryData:M,updateQueryData:V,upsertQueryData:j,prefetch:D,resetApiState:H.resetApiState,upsertQueryEntries:H.cacheEntriesUpserted}),gr(t.internalActions,H);let Q=new WeakMap,J=ve=>ec(Q,ve,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:X,buildInitiateInfiniteQuery:W,buildInitiateMutation:te,getRunningMutationThunk:le,getRunningMutationsThunk:_e,getRunningQueriesThunk:Ve,getRunningQueryThunk:Fe}=zI({queryThunk:O,mutationThunk:N,infiniteQueryThunk:k,api:t,serializeQueryArgs:i,context:y,getInternalState:J});gr(t.util,{getRunningMutationThunk:le,getRunningMutationsThunk:_e,getRunningQueryThunk:Fe,getRunningQueriesThunk:Ve});let{middleware:Me,actions:Le}=sT({reducerPath:o,context:y,queryThunk:O,mutationThunk:N,infiniteQueryThunk:k,api:t,assertTagType:b,selectors:x,getRunningQueryThunk:Fe,getInternalState:J});return gr(t.util,Le),gr(t,{reducer:U,middleware:Me}),{name:ay,injectEndpoint(ve,ge){var He;let Se=(He=t.endpoints)[ve]??(He[ve]={});nc(ge)&&gr(Se,{name:ve,select:T(ve,ge),initiate:X(ve,ge)},q(O,ve)),$I(ge)&&gr(Se,{name:ve,select:A(),initiate:te(ve)},q(N,ve)),oc(ge)&&gr(Se,{name:ve,select:P(ve,ge),initiate:W(ve,ge)},q(O,ve))}}}}),Ay=XI(cT());m();d();f();p();m();d();f();p();var hn=e=>e.query,wy=e=>e.query?.enableQuerySyntax;var a$=ze(e=>hn(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})),uT=ze(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();var ic=e=>{if(e==="yes")return!0;if(e==="no")return!1},lT=()=>De("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function dT(e,t){return De({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??je(n),i=So(n,e);if(!o||!i)return null;let a=Or(n);return r.makeGeneratedAnswerCitationClick(Lh(i,n),{generativeQuestionAnsweringId:o,citationId:i.id,documentId:Uh(i),...(a&&{conversationId:a})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=So(r,e);return{answerId:t??je(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function pT(e,t,r){return De({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let i=r??je(o),a=So(o,e);if(!i||!a)return null;let s=Or(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:i,permanentId:a.permanentid,citationId:a.id,citationHoverTimeMs:t,...(s&&{conversationId:s})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=So(n,e);return{answerId:r??je(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function fT(e,t){return De({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function mT(e){return De({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=Or(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"like"})})}function gT(e){return De({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=Or(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"dislike"})})}var hT=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:ic(o),documented:ic(i),correctTopic:ic(s),hallucinationFree:ic(a)},additionalNotes:c,correctAnswerUrl:u}}}),lp=(e,t,r)=>De({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let i=t??je(o);if(!i)return null;let a=Or(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})}),To=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||""})}),yT=()=>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"})}),vT=()=>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"})}),ST=()=>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"})}),bT=()=>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 AT(e){return De({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=Or(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"copyToClipboard"})})}function wT(e,t){return De({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=So(n,e);if(!o)return null;let i=Or(n);return i?r.makeGeneratedAnswerFollowupOpenSource({...qh(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:i}):null}})}var ac={logCopyGeneratedAnswer:AT,logGeneratedAnswerHideAnswers:vT,logGeneratedAnswerShowAnswers:yT,logGeneratedAnswerStreamEnd:lp,logGeneratedAnswerFeedback:hT,logDislikeGeneratedAnswer:gT,logLikeGeneratedAnswer:mT,logGeneratedAnswerOpenInlineLink:fT,logHoverCitation:pT,logOpenGeneratedAnswerSource:dT,logOpenGeneratedAnswerFollowUpSource:wT,logRetryGeneratedAnswer:lT,logGeneratedAnswerExpand:ST,logGeneratedAnswerCollapse:bT};m();d();f();p();m();d();f();p();var xy=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 Zi=(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 dp=e=>e.context;m();d();f();p();var pp=e=>e.pipeline;m();d();f();p();m();d();f();p();var Ji=jt(sc(),1),_y=jt(Cy(),1);m();d();f();p();var cc=jt(sc(),1),Ry=jt(Ey(),1);cc.default.extend(Ry.default);var Iy="YYYY/MM/DD@HH:mm:ss",xT="1401-01-01";function _o(e,t){let r=(0,cc.default)(e,t);return!r.isValid()&&!t?(0,cc.default)(e,Iy):r}function uc(e){return e.format(Iy)}function Ty(e,t){let r=_o(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}`)}Sp(r)}function Sp(e){if(e.isBefore(xT))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}Ji.default.extend(_y.default);var ky=["past","now","next"],Oy=["minute","hour","day","week","month","quarter","year"],CT=e=>{let t=e==="now";return{amount:new oe({required:!t,min:1}),unit:new z({required:!t,constrainTo:Oy}),period:new z({required:!0,constrainTo:ky})}};function bp(e){if(typeof e=="string"&&!Fr(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?My(e):e;new yt(CT(t.period)).validate(t);let r=Ny(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);Sp(r)}function Py(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function Ny(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Ji.default)().subtract(r,n);case"next":return(0,Ji.default)().add(r,n);case"now":return(0,Ji.default)()}}function ea(e){return uc(Ny(My(e)))}function Fy(e){return e.toLocaleLowerCase().split("-")}function Fr(e){let[t,r,n]=Fy(e);if(t==="now")return!0;if(!ky.includes(t)||!Oy.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function Dy(e){return!!e&&typeof e=="object"&&"period"in e}function My(e){let[t,r,n]=Fy(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function Ly(e){return e.type==="dateRange"}function qy(e){return`start${e}`}function jy(e){return`end${e}`}var Ap=()=>({dateFacetValueMap:{}});function ET(e,t,r){let n=e.start,o=e.end;return Fr(n)&&(n=ea(n),r.dateFacetValueMap[t][qy(n)]=e.start),Fr(o)&&(o=ea(o),r.dateFacetValueMap[t][jy(o)]=e.end),{...e,start:n,end:o}}function wp(e,t){if(Ly(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>ET(o,r,t))}}return e}function Dr(e){let t=Ap();return{request:{...e,facets:e.facets?.map(n=>wp(n,t))},mappings:t}}function RT(e,t,r){return{...e,start:r.dateFacetValueMap[t][qy(e.start)]||e.start,end:r.dateFacetValueMap[t][jy(e.end)]||e.end}}function IT(e,t){return e.facetId in t.dateFacetValueMap}function TT(e,t){return IT(e,t)?{...e,values:e.values.map(r=>RT(r,e.facetId,t))}:e}function lc(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>TT(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function Mr(e){return Object.values(e).map(t=>t.request)}function xp(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 Uy(e){return Mr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Cp={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function _T(e){return Mr(e).map(t=>{let r=Cp[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function kT(e){return[..._T(e.facetSet??{}),...Uy(e.numericFacetSet??{}),...Uy(e.dateFacetSet??{}),...Mr(e.categoryFacetSet??{})]}function OT(e){return kT(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function dc(e){return xp(OT(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();var Lr=/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??xr(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 Ws(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 Lr(_x67,_x68){return _ref29.apply(this,arguments)}}();m();d();f();p();var ko=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??xr(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&&Zi(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 Vy=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 qr=/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t,r){let n=Rp(e),o=PT(e),i=NT(e),a=e.configuration.analytics.analyticsMode==="legacy"?yield Lr(e,r):ko(e,t,r);return Dr({...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:Ep(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 qr(_x69,_x70,_x71){return _ref30.apply(this,arguments)}}();function Ep(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function PT(e){return xp(DT(e),e.facetOrder??[])}function NT(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(FT).filter(r=>r.currentValues.length>0):void 0}function FT(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function DT(e){return MT(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function MT(e){return[...LT(e.facetSet??{}),...Gy(e.numericFacetSet??{}),...Gy(e.dateFacetSet??{}),...Mr(e.categoryFacetSet??{})]}function LT(e){return Mr(e).map(t=>{let r=Cp[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function Gy(e){return Mr(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 Rp(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=Vy(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();f();p();m();d();f();p();var ta=(e,t)=>{let r=e;return ce(r[t])?ce(e.raw[t])?null:e.raw[t]:r[t]},qT=e=>t=>e.every(r=>!ce(ta(t,r))),jT=e=>t=>e.every(r=>ce(ta(t,r))),UT=(e,t)=>r=>{let n=By(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},VT=(e,t)=>r=>{let n=By(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},By=(e,t)=>{let r=ta(t,e);return dm(r)?r:[r]},$y={getResultProperty:ta,fieldsMustBeDefined:qT,fieldsMustNotBeDefined:jT,fieldMustMatch:UT,fieldMustNotMatch:VT};var Ip=ze(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var Tp=e=>e.searchHub;m();d();f();p();var pc=ze(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),VH=ze(e=>e,e=>{let t=pc(e);return t&&e?e[t].expression:""});m();d();f();p();var Qy=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var Hy=e=>e.excerptLength?.length;m();d();f();p();var zy=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var Wy=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 Ky=e=>e.sortCriteria;var Yy=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Zn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function Yy(_x72){return _ref31.apply(this,arguments)}}(),Xy=(e,t)=>{let r=hn(e)?.q,{aq:n,cq:o,dq:i,lq:a}=ev(e),s=dp(e),u=Zi(e.configuration.analytics,t,{actionCause:Ip(e)}),c=Tp(e),g=pp(e),v=Gd(e)??[],R=Jy(e),h=pc(e.tabSet)||"default",y=Ud(e),b=dh(e),x=t.referrer||"",I=zy(e),_=Ky(e),T=GT(e),P=Hy(e),A=Wy(e),O=Qy(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(a&&{lq:a}),...(e.query&&{enableQuerySyntax:wy(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:Ep(e),firstResult:e.pagination.firstResult}),tab:h,locale:y,timezone:b,...(e.debug!==void 0&&{debug:e.debug}),referrer:x,...T,...(A??{}),...(P&&{excerptLength:P}),...(O&&{dictionaryFieldContext:O}),sortCriteria:_,...(I&&{facetOptions:I}),...u,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Zy=(e,t)=>{let r=hn(e)?.q,n=Jy(e),o=Zi(e.configuration.analytics,t,{actionCause:Ip(e)}),i=Ud(e),a=pc(e.tabSet)||"default",s=t.referrer,{aq:u,cq:c}=ev(e),g=Tp(e),v=pp(e),R=dp(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}},Jy=e=>dc(e)?.map(t=>wp(t,Ap())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),GT=e=>({actionsHistory:e.configuration.analytics.enabled?ht.getInstance().getHistory():[]}),ev=e=>{let t=xy(e),r=Rp(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var fc=["searching","thinking","answering"];function mc(e){return e.toLowerCase()}var gc=["search","generic"];m();d();f();p();var tv=["text/plain","text/markdown"];var Oo=new z({required:!0}),rv=new z,Po=new me({required:!0}),_p={id:Oo,title:Oo,uri:Oo,permanentid:Oo,clickUri:rv},hc=new z({required:!0,constrainTo:tv}),nv=new z({required:!0,constrainTo:fc}),ov=e=>({...e,name:mc(e.name)}),sz=L("generatedAnswer/setIsVisible",e=>B(e,Po)),yc=L("generatedAnswer/setAnswerId",e=>B(e,Y)),cz=L("generatedAnswer/setAnswerGenerationMode",e=>B(e,new z({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),uz=L("generatedAnswer/setIsEnabled",e=>B(e,Po)),na=L("generatedAnswer/updateMessage",e=>B(e,{textDelta:Oo})),oa=L("generatedAnswer/updateCitations",e=>B(e,{citations:new Ae({required:!0,each:new ne({values:_p})})})),ia=L("generatedAnswer/updateError",e=>B(e,{message:rv,code:new oe({min:0})})),vc=L("generatedAnswer/resetAnswer"),lz=L("generatedAnswer/like"),dz=L("generatedAnswer/dislike"),pz=L("generatedAnswer/feedbackModal/open"),fz=L("generatedAnswer/expand"),mz=L("generatedAnswer/collapse"),gz=L("generatedAnswer/setId",e=>B(e,{id:new z({required:!0})})),hz=L("generatedAnswer/feedbackModal/close"),yz=L("generatedAnswer/sendFeedback"),jr=L("generatedAnswer/setIsLoading",e=>B(e,Po)),ra=L("generatedAnswer/setIsStreaming",e=>B(e,Po)),aa=L("generatedAnswer/setAnswerContentFormat",e=>B(e,hc)),vz=L("generatedAnswer/updateResponseFormat",e=>B(e,{contentFormat:new Ae({each:hc,default:["text/plain"]})})),Sz=L("knowledge/updateAnswerConfigurationId",e=>B(e,Oo)),bz=L("generatedAnswer/registerFieldsToIncludeInCitations",e=>B(e,gs)),kp=L("generatedAnswer/setIsAnswerGenerated",e=>B(e,Po)),sa=L("generatedAnswer/setCannotAnswer",e=>B(e,Po)),BT=L("generatedAnswer/setAnswerApiQueryParams",e=>B(e,new ne({}))),iv=L("generatedAnswer/startStep",e=>B(ov(e),{name:nv,startedAt:new oe({min:0,required:!0})})),av=L("generatedAnswer/finishStep",e=>B(ov(e),{name:nv,finishedAt:new oe({min:0,required:!0})})),sv=L("generatedAnswer/startToolCall",e=>B(e,{toolCallName:Y,startedAt:new oe({min:0,required:!0}),toolCallId:Y})),cv=L("generatedAnswer/finishToolCall",e=>B(e,{finishedAt:new oe({min:0,required:!0}),toolCallId:Y})),Sc=L("generatedAnswer/toolCallArgs",e=>B(e,{toolCallId:Y,args:new ne({options:{required:!0}}),type:new z({required:!0,constrainTo:gc})})),Az=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 Yy(r),v=(y,b)=>{switch(y){case"genqa.headerMessageType":{let x=JSON.parse(b);n(aa(x.contentFormat));break}case"genqa.messageType":n(na(JSON.parse(b)));break;case"genqa.citationsType":n(oa(JSON.parse(b)));break;case"genqa.endOfStreamType":{let x=JSON.parse(b).answerGenerated,{answerId:I,answer:_}=i().generatedAnswer,P=u.length!==0&&!x,A=!_?.trim();n(sa(P)),n(ra(!1)),n(kp(x)),n((a??ac).logGeneratedAnswerStreamEnd(x,I,x?A:void 0)),n(To());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${y}"`)}};n(jr(!0));let R=y=>y.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:y=>{R(g)&&(n(jr(!1)),y.payload&&y.payloadType&&v(y.payloadType,y.payload))},abort:y=>{R(g)&&n(ia(y))},close:()=>{R(g)&&n(ra(!1))},resetAnswer:()=>{R(g)&&n(vc())}});h?c(h):n(jr(!1))});return function(_x73,_x74){return _ref32.apply(this,arguments)}}()),wz=ke("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(vc());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=Xy(i,n);r(BT(a)),yield r(uv(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 dv(_x77,_x78){return _dv.apply(this,arguments)}function _dv(){_dv=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _dv.apply(this,arguments)}function pv(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=QT(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 fv(e,t,r){let n=lv(),o=new TextDecoder;return function(a,s){if(a.length===0)r?.(n),n=lv();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":$T(g,n,t);break}}}}function $T(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function QT(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function lv(){return{data:"",event:"",id:"",retry:void 0}}var Op="text/event-stream",HT=1e3,mv="last-event-id";function gv(){return typeof window<"u"}function hv(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=Op);let h;function y(){h?.abort(),document.hidden||P()}!s&&gv()&&document.addEventListener("visibilitychange",y);let b=HT,x;function I(){gv()&&document.removeEventListener("visibilitychange",y),clearTimeout(x),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let _=u??C,T=n??zT;function P(){return _P2.apply(this,arguments)}function _P2(){_P2=_asyncToGenerator(function*(){h=l.AbortController?new l.AbortController:null;try{let A=yield _(e,{...c,headers:R,signal:h?.signal});yield T(A),yield dv(A.body,pv(fv(O=>{O?R[mv]=O:delete R[mv]},O=>{b=O},o))),i?.(),I(),g()}catch(A){if(!h?.signal?.aborted)try{let O=a?.(A)??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(Op))throw new Error(`Expected content-type to be ${Op}, Actual: ${t}`)}m();d();f();p();var WT=/*#__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=Zn(n.configuration.search?.apiBaseUrl,a,i);return cy({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 WT(_x79,_x80,_x81){return _ref34.apply(this,arguments)}}(),yv=Ay({reducerPath:"answer",baseQuery:ly(WT,{maxRetries:3}),endpoints:()=>({})});var KT=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},YT=(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)},XT=(e,t)=>{delete e.error,e.citations=t.citations},ZT=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},JT=(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})`)},e0=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&JT(t,o);let i=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":i.contentFormat&&(KT(t,i),r(aa(i.contentFormat)));break;case"genqa.messageType":typeof i.textDelta=="string"&&(YT(t,i),r(na({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(XT(t,i),r(oa({citations:i.citations})));break;case"genqa.endOfStreamType":{ZT(t,i);let a=t.answerId,s=i.answerGenerated??!1,u=s?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(s,a,u)),r(To());break}}},t0=(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`},Pp=yv.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=Zn(s.search.apiBaseUrl,v,R),b=t0(y,v,u.answerConfigurationId,c?.insightId);yield hv(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(_=>{_.answerId=I,i(yc(I))})});return function onopen(_x85){return _ref36.apply(this,arguments)}}(),onmessage:x=>{o(I=>{e0(x,I,i,g??ac)})},onerror:x=>{throw x},onclose:()=>{o(x=>{i(sa(!x.generated))})}})}).apply(this,arguments)}})})}),uv=e=>Pp.endpoints.getAnswer.initiate(e);m();d();f();p();var vv=Be(ao,e=>e);m();d();f();p();function r0(e){let t=e.payload?.analyticsAction;return Sv(e)&&!ce(t)}function Sv(e){return"type"in e}var bv=e=>t=>r=>{let n;r0(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return Sv(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 SW=L("tab/register",e=>{let t=new ne({values:{id:Y,expression:nt}});return B(e,t)}),bc=L("tab/updateActiveTab",e=>B(e,Y));m();d();f();p();var Ac=jt(sc(),1),xv=jt(Av(),1),Cv=jt(wv(),1);Ac.default.extend(Cv.default);Ac.default.extend(xv.default);var Ev=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:Ac.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 n0=/(^|; )Coveo-Pendragon=([^;]*)/,o0=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function Rv(){return typeof window>"u"?!1:n0.exec(document.cookie)?.pop()||null}function Iv(){return typeof window>"u"?!1:o0.test(document.cookie)}var Tv=Be(Ev(),e=>e.addCase(Ir,(t,r)=>{i0(t,r.payload)}).addCase(Yt,(t,r)=>{a0(t,r.payload)}).addCase(so,(t,r)=>{s0(t,r.payload)}).addCase(co,t=>{t.analytics.enabled=!1}).addCase(uo,t=>{t.analytics.enabled=!0}).addCase(hs,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(ys,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(bc,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Ng,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Tr,(t,r)=>{ce(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Og,(t,{payload:r})=>{c0(t,r)}));function i0(e,t){ce(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ce(t.organizationId)||(e.organizationId=t.organizationId)}function a0(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 s0(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=Rv();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 c0(e,t){e.knowledge.agentId=t;try{Iv()&&(e.knowledge.debugAgentSession=!0)}catch{}}var Vt=Tv;m();d();f();p();function u0(e){return e.instantlyCallable}var _v=()=>e=>t=>e(u0(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 kv(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 Lp,l0=new Uint8Array(16);function qp(){if(!Lp){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Lp=crypto.getRandomValues.bind(crypto)}return Lp(l0)}m();d();f();p();m();d();f();p();var d0=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),jp={randomUUID:d0};function p0(e,t,r){if(jp.randomUUID&&!t&&!e)return jp.randomUUID();e=e||{};let n=e.random??e.rng?.()??qp();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 kv(n)}var Ur=p0;m();d();f();p();m();d();f();p();var S={};ui(S,{BRAND:()=>q0,DIRTY:()=>vn,EMPTY_PATH:()=>h0,INVALID:()=>pe,NEVER:()=>w_,OK:()=>pt,ParseStatus:()=>st,Schema:()=>xe,ZodAny:()=>Br,ZodArray:()=>br,ZodBigInt:()=>bn,ZodBoolean:()=>An,ZodBranded:()=>ua,ZodCatch:()=>Pn,ZodDate:()=>wn,ZodDefault:()=>On,ZodDiscriminatedUnion:()=>Cc,ZodEffects:()=>Dt,ZodEnum:()=>_n,ZodError:()=>bt,ZodFirstPartyTypeKind:()=>fe,ZodFunction:()=>Rc,ZodIntersection:()=>Rn,ZodIssueCode:()=>K,ZodLazy:()=>In,ZodLiteral:()=>Tn,ZodMap:()=>qo,ZodNaN:()=>Uo,ZodNativeEnum:()=>kn,ZodNever:()=>Gt,ZodNull:()=>Cn,ZodNullable:()=>tr,ZodNumber:()=>Sn,ZodObject:()=>At,ZodOptional:()=>Nt,ZodParsedType:()=>re,ZodPipeline:()=>la,ZodPromise:()=>$r,ZodReadonly:()=>Nn,ZodRecord:()=>Ec,ZodSchema:()=>xe,ZodSet:()=>jo,ZodString:()=>Gr,ZodSymbol:()=>Mo,ZodTransformer:()=>Dt,ZodTuple:()=>er,ZodType:()=>xe,ZodUndefined:()=>xn,ZodUnion:()=>En,ZodUnknown:()=>Sr,ZodVoid:()=>Lo,addIssueToContext:()=>ee,any:()=>z0,array:()=>X0,bigint:()=>G0,boolean:()=>Vv,coerce:()=>A_,custom:()=>qv,date:()=>B0,datetimeRegex:()=>Mv,defaultErrorMap:()=>yr,discriminatedUnion:()=>t_,effect:()=>f_,enum:()=>l_,function:()=>s_,getErrorMap:()=>No,getParsedType:()=>Jt,instanceof:()=>U0,intersection:()=>r_,isAborted:()=>wc,isAsync:()=>Fo,isDirty:()=>xc,isValid:()=>Vr,late:()=>j0,lazy:()=>c_,literal:()=>u_,makeIssue:()=>ca,map:()=>i_,nan:()=>V0,nativeEnum:()=>d_,never:()=>K0,null:()=>H0,nullable:()=>g_,number:()=>Uv,object:()=>Z0,objectUtil:()=>Up,oboolean:()=>b_,onumber:()=>S_,optional:()=>m_,ostring:()=>v_,pipeline:()=>y_,preprocess:()=>h_,promise:()=>p_,quotelessJson:()=>f0,record:()=>o_,set:()=>a_,setErrorMap:()=>g0,strictObject:()=>J0,string:()=>jv,symbol:()=>$0,transformer:()=>f_,tuple:()=>n_,undefined:()=>Q0,union:()=>e_,unknown:()=>W0,util:()=>Re,void:()=>Y0});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 Up;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Up||(Up={}));var re=Re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Jt=e=>{switch(typeof e){case"undefined":return re.undefined;case"string":return re.string;case"number":return Number.isNaN(e)?re.nan:re.number;case"boolean":return re.boolean;case"function":return re.function;case"bigint":return re.bigint;case"symbol":return re.symbol;case"object":return Array.isArray(e)?re.array:e===null?re.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?re.promise:typeof Map<"u"&&e instanceof Map?re.map:typeof Set<"u"&&e instanceof Set?re.set:typeof Date<"u"&&e instanceof Date?re.date:re.object;default:return re.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"]),f0=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 m0=(e,t)=>{let r;switch(e.code){case K.invalid_type:e.received===re.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}},yr=m0;var Ov=yr;function g0(e){Ov=e}function No(){return Ov}m();d();f();p();var ca=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}},h0=[];function ee(e,t){let r=No(),n=ca({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===yr?void 0:yr].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 pe;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 pe;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}}},pe=Object.freeze({status:"aborted"}),vn=e=>({status:"dirty",value:e}),pt=e=>({status:"valid",value:e}),wc=e=>e.status==="aborted",xc=e=>e.status==="dirty",Vr=e=>e.status==="valid",Fo=e=>typeof Promise<"u"&&e instanceof Promise;m();d();f();p();m();d();f();p();var ae;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ae||(ae={}));var Ft=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}},Pv=(e,t)=>{if(Vr(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 Jt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Jt(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:Jt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Fo(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:Jt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Pv(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Jt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Vr(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=>Vr(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:Jt(t)},o=_this11._parse({data:t,path:n.path,parent:n}),i=yield Fo(o)?o:Promise.resolve(o);return Pv(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 Dt({schema:this,typeName:fe.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 Nt.create(this,this._def)}nullable(){return tr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return br.create(this)}promise(){return $r.create(this,this._def)}or(t){return En.create([this,t],this._def)}and(t){return Rn.create(this,t,this._def)}transform(t){return new Dt({...be(this._def),schema:this,typeName:fe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new On({...be(this._def),innerType:this,defaultValue:r,typeName:fe.ZodDefault})}brand(){return new ua({typeName:fe.ZodBranded,type:this,...be(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Pn({...be(this._def),innerType:this,catchValue:r,typeName:fe.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return la.create(this,t)}readonly(){return Nn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},y0=/^c[^\s-]{8,}$/i,v0=/^[0-9a-z]+$/,S0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,b0=/^[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,A0=/^[a-z0-9_-]{21}$/i,w0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,x0=/^[-+]?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)?)??$/,C0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,E0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Vp,R0=/^(?:(?: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])$/,I0=/^(?:(?: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])$/,T0=/^(([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]))$/,_0=/^(([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])$/,k0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,O0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Fv="((\\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])))",P0=new RegExp(`^${Fv}$`);function Dv(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 N0(e){return new RegExp(`^${Dv(e)}$`)}function Mv(e){let t=`${Fv}T${Dv(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 F0(e,t){return!!((t==="v4"||!t)&&R0.test(e)||(t==="v6"||!t)&&T0.test(e))}function D0(e,t){if(!w0.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 M0(e,t){return!!((t==="v4"||!t)&&I0.test(e)||(t==="v6"||!t)&&_0.test(e))}var Gr=class e extends xe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==re.string){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:re.string,received:i.parsedType}),pe}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")C0.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")Vp||(Vp=new RegExp(E0,"u")),Vp.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")b0.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")A0.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")y0.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")v0.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")S0.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"?Mv(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"?P0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?N0(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"?x0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"duration",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?F0(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"?D0(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"?M0(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"?k0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"base64",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?O0.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,...ae.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ae.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ae.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ae.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ae.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ae.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ae.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ae.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ae.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ae.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ae.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ae.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ae.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ae.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,...ae.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,...ae.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ae.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ae.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ae.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ae.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ae.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ae.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ae.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ae.errToObj(r)})}nonempty(t){return this.min(1,ae.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}};Gr.create=e=>new Gr({checks:[],typeName:fe.ZodString,coerce:e?.coerce??!1,...be(e)});function L0(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 Sn=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)!==re.number){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:re.number,received:i.parsedType}),pe}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"?L0(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,ae.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ae.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ae.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ae.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ae.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ae.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ae.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ae.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ae.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ae.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ae.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ae.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ae.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ae.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)}};Sn.create=e=>new Sn({checks:[],typeName:fe.ZodNumber,coerce:e?.coerce||!1,...be(e)});var bn=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)!==re.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:re.bigint,received:r.parsedType}),pe}gte(t,r){return this.setLimit("min",t,!0,ae.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ae.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ae.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ae.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ae.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:ae.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ae.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ae.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ae.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ae.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}};bn.create=e=>new bn({checks:[],typeName:fe.ZodBigInt,coerce:e?.coerce??!1,...be(e)});var An=class extends xe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==re.boolean){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.boolean,received:n.parsedType}),pe}return pt(t.data)}};An.create=e=>new An({typeName:fe.ZodBoolean,coerce:e?.coerce||!1,...be(e)});var wn=class e extends xe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==re.date){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:re.date,received:i.parsedType}),pe}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_date}),pe}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:ae.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ae.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}};wn.create=e=>new wn({checks:[],coerce:e?.coerce||!1,typeName:fe.ZodDate,...be(e)});var Mo=class extends xe{_parse(t){if(this._getType(t)!==re.symbol){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.symbol,received:n.parsedType}),pe}return pt(t.data)}};Mo.create=e=>new Mo({typeName:fe.ZodSymbol,...be(e)});var xn=class extends xe{_parse(t){if(this._getType(t)!==re.undefined){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.undefined,received:n.parsedType}),pe}return pt(t.data)}};xn.create=e=>new xn({typeName:fe.ZodUndefined,...be(e)});var Cn=class extends xe{_parse(t){if(this._getType(t)!==re.null){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.null,received:n.parsedType}),pe}return pt(t.data)}};Cn.create=e=>new Cn({typeName:fe.ZodNull,...be(e)});var Br=class extends xe{constructor(){super(...arguments),this._any=!0}_parse(t){return pt(t.data)}};Br.create=e=>new Br({typeName:fe.ZodAny,...be(e)});var Sr=class extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return pt(t.data)}};Sr.create=e=>new Sr({typeName:fe.ZodUnknown,...be(e)});var Gt=class extends xe{_parse(t){let r=this._getOrReturnCtx(t);return ee(r,{code:K.invalid_type,expected:re.never,received:r.parsedType}),pe}};Gt.create=e=>new Gt({typeName:fe.ZodNever,...be(e)});var Lo=class extends xe{_parse(t){if(this._getType(t)!==re.undefined){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.void,received:n.parsedType}),pe}return pt(t.data)}};Lo.create=e=>new Lo({typeName:fe.ZodVoid,...be(e)});var br=class e extends xe{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==re.array)return ee(r,{code:K.invalid_type,expected:re.array,received:r.parsedType}),pe;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 Ft(r,a,r.path,s)))).then(a=>st.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Ft(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:ae.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ae.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ae.toString(r)}})}nonempty(t){return this.min(1,t)}};br.create=(e,t)=>new br({type:e,minLength:null,maxLength:null,exactLength:null,typeName:fe.ZodArray,...be(t)});function Do(e){if(e instanceof At){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Nt.create(Do(n))}return new At({...e._def,shape:()=>t})}else return e instanceof br?new br({...e._def,type:Do(e.element)}):e instanceof Nt?Nt.create(Do(e.unwrap())):e instanceof tr?tr.create(Do(e.unwrap())):e instanceof er?er.create(e.items.map(t=>Do(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)!==re.object){let c=this._getOrReturnCtx(t);return ee(c,{code:K.invalid_type,expected:re.object,received:c.parsedType}),pe}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 Ft(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 Ft(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 ae.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:ae.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:fe.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 Do(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 Nt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Lv(Re.objectKeys(this.shape))}};At.create=(e,t)=>new At({shape:()=>e,unknownKeys:"strip",catchall:Gt.create(),typeName:fe.ZodObject,...be(t)});At.strictCreate=(e,t)=>new At({shape:()=>e,unknownKeys:"strict",catchall:Gt.create(),typeName:fe.ZodObject,...be(t)});At.lazycreate=(e,t)=>new At({shape:e,unknownKeys:"strip",catchall:Gt.create(),typeName:fe.ZodObject,...be(t)});var En=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}),pe}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}),pe}}get options(){return this._def.options}};En.create=(e,t)=>new En({options:e,typeName:fe.ZodUnion,...be(t)});var vr=e=>e instanceof In?vr(e.schema):e instanceof Dt?vr(e.innerType()):e instanceof Tn?[e.value]:e instanceof _n?e.options:e instanceof kn?Re.objectValues(e.enum):e instanceof On?vr(e._def.innerType):e instanceof xn?[void 0]:e instanceof Cn?[null]:e instanceof Nt?[void 0,...vr(e.unwrap())]:e instanceof tr?[null,...vr(e.unwrap())]:e instanceof ua||e instanceof Nn?vr(e.unwrap()):e instanceof Pn?vr(e._def.innerType):[],Cc=class e extends xe{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==re.object)return ee(r,{code:K.invalid_type,expected:re.object,received:r.parsedType}),pe;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]}),pe)}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=vr(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:fe.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...be(n)})}};function Gp(e,t){let r=Jt(e),n=Jt(t);if(e===t)return{valid:!0,data:e};if(r===re.object&&n===re.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=Gp(e[s],t[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===re.array&&n===re.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=Gp(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===re.date&&n===re.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Rn=class extends xe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(wc(i)||wc(a))return pe;let s=Gp(i.value,a.value);return s.valid?((xc(i)||xc(a))&&r.dirty(),{status:r.value,value:s.data}):(ee(n,{code:K.invalid_intersection_types}),pe)};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}))}};Rn.create=(e,t,r)=>new Rn({left:e,right:t,typeName:fe.ZodIntersection,...be(r)});var er=class e extends xe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==re.array)return ee(n,{code:K.invalid_type,expected:re.array,received:n.parsedType}),pe;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"}),pe;!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 Ft(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})}};er.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new er({items:e,typeName:fe.ZodTuple,rest:null,...be(t)})};var Ec=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!==re.object)return ee(n,{code:K.invalid_type,expected:re.object,received:n.parsedType}),pe;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Ft(n,s,n.path,s)),value:a._parse(new Ft(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:fe.ZodRecord,...be(n)}):new e({keyType:Gr.create(),valueType:t,typeName:fe.ZodRecord,...be(r)})}},qo=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!==re.map)return ee(n,{code:K.invalid_type,expected:re.map,received:n.parsedType}),pe;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],c)=>({key:o._parse(new Ft(n,s,n.path,[c,"key"])),value:i._parse(new Ft(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 pe;(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 pe;(c.status==="dirty"||g.status==="dirty")&&r.dirty(),s.set(c.value,g.value)}return{status:r.value,value:s}}}};qo.create=(e,t,r)=>new qo({valueType:t,keyType:e,typeName:fe.ZodMap,...be(r)});var jo=class e extends xe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==re.set)return ee(n,{code:K.invalid_type,expected:re.set,received:n.parsedType}),pe;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 pe;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 Ft(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:ae.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ae.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};jo.create=(e,t)=>new jo({valueType:e,minSize:null,maxSize:null,typeName:fe.ZodSet,...be(t)});var Rc=class e extends xe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==re.function)return ee(r,{code:K.invalid_type,expected:re.function,received:r.parsedType}),pe;function n(s,u){return ca({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,No(),yr].filter(c=>!!c),issueData:{code:K.invalid_arguments,argumentsError:u}})}function o(s,u){return ca({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,No(),yr].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 $r){let s=this;return pt(/*#__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 pt(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:er.create(t).rest(Sr.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||er.create([]).rest(Sr.create()),returns:r||Sr.create(),typeName:fe.ZodFunction,...be(n)})}},In=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})}};In.create=(e,t)=>new In({getter:e,typeName:fe.ZodLazy,...be(t)});var Tn=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}),pe}return{status:"valid",value:t.data}}get value(){return this._def.value}};Tn.create=(e,t)=>new Tn({value:e,typeName:fe.ZodLiteral,...be(t)});function Lv(e,t){return new _n({values:e,typeName:fe.ZodEnum,...be(t)})}var _n=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}),pe}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}),pe}return pt(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})}};_n.create=Lv;var kn=class extends xe{_parse(t){let r=Re.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==re.string&&n.parsedType!==re.number){let o=Re.objectValues(r);return ee(n,{expected:Re.joinValues(o),received:n.parsedType,code:K.invalid_type}),pe}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}),pe}return pt(t.data)}get enum(){return this._def.values}};kn.create=(e,t)=>new kn({values:e,typeName:fe.ZodNativeEnum,...be(t)});var $r=class extends xe{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==re.promise&&r.common.async===!1)return ee(r,{code:K.invalid_type,expected:re.promise,received:r.parsedType}),pe;let n=r.parsedType===re.promise?r.data:Promise.resolve(r.data);return pt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};$r.create=(e,t)=>new $r({type:e,typeName:fe.ZodPromise,...be(t)});var Dt=class extends xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===fe.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 pe;let u=yield _this12._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?pe:u.status==="dirty"?vn(u.value):r.value==="dirty"?vn(u.value):u});return function(_x87){return _ref41.apply(this,arguments)}}());{if(r.value==="aborted")return pe;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?pe:s.status==="dirty"?vn(s.value):r.value==="dirty"?vn(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"?pe:(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"?pe:(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(!Vr(a))return pe;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=>Vr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):pe);Re.assertNever(o)}};Dt.create=(e,t,r)=>new Dt({schema:e,typeName:fe.ZodEffects,effect:t,...be(r)});Dt.createWithPreprocess=(e,t,r)=>new Dt({schema:t,effect:{type:"preprocess",transform:e},typeName:fe.ZodEffects,...be(r)});var Nt=class extends xe{_parse(t){return this._getType(t)===re.undefined?pt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Nt.create=(e,t)=>new Nt({innerType:e,typeName:fe.ZodOptional,...be(t)});var tr=class extends xe{_parse(t){return this._getType(t)===re.null?pt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};tr.create=(e,t)=>new tr({innerType:e,typeName:fe.ZodNullable,...be(t)});var On=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===re.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};On.create=(e,t)=>new On({innerType:e,typeName:fe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...be(t)});var Pn=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 Fo(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}};Pn.create=(e,t)=>new Pn({innerType:e,typeName:fe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...be(t)});var Uo=class extends xe{_parse(t){if(this._getType(t)!==re.nan){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.nan,received:n.parsedType}),pe}return{status:"valid",value:t.data}}};Uo.create=e=>new Uo({typeName:fe.ZodNaN,...be(e)});var q0=Symbol("zod_brand"),ua=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}},la=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"?pe:i.status==="dirty"?(r.dirty(),vn(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"?pe: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:fe.ZodPipeline})}},Nn=class extends xe{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Vr(o)&&(o.value=Object.freeze(o.value)),o);return Fo(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Nn.create=(e,t)=>new Nn({innerType:e,typeName:fe.ZodReadonly,...be(t)});function Nv(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function qv(e,t={},r){return e?Br.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=Nv(t,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=Nv(t,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):Br.create()}var j0={object:At.lazycreate},fe;(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"})(fe||(fe={}));var U0=(e,t={message:`Input not instance of ${e.name}`})=>qv(r=>r instanceof e,t),jv=Gr.create,Uv=Sn.create,V0=Uo.create,G0=bn.create,Vv=An.create,B0=wn.create,$0=Mo.create,Q0=xn.create,H0=Cn.create,z0=Br.create,W0=Sr.create,K0=Gt.create,Y0=Lo.create,X0=br.create,Z0=At.create,J0=At.strictCreate,e_=En.create,t_=Cc.create,r_=Rn.create,n_=er.create,o_=Ec.create,i_=qo.create,a_=jo.create,s_=Rc.create,c_=In.create,u_=Tn.create,l_=_n.create,d_=kn.create,p_=$r.create,f_=Dt.create,m_=Nt.create,g_=tr.create,h_=Dt.createWithPreprocess,y_=la.create,v_=()=>jv().optional(),S_=()=>Uv().optional(),b_=()=>Vv().optional(),A_={string:e=>Gr.create({...e,coerce:!0}),number:e=>Sn.create({...e,coerce:!0}),boolean:e=>An.create({...e,coerce:!0}),bigint:e=>bn.create({...e,coerce:!0}),date:e=>wn.create({...e,coerce:!0})};var w_=pe;var x_=S.record(S.any()),Fn=x_.optional();function Gv(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var C_=S.object({name:S.string(),arguments:S.string()}),E_=S.object({id:S.string(),type:S.literal("function"),function:C_,encryptedValue:S.string().optional(),metadata:Fn}),Ic=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:Fn}),R_=S.object({type:S.literal("text"),text:S.string()}),I_=S.object({type:S.literal("data"),value:S.string(),mimeType:S.string()}),T_=S.object({type:S.literal("url"),value:S.string(),mimeType:S.string().optional()}),Tc=S.discriminatedUnion("type",[I_,T_]),__=S.object({type:S.literal("image"),source:Tc,metadata:S.unknown().optional()}),k_=S.object({type:S.literal("audio"),source:Tc,metadata:S.unknown().optional()}),O_=S.object({type:S.literal("video"),source:Tc,metadata:S.unknown().optional()}),P_=S.object({type:S.literal("document"),source:Tc,metadata:S.unknown().optional()});var Bv=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()}),$v=(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"]})},Y8=Bv.superRefine((e,t)=>{$v(e,t)}),N_=S.discriminatedUnion("type",[R_,__,k_,O_,P_,Bv]),F_=N_.superRefine((e,t)=>{e.type==="binary"&&$v(e,t)}),D_=Ic.extend({role:S.literal("developer"),content:S.string()}),M_=Ic.extend({role:S.literal("system"),content:S.string()}),L_=Ic.extend({role:S.literal("assistant"),content:S.string().optional(),toolCalls:S.array(E_).optional()}),q_=Ic.extend({role:S.literal("user"),content:S.union([S.string(),S.array(F_)])}),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:Fn}),U_=S.object({id:S.string(),role:S.literal("activity"),activityType:S.string(),content:S.record(S.any()),subagentRunId:S.string().optional(),metadata:Fn}),V_=S.object({id:S.string(),role:S.literal("reasoning"),content:S.string(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Fn}),Qv=S.discriminatedUnion("role",[D_,M_,L_,q_,j_,U_,V_]),X8=S.union([S.literal("developer"),S.literal("system"),S.literal("assistant"),S.literal("user"),S.literal("tool"),S.literal("activity"),S.literal("reasoning")]),G_=S.object({description:S.string(),value:S.string()}),Hv=S.object({name:S.string(),description:S.string(),parameters:S.any(),metadata:S.record(S.any()).optional()}),B_=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()}),$_=S.object({interruptId:S.string(),status:S.enum(["resolved","cancelled"]),payload:S.any().optional(),metadata:Fn}),Q_=S.object({threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),state:S.any().transform(e=>e??void 0),messages:S.array(Qv),tools:S.array(Hv),context:S.array(G_),forwardedProps:S.any(),resume:S.array($_).optional()}),H_=S.any(),he=class extends Error{constructor(e){super(e)}},Bp=class extends he{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},z_=S.object({name:S.string(),description:S.string().optional()}),W_=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()}),K_=S.object({streaming:S.boolean().optional(),websocket:S.boolean().optional(),httpBinary:S.boolean().optional(),pushNotifications:S.boolean().optional(),resumable:S.boolean().optional()}),Y_=S.object({supported:S.boolean().optional(),items:S.array(Hv).optional(),parallelCalls:S.boolean().optional(),clientProvided:S.boolean().optional()}),X_=S.object({structuredOutput:S.boolean().optional(),supportedMimeTypes:S.array(S.string()).optional()}),Z_=S.object({snapshots:S.boolean().optional(),deltas:S.boolean().optional(),memory:S.boolean().optional(),persistentState:S.boolean().optional()}),J_=S.object({supported:S.boolean().optional(),delegation:S.boolean().optional(),handoffs:S.boolean().optional(),subAgents:S.array(z_).optional()}),ek=S.object({supported:S.boolean().optional(),streaming:S.boolean().optional(),encrypted:S.boolean().optional()}),tk=S.object({image:S.boolean().optional(),audio:S.boolean().optional(),video:S.boolean().optional(),pdf:S.boolean().optional(),file:S.boolean().optional()}),rk=S.object({image:S.boolean().optional(),audio:S.boolean().optional()}),nk=S.object({input:tk.optional(),output:rk.optional()}),ok=S.object({codeExecution:S.boolean().optional(),sandboxed:S.boolean().optional(),maxIterations:S.number().optional(),maxExecutionTime:S.number().optional()}),ik=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()}),Z8=S.object({identity:W_.optional(),transport:K_.optional(),tools:Y_.optional(),output:X_.optional(),state:Z_.optional(),multiAgent:J_.optional(),reasoning:ek.optional(),multimodal:nk.optional(),execution:ok.optional(),humanInTheLoop:ik.optional(),custom:S.record(S.unknown()).optional()}),zv=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:Fn}).passthrough(),ak=Ie.extend({type:S.literal(F.TEXT_MESSAGE_START),messageId:S.string(),role:zv.default("assistant"),name:S.string().optional(),subagentRunId:S.string().optional()}),Wv=Ie.extend({type:S.literal(F.TEXT_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),sk=Ie.extend({type:S.literal(F.TEXT_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),ck=Ie.extend({type:S.literal(F.TEXT_MESSAGE_CHUNK),messageId:S.string().optional(),role:zv.optional(),delta:S.string().optional(),name:S.string().optional(),subagentRunId:S.string().optional()}),uk=Ie.extend({type:S.literal(F.THINKING_TEXT_MESSAGE_START)}),lk=Wv.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:S.literal(F.THINKING_TEXT_MESSAGE_CONTENT)}),dk=Ie.extend({type:S.literal(F.THINKING_TEXT_MESSAGE_END)}),pk=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()}),fk=Ie.extend({type:S.literal(F.TOOL_CALL_ARGS),toolCallId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),mk=Ie.extend({type:S.literal(F.TOOL_CALL_END),toolCallId:S.string(),subagentRunId:S.string().optional()}),gk=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()}),hk=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()}),yk=Ie.extend({type:S.literal(F.THINKING_START),title:S.string().optional()}),vk=Ie.extend({type:S.literal(F.THINKING_END)}),Sk=Ie.extend({type:S.literal(F.STATE_SNAPSHOT),snapshot:H_,subagentRunId:S.string().optional()}),bk=Ie.extend({type:S.literal(F.STATE_DELTA),delta:S.array(S.any()),subagentRunId:S.string().optional()}),Ak=Ie.extend({type:S.literal(F.MESSAGES_SNAPSHOT),messages:S.array(Qv)}),wk=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()}),xk=Ie.extend({type:S.literal(F.ACTIVITY_DELTA),messageId:S.string(),activityType:S.string(),patch:S.array(S.any()),subagentRunId:S.string().optional()}),Ck=Ie.extend({type:S.literal(F.RAW),event:S.any(),source:S.string().optional(),subagentRunId:S.string().optional()}),Ek=Ie.extend({type:S.literal(F.CUSTOM),name:S.string(),value:S.any(),subagentRunId:S.string().optional()}),Rk=Ie.extend({type:S.literal(F.RUN_STARTED),threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),input:Q_.optional()}),Ik=S.object({type:S.literal("success")}).strict(),Tk=S.object({type:S.literal("interrupt"),interrupts:S.array(B_).min(1)}).strict(),_k=S.discriminatedUnion("type",[Ik,Tk]),Kv=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()}),kk=Ie.extend({type:S.literal(F.RUN_FINISHED),threadId:S.string(),runId:S.string(),result:S.any().optional(),outcome:_k.nullable().optional().transform(e=>e??void 0),usage:S.array(Kv).optional()}),Ok=Ie.extend({type:S.literal(F.RUN_ERROR),message:S.string(),code:S.string().optional(),usage:S.array(Kv).optional()}),Pk=Ie.extend({type:S.literal(F.STEP_STARTED),stepName:S.string(),subagentRunId:S.string().optional()}),Nk=Ie.extend({type:S.literal(F.STEP_FINISHED),stepName:S.string(),subagentRunId:S.string().optional()}),Fk=S.union([S.literal("tool-call"),S.literal("message")]),Dk=Ie.extend({type:S.literal(F.REASONING_START),messageId:S.string(),subagentRunId:S.string().optional()}),Mk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_START),messageId:S.string(),role:S.literal("reasoning"),subagentRunId:S.string().optional()}),Lk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),qk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),jk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_CHUNK),messageId:S.string().optional(),delta:S.string().optional(),subagentRunId:S.string().optional()}),Uk=Ie.extend({type:S.literal(F.REASONING_END),messageId:S.string(),subagentRunId:S.string().optional()}),Vk=Ie.extend({type:S.literal(F.REASONING_ENCRYPTED_VALUE),subtype:Fk,entityId:S.string(),encryptedValue:S.string(),subagentRunId:S.string().optional()}),Gk=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()}),Bk=S.object({type:S.literal("success")}).strict(),$k=S.object({type:S.literal("suspended"),interruptIds:S.array(S.string()).optional()}).strict(),Qk=S.discriminatedUnion("type",[Bk,$k]),Hk=Ie.extend({type:S.literal(F.SUBAGENT_FINISHED),subagentRunId:S.string(),result:S.any().optional(),outcome:Qk.optional()}),zk=Ie.extend({type:S.literal(F.SUBAGENT_ERROR),subagentRunId:S.string(),message:S.string(),code:S.string().optional()}),_c=S.discriminatedUnion("type",[ak,Wv,sk,ck,yk,vk,uk,lk,dk,pk,fk,mk,hk,gk,Sk,bk,Ak,wk,xk,Ck,Ek,Rk,kk,Ok,Pk,Nk,Dk,Mk,Lk,qk,jk,Uk,Vk,Gk,Hk,zk]);m();d();f();p();var $p={};ui($p,{JsonPatchError:()=>$e,_areEquals:()=>fa,applyOperation:()=>Dn,applyPatch:()=>Mc,applyReducer:()=>Zk,deepClone:()=>Yk,getValueByPointer:()=>Fc,validate:()=>Xv,validator:()=>Dc});m();d();f();p();m();d();f();p();var Wk=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)}}(),Kk=Object.prototype.hasOwnProperty;function Oc(e,t){return Kk.call(e,t)}function Pc(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)Oc(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 Nc(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 rr(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function da(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function kc(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(kc(e[t]))return!0}else if(typeof e=="object"){for(var n=Pc(e),o=n.length,i=0;i<o;i++)if(kc(e[n[i]]))return!0}}return!1}function Yv(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 pa=function(e){Wk(t,e);function t(r,n,o,i,a){var s=this.constructor,u=e.call(this,Yv(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=Yv(r,{name:n,index:o,operation:i,tree:a}),u}return t}(Error);var $e=pa,Yk=ct,Vo={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=Fc(r,this.path);n&&(n=ct(n));var o=Dn(r,{op:"remove",path:this.from}).removed;return Dn(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Fc(r,this.from);return Dn(r,{op:"add",path:this.path,value:ct(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:fa(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},Xk={add:function(e,t,r){return Nc(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:Vo.move,copy:Vo.copy,test:Vo.test,_get:Vo._get};function Fc(e,t){if(t=="")return e;var r={op:"_get",path:t};return Dn(e,r),r.value}function Dn(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):Dc(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=Fc(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=fa(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=Dc;;){if(h=u[g],h&&h.indexOf("~")!=-1&&(h=da(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&&!Nc(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);Nc(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=Xk[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=Vo[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 Mc(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]=Dn(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function Zk(e,t,r){var n=Dn(e,t);if(n.test===!1)throw new $e("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Dc(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(Vo[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")&&kc(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=Xv([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 Xv(e,t,r){try{if(!Array.isArray(e))throw new $e("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Mc(ct(t),ct(e),r||!0);else{r=r||Dc;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 fa(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(!fa(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],!fa(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var Wp={};ui(Wp,{compare:()=>aO,generate:()=>Qp,observe:()=>iO,unobserve:()=>oO});m();d();f();p();var Hp=new WeakMap,Jk=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),eO=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function tO(e){return Hp.get(e)}function rO(e,t){return e.observers.get(t)}function nO(e,t){e.observers.delete(t.callback)}function oO(e,t){t.unobserve()}function iO(e,t){var r=[],n,o=tO(e);if(!o)o=new Jk(e),Hp.set(e,o);else{var i=rO(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(){Qp(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(){Qp(n),clearTimeout(n.next),nO(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 eO(t,n)),n}function Qp(e,t){t===void 0&&(t=!1);var r=Hp.get(e.object);zp(r.value,e.object,e.patches,"",t),e.patches.length&&Mc(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function zp(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=Pc(t),a=Pc(e),s=!1,u=!1,c=a.length-1;c>=0;c--){var g=a[c],v=e[g];if(Oc(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)?zp(v,R,r,n+"/"+rr(g),o):v!==R&&(s=!0,o&&r.push({op:"test",path:n+"/"+rr(g),value:ct(v)}),r.push({op:"replace",path:n+"/"+rr(g),value:ct(R)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+rr(g),value:ct(v)}),r.push({op:"remove",path:n+"/"+rr(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];!Oc(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+rr(g),value:ct(t[g])})}}}function aO(e,t,r){r===void 0&&(r=!1);var n=[];return zp(e,t,n,"",r),n}var Lc=Object.assign({},$p,Wp,{JsonPatchError:pa,deepClone:ct,escapePathComponent:rr,unescapePathComponent:da});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Kp=function(e,t){return Kp=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])},Kp(e,t)};function nr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Kp(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Zv(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 qc(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 Ar(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 Go(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 Bo(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 Mn(e){return this instanceof Mn?(this.v=e,this):new Mn(e)}function Jv(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 Mn?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 eS(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 Ar=="function"?Ar(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 $o(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 jc=$o(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
31
|
+
`;function vR(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var SR=["1",1,"yes",!0];function bR(){let e=[];return wd()&&e.push(window.doNotTrack),Md()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>SR.indexOf(t)!==-1)}function Ds(e){return e===!0?!1:bR()}var nh="v15",oh={default:"https://analytics.cloud.coveo.com/rest/ua"};function AR(e=oh.default,t=nh,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 wR="38824e1f-37f5-42d3-8372-a4b8fa9df946",Zt=class{get defaultOptions(){return{endpoint:oh.default,isCustomEndpoint:!1,token:"",version:nh,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Jg}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=[dE,oE].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};Ds(this.options.disableBrowserPrivacySignals)?this.runtime=new Fs: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 wd()&&go()?new Fd(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(vR()&&console.warn(yR),new Dd(t))}get storage(){return this.runtime.storage}determineVisitorId(){return G(this,void 0,void 0,function*(){try{return wd()&&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 G(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return G(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return G(this,void 0,void 0,function*(){if(_s(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(ks(t,ks(r,wR)))}})}getParameters(t,...r){return G(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return G(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(Ds(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(kr.cvo_cid);if(r==null)return null;let n=kr.fromString(r);return!n||!go()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return G(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=>G(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>G(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)=>G(this,void 0,void 0,function*(){let x=yield y;return yield b(t,x)}),h)].reduce((h,y)=>G(this,void 0,void 0,function*(){let b=yield h;return yield y(b)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return G(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?sR(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,R)=>G(this,void 0,void 0,function*(){let h=yield v;return yield R(h)}),Promise.resolve(r))})}makeEvent(t,...r){return G(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=>G(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 G(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return G(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 Ts().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(Ce.search,t)})}sendSearchEvent(t){return G(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 G(this,void 0,void 0,function*(){return this.makeEvent(Ce.click,t)})}sendClickEvent(t){return G(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 G(this,void 0,void 0,function*(){return this.makeEvent(Ce.custom,t)})}sendCustomEvent(t){return G(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 G(this,void 0,void 0,function*(){return this.makeEvent(Ce.view,t)})}sendViewEvent(t){return G(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return G(this,void 0,void 0,function*(){let r=yield(yield C(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return G(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(dR(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&&Is(r)&&(o=this.lowercaseKeys(r));let i=pR(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=pr(t,["custom"]);if(r&&Is(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 hR(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")&&Is(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Is(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"?CE(t,r):t}get baseUrl(){return AR(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 zg={[$.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 Fs,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 Jg}};function xR(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function CR(e){return e.map(t=>t.replace(/;/g,""))}function ih(e){let r=e.join(";");return r.length<=256?r:ih(e.slice(1))}var Wg=e=>{let t=CR(e),r=xR(t);return ih(r)};function Kg(e){let t=typeof e.partialQueries=="string"?e.partialQueries:Wg(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:Wg(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Ms=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Ds(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new So:new Zt(t)}disable(){this.coveoAnalyticsClient=new So}enable(){this.coveoAnalyticsClient=new Zt(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent($.interfaceLoad)}logInterfaceLoad(){return G(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent($.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return G(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent($.recommendation)}logRecommendation(){return G(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 G(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 G(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 G(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 G(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 G(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 G(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent($.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return G(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent($.didyoumeanClick)}logDidYouMeanClick(){return G(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 G(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent($.searchboxSubmit)}logSearchboxSubmit(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent($.searchboxClear)}logSearchboxClear(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent($.searchboxAsYouType)}logSearchboxAsYouType(){return G(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 G(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent($.breadcrumbResetAll)}logBreadcrumbResetAll(){return G(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 G(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 G(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent($.omniboxAnalytics,Kg(t))}logOmniboxAnalytics(t){return G(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent($.omniboxFromLink,Kg(t))}logOmniboxFromLink(t){return G(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent($.searchFromLink)}logSearchFromLink(){return G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent($.pagerScrolling)}logPagerScrolling(){return G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return G(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorBack);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorBack)})}})}logQueryErrorBack(){return G(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return G(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorRetry);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorRetry)})}})}logQueryErrorRetry(){return G(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return G(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorClear);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorClear)})}})}logQueryErrorClear(){return G(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent($.likeSmartSnippet)}logLikeSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent($.dislikeSmartSnippet)}logDislikeSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent($.expandSmartSnippet)}logExpandSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent($.collapseSmartSnippet)}logCollapseSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent($.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent($.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return G(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 G(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 G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent($.recentQueryClick)}logRecentQueryClick(){return G(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent($.clearRecentQueries)}logClearRecentQueries(){return G(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 G(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent($.clearRecentResults)}logClearRecentResults(){return G(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent($.noResultsBack)}logNoResultsBack(){return G(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 G(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent($.showLessFoldedResults)}logShowLessFoldedResults(){return G(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 G(this,arguments,void 0,function*(n,o,i=zg[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 G(this,arguments,void 0,function*(n,o,i=zg[n]){return(yield this.makeCustomEvent(n,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return G(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 G(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return G(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 G(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 G(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return G(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 G(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 Zt?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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(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 G(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent($.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return G(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 G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Ls=Object.assign({},qi),Yg=Object.keys(Ls).map(e=>Ls[e]),yo=class extends Rd{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])=>Yg.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Yg.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Ls.pageview,{newEventType:Ce.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Ls.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 _E(this.ticket)}};yo.Id="svc";var qs;(function(e){e.click="click",e.flowStart="flowStart"})(qs||(qs={}));var Ot;(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"})(Ot||(Ot={}));var js;(function(e){e.quit="Quit",e.solved="Solved"})(js||(js={}));var Us=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!Ds(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new Zt(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 Zt(this.options),this.svc=new yo({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(Ot.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(Ot.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(Ot.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(Ot.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(Ot.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(Ot.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(Ot.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(Ot.caseCancelled,{reason:js.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(Ot.caseSolved,{reason:js.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(Ot.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",qs.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",qs.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return G(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 Zt?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 G(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 ah=e=>new Zt(e).getCurrentVisitorId(),Ui=(e,t)=>typeof t=="function"?(...r)=>{let n=gi(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,Vi=(e,t)=>(...r)=>{let n=gi(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 Vs(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function sh(e){let{activeValue:t,ancestryMap:r}=ER(e);return t?RR(t,r):[]}function ER(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 RR(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var IR=(e,t)=>e.categoryFacetSet[t]?.request;var jd=(e,t)=>{let r=IR(e,t);return sh(r?.currentValues??[])};m();d();f();p();function Gs(){return{}}m();d();f();p();function Bs(){return{}}m();d();f();p();function $s(){return{}}m();d();f();p();function Qs(){return{}}function Ud(e){return{facetSet:e.facetSet??Qs(),categoryFacetSet:e.categoryFacetSet??Gs(),dateFacetSet:e.dateFacetSet??Bs(),numericFacetSet:e.numericFacetSet??$s(),automaticFacetSet:e.automaticFacetSet??Vs()}}var Vd=e=>{let t=[];return kR(e).forEach((r,n)=>{let o=qR(e,r.facetId),i=MR(r,n+1);if(_R(r)){if(!!!jd(e,r.facetId).length)return;t.push({...i,...FR(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((a,s)=>{if(a.state==="idle")return;let u=ch(a,s+1,o),c=TR(r)?uh(a):PR(a);t.push({...i,...u,...c})})}),OR(e).forEach((r,n)=>{let o=DR(r,n+1);r.values.forEach((i,a)=>{if(i.state==="idle")return;let s=ch(i,a+1,"specific"),u=uh(i);t.push({...o,...s,...u})})}),t},TR=e=>e.type==="specific",_R=e=>e.type==="hierarchical",kR=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),OR=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),ch=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),PR=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),uh=e=>({displayValue:e.value,value:e.value}),NR=(e,t)=>jd(e,t).map(n=>n.value).join(";"),FR=(e,t)=>{let n=NR(e,t);return{value:n,valuePosition:1,displayValue:n}},DR=(e,t)=>({title:lh(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),MR=(e,t)=>({title:lh(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),lh=(e,t)=>`${e}_${t}`,LR=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,qR=(e,t)=>{let r=LR(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var Gd=e=>e.configuration.search.locale,dh=e=>e.configuration.search.timezone,ph=e=>e.configuration.accessToken,fh=e=>e.configuration.organizationId,mh=e=>e.configuration.environment,Hs=e=>e.configuration?.knowledge?.agentId,gh=e=>e.configuration.knowledge.debugAgentSession;var je=e=>{if(jR(e)||Bd(e))return e.generatedAnswer?.answerId;if(UR(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},jR=e=>"answer"in e&&"generatedAnswer"in e&&!ce(e.generatedAnswer?.answerConfigurationId),Bd=e=>{let t=Hs(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},UR=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",$d=e=>e.generatedAnswer?.fieldsToIncludeInCitations,Or=e=>e.followUpAnswers?.conversationId,VR=e=>e.generatedAnswer?.citations,GR=e=>e.followUpAnswers?.followUpAnswers,BR=ze(GR,e=>e?.flatMap(t=>t.citations)),$R=(e,t)=>t,bo=ze(VR,BR,$R,(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 hh=(r=>(r.Ascending="ascending",r.Descending="descending",r))(hh||{}),yh=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(yh||{}),Qd=e=>{if(pm(e))return e.map(t=>Qd(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""}},vh=()=>({by:"relevancy"});var EV=new ne({values:{by:new Ll({enum:yh,required:!0}),order:new Ll({enum:hh}),field:new z}});function zs(){return Qd(vh())}m();d();f();p();m();d();f();p();var Ao=()=>"default";var QR=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 QR(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 Gi=class Gi 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 Vd(Ud(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Gi.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||zt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Gi.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??zs()}}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||zt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||zt().response.totalCountFiltered}};ue(Gi,"fallbackPipelineName","default");var Pr=Gi,Sh=({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??_t(a.configuration.organizationId,a.configuration.environment,"analytics"),c=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,v=new Ms({token:s,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:Ui(e,n),beforeSendHooks:[Vi(e,r),(R,h)=>(e.info({...h,type:R,endpoint:u,token:s},"Analytics request"),h)]},o);return g||v.disable(),v},Hd=()=>{let t=ht.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};var Ws=/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield ah(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}),...(Hd()&&{pageId:Hd()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:mo(e)})}}});return function Ws(_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 Bi=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 bh(){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 Ah=/^(?:[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 HR(e){return typeof e=="string"&&Ah.test(e)}var zd=HR;m();d();f();p();var it=[];for(let e=0;e<256;++e)it.push((e+256).toString(16).slice(1));function wh(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 zR=new Uint8Array(16);function Wd(){return crypto.getRandomValues(zR)}m();d();f();p();function WR(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():KR(e,t,r)}function KR(e,t,r){e=e||{};let n=e.random??e.rng?.()??Wd();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 wh(n)}var Kd=WR;function YR(_x19){return _YR.apply(this,arguments)}function _YR(){_YR=_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 _YR.apply(this,arguments)}var Th="2.1.3",Yd=128,_h=192,xh=224,Ch=240,XR=248;function ZR(e){return(e&XR)===Ch?4:(e&Ch)===xh?3:(e&xh)===_h?2:1}function JR(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&Yd)!=Yd)break;if(r-=3,(n&_h)!=Yd){t-r>=ZR(n)*3&&(r=t);break}}return e.substring(0,r)}function eI(e){let{trackingId:t}=e;return{trackingId:t}}function tI(e){return(e.source||[]).concat([`relay@${Th}`])}function kh(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,a=eI(t),s=r.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:tI(t),clientId:s,userAgent:i(),referrer:Eh(n()),location:Eh(o())})}function Eh(e){return e!==null?JR(e,1024):null}function rI(e,t,r,n){return{...t,meta:kh(e,r,n)}}var nI="*";function oI(){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===nI)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 Rh({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 iI(e){let t=Rh(e);return{get:()=>t,update:r=>{t=Rh({...t,...r})}}}var Xd=aI();function aI(){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 sI(){return{getItem(e){return Xd.getItem(e)||localStorage.getItem(e)},removeItem(e){Xd.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Xd.setItem(e,t,31556952e3)}}}var Ih="visitorId";function cI(){let e=document.referrer;return e===""?null:e}function Zd(){let e=sI();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}`}});bh().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:()=>cI(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(Ih);if(t&&zd(t))return t;let r=Kd();return e.setItem(Ih,r),r}}}function uI(){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 lI(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function dI(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=lI();return t&&r?{...r,runtime:"custom"}:t&&pI()&&uI()?Zd():n}function pI(){try{return typeof window=="object"}catch{return!1}}function fI(e){return{get:()=>Object.freeze(dI(e))}}function Oh(e){let t=iI(e),r=oI(),n=fI(t);return{emit:function(){var _ref12=_asyncToGenerator(function*(o,i){let a=t.get(),s=n.get(),u=rI(o,i,a,s);return YR({config:a,environment:s,event:u,listenerManager:r})});return function emit(_x23,_x24){return _ref12.apply(this,arguments)}}(),getMeta:o=>kh(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:Th}}m();d();f();p();function Ph(){return typeof window<"u"&&typeof document<"u"}var mI=50,gI=is({memoize:dd,memoizeOptions:{maxSize:mI}}),$i=gI(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=yI(s);return Oh({mode:i?"emit":"disabled",url:o??qa(e,t),token:r,trackingId:n??null,source:a,environment:u})}),hI={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref13=_asyncToGenerator(function*(){});return function send(){return _ref13.apply(this,arguments)}}()},yI=e=>{if(!e)return;let t=e();return{...(Ph()?Zd():hI),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();var Qi=class extends mr{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Nh=({logger:e,getState:t,analyticsClientMiddleware:r=(a,s)=>s,preprocessRequest:n,provider:o=new Qi(t),disableBrowserPrivacySignals:i})=>{let a=t(),s=a.configuration.accessToken,u=a.configuration.analytics.apiBaseUrl??_t(a.configuration.organizationId,a.configuration.environment,"analytics"),c=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,v=new Us({enableAnalytics:g,token:s,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:Ui(e,n),beforeSendHooks:[Vi(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 Dh(e,t){return{...new Pr(t).getBaseMetadata(),actionCause:e,type:e}}function vI(e){return Object.assign(e,{instantlyCallable:!0})}function SI(e,t){let r=i=>{let a=ke(e,i);return vI(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 Mh=(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 wI(i)}return n},bI=e=>e.configuration.analytics.analyticsMode==="legacy",AI=e=>e.configuration.analytics.analyticsMode==="next",wI=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:a})=>(r??(r=s=>new a(s)),SI(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:_}){for(let T of R)yield T(_)});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*(_){bI(_)&&(yield xI(x,r,_,g,b.coveoAnalyticsClient))});return function(_x32){return _ref19.apply(this,arguments)}}());let{emit:I}=$i(y);return R.push(/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(_){if(AI(_)&&o&&n){let T=n(_);yield kI(I,o,T)}});return function(_x33){return _ref20.apply(this,arguments)}}()),h});return function(_x30){return _ref17.apply(this,arguments)}}()));function xI(_x34,_x35,_x36,_x37,_x38){return _xI.apply(this,arguments)}function _xI(){_xI=_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 _xI.apply(this,arguments)}var CI=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=Mh(e=>Sh({...e,provider:e.provider||new Pr(e.getState)}),e=>e,Pr),_B=Mh(Nh,CI("caseAssist"),Qi);var Jd=(e,t)=>{let r=t.recommendation?.recommendations.findIndex(({uniqueId:n})=>e.uniqueId===n)||0;return EI(e,r,t)},Lh=(e,t)=>({sourceName:jh(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||_r()}),qh=(e,t)=>({sourceName:jh(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||_r()});function jh(e){let t=e.source;return ce(t)?"unknown":t}var Uh=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function EI(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:TI(e),...(Fh(e)?{documentCategory:Fh(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:_I(e),queryPipeline:r.pipeline||_r()}}function Fh(e){return e.raw?.objecttype||void 0}var Ks=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||""}),Vh={urihash:new z,sourcetype:new z,permanentid:new z},Gh={uniqueId:Y,raw:new ne({values:Vh}),title:Y,uri:Y,clickUri:Y,rankingModifier:new z({required:!1,emptyAllowed:!0})};function RI(e){return Object.assign({},...Object.keys(Vh).map(t=>({[t]:e[t]})))}function II(e){return Object.assign({},...Object.keys(Gh).map(t=>({[t]:e[t]})),{raw:RI(e.raw)})}function TI(e){let t=e.raw.author;return ce(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function _I(e){let t=e.raw.source;return ce(t)?"unknown":t}var ep=e=>new yt(Gh).validate(II(e));function kI(_x40,_x41,_x42){return _kI.apply(this,arguments)}function _kI(){_kI=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _kI.apply(this,arguments)}m();d();f();p();var Bh=()=>De("analytics/recommendation/update",e=>e.makeRecommendationInterfaceLoad(),e=>new Bi(e)),$h=()=>({actionCause:"recommendationInterfaceLoad"}),Xs=e=>De({prefix:"analytics/recommendation/open",__legacy__getBuilder:(t,r)=>(ep(e),t.makeRecommendationOpen(Jd(e,r),Ks(e))),__legacy__provider:t=>new Bi(t),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=Jd(e,t),n=Ks(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=>B(e,{id:Y})),Nr=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 OI(o),s=yield n.recommendations(a),u=Date.now()-i;return vt(s)?r(s.error):{recommendations:s.success.results,analyticsAction:Bh(),duration:u,searchUid:s.success.searchUid,splitTestRun:s.success.splitTestRun,pipeline:s.success.pipeline}});return function(_x43,_x44){return _ref22.apply(this,arguments)}}()),OI=/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??xr(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 PI(e,$h()))),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}),...(e.pagination&&{numberOfResults:e.pagination.numberOfResults})}});return function OI(_x45){return _ref23.apply(this,arguments)}}(),PI=/*#__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 Ws(e.configuration.analytics,r)});return function PI(_x46,_x47){return _ref24.apply(this,arguments)}}();var Co=Be(wo(),e=>{e.addCase(xo,(t,r)=>{t.id=r.payload.id}).addCase(Nr.rejected,(t,r)=>{t.error=r.payload?r.payload:null,t.isLoading=!1}).addCase(Nr.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(Nr.pending,t=>{t.isLoading=!0}).addCase(ws,(t,r)=>{t.error=r.payload,t.isLoading=!1})});m();d();f();p();var Eo=L("searchHub/set",e=>B(e,new z({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(Yt,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Qh=class extends Error{constructor(t){super(t[0].message);ue(this,"issues");this.name="SchemaError",this.issues=t}};var hr="uninitialized",np="pending",zi="fulfilled",Wi="rejected";function Hh(e){return{status:e,isUninitialized:e===hr,isLoading:e===np,isSuccess:e===zi,isError:e===Wi}}var zh=Wt;function sy(e,t){if(e===t||!(zh(e)&&zh(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]=sy(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 NI(e){return new RegExp("(^|:)//").test(e)}function FI(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function cp(e){return e!=null}function Wh(e){return[...(e?.values()??[])].filter(cp)}function DI(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var MI=e=>e.replace(/\/$/,""),LI=e=>e.replace(/^\//,"");function qI(e,t){if(!e)return t;if(!t)return e;if(NI(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=MI(e),t=LI(t),`${e}${r}${t}`}function ec(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var ip=()=>new Map,jI=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},UI=(...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},Kh=(...e)=>C(...e),VI=e=>e.status>=200&&e.status<=299,GI=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Yh(e){if(!Wt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var BI=e=>typeof e=="object"&&(Wt(e)||Array.isArray(e)||typeof e.toJSON=="function");function cy({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=Kh,paramsSerializer:n,isJsonContentType:o=GI,jsonContentType:i="application/json",jsonReplacer:a,timeout:s,responseHandler:u,validateStatus:c,...g}={}){return typeof C>"u"&&r===Kh&&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:_,type:T}=h,P,{url:A,headers:O=new E(g.headers),params:k=void 0,responseHandler:N=u??"json",validateStatus:M=c??VI,timeout:V=s,...j}=typeof R=="string"?{url:R}:R,D={...g,signal:V?UI(h.signal,jI(V)):h.signal,...j};O=new E(Yh(O)),D.headers=(yield t(O,{getState:b,arg:R,extra:x,endpoint:I,forced:_,type:T,extraOptions:y}))||O;let q=BI(D.body);if(D.body!=null&&!q&&typeof D.body!="string"&&D.headers.delete("content-type"),!D.headers.has("content-type")&&q&&D.headers.set("content-type",i),q&&o(D.headers)&&(D.body=JSON.stringify(D.body,a)),D.headers.has("accept")||(N==="json"?D.headers.set("accept","application/json"):N==="text"&&D.headers.set("accept","text/plain, text/html, */*")),k){let te=~A.indexOf("?")?"&":"?",le=n?n(k):new URLSearchParams(Yh(k));A+=te+le}A=qI(e,A);let U=new Request(A,D);P={request:new Request(A,D)};let Q;try{Q=yield r(U)}catch(te){return{error:{status:(te instanceof Error||typeof DOMException<"u"&&te instanceof DOMException)&&te.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(te)},meta:P}}let J=Q.clone();P.response=J;let X,W="";try{let te;if(yield Promise.all([v(Q,N).then(le=>X=le,le=>te=le),J.text().then(le=>W=le,()=>{})]),te)throw te}catch(te){return{error:{status:"PARSING_ERROR",originalStatus:Q.status,data:W,error:String(te)},meta:P}}return M(Q,X)?{data:X,meta:P}:{error:{status:Q.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 $I(){return _$I.apply(this,arguments)}function _$I(){_$I=_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 _$I.apply(this,arguments)}function uy(e,t){throw Object.assign(new Io({error:e,meta:t}),{throwImmediately:!0})}function tp(e){e.aborted&&uy({status:"CUSTOM_ERROR",error:"Aborted"})}var Xh={},QI=(e,t)=>(/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(r,n,o){let i=[5,(t||Xh).maxRetries,(o||Xh).maxRetries].filter(g=>g!==void 0),[a]=i.slice(-1),u={maxRetries:a,backoff:$I,retryCondition:(g,v,{attempt:R})=>R<=a,...t,...o},c=0;for(;;){tp(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Io(g);return g}catch(g){if(c++,g.throwImmediately){if(g instanceof Io)return g.value;throw g}if(g instanceof Io){if(!u.retryCondition(g.value.error,r,{attempt:c,baseQueryApi:n,extraOptions:o}))return g.value}else if(c>u.maxRetries)return{error:g};tp(n.signal);try{yield u.backoff(c,u.maxRetries,n.signal)}catch(v){throw tp(n.signal),v}}}});return function(_x53,_x54,_x55){return _ref26.apply(this,arguments)}}()),ly=Object.assign(QI,{fail:uy}),rc="__rtkq/",HI="online",zI="offline";var dy="focused";var up=L(`${rc}${dy}`),py=L(`${rc}un${dy}`),lp=L(`${rc}${HI}`),fy=L(`${rc}${zI}`);var Xi="query",my="mutation",gy="infinitequery";function nc(e){return e.type===Xi}function WI(e){return e.type===my}function oc(e){return e.type===gy}function tc(e){return nc(e)||oc(e)}function dp(e,t,r,n,o,i){let a=KI(e)?e(t,r,n,o):e;return a?op(a,cp,s=>i(hy(s))):[]}function KI(e){return typeof e=="function"}function hy(e){return typeof e=="string"?{type:e}:e}function YI(e,t){return e.catch(t)}var To=(e,t)=>e.endpointDefinitions[t],Ki=Symbol("forceQueryFn"),ap=e=>typeof e[Ki]=="function";function XI({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:a}){let s=A=>a(A)?.runningQueries,u=A=>a(A)?.runningMutations,{unsubscribeQueryResult:c,removeMutationResult:g,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:_,buildInitiateInfiniteQuery:T,buildInitiateMutation:P,getRunningQueryThunk:R,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:b};function R(A,O){return k=>{let N=To(i,A),M=e({queryArgs:O,endpointDefinition:N,endpointName:A});return s(k)?.get(M)}}function h(A,O){return k=>u(k)?.get(O)}function y(){return A=>Wh(s(A))}function b(){return A=>Wh(u(A))}function x(A){}function I(A,O){let k=(N,{subscribe:M=!0,forceRefetch:V,subscriptionOptions:j,[Ki]:D,...q}={})=>(U,H)=>{let Q=e({queryArgs:N,endpointDefinition:O,endpointName:A}),J,X={...q,type:Xi,subscribe:M,forceRefetch:V,subscriptionOptions:j,endpointName:A,originalArgs:N,queryCacheKey:Q,[Ki]:D};if(nc(O))J=t(X);else{let{direction:ge,initialPageParam:we,refetchCachedPages:Se}=q;J=r({...X,direction:ge,initialPageParam:we,refetchCachedPages:Se})}let W=o.endpoints[A].select(N),te=U(J),le=W(H());let{requestId:_e,abort:Ve}=te,Fe=le.requestId!==_e,Me=s(U)?.get(Q),Le=()=>W(H()),ve=Object.assign(D?te.then(Le):Fe&&!Me?Promise.resolve(le):Promise.all([Me,te]).then(Le),{arg:N,requestId:_e,subscriptionOptions:j,queryCacheKey:Q,abort:Ve,unwrap(){return _asyncToGenerator(function*(){let ge=yield ve;if(ge.isError)throw ge.error;return ge.data})()},refetch:ge=>U(k(N,{subscribe:!1,forceRefetch:!0,...ge})),unsubscribe(){M&&U(c({queryCacheKey:Q,requestId:_e}))},updateSubscriptionOptions(ge){ve.subscriptionOptions=ge,U(v({endpointName:A,requestId:_e,queryCacheKey:Q,options:ge}))}});if(!Me&&!Fe&&!D){let ge=s(U);ge.set(Q,ve),ve.then(()=>{ge.delete(Q)})}return ve};return k}function _(A,O){return I(A,O)}function T(A,O){return I(A,O)}function P(A){return(O,{track:k=!0,fixedCacheKey:N}={})=>(M,V)=>{let j=n({type:"mutation",endpointName:A,originalArgs:O,track:k,fixedCacheKey:N}),D=M(j);let{requestId:q,abort:U,unwrap:H}=D,Q=YI(D.unwrap().then(te=>({data:te})),te=>({error:te})),J=()=>{M(g({requestId:q,fixedCacheKey:N}))},X=Object.assign(Q,{arg:D.arg,requestId:q,abort:U,unwrap:H,reset:J}),W=u(M);return W.set(q,X),X.then(()=>{W.delete(q)}),N&&(W.set(N,X),X.then(()=>{W.get(N)===X&&W.delete(N)})),X}}}var yy=class extends Qh{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 yy(o.issues,t,r,n);return o.value});return _hn.apply(this,arguments)}function Zh(e){return e}var Hi=(e={})=>({...e,[Fi]:!0});function ZI({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:a,onSchemaFailure:s,catchSchemaFailure:u,skipSchemaValidation:c}){let g=(j,D,q,U)=>(H,Q)=>{let J=r[j],X=n({queryArgs:D,endpointDefinition:J,endpointName:j});if(H(o.internalActions.queryResultPatched({queryCacheKey:X,patches:q})),!U)return;let W=o.endpoints[j].select(D)(Q()),te=dp(J.providesTags,W.data,void 0,D,{},i);H(o.internalActions.updateProvidedBy([{queryCacheKey:X,providedTags:te}]))};function v(j,D,q=0){let U=[D,...j];return q&&U.length>q?U.slice(0,-1):U}function R(j,D,q=0){let U=[...j,D];return q&&U.length>q?U.slice(1):U}let h=(j,D,q,U=!0)=>(H,Q)=>{let X=o.endpoints[j].select(D)(Q()),W={patches:[],inversePatches:[],undo:()=>H(o.util.patchQueryData(j,D,W.inversePatches,U))};if(X.status===hr)return W;let te;if("data"in X)if(lt(X.data)){let[le,_e,Ve]=cd(X.data,q);W.patches.push(..._e),W.inversePatches.push(...Ve),te=le}else te=q(X.data),W.patches.push({op:"replace",path:[],value:te}),W.inversePatches.push({op:"replace",path:[],value:X.data});return W.patches.length===0||H(o.util.patchQueryData(j,D,W.patches,U)),W},y=(j,D,q)=>U=>U(o.endpoints[j].initiate(D,{subscribe:!1,forceRefetch:!0,[Ki]:()=>({data:q})})),b=(j,D)=>j.query&&j[D]?j[D]:Zh,x=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(j,{signal:D,abort:q,rejectWithValue:U,fulfillWithValue:H,dispatch:Q,getState:J,extra:X}){let W=r[j.endpointName],{metaSchema:te,skipSchemaValidation:le=c}=W,_e=j.type===Xi;try{let Ve=Zh,Fe={signal:D,abort:q,dispatch:Q,getState:J,extra:X,endpoint:j.endpointName,type:j.type,forced:_e?I(j,J()):void 0,queryCacheKey:_e?j.queryCacheKey:void 0},Me=_e?j[Ki]: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 Lt={queryArg:j.originalArgs,pageParam:Se},xt=yield ge(Lt),Qt=Ye?v:R;return{data:{pages:Qt(we.pages,xt.data,He),pageParams:Qt(we.pageParams,Se,He)},meta:xt.meta}});return function ve(_x62,_x63,_x64,_x65){return _ref28.apply(this,arguments)}}();function ge(_x66){return _ge.apply(this,arguments)}function _ge(){_ge=_asyncToGenerator(function*(we){let Se,{extraOptions:He,argSchema:Ye,rawResponseSchema:Lt,responseSchema:xt}=W;if(Ye&&!gn(le,"arg")&&(we=yield hn(Ye,we,"argSchema",{})),Me?Se=Me():W.query?(Ve=b(W,"transformResponse"),Se=yield t(W.query(we),Fe,He)):Se=yield W.queryFn(we,Fe,He,qt=>t(qt,Fe,He)),typeof process<"u",Se.error)throw new Io(Se.error,Se.meta);let{data:Qt}=Se;Lt&&!gn(le,"rawResponse")&&(Qt=yield hn(Lt,Se.data,"rawResponseSchema",Se.meta));let Tt=yield Ve(Qt,Se.meta,we);return xt&&!gn(le,"response")&&(Tt=yield hn(xt,Tt,"responseSchema",Se.meta)),{...Se,data:Tt}});return _ge.apply(this,arguments)}if(_e&&"infiniteQueryOptions"in W){let{infiniteQueryOptions:we}=W,{maxPages:Se=1/0}=we,He=j.refetchCachedPages??we.refetchCachedPages??!0,Ye,Lt={pages:[],pageParams:[]},xt=a.selectQueryEntry(J(),j.queryCacheKey)?.data,Tt=I(j,J())&&!j.direction||!xt?Lt:xt;if("direction"in j&&j.direction&&Tt.pages.length){let qt=j.direction==="backward",_a=(qt?vy:sp)(we,Tt,j.originalArgs);Ye=yield ve(Tt,_a,Se,qt)}else{let{initialPageParam:qt=we.initialPageParam}=j,ci=xt?.pageParams??[],_a=ci[0]??qt,hw=ci.length;if(Ye=yield ve(Tt,_a,Se),Me&&(Ye={data:Ye.data.pages[0]}),He)for(let zf=1;zf<hw;zf++){let yw=sp(we,Ye.data,j.originalArgs);Ye=yield ve(Ye.data,yw,Se)}}Le=Ye}else Le=yield ge(j.originalArgs);return te&&!gn(le,"meta")&&Le.meta&&(Le.meta=yield hn(te,Le.meta,"metaSchema",Le.meta)),H(Le.data,Hi({fulfilledTimeStamp:Date.now(),baseQueryMeta:Le.meta}))}catch(Ve){let Fe=Ve;if(Fe instanceof Io){let Me=b(W,"transformErrorResponse"),{rawErrorResponseSchema:Le,errorResponseSchema:ve}=W,{value:ge,meta:we}=Fe;try{Le&&!gn(le,"rawErrorResponse")&&(ge=yield hn(Le,ge,"rawErrorResponseSchema",we)),te&&!gn(le,"meta")&&(we=yield hn(te,we,"metaSchema",we));let Se=yield Me(ge,we,j.originalArgs);return ve&&!gn(le,"errorResponse")&&(Se=yield hn(ve,Se,"errorResponseSchema",we)),U(Se,Hi({baseQueryMeta:we}))}catch(Se){Fe=Se}}try{if(Fe instanceof yy){let Me={endpoint:j.endpointName,arg:j.originalArgs,type:j.type,queryCacheKey:_e?j.queryCacheKey:void 0};W.onSchemaFailure?.(Fe,Me),s?.(Fe,Me);let{catchSchemaFailure:Le=u}=W;if(Le)return U(Le(Fe,Me),Hi({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(j,D){let q=a.selectQueryEntry(D,j.queryCacheKey),U=a.selectConfig(D).refetchOnMountOrArgChange,H=q?.fulfilledTimeStamp,Q=j.forceRefetch??(j.subscribe&&U);return Q?Q===!0||(Number(new Date)-Number(H))/1e3>=Q:!1}let _=()=>ke(`${e}/executeQuery`,x,{getPendingMeta({arg:D}){let q=r[D.endpointName];return Hi({startedTimeStamp:Date.now(),...(oc(q)?{direction:D.direction}:{})})},condition(D,{getState:q}){let U=q(),H=a.selectQueryEntry(U,D.queryCacheKey),Q=H?.fulfilledTimeStamp,J=D.originalArgs,X=H?.originalArgs,W=r[D.endpointName],te=D.direction;return ap(D)?!0:H?.status==="pending"?!1:I(D,U)||nc(W)&&W?.forceRefetch?.({currentArg:J,previousArg:X,endpointState:H,state:U})?!0:!(Q&&!te)},dispatchConditionRejection:!0}),T=_(),P=_(),A=ke(`${e}/executeMutation`,x,{getPendingMeta(){return Hi({startedTimeStamp:Date.now()})}}),O=j=>"force"in j,k=j=>"ifOlderThan"in j,N=(j,D,q={})=>(U,H)=>{let Q=O(q)&&q.force,J=k(q)&&q.ifOlderThan,X=(te=!0)=>{let le={forceRefetch:te,subscribe:!1};return o.endpoints[j].initiate(D,le)},W=o.endpoints[j].select(D)(H());if(Q)U(X());else if(J){let te=W?.fulfilledTimeStamp;if(!te){U(X());return}(Number(new Date)-Number(new Date(te)))/1e3>=J&&U(X())}else U(X(!1))};function M(j){return D=>D?.meta?.arg?.endpointName===j}function V(j,D){return{matchPending:io(ds(j),M(D)),matchFulfilled:io(lr(j),M(D)),matchRejected:io(ln(j),M(D))}}return{queryThunk:T,mutationThunk:A,infiniteQueryThunk:P,prefetch:N,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:V}}function sp(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function vy(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function Sy(e,t,r,n){return dp(r[e.meta.arg.endpointName][t],lr(e)?e.payload:void 0,Mi(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function Jh(e){return mt(e)?ns(e):e}function Zs(e,t,r){let n=e[t];n&&r(n)}function Yi(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function ey(e,t,r){let n=e[Yi(t)];n&&r(n)}var Js={};function JI({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(M,V,j,D){var q;M[q=V.queryCacheKey]??(M[q]={status:hr,endpointName:V.endpointName}),Zs(M,V.queryCacheKey,U=>{U.status=np,U.requestId=j&&U.requestId?U.requestId:D.requestId,V.originalArgs!==void 0&&(U.originalArgs=V.originalArgs),U.startedTimeStamp=D.startedTimeStamp;let H=o[D.arg.endpointName];oc(H)&&"direction"in V&&(U.direction=V.direction)})}function R(M,V,j,D){Zs(M,V.arg.queryCacheKey,q=>{if(q.requestId!==V.requestId&&!D)return;let{merge:U}=o[V.arg.endpointName];if(q.status=zi,U){if(q.data!==void 0){let{fulfilledTimeStamp:H,arg:Q,baseQueryMeta:J,requestId:X}=V,W=cn(q.data,te=>U(te,j,{arg:Q.originalArgs,baseQueryMeta:J,fulfilledTimeStamp:H,requestId:X}));q.data=W}else q.data=j;}else q.data=o[V.arg.endpointName].structuralSharing??!0?sy(mt(q.data)?$m(q.data):q.data,j):j;delete q.error,q.fulfilledTimeStamp=V.fulfilledTimeStamp})}let h=dn({name:`${e}/queries`,initialState:Js,reducers:{removeQueryResult:{reducer(M,{payload:{queryCacheKey:V}}){delete M[V]},prepare:ao()},cacheEntriesUpserted:{reducer(M,V){for(let j of V.payload){let{queryDescription:D,value:q}=j;v(M,D,!0,{arg:D,requestId:V.meta.requestId,startedTimeStamp:V.meta.timestamp}),R(M,{arg:D,requestId:V.meta.requestId,fulfilledTimeStamp:V.meta.timestamp,baseQueryMeta:{}},q,!0)}},prepare:M=>({payload:M.map(D=>{let{endpointName:q,arg:U,value:H}=D,Q=o[q];return{queryDescription:{type:Xi,endpointName:q,originalArgs:D.arg,queryCacheKey:n({queryArgs:U,endpointDefinition:Q,endpointName:q})},value:H}}),meta:{[Fi]:!0,requestId:Li(),timestamp:Date.now()}})},queryResultPatched:{reducer(M,{payload:{queryCacheKey:V,patches:j}}){Zs(M,V,D=>{D.data=ud(D.data,j.concat())})},prepare:ao()}},extraReducers(M){M.addCase(t.pending,(V,{meta:j,meta:{arg:D}})=>{let q=ap(D);v(V,D,q,j)}).addCase(t.fulfilled,(V,{meta:j,payload:D})=>{let q=ap(j.arg);R(V,j,D,q)}).addCase(t.rejected,(V,{meta:{condition:j,arg:D,requestId:q},error:U,payload:H})=>{Zs(V,D.queryCacheKey,Q=>{if(!j){if(Q.requestId!==q)return;Q.status=Wi,Q.error=H??U}})}).addMatcher(s,(V,j)=>{let{queries:D}=a(j);for(let[q,U]of Object.entries(D))(U?.status===zi||U?.status===Wi)&&(V[q]=U)})}}),y=dn({name:`${e}/mutations`,initialState:Js,reducers:{removeMutationResult:{reducer(M,{payload:V}){let j=Yi(V);j in M&&delete M[j]},prepare:ao()}},extraReducers(M){M.addCase(r.pending,(V,{meta:j,meta:{requestId:D,arg:q,startedTimeStamp:U}})=>{q.track&&(V[Yi(j)]={requestId:D,status:np,endpointName:q.endpointName,startedTimeStamp:U})}).addCase(r.fulfilled,(V,{payload:j,meta:D})=>{D.arg.track&&ey(V,D,q=>{q.requestId===D.requestId&&(q.status=zi,q.data=j,q.fulfilledTimeStamp=D.fulfilledTimeStamp)})}).addCase(r.rejected,(V,{payload:j,error:D,meta:q})=>{q.arg.track&&ey(V,q,U=>{U.requestId===q.requestId&&(U.status=Wi,U.error=j??D)})}).addMatcher(s,(V,j)=>{let{mutations:D}=a(j);for(let[q,U]of Object.entries(D))(U?.status===zi||U?.status===Wi)&&q!==U?.requestId&&(V[q]=U)})}}),b={tags:{},keys:{}},x=dn({name:`${e}/invalidation`,initialState:b,reducers:{updateProvidedBy:{reducer(M,V){var j,D,q;for(let{queryCacheKey:U,providedTags:H}of V.payload){I(M,U);for(let{type:Q,id:J}of H){let X=(D=(j=M.tags)[Q]??(j[Q]={}))[q=J||"__internal_without_id"]??(D[q]=[]);X.includes(U)||X.push(U)}M.keys[U]=H}},prepare:ao()}},extraReducers(M){M.addCase(h.actions.removeQueryResult,(V,{payload:{queryCacheKey:j}})=>{I(V,j)}).addMatcher(s,(V,j)=>{var q,U,H;let{provided:D}=a(j);for(let[Q,J]of Object.entries(D.tags??{}))for(let[X,W]of Object.entries(J)){let te=(U=(q=V.tags)[Q]??(q[Q]={}))[H=X||"__internal_without_id"]??(U[H]=[]);for(let le of W)te.includes(le)||te.push(le),V.keys[le]=D.keys[le]}}).addMatcher(Kt(lr(t),Mi(t)),(V,j)=>{_(V,[j])}).addMatcher(h.actions.cacheEntriesUpserted.match,(V,j)=>{let D=j.payload.map(({queryDescription:q,value:U})=>({type:"UNKNOWN",payload:U,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:q}}));_(V,D)})}});function I(M,V){let j=Jh(M.keys[V]??[]);for(let D of j){let q=D.type,U=D.id??"__internal_without_id",H=M.tags[q]?.[U];H&&(M.tags[q][U]=Jh(H).filter(Q=>Q!==V))}delete M.keys[V]}function _(M,V){let j=V.map(D=>{let q=Sy(D,"providesTags",o,u),{queryCacheKey:U}=D.meta.arg;return{queryCacheKey:U,providedTags:q}});x.caseReducers.updateProvidedBy(M,x.actions.updateProvidedBy(j))}let T=dn({name:`${e}/subscriptions`,initialState:Js,reducers:{updateSubscriptionOptions(M,V){},unsubscribeQueryResult(M,V){},internal_getRTKQSubscriptions(){}}}),P=dn({name:`${e}/internalSubscriptions`,initialState:Js,reducers:{subscriptionsUpdated:{reducer(M,V){return ud(M,V.payload)},prepare:ao()}}}),A=dn({name:`${e}/config`,initialState:{online:DI(),focused:FI(),middlewareRegistered:!1,...c},reducers:{middlewareRegistered(M,{payload:V}){M.middlewareRegistered=M.middlewareRegistered==="conflict"||i!==V?"conflict":!0}},extraReducers:M=>{M.addCase(lp,V=>{V.online=!0}).addCase(fy,V=>{V.online=!1}).addCase(up,V=>{V.focused=!0}).addCase(py,V=>{V.focused=!1}).addMatcher(s,V=>({...V}))}}),O=eo({queries:h.reducer,mutations:y.reducer,provided:x.reducer,subscriptions:P.reducer,config:A.reducer}),k=(M,V)=>O(g.match(V)?void 0:M,V),N={...A.actions,...h.actions,...T.actions,...P.actions,...y.actions,...x.actions,resetApiState:g};return{reducer:k,actions:N}}var rp=Symbol.for("RTKQ/skipToken"),by={status:hr},ty=cn(by,()=>{}),ry=cn(by,()=>{});function eT({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=T=>ty,o=T=>ry;return{buildQuerySelector:R,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:b,selectCachedArgsForQuery:x,selectApiState:a,selectQueries:s,selectMutations:c,selectQueryEntry:u,selectConfig:g};function i(T){return{...T,...Hh(T.status)}}function a(T){return T[t]}function s(T){return a(T)?.queries}function u(T,P){return s(T)?.[P]}function c(T){return a(T)?.mutations}function g(T){return a(T)?.config}function v(T,P,A){return O=>{if(O===rp)return r(n,A);let k=e({queryArgs:O,endpointDefinition:P,endpointName:T});return r(M=>u(M,k)??ty,A)}}function R(T,P){return v(T,P,i)}function h(T,P){let{infiniteQueryOptions:A}=P;function O(k){let N={...k,...Hh(k.status)},{isLoading:M,isError:V,direction:j}=N,D=j==="forward",q=j==="backward";return{...N,hasNextPage:I(A,N.data,N.originalArgs),hasPreviousPage:_(A,N.data,N.originalArgs),isFetchingNextPage:M&&D,isFetchingPreviousPage:M&&q,isFetchNextPageError:V&&D,isFetchPreviousPageError:V&&q}}return v(T,P,O)}function y(){return T=>{let P;return typeof T=="object"?P=Yi(T)??rp:P=T,r(P===rp?o:k=>a(k)?.mutations?.[P]??ry,i)}}function b(T,P){let A=T[t],O=new Set,k=op(P,cp,hy);for(let N of k){let M=A.provided.tags[N.type];if(!M)continue;let V=(N.id!==void 0?M[N.id]:Object.values(M).flat())??[];for(let j of V)O.add(j)}return Array.from(O.values()).flatMap(N=>{let M=A.queries[N];return M?{queryCacheKey:N,endpointName:M.endpointName,originalArgs:M.originalArgs}:[]})}function x(T,P){return op(Object.values(s(T)),A=>A?.endpointName===P&&A.status!==hr,A=>A.originalArgs)}function I(T,P,A){return P?sp(T,P,A)!=null:!1}function _(T,P,A){return!P||!T.getPreviousPageParam?!1:vy(T,P,A)!=null}}var ny=WeakMap?new WeakMap:void 0,oy=({endpointName:e,queryArgs:t})=>{let r="",n=ny?.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=Wt(a)?Object.keys(a).sort().reduce((s,u)=>(s[u]=a[u],s),{}):a,a));Wt(t)&&ny?.set(t,o),r=o}return`${e}(${r})`};function tT(...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=oy;if("serializeQueryArgs"in c.endpointDefinition){let v=c.endpointDefinition.serializeQueryArgs;g=R=>{let h=v(R);return typeof h=="string"?h:oy({...R,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(c)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(c){c()},apiUid:Li(),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:Xi}),mutation:v=>({...v,type:my}),infiniteQuery:v=>({...v,type:gy})});for(let[v,R]of Object.entries(g)){if(c.overrideExisting!==!0&&v in i.endpointDefinitions){if(c.overrideExisting==="throw")throw new Error(gt(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 rT=({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:_,requestId:T,options:P}=x.payload,A=b.get(_);return A?.has(T)&&A.set(T,P),!0}if(u.match(x)){let{queryCacheKey:_,requestId:T}=x.payload,P=b.get(_);return P&&P.delete(T),!0}if(e.internalActions.removeQueryResult.match(x))return b.delete(x.payload.queryCacheKey),!0;if(t.pending.match(x)){let{meta:{arg:_,requestId:T}}=x,P=ec(b,_.queryCacheKey,ip);return _.subscribe&&P.set(T,_.subscriptionOptions??P.get(T)??{}),!0}let I=!1;if(t.rejected.match(x)){let{meta:{condition:_,arg:T,requestId:P}}=x;if(_&&T.subscribe){let A=ec(b,T.queryCacheKey,ip);A.set(P,T.subscriptionOptions??A.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),_=!0;if(I){a||(a=setTimeout(()=>{let A=y(r.currentSubscriptions),[,O]=cd(i,()=>A);x.next(e.internalActions.subscriptionsUpdated(O)),i=A,a=null},500));let T=typeof b.type=="string"&&!!b.type.startsWith(o),P=t.rejected.match(b)&&b.meta.condition&&!!b.meta.arg.subscribe;_=!T&&!P}return[_,!1]}},nT=2147483647/1e3-1,oT=({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=Kt(g.match,r.fulfilled,r.rejected,v.match);function h(T){let P=o.currentSubscriptions.get(T);return P?P.size>0:!1}let y={};function b(T){for(let P of T.values())P?.abort?.()}let x=(T,P)=>{let A=P.getState(),O=a(A);if(R(T)){let k;if(v.match(T))k=T.payload.map(N=>N.queryDescription.queryCacheKey);else{let{queryCacheKey:N}=g.match(T)?T.payload:T.meta.arg;k=[N]}I(k,P,O)}if(t.util.resetApiState.match(T)){for(let[k,N]of Object.entries(y))N&&clearTimeout(N),delete y[k];b(o.runningQueries),b(o.runningMutations)}if(n.hasRehydrationInfo(T)){let{queries:k}=n.extractRehydrationInfo(T);I(Object.keys(k),P,O)}};function I(T,P,A){let O=P.getState();for(let k of T){let N=i(O,k);N?.endpointName&&_(k,N.endpointName,P,A)}}function _(T,P,A,O){let N=To(n,P)?.keepUnusedDataFor??O.keepUnusedDataFor;if(N===1/0)return;let M=Math.max(0,Math.min(N,nT));if(!h(T)){let V=y[T];V&&clearTimeout(V),y[T]=setTimeout(()=>{if(!h(T)){let j=i(A.getState(),T);j?.endpointName&&A.dispatch(s(j.endpointName,j.originalArgs))?.abort(),A.dispatch(c({queryCacheKey:T}))}delete y[T]},M*1e3)}}return x},iy=new Error("Promise never resolved before cacheEntryRemoved."),iT=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:a,selectApiState:s}})=>{let u=ps(n),c=ps(o),g=lr(n,o),v={},{removeQueryResult:R,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function b(A,O,k){let N=v[A];N?.valueResolved&&(N.valueResolved({data:O,meta:k}),delete N.valueResolved)}function x(A){let O=v[A];O&&(delete v[A],O.cacheEntryRemoved())}function I(A){let{arg:O,requestId:k}=A.meta,{endpointName:N,originalArgs:M}=O;return[N,M,k]}let _=(A,O,k)=>{let N=T(A);function M(V,j,D,q){let U=a(k,j),H=a(O.getState(),j);!U&&H&&P(V,q,j,O,D)}if(n.pending.match(A)){let[V,j,D]=I(A);M(V,N,D,j)}else if(y.match(A))for(let{queryDescription:V,value:j}of A.payload){let{endpointName:D,originalArgs:q,queryCacheKey:U}=V;M(D,U,A.meta.requestId,q),b(U,j,{})}else if(o.pending.match(A)){if(O.getState()[t].mutations[N]){let[j,D,q]=I(A);P(j,D,N,O,q)}}else if(g(A))b(N,A.payload,A.meta.baseQueryMeta);else if(R.match(A)||h.match(A))x(N);else if(e.util.resetApiState.match(A))for(let V of Object.keys(v))x(V)};function T(A){return u(A)?A.meta.arg.queryCacheKey:c(A)?A.meta.arg.fixedCacheKey??A.meta.requestId:R.match(A)?A.payload.queryCacheKey:h.match(A)?Yi(A.payload):""}function P(A,O,k,N,M){let V=To(r,A),j=V?.onCacheEntryAdded;if(!j)return;let D={},q=new Promise(W=>{D.cacheEntryRemoved=W}),U=Promise.race([new Promise(W=>{D.valueResolved=W}),q.then(()=>{throw iy})]);U.catch(()=>{}),v[k]=D;let H=e.endpoints[A].select(tc(V)?O:k),Q=N.dispatch((W,te,le)=>le),J={...N,getCacheEntry:()=>H(N.getState()),requestId:M,extra:Q,updateCachedData:tc(V)?W=>N.dispatch(e.util.updateQueryData(A,O,W)):void 0,cacheDataLoaded:U,cacheEntryRemoved:q},X=j(O,J);Promise.resolve(X).catch(W=>{if(W!==iy)throw W})}return _},aT=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},sT=({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=Kt(lr(n),Mi(n)),v=Kt(lr(o,n),ln(o,n)),R=[],h=0,y=(I,_)=>{(o.pending.match(I)||n.pending.match(I))&&h++,v(I)&&(h=Math.max(0,h-1)),g(I)?x(Sy(I,"invalidatesTags",r,a),_):v(I)?x([],_):i.util.invalidateTags.match(I)&&x(dp(I.payload,void 0,void 0,void 0,void 0,a),_)};function b(){return h>0}function x(I,_){let T=_.getState(),P=T[e];if(R.push(...I),P.config.invalidationBehavior==="delayed"&&b())return;let A=R;if(R=[],A.length===0)return;let O=i.util.selectInvalidatedBy(T,A);t.batch(()=>{let k=Array.from(O.values());for(let{queryCacheKey:N}of k){let M=P.queries[N],V=ec(u.currentSubscriptions,N,ip);M&&(V.size===0?_.dispatch(c({queryCacheKey:N})):M.status!==hr&&_.dispatch(s(M)))}})}return y},cT=({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 _ of s)R({queryCacheKey:_},I);s.clear(),u=null},0))}function v({queryCacheKey:x},I){let _=I.getState()[e],T=_.queries[x],P=a.get(x);if(!T||T.status===hr)return;let{lowestPollingInterval:A,skipPollingIfUnfocused:O}=b(P);if(!Number.isFinite(A))return;let k=i.get(x);k?.timeout&&(clearTimeout(k.timeout),k.timeout=void 0);let N=Date.now()+A;i.set(x,{nextPollTimestamp:N,pollingInterval:A,timeout:setTimeout(()=>{(_.config.focused||!O)&&I.dispatch(n(T)),v({queryCacheKey:x},I)},A)})}function R({queryCacheKey:x},I){let T=I.getState()[e].queries[x],P=a.get(x);if(!T||T.status===hr)return;let{lowestPollingInterval:A}=b(P);if(!Number.isFinite(A)){h(x);return}let O=i.get(x),k=Date.now()+A;(!O||k<O.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,_=Number.POSITIVE_INFINITY;for(let T of x.values())T.pollingInterval&&(_=Math.min(T.pollingInterval,_),I=T.skipPollingIfUnfocused||I);return{lowestPollingInterval:_,skipPollingIfUnfocused:I}}return c},uT=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=ds(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((A,O)=>{x.resolve=A,x.reject=O});I.catch(()=>{}),s[v]=x;let _=e.endpoints[R].select(tc(y)?h:v),T=g.dispatch((A,O,k)=>k),P={...g,getCacheEntry:()=>_(g.getState()),requestId:v,extra:T,updateCachedData:tc(y)?A=>g.dispatch(e.util.updateQueryData(R,h,A)):void 0,queryFulfilled:I};b(h,P)}}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]}}},lT=({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(_=>_[c]===!0)||x.every(_=>_[c]===void 0)&&g.config[c])&&(b.size===0?u.dispatch(i({queryCacheKey:h})):y.status!==hr&&u.dispatch(n(y)))}})}return a};function dT(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=[aT,oT,sT,cT,iT,uT];return{middleware:R=>{let h=!1,y=i(R.dispatch),b={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:u,mwApi:R},x=c.map(T=>T(b)),I=rT(b),_=lT(b);return T=>P=>{if(!bi(P))return T(P);h||(h=!0,R.dispatch(n.internalActions.middlewareRegistered(a)));let A={...R,next:T},O=R.getState(),[k,N]=I(P,A,O),M;if(k?M=T(P):M=N,R.getState()[t]&&(_(P,A,O),u(P)||o.hasRehydrationInfo(P)))for(let V of x)V(P,A,O);return M}},actions:s};function v(R){return e.api.endpoints[R.endpointName].initiate(R.originalArgs,{subscribe:!1,forceRefetch:!0})}}var ay=Symbol(),pT=({createSelector:e=ze}={})=>({name:ay,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){Xm();let b=ve=>(typeof process<"u",ve);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:lp,onOffline:fy,onFocus:up,onFocusLost:py},util:{}});let x=eT({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:_,buildQuerySelector:T,buildInfiniteQuerySelector:P,buildMutationSelector:A}=x;gr(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:_});let{queryThunk:O,infiniteQueryThunk:k,mutationThunk:N,patchQueryData:M,updateQueryData:V,upsertQueryData:j,prefetch:D,buildMatchThunkActions:q}=ZI({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:b,selectors:x,onSchemaFailure:v,catchSchemaFailure:R,skipSchemaValidation:h}),{reducer:U,actions:H}=JI({context:y,queryThunk:O,infiniteQueryThunk:k,mutationThunk:N,serializeQueryArgs:i,reducerPath:o,assertTagType:b,config:{refetchOnFocus:u,refetchOnReconnect:c,refetchOnMountOrArgChange:s,keepUnusedDataFor:a,reducerPath:o,invalidationBehavior:g}});gr(t.util,{patchQueryData:M,updateQueryData:V,upsertQueryData:j,prefetch:D,resetApiState:H.resetApiState,upsertQueryEntries:H.cacheEntriesUpserted}),gr(t.internalActions,H);let Q=new WeakMap,J=ve=>ec(Q,ve,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:X,buildInitiateInfiniteQuery:W,buildInitiateMutation:te,getRunningMutationThunk:le,getRunningMutationsThunk:_e,getRunningQueriesThunk:Ve,getRunningQueryThunk:Fe}=XI({queryThunk:O,mutationThunk:N,infiniteQueryThunk:k,api:t,serializeQueryArgs:i,context:y,getInternalState:J});gr(t.util,{getRunningMutationThunk:le,getRunningMutationsThunk:_e,getRunningQueryThunk:Fe,getRunningQueriesThunk:Ve});let{middleware:Me,actions:Le}=dT({reducerPath:o,context:y,queryThunk:O,mutationThunk:N,infiniteQueryThunk:k,api:t,assertTagType:b,selectors:x,getRunningQueryThunk:Fe,getInternalState:J});return gr(t.util,Le),gr(t,{reducer:U,middleware:Me}),{name:ay,injectEndpoint(ve,ge){var He;let Se=(He=t.endpoints)[ve]??(He[ve]={});nc(ge)&&gr(Se,{name:ve,select:T(ve,ge),initiate:X(ve,ge)},q(O,ve)),WI(ge)&&gr(Se,{name:ve,select:A(),initiate:te(ve)},q(N,ve)),oc(ge)&&gr(Se,{name:ve,select:P(ve,ge),initiate:W(ve,ge)},q(O,ve))}}}}),Ay=tT(pT());m();d();f();p();m();d();f();p();var yn=e=>e.query,wy=e=>e.query?.enableQuerySyntax;var c$=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})),fT=ze(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();var ic=e=>{if(e==="yes")return!0;if(e==="no")return!1},mT=()=>De("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function gT(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=Or(n);return r.makeGeneratedAnswerCitationClick(Lh(i,n),{generativeQuestionAnsweringId:o,citationId:i.id,documentId:Uh(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 hT(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=Or(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 yT(e,t){return De({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function vT(e){return De({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=Or(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"like"})})}function ST(e){return De({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=Or(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"dislike"})})}var bT=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:ic(o),documented:ic(i),correctTopic:ic(s),hallucinationFree:ic(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=Or(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||""})}),AT=()=>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"})}),wT=()=>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"})}),xT=()=>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"})}),CT=()=>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 ET(e){return De({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=Or(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"copyToClipboard"})})}function RT(e,t){return De({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=bo(n,e);if(!o)return null;let i=Or(n);return i?r.makeGeneratedAnswerFollowupOpenSource({...qh(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:i}):null}})}var ac={logCopyGeneratedAnswer:ET,logGeneratedAnswerHideAnswers:wT,logGeneratedAnswerShowAnswers:AT,logGeneratedAnswerStreamEnd:pp,logGeneratedAnswerFeedback:bT,logDislikeGeneratedAnswer:ST,logLikeGeneratedAnswer:vT,logGeneratedAnswerOpenInlineLink:yT,logHoverCitation:hT,logOpenGeneratedAnswerSource:gT,logOpenGeneratedAnswerFollowUpSource:RT,logRetryGeneratedAnswer:mT,logGeneratedAnswerExpand:xT,logGeneratedAnswerCollapse:CT};m();d();f();p();m();d();f();p();var xy=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 Zi=(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 Ji=jt(sc(),1),_y=jt(Cy(),1);m();d();f();p();var cc=jt(sc(),1),Ry=jt(Ey(),1);cc.default.extend(Ry.default);var Iy="YYYY/MM/DD@HH:mm:ss",IT="1401-01-01";function ko(e,t){let r=(0,cc.default)(e,t);return!r.isValid()&&!t?(0,cc.default)(e,Iy):r}function uc(e){return e.format(Iy)}function Ty(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(IT))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}Ji.default.extend(_y.default);var ky=["past","now","next"],Oy=["minute","hour","day","week","month","quarter","year"],TT=e=>{let t=e==="now";return{amount:new oe({required:!t,min:1}),unit:new z({required:!t,constrainTo:Oy}),period:new z({required:!0,constrainTo:ky})}};function wp(e){if(typeof e=="string"&&!Fr(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?My(e):e;new yt(TT(t.period)).validate(t);let r=Ny(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);Ap(r)}function Py(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function Ny(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Ji.default)().subtract(r,n);case"next":return(0,Ji.default)().add(r,n);case"now":return(0,Ji.default)()}}function ea(e){return uc(Ny(My(e)))}function Fy(e){return e.toLocaleLowerCase().split("-")}function Fr(e){let[t,r,n]=Fy(e);if(t==="now")return!0;if(!ky.includes(t)||!Oy.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function Dy(e){return!!e&&typeof e=="object"&&"period"in e}function My(e){let[t,r,n]=Fy(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function Ly(e){return e.type==="dateRange"}function qy(e){return`start${e}`}function jy(e){return`end${e}`}var xp=()=>({dateFacetValueMap:{}});function _T(e,t,r){let n=e.start,o=e.end;return Fr(n)&&(n=ea(n),r.dateFacetValueMap[t][qy(n)]=e.start),Fr(o)&&(o=ea(o),r.dateFacetValueMap[t][jy(o)]=e.end),{...e,start:n,end:o}}function Cp(e,t){if(Ly(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>_T(o,r,t))}}return e}function Dr(e){let t=xp();return{request:{...e,facets:e.facets?.map(n=>Cp(n,t))},mappings:t}}function kT(e,t,r){return{...e,start:r.dateFacetValueMap[t][qy(e.start)]||e.start,end:r.dateFacetValueMap[t][jy(e.end)]||e.end}}function OT(e,t){return e.facetId in t.dateFacetValueMap}function PT(e,t){return OT(e,t)?{...e,values:e.values.map(r=>kT(r,e.facetId,t))}:e}function lc(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>PT(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function Mr(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 Uy(e){return Mr(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 NT(e){return Mr(e).map(t=>{let r=Rp[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function FT(e){return[...NT(e.facetSet??{}),...Uy(e.numericFacetSet??{}),...Uy(e.dateFacetSet??{}),...Mr(e.categoryFacetSet??{})]}function DT(e){return FT(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function dc(e){return Ep(DT(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();var Lr=/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??xr(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 Ws(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 Lr(_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??xr(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&&Zi(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 Vy=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 qr=/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t,r){let n=Tp(e),o=MT(e),i=LT(e),a=e.configuration.analytics.analyticsMode==="legacy"?yield Lr(e,r):Oo(e,t,r);return Dr({...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}}})})});return function qr(_x69,_x70,_x71){return _ref30.apply(this,arguments)}}();function Ip(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function MT(e){return Ep(jT(e),e.facetOrder??[])}function LT(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(qT).filter(r=>r.currentValues.length>0):void 0}function qT(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function jT(e){return UT(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function UT(e){return[...VT(e.facetSet??{}),...Gy(e.numericFacetSet??{}),...Gy(e.dateFacetSet??{}),...Mr(e.categoryFacetSet??{})]}function VT(e){return Mr(e).map(t=>{let r=Rp[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function Gy(e){return Mr(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=Vy(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();f();p();m();d();f();p();var ta=(e,t)=>{let r=e;return ce(r[t])?ce(e.raw[t])?null:e.raw[t]:r[t]},GT=e=>t=>e.every(r=>!ce(ta(t,r))),BT=e=>t=>e.every(r=>ce(ta(t,r))),$T=(e,t)=>r=>{let n=By(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},QT=(e,t)=>r=>{let n=By(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},By=(e,t)=>{let r=ta(t,e);return fm(r)?r:[r]},$y={getResultProperty:ta,fieldsMustBeDefined:GT,fieldsMustNotBeDefined:BT,fieldMustMatch:$T,fieldMustNotMatch:QT};var _p=ze(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var kp=e=>e.searchHub;m();d();f();p();var pc=ze(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),BH=ze(e=>e,e=>{let t=pc(e);return t&&e?e[t].expression:""});m();d();f();p();var Qy=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var Hy=e=>e.excerptLength?.length;m();d();f();p();var zy=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var Wy=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 Ky=e=>e.sortCriteria;var Yy=/*#__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 Yy(_x72){return _ref31.apply(this,arguments)}}(),Xy=(e,t)=>{let r=yn(e)?.q,{aq:n,cq:o,dq:i,lq:a}=ev(e),s=fp(e),u=Zi(e.configuration.analytics,t,{actionCause:_p(e)}),c=kp(e),g=mp(e),v=$d(e)??[],R=Jy(e),h=pc(e.tabSet)||"default",y=Gd(e),b=dh(e),x=t.referrer||"",I=zy(e),_=Ky(e),T=HT(e),P=Hy(e),A=Wy(e),O=Qy(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(a&&{lq:a}),...(e.query&&{enableQuerySyntax:wy(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,...T,...(A??{}),...(P&&{excerptLength:P}),...(O&&{dictionaryFieldContext:O}),sortCriteria:_,...(I&&{facetOptions:I}),...u,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Zy=(e,t)=>{let r=yn(e)?.q,n=Jy(e),o=Zi(e.configuration.analytics,t,{actionCause:_p(e)}),i=Gd(e),a=pc(e.tabSet)||"default",s=t.referrer,{aq:u,cq:c}=ev(e),g=kp(e),v=mp(e),R=fp(e),h=$d(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}},Jy=e=>dc(e)?.map(t=>Cp(t,xp())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),HT=e=>({actionsHistory:e.configuration.analytics.enabled?ht.getInstance().getHistory():[]}),ev=e=>{let t=xy(e),r=Tp(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var fc=["searching","thinking","answering"];function mc(e){return e.toLowerCase()}var gc=["search","generic"];m();d();f();p();var tv=["text/plain","text/markdown"];var Po=new z({required:!0}),rv=new z,No=new me({required:!0}),Op={id:Po,title:Po,uri:Po,permanentid:Po,clickUri:rv},hc=new z({required:!0,constrainTo:tv}),nv=new z({required:!0,constrainTo:fc}),ov=e=>({...e,name:mc(e.name)}),uz=L("generatedAnswer/setIsVisible",e=>B(e,No)),yc=L("generatedAnswer/setAnswerId",e=>B(e,Y)),lz=L("generatedAnswer/setAnswerGenerationMode",e=>B(e,new z({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),dz=L("generatedAnswer/setIsEnabled",e=>B(e,No)),na=L("generatedAnswer/updateMessage",e=>B(e,{textDelta:Po})),oa=L("generatedAnswer/updateCitations",e=>B(e,{citations:new Ae({required:!0,each:new ne({values:Op})})})),ia=L("generatedAnswer/updateError",e=>B(e,{message:rv,code:new oe({min:0})})),vc=L("generatedAnswer/resetAnswer"),pz=L("generatedAnswer/like"),fz=L("generatedAnswer/dislike"),mz=L("generatedAnswer/feedbackModal/open"),gz=L("generatedAnswer/expand"),hz=L("generatedAnswer/collapse"),yz=L("generatedAnswer/setId",e=>B(e,{id:new z({required:!0})})),vz=L("generatedAnswer/feedbackModal/close"),Sz=L("generatedAnswer/sendFeedback"),jr=L("generatedAnswer/setIsLoading",e=>B(e,No)),ra=L("generatedAnswer/setIsStreaming",e=>B(e,No)),aa=L("generatedAnswer/setAnswerContentFormat",e=>B(e,hc)),bz=L("generatedAnswer/updateResponseFormat",e=>B(e,{contentFormat:new Ae({each:hc,default:["text/plain"]})})),Az=L("knowledge/updateAnswerConfigurationId",e=>B(e,Po)),wz=L("generatedAnswer/registerFieldsToIncludeInCitations",e=>B(e,gs)),Pp=L("generatedAnswer/setIsAnswerGenerated",e=>B(e,No)),sa=L("generatedAnswer/setCannotAnswer",e=>B(e,No)),zT=L("generatedAnswer/setAnswerApiQueryParams",e=>B(e,new ne({}))),iv=L("generatedAnswer/startStep",e=>B(ov(e),{name:nv,startedAt:new oe({min:0,required:!0})})),av=L("generatedAnswer/finishStep",e=>B(ov(e),{name:nv,finishedAt:new oe({min:0,required:!0})})),sv=L("generatedAnswer/startToolCall",e=>B(e,{toolCallName:Y,startedAt:new oe({min:0,required:!0}),toolCallId:Y})),cv=L("generatedAnswer/finishToolCall",e=>B(e,{finishedAt:new oe({min:0,required:!0}),toolCallId:Y})),Sc=L("generatedAnswer/toolCallArgs",e=>B(e,{toolCallId:Y,args:new ne({options:{required:!0}}),type:new z({required:!0,constrainTo:gc})})),xz=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 Yy(r),v=(y,b)=>{switch(y){case"genqa.headerMessageType":{let x=JSON.parse(b);n(aa(x.contentFormat));break}case"genqa.messageType":n(na(JSON.parse(b)));break;case"genqa.citationsType":n(oa(JSON.parse(b)));break;case"genqa.endOfStreamType":{let x=JSON.parse(b).answerGenerated,{answerId:I,answer:_}=i().generatedAnswer,P=u.length!==0&&!x,A=!_?.trim();n(sa(P)),n(ra(!1)),n(Pp(x)),n((a??ac).logGeneratedAnswerStreamEnd(x,I,x?A:void 0)),n(_o());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${y}"`)}};n(jr(!0));let R=y=>y.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:y=>{R(g)&&(n(jr(!1)),y.payload&&y.payloadType&&v(y.payloadType,y.payload))},abort:y=>{R(g)&&n(ia(y))},close:()=>{R(g)&&n(ra(!1))},resetAnswer:()=>{R(g)&&n(vc())}});h?c(h):n(jr(!1))});return function(_x73,_x74){return _ref32.apply(this,arguments)}}()),Cz=ke("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(vc());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=Xy(i,n);r(zT(a)),yield r(uv(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 dv(_x77,_x78){return _dv.apply(this,arguments)}function _dv(){_dv=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _dv.apply(this,arguments)}function pv(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=KT(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 fv(e,t,r){let n=lv(),o=new TextDecoder;return function(a,s){if(a.length===0)r?.(n),n=lv();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":WT(g,n,t);break}}}}function WT(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function KT(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function lv(){return{data:"",event:"",id:"",retry:void 0}}var Np="text/event-stream",YT=1e3,mv="last-event-id";function gv(){return typeof window<"u"}function hv(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&&gv()&&document.addEventListener("visibilitychange",y);let b=YT,x;function I(){gv()&&document.removeEventListener("visibilitychange",y),clearTimeout(x),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let _=u??C,T=n??XT;function P(){return _P2.apply(this,arguments)}function _P2(){_P2=_asyncToGenerator(function*(){h=l.AbortController?new l.AbortController:null;try{let A=yield _(e,{...c,headers:R,signal:h?.signal});yield T(A),yield dv(A.body,pv(fv(O=>{O?R[mv]=O:delete R[mv]},O=>{b=O},o))),i?.(),I(),g()}catch(A){if(!h?.signal?.aborted)try{let O=a?.(A)??b;clearTimeout(x),x=setTimeout(P,O)}catch(O){I(),v(O)}}});return _P2.apply(this,arguments)}P()})}function XT(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 ZT=/*#__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 cy({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 ZT(_x79,_x80,_x81){return _ref34.apply(this,arguments)}}(),yv=Ay({reducerPath:"answer",baseQuery:ly(ZT,{maxRetries:3}),endpoints:()=>({})});var JT=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},e0=(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)},t0=(e,t)=>{delete e.error,e.citations=t.citations},r0=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},n0=(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})`)},o0=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&n0(t,o);let i=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":i.contentFormat&&(JT(t,i),r(aa(i.contentFormat)));break;case"genqa.messageType":typeof i.textDelta=="string"&&(e0(t,i),r(na({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(t0(t,i),r(oa({citations:i.citations})));break;case"genqa.endOfStreamType":{r0(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}}},i0=(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=yv.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=i0(y,v,u.answerConfigurationId,c?.insightId);yield hv(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(_=>{_.answerId=I,i(yc(I))})});return function onopen(_x85){return _ref36.apply(this,arguments)}}(),onmessage:x=>{o(I=>{o0(x,I,i,g??ac)})},onerror:x=>{throw x},onclose:()=>{o(x=>{i(sa(!x.generated))})}})}).apply(this,arguments)}})})}),uv=e=>Fp.endpoints.getAnswer.initiate(e);m();d();f();p();var vv=Be(so,e=>e);m();d();f();p();function a0(e){let t=e.payload?.analyticsAction;return Sv(e)&&!ce(t)}function Sv(e){return"type"in e}var bv=e=>t=>r=>{let n;a0(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return Sv(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 AW=L("tab/register",e=>{let t=new ne({values:{id:Y,expression:nt}});return B(e,t)}),bc=L("tab/updateActiveTab",e=>B(e,Y));m();d();f();p();var Ac=jt(sc(),1),xv=jt(Av(),1),Cv=jt(wv(),1);Ac.default.extend(Cv.default);Ac.default.extend(xv.default);var Ev=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:Ac.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 s0=/(^|; )Coveo-Pendragon=([^;]*)/,c0=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function Rv(){return typeof window>"u"?!1:s0.exec(document.cookie)?.pop()||null}function Iv(){return typeof window>"u"?!1:c0.test(document.cookie)}var Tv=Be(Ev(),e=>e.addCase(Ir,(t,r)=>{u0(t,r.payload)}).addCase(Yt,(t,r)=>{l0(t,r.payload)}).addCase(co,(t,r)=>{d0(t,r.payload)}).addCase(uo,t=>{t.analytics.enabled=!1}).addCase(lo,t=>{t.analytics.enabled=!0}).addCase(hs,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(ys,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(bc,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Dg,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Tr,(t,r)=>{ce(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Ng,(t,{payload:r})=>{p0(t,r)}));function u0(e,t){ce(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ce(t.organizationId)||(e.organizationId=t.organizationId)}function l0(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 d0(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=Rv();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 p0(e,t){e.knowledge.agentId=t;try{Iv()&&(e.knowledge.debugAgentSession=!0)}catch{}}var Vt=Tv;m();d();f();p();function f0(e){return e.instantlyCallable}var _v=()=>e=>t=>e(f0(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 kv(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,m0=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(m0)}m();d();f();p();m();d();f();p();var g0=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Vp={randomUUID:g0};function h0(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 kv(n)}var Ur=h0;m();d();f();p();m();d();f();p();var S={};li(S,{BRAND:()=>G0,DIRTY:()=>Sn,EMPTY_PATH:()=>b0,INVALID:()=>pe,NEVER:()=>R_,OK:()=>pt,ParseStatus:()=>st,Schema:()=>xe,ZodAny:()=>Br,ZodArray:()=>br,ZodBigInt:()=>An,ZodBoolean:()=>wn,ZodBranded:()=>ua,ZodCatch:()=>Nn,ZodDate:()=>xn,ZodDefault:()=>Pn,ZodDiscriminatedUnion:()=>Cc,ZodEffects:()=>Dt,ZodEnum:()=>kn,ZodError:()=>bt,ZodFirstPartyTypeKind:()=>fe,ZodFunction:()=>Rc,ZodIntersection:()=>In,ZodIssueCode:()=>K,ZodLazy:()=>Tn,ZodLiteral:()=>_n,ZodMap:()=>jo,ZodNaN:()=>Vo,ZodNativeEnum:()=>On,ZodNever:()=>Gt,ZodNull:()=>En,ZodNullable:()=>tr,ZodNumber:()=>bn,ZodObject:()=>At,ZodOptional:()=>Nt,ZodParsedType:()=>re,ZodPipeline:()=>la,ZodPromise:()=>$r,ZodReadonly:()=>Fn,ZodRecord:()=>Ec,ZodSchema:()=>xe,ZodSet:()=>Uo,ZodString:()=>Gr,ZodSymbol:()=>Lo,ZodTransformer:()=>Dt,ZodTuple:()=>er,ZodType:()=>xe,ZodUndefined:()=>Cn,ZodUnion:()=>Rn,ZodUnknown:()=>Sr,ZodVoid:()=>qo,addIssueToContext:()=>ee,any:()=>X0,array:()=>t_,bigint:()=>H0,boolean:()=>Vv,coerce:()=>E_,custom:()=>qv,date:()=>z0,datetimeRegex:()=>Mv,defaultErrorMap:()=>yr,discriminatedUnion:()=>i_,effect:()=>y_,enum:()=>m_,function:()=>d_,getErrorMap:()=>Fo,getParsedType:()=>Jt,instanceof:()=>$0,intersection:()=>a_,isAborted:()=>wc,isAsync:()=>Do,isDirty:()=>xc,isValid:()=>Vr,late:()=>B0,lazy:()=>p_,literal:()=>f_,makeIssue:()=>ca,map:()=>u_,nan:()=>Q0,nativeEnum:()=>g_,never:()=>J0,null:()=>Y0,nullable:()=>S_,number:()=>Uv,object:()=>r_,objectUtil:()=>Gp,oboolean:()=>C_,onumber:()=>x_,optional:()=>v_,ostring:()=>w_,pipeline:()=>A_,preprocess:()=>b_,promise:()=>h_,quotelessJson:()=>y0,record:()=>c_,set:()=>l_,setErrorMap:()=>S0,strictObject:()=>n_,string:()=>jv,symbol:()=>W0,transformer:()=>y_,tuple:()=>s_,undefined:()=>K0,union:()=>o_,unknown:()=>Z0,util:()=>Re,void:()=>e_});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 re=Re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Jt=e=>{switch(typeof e){case"undefined":return re.undefined;case"string":return re.string;case"number":return Number.isNaN(e)?re.nan:re.number;case"boolean":return re.boolean;case"function":return re.function;case"bigint":return re.bigint;case"symbol":return re.symbol;case"object":return Array.isArray(e)?re.array:e===null?re.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?re.promise:typeof Map<"u"&&e instanceof Map?re.map:typeof Set<"u"&&e instanceof Set?re.set:typeof Date<"u"&&e instanceof Date?re.date:re.object;default:return re.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"]),y0=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 v0=(e,t)=>{let r;switch(e.code){case K.invalid_type:e.received===re.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}},yr=v0;var Ov=yr;function S0(e){Ov=e}function Fo(){return Ov}m();d();f();p();var ca=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}},b0=[];function ee(e,t){let r=Fo(),n=ca({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===yr?void 0:yr].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 pe;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 pe;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}}},pe=Object.freeze({status:"aborted"}),Sn=e=>({status:"dirty",value:e}),pt=e=>({status:"valid",value:e}),wc=e=>e.status==="aborted",xc=e=>e.status==="dirty",Vr=e=>e.status==="valid",Do=e=>typeof Promise<"u"&&e instanceof Promise;m();d();f();p();m();d();f();p();var ae;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ae||(ae={}));var Ft=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}},Pv=(e,t)=>{if(Vr(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 Jt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Jt(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:Jt(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:Jt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Pv(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Jt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Vr(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=>Vr(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:Jt(t)},o=_this11._parse({data:t,path:n.path,parent:n}),i=yield Do(o)?o:Promise.resolve(o);return Pv(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 Dt({schema:this,typeName:fe.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 Nt.create(this,this._def)}nullable(){return tr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return br.create(this)}promise(){return $r.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 Dt({...be(this._def),schema:this,typeName:fe.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:fe.ZodDefault})}brand(){return new ua({typeName:fe.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:fe.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return la.create(this,t)}readonly(){return Fn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},A0=/^c[^\s-]{8,}$/i,w0=/^[0-9a-z]+$/,x0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,C0=/^[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,E0=/^[a-z0-9_-]{21}$/i,R0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,I0=/^[-+]?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)?)??$/,T0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Bp,k0=/^(?:(?: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])$/,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])\/(3[0-2]|[12]?[0-9])$/,P0=/^(([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]))$/,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]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,F0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,D0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Fv="((\\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])))",M0=new RegExp(`^${Fv}$`);function Dv(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 L0(e){return new RegExp(`^${Dv(e)}$`)}function Mv(e){let t=`${Fv}T${Dv(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 q0(e,t){return!!((t==="v4"||!t)&&k0.test(e)||(t==="v6"||!t)&&P0.test(e))}function j0(e,t){if(!R0.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 U0(e,t){return!!((t==="v4"||!t)&&O0.test(e)||(t==="v6"||!t)&&N0.test(e))}var Gr=class e extends xe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==re.string){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:re.string,received:i.parsedType}),pe}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")T0.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(_0,"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")C0.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")E0.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")A0.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")w0.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")x0.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"?Mv(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"?M0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?L0(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"?I0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"duration",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?q0(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"?j0(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"?U0(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"?F0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"base64",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?D0.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,...ae.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ae.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ae.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ae.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ae.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ae.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ae.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ae.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ae.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ae.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ae.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ae.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ae.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ae.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,...ae.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,...ae.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ae.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ae.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ae.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ae.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ae.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ae.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ae.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ae.errToObj(r)})}nonempty(t){return this.min(1,ae.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}};Gr.create=e=>new Gr({checks:[],typeName:fe.ZodString,coerce:e?.coerce??!1,...be(e)});function V0(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)!==re.number){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:re.number,received:i.parsedType}),pe}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"?V0(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,ae.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ae.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ae.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ae.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ae.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ae.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ae.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ae.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ae.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ae.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ae.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ae.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ae.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ae.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:fe.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)!==re.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:re.bigint,received:r.parsedType}),pe}gte(t,r){return this.setLimit("min",t,!0,ae.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ae.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ae.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ae.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ae.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:ae.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ae.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ae.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ae.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ae.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:fe.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)!==re.boolean){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.boolean,received:n.parsedType}),pe}return pt(t.data)}};wn.create=e=>new wn({typeName:fe.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)!==re.date){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:re.date,received:i.parsedType}),pe}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_date}),pe}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:ae.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ae.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:fe.ZodDate,...be(e)});var Lo=class extends xe{_parse(t){if(this._getType(t)!==re.symbol){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.symbol,received:n.parsedType}),pe}return pt(t.data)}};Lo.create=e=>new Lo({typeName:fe.ZodSymbol,...be(e)});var Cn=class extends xe{_parse(t){if(this._getType(t)!==re.undefined){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.undefined,received:n.parsedType}),pe}return pt(t.data)}};Cn.create=e=>new Cn({typeName:fe.ZodUndefined,...be(e)});var En=class extends xe{_parse(t){if(this._getType(t)!==re.null){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.null,received:n.parsedType}),pe}return pt(t.data)}};En.create=e=>new En({typeName:fe.ZodNull,...be(e)});var Br=class extends xe{constructor(){super(...arguments),this._any=!0}_parse(t){return pt(t.data)}};Br.create=e=>new Br({typeName:fe.ZodAny,...be(e)});var Sr=class extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return pt(t.data)}};Sr.create=e=>new Sr({typeName:fe.ZodUnknown,...be(e)});var Gt=class extends xe{_parse(t){let r=this._getOrReturnCtx(t);return ee(r,{code:K.invalid_type,expected:re.never,received:r.parsedType}),pe}};Gt.create=e=>new Gt({typeName:fe.ZodNever,...be(e)});var qo=class extends xe{_parse(t){if(this._getType(t)!==re.undefined){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.void,received:n.parsedType}),pe}return pt(t.data)}};qo.create=e=>new qo({typeName:fe.ZodVoid,...be(e)});var br=class e extends xe{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==re.array)return ee(r,{code:K.invalid_type,expected:re.array,received:r.parsedType}),pe;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 Ft(r,a,r.path,s)))).then(a=>st.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Ft(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:ae.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ae.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ae.toString(r)}})}nonempty(t){return this.min(1,t)}};br.create=(e,t)=>new br({type:e,minLength:null,maxLength:null,exactLength:null,typeName:fe.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]=Nt.create(Mo(n))}return new At({...e._def,shape:()=>t})}else return e instanceof br?new br({...e._def,type:Mo(e.element)}):e instanceof Nt?Nt.create(Mo(e.unwrap())):e instanceof tr?tr.create(Mo(e.unwrap())):e instanceof er?er.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)!==re.object){let c=this._getOrReturnCtx(t);return ee(c,{code:K.invalid_type,expected:re.object,received:c.parsedType}),pe}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 Ft(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 Ft(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 ae.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:ae.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:fe.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 Nt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Lv(Re.objectKeys(this.shape))}};At.create=(e,t)=>new At({shape:()=>e,unknownKeys:"strip",catchall:Gt.create(),typeName:fe.ZodObject,...be(t)});At.strictCreate=(e,t)=>new At({shape:()=>e,unknownKeys:"strict",catchall:Gt.create(),typeName:fe.ZodObject,...be(t)});At.lazycreate=(e,t)=>new At({shape:e,unknownKeys:"strip",catchall:Gt.create(),typeName:fe.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}),pe}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}),pe}}get options(){return this._def.options}};Rn.create=(e,t)=>new Rn({options:e,typeName:fe.ZodUnion,...be(t)});var vr=e=>e instanceof Tn?vr(e.schema):e instanceof Dt?vr(e.innerType()):e instanceof _n?[e.value]:e instanceof kn?e.options:e instanceof On?Re.objectValues(e.enum):e instanceof Pn?vr(e._def.innerType):e instanceof Cn?[void 0]:e instanceof En?[null]:e instanceof Nt?[void 0,...vr(e.unwrap())]:e instanceof tr?[null,...vr(e.unwrap())]:e instanceof ua||e instanceof Fn?vr(e.unwrap()):e instanceof Nn?vr(e._def.innerType):[],Cc=class e extends xe{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==re.object)return ee(r,{code:K.invalid_type,expected:re.object,received:r.parsedType}),pe;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]}),pe)}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=vr(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:fe.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...be(n)})}};function $p(e,t){let r=Jt(e),n=Jt(t);if(e===t)return{valid:!0,data:e};if(r===re.object&&n===re.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===re.array&&n===re.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===re.date&&n===re.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(wc(i)||wc(a))return pe;let s=$p(i.value,a.value);return s.valid?((xc(i)||xc(a))&&r.dirty(),{status:r.value,value:s.data}):(ee(n,{code:K.invalid_intersection_types}),pe)};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:fe.ZodIntersection,...be(r)});var er=class e extends xe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==re.array)return ee(n,{code:K.invalid_type,expected:re.array,received:n.parsedType}),pe;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"}),pe;!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 Ft(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})}};er.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new er({items:e,typeName:fe.ZodTuple,rest:null,...be(t)})};var Ec=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!==re.object)return ee(n,{code:K.invalid_type,expected:re.object,received:n.parsedType}),pe;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Ft(n,s,n.path,s)),value:a._parse(new Ft(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:fe.ZodRecord,...be(n)}):new e({keyType:Gr.create(),valueType:t,typeName:fe.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!==re.map)return ee(n,{code:K.invalid_type,expected:re.map,received:n.parsedType}),pe;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],c)=>({key:o._parse(new Ft(n,s,n.path,[c,"key"])),value:i._parse(new Ft(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 pe;(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 pe;(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:fe.ZodMap,...be(r)});var Uo=class e extends xe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==re.set)return ee(n,{code:K.invalid_type,expected:re.set,received:n.parsedType}),pe;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 pe;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 Ft(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:ae.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ae.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:fe.ZodSet,...be(t)});var Rc=class e extends xe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==re.function)return ee(r,{code:K.invalid_type,expected:re.function,received:r.parsedType}),pe;function n(s,u){return ca({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Fo(),yr].filter(c=>!!c),issueData:{code:K.invalid_arguments,argumentsError:u}})}function o(s,u){return ca({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Fo(),yr].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 $r){let s=this;return pt(/*#__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 pt(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:er.create(t).rest(Sr.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||er.create([]).rest(Sr.create()),returns:r||Sr.create(),typeName:fe.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:fe.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}),pe}return{status:"valid",value:t.data}}get value(){return this._def.value}};_n.create=(e,t)=>new _n({value:e,typeName:fe.ZodLiteral,...be(t)});function Lv(e,t){return new kn({values:e,typeName:fe.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}),pe}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}),pe}return pt(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=Lv;var On=class extends xe{_parse(t){let r=Re.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==re.string&&n.parsedType!==re.number){let o=Re.objectValues(r);return ee(n,{expected:Re.joinValues(o),received:n.parsedType,code:K.invalid_type}),pe}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}),pe}return pt(t.data)}get enum(){return this._def.values}};On.create=(e,t)=>new On({values:e,typeName:fe.ZodNativeEnum,...be(t)});var $r=class extends xe{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==re.promise&&r.common.async===!1)return ee(r,{code:K.invalid_type,expected:re.promise,received:r.parsedType}),pe;let n=r.parsedType===re.promise?r.data:Promise.resolve(r.data);return pt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};$r.create=(e,t)=>new $r({type:e,typeName:fe.ZodPromise,...be(t)});var Dt=class extends xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===fe.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 pe;let u=yield _this12._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?pe: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 pe;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?pe: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"?pe:(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"?pe:(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(!Vr(a))return pe;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=>Vr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):pe);Re.assertNever(o)}};Dt.create=(e,t,r)=>new Dt({schema:e,typeName:fe.ZodEffects,effect:t,...be(r)});Dt.createWithPreprocess=(e,t,r)=>new Dt({schema:t,effect:{type:"preprocess",transform:e},typeName:fe.ZodEffects,...be(r)});var Nt=class extends xe{_parse(t){return this._getType(t)===re.undefined?pt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Nt.create=(e,t)=>new Nt({innerType:e,typeName:fe.ZodOptional,...be(t)});var tr=class extends xe{_parse(t){return this._getType(t)===re.null?pt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};tr.create=(e,t)=>new tr({innerType:e,typeName:fe.ZodNullable,...be(t)});var Pn=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===re.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:fe.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:fe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...be(t)});var Vo=class extends xe{_parse(t){if(this._getType(t)!==re.nan){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.nan,received:n.parsedType}),pe}return{status:"valid",value:t.data}}};Vo.create=e=>new Vo({typeName:fe.ZodNaN,...be(e)});var G0=Symbol("zod_brand"),ua=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}},la=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"?pe: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"?pe: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:fe.ZodPipeline})}},Fn=class extends xe{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Vr(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:fe.ZodReadonly,...be(t)});function Nv(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function qv(e,t={},r){return e?Br.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=Nv(t,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=Nv(t,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):Br.create()}var B0={object:At.lazycreate},fe;(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"})(fe||(fe={}));var $0=(e,t={message:`Input not instance of ${e.name}`})=>qv(r=>r instanceof e,t),jv=Gr.create,Uv=bn.create,Q0=Vo.create,H0=An.create,Vv=wn.create,z0=xn.create,W0=Lo.create,K0=Cn.create,Y0=En.create,X0=Br.create,Z0=Sr.create,J0=Gt.create,e_=qo.create,t_=br.create,r_=At.create,n_=At.strictCreate,o_=Rn.create,i_=Cc.create,a_=In.create,s_=er.create,c_=Ec.create,u_=jo.create,l_=Uo.create,d_=Rc.create,p_=Tn.create,f_=_n.create,m_=kn.create,g_=On.create,h_=$r.create,y_=Dt.create,v_=Nt.create,S_=tr.create,b_=Dt.createWithPreprocess,A_=la.create,w_=()=>jv().optional(),x_=()=>Uv().optional(),C_=()=>Vv().optional(),E_={string:e=>Gr.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 R_=pe;var I_=S.record(S.any()),Dn=I_.optional();function Gv(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var T_=S.object({name:S.string(),arguments:S.string()}),__=S.object({id:S.string(),type:S.literal("function"),function:T_,encryptedValue:S.string().optional(),metadata:Dn}),Ic=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}),k_=S.object({type:S.literal("text"),text:S.string()}),O_=S.object({type:S.literal("data"),value:S.string(),mimeType:S.string()}),P_=S.object({type:S.literal("url"),value:S.string(),mimeType:S.string().optional()}),Tc=S.discriminatedUnion("type",[O_,P_]),N_=S.object({type:S.literal("image"),source:Tc,metadata:S.unknown().optional()}),F_=S.object({type:S.literal("audio"),source:Tc,metadata:S.unknown().optional()}),D_=S.object({type:S.literal("video"),source:Tc,metadata:S.unknown().optional()}),M_=S.object({type:S.literal("document"),source:Tc,metadata:S.unknown().optional()});var Bv=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()}),$v=(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=Bv.superRefine((e,t)=>{$v(e,t)}),L_=S.discriminatedUnion("type",[k_,N_,F_,D_,M_,Bv]),q_=L_.superRefine((e,t)=>{e.type==="binary"&&$v(e,t)}),j_=Ic.extend({role:S.literal("developer"),content:S.string()}),U_=Ic.extend({role:S.literal("system"),content:S.string()}),V_=Ic.extend({role:S.literal("assistant"),content:S.string().optional(),toolCalls:S.array(__).optional()}),G_=Ic.extend({role:S.literal("user"),content:S.union([S.string(),S.array(q_)])}),B_=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}),$_=S.object({id:S.string(),role:S.literal("activity"),activityType:S.string(),content:S.record(S.any()),subagentRunId:S.string().optional(),metadata:Dn}),Q_=S.object({id:S.string(),role:S.literal("reasoning"),content:S.string(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Dn}),Qv=S.discriminatedUnion("role",[j_,U_,V_,G_,B_,$_,Q_]),J8=S.union([S.literal("developer"),S.literal("system"),S.literal("assistant"),S.literal("user"),S.literal("tool"),S.literal("activity"),S.literal("reasoning")]),H_=S.object({description:S.string(),value:S.string()}),Hv=S.object({name:S.string(),description:S.string(),parameters:S.any(),metadata:S.record(S.any()).optional()}),z_=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()}),W_=S.object({interruptId:S.string(),status:S.enum(["resolved","cancelled"]),payload:S.any().optional(),metadata:Dn}),K_=S.object({threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),state:S.any().transform(e=>e??void 0),messages:S.array(Qv),tools:S.array(Hv),context:S.array(H_),forwardedProps:S.any(),resume:S.array(W_).optional()}),Y_=S.any(),he=class extends Error{constructor(e){super(e)}},Qp=class extends he{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},X_=S.object({name:S.string(),description:S.string().optional()}),Z_=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()}),J_=S.object({streaming:S.boolean().optional(),websocket:S.boolean().optional(),httpBinary:S.boolean().optional(),pushNotifications:S.boolean().optional(),resumable:S.boolean().optional()}),ek=S.object({supported:S.boolean().optional(),items:S.array(Hv).optional(),parallelCalls:S.boolean().optional(),clientProvided:S.boolean().optional()}),tk=S.object({structuredOutput:S.boolean().optional(),supportedMimeTypes:S.array(S.string()).optional()}),rk=S.object({snapshots:S.boolean().optional(),deltas:S.boolean().optional(),memory:S.boolean().optional(),persistentState:S.boolean().optional()}),nk=S.object({supported:S.boolean().optional(),delegation:S.boolean().optional(),handoffs:S.boolean().optional(),subAgents:S.array(X_).optional()}),ok=S.object({supported:S.boolean().optional(),streaming:S.boolean().optional(),encrypted:S.boolean().optional()}),ik=S.object({image:S.boolean().optional(),audio:S.boolean().optional(),video:S.boolean().optional(),pdf:S.boolean().optional(),file:S.boolean().optional()}),ak=S.object({image:S.boolean().optional(),audio:S.boolean().optional()}),sk=S.object({input:ik.optional(),output:ak.optional()}),ck=S.object({codeExecution:S.boolean().optional(),sandboxed:S.boolean().optional(),maxIterations:S.number().optional(),maxExecutionTime:S.number().optional()}),uk=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()}),eK=S.object({identity:Z_.optional(),transport:J_.optional(),tools:ek.optional(),output:tk.optional(),state:rk.optional(),multiAgent:nk.optional(),reasoning:ok.optional(),multimodal:sk.optional(),execution:ck.optional(),humanInTheLoop:uk.optional(),custom:S.record(S.unknown()).optional()}),zv=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(),lk=Ie.extend({type:S.literal(F.TEXT_MESSAGE_START),messageId:S.string(),role:zv.default("assistant"),name:S.string().optional(),subagentRunId:S.string().optional()}),Wv=Ie.extend({type:S.literal(F.TEXT_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),dk=Ie.extend({type:S.literal(F.TEXT_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),pk=Ie.extend({type:S.literal(F.TEXT_MESSAGE_CHUNK),messageId:S.string().optional(),role:zv.optional(),delta:S.string().optional(),name:S.string().optional(),subagentRunId:S.string().optional()}),fk=Ie.extend({type:S.literal(F.THINKING_TEXT_MESSAGE_START)}),mk=Wv.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:S.literal(F.THINKING_TEXT_MESSAGE_CONTENT)}),gk=Ie.extend({type:S.literal(F.THINKING_TEXT_MESSAGE_END)}),hk=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()}),yk=Ie.extend({type:S.literal(F.TOOL_CALL_ARGS),toolCallId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),vk=Ie.extend({type:S.literal(F.TOOL_CALL_END),toolCallId:S.string(),subagentRunId:S.string().optional()}),Sk=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()}),bk=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()}),Ak=Ie.extend({type:S.literal(F.THINKING_START),title:S.string().optional()}),wk=Ie.extend({type:S.literal(F.THINKING_END)}),xk=Ie.extend({type:S.literal(F.STATE_SNAPSHOT),snapshot:Y_,subagentRunId:S.string().optional()}),Ck=Ie.extend({type:S.literal(F.STATE_DELTA),delta:S.array(S.any()),subagentRunId:S.string().optional()}),Ek=Ie.extend({type:S.literal(F.MESSAGES_SNAPSHOT),messages:S.array(Qv)}),Rk=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()}),Ik=Ie.extend({type:S.literal(F.ACTIVITY_DELTA),messageId:S.string(),activityType:S.string(),patch:S.array(S.any()),subagentRunId:S.string().optional()}),Tk=Ie.extend({type:S.literal(F.RAW),event:S.any(),source:S.string().optional(),subagentRunId:S.string().optional()}),_k=Ie.extend({type:S.literal(F.CUSTOM),name:S.string(),value:S.any(),subagentRunId:S.string().optional()}),kk=Ie.extend({type:S.literal(F.RUN_STARTED),threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),input:K_.optional()}),Ok=S.object({type:S.literal("success")}).strict(),Pk=S.object({type:S.literal("interrupt"),interrupts:S.array(z_).min(1)}).strict(),Nk=S.discriminatedUnion("type",[Ok,Pk]),Kv=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()}),Fk=Ie.extend({type:S.literal(F.RUN_FINISHED),threadId:S.string(),runId:S.string(),result:S.any().optional(),outcome:Nk.nullable().optional().transform(e=>e??void 0),usage:S.array(Kv).optional()}),Dk=Ie.extend({type:S.literal(F.RUN_ERROR),message:S.string(),code:S.string().optional(),usage:S.array(Kv).optional()}),Mk=Ie.extend({type:S.literal(F.STEP_STARTED),stepName:S.string(),subagentRunId:S.string().optional()}),Lk=Ie.extend({type:S.literal(F.STEP_FINISHED),stepName:S.string(),subagentRunId:S.string().optional()}),qk=S.union([S.literal("tool-call"),S.literal("message")]),jk=Ie.extend({type:S.literal(F.REASONING_START),messageId:S.string(),subagentRunId:S.string().optional()}),Uk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_START),messageId:S.string(),role:S.literal("reasoning"),subagentRunId:S.string().optional()}),Vk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),Gk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),Bk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_CHUNK),messageId:S.string().optional(),delta:S.string().optional(),subagentRunId:S.string().optional()}),$k=Ie.extend({type:S.literal(F.REASONING_END),messageId:S.string(),subagentRunId:S.string().optional()}),Qk=Ie.extend({type:S.literal(F.REASONING_ENCRYPTED_VALUE),subtype:qk,entityId:S.string(),encryptedValue:S.string(),subagentRunId:S.string().optional()}),Hk=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()}),zk=S.object({type:S.literal("success")}).strict(),Wk=S.object({type:S.literal("suspended"),interruptIds:S.array(S.string()).optional()}).strict(),Kk=S.discriminatedUnion("type",[zk,Wk]),Yk=Ie.extend({type:S.literal(F.SUBAGENT_FINISHED),subagentRunId:S.string(),result:S.any().optional(),outcome:Kk.optional()}),Xk=Ie.extend({type:S.literal(F.SUBAGENT_ERROR),subagentRunId:S.string(),message:S.string(),code:S.string().optional()}),_c=S.discriminatedUnion("type",[lk,Wv,dk,pk,Ak,wk,fk,mk,gk,hk,yk,vk,bk,Sk,xk,Ck,Ek,Rk,Ik,Tk,_k,kk,Fk,Dk,Mk,Lk,jk,Uk,Vk,Gk,Bk,$k,Qk,Hk,Yk,Xk]);m();d();f();p();var Hp={};li(Hp,{JsonPatchError:()=>$e,_areEquals:()=>fa,applyOperation:()=>Mn,applyPatch:()=>Mc,applyReducer:()=>rO,deepClone:()=>eO,getValueByPointer:()=>Fc,validate:()=>Xv,validator:()=>Dc});m();d();f();p();m();d();f();p();var Zk=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)}}(),Jk=Object.prototype.hasOwnProperty;function Oc(e,t){return Jk.call(e,t)}function Pc(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)Oc(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 Nc(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 rr(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function da(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function kc(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(kc(e[t]))return!0}else if(typeof e=="object"){for(var n=Pc(e),o=n.length,i=0;i<o;i++)if(kc(e[n[i]]))return!0}}return!1}function Yv(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 pa=function(e){Zk(t,e);function t(r,n,o,i,a){var s=this.constructor,u=e.call(this,Yv(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=Yv(r,{name:n,index:o,operation:i,tree:a}),u}return t}(Error);var $e=pa,eO=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=Fc(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=Fc(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:fa(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},tO={add:function(e,t,r){return Nc(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 Fc(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):Dc(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=Fc(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=fa(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=Dc;;){if(h=u[g],h&&h.indexOf("~")!=-1&&(h=da(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&&!Nc(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);Nc(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=tO[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 Mc(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 rO(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 Dc(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")&&kc(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=Xv([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 Xv(e,t,r){try{if(!Array.isArray(e))throw new $e("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Mc(ct(t),ct(e),r||!0);else{r=r||Dc;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 fa(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(!fa(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],!fa(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var Yp={};li(Yp,{compare:()=>lO,generate:()=>zp,observe:()=>uO,unobserve:()=>cO});m();d();f();p();var Wp=new WeakMap,nO=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),oO=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function iO(e){return Wp.get(e)}function aO(e,t){return e.observers.get(t)}function sO(e,t){e.observers.delete(t.callback)}function cO(e,t){t.unobserve()}function uO(e,t){var r=[],n,o=iO(e);if(!o)o=new nO(e),Wp.set(e,o);else{var i=aO(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),sO(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 oO(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&&Mc(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=Pc(t),a=Pc(e),s=!1,u=!1,c=a.length-1;c>=0;c--){var g=a[c],v=e[g];if(Oc(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+"/"+rr(g),o):v!==R&&(s=!0,o&&r.push({op:"test",path:n+"/"+rr(g),value:ct(v)}),r.push({op:"replace",path:n+"/"+rr(g),value:ct(R)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+rr(g),value:ct(v)}),r.push({op:"remove",path:n+"/"+rr(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];!Oc(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+rr(g),value:ct(t[g])})}}}function lO(e,t,r){r===void 0&&(r=!1);var n=[];return Kp(e,t,n,"",r),n}var Lc=Object.assign({},Hp,Yp,{JsonPatchError:pa,deepClone:ct,escapePathComponent:rr,unescapePathComponent:da});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 nr(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 Zv(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 qc(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 Ar(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 Jv(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 eS(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 Ar=="function"?Ar(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 jc=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 ma(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Qo=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=Ar(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 jc?b.errors:[b]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var R=Ar(v),h=R.next();!h.done;h=R.next()){var y=h.value;try{tS(y)}catch(b){i=i??[],b instanceof jc?i=Bo(Bo([],Go(i)),Go(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 jc(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)tS(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)&&ma(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&ma(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Yp=Qo.EMPTY;function Uc(e){return e instanceof Qo||e&&"closed"in e&&Ee(e.remove)&&Ee(e.add)&&Ee(e.unsubscribe)}function tS(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 Ho={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Ho.delegate;return o?.setTimeout?o.setTimeout.apply(o,Bo([e,t],Go(r))):setTimeout.apply(void 0,Bo([e,t],Go(r)))},clearTimeout:function(e){var t=Ho.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Vc(e){Ho.setTimeout(function(){var t=Bt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function ga(){}m();d();f();p();var rS=function(){return Xp("C",void 0,void 0)}();function nS(e){return Xp("E",void 0,e)}function oS(e){return Xp("N",e,void 0)}function Xp(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var Ln=null;function zo(e){if(Bt.useDeprecatedSynchronousErrorHandling){var t=!Ln;if(t&&(Ln={errorThrown:!1,error:null}),e(),t){var r=Ln,n=r.errorThrown,o=r.error;if(Ln=null,n)throw o}}else e()}function iS(e){Bt.useDeprecatedSynchronousErrorHandling&&Ln&&(Ln.errorThrown=!0,Ln.error=e)}var ha=function(e){nr(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Uc(r)&&r.add(n)):n.destination=lO,n}return t.create=function(r,n,o){return new Bc(r,n,o)},t.prototype.next=function(r){this.isStopped?Jp(oS(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Jp(nS(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Jp(rS,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}(Qo);var sO=Function.prototype.bind;function Zp(e,t){return sO.call(e,t)}var cO=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){Gc(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Gc(n)}else Gc(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Gc(r)}},e}(),Bc=function(e){nr(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&&Zp(r.next,s),error:r.error&&Zp(r.error,s),complete:r.complete&&Zp(r.complete,s)}):a=r}return i.destination=new cO(a),i}return t}(ha);function Gc(e){Bt.useDeprecatedSynchronousErrorHandling?iS(e):Vc(e)}function uO(e){throw e}function Jp(e,t){var r=Bt.onStoppedNotification;r&&Ho.setTimeout(function(){return r(e,t)})}var lO={closed:!0,next:ga,error:uO,complete:ga};m();d();f();p();var Wo=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function Ko(e){return e}function $c(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ef(e)}function ef(e){return e.length===0?Ko:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var Ge=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=pO(t)?t:new Bc(t,r,n);return zo(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=aS(r),new r(function(o,i){var a=new Bc({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[Wo]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return ef(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=aS(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 aS(e){var t;return(t=e??Bt.Promise)!==null&&t!==void 0?t:Promise}function dO(e){return e&&Ee(e.next)&&Ee(e.error)&&Ee(e.complete)}function pO(e){return e&&e instanceof ha||dO(e)&&Uc(e)}m();d();f();p();function fO(e){return Ee(e?.lift)}function Qe(e){return function(t){if(fO(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 mO(e,t,r,n,o)}var mO=function(e){nr(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}(ha);m();d();f();p();m();d();f();p();var sS=$o(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var or=function(e){nr(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 cS(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new sS},t.prototype.next=function(r){var n=this;zo(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=Ar(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;zo(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;zo(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?Yp:(this.currentObservers=null,s.push(r),new Qo(function(){n.currentObservers=null,ma(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 Ge;return r.source=this,r},t.create=function(r,n){return new cS(r,n)},t}(Ge);var cS=function(e){nr(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:Yp},t}(or);m();d();f();p();m();d();f();p();var tf={now:function(){return(tf.delegate||Date).now()},delegate:void 0};var Qc=function(e){nr(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=tf);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}(or);m();d();f();p();var Hc=new Ge(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function uS(e){return e&&Ee(e.schedule)}function gO(e){return e[e.length-1]}function lS(e){return uS(gO(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 zc=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function Wc(e){return Ee(e?.then)}m();d();f();p();function Kc(e){return Ee(e[Wo])}m();d();f();p();function Yc(e){return Symbol.asyncIterator&&Ee(e?.[Symbol.asyncIterator])}m();d();f();p();function Xc(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 hO(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Zc=hO();function Jc(e){return Ee(e?.[Zc])}m();d();f();p();function eu(e){return Jv(this,arguments,function(){var r,n,o,i;return qc(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,Mn(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,Mn(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Mn(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 tu(e){return Ee(e?.getReader)}function Xe(e){if(e instanceof Ge)return e;if(e!=null){if(Kc(e))return yO(e);if(zc(e))return vO(e);if(Wc(e))return SO(e);if(Yc(e))return dS(e);if(Jc(e))return bO(e);if(tu(e))return AO(e)}throw Xc(e)}function yO(e){return new Ge(function(t){var r=e[Wo]();if(Ee(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function vO(e){return new Ge(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function SO(e){return new Ge(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Vc)})}function bO(e){return new Ge(function(t){var r,n;try{for(var o=Ar(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 dS(e){return new Ge(function(t){wO(e,t).catch(function(r){return t.error(r)})})}function AO(e){return dS(eu(e))}function wO(e,t){var r,n,o,i;return Zv(this,void 0,void 0,function(){var a,s;return qc(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),r=eS(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 Mt(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 ru(e,t){return t===void 0&&(t=0),Qe(function(r,n){r.subscribe(We(n,function(o){return Mt(n,e,function(){return n.next(o)},t)},function(){return Mt(n,e,function(){return n.complete()},t)},function(o){return Mt(n,e,function(){return n.error(o)},t)}))})}m();d();f();p();function nu(e,t){return t===void 0&&(t=0),Qe(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function pS(e,t){return Xe(e).pipe(nu(t),ru(t))}m();d();f();p();function fS(e,t){return Xe(e).pipe(nu(t),ru(t))}m();d();f();p();function mS(e,t){return new Ge(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 gS(e,t){return new Ge(function(r){var n;return Mt(r,t,function(){n=e[Zc](),Mt(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 ou(e,t){if(!e)throw new Error("Iterable cannot be null");return new Ge(function(r){Mt(r,t,function(){var n=e[Symbol.asyncIterator]();Mt(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}m();d();f();p();function hS(e,t){return ou(eu(e),t)}function yS(e,t){if(e!=null){if(Kc(e))return pS(e,t);if(zc(e))return mS(e,t);if(Wc(e))return fS(e,t);if(Yc(e))return ou(e,t);if(Jc(e))return gS(e,t);if(tu(e))return hS(e,t)}throw Xc(e)}function qn(e,t){return t?yS(e,t):Xe(e)}function Oe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=lS(e);return qn(e,r)}m();d();f();p();function de(e,t){var r=Ee(e)?e:function(){return e},n=function(o){return o.error(r())};return new Ge(t?function(o){return t.schedule(n,0,o)}:n)}m();d();f();p();m();d();f();p();var vS=$o(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function iu(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 vS)}})})}m();d();f();p();function Qr(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 SS(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 _=u.shift();a?Mt(t,a,function(){return y(_)}):y(_)};u.length&&c<n;)I();R()}catch(_){t.error(_)}}))};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 Qr(function(i,a){return t(n,i,o,a)})(Xe(e(n,o)))},r):(typeof t=="number"&&(r=t),Qe(function(n,o){return SS(n,o,e,r)}))}function rf(e){return e===void 0&&(e=1/0),wt(Ko,e)}m();d();f();p();function au(e){return new Ge(function(t){Xe(e()).subscribe(t)})}m();d();f();p();function nf(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 ya(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,ya(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 su(e,t){return Ee(t)?wt(e,t,1):wt(e,1)}m();d();f();p();function of(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 jn(e){return Qe(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function af(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 cu(e){return Qe(function(t,r){Xe(e).subscribe(We(r,function(){return r.complete()},ga)),!r.closed&&t.subscribe(r)})}m();d();f();p();function uu(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)}))}):Ko}m();d();f();p();m();d();f();p();function bS(e){return` \r
|
|
36
|
-
`.indexOf(e)>=0}function lu(e){for(var t=["topLevel"],r=0,n,o,i,a=function(_){return t.push(_)},s=function(_){return t[t.length-1]=_},u=function(_){n==null&&(n=r,o=t.length,i=_)},c=function(_){_===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},R=function(_){if("0"<=_&&_<="9"){a("number");return}switch(_){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():bS(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":bS(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(_){return b.push(_.slice(e.length-e.lastIndexOf(_[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 wS(){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 du=4294967296;function sf(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>=du&&(o=o+(n/du|0),n=n%du)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?CS(n,o):uf(n,o)}function xS(e,t){let r=uf(e,t),n=r.hi&2147483648;n&&(r=CS(r.lo,r.hi));let o=cf(r.lo,r.hi);return n?"-"+o:o}function cf(e,t){if({lo:e,hi:t}=xO(e,t),t<=2097151)return String(du*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()+AS(a)+AS(i)}function xO(e,t){return{lo:e>>>0,hi:t>>>0}}function uf(e,t){return{lo:e|0,hi:t|0}}function CS(e,t){return t=~t,e?e=~e+1:t+=1,uf(e,t)}var AS=e=>{let t=String(e);return"0000000".slice(t.length)+t};function ES(){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=CO();function CO(){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"&&(!!w.Deno||!!w.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()),RS(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),IS(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),RS(r),sf(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),IS(r),sf(r)},dec(r,n){return xS(r,n)},uDec(r,n){return cf(r,n)}}}function RS(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function IS(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var lf;function EO(e){var t;lf=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:pf(e.encodeUtf8.bind(e))})}function df(){if(!lf){let e=w;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)),EO(o)}return lf}function pf(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var Hr;(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"})(Hr||(Hr={}));var RO=34028234663852886e22,IO=-34028234663852886e22,TO=4294967295,_O=2147483647,kO=-2147483648,ye=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?pf(t):df().encodeUtf8Into,this.buffer=_S,this.viewCache=PO,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||OO;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(va),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-va,n=ff(r);return n>va&&(this.ensureCapacity(n-va),this.buffer.copyWithin(t+n,t+va,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(TS(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(mf(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<=kS){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=ff(r),o=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(t,o.subarray(i+n)),s=ff(a);return s!=n&&o.copyWithin(i+s,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(t){return NO(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 TS(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return mf(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return mf(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}},OO=128,va=1,_S=new Uint8Array(0),PO=new DataView(_S.buffer),kS=32;function ff(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var Z=class{constructor(t,r=df().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=wS,this.uint32=ES,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 Hr.Varint:for(;this.buf[this.pos++]&128;);break;case Hr.Bit64:this.pos+=4;case Hr.Bit32:this.pos+=4;break;case Hr.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Hr.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[a,s]=this.tag();if(s===Hr.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<=kS){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 mf(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>_O||e<kO)throw new Error("invalid int32: "+e)}function TS(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>TO||e<0)throw new Error("invalid uint32: "+e)}function NO(e){if(typeof e=="string"){let t=e;if(e=Number(e),Number.isNaN(e)&&t!=="NaN")throw new Error("invalid float32: "+t)}else if(typeof e!="number")throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>RO||e<IO))throw new Error("invalid float32: "+e)}var FO=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function gf(){return{fields:{}}}var ut={encode(e,t=new ye){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&vf.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=gf();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=vf.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=gf();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=gf();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 OS(){return{key:"",value:void 0}}var vf={encode(e,t=new ye){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&se.encode(se.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=OS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=r.string();continue;case 2:if(i!==18)break;o.value=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vf.fromPartial(e??{})},fromPartial(e){let t=OS();return t.key=e.key??"",t.value=e.value??void 0,t}};function hf(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var se={encode(e,t=new ye){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&ut.encode(ut.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Sa.encode(Sa.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=hf();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=Sa.unwrap(Sa.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return se.fromPartial(e??{})},fromPartial(e){let t=hf();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=hf();if(e===null)t.nullValue=FO.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(w.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new w.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 yf(){return{values:[]}}var Sa={encode(e,t=new ye){for(let r of e.values)se.encode(se.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof Z?e:new Z(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;o.values.push(se.unwrap(se.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Sa.fromPartial(e??{})},fromPartial(e){let t=yf();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=yf();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&w.Array.isArray(e.values)?e.values:e}},DO=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 PS(){return{op:0,path:"",from:void 0,value:void 0}}var fu={encode(e,t=new ye){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&se.encode(se.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=PS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.op=r.int32();continue;case 2:if(i!==18)break;o.path=r.string();continue;case 3:if(i!==26)break;o.from=r.string();continue;case 4:if(i!==34)break;o.value=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return fu.fromPartial(e??{})},fromPartial(e){let t=PS();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function NS(){return{id:"",type:"",function:void 0,metadata:void 0}}var mu={encode(e,t=new ye){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&gu.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 Z?e:new Z(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.id=r.string();continue;case 2:if(i!==18)break;o.type=r.string();continue;case 3:if(i!==26)break;o.function=gu.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 mu.fromPartial(e??{})},fromPartial(e){let t=NS();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?gu.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function FS(){return{name:"",arguments:""}}var gu={encode(e,t=new ye){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=FS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.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 gu.fromPartial(e??{})},fromPartial(e){let t=FS();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function DS(){return{value:"",mimeType:""}}var hu={encode(e,t=new ye){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==""&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof Z?e:new Z(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.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 hu.fromPartial(e??{})},fromPartial(e){let t=DS();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function MS(){return{value:"",mimeType:void 0}}var yu={encode(e,t=new ye){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof Z?e:new Z(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.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 yu.fromPartial(e??{})},fromPartial(e){let t=MS();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function LS(){return{data:void 0,url:void 0}}var Rt={encode(e,t=new ye){return e.data!==void 0&&hu.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&yu.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(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.data=hu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=yu.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=LS();return t.data=e.data!==void 0&&e.data!==null?hu.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?yu.fromPartial(e.url):void 0,t}};function qS(){return{text:""}}var vu={encode(e,t=new ye){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof Z?e:new Z(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=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=qS();return t.text=e.text??"",t}};function jS(){return{source:void 0,metadata:void 0}}var Su={encode(e,t=new ye){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(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.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Su.fromPartial(e??{})},fromPartial(e){let t=jS();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function US(){return{source:void 0,metadata:void 0}}var bu={encode(e,t=new ye){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(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.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return bu.fromPartial(e??{})},fromPartial(e){let t=US();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function VS(){return{source:void 0,metadata:void 0}}var Au={encode(e,t=new ye){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(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=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Au.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 wu={encode(e,t=new ye){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(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=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return wu.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{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var xu={encode(e,t=new ye){return e.text!==void 0&&vu.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Su.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&bu.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Au.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&wu.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(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.text=vu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=Su.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=bu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=Au.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=wu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xu.fromPartial(e??{})},fromPartial(e){let t=BS();return t.text=e.text!==void 0&&e.text!==null?vu.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Su.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?bu.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Au.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?wu.fromPartial(e.document):void 0,t}};function $S(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var Cu={encode(e,t=new ye){e.id!==""&&t.uint32(10).string(e.id),e.role!==""&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let r of e.toolCalls)mu.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)xu.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 Z?e:new Z(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.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(mu.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(xu.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 Cu.fromPartial(e??{})},fromPartial(e){let t=$S();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=>mu.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>xu.fromPartial(r))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function QS(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var Eu={encode(e,t=new ye){return e.id!==""&&t.uint32(10).string(e.id),e.reason!==""&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&se.encode(se.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(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.id=r.string();continue;case 2:if(i!==18)break;o.reason=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.toolCallId=r.string();continue;case 5:if(i!==42)break;o.responseSchema=se.unwrap(se.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.expiresAt=r.string();continue;case 7:if(i!==58)break;o.metadata=se.unwrap(se.decode(r,r.uint32()));continue;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 Eu.fromPartial(e??{})},fromPartial(e){let t=QS();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}},MO=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 HS(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var ie={encode(e,t=new ye){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&se.encode(se.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 Z?e:new Z(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!==8)break;o.type=r.int32();continue;case 2:if(i!==16)break;o.timestamp=Yo(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=se.unwrap(se.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 ie.fromPartial(e??{})},fromPartial(e){let t=HS();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 zS(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0,subagentRunId:void 0}}var Ru={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Ru.fromPartial(e??{})},fromPartial(e){let t=zS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.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 WS(){return{baseEvent:void 0,messageId:"",delta:"",subagentRunId:void 0}}var Iu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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!==10)break;o.baseEvent=ie.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 Iu.fromPartial(e??{})},fromPartial(e){let t=WS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function KS(){return{baseEvent:void 0,messageId:"",subagentRunId:void 0}}var Tu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Tu.fromPartial(e??{})},fromPartial(e){let t=KS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function YS(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0,subagentRunId:void 0}}var _u={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 _u.fromPartial(e??{})},fromPartial(e){let t=YS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.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 XS(){return{baseEvent:void 0,toolCallId:"",delta:"",subagentRunId:void 0}}var ku={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 ku.fromPartial(e??{})},fromPartial(e){let t=XS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function ZS(){return{baseEvent:void 0,toolCallId:"",subagentRunId:void 0}}var Ou={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Ou.fromPartial(e??{})},fromPartial(e){let t=ZS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function JS(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var Pu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&se.encode(se.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 Z?e:new Z(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=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=se.unwrap(se.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 Pu.fromPartial(e??{})},fromPartial(e){let t=JS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function eb(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var Nu={encode(e,t=new ye){e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)fu.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 Z?e:new Z(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=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(fu.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 Nu.fromPartial(e??{})},fromPartial(e){let t=eb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>fu.fromPartial(r))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function tb(){return{baseEvent:void 0,messages:[]}}var Fu={encode(e,t=new ye){e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Cu.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof Z?e:new Z(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=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(Cu.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Fu.fromPartial(e??{})},fromPartial(e){let t=tb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Cu.fromPartial(r))||[],t}};function rb(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var Du={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&se.encode(se.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(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=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=se.unwrap(se.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.source=r.string();continue;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 Du.fromPartial(e??{})},fromPartial(e){let t=rb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.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 nb(){return{baseEvent:void 0,name:"",value:void 0,subagentRunId:void 0}}var Mu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&se.encode(se.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(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=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=se.unwrap(se.decode(r,r.uint32()));continue;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 Mu.fromPartial(e??{})},fromPartial(e){let t=nb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function ob(){return{baseEvent:void 0,threadId:"",runId:""}}var Lu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Lu.fromPartial(e??{})},fromPartial(e){let t=ob();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function ib(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var Un={encode(e,t=new ye){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 Z?e:new Z(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.provider=r.string();continue;case 2:if(i!==18)break;o.model=r.string();continue;case 3:if(i!==24)break;o.inputTokens=Yo(r.int64());continue;case 4:if(i!==32)break;o.outputTokens=Yo(r.int64());continue;case 5:if(i!==40)break;o.totalTokens=Yo(r.int64());continue;case 6:if(i!==48)break;o.reasoningTokens=Yo(r.int64());continue;case 7:if(i!==56)break;o.cachedInputTokens=Yo(r.int64());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Un.fromPartial(e??{})},fromPartial(e){let t=ib();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 ab(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var qu={encode(e,t=new ye){e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&se.encode(se.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)Eu.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)Un.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof Z?e:new Z(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=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue;case 4:if(i!==34)break;o.result=se.unwrap(se.decode(r,r.uint32()));continue;case 5:if(i!==42)break;o.outcome=r.string();continue;case 6:if(i!==50)break;o.interrupts.push(Eu.decode(r,r.uint32()));continue;case 7:if(i!==58)break;o.usage.push(Un.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return qu.fromPartial(e??{})},fromPartial(e){let t=ab();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.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=>Eu.fromPartial(r))||[],t.usage=e.usage?.map(r=>Un.fromPartial(r))||[],t}};function sb(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var ju={encode(e,t=new ye){e.baseEvent!==void 0&&ie.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)Un.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof Z?e:new Z(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.baseEvent=ie.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(Un.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ju.fromPartial(e??{})},fromPartial(e){let t=sb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>Un.fromPartial(r))||[],t}};function cb(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Uu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Uu.fromPartial(e??{})},fromPartial(e){let t=cb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function ub(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Vu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Vu.fromPartial(e??{})},fromPartial(e){let t=ub();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function lb(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var Gu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Gu.fromPartial(e??{})},fromPartial(e){let t=lb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.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 db(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var Bu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Bu.fromPartial(e??{})},fromPartial(e){let t=db();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.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 pb(){return{baseEvent:void 0,subagentRunId:"",name:"",description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var $u={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 $u.fromPartial(e??{})},fromPartial(e){let t=pb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.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 fb(){return{baseEvent:void 0,subagentRunId:"",result:void 0,outcome:"",interruptIds:[]}}var Qu={encode(e,t=new ye){e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&se.encode(se.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 Z?e:new Z(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=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=r.string();continue;case 3:if(i!==26)break;o.result=se.unwrap(se.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 Qu.fromPartial(e??{})},fromPartial(e){let t=fb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.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 mb(){return{baseEvent:void 0,subagentRunId:"",message:"",code:void 0}}var Hu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Hu.fromPartial(e??{})},fromPartial(e){let t=mb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.message=e.message??"",t.code=e.code??void 0,t}};function gb(){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 hb={encode(e,t=new ye){return e.textMessageStart!==void 0&&Ru.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Iu.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Tu.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&_u.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&ku.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Ou.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Pu.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Nu.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Fu.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Du.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Mu.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Lu.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&qu.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&ju.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Uu.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Vu.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Gu.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Bu.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&$u.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&Qu.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&Hu.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(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.textMessageStart=Ru.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=Iu.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=Tu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=_u.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=ku.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=Ou.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=Pu.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Nu.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=Fu.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Du.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Mu.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Lu.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=qu.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=ju.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Uu.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=Vu.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=Gu.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Bu.decode(r,r.uint32());continue;case 19:if(i!==154)break;o.subagentStarted=$u.decode(r,r.uint32());continue;case 20:if(i!==162)break;o.subagentFinished=Qu.decode(r,r.uint32());continue;case 21:if(i!==170)break;o.subagentError=Hu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return hb.fromPartial(e??{})},fromPartial(e){let t=gb();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Ru.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Iu.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Tu.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?_u.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?ku.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Ou.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Pu.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Nu.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Fu.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Du.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Mu.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Lu.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?qu.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?ju.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Uu.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Vu.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Gu.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Bu.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?$u.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?Qu.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?Hu.fromPartial(e.subagentError):void 0,t}};function Yo(e){let t=w.Number(e.toString());if(t>w.Number.MAX_SAFE_INTEGER)throw new w.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<w.Number.MIN_SAFE_INTEGER)throw new w.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var yb=e=>e&&typeof e=="object"?e:void 0;var pu=e=>{let t=yb(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}}}},LO=e=>{let t=yb(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:pu(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:pu(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:pu(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:pu(r.source),metadata:r.metadata}}}};function vb(e){let t=hb.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=MO[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=>LO(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=DO[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]}),_c.parse(r)}var Sf="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var jO=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,bf=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(jO);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Sb=e=>e==="*"||e==="x"||e==="X",bb=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},UO=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],VO=(e,t)=>{if(Sb(e)||Sb(t))return 0;let[r,n]=UO(bb(e),bb(t));return r>n?1:r<n?-1:0},Af=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=VO(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Xo=(e,t)=>{let r=bf(e),n=bf(t),o=r.pop(),i=n.pop(),a=Af(r,n);return a!==0?a:o&&i?Af(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 ba(){return Ur()}function Cf(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&Cf(t);return e}var Ab=512*1024;function wb(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&&!wb(t,r,Ab),u=s?Te(t):t,c=s?Te(r):r,g=!1,v=!1,R;for(let h of e)try{s&&(Cf(u),Cf(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&&wb(u,c,Ab)&&(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 zu(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 Aa(e){if(e instanceof Ef)return e;if(e===!0)return new Ef(zu(!0))}var Ef=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 wf(e){return e.enabled?new Ef(e):void 0}function GO(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=Gv(e.metadata,Te(t.metadata)),!0)}var Pb=(e,t,r,n,o)=>{let i=Aa(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):Hc};return t.pipe(su(/*#__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,_=a.find(A=>A.id===y);if(_?.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 T=_;if(!T){let A={id:y,role:b,content:"",...(x!==void 0&&{name:x}),...(I!=null&&{subagentRunId:I})};a.push(A),T=A}let P=It(T,v);(!_||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,_,T)=>I.onTextMessageContentEvent?.({event:v,messages:_,state:T,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,_)=>x.onTextMessageEndEvent?.({event:v,messages:I,state:_,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,_=a.find(O=>O.toolCalls?.some(k=>k.id===y))?.toolCalls?.find(O=>O.id===y);if(_){let O=_.function.name!==b;return O&&(console.warn(`TOOL_CALL_START: tool call '${y}' already exists with name '${_.function.name}' \u2014 updating it to '${b}'`),_.function.name=b),(It(_,v)||O)&&c({messages:a}),g()}let T=new Set(a.map(O=>O.id)),P=GO(a,x,y);!T.has(P.id)&&I!=null&&P.subagentRunId===void 0&&(P.subagentRunId=I),P.toolCalls??(P.toolCalls=[]);let A={id:y,type:"function",function:{name:b,arguments:""}};P.toolCalls.push(A),It(A,v),c({messages:a})}return g()}case F.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=v,b=a.find(_=>_.toolCalls?.some(T=>T.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(_=>_.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,(_,T,P)=>{let A=x.function.arguments,O=x.function.name,k={};try{k=lu(A)}catch{}return _.onToolCallArgsEvent?.({event:v,messages:T,state:P,agent:r,input:e,toolCallBuffer:A,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(_=>_.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,_,T)=>{let P=b.function.arguments,A=b.function.name,O={};try{O=JSON.parse(P)}catch{}return I.onToolCallEndEvent?.({event:v,messages:_,state:T,agent:r,input:e,toolCallName:A,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:_}=v,T={id:y,toolCallId:b,role:I||"tool",content:x,...(_!=null&&{subagentRunId:_})};It(T,v);let P=a.findIndex(A=>A.role==="assistant"&&A.toolCalls?.some(O=>O.id===b));if(P===-1)a.push(T);else{let A=P+1;for(;A<a.length&&a[A].role==="tool";)A++;a.splice(A,0,T)}yield Promise.all(n.map(A=>{A.onNewMessage?.({message:T,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=Lc.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 ma(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=Ar(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 jc?b.errors:[b]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var R=Ar(v),h=R.next();!h.done;h=R.next()){var y=h.value;try{tS(y)}catch(b){i=i??[],b instanceof jc?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 jc(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)tS(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)&&ma(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&ma(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 Uc(e){return e instanceof Ho||e&&"closed"in e&&Ee(e.remove)&&Ee(e.add)&&Ee(e.unsubscribe)}function tS(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 Vc(e){zo.setTimeout(function(){var t=Bt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function ga(){}m();d();f();p();var rS=function(){return Jp("C",void 0,void 0)}();function nS(e){return Jp("E",void 0,e)}function oS(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 iS(e){Bt.useDeprecatedSynchronousErrorHandling&&qn&&(qn.errorThrown=!0,qn.error=e)}var ha=function(e){nr(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Uc(r)&&r.add(n)):n.destination=mO,n}return t.create=function(r,n,o){return new Bc(r,n,o)},t.prototype.next=function(r){this.isStopped?tf(oS(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?tf(nS(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?tf(rS,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 dO=Function.prototype.bind;function ef(e,t){return dO.call(e,t)}var pO=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){Gc(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Gc(n)}else Gc(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Gc(r)}},e}(),Bc=function(e){nr(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 pO(a),i}return t}(ha);function Gc(e){Bt.useDeprecatedSynchronousErrorHandling?iS(e):Vc(e)}function fO(e){throw e}function tf(e,t){var r=Bt.onStoppedNotification;r&&zo.setTimeout(function(){return r(e,t)})}var mO={closed:!0,next:ga,error:fO,complete:ga};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 $c(){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 Ge=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=hO(t)?t:new Bc(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=aS(r),new r(function(o,i){var a=new Bc({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=aS(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 aS(e){var t;return(t=e??Bt.Promise)!==null&&t!==void 0?t:Promise}function gO(e){return e&&Ee(e.next)&&Ee(e.error)&&Ee(e.complete)}function hO(e){return e&&e instanceof ha||gO(e)&&Uc(e)}m();d();f();p();function yO(e){return Ee(e?.lift)}function Qe(e){return function(t){if(yO(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 vO(e,t,r,n,o)}var vO=function(e){nr(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}(ha);m();d();f();p();m();d();f();p();var sS=Qo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var or=function(e){nr(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 cS(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new sS},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=Ar(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,ma(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 Ge;return r.source=this,r},t.create=function(r,n){return new cS(r,n)},t}(Ge);var cS=function(e){nr(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}(or);m();d();f();p();m();d();f();p();var nf={now:function(){return(nf.delegate||Date).now()},delegate:void 0};var Qc=function(e){nr(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}(or);m();d();f();p();var Hc=new Ge(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function uS(e){return e&&Ee(e.schedule)}function SO(e){return e[e.length-1]}function lS(e){return uS(SO(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 zc=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function Wc(e){return Ee(e?.then)}m();d();f();p();function Kc(e){return Ee(e[Ko])}m();d();f();p();function Yc(e){return Symbol.asyncIterator&&Ee(e?.[Symbol.asyncIterator])}m();d();f();p();function Xc(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 bO(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Zc=bO();function Jc(e){return Ee(e?.[Zc])}m();d();f();p();function eu(e){return Jv(this,arguments,function(){var r,n,o,i;return qc(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 tu(e){return Ee(e?.getReader)}function Xe(e){if(e instanceof Ge)return e;if(e!=null){if(Kc(e))return AO(e);if(zc(e))return wO(e);if(Wc(e))return xO(e);if(Yc(e))return dS(e);if(Jc(e))return CO(e);if(tu(e))return EO(e)}throw Xc(e)}function AO(e){return new Ge(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 wO(e){return new Ge(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function xO(e){return new Ge(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Vc)})}function CO(e){return new Ge(function(t){var r,n;try{for(var o=Ar(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 dS(e){return new Ge(function(t){RO(e,t).catch(function(r){return t.error(r)})})}function EO(e){return dS(eu(e))}function RO(e,t){var r,n,o,i;return Zv(this,void 0,void 0,function(){var a,s;return qc(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),r=eS(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 Mt(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 ru(e,t){return t===void 0&&(t=0),Qe(function(r,n){r.subscribe(We(n,function(o){return Mt(n,e,function(){return n.next(o)},t)},function(){return Mt(n,e,function(){return n.complete()},t)},function(o){return Mt(n,e,function(){return n.error(o)},t)}))})}m();d();f();p();function nu(e,t){return t===void 0&&(t=0),Qe(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function pS(e,t){return Xe(e).pipe(nu(t),ru(t))}m();d();f();p();function fS(e,t){return Xe(e).pipe(nu(t),ru(t))}m();d();f();p();function mS(e,t){return new Ge(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 gS(e,t){return new Ge(function(r){var n;return Mt(r,t,function(){n=e[Zc](),Mt(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 ou(e,t){if(!e)throw new Error("Iterable cannot be null");return new Ge(function(r){Mt(r,t,function(){var n=e[Symbol.asyncIterator]();Mt(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}m();d();f();p();function hS(e,t){return ou(eu(e),t)}function yS(e,t){if(e!=null){if(Kc(e))return pS(e,t);if(zc(e))return mS(e,t);if(Wc(e))return fS(e,t);if(Yc(e))return ou(e,t);if(Jc(e))return gS(e,t);if(tu(e))return hS(e,t)}throw Xc(e)}function jn(e,t){return t?yS(e,t):Xe(e)}function Oe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=lS(e);return jn(e,r)}m();d();f();p();function de(e,t){var r=Ee(e)?e:function(){return e},n=function(o){return o.error(r())};return new Ge(t?function(o){return t.schedule(n,0,o)}:n)}m();d();f();p();m();d();f();p();var vS=Qo(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function iu(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 vS)}})})}m();d();f();p();function Qr(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 SS(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 _=u.shift();a?Mt(t,a,function(){return y(_)}):y(_)};u.length&&c<n;)I();R()}catch(_){t.error(_)}}))};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 Qr(function(i,a){return t(n,i,o,a)})(Xe(e(n,o)))},r):(typeof t=="number"&&(r=t),Qe(function(n,o){return SS(n,o,e,r)}))}function of(e){return e===void 0&&(e=1/0),wt(Yo,e)}m();d();f();p();function au(e){return new Ge(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 ya(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,ya(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 su(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 cu(e){return Qe(function(t,r){Xe(e).subscribe(We(r,function(){return r.complete()},ga)),!r.closed&&t.subscribe(r)})}m();d();f();p();function uu(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 bS(e){return` \r
|
|
36
|
+
`.indexOf(e)>=0}function lu(e){for(var t=["topLevel"],r=0,n,o,i,a=function(_){return t.push(_)},s=function(_){return t[t.length-1]=_},u=function(_){n==null&&(n=r,o=t.length,i=_)},c=function(_){_===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},R=function(_){if("0"<=_&&_<="9"){a("number");return}switch(_){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():bS(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":bS(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(_){return b.push(_.slice(e.length-e.lastIndexOf(_[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 wS(){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 du=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>=du&&(o=o+(n/du|0),n=n%du)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?CS(n,o):df(n,o)}function xS(e,t){let r=df(e,t),n=r.hi&2147483648;n&&(r=CS(r.lo,r.hi));let o=lf(r.lo,r.hi);return n?"-"+o:o}function lf(e,t){if({lo:e,hi:t}=IO(e,t),t<=2097151)return String(du*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()+AS(a)+AS(i)}function IO(e,t){return{lo:e>>>0,hi:t>>>0}}function df(e,t){return{lo:e|0,hi:t|0}}function CS(e,t){return t=~t,e?e=~e+1:t+=1,df(e,t)}var AS=e=>{let t=String(e);return"0000000".slice(t.length)+t};function ES(){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=TO();function TO(){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"&&(!!w.Deno||!!w.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()),RS(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),IS(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),RS(r),uf(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),IS(r),uf(r)},dec(r,n){return xS(r,n)},uDec(r,n){return lf(r,n)}}}function RS(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function IS(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var pf;function _O(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=w;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)),_O(o)}return pf}function mf(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var Hr;(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"})(Hr||(Hr={}));var kO=4294967295,OO=2147483647,PO=-2147483648,ye=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?mf(t):ff().encodeUtf8Into,this.buffer=_S,this.viewCache=FO,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||NO;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(va),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-va,n=gf(r);return n>va&&(this.ensureCapacity(n-va),this.buffer.copyWithin(t+n,t+va,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(TS(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<=kS){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 DO(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 TS(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}},NO=128,va=1,_S=new Uint8Array(0),FO=new DataView(_S.buffer),kS=32;function gf(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var Z=class{constructor(t,r=ff().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=wS,this.uint32=ES,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 Hr.Varint:for(;this.buf[this.pos++]&128;);break;case Hr.Bit64:this.pos+=4;case Hr.Bit32:this.pos+=4;break;case Hr.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Hr.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[a,s]=this.tag();if(s===Hr.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<=kS){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>OO||e<PO)throw new Error("invalid int32: "+e)}function TS(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>kO||e<0)throw new Error("invalid uint32: "+e)}function DO(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 MO=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 ye){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 Z?e:new Z(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 OS(){return{key:"",value:void 0}}var bf={encode(e,t=new ye){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&se.encode(se.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=OS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=r.string();continue;case 2:if(i!==18)break;o.value=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return bf.fromPartial(e??{})},fromPartial(e){let t=OS();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 se={encode(e,t=new ye){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&ut.encode(ut.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Sa.encode(Sa.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(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=Sa.unwrap(Sa.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return se.fromPartial(e??{})},fromPartial(e){let t=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=MO.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(w.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new w.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 Sa={encode(e,t=new ye){for(let r of e.values)se.encode(se.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof Z?e:new Z(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(se.unwrap(se.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Sa.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")&&w.Array.isArray(e.values)?e.values:e}},LO=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 PS(){return{op:0,path:"",from:void 0,value:void 0}}var fu={encode(e,t=new ye){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&se.encode(se.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=PS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.op=r.int32();continue;case 2:if(i!==18)break;o.path=r.string();continue;case 3:if(i!==26)break;o.from=r.string();continue;case 4:if(i!==34)break;o.value=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return fu.fromPartial(e??{})},fromPartial(e){let t=PS();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function NS(){return{id:"",type:"",function:void 0,metadata:void 0}}var mu={encode(e,t=new ye){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&gu.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 Z?e:new Z(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.id=r.string();continue;case 2:if(i!==18)break;o.type=r.string();continue;case 3:if(i!==26)break;o.function=gu.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 mu.fromPartial(e??{})},fromPartial(e){let t=NS();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?gu.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function FS(){return{name:"",arguments:""}}var gu={encode(e,t=new ye){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=FS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.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 gu.fromPartial(e??{})},fromPartial(e){let t=FS();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function DS(){return{value:"",mimeType:""}}var hu={encode(e,t=new ye){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==""&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof Z?e:new Z(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.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 hu.fromPartial(e??{})},fromPartial(e){let t=DS();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function MS(){return{value:"",mimeType:void 0}}var yu={encode(e,t=new ye){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof Z?e:new Z(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.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 yu.fromPartial(e??{})},fromPartial(e){let t=MS();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function LS(){return{data:void 0,url:void 0}}var Rt={encode(e,t=new ye){return e.data!==void 0&&hu.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&yu.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(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.data=hu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=yu.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=LS();return t.data=e.data!==void 0&&e.data!==null?hu.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?yu.fromPartial(e.url):void 0,t}};function qS(){return{text:""}}var vu={encode(e,t=new ye){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof Z?e:new Z(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=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=qS();return t.text=e.text??"",t}};function jS(){return{source:void 0,metadata:void 0}}var Su={encode(e,t=new ye){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(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.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Su.fromPartial(e??{})},fromPartial(e){let t=jS();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function US(){return{source:void 0,metadata:void 0}}var bu={encode(e,t=new ye){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(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.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return bu.fromPartial(e??{})},fromPartial(e){let t=US();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function VS(){return{source:void 0,metadata:void 0}}var Au={encode(e,t=new ye){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(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=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Au.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 wu={encode(e,t=new ye){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(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=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return wu.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{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var xu={encode(e,t=new ye){return e.text!==void 0&&vu.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Su.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&bu.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Au.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&wu.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(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.text=vu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=Su.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=bu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=Au.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=wu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xu.fromPartial(e??{})},fromPartial(e){let t=BS();return t.text=e.text!==void 0&&e.text!==null?vu.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Su.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?bu.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Au.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?wu.fromPartial(e.document):void 0,t}};function $S(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var Cu={encode(e,t=new ye){e.id!==""&&t.uint32(10).string(e.id),e.role!==""&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let r of e.toolCalls)mu.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)xu.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 Z?e:new Z(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.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(mu.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(xu.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 Cu.fromPartial(e??{})},fromPartial(e){let t=$S();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=>mu.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>xu.fromPartial(r))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function QS(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var Eu={encode(e,t=new ye){return e.id!==""&&t.uint32(10).string(e.id),e.reason!==""&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&se.encode(se.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(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.id=r.string();continue;case 2:if(i!==18)break;o.reason=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.toolCallId=r.string();continue;case 5:if(i!==42)break;o.responseSchema=se.unwrap(se.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.expiresAt=r.string();continue;case 7:if(i!==58)break;o.metadata=se.unwrap(se.decode(r,r.uint32()));continue;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 Eu.fromPartial(e??{})},fromPartial(e){let t=QS();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}},qO=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 HS(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var ie={encode(e,t=new ye){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&se.encode(se.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 Z?e:new Z(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!==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=se.unwrap(se.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 ie.fromPartial(e??{})},fromPartial(e){let t=HS();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 zS(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0,subagentRunId:void 0}}var Ru={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Ru.fromPartial(e??{})},fromPartial(e){let t=zS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.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 WS(){return{baseEvent:void 0,messageId:"",delta:"",subagentRunId:void 0}}var Iu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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!==10)break;o.baseEvent=ie.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 Iu.fromPartial(e??{})},fromPartial(e){let t=WS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function KS(){return{baseEvent:void 0,messageId:"",subagentRunId:void 0}}var Tu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Tu.fromPartial(e??{})},fromPartial(e){let t=KS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function YS(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0,subagentRunId:void 0}}var _u={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 _u.fromPartial(e??{})},fromPartial(e){let t=YS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.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 XS(){return{baseEvent:void 0,toolCallId:"",delta:"",subagentRunId:void 0}}var ku={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 ku.fromPartial(e??{})},fromPartial(e){let t=XS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function ZS(){return{baseEvent:void 0,toolCallId:"",subagentRunId:void 0}}var Ou={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Ou.fromPartial(e??{})},fromPartial(e){let t=ZS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function JS(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var Pu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&se.encode(se.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 Z?e:new Z(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=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=se.unwrap(se.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 Pu.fromPartial(e??{})},fromPartial(e){let t=JS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function eb(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var Nu={encode(e,t=new ye){e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)fu.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 Z?e:new Z(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=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(fu.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 Nu.fromPartial(e??{})},fromPartial(e){let t=eb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>fu.fromPartial(r))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function tb(){return{baseEvent:void 0,messages:[]}}var Fu={encode(e,t=new ye){e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Cu.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof Z?e:new Z(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=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(Cu.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Fu.fromPartial(e??{})},fromPartial(e){let t=tb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Cu.fromPartial(r))||[],t}};function rb(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var Du={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&se.encode(se.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(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=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=se.unwrap(se.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.source=r.string();continue;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 Du.fromPartial(e??{})},fromPartial(e){let t=rb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.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 nb(){return{baseEvent:void 0,name:"",value:void 0,subagentRunId:void 0}}var Mu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&se.encode(se.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(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=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=se.unwrap(se.decode(r,r.uint32()));continue;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 Mu.fromPartial(e??{})},fromPartial(e){let t=nb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function ob(){return{baseEvent:void 0,threadId:"",runId:""}}var Lu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Lu.fromPartial(e??{})},fromPartial(e){let t=ob();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function ib(){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 ye){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 Z?e:new Z(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.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=ib();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 ab(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var qu={encode(e,t=new ye){e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&se.encode(se.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)Eu.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 Z?e:new Z(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=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue;case 4:if(i!==34)break;o.result=se.unwrap(se.decode(r,r.uint32()));continue;case 5:if(i!==42)break;o.outcome=r.string();continue;case 6:if(i!==50)break;o.interrupts.push(Eu.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 qu.fromPartial(e??{})},fromPartial(e){let t=ab();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.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=>Eu.fromPartial(r))||[],t.usage=e.usage?.map(r=>Vn.fromPartial(r))||[],t}};function sb(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var ju={encode(e,t=new ye){e.baseEvent!==void 0&&ie.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 Z?e:new Z(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.baseEvent=ie.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 ju.fromPartial(e??{})},fromPartial(e){let t=sb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.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 cb(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Uu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Uu.fromPartial(e??{})},fromPartial(e){let t=cb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function ub(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Vu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Vu.fromPartial(e??{})},fromPartial(e){let t=ub();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function lb(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var Gu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Gu.fromPartial(e??{})},fromPartial(e){let t=lb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.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 db(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var Bu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Bu.fromPartial(e??{})},fromPartial(e){let t=db();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.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 pb(){return{baseEvent:void 0,subagentRunId:"",name:"",description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var $u={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 $u.fromPartial(e??{})},fromPartial(e){let t=pb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.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 fb(){return{baseEvent:void 0,subagentRunId:"",result:void 0,outcome:"",interruptIds:[]}}var Qu={encode(e,t=new ye){e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&se.encode(se.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 Z?e:new Z(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=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=r.string();continue;case 3:if(i!==26)break;o.result=se.unwrap(se.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 Qu.fromPartial(e??{})},fromPartial(e){let t=fb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.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 mb(){return{baseEvent:void 0,subagentRunId:"",message:"",code:void 0}}var Hu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.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 Z?e:new Z(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=ie.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 Hu.fromPartial(e??{})},fromPartial(e){let t=mb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.message=e.message??"",t.code=e.code??void 0,t}};function gb(){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 hb={encode(e,t=new ye){return e.textMessageStart!==void 0&&Ru.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Iu.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Tu.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&_u.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&ku.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Ou.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Pu.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Nu.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Fu.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Du.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Mu.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Lu.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&qu.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&ju.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Uu.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Vu.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Gu.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Bu.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&$u.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&Qu.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&Hu.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(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.textMessageStart=Ru.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=Iu.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=Tu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=_u.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=ku.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=Ou.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=Pu.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Nu.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=Fu.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Du.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Mu.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Lu.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=qu.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=ju.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Uu.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=Vu.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=Gu.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Bu.decode(r,r.uint32());continue;case 19:if(i!==154)break;o.subagentStarted=$u.decode(r,r.uint32());continue;case 20:if(i!==162)break;o.subagentFinished=Qu.decode(r,r.uint32());continue;case 21:if(i!==170)break;o.subagentError=Hu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return hb.fromPartial(e??{})},fromPartial(e){let t=gb();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Ru.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Iu.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Tu.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?_u.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?ku.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Ou.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Pu.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Nu.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Fu.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Du.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Mu.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Lu.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?qu.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?ju.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Uu.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Vu.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Gu.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Bu.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?$u.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?Qu.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?Hu.fromPartial(e.subagentError):void 0,t}};function Xo(e){let t=w.Number(e.toString());if(t>w.Number.MAX_SAFE_INTEGER)throw new w.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<w.Number.MIN_SAFE_INTEGER)throw new w.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var yb=e=>e&&typeof e=="object"?e:void 0;var pu=e=>{let t=yb(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}}}},jO=e=>{let t=yb(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:pu(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:pu(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:pu(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:pu(r.source),metadata:r.metadata}}}};function vb(e){let t=hb.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=qO[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=>jO(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=LO[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]}),_c.parse(r)}var Af="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var VO=/^[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(VO);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Sb=e=>e==="*"||e==="x"||e==="X",bb=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},GO=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],BO=(e,t)=>{if(Sb(e)||Sb(t))return 0;let[r,n]=GO(bb(e),bb(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=BO(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 ba(){return Ur()}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 Ab=512*1024;function wb(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&&!wb(t,r,Ab),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&&wb(u,c,Ab)&&(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 zu(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 Aa(e){if(e instanceof If)return e;if(e===!0)return new If(zu(!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 $O(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=Gv(e.metadata,Te(t.metadata)),!0)}var Pb=(e,t,r,n,o)=>{let i=Aa(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):Hc};return t.pipe(su(/*#__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,_=a.find(A=>A.id===y);if(_?.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 T=_;if(!T){let A={id:y,role:b,content:"",...(x!==void 0&&{name:x}),...(I!=null&&{subagentRunId:I})};a.push(A),T=A}let P=It(T,v);(!_||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,_,T)=>I.onTextMessageContentEvent?.({event:v,messages:_,state:T,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,_)=>x.onTextMessageEndEvent?.({event:v,messages:I,state:_,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,_=a.find(O=>O.toolCalls?.some(k=>k.id===y))?.toolCalls?.find(O=>O.id===y);if(_){let O=_.function.name!==b;return O&&(console.warn(`TOOL_CALL_START: tool call '${y}' already exists with name '${_.function.name}' \u2014 updating it to '${b}'`),_.function.name=b),(It(_,v)||O)&&c({messages:a}),g()}let T=new Set(a.map(O=>O.id)),P=$O(a,x,y);!T.has(P.id)&&I!=null&&P.subagentRunId===void 0&&(P.subagentRunId=I),P.toolCalls??(P.toolCalls=[]);let A={id:y,type:"function",function:{name:b,arguments:""}};P.toolCalls.push(A),It(A,v),c({messages:a})}return g()}case F.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=v,b=a.find(_=>_.toolCalls?.some(T=>T.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(_=>_.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,(_,T,P)=>{let A=x.function.arguments,O=x.function.name,k={};try{k=lu(A)}catch{}return _.onToolCallArgsEvent?.({event:v,messages:T,state:P,agent:r,input:e,toolCallBuffer:A,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(_=>_.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,_,T)=>{let P=b.function.arguments,A=b.function.name,O={};try{O=JSON.parse(P)}catch{}return I.onToolCallEndEvent?.({event:v,messages:_,state:T,agent:r,input:e,toolCallName:A,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:_}=v,T={id:y,toolCallId:b,role:I||"tool",content:x,...(_!=null&&{subagentRunId:_})};It(T,v);let P=a.findIndex(A=>A.role==="assistant"&&A.toolCalls?.some(O=>O.id===b));if(P===-1)a.push(T);else{let A=P+1;for(;A<a.length&&a[A].role==="tool";)A++;a.splice(A,0,T)}yield Promise.all(n.map(A=>{A.onNewMessage?.({message:T,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=Lc.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(A=>{if(A.subagentRunId!==null)return A;let O={...A};return delete O.subagentRunId,O}),x=new Map(b.map(A=>[A.id,A])),I=b.some(A=>A.role==="activity"),_=b.some(A=>A.role==="reasoning"),T=A=>A.role==="activity"&&!I||A.role==="reasoning"&&!_;a=a.filter(A=>T(A)||x.has(A.id)).map(A=>T(A)?A:x.get(A.id));let P=new Set(a.map(A=>A.id));for(let A of b)P.has(A.id)||a.push(A);c({messages:a})}return g()}case F.ACTIVITY_SNAPSHOT:{let h=v,y=a.findIndex(T=>T.id===h.messageId),b=y>=0?a[y]:void 0,x=b?.role==="activity"?b:void 0,I=h.replace??!0,_=yield Pe(n,a,s,(T,P,A)=>T.onActivitySnapshotEvent?.({event:h,messages:P,state:A,agent:r,input:e,activityMessage:x,existingMessage:b}));if(c(_),_.stopPropagation!==!0){let T={id:h.messageId,role:"activity",activityType:h.activityType,content:Te(h.content),...(h.subagentRunId!=null&&{subagentRunId:h.subagentRunId})},P,A;y===-1?(a.push(T),P=T,A=T):x?(I&&(a[y]={...x,activityType:h.activityType,content:Te(h.content),subagentRunId:h.subagentRunId},h.subagentRunId??delete a[y].subagentRunId),A=a[y]):I&&(a[y]=T,P=T,A=T),It(A,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(_=>_.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,(_,T,P)=>_.onActivityDeltaEvent?.({event:h,messages:T,state:P,agent:r,input:e,activityMessage:x}));if(c(I),I.stopPropagation!==!0)try{It(x,h)&&c({messages:a});let _=Te(x.content??{}),T=Lc.applyPatch(_,h.patch??[],!0,!1).newDocument;a[y]={...x,content:Te(T),activityType:h.activityType},c({messages:a})}catch(_){let T=_ instanceof Error?_.message:String(_);console.warn(`Failed to apply activity patch for '${h.messageId}': ${T}`)}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,_)=>x.onRunFinishedEvent?.({...y,messages:I,state:_,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(T=>T.id===y),I=x;if(!I){let T={id:y,role:"reasoning",content:"",...(b!=null&&{subagentRunId:b})};a.push(T),I=T}let _=It(I,v);(!x||_)&&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,_,T)=>I.onReasoningMessageContentEvent?.({event:v,messages:_,state:T,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,_)=>x.onReasoningMessageEndEvent?.({event:v,messages:I,state:_,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,_,T)=>I.onReasoningEncryptedValueEvent?.({event:v,messages:_,state:T,agent:r,input:e}));if(c(x),x.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let _ of a)if(_.role==="assistant"&&_.toolCalls){let T=_.toolCalls.find(P=>P.id===y);if(T){T.encryptedValue=b,I=!0;break}}}else{let _=a.find(T=>T.id===y);_?.role!=="activity"&&_&&(_.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)}}()),rf(),n.length>0?of({}):v=>v)},xf=e=>t=>{let r=Aa(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=A=>{let O=g.get(A);return O||(O=new Map,g.set(A,O)),O},R=()=>{for(let A of g.values())if(A.size>0)return!0;return!1},h=new Map,y=new Set,b=!1,x=!1,I=!1,_=()=>{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},T=(A,O)=>{let k=A??[];if(Array.isArray(k))for(let N of k){if(!N||typeof N.id!="string")continue;if(N.subagentRunId===null)return new he(`Cannot send a message (id '${N.id}') with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`);let M=N.role==="reasoning"?a.reasoning:N.role==="activity"?a.activity:a.message;(O||!M.has(N.id))&&M.set(N.id,{subagentRunId:N.subagentRunId});for(let V of N.toolCalls??[])V&&typeof V.id=="string"&&(O||!a.toolCall.has(V.id))&&a.toolCall.set(V.id,{subagentRunId:N.subagentRunId??void 0})}},P=(A,O,k,N,M)=>{if(O!==void 0&&k&&k.subagentRunId!==O)return new he(`Cannot send '${A}': subagentRunId '${O}' does not match the ${N} '${M}' opener's subagent '${k.subagentRunId??"(the parent agent)"}'.`)};return t.pipe(wt(A=>{let O=A.type;if(r?.event("VERIFY","Event:",A,{type:A.type}),u&&O!==F.RUN_STARTED)return de(()=>new he(`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 de(()=>new he(`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 de(()=>new he("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)&&_()}}else if(c=!0,O!==F.RUN_STARTED&&O!==F.RUN_ERROR)return de(()=>new he("First event must be 'RUN_STARTED'"));if(A.subagentRunId===null)return de(()=>new he(`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 M of k)if(A[M]===null)return de(()=>new he(`Cannot send '${O}' with '${M}: null'. The field is optional \u2014 omit it entirely.`));let N=A.outcome;if(N!=null&&N.type!=="success"&&N.type!=="suspended")return de(()=>new he(`Cannot send '${O}' with outcome type '${String(N.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(N&&N.interruptIds===null)return de(()=>new he(`Cannot send '${O}' with 'outcome.interruptIds: null'. The field is optional \u2014 omit it entirely.`));if(N&&Array.isArray(N.interruptIds)&&N.interruptIds.some(M=>typeof M!="string"))return de(()=>new he(`Cannot send '${O}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(O===F.RUN_FINISHED){let k=A.outcome;if(k?.type==="interrupt"&&Array.isArray(k.interrupts)){for(let N of k.interrupts)if(N&&N.subagentRunId===null)return de(()=>new he(`Cannot send 'RUN_FINISHED' with an interrupt (id '${N.id}') carrying 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`))}}switch(O){case F.TEXT_MESSAGE_START:{let k=A.messageId;if(n.has(k))return de(()=>new he(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${k}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let N=a.message.get(k);if(N){let M=P(O,A.subagentRunId,N,"message",k);if(M)return de(()=>M)}return n.add(k),N||a.message.set(k,{subagentRunId:A.subagentRunId}),Oe(A)}case F.TEXT_MESSAGE_CONTENT:{let k=A.messageId;if(!n.has(k))return de(()=>new he(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${k}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let N=P(O,A.subagentRunId,a.message.get(k),"message",k);return N?de(()=>N):Oe(A)}case F.TEXT_MESSAGE_END:{let k=A.messageId;if(!n.has(k))return de(()=>new he(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${k}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let N=P(O,A.subagentRunId,a.message.get(k),"message",k);return N?de(()=>N):(n.delete(k),Oe(A))}case F.TOOL_CALL_START:{let k=A.toolCallId;if(o.has(k))return de(()=>new he(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${k}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let N=A.parentMessageId,M=A.subagentRunId,V;if(N!==void 0){let D=a.message.get(N);if(D){if(M!==void 0&&M!==D.subagentRunId)return de(()=>new he(`Cannot send 'TOOL_CALL_START': subagentRunId '${M}' does not match its parent message '${N}' owner '${D.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`));V=D}}let j=a.toolCall.get(k);if(j){let D=P(O,M,j,"tool call",k);if(D)return de(()=>D);if(M===void 0&&V&&V.subagentRunId!==j.subagentRunId)return de(()=>new he(`Cannot send 'TOOL_CALL_START': tool call '${k}' is owned by '${j.subagentRunId??"(the parent agent)"}' but its parent message '${N}' is owned by '${V.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`))}return o.add(k),j||a.toolCall.set(k,M===void 0?V??{subagentRunId:void 0}:{subagentRunId:M}),Oe(A)}case F.TOOL_CALL_ARGS:{let k=A.toolCallId;if(!o.has(k))return de(()=>new he(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${k}'. Start a tool call with 'TOOL_CALL_START' first.`));let N=P(O,A.subagentRunId,a.toolCall.get(k),"tool call",k);return N?de(()=>N):Oe(A)}case F.TOOL_CALL_END:{let k=A.toolCallId;if(!o.has(k))return de(()=>new he(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${k}'. A 'TOOL_CALL_START' event must be sent first.`));let N=P(O,A.subagentRunId,a.toolCall.get(k),"tool call",k);return N?de(()=>N):(o.delete(k),Oe(A))}case F.STEP_STARTED:{let k=A.stepName,N=A.subagentRunId;return v(N).has(k)?de(()=>new he(`Step "${k}" is already active for 'STEP_STARTED'${N===void 0?"":` in subagent '${N}'`}`)):(v(N).set(k,!0),Oe(A))}case F.STEP_FINISHED:{let k=A.stepName,N=A.subagentRunId;if(!v(N).has(k)){let M,V=!1;for(let[j,D]of g)if(j!==N&&D.has(k)){M=j,V=!0;break}return de(V?()=>new he(`Cannot send 'STEP_FINISHED' for step "${k}" attributed to ${N===void 0?"the parent agent":`subagent '${N}'`}: that step is open under ${M===void 0?"the parent agent":`subagent '${M}'`}. A step must be finished by whoever started it.`):()=>new he(`Cannot send 'STEP_FINISHED' for step "${k}" that was not started`))}return v(N).delete(k),Oe(A)}case F.ACTIVITY_SNAPSHOT:{let k=A.messageId;return(!a.activity.has(k)||A.replace!==!1)&&a.activity.set(k,{subagentRunId:A.subagentRunId}),Oe(A)}case F.TOOL_CALL_RESULT:{let k=A.messageId;return typeof k=="string"&&a.message.set(k,{subagentRunId:A.subagentRunId}),Oe(A)}case F.REASONING_START:case F.REASONING_MESSAGE_START:{let k=A.messageId,N=a.reasoning.get(k);if(N){let M=P(O,A.subagentRunId,N,"reasoning message",k);if(M)return de(()=>M)}return i.add(k),N||a.reasoning.set(k,{subagentRunId:A.subagentRunId}),Oe(A)}case F.REASONING_MESSAGE_CONTENT:case F.REASONING_MESSAGE_END:case F.REASONING_END:{let k=A.messageId,N=P(O,A.subagentRunId,a.reasoning.get(k),"reasoning message",k);return N?de(()=>N):(O===F.REASONING_END&&i.delete(k),Oe(A))}case F.REASONING_ENCRYPTED_VALUE:{let k=A.entityId,N=A.subtype,M=N==="tool-call"?a.toolCall.get(k):N==="message"?a.message.get(k)??a.reasoning.get(k):a.reasoning.get(k),V=N==="tool-call"?"tool call":N==="message"?"message":"reasoning message",j=P(O,A.subagentRunId,M,V,k);return j?de(()=>j):Oe(A)}case F.ACTIVITY_DELTA:{let k=A.messageId,N=P(O,A.subagentRunId,a.activity.get(k),"activity",k);return N?de(()=>N):Oe(A)}case F.SUBAGENT_STARTED:{if(typeof A.subagentRunId!="string")return de(()=>new he("Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'."));if(typeof A.name!="string")return de(()=>new he("Cannot send 'SUBAGENT_STARTED' without a 'name'."));let k=A.subagentRunId,N=A.parentSubagentRunId;return h.has(k)?de(()=>new he(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):y.has(k)?de(()=>new he(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):N!==void 0&&!h.has(N)&&!y.has(N)?de(()=>new he(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${N}' has not been started in this run.`)):(h.set(k,!0),Oe(A))}case F.SUBAGENT_FINISHED:case F.SUBAGENT_ERROR:{if(typeof A.subagentRunId!="string")return de(()=>new he(`Cannot send '${O}' without a 'subagentRunId'.`));if(O===F.SUBAGENT_ERROR&&typeof A.message!="string")return de(()=>new he("Cannot send 'SUBAGENT_ERROR' without a 'message'."));let k=A.subagentRunId;return h.has(k)?(h.delete(k),y.add(k),Oe(A)):de(()=>new he(`Cannot send '${O}': no active subagent found with ID '${k}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case F.MESSAGES_SNAPSHOT:{let k=T(A.messages,!0);if(k)return de(()=>k)}return Oe(A);case F.RUN_STARTED:I=!0;{let k=T((A.input??{}).messages,!1);if(k)return de(()=>k)}return Oe(A);case F.RUN_FINISHED:if(R()){let k=[];for(let[M,V]of g)for(let j of V.keys())k.push(M===void 0?j:`${j} (subagent '${M}')`);let N=k.join(", ");return de(()=>new he(`Cannot send 'RUN_FINISHED' while steps are still active: ${N}`))}if(n.size>0){let k=Array.from(n.keys()).join(", ");return de(()=>new he(`Cannot send 'RUN_FINISHED' while text messages are still active: ${k}`))}if(o.size>0){let k=Array.from(o.keys()).join(", ");return de(()=>new he(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${k}`))}if(h.size>0){let k=Array.from(h.keys()).join(", ");return de(()=>new he(`Cannot send 'RUN_FINISHED' while subagents are still active: ${k}`))}return s=!0,Oe(A);case F.RUN_ERROR:return u=!0,Oe(A);case F.CUSTOM:return Oe(A);case F.THINKING_TEXT_MESSAGE_START:return b?x?de(()=>new he("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(A)):de(()=>new he("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(A):de(()=>new he("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(A)):de(()=>new he("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?de(()=>new he("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(b=!0,Oe(A));case F.THINKING_END:return b?(b=!1,Oe(A)):de(()=>new he("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Oe(A)}}))},Vn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),BO=e=>au(()=>qn(e())).pipe(af(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return qn(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,de(()=>s)}))}let r={type:Vn.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new Ge(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:a}=yield n.read();if(i)break;let s={type:Vn.DATA,data:a};o.next(s)}o.complete()}catch(i){o.error(i)}})(),()=>{n.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):de(()=>Error("Failed to getReader() from response"))})),$O=(e,t)=>{let r=Aa(t),n=new or,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:s=>{if(s.type!==Vn.HEADERS&&s.type===Vn.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(A=>{if(A.subagentRunId!==null)return A;let O={...A};return delete O.subagentRunId,O}),x=new Map(b.map(A=>[A.id,A])),I=b.some(A=>A.role==="activity"),_=b.some(A=>A.role==="reasoning"),T=A=>A.role==="activity"&&!I||A.role==="reasoning"&&!_;a=a.filter(A=>T(A)||x.has(A.id)).map(A=>T(A)?A:x.get(A.id));let P=new Set(a.map(A=>A.id));for(let A of b)P.has(A.id)||a.push(A);c({messages:a})}return g()}case F.ACTIVITY_SNAPSHOT:{let h=v,y=a.findIndex(T=>T.id===h.messageId),b=y>=0?a[y]:void 0,x=b?.role==="activity"?b:void 0,I=h.replace??!0,_=yield Pe(n,a,s,(T,P,A)=>T.onActivitySnapshotEvent?.({event:h,messages:P,state:A,agent:r,input:e,activityMessage:x,existingMessage:b}));if(c(_),_.stopPropagation!==!0){let T={id:h.messageId,role:"activity",activityType:h.activityType,content:Te(h.content),...(h.subagentRunId!=null&&{subagentRunId:h.subagentRunId})},P,A;y===-1?(a.push(T),P=T,A=T):x?(I&&(a[y]={...x,activityType:h.activityType,content:Te(h.content),subagentRunId:h.subagentRunId},h.subagentRunId??delete a[y].subagentRunId),A=a[y]):I&&(a[y]=T,P=T,A=T),It(A,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(_=>_.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,(_,T,P)=>_.onActivityDeltaEvent?.({event:h,messages:T,state:P,agent:r,input:e,activityMessage:x}));if(c(I),I.stopPropagation!==!0)try{It(x,h)&&c({messages:a});let _=Te(x.content??{}),T=Lc.applyPatch(_,h.patch??[],!0,!1).newDocument;a[y]={...x,content:Te(T),activityType:h.activityType},c({messages:a})}catch(_){let T=_ instanceof Error?_.message:String(_);console.warn(`Failed to apply activity patch for '${h.messageId}': ${T}`)}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,_)=>x.onRunFinishedEvent?.({...y,messages:I,state:_,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(T=>T.id===y),I=x;if(!I){let T={id:y,role:"reasoning",content:"",...(b!=null&&{subagentRunId:b})};a.push(T),I=T}let _=It(I,v);(!x||_)&&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,_,T)=>I.onReasoningMessageContentEvent?.({event:v,messages:_,state:T,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,_)=>x.onReasoningMessageEndEvent?.({event:v,messages:I,state:_,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,_,T)=>I.onReasoningEncryptedValueEvent?.({event:v,messages:_,state:T,agent:r,input:e}));if(c(x),x.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let _ of a)if(_.role==="assistant"&&_.toolCalls){let T=_.toolCalls.find(P=>P.id===y);if(T){T.encryptedValue=b,I=!0;break}}}else{let _=a.find(T=>T.id===y);_?.role!=="activity"&&_&&(_.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)}}()),of(),n.length>0?sf({}):v=>v)},Ef=e=>t=>{let r=Aa(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=A=>{let O=g.get(A);return O||(O=new Map,g.set(A,O)),O},R=()=>{for(let A of g.values())if(A.size>0)return!0;return!1},h=new Map,y=new Set,b=!1,x=!1,I=!1,_=()=>{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},T=(A,O)=>{let k=A??[];if(Array.isArray(k))for(let N of k){if(!N||typeof N.id!="string")continue;if(N.subagentRunId===null)return new he(`Cannot send a message (id '${N.id}') with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`);let M=N.role==="reasoning"?a.reasoning:N.role==="activity"?a.activity:a.message;(O||!M.has(N.id))&&M.set(N.id,{subagentRunId:N.subagentRunId});for(let V of N.toolCalls??[])V&&typeof V.id=="string"&&(O||!a.toolCall.has(V.id))&&a.toolCall.set(V.id,{subagentRunId:N.subagentRunId??void 0})}},P=(A,O,k,N,M)=>{if(O!==void 0&&k&&k.subagentRunId!==O)return new he(`Cannot send '${A}': subagentRunId '${O}' does not match the ${N} '${M}' opener's subagent '${k.subagentRunId??"(the parent agent)"}'.`)};return t.pipe(wt(A=>{let O=A.type;if(r?.event("VERIFY","Event:",A,{type:A.type}),u&&O!==F.RUN_STARTED)return de(()=>new he(`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 de(()=>new he(`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 de(()=>new he("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)&&_()}}else if(c=!0,O!==F.RUN_STARTED&&O!==F.RUN_ERROR)return de(()=>new he("First event must be 'RUN_STARTED'"));if(A.subagentRunId===null)return de(()=>new he(`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 M of k)if(A[M]===null)return de(()=>new he(`Cannot send '${O}' with '${M}: null'. The field is optional \u2014 omit it entirely.`));let N=A.outcome;if(N!=null&&N.type!=="success"&&N.type!=="suspended")return de(()=>new he(`Cannot send '${O}' with outcome type '${String(N.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(N&&N.interruptIds===null)return de(()=>new he(`Cannot send '${O}' with 'outcome.interruptIds: null'. The field is optional \u2014 omit it entirely.`));if(N&&Array.isArray(N.interruptIds)&&N.interruptIds.some(M=>typeof M!="string"))return de(()=>new he(`Cannot send '${O}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(O===F.RUN_FINISHED){let k=A.outcome;if(k?.type==="interrupt"&&Array.isArray(k.interrupts)){for(let N of k.interrupts)if(N&&N.subagentRunId===null)return de(()=>new he(`Cannot send 'RUN_FINISHED' with an interrupt (id '${N.id}') carrying 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`))}}switch(O){case F.TEXT_MESSAGE_START:{let k=A.messageId;if(n.has(k))return de(()=>new he(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${k}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let N=a.message.get(k);if(N){let M=P(O,A.subagentRunId,N,"message",k);if(M)return de(()=>M)}return n.add(k),N||a.message.set(k,{subagentRunId:A.subagentRunId}),Oe(A)}case F.TEXT_MESSAGE_CONTENT:{let k=A.messageId;if(!n.has(k))return de(()=>new he(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${k}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let N=P(O,A.subagentRunId,a.message.get(k),"message",k);return N?de(()=>N):Oe(A)}case F.TEXT_MESSAGE_END:{let k=A.messageId;if(!n.has(k))return de(()=>new he(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${k}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let N=P(O,A.subagentRunId,a.message.get(k),"message",k);return N?de(()=>N):(n.delete(k),Oe(A))}case F.TOOL_CALL_START:{let k=A.toolCallId;if(o.has(k))return de(()=>new he(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${k}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let N=A.parentMessageId,M=A.subagentRunId,V;if(N!==void 0){let D=a.message.get(N);if(D){if(M!==void 0&&M!==D.subagentRunId)return de(()=>new he(`Cannot send 'TOOL_CALL_START': subagentRunId '${M}' does not match its parent message '${N}' owner '${D.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`));V=D}}let j=a.toolCall.get(k);if(j){let D=P(O,M,j,"tool call",k);if(D)return de(()=>D);if(M===void 0&&V&&V.subagentRunId!==j.subagentRunId)return de(()=>new he(`Cannot send 'TOOL_CALL_START': tool call '${k}' is owned by '${j.subagentRunId??"(the parent agent)"}' but its parent message '${N}' is owned by '${V.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`))}return o.add(k),j||a.toolCall.set(k,M===void 0?V??{subagentRunId:void 0}:{subagentRunId:M}),Oe(A)}case F.TOOL_CALL_ARGS:{let k=A.toolCallId;if(!o.has(k))return de(()=>new he(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${k}'. Start a tool call with 'TOOL_CALL_START' first.`));let N=P(O,A.subagentRunId,a.toolCall.get(k),"tool call",k);return N?de(()=>N):Oe(A)}case F.TOOL_CALL_END:{let k=A.toolCallId;if(!o.has(k))return de(()=>new he(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${k}'. A 'TOOL_CALL_START' event must be sent first.`));let N=P(O,A.subagentRunId,a.toolCall.get(k),"tool call",k);return N?de(()=>N):(o.delete(k),Oe(A))}case F.STEP_STARTED:{let k=A.stepName,N=A.subagentRunId;return v(N).has(k)?de(()=>new he(`Step "${k}" is already active for 'STEP_STARTED'${N===void 0?"":` in subagent '${N}'`}`)):(v(N).set(k,!0),Oe(A))}case F.STEP_FINISHED:{let k=A.stepName,N=A.subagentRunId;if(!v(N).has(k)){let M,V=!1;for(let[j,D]of g)if(j!==N&&D.has(k)){M=j,V=!0;break}return de(V?()=>new he(`Cannot send 'STEP_FINISHED' for step "${k}" attributed to ${N===void 0?"the parent agent":`subagent '${N}'`}: that step is open under ${M===void 0?"the parent agent":`subagent '${M}'`}. A step must be finished by whoever started it.`):()=>new he(`Cannot send 'STEP_FINISHED' for step "${k}" that was not started`))}return v(N).delete(k),Oe(A)}case F.ACTIVITY_SNAPSHOT:{let k=A.messageId;return(!a.activity.has(k)||A.replace!==!1)&&a.activity.set(k,{subagentRunId:A.subagentRunId}),Oe(A)}case F.TOOL_CALL_RESULT:{let k=A.messageId;return typeof k=="string"&&a.message.set(k,{subagentRunId:A.subagentRunId}),Oe(A)}case F.REASONING_START:case F.REASONING_MESSAGE_START:{let k=A.messageId,N=a.reasoning.get(k);if(N){let M=P(O,A.subagentRunId,N,"reasoning message",k);if(M)return de(()=>M)}return i.add(k),N||a.reasoning.set(k,{subagentRunId:A.subagentRunId}),Oe(A)}case F.REASONING_MESSAGE_CONTENT:case F.REASONING_MESSAGE_END:case F.REASONING_END:{let k=A.messageId,N=P(O,A.subagentRunId,a.reasoning.get(k),"reasoning message",k);return N?de(()=>N):(O===F.REASONING_END&&i.delete(k),Oe(A))}case F.REASONING_ENCRYPTED_VALUE:{let k=A.entityId,N=A.subtype,M=N==="tool-call"?a.toolCall.get(k):N==="message"?a.message.get(k)??a.reasoning.get(k):a.reasoning.get(k),V=N==="tool-call"?"tool call":N==="message"?"message":"reasoning message",j=P(O,A.subagentRunId,M,V,k);return j?de(()=>j):Oe(A)}case F.ACTIVITY_DELTA:{let k=A.messageId,N=P(O,A.subagentRunId,a.activity.get(k),"activity",k);return N?de(()=>N):Oe(A)}case F.SUBAGENT_STARTED:{if(typeof A.subagentRunId!="string")return de(()=>new he("Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'."));if(typeof A.name!="string")return de(()=>new he("Cannot send 'SUBAGENT_STARTED' without a 'name'."));let k=A.subagentRunId,N=A.parentSubagentRunId;return h.has(k)?de(()=>new he(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):y.has(k)?de(()=>new he(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):N!==void 0&&!h.has(N)&&!y.has(N)?de(()=>new he(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${N}' has not been started in this run.`)):(h.set(k,!0),Oe(A))}case F.SUBAGENT_FINISHED:case F.SUBAGENT_ERROR:{if(typeof A.subagentRunId!="string")return de(()=>new he(`Cannot send '${O}' without a 'subagentRunId'.`));if(O===F.SUBAGENT_ERROR&&typeof A.message!="string")return de(()=>new he("Cannot send 'SUBAGENT_ERROR' without a 'message'."));let k=A.subagentRunId;return h.has(k)?(h.delete(k),y.add(k),Oe(A)):de(()=>new he(`Cannot send '${O}': no active subagent found with ID '${k}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case F.MESSAGES_SNAPSHOT:{let k=T(A.messages,!0);if(k)return de(()=>k)}return Oe(A);case F.RUN_STARTED:I=!0;{let k=T((A.input??{}).messages,!1);if(k)return de(()=>k)}return Oe(A);case F.RUN_FINISHED:if(R()){let k=[];for(let[M,V]of g)for(let j of V.keys())k.push(M===void 0?j:`${j} (subagent '${M}')`);let N=k.join(", ");return de(()=>new he(`Cannot send 'RUN_FINISHED' while steps are still active: ${N}`))}if(n.size>0){let k=Array.from(n.keys()).join(", ");return de(()=>new he(`Cannot send 'RUN_FINISHED' while text messages are still active: ${k}`))}if(o.size>0){let k=Array.from(o.keys()).join(", ");return de(()=>new he(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${k}`))}if(h.size>0){let k=Array.from(h.keys()).join(", ");return de(()=>new he(`Cannot send 'RUN_FINISHED' while subagents are still active: ${k}`))}return s=!0,Oe(A);case F.RUN_ERROR:return u=!0,Oe(A);case F.CUSTOM:return Oe(A);case F.THINKING_TEXT_MESSAGE_START:return b?x?de(()=>new he("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(A)):de(()=>new he("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(A):de(()=>new he("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(A)):de(()=>new he("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?de(()=>new he("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(b=!0,Oe(A));case F.THINKING_END:return b?(b=!1,Oe(A)):de(()=>new he("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Oe(A)}}))},Gn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),QO=e=>au(()=>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,de(()=>s)}))}let r={type:Gn.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new Ge(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})})):de(()=>Error("Failed to getReader() from response"))})),HO=(e,t)=>{let r=Aa(t),n=new or,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()},
|
|
42
|
-
`)},iP=(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(_=>_.tool==b.function.name);if(I)try{let _=JSON.parse(lu(b.function.arguments));I.tool_argument&&I.tool_argument in _?(R({...o,[I.state_key]:_[I.tool_argument]}),x=!0):I.tool_argument||(R({...o,[I.state_key]:_}),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=Lc.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:aP(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 aP(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=oP(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 sP=e=>e.kind==="tool"?e.fields.toolCallId:e.fields.messageId,cP=e=>e==="tool"?"toolCallId":"messageId",Zo=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},Wu=e=>t=>{let r=Aa(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&&sP(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 ${cP(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=Zo({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=Zo({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=Zo({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=Zo({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=Zo({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=Zo({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,[]}),jn(()=>{i()}))};function uP(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var wa=class{runNext(e,t){return t.run(e).pipe(Wu(!1))}runNextWithState(e,t){let r=Te(e.messages||[]),n=Te(e.state||{}),o=new Qc;return Pb(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(su(/*#__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)}}()))}},lP=class extends wa{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function dP(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 pP=class extends wa{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(dP)};return this.runNext(o,t)}},xb="THINKING_START",Cb="THINKING_END",Eb="THINKING_TEXT_MESSAGE_START",Rb="THINKING_TEXT_MESSAGE_CONTENT",Ib="THINKING_TEXT_MESSAGE_END",fP=class extends wa{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(Qr(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case xb:{this.currentReasoningId=ba();let{title:t,...r}=e;return this.warnAboutTransformation(xb,F.REASONING_START),{...r,type:F.REASONING_START,messageId:this.currentReasoningId}}case Eb:return this.currentMessageId=ba(),this.warnAboutTransformation(Eb,F.REASONING_MESSAGE_START),{...e,type:F.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case Rb:{let{delta:t,...r}=e;return this.warnAboutTransformation(Rb,F.REASONING_MESSAGE_CONTENT),{...r,type:F.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??ba(),delta:t}}case Ib:{let t=this.currentMessageId??ba();return this.warnAboutTransformation(Ib,F.REASONING_MESSAGE_END),{...e,type:F.REASONING_MESSAGE_END,messageId:t}}case Cb:{let t=this.currentReasoningId??ba();return this.warnAboutTransformation(Cb,F.REASONING_END),{...e,type:F.REASONING_END,messageId:t}}default:return e}}};function mP(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function gP(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function hP(e){let t=mP(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 yP(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>gP(n)?hP(n):n);return{...e,content:r}}var vP=class extends wa{run(e,t){let r={...e,messages:e.messages.map(yP)};return this.runNext(r,t)}},Tb="SUBAGENT_STARTED",_b="SUBAGENT_FINISHED",kb="SUBAGENT_ERROR";function Ku(e){if(e&&typeof e=="object"&&"subagentRunId"in e){let{subagentRunId:t,...r}=e;return r}return e}function Ob(e){return e.map(t=>Ku(t))}var SP=class extends wa{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=>Ku(n))};return this.runNext(r,t).pipe(uu(n=>{let o=n.type;(o===Tb||o===_b||o===kb)&&this.warnDroppedLifecycleEvent(o)}),nf(n=>{let o=n.type;return o!==Tb&&o!==_b&&o!==kb}),Qr(n=>{let o=Ku(n);if(o.type===F.MESSAGES_SNAPSHOT){let i=o;if(Array.isArray(i.messages))return{...i,messages:Ob(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=>Ku(a))}}}if(o.type===F.RUN_STARTED){let i=o;if(i.input&&Array.isArray(i.input.messages))return{...i,input:{...i.input,messages:Ob(i.input.messages)}}}return o}))}},bP="0.0.59",AP=class{get maxVersion(){return bP}get debug(){return this._debug}set debug(e){this._debug=zu(e),this._debugLogger=wf(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?wf(zu(!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??Ur(),this.messages=Te(n??[]),this.state=Te(o??{}),this._debug=zu(i),this._debugLogger=wf(this._debug),Xo(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new pP),Xo(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new fP),Xo(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new vP),Xo(this.maxVersion,"0.0.57")<=0&&this.middlewares.unshift(new SP)}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 lP(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??Ur();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 or;let a;_this14.activeRunCompletionPromise=new Promise(u=>{a=u}),yield iu($c(()=>_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),Wu(_this14.debugLogger),xf(_this14.debugLogger),u=>u.pipe(cu(_this14.activeRunDetach$)),u=>_this14.apply(r,u,i),u=>_this14.processApplyEvents(r,u,i),ya(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))),jn(()=>{_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 Bp}connectAgent(e,t){var _this15=this;return _asyncToGenerator(function*(){try{_this15.isRunning=!0,_this15.agentId=_this15.agentId??Ur();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 or;let a;_this15.activeRunCompletionPromise=new Promise(u=>{a=u}),yield iu($c(()=>au(()=>_this15.connect(r)),Wu(_this15.debugLogger),xf(_this15.debugLogger),u=>u.pipe(cu(_this15.activeRunDetach$)),u=>_this15.apply(r,u,i),u=>_this15.processApplyEvents(r,u,i),ya(u=>(_this15.isRunning=!1,u instanceof Bp?Hc:_this15.onError(r,u,i))),jn(()=>{_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 Pb(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(uu(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||Ur(),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 he(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let i of _this17.pendingInterrupts)if(uP(i))throw new he(`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 qn(Pe(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(Qr(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??Ur();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(Wu(this.debugLogger),xf(this.debugLogger),iP(this.threadId,t.runId,this.agentId),r=>r.pipe(Qr(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}};function wP(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 Nb=class extends AP{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(wP(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 HO(BO(()=>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 Fb=(e,t,r)=>{let n=_t(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 Rf=class extends Nb{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}}},Db=(e,t,r)=>new Rf({url:`${Fb(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var xP=new z({required:!0}),Mb=new z({required:!0,constrainTo:fc}),Lb=e=>({...e,name:mc(e.name)}),qb=L("followUpAnswers/setIsEnabled",e=>B(e,new me({required:!0}))),jb=L("followUpAnswers/setFollowUpAnswersConversationId",e=>B(e,Y)),Ub=L("followUpAnswers/setFollowUpAnswersConversationToken",e=>B(e,Y)),Vb=L("followUpAnswers/clearFollowUpAnswersConversationToken"),hne=L("followUpAnswers/createFollowUpAnswer",e=>B(e,{question:Y})),yne=L("followUpAnswers/setActiveFollowUpAnswerId",e=>B(e,Y)),vne=L("followUpAnswers/setFollowUpAnswerContentFormat",e=>B(e,{contentFormat:hc,answerId:Y})),Sne=L("followUpAnswers/setFollowUpIsLoading",e=>B(e,{isLoading:new me({required:!0}),answerId:Y})),bne=L("followUpAnswers/setFollowUpIsStreaming",e=>B(e,{isStreaming:new me({required:!0}),answerId:Y})),Ane=L("followUpAnswers/followUpMessageChunkReceived",e=>B(e,{textDelta:xP,answerId:Y})),wne=L("followUpAnswers/followUpCitationsReceived",e=>B(e,{citations:new Ae({required:!0,each:new ne({values:_p})}),answerId:Y})),xne=L("followUpAnswers/followUpCompleted",e=>B(e,{answerId:Y,cannotAnswer:new me({required:!1})})),Cne=L("followUpAnswers/followUpFailed",e=>B(e,{message:new z,code:new oe({min:0}),answerId:Y})),Ene=L("followUpAnswers/activeFollowUpStartFailed",e=>B(e,{message:new z})),Rne=L("followUpAnswers/likeFollowUp",e=>B(e,{answerId:Y})),Ine=L("followUpAnswers/dislikeFollowUp",e=>B(e,{answerId:Y})),Tne=L("followUpAnswers/submitFollowUpFeedback",e=>B(e,{answerId:Y})),Gb=L("followUpAnswers/resetFollowUpAnswers"),_ne=L("followUpAnswers/stepStarted",e=>B(Lb(e),{answerId:Y,name:Mb,startedAt:new oe({min:0,required:!0})})),kne=L("followUpAnswers/stepFinished",e=>B(Lb(e),{answerId:Y,name:Mb,finishedAt:new oe({min:0,required:!0})})),One=L("followUpAnswers/startToolCall",e=>B(e,{answerId:Y,toolCallName:Y,startedAt:new oe({min:0,required:!0}),toolCallId:Y})),Pne=L("followUpAnswers/finishToolCall",e=>B(e,{answerId:Y,finishedAt:new oe({min:0,required:!0}),toolCallId:Y})),Nne=L("followUpAnswers/toolCallArgs",e=>B(e,{answerId:Y,toolCallId:Y,args:new ne({options:{required:!0}}),type:new z({required:!0,constrainTo:gc})}));m();d();f();p();var CP={"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 Bb(e){return e?CP[e]??1004:1004}var $b=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(yc(n.runId)),e(jr(!1)),e(ra(!0)),e(jb(n.threadId)),e(Vb())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(iv({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(av({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(sv({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(cv({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(Sc({toolCallId:i,args:s,type:"search"})):e(Sc({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(Sc({toolCallId:i,args:{raw:a},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(na({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(aa(a.contentFormat)),typeof a?.followUpEnabled=="boolean"&&e(qb(a.followUpEnabled)),a?.conversationToken&&e(Ub(a.conversationToken));return}case"citations":{e(oa({citations:a.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=Bb(n.code);e(ia({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(kp(i)),e(sa(!i)),e(ra(!1)),e(lp(i,t,a)),e(To())}}};var Qb=()=>{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=Hs(n),s=fh(n),u=mh(n),c=ph(n),g=gh(n),v=Db(a,s,u);e=v;let R=$b(o),h=Zy(n,i());try{o(jr(!0)),yield v.runAgent({forwardedProps:{params:h,accessToken:c,recordDebugSession:g}},R)}catch(y){o(jr(!1)),o(ia({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 Yu=L("breadcrumb/deselectAll"),Hb=L("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var zb=L("facet/updateFacetAutoSelection",e=>B(e,{allow:new me({required:!0})}));m();d();f();p();m();d();f();p();var Xu=class extends Pr{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??zt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??zt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var Wb=()=>De("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Xu(e)),Kb=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var If={id:Y},EP={...If,q:nt},Boe=L("instantResults/register",e=>B(e,If)),Zu=L("instantResults/updateQuery",e=>B(e,EP)),$oe=L("instantResults/clearExpired",e=>B(e,If));m();d();f();p();var Ju=new oe({required:!0,min:0}),el=L("pagination/registerNumberOfResults",e=>B(e,Ju)),tl=L("pagination/updateNumberOfResults",e=>B(e,Ju)),rl=L("pagination/registerPage",e=>B(e,Ju)),Jo=L("pagination/updatePage",e=>B(e,Ju)),nl=L("pagination/nextPage"),ol=L("pagination/previousPage");m();d();f();p();var ei=L("query/updateQuery",e=>B(e,{q:new z,enableQuerySyntax:new me}));m();d();f();p();m();d();f();p();m();d();f();p();var zr=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var Tf=()=>De("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),Wr=e=>De("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||Et().q,aq:r.advancedSearchQueries?.aq||zr().aq,cq:r.advancedSearchQueries?.cq||zr().cq,dq:r.advancedSearchQueries?.dq||zr().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();var Tie=L("didYouMean/enable"),_ie=L("didYouMean/disable"),kie=L("didYouMean/automaticCorrections/disable"),Oie=L("didYouMean/automaticCorrections/enable"),il=L("didYouMean/correction",e=>B(e,Y)),Pie=L("didYouMean/automaticCorrections/mode",e=>B(e,new z({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var _f=()=>De("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var Yb=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function al(){return{contextValues:{}}}m();d();f();p();function sl(){return{contextValues:{}}}m();d();f();p();function Xb(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function Zb(){return[]}m();d();f();p();function xa(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function Jb(){return{}}m();d();f();p();function eA(){return{}}m();d();f();p();function tA(){return{}}function ir(e){return{context:e.context||al(),dictionaryFieldContext:e.dictionaryFieldContext||sl(),facetSet:e.facetSet||Qs(),numericFacetSet:e.numericFacetSet||$s(),dateFacetSet:e.dateFacetSet||Bs(),categoryFacetSet:e.categoryFacetSet||Gs(),automaticFacetSet:e.automaticFacetSet??Vs(),pagination:e.pagination||xa(),query:e.query||Et(),tabSet:e.tabSet||tA(),advancedSearchQueries:e.advancedSearchQueries||zr(),staticFilterSet:e.staticFilterSet||eA(),querySet:e.querySet||Jb(),sortCriteria:e.sortCriteria||zs(),pipeline:e.pipeline||_r(),searchHub:e.searchHub||bo(),facetOptions:e.facetOptions||Xb(),facetOrder:e.facetOrder??Zb(),debug:e.debug??bs()}}m();d();f();p();var ose=new ne({values:{undoneQuery:nt},options:{required:!0}}),rA=()=>De("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var cl=L("trigger/query/ignore",e=>B(e,new z({emptyAllowed:!0,required:!0}))),ul=L("trigger/query/modification",e=>B(e,new ne({values:{originalQuery:rt,modification:rt}})));m();d();f();p();var Kr=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=TP(e),n=dc(e),o=RP(e),i=yield Lr(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Dr({...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 Kr(_x97,_x98){return _ref51.apply(this,arguments)}}();function RP(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(IP).filter(r=>r.currentValues.length>0):void 0}function IP(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function TP(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=_P(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function _P(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 Yr=class{constructor(t,r=n=>{this.dispatch(ei({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=lc(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(Wr(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(Xt(ir(_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(Wr(i.response.error)),_this26.rejectWithValue(i.response.error)):(_this26.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this26.dispatch(Xt(ir(_this26.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:_f()})})()}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:_f()}}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(cl("")),null;_this27.analyticsAction&&(yield _this27.dispatch(_this27.analyticsAction));let i=_this27.getCurrentQuery(),a=yield _this27.automaticallyRetryQueryWithTriggerModification(n);return vt(a.response)?(_this27.dispatch(Wr(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(Xt(ir(_this27.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:rA()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??Et().enableQuerySyntax},search:{...zt(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Xt(ir(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Ba(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this28=this;return _asyncToGenerator(function*(){_this28.onUpdateQueryForCorrection(t);let r=yield _this28.fetchFromAPI(yield Kr(_this28.getState()),{origin:"mainSearch"});return _this28.dispatch(il(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this29=this;return _asyncToGenerator(function*(){return _this29.dispatch(ul({newQuery:t,originalQuery:_this29.getCurrentQuery()})),_this29.onUpdateQueryForCorrection(t),yield _this29.fetchFromAPI(yield Kr(_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 oce=ke("search/executeSearch",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield ll(r,t,e)});return function(_x101,_x102){return _ref52.apply(this,arguments)}}()),ice=ke("search/fetchPage",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Of(r,t,e)});return function(_x103,_x104){return _ref53.apply(this,arguments)}}()),ace=ke("search/fetchMoreResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Pf(t,r)});return function(_x105,_x106){return _ref54.apply(this,arguments)}}()),sce=ke("search/fetchFacetValues",/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t){let r=t.getState();return yield NP(t,e,r)});return function(_x107,_x108){return _ref55.apply(this,arguments)}}()),cce=ke("search/fetchInstantResults",/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){return kf(e,t)});return function(_x109,_x110){return _ref56.apply(this,arguments)}}()),kP=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=yield Kr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function kP(_x111,_x112){return _ref57.apply(this,arguments)}}(),OP=/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t,r){let n=yield Lr(e);return Dr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function OP(_x113,_x114,_x115){return _ref58.apply(this,arguments)}}(),PP=/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=yield Kr(e,t);return r.request.numberOfResults=0,r});return function PP(_x116,_x117){return _ref59.apply(this,arguments)}}(),nA=e=>{e.configuration.analytics.enabled&&ht.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function kf(_x118,_x119){return _kf.apply(this,arguments)}function _kf(){_kf=_asyncToGenerator(function*(e,t){B(e,{id:Y,q:Y,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new Yr({...t,analyticsAction:Wb()},c=>{t.dispatch(Zu({q:c,id:e.id}))}),a=yield OP(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 _kf.apply(this,arguments)}function Of(_x120,_x121,_x122){return _Of.apply(this,arguments)}function _Of(){_Of=_asyncToGenerator(function*(e,t,r){nA(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 Yr({...t,analyticsAction:r}),u=yield Kr(e,a),c=yield s.fetchFromAPI(u,{origin:"mainSearch"});return yield s.process(c)});return _Of.apply(this,arguments)}function Pf(_x123,_x124){return _Pf.apply(this,arguments)}function _Pf(){_Pf=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield Tf().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new Yr({...e,analyticsAction:Tf()}),s=yield kP(t,i),u=yield a.fetchFromAPI(s,{origin:"mainSearch"});return yield a.process(u)});return _Pf.apply(this,arguments)}function NP(_x125,_x126,_x127){return _NP.apply(this,arguments)}function _NP(){_NP=_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 Yr({...e,analyticsAction:t}),u=yield PP(r,a),c=yield s.fetchFromAPI(u,{origin:"facetValues"});return yield s.process(c)});return _NP.apply(this,arguments)}function ll(_x128,_x129,_x130){return _ll.apply(this,arguments)}function _ll(){_ll=_asyncToGenerator(function*(e,t,r){nA(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 Kr(e,a),u=new Yr({...t,analyticsAction:r}),c=yield u.fetchFromAPI(s,{origin:"mainSearch"});return yield u.process(c)});return _ll.apply(this,arguments)}m();d();f();p();var Xr=class{constructor(t,r=n=>{this.dispatch(ei({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=lc(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(Wr(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(Xt(ir(_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(Wr(i.response.error)),_this33.rejectWithValue(i.response.error)):(_this33.dispatch(Xt(ir(_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(cl("")),null;let i=_this34.getCurrentQuery(),a=yield _this34.automaticallyRetryQueryWithTriggerModification(n);return vt(a.response)?(_this34.dispatch(Wr(a.response.error)),_this34.rejectWithValue(a.response.error)):(_this34.dispatch(Xt(ir(_this34.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Xt(ir(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Ba(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this35=this;return _asyncToGenerator(function*(){_this35.onUpdateQueryForCorrection(t);let r=_this35.getState(),{actionCause:n}=Yb(),o=yield _this35.fetchFromAPI(yield qr(r,_this35.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this35.dispatch(il(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this36=this;return _asyncToGenerator(function*(){return _this36.dispatch(ul({newQuery:t,originalQuery:_this36.getCurrentQuery()})),_this36.onUpdateQueryForCorrection(t),yield _this36.fetchFromAPI(yield qr(_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 Wce=ke("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;B(e,{q:new z,enableQuerySyntax:new me,clearFilters:new me}),e.clearFilters&&(r(Yu()),r(Hb())),r(zb({allow:!0})),r(ei({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(Jo(1))}),Kce=L("search/updateSearchAction"),dl=ke("search/executeSearch",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return ll(r,t,e.legacy);iA(r);let n=e.next?aA(e.next):void 0,o=yield qr(r,t.extra.navigatorContext,n),i=new Xr({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x133,_x134){return _ref60.apply(this,arguments)}}()),oA=ke("search/fetchPage",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(iA(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Of(r,t,e.legacy);let n=new Xr({...t,analyticsAction:e.next}),o=yield qr(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)}}()),Yce=ke("search/fetchMoreResults",/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Pf(t,r);let n=Dh("browseResults",t.getState),o=new Xr({...t,analyticsAction:n}),i=yield FP(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)}}()),Xce=ke("search/fetchFacetValues",/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return ll(r,t,e.legacy);let n=new Xr({...t,analyticsAction:{}}),o=yield MP(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)}}()),Zce=ke("search/fetchInstantResults",/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return kf(e,t);B(e,{id:Y,q:Y,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:n,maxResultsPerQuery:o}=e,i=aA(Kb()),a=yield DP(r,t.extra.navigatorContext,n,o,i),s=new Xr({...t,analyticsAction:i},g=>{t.dispatch(Zu({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)}}()),FP=/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t,r){let n=yield qr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function FP(_x143,_x144,_x145){return _ref65.apply(this,arguments)}}(),DP=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(e,t,r,n,o){let i=ko(e,t,o);return Dr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function DP(_x146,_x147,_x148,_x149,_x150){return _ref66.apply(this,arguments)}}(),MP=/*#__PURE__*/function(){var _ref67=_asyncToGenerator(function*(e,t,r){let n=yield qr(e,t,r);return n.request.numberOfResults=0,n});return function MP(_x151,_x152,_x153){return _ref67.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)})},aA=e=>({actionCause:e.actionCause,type:e.actionCause});var sA=e=>{let t=xg({extra:e}),r=Qb();return t.startListening({actionCreator:dl.pending,effect:function(){var _ref68=_asyncToGenerator(function*(n,o){let i=o.getState();if(!Vd(i)||(r.abortRun(),o.dispatch(vc()),o.dispatch(Gb()),i.generatedAnswer.isEnabled===!1))return;let a=hn(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 cA=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)},uA=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var Nf=(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 lA(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=pm(Object.entries(t).filter(([a])=>!(a in r)).map(([a,s])=>[a,()=>s]));return o(Jn({...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 LP(e){if(!e||!qP(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 dA(e,t=60){if(!e)return!1;let r=LP(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function qP(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function fA(e,t){let r=0,n=null,o=Ma(()=>{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(Ir({accessToken:y})),y});return function i(_x156){return _ref69.apply(this,arguments)}}(),a=v=>{let R=VP(v.getState());return!!R&&dA(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."),pA(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)=>UP(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."),pA(v,h.error),h):h,g=(v,R,h)=>jP(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 jP(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function UP(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Xn().name}function pA(e,t){e.dispatch(ws({status:401,statusCode:401,message:t.message,type:t.name}))}function VP(e){return e.configuration.accessToken}m();d();f();p();function mA({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return ug({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(uA(n.logger))})}function GP(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&&ql()&&!u?(t.info("Analytics disabled since doNotTrack is active."),{...a,enabled:!1}):(s&&ql()&&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 gA(e,t){let r={...e.reducers,configuration:Vt,version:vv},n=BP({...e,reducers:r},t,Vt),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(Ir({accessToken:o,environment:i,organizationId:a}));let s=GP(e.configuration,n.logger);return s&&n.dispatch(so(s)),n}function BP(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=lA({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,s={...t,get relay(){return $i(c.state,o)},get navigatorContext(){return Nf(this.relay,o)}},u=$P(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(uo())},disableAnalytics(){u.dispatch(co())},get state(){return u.getState()},get relay(){return $i(this.state,o)},get navigatorContext(){return Nf(this.relay,o)},logger:a,store:u};return c}function $P(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=QP(e,t.logger,()=>t.navigatorContext);return mA({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function QP(e,t,r){let{renewAccessToken:n}=e.configuration,o=fA(t,n),i=sA({getNavigatorContext:r});return[_v,o,cA(t),bv].concat(Pp.middleware,i.middleware,e.middlewares||[])}m();d();f();p();var EA=jt(CA(),1);function RA(e){return(0,EA.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function IA(e,t){let r=uN(e),n=kt,o=lN(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function uN(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function lN(e){return e.preprocessRequest||ja}m();d();f();p();m();d();f();p();var TA={organizationId:Y,accessToken:Y,name:new z({required:!1,emptyAllowed:!1}),analytics:new ne({options:{required:!1},values:{enabled:new me({required:!1}),originContext:new z({required:!1}),originLevel2:new z({required:!1}),originLevel3:new z({required:!1}),analyticsMode:new z({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new z({required:!1,url:!0}),trackingId:new z({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new me({required:!1})}}),environment:new z({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function _A(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var kA=new yt({...TA,pipeline:new z({required:!1,emptyAllowed:!0}),searchHub:rt,locale:rt,timezone:rt});function jf(){return{..._A(),searchHub:"default"}}var dN={debug:As,pipeline:po,searchHub:Eo,recommendation:xo};function OA(e){let t=RA(e.loggerOptions);pN(e.configuration,t);let r=fN(e.configuration,t),n={...IA(e.configuration,t),apiClient:r},o={...e,reducers:dN},i=gA(o,n),{pipeline:a,searchHub:s,timezone:u,locale:c,proxyBaseUrl:g}=e.configuration;return i.dispatch(Yt({timezone:u,locale:c,proxyBaseUrl:g})),ce(a)||i.dispatch(lo(a)),ce(s)||i.dispatch(Co(s)),{...i,get state(){return i.state}}}function pN(e,t){try{kA.validate(e)}catch(r){throw t.error(r,"Recommendation engine configuration error"),r}}function fN(e,t){return new Ga({logger:t,preprocessRequest:e.preprocessRequest||ja,postprocessSearchResponseMiddleware:e.preprocessSearchResponseMiddleware||_m,postprocessFacetSearchResponseMiddleware:km,postprocessQuerySuggestResponseMiddleware:Om})}m();d();f();p();m();d();f();p();m();d();f();p();var mN=new Ae({each:Y,required:!0}),PA=(e,t)=>(B(e,Y),Fa(t)?B(t,Y):B(t,mN),{payload:{contextKey:e,contextValue:t}}),Bn=L("context/set",e=>{for(let[t,r]of Object.entries(e))PA(t,r);return{payload:e}}),$n=L("context/add",e=>PA(e.contextKey,e.contextValue)),Qn=L("context/remove",e=>B(e,Y));m();d();f();p();var ml=Be(al(),e=>{e.addCase(Bn,(t,r)=>{t.contextValues=r.payload}).addCase($n,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Qn,(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 Jr(e){let t,r=new Map,n=()=>r.size===0,o=i=>{try{let a=JSON.stringify(i),s=t!==a;return t=a,s}catch(a){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",a),!0}};return{subscribe(i){i();let a=Symbol(),s;return n()&&(t=JSON.stringify(this.state),s=e.subscribe(()=>{o(this.state)&&r.forEach(u=>u())})),r.set(a,i),()=>{r.delete(a),n()&&s?.()}},get state(){return{}}}}m();d();f();p();var gN=["caseId","caseNumber"],hN={caseId:"caseContext",caseNumber:"caseContext"},Ea=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${hN[t]} to set this value.}`)}};function Uf(e){return gN.includes(e)}var yN=new yt({values:new ne({options:{required:!1}})});function NA(e,t={}){if(!bN(e))throw Ht;let r=Jr(e),{dispatch:n}=e,o=()=>e.state,i=Rg(e,yN,t.initialState,"buildContext");return i.values&&n(Bn(i.values)),{...r,get state(){return{values:o().context.contextValues}},set(a){n(Bn(a))},...(o().configuration.analytics.analyticsMode==="legacy"?vN(n):SN(n))}}var vN=e=>({add(t,r){e($n({contextKey:t,contextValue:r}))},remove(t){e(Qn(t))}}),SN=e=>({add(t,r){if(Uf(t))throw new Ea(t);e($n({contextKey:t,contextValue:r}))},remove(t){if(Uf(t))throw new Ea(t);e(Qn(t))}});function bN(e){return e.addReducers({context:ml}),!0}function FA(e,t){return NA(e,t)}m();d();f();p();m();d();f();p();var ri=L("dictionaryFieldContext/set",e=>{let t=new ne({options:{required:!0}}),r=B(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new Ae({each:nt}),i=B(n,o).error;return i?{payload:e,error:i}:{payload:e}}),ni=L("dictionaryFieldContext/add",e=>{let t=new ne({options:{required:!0},values:{field:nt,key:nt}});return B(e,t)}),oi=L("dictionaryFieldContext/remove",e=>B(e,nt));m();d();f();p();var gl=Be(sl(),e=>{e.addCase(ri,(t,r)=>{t.contextValues=r.payload}).addCase(ni,(t,r)=>{let{field:n,key:o}=r.payload;t.contextValues[n]=o}).addCase(oi,(t,r)=>{delete t.contextValues[r.payload]}).addCase(St.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.dictionaryFieldContext.contextValues)})});function DA(e){if(!AN(e))throw Ht;let t=Jr(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return{values:n().dictionaryFieldContext.contextValues}},set(o){r(ri(o))},add(o,i){r(ni({field:o,key:i}))},remove(o){r(oi(o))}}}function AN(e){return e.addReducers({dictionaryFieldContext:gl}),!0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Ra={value:Y,numberOfResults:new oe({min:0}),state:Y};m();d();f();p();var Ne=Y;var EN=new oe({min:1,default:8,required:!1}),RN=new oe({min:1,max:20,default:5,required:!1}),IN={desiredCount:RN,numberOfValues:EN},ife=L("automaticFacet/setOptions",e=>B(e,IN)),afe=L("automaticFacet/deselectAll",e=>B(e,Ne)),TN=Y,MA=L("automaticFacet/toggleSelectValue",e=>B(e,{field:TN,selection:new ne({values:Ra})}));m();d();f();p();m();d();f();p();var _N={state:new qe({required:!0}),numberOfResults:new oe({required:!0,min:0}),value:new z({required:!0,emptyAllowed:!0}),path:new Ae({required:!0,each:Y}),moreValuesAvailable:new me({required:!1})};function Vf(e){e.children.forEach(t=>{Vf(t)}),kt({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},_N)}var ii={facetId:Ne,field:Y,tabs:new ne({options:{required:!1},values:{included:new Ae({each:new z}),excluded:new Ae({each:new z})}}),activeTab:new z({required:!1}),delimitingCharacter:new z({required:!1,emptyAllowed:!0}),filterFacetCount:new me({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new qe({required:!1}),basePath:new Ae({required:!1,each:Y}),filterByBasePath:new me({required:!1})};var Cfe=L("categoryFacet/register",e=>B(e,ii)),LA=L("categoryFacet/toggleSelectValue",e=>{try{return kt(e.facetId,Y),Vf(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),qA=L("categoryFacet/deselectAll",e=>B(e,ii.facetId)),Efe=L("categoryFacet/updateNumberOfValues",e=>B(e,{facetId:ii.facetId,numberOfValues:ii.numberOfValues})),Rfe=L("categoryFacet/updateSortCriterion",e=>B(e,{facetId:ii.facetId,criterion:new qe})),Ife=L("categoryFacet/updateBasePath",e=>B(e,{facetId:ii.facetId,basePath:new Ae({each:Y})}));m();d();f();p();m();d();f();p();var Ia={facetId:Ne,captions:new ne({options:{required:!1}}),numberOfValues:new oe({required:!1,min:1}),query:new z({required:!1,emptyAllowed:!0})};var kN={path:new Ae({required:!0,each:Y}),displayValue:nt,rawValue:nt,count:new oe({required:!0,min:0})},jA=L("categoryFacet/selectSearchResult",e=>B(e,{facetId:Ne,value:new ne({values:kN})})),Qfe=L("categoryFacetSearch/register",e=>B(e,Ia));m();d();f();p();var UA={facetId:Ne,value:new ne({values:{displayValue:nt,rawValue:nt,count:new oe({required:!0,min:0})}})},rme=L("facetSearch/register",e=>B(e,Ia)),nme=L("facetSearch/update",e=>B(e,Ia)),VA=L("facetSearch/toggleSelectValue",e=>B(e,UA)),GA=L("facetSearch/toggleExcludeValue",e=>B(e,UA));m();d();f();p();m();d();f();p();var lme=new z({regex:/^[a-zA-Z0-9-_]+$/}),dme=new z({required:!0}),pme=new Ae({each:new z}),fme=new z,mme=new me,gme=new me,hme=new oe({min:0}),ON=new oe({min:1}),yme=new me({required:!0}),PN=new ne,NN=new z,FN={captions:PN,numberOfValues:ON,query:NN},vme=new ne({values:FN}),BA=new ne({options:{required:!1},values:{type:new z({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new Ae({required:!0,max:25,each:new z({emptyAllowed:!1,required:!0})})}}),Sme=new me,$A=new Ae({min:1,max:25,required:!1,each:new z({emptyAllowed:!1,required:!0})});var DN={facetId:Ne,field:new z({required:!0,emptyAllowed:!0}),tabs:new ne({options:{required:!1},values:{included:new Ae({each:new z}),excluded:new Ae({each:new z})}}),activeTab:new z({required:!1}),filterFacetCount:new me({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new qe({required:!1}),resultsMustMatch:new qe({required:!1}),allowedValues:BA,customSort:$A},Ome=L("facet/register",e=>B(e,DN)),QA=L("facet/toggleSelectValue",e=>B(e,{facetId:Ne,selection:new ne({values:Ra})})),HA=L("facet/toggleExcludeValue",e=>B(e,{facetId:Ne,selection:new ne({values:Ra})})),hl=L("facet/deselectAll",e=>B(e,Ne)),Pme=L("facet/updateSortCriterion",e=>B(e,{facetId:Ne,criterion:new qe({required:!0})})),Nme=L("facet/updateNumberOfValues",e=>B(e,{facetId:Ne,numberOfValues:new oe({required:!0,min:1})})),Fme=L("facet/updateIsFieldExpanded",e=>B(e,{facetId:Ne,isFieldExpanded:new me({required:!0})})),Dme=L("facet/updateFreezeCurrentValues",e=>B(e,{facetId:Ne,freezeCurrentValues:new me({required:!0})}));m();d();f();p();m();d();f();p();function WA(e){let t=zA(e.start,e),r=zA(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function zA(e,t){let{dateFormat:r}=t;return Dy(e)?(bp(e),Py(e)):typeof e=="string"&&Fr(e)?(bp(e),e):(Ty(e,r),uc(_o(e,r)))}m();d();f();p();var KA=L("rangeFacet/updateSortCriterion",e=>B(e,{facetId:Ne,criterion:new qe({required:!0})}));m();d();f();p();var yl={state:Y,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new me({required:!0}),numberOfResults:new oe({required:!0,min:0})},vl={start:Y,end:Y,endInclusive:new me({required:!0}),state:Y,numberOfResults:new oe({required:!0,min:0})};var MN={start:Y,end:Y,endInclusive:new me({required:!0}),state:Y},LN={facetId:Ne,field:Y,tabs:new ne({options:{required:!1},values:{included:new Ae({each:new z}),excluded:new Ae({each:new z})}}),activeTab:new z({required:!1}),currentValues:new Ae({required:!1,each:new ne({values:MN})}),generateAutomaticRanges:new me({required:!0}),filterFacetCount:new me({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new qe({required:!1}),rangeAlgorithm:new qe({required:!1})};function YA(e){return Fr(e)?ea(e):e}function XA(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=WA(t);if(_o(YA(r)).isAfter(_o(YA(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var Age=L("dateFacet/register",e=>{try{return kt(e,LN),XA(e),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),ZA=L("dateFacet/toggleSelectValue",e=>B(e,{facetId:Ne,selection:new ne({values:vl})})),JA=L("dateFacet/toggleExcludeValue",e=>B(e,{facetId:Ne,selection:new ne({values:vl})})),ew=L("dateFacet/updateFacetValues",e=>{try{return kt(e,{facetId:Ne,values:new Ae({each:new ne({values:vl})})}),XA({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}});m();d();f();p();var qN={state:Y,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new me({required:!0})},jN={facetId:Ne,field:Y,tabs:new ne({options:{required:!1},values:{included:new Ae({each:new z}),excluded:new Ae({each:new z})}}),activeTab:new z({required:!1}),currentValues:new Ae({required:!1,each:new ne({values:qN})}),generateAutomaticRanges:new me({required:!0}),filterFacetCount:new me({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new qe({required:!1}),rangeAlgorithm:new qe({required:!1})};function tw(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 Fge=L("numericFacet/register",e=>{try{return B(e,jN),tw(e),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),rw=L("numericFacet/toggleSelectValue",e=>B(e,{facetId:Ne,selection:new ne({values:yl})})),nw=L("numericFacet/toggleExcludeValue",e=>B(e,{facetId:Ne,selection:new ne({values:yl})})),ow=L("numericFacet/updateFacetValues",e=>{try{return kt(e,{facetId:Ne,values:new Ae({each:new ne({values:yl})})}),tw({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}});var iw=Be(xa(),e=>{e.addCase(el,(t,r)=>{let n=Gf(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=Ta(n,o)}).addCase(tl,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(bc,t=>{t.firstResult=0}).addCase(rl,(t,r)=>{let n=r.payload;t.firstResult=Ta(n,t.numberOfResults)}).addCase(Jo,(t,r)=>{let n=r.payload;t.firstResult=Ta(n,t.numberOfResults)}).addCase(ol,t=>{let r=Gf(t),n=Math.max(r-1,1);t.firstResult=Ta(n,t.numberOfResults)}).addCase(nl,t=>{let r=Gf(t),n=VN(t),o=Math.min(r+1,n);t.firstResult=Ta(o,t.numberOfResults)}).addCase(St.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(Tr,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(dl.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(oA.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(hl,t=>{ft(t)}).addCase(JA,t=>{ft(t)}).addCase(HA,t=>{ft(t)}).addCase(nw,t=>{ft(t)}).addCase(GA,t=>{ft(t)}).addCase(QA,t=>{ft(t)}).addCase(qA,t=>{ft(t)}).addCase(LA,t=>{ft(t)}).addCase(jA,t=>{ft(t)}).addCase(ZA,t=>{ft(t)}).addCase(rw,t=>{ft(t)}).addCase(Yu,t=>{ft(t)}).addCase(ew,t=>{ft(t)}).addCase(ow,t=>{ft(t)}).addCase(VA,t=>{ft(t)}).addCase(MA,t=>{ft(t)})});function ft(e){e.firstResult=xa().firstResult}function Gf(e){let{firstResult:t,numberOfResults:r}=e;return GN(t,r)}function VN(e){let{totalCountFiltered:t,numberOfResults:r}=e;return BN(t,r)}function Ta(e,t){return(e-1)*t}function GN(e,t){return Math.round(e/t)+1}function BN(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function Bf(e){return e.addReducers({pagination:iw}),{nextPage:nl,previousPage:ol,registerNumberOfResults:el,registerPage:rl,updateNumberOfResults:tl,updatePage:Jo}}var $N=new yt({id:new z({emptyAllowed:!0,required:!1,default:""}),numberOfRecommendations:new oe({min:0})});function aw(e,t={}){if(!QN(e))throw Ht;let r=Jr(e),{dispatch:n}=e,o=()=>e.state,i=Ig(e,$N,t.options,"buildRecommendationList");return i.id!==""&&n(wo({id:i.id})),i.numberOfRecommendations&&n(Bf(e).updateNumberOfResults(i.numberOfRecommendations)),{...r,refresh(){n(Nr())},get state(){let a=o();return{recommendations:a.recommendation.recommendations,error:a.recommendation.error,isLoading:a.recommendation.isLoading,searchResponseId:a.recommendation.searchUid}}}}function QN(e){return e.addReducers({recommendation:xo,configuration:Vt}),!0}m();d();f();p();m();d();f();p();function sw(e,t,r){if(!HN(e))throw Ht;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:Ma(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function HN(e){return e.addReducers({configuration:Vt}),!0}function cw(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(Xs(t.options.result)))};return sw(e,t,()=>{n()})}m();d();f();p();m();d();f();p();m();d();f();p();var en=()=>new z({required:!1,emptyAllowed:!0}),Sl=L("advancedSearchQueries/update",e=>B(e,{aq:en(),cq:en(),lq:en(),dq:en()})),bl=L("advancedSearchQueries/register",e=>B(e,{aq:en(),cq:en(),lq:en(),dq:en()}));var uw=Be(zr(),e=>{e.addCase(Sl,(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(bl,(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(Tr,(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 zN(e){return e.addReducers({advancedSearchQueries:uw}),{updateAdvancedSearchQueries:Sl,registerAdvancedSearchQueries:bl}}m();d();f();p();function WN(e){return e.addReducers({configuration:Vt}),{disableAnalytics:co,enableAnalytics:uo,setOriginLevel2:hs,setOriginLevel3:ys,updateAnalyticsConfiguration:so,updateBasicConfiguration:Ir}}m();d();f();p();function KN(e){return e.addReducers({configuration:Vt,pipeline:po,searchHub:Eo}),{updateSearchConfiguration:Yt}}m();d();f();p();function YN(e){return e.addReducers({context:ml}),{addContext:$n,removeContext:Qn,setContext:Bn}}m();d();f();p();function XN(e){return e.addReducers({debug:As}),{disableDebug:Ss,enableDebug:vs}}m();d();f();p();function ZN(e){return e.addReducers({dictionaryFieldContext:gl}),{addContext:ni,removeContext:oi,setContext:ri}}m();d();f();p();m();d();f();p();m();d();f();p();var JN={collectionField:new z({emptyAllowed:!1,required:!1}),parentField:new z({emptyAllowed:!1,required:!1}),childField:new z({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new oe({min:0,required:!1})},lw=L("folding/register",e=>B(e,JN)),nve=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 Lr(i):ko(i,o),s=yield n.search({...a,q:eF(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 eF(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}m();d();f();p();var dw=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});m();d();f();p();var ai=L("fields/registerFieldsToInclude",e=>B(e,gs)),Al=L("fields/fetchall/enable"),wl=L("fields/fetchall/disable"),xl=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??xr(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 Cl=["author","language","urihash","objecttype","collection","source","permanentid"],$f=[...Cl,"date","filetype","parents"],pw=[...$f,"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"],fw=()=>({fieldsToInclude:Cl,fetchAllFields:!1,fieldsDescription:[]});var El=Be(fw(),e=>e.addCase(ai,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(Al,t=>{t.fetchAllFields=!0}).addCase(wl,t=>{t.fetchAllFields=!1}).addCase(xl.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(lw,(t,{payload:r})=>{let n=dw().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));function tF(e){return e.addReducers({fields:El}),{registerFieldsToInclude:ai,enableFetchAllFields:Al,disableFetchAllFields:wl,fetchFieldsDescription:xl}}m();d();f();p();function rF(e){return e.addReducers({pipeline:po}),{setPipeline:lo}}m();d();f();p();function nF(e){return e.addReducers({recommendation:xo}),{getRecommendations:Nr,setRecommendationId:wo}}m();d();f();p();function oF(e){return e.addReducers({}),{logRecommendationOpen:Xs}}m();d();f();p();m();d();f();p();var iF=new yt({content:new qe({required:!0}),conditions:new qe({required:!0}),priority:new oe({required:!1,default:0,min:0}),fields:new Ae({required:!1,each:Y})});function mw(){let e=[],t=r=>{let n=iF.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 gw(e){if(!aF(e))throw Ht;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=mw();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(ai(i))},selectTemplate:r,selectLinkTemplate:n}}function aF(e){return e.addReducers({fields:El}),!0}m();d();f();p();function sF(e){return e.addReducers({searchHub:Eo}),{setSearchHub:Co}}/**
|
|
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()},zO=e=>{let t=new or,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=vb(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()},WO=(e,t)=>{let r=Aa(t),n=new or,o=new Qc,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?zO(o).subscribe({next:u=>n.next(u),error:u=>n.error(u),complete:()=>n.complete()}):HO(o,r).subscribe({next:u=>{try{let c=_c.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"]),KO=S.enum(["LangGraphInterruptEvent","PredictState","Exit"]),YO=S.object({type:S.literal(Ue.enum.TextMessageStart),messageId:S.string(),parentMessageId:S.string().optional(),role:S.string().optional()}),XO=S.object({type:S.literal(Ue.enum.TextMessageContent),messageId:S.string(),content:S.string()}),ZO=S.object({type:S.literal(Ue.enum.TextMessageEnd),messageId:S.string()}),JO=S.object({type:S.literal(Ue.enum.ActionExecutionStart),actionExecutionId:S.string(),actionName:S.string(),parentMessageId:S.string().optional()}),eP=S.object({type:S.literal(Ue.enum.ActionExecutionArgs),actionExecutionId:S.string(),args:S.string()}),tP=S.object({type:S.literal(Ue.enum.ActionExecutionEnd),actionExecutionId:S.string()}),rP=S.object({type:S.literal(Ue.enum.ActionExecutionResult),actionName:S.string(),actionExecutionId:S.string(),result:S.string()}),nP=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()}),oP=S.object({type:S.literal(Ue.enum.MetaEvent),name:KO,value:S.any()}),iP=S.object({type:S.literal(Ue.enum.RunError),message:S.string(),code:S.string().optional()});S.discriminatedUnion("type",[YO,XO,ZO,JO,eP,tP,rP,nP,oP,iP]),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 aP=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
|
+
`)},sP=(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(_=>_.tool==b.function.name);if(I)try{let _=JSON.parse(lu(b.function.arguments));I.tool_argument&&I.tool_argument in _?(R({...o,[I.state_key]:_[I.tool_argument]}),x=!0):I.tool_argument||(R({...o,[I.state_key]:_}),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=Lc.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:cP(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 cP(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=aP(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 uP=e=>e.kind==="tool"?e.fields.toolCallId:e.fields.messageId,lP=e=>e==="tool"?"toolCallId":"messageId",Jo=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},Wu=e=>t=>{let r=Aa(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&&uP(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 ${lP(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 dP(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var wa=class{runNext(e,t){return t.run(e).pipe(Wu(!1))}runNextWithState(e,t){let r=Te(e.messages||[]),n=Te(e.state||{}),o=new Qc;return Pb(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(su(/*#__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)}}()))}},pP=class extends wa{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function fP(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 mP=class extends wa{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(fP)};return this.runNext(o,t)}},xb="THINKING_START",Cb="THINKING_END",Eb="THINKING_TEXT_MESSAGE_START",Rb="THINKING_TEXT_MESSAGE_CONTENT",Ib="THINKING_TEXT_MESSAGE_END",gP=class extends wa{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(Qr(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case xb:{this.currentReasoningId=ba();let{title:t,...r}=e;return this.warnAboutTransformation(xb,F.REASONING_START),{...r,type:F.REASONING_START,messageId:this.currentReasoningId}}case Eb:return this.currentMessageId=ba(),this.warnAboutTransformation(Eb,F.REASONING_MESSAGE_START),{...e,type:F.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case Rb:{let{delta:t,...r}=e;return this.warnAboutTransformation(Rb,F.REASONING_MESSAGE_CONTENT),{...r,type:F.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??ba(),delta:t}}case Ib:{let t=this.currentMessageId??ba();return this.warnAboutTransformation(Ib,F.REASONING_MESSAGE_END),{...e,type:F.REASONING_MESSAGE_END,messageId:t}}case Cb:{let t=this.currentReasoningId??ba();return this.warnAboutTransformation(Cb,F.REASONING_END),{...e,type:F.REASONING_END,messageId:t}}default:return e}}};function hP(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function yP(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function vP(e){let t=hP(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 SP(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>yP(n)?vP(n):n);return{...e,content:r}}var bP=class extends wa{run(e,t){let r={...e,messages:e.messages.map(SP)};return this.runNext(r,t)}},Tb="SUBAGENT_STARTED",_b="SUBAGENT_FINISHED",kb="SUBAGENT_ERROR";function Ku(e){if(e&&typeof e=="object"&&"subagentRunId"in e){let{subagentRunId:t,...r}=e;return r}return e}function Ob(e){return e.map(t=>Ku(t))}var AP=class extends wa{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=>Ku(n))};return this.runNext(r,t).pipe(uu(n=>{let o=n.type;(o===Tb||o===_b||o===kb)&&this.warnDroppedLifecycleEvent(o)}),af(n=>{let o=n.type;return o!==Tb&&o!==_b&&o!==kb}),Qr(n=>{let o=Ku(n);if(o.type===F.MESSAGES_SNAPSHOT){let i=o;if(Array.isArray(i.messages))return{...i,messages:Ob(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=>Ku(a))}}}if(o.type===F.RUN_STARTED){let i=o;if(i.input&&Array.isArray(i.input.messages))return{...i,input:{...i.input,messages:Ob(i.input.messages)}}}return o}))}},wP="0.0.59",xP=class{get maxVersion(){return wP}get debug(){return this._debug}set debug(e){this._debug=zu(e),this._debugLogger=Cf(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?Cf(zu(!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??Ur(),this.messages=Te(n??[]),this.state=Te(o??{}),this._debug=zu(i),this._debugLogger=Cf(this._debug),Zo(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new mP),Zo(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new gP),Zo(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new bP),Zo(this.maxVersion,"0.0.57")<=0&&this.middlewares.unshift(new AP)}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 pP(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??Ur();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 or;let a;_this14.activeRunCompletionPromise=new Promise(u=>{a=u}),yield iu($c(()=>_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),Wu(_this14.debugLogger),Ef(_this14.debugLogger),u=>u.pipe(cu(_this14.activeRunDetach$)),u=>_this14.apply(r,u,i),u=>_this14.processApplyEvents(r,u,i),ya(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??Ur();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 or;let a;_this15.activeRunCompletionPromise=new Promise(u=>{a=u}),yield iu($c(()=>au(()=>_this15.connect(r)),Wu(_this15.debugLogger),Ef(_this15.debugLogger),u=>u.pipe(cu(_this15.activeRunDetach$)),u=>_this15.apply(r,u,i),u=>_this15.processApplyEvents(r,u,i),ya(u=>(_this15.isRunning=!1,u instanceof Qp?Hc:_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 Pb(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(uu(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||Ur(),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 he(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let i of _this17.pendingInterrupts)if(dP(i))throw new he(`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(Qr(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??Ur();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(Wu(this.debugLogger),Ef(this.debugLogger),sP(this.threadId,t.runId,this.agentId),r=>r.pipe(Qr(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}};function CP(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 Nb=class extends xP{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(CP(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 WO(QO(()=>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 Fb=(e,t,r)=>{let n=_t(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 Nb{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}}},Db=(e,t,r)=>new Tf({url:`${Fb(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var EP=new z({required:!0}),Mb=new z({required:!0,constrainTo:fc}),Lb=e=>({...e,name:mc(e.name)}),qb=L("followUpAnswers/setIsEnabled",e=>B(e,new me({required:!0}))),jb=L("followUpAnswers/setFollowUpAnswersConversationId",e=>B(e,Y)),Ub=L("followUpAnswers/setFollowUpAnswersConversationToken",e=>B(e,Y)),Vb=L("followUpAnswers/clearFollowUpAnswersConversationToken"),vne=L("followUpAnswers/createFollowUpAnswer",e=>B(e,{question:Y})),Sne=L("followUpAnswers/setActiveFollowUpAnswerId",e=>B(e,Y)),bne=L("followUpAnswers/setFollowUpAnswerContentFormat",e=>B(e,{contentFormat:hc,answerId:Y})),Ane=L("followUpAnswers/setFollowUpIsLoading",e=>B(e,{isLoading:new me({required:!0}),answerId:Y})),wne=L("followUpAnswers/setFollowUpIsStreaming",e=>B(e,{isStreaming:new me({required:!0}),answerId:Y})),xne=L("followUpAnswers/followUpMessageChunkReceived",e=>B(e,{textDelta:EP,answerId:Y})),Cne=L("followUpAnswers/followUpCitationsReceived",e=>B(e,{citations:new Ae({required:!0,each:new ne({values:Op})}),answerId:Y})),Ene=L("followUpAnswers/followUpCompleted",e=>B(e,{answerId:Y,cannotAnswer:new me({required:!1})})),Rne=L("followUpAnswers/followUpFailed",e=>B(e,{message:new z,code:new oe({min:0}),answerId:Y})),Ine=L("followUpAnswers/activeFollowUpStartFailed",e=>B(e,{message:new z})),Tne=L("followUpAnswers/likeFollowUp",e=>B(e,{answerId:Y})),_ne=L("followUpAnswers/dislikeFollowUp",e=>B(e,{answerId:Y})),kne=L("followUpAnswers/submitFollowUpFeedback",e=>B(e,{answerId:Y})),Gb=L("followUpAnswers/resetFollowUpAnswers"),One=L("followUpAnswers/stepStarted",e=>B(Lb(e),{answerId:Y,name:Mb,startedAt:new oe({min:0,required:!0})})),Pne=L("followUpAnswers/stepFinished",e=>B(Lb(e),{answerId:Y,name:Mb,finishedAt:new oe({min:0,required:!0})})),Nne=L("followUpAnswers/startToolCall",e=>B(e,{answerId:Y,toolCallName:Y,startedAt:new oe({min:0,required:!0}),toolCallId:Y})),Fne=L("followUpAnswers/finishToolCall",e=>B(e,{answerId:Y,finishedAt:new oe({min:0,required:!0}),toolCallId:Y})),Dne=L("followUpAnswers/toolCallArgs",e=>B(e,{answerId:Y,toolCallId:Y,args:new ne({options:{required:!0}}),type:new z({required:!0,constrainTo:gc})}));m();d();f();p();var RP={"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 Bb(e){return e?RP[e]??1004:1004}var $b=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(yc(n.runId)),e(jr(!1)),e(ra(!0)),e(jb(n.threadId)),e(Vb())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(iv({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(av({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(sv({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(cv({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(Sc({toolCallId:i,args:s,type:"search"})):e(Sc({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(Sc({toolCallId:i,args:{raw:a},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(na({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(aa(a.contentFormat)),typeof a?.followUpEnabled=="boolean"&&e(qb(a.followUpEnabled)),a?.conversationToken&&e(Ub(a.conversationToken));return}case"citations":{e(oa({citations:a.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=Bb(n.code);e(ia({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(sa(!i)),e(ra(!1)),e(pp(i,t,a)),e(_o())}}};var Qb=()=>{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=Hs(n),s=fh(n),u=mh(n),c=ph(n),g=gh(n),v=Db(a,s,u);e=v;let R=$b(o),h=Zy(n,i());try{o(jr(!0)),yield v.runAgent({forwardedProps:{params:h,accessToken:c,recordDebugSession:g}},R)}catch(y){o(jr(!1)),o(ia({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 Yu=L("breadcrumb/deselectAll"),Hb=L("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var zb=L("facet/updateFacetAutoSelection",e=>B(e,{allow:new me({required:!0})}));m();d();f();p();m();d();f();p();var Xu=class extends Pr{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??zt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??zt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var Wb=()=>De("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Xu(e)),Kb=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var _f={id:Y},IP={..._f,q:nt},Qoe=L("instantResults/register",e=>B(e,_f)),Zu=L("instantResults/updateQuery",e=>B(e,IP)),Hoe=L("instantResults/clearExpired",e=>B(e,_f));m();d();f();p();var Ju=new oe({required:!0,min:0}),el=L("pagination/registerNumberOfResults",e=>B(e,Ju)),tl=L("pagination/updateNumberOfResults",e=>B(e,Ju)),rl=L("pagination/registerPage",e=>B(e,Ju)),ei=L("pagination/updatePage",e=>B(e,Ju)),nl=L("pagination/nextPage"),ol=L("pagination/previousPage");m();d();f();p();var ti=L("query/updateQuery",e=>B(e,{q:new z,enableQuerySyntax:new me}));m();d();f();p();m();d();f();p();m();d();f();p();var zr=()=>({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()),Wr=e=>De("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||Et().q,aq:r.advancedSearchQueries?.aq||zr().aq,cq:r.advancedSearchQueries?.cq||zr().cq,dq:r.advancedSearchQueries?.dq||zr().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();var kie=L("didYouMean/enable"),Oie=L("didYouMean/disable"),Pie=L("didYouMean/automaticCorrections/disable"),Nie=L("didYouMean/automaticCorrections/enable"),il=L("didYouMean/correction",e=>B(e,Y)),Fie=L("didYouMean/automaticCorrections/mode",e=>B(e,new z({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var Of=()=>De("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var Yb=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function al(){return{contextValues:{}}}m();d();f();p();function sl(){return{contextValues:{}}}m();d();f();p();function Xb(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function Zb(){return[]}m();d();f();p();function xa(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function Jb(){return{}}m();d();f();p();function eA(){return{}}m();d();f();p();function tA(){return{}}function ir(e){return{context:e.context||al(),dictionaryFieldContext:e.dictionaryFieldContext||sl(),facetSet:e.facetSet||Qs(),numericFacetSet:e.numericFacetSet||$s(),dateFacetSet:e.dateFacetSet||Bs(),categoryFacetSet:e.categoryFacetSet||Gs(),automaticFacetSet:e.automaticFacetSet??Vs(),pagination:e.pagination||xa(),query:e.query||Et(),tabSet:e.tabSet||tA(),advancedSearchQueries:e.advancedSearchQueries||zr(),staticFilterSet:e.staticFilterSet||eA(),querySet:e.querySet||Jb(),sortCriteria:e.sortCriteria||zs(),pipeline:e.pipeline||_r(),searchHub:e.searchHub||Ao(),facetOptions:e.facetOptions||Xb(),facetOrder:e.facetOrder??Zb(),debug:e.debug??bs()}}m();d();f();p();var ase=new ne({values:{undoneQuery:nt},options:{required:!0}}),rA=()=>De("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var cl=L("trigger/query/ignore",e=>B(e,new z({emptyAllowed:!0,required:!0}))),ul=L("trigger/query/modification",e=>B(e,new ne({values:{originalQuery:rt,modification:rt}})));m();d();f();p();var Kr=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=kP(e),n=dc(e),o=TP(e),i=yield Lr(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Dr({...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 Kr(_x97,_x98){return _ref51.apply(this,arguments)}}();function TP(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(_P).filter(r=>r.currentValues.length>0):void 0}function _P(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function kP(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=OP(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function OP(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 Yr=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=lc(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(Wr(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(Xt(ir(_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(Wr(i.response.error)),_this26.rejectWithValue(i.response.error)):(_this26.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this26.dispatch(Xt(ir(_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(cl("")),null;_this27.analyticsAction&&(yield _this27.dispatch(_this27.analyticsAction));let i=_this27.getCurrentQuery(),a=yield _this27.automaticallyRetryQueryWithTriggerModification(n);return vt(a.response)?(_this27.dispatch(Wr(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(Xt(ir(_this27.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:rA()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??Et().enableQuerySyntax},search:{...zt(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Xt(ir(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Ba(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this28=this;return _asyncToGenerator(function*(){_this28.onUpdateQueryForCorrection(t);let r=yield _this28.fetchFromAPI(yield Kr(_this28.getState()),{origin:"mainSearch"});return _this28.dispatch(il(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this29=this;return _asyncToGenerator(function*(){return _this29.dispatch(ul({newQuery:t,originalQuery:_this29.getCurrentQuery()})),_this29.onUpdateQueryForCorrection(t),yield _this29.fetchFromAPI(yield Kr(_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 ace=ke("search/executeSearch",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield ll(r,t,e)});return function(_x101,_x102){return _ref52.apply(this,arguments)}}()),sce=ke("search/fetchPage",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Nf(r,t,e)});return function(_x103,_x104){return _ref53.apply(this,arguments)}}()),cce=ke("search/fetchMoreResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ff(t,r)});return function(_x105,_x106){return _ref54.apply(this,arguments)}}()),uce=ke("search/fetchFacetValues",/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t){let r=t.getState();return yield DP(t,e,r)});return function(_x107,_x108){return _ref55.apply(this,arguments)}}()),lce=ke("search/fetchInstantResults",/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){return Pf(e,t)});return function(_x109,_x110){return _ref56.apply(this,arguments)}}()),PP=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=yield Kr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function PP(_x111,_x112){return _ref57.apply(this,arguments)}}(),NP=/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t,r){let n=yield Lr(e);return Dr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function NP(_x113,_x114,_x115){return _ref58.apply(this,arguments)}}(),FP=/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=yield Kr(e,t);return r.request.numberOfResults=0,r});return function FP(_x116,_x117){return _ref59.apply(this,arguments)}}(),nA=e=>{e.configuration.analytics.enabled&&ht.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Pf(_x118,_x119){return _Pf.apply(this,arguments)}function _Pf(){_Pf=_asyncToGenerator(function*(e,t){B(e,{id:Y,q:Y,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new Yr({...t,analyticsAction:Wb()},c=>{t.dispatch(Zu({q:c,id:e.id}))}),a=yield NP(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(_x120,_x121,_x122){return _Nf.apply(this,arguments)}function _Nf(){_Nf=_asyncToGenerator(function*(e,t,r){nA(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 Yr({...t,analyticsAction:r}),u=yield Kr(e,a),c=yield s.fetchFromAPI(u,{origin:"mainSearch"});return yield s.process(c)});return _Nf.apply(this,arguments)}function Ff(_x123,_x124){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 Yr({...e,analyticsAction:kf()}),s=yield PP(t,i),u=yield a.fetchFromAPI(s,{origin:"mainSearch"});return yield a.process(u)});return _Ff.apply(this,arguments)}function DP(_x125,_x126,_x127){return _DP.apply(this,arguments)}function _DP(){_DP=_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 Yr({...e,analyticsAction:t}),u=yield FP(r,a),c=yield s.fetchFromAPI(u,{origin:"facetValues"});return yield s.process(c)});return _DP.apply(this,arguments)}function ll(_x128,_x129,_x130){return _ll.apply(this,arguments)}function _ll(){_ll=_asyncToGenerator(function*(e,t,r){nA(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 Kr(e,a),u=new Yr({...t,analyticsAction:r}),c=yield u.fetchFromAPI(s,{origin:"mainSearch"});return yield u.process(c)});return _ll.apply(this,arguments)}m();d();f();p();var Xr=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=lc(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(Wr(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(Xt(ir(_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(Wr(i.response.error)),_this33.rejectWithValue(i.response.error)):(_this33.dispatch(Xt(ir(_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(cl("")),null;let i=_this34.getCurrentQuery(),a=yield _this34.automaticallyRetryQueryWithTriggerModification(n);return vt(a.response)?(_this34.dispatch(Wr(a.response.error)),_this34.rejectWithValue(a.response.error)):(_this34.dispatch(Xt(ir(_this34.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Xt(ir(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Ba(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this35=this;return _asyncToGenerator(function*(){_this35.onUpdateQueryForCorrection(t);let r=_this35.getState(),{actionCause:n}=Yb(),o=yield _this35.fetchFromAPI(yield qr(r,_this35.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this35.dispatch(il(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this36=this;return _asyncToGenerator(function*(){return _this36.dispatch(ul({newQuery:t,originalQuery:_this36.getCurrentQuery()})),_this36.onUpdateQueryForCorrection(t),yield _this36.fetchFromAPI(yield qr(_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 Yce=ke("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;B(e,{q:new z,enableQuerySyntax:new me,clearFilters:new me}),e.clearFilters&&(r(Yu()),r(Hb())),r(zb({allow:!0})),r(ti({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(ei(1))}),Xce=L("search/updateSearchAction"),dl=ke("search/executeSearch",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return ll(r,t,e.legacy);iA(r);let n=e.next?aA(e.next):void 0,o=yield qr(r,t.extra.navigatorContext,n),i=new Xr({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x133,_x134){return _ref60.apply(this,arguments)}}()),oA=ke("search/fetchPage",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(iA(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Nf(r,t,e.legacy);let n=new Xr({...t,analyticsAction:e.next}),o=yield qr(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 Ff(t,r);let n=Dh("browseResults",t.getState),o=new Xr({...t,analyticsAction:n}),i=yield MP(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)}}()),Jce=ke("search/fetchFacetValues",/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return ll(r,t,e.legacy);let n=new Xr({...t,analyticsAction:{}}),o=yield qP(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)}}()),eue=ke("search/fetchInstantResults",/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Pf(e,t);B(e,{id:Y,q:Y,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:n,maxResultsPerQuery:o}=e,i=aA(Kb()),a=yield LP(r,t.extra.navigatorContext,n,o,i),s=new Xr({...t,analyticsAction:i},g=>{t.dispatch(Zu({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)}}()),MP=/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t,r){let n=yield qr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function MP(_x143,_x144,_x145){return _ref65.apply(this,arguments)}}(),LP=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(e,t,r,n,o){let i=Oo(e,t,o);return Dr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function LP(_x146,_x147,_x148,_x149,_x150){return _ref66.apply(this,arguments)}}(),qP=/*#__PURE__*/function(){var _ref67=_asyncToGenerator(function*(e,t,r){let n=yield qr(e,t,r);return n.request.numberOfResults=0,n});return function qP(_x151,_x152,_x153){return _ref67.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)})},aA=e=>({actionCause:e.actionCause,type:e.actionCause});var sA=e=>{let t=Eg({extra:e}),r=Qb();return t.startListening({actionCreator:dl.pending,effect:function(){var _ref68=_asyncToGenerator(function*(n,o){let i=o.getState();if(!Bd(i)||(r.abortRun(),o.dispatch(vc()),o.dispatch(Gb()),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 cA=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)},uA=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 lA(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=mm(Object.entries(t).filter(([a])=>!(a in r)).map(([a,s])=>[a,()=>s]));return o(eo({...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 jP(e){if(!e||!UP(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 dA(e,t=60){if(!e)return!1;let r=jP(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function UP(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function fA(e,t){let r=0,n=null,o=Ma(()=>{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(Ir({accessToken:y})),y});return function i(_x156){return _ref69.apply(this,arguments)}}(),a=v=>{let R=BP(v.getState());return!!R&&dA(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."),pA(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)=>GP(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."),pA(v,h.error),h):h,g=(v,R,h)=>VP(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 VP(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function GP(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Zn().name}function pA(e,t){e.dispatch(ws({status:401,statusCode:401,message:t.message,type:t.name}))}function BP(e){return e.configuration.accessToken}m();d();f();p();function mA({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return dg({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(uA(n.logger))})}function $P(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&&ql()&&!u?(t.info("Analytics disabled since doNotTrack is active."),{...a,enabled:!1}):(s&&ql()&&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 gA(e,t){let r={...e.reducers,configuration:Vt,version:vv},n=QP({...e,reducers:r},t,Vt),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(Ir({accessToken:o,environment:i,organizationId:a}));let s=$P(e.configuration,n.logger);return s&&n.dispatch(co(s)),n}function QP(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=lA({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,s={...t,get relay(){return $i(c.state,o)},get navigatorContext(){return Df(this.relay,o)}},u=HP(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 $i(this.state,o)},get navigatorContext(){return Df(this.relay,o)},logger:a,store:u};return c}function HP(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=zP(e,t.logger,()=>t.navigatorContext);return mA({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function zP(e,t,r){let{renewAccessToken:n}=e.configuration,o=fA(t,n),i=sA({getNavigatorContext:r});return[_v,o,cA(t),bv].concat(Fp.middleware,i.middleware,e.middlewares||[])}m();d();f();p();var EA=jt(CA(),1);function RA(e){return(0,EA.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function IA(e,t){let r=dN(e),n=kt,o=pN(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function dN(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function pN(e){return e.preprocessRequest||ja}m();d();f();p();m();d();f();p();var TA={organizationId:Y,accessToken:Y,name:new z({required:!1,emptyAllowed:!1}),analytics:new ne({options:{required:!1},values:{enabled:new me({required:!1}),originContext:new z({required:!1}),originLevel2:new z({required:!1}),originLevel3:new z({required:!1}),analyticsMode:new z({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new z({required:!1,url:!0}),trackingId:new z({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new me({required:!1})}}),environment:new z({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function _A(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var kA=new yt({...TA,pipeline:new z({required:!1,emptyAllowed:!0}),searchHub:rt,locale:rt,timezone:rt});function Vf(){return{..._A(),searchHub:"default"}}var fN={debug:As,pipeline:fo,searchHub:Ro,recommendation:Co};function OA(e){let t=RA(e.loggerOptions);mN(e.configuration,t);let r=gN(e.configuration,t),n={...IA(e.configuration,t),apiClient:r},o={...e,reducers:fN},i=gA(o,n),{pipeline:a,searchHub:s,timezone:u,locale:c,proxyBaseUrl:g}=e.configuration;return i.dispatch(Yt({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 mN(e,t){try{kA.validate(e)}catch(r){throw t.error(r,"Recommendation engine configuration error"),r}}function gN(e,t){return new Ga({logger:t,preprocessRequest:e.preprocessRequest||ja,postprocessSearchResponseMiddleware:e.preprocessSearchResponseMiddleware||Om,postprocessFacetSearchResponseMiddleware:Pm,postprocessQuerySuggestResponseMiddleware:Nm})}m();d();f();p();m();d();f();p();m();d();f();p();var hN=new Ae({each:Y,required:!0}),PA=(e,t)=>(B(e,Y),Fa(t)?B(t,Y):B(t,hN),{payload:{contextKey:e,contextValue:t}}),$n=L("context/set",e=>{for(let[t,r]of Object.entries(e))PA(t,r);return{payload:e}}),Qn=L("context/add",e=>PA(e.contextKey,e.contextValue)),Hn=L("context/remove",e=>B(e,Y));m();d();f();p();var ml=Be(al(),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 Jr(e){let t,r=new Map,n=()=>r.size===0,o=i=>{try{let a=JSON.stringify(i),s=t!==a;return t=a,s}catch(a){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",a),!0}};return{subscribe(i){i();let a=Symbol(),s;return n()&&(t=JSON.stringify(this.state),s=e.subscribe(()=>{o(this.state)&&r.forEach(u=>u())})),r.set(a,i),()=>{r.delete(a),n()&&s?.()}},get state(){return{}}}}m();d();f();p();var yN=["caseId","caseNumber"],vN={caseId:"caseContext",caseNumber:"caseContext"},Ea=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${vN[t]} to set this value.}`)}};function Gf(e){return yN.includes(e)}var SN=new yt({values:new ne({options:{required:!1}})});function NA(e,t={}){if(!wN(e))throw Ht;let r=Jr(e),{dispatch:n}=e,o=()=>e.state,i=Tg(e,SN,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"?bN(n):AN(n))}}var bN=e=>({add(t,r){e(Qn({contextKey:t,contextValue:r}))},remove(t){e(Hn(t))}}),AN=e=>({add(t,r){if(Gf(t))throw new Ea(t);e(Qn({contextKey:t,contextValue:r}))},remove(t){if(Gf(t))throw new Ea(t);e(Hn(t))}});function wN(e){return e.addReducers({context:ml}),!0}function FA(e,t){return NA(e,t)}m();d();f();p();m();d();f();p();var ni=L("dictionaryFieldContext/set",e=>{let t=new ne({options:{required:!0}}),r=B(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new Ae({each:nt}),i=B(n,o).error;return i?{payload:e,error:i}:{payload:e}}),oi=L("dictionaryFieldContext/add",e=>{let t=new ne({options:{required:!0},values:{field:nt,key:nt}});return B(e,t)}),ii=L("dictionaryFieldContext/remove",e=>B(e,nt));m();d();f();p();var gl=Be(sl(),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 DA(e){if(!xN(e))throw Ht;let t=Jr(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 xN(e){return e.addReducers({dictionaryFieldContext:gl}),!0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Ra={value:Y,numberOfResults:new oe({min:0}),state:Y};m();d();f();p();var Ne=Y;var IN=new oe({min:1,default:8,required:!1}),TN=new oe({min:1,max:20,default:5,required:!1}),_N={desiredCount:TN,numberOfValues:IN},sfe=L("automaticFacet/setOptions",e=>B(e,_N)),cfe=L("automaticFacet/deselectAll",e=>B(e,Ne)),kN=Y,MA=L("automaticFacet/toggleSelectValue",e=>B(e,{field:kN,selection:new ne({values:Ra})}));m();d();f();p();m();d();f();p();var ON={state:new qe({required:!0}),numberOfResults:new oe({required:!0,min:0}),value:new z({required:!0,emptyAllowed:!0}),path:new Ae({required:!0,each:Y}),moreValuesAvailable:new me({required:!1})};function Bf(e){e.children.forEach(t=>{Bf(t)}),kt({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},ON)}var ai={facetId:Ne,field:Y,tabs:new ne({options:{required:!1},values:{included:new Ae({each:new z}),excluded:new Ae({each:new z})}}),activeTab:new z({required:!1}),delimitingCharacter:new z({required:!1,emptyAllowed:!0}),filterFacetCount:new me({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new qe({required:!1}),basePath:new Ae({required:!1,each:Y}),filterByBasePath:new me({required:!1})};var Rfe=L("categoryFacet/register",e=>B(e,ai)),LA=L("categoryFacet/toggleSelectValue",e=>{try{return kt(e.facetId,Y),Bf(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),qA=L("categoryFacet/deselectAll",e=>B(e,ai.facetId)),Ife=L("categoryFacet/updateNumberOfValues",e=>B(e,{facetId:ai.facetId,numberOfValues:ai.numberOfValues})),Tfe=L("categoryFacet/updateSortCriterion",e=>B(e,{facetId:ai.facetId,criterion:new qe})),_fe=L("categoryFacet/updateBasePath",e=>B(e,{facetId:ai.facetId,basePath:new Ae({each:Y})}));m();d();f();p();m();d();f();p();var Ia={facetId:Ne,captions:new ne({options:{required:!1}}),numberOfValues:new oe({required:!1,min:1}),query:new z({required:!1,emptyAllowed:!0})};var PN={path:new Ae({required:!0,each:Y}),displayValue:nt,rawValue:nt,count:new oe({required:!0,min:0})},jA=L("categoryFacet/selectSearchResult",e=>B(e,{facetId:Ne,value:new ne({values:PN})})),zfe=L("categoryFacetSearch/register",e=>B(e,Ia));m();d();f();p();var UA={facetId:Ne,value:new ne({values:{displayValue:nt,rawValue:nt,count:new oe({required:!0,min:0})}})},ome=L("facetSearch/register",e=>B(e,Ia)),ime=L("facetSearch/update",e=>B(e,Ia)),VA=L("facetSearch/toggleSelectValue",e=>B(e,UA)),GA=L("facetSearch/toggleExcludeValue",e=>B(e,UA));m();d();f();p();m();d();f();p();var pme=new z({regex:/^[a-zA-Z0-9-_]+$/}),fme=new z({required:!0}),mme=new Ae({each:new z}),gme=new z,hme=new me,yme=new me,vme=new oe({min:0}),NN=new oe({min:1}),Sme=new me({required:!0}),FN=new ne,DN=new z,MN={captions:FN,numberOfValues:NN,query:DN},bme=new ne({values:MN}),BA=new ne({options:{required:!1},values:{type:new z({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new Ae({required:!0,max:25,each:new z({emptyAllowed:!1,required:!0})})}}),Ame=new me,$A=new Ae({min:1,max:25,required:!1,each:new z({emptyAllowed:!1,required:!0})});var LN={facetId:Ne,field:new z({required:!0,emptyAllowed:!0}),tabs:new ne({options:{required:!1},values:{included:new Ae({each:new z}),excluded:new Ae({each:new z})}}),activeTab:new z({required:!1}),filterFacetCount:new me({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new qe({required:!1}),resultsMustMatch:new qe({required:!1}),allowedValues:BA,customSort:$A},Nme=L("facet/register",e=>B(e,LN)),QA=L("facet/toggleSelectValue",e=>B(e,{facetId:Ne,selection:new ne({values:Ra})})),HA=L("facet/toggleExcludeValue",e=>B(e,{facetId:Ne,selection:new ne({values:Ra})})),hl=L("facet/deselectAll",e=>B(e,Ne)),Fme=L("facet/updateSortCriterion",e=>B(e,{facetId:Ne,criterion:new qe({required:!0})})),Dme=L("facet/updateNumberOfValues",e=>B(e,{facetId:Ne,numberOfValues:new oe({required:!0,min:1})})),Mme=L("facet/updateIsFieldExpanded",e=>B(e,{facetId:Ne,isFieldExpanded:new me({required:!0})})),Lme=L("facet/updateFreezeCurrentValues",e=>B(e,{facetId:Ne,freezeCurrentValues:new me({required:!0})}));m();d();f();p();m();d();f();p();function WA(e){let t=zA(e.start,e),r=zA(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function zA(e,t){let{dateFormat:r}=t;return Dy(e)?(wp(e),Py(e)):typeof e=="string"&&Fr(e)?(wp(e),e):(Ty(e,r),uc(ko(e,r)))}m();d();f();p();var KA=L("rangeFacet/updateSortCriterion",e=>B(e,{facetId:Ne,criterion:new qe({required:!0})}));m();d();f();p();var yl={state:Y,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new me({required:!0}),numberOfResults:new oe({required:!0,min:0})},vl={start:Y,end:Y,endInclusive:new me({required:!0}),state:Y,numberOfResults:new oe({required:!0,min:0})};var qN={start:Y,end:Y,endInclusive:new me({required:!0}),state:Y},jN={facetId:Ne,field:Y,tabs:new ne({options:{required:!1},values:{included:new Ae({each:new z}),excluded:new Ae({each:new z})}}),activeTab:new z({required:!1}),currentValues:new Ae({required:!1,each:new ne({values:qN})}),generateAutomaticRanges:new me({required:!0}),filterFacetCount:new me({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new qe({required:!1}),rangeAlgorithm:new qe({required:!1})};function YA(e){return Fr(e)?ea(e):e}function XA(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=WA(t);if(ko(YA(r)).isAfter(ko(YA(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var xge=L("dateFacet/register",e=>{try{return kt(e,jN),XA(e),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),ZA=L("dateFacet/toggleSelectValue",e=>B(e,{facetId:Ne,selection:new ne({values:vl})})),JA=L("dateFacet/toggleExcludeValue",e=>B(e,{facetId:Ne,selection:new ne({values:vl})})),ew=L("dateFacet/updateFacetValues",e=>{try{return kt(e,{facetId:Ne,values:new Ae({each:new ne({values:vl})})}),XA({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}});m();d();f();p();var UN={state:Y,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new me({required:!0})},VN={facetId:Ne,field:Y,tabs:new ne({options:{required:!1},values:{included:new Ae({each:new z}),excluded:new Ae({each:new z})}}),activeTab:new z({required:!1}),currentValues:new Ae({required:!1,each:new ne({values:UN})}),generateAutomaticRanges:new me({required:!0}),filterFacetCount:new me({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new qe({required:!1}),rangeAlgorithm:new qe({required:!1})};function tw(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 Mge=L("numericFacet/register",e=>{try{return B(e,VN),tw(e),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),rw=L("numericFacet/toggleSelectValue",e=>B(e,{facetId:Ne,selection:new ne({values:yl})})),nw=L("numericFacet/toggleExcludeValue",e=>B(e,{facetId:Ne,selection:new ne({values:yl})})),ow=L("numericFacet/updateFacetValues",e=>{try{return kt(e,{facetId:Ne,values:new Ae({each:new ne({values:yl})})}),tw({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}});var iw=Be(xa(),e=>{e.addCase(el,(t,r)=>{let n=$f(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=Ta(n,o)}).addCase(tl,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(bc,t=>{t.firstResult=0}).addCase(rl,(t,r)=>{let n=r.payload;t.firstResult=Ta(n,t.numberOfResults)}).addCase(ei,(t,r)=>{let n=r.payload;t.firstResult=Ta(n,t.numberOfResults)}).addCase(ol,t=>{let r=$f(t),n=Math.max(r-1,1);t.firstResult=Ta(n,t.numberOfResults)}).addCase(nl,t=>{let r=$f(t),n=BN(t),o=Math.min(r+1,n);t.firstResult=Ta(o,t.numberOfResults)}).addCase(St.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(Tr,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(dl.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(oA.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(hl,t=>{ft(t)}).addCase(JA,t=>{ft(t)}).addCase(HA,t=>{ft(t)}).addCase(nw,t=>{ft(t)}).addCase(GA,t=>{ft(t)}).addCase(QA,t=>{ft(t)}).addCase(qA,t=>{ft(t)}).addCase(LA,t=>{ft(t)}).addCase(jA,t=>{ft(t)}).addCase(ZA,t=>{ft(t)}).addCase(rw,t=>{ft(t)}).addCase(Yu,t=>{ft(t)}).addCase(ew,t=>{ft(t)}).addCase(ow,t=>{ft(t)}).addCase(VA,t=>{ft(t)}).addCase(MA,t=>{ft(t)})});function ft(e){e.firstResult=xa().firstResult}function $f(e){let{firstResult:t,numberOfResults:r}=e;return $N(t,r)}function BN(e){let{totalCountFiltered:t,numberOfResults:r}=e;return QN(t,r)}function Ta(e,t){return(e-1)*t}function $N(e,t){return Math.round(e/t)+1}function QN(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function Qf(e){return e.addReducers({pagination:iw}),{nextPage:nl,previousPage:ol,registerNumberOfResults:el,registerPage:rl,updateNumberOfResults:tl,updatePage:ei}}var HN=new yt({id:new z({emptyAllowed:!0,required:!1,default:""}),numberOfRecommendations:new oe({min:0})});function aw(e,t={}){if(!zN(e))throw Ht;let r=Jr(e),{dispatch:n}=e,o=()=>e.state,i=_g(e,HN,t.options,"buildRecommendationList");return i.id!==""&&n(xo({id:i.id})),i.numberOfRecommendations&&n(Qf(e).updateNumberOfResults(i.numberOfRecommendations)),{...r,refresh(){n(Nr())},get state(){let a=o();return{recommendations:a.recommendation.recommendations,error:a.recommendation.error,isLoading:a.recommendation.isLoading,searchResponseId:a.recommendation.searchUid}}}}function zN(e){return e.addReducers({recommendation:Co,configuration:Vt}),!0}m();d();f();p();m();d();f();p();function sw(e,t,r){if(!WN(e))throw Ht;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:Ma(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function WN(e){return e.addReducers({configuration:Vt}),!0}function cw(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(Xs(t.options.result)))};return sw(e,t,()=>{n()})}m();d();f();p();m();d();f();p();m();d();f();p();var en=()=>new z({required:!1,emptyAllowed:!0}),Sl=L("advancedSearchQueries/update",e=>B(e,{aq:en(),cq:en(),lq:en(),dq:en()})),bl=L("advancedSearchQueries/register",e=>B(e,{aq:en(),cq:en(),lq:en(),dq:en()}));var uw=Be(zr(),e=>{e.addCase(Sl,(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(bl,(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(Tr,(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 KN(e){return e.addReducers({advancedSearchQueries:uw}),{updateAdvancedSearchQueries:Sl,registerAdvancedSearchQueries:bl}}m();d();f();p();function YN(e){return e.addReducers({configuration:Vt}),{disableAnalytics:uo,enableAnalytics:lo,setOriginLevel2:hs,setOriginLevel3:ys,updateAnalyticsConfiguration:co,updateBasicConfiguration:Ir}}m();d();f();p();function XN(e){return e.addReducers({configuration:Vt,pipeline:fo,searchHub:Ro}),{updateSearchConfiguration:Yt}}m();d();f();p();function ZN(e){return e.addReducers({context:ml}),{addContext:Qn,removeContext:Hn,setContext:$n}}m();d();f();p();function JN(e){return e.addReducers({debug:As}),{disableDebug:Ss,enableDebug:vs}}m();d();f();p();function eF(e){return e.addReducers({dictionaryFieldContext:gl}),{addContext:oi,removeContext:ii,setContext:ni}}m();d();f();p();m();d();f();p();m();d();f();p();var tF={collectionField:new z({emptyAllowed:!1,required:!1}),parentField:new z({emptyAllowed:!1,required:!1}),childField:new z({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new oe({min:0,required:!1})},lw=L("folding/register",e=>B(e,tF)),ive=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 Lr(i):Oo(i,o),s=yield n.search({...a,q:rF(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 rF(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}m();d();f();p();var dw=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});m();d();f();p();var si=L("fields/registerFieldsToInclude",e=>B(e,gs)),Al=L("fields/fetchall/enable"),wl=L("fields/fetchall/disable"),xl=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??xr(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 Cl=["author","language","urihash","objecttype","collection","source","permanentid"],Hf=[...Cl,"date","filetype","parents"],pw=[...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"],fw=()=>({fieldsToInclude:Cl,fetchAllFields:!1,fieldsDescription:[]});var El=Be(fw(),e=>e.addCase(si,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(Al,t=>{t.fetchAllFields=!0}).addCase(wl,t=>{t.fetchAllFields=!1}).addCase(xl.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(lw,(t,{payload:r})=>{let n=dw().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));function nF(e){return e.addReducers({fields:El}),{registerFieldsToInclude:si,enableFetchAllFields:Al,disableFetchAllFields:wl,fetchFieldsDescription:xl}}m();d();f();p();function oF(e){return e.addReducers({pipeline:fo}),{setPipeline:po}}m();d();f();p();function iF(e){return e.addReducers({recommendation:Co}),{getRecommendations:Nr,setRecommendationId:xo}}m();d();f();p();function aF(e){return e.addReducers({}),{logRecommendationOpen:Xs}}m();d();f();p();m();d();f();p();var sF=new yt({content:new qe({required:!0}),conditions:new qe({required:!0}),priority:new oe({required:!1,default:0,min:0}),fields:new Ae({required:!1,each:Y})});function mw(){let e=[],t=r=>{let n=sF.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new mi("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 gw(e){if(!cF(e))throw Ht;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=mw();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 cF(e){return e.addReducers({fields:El}),!0}m();d();f();p();function uF(e){return e.addReducers({searchHub:Ro}),{setSearchHub:Eo}}/**
|
|
43
43
|
* @license
|
|
44
44
|
*
|
|
45
45
|
* Copyright 2026 Coveo Solutions Inc.
|
|
@@ -72,4 +72,4 @@ fast-json-patch/module/duplex.mjs:
|
|
|
72
72
|
*)
|
|
73
73
|
*/if(__exports!=exports)module.exports=exports;return module.exports});
|
|
74
74
|
|
|
75
|
-
window.coveoQuanticVersion = '3.45.
|
|
75
|
+
window.coveoQuanticVersion = '3.45.4';
|