@coveo/quantic 3.44.3 → 3.45.0

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.
Files changed (19) hide show
  1. package/docs/out/quantic-docs.json +58 -0
  2. package/force-app/main/default/labels/CustomLabels.labels-meta.xml +28 -0
  3. package/force-app/main/default/lwc/quanticLoadMoreResults/quanticLoadMoreResults.css +5 -0
  4. package/force-app/main/default/lwc/quanticLoadMoreResults/quanticLoadMoreResults.html +30 -0
  5. package/force-app/main/default/lwc/quanticLoadMoreResults/quanticLoadMoreResults.js +162 -0
  6. package/force-app/main/default/lwc/quanticLoadMoreResults/quanticLoadMoreResults.js-meta.xml +5 -0
  7. package/force-app/main/default/lwc/quanticResultLink/quanticResultLink.js +2 -2
  8. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +15 -15
  9. package/force-app/main/default/staticresources/coveoheadless/definitions/api/analytics/analytics-relay-client.d.ts +2 -1
  10. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/factories/build-factory.d.ts +1 -1
  11. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/access-token-manager.d.ts +7 -1
  12. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/build.d.ts +10 -0
  13. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/engine.d.ts +1 -1
  14. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/common/access-token-manager.d.ts +7 -1
  15. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/types/engine.d.ts +1 -1
  16. package/force-app/main/default/staticresources/coveoheadless/headless.js +17 -17
  17. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +16 -16
  18. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +15 -15
  19. package/package.json +2 -2
@@ -14,35 +14,35 @@ 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("CoveoHeadlessCaseAssist",["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["CoveoHeadlessCaseAssist"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var sb=Object.create;var Mo=Object.defineProperty;var ab=Object.getOwnPropertyDescriptor;var cb=Object.getOwnPropertyNames;var ub=Object.getPrototypeOf,lb=Object.prototype.hasOwnProperty;var db=(e,t,r)=>t in e?Mo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var _n=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var Ye=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Xi=(e,t)=>{for(var r in t)Mo(e,r,{get:t[r],enumerable:!0})},zp=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of cb(t))!lb.call(e,o)&&o!==r&&Mo(e,o,{get:()=>t[o],enumerable:!(n=ab(t,o))||n.enumerable});return e};var Pt=(e,t,r)=>(r=e!=null?sb(ub(e)):{},zp(t||!e||!e.__esModule?Mo(r,"default",{value:e,enumerable:!0}):r,e)),pb=e=>zp(Mo({},"__esModule",{value:!0}),e);var oe=(e,t,r)=>db(e,typeof t!="symbol"?t+"":t,r);var b,d=_n(()=>{"use strict";b=typeof globalThis<"u"?globalThis:window});function Zi(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Zi=function(t){return typeof t}:Zi=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zi(e)}function gb(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=hb.bind(this))}function hb(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","*/*"),fb(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):mb(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var fb,mb,p=_n(()=>{"use strict";fb=function(t){return typeof t=="string"},mb=function(t){return t instanceof Blob};gb.call((typeof window>"u"?"undefined":Zi(window))==="object"?window:{})});var Ou=Ye(Lo=>{"use strict";m();d();f();p();Object.defineProperty(Lo,"__esModule",{value:!0});function Wp(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 yb(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function vb(e,t,r){return t=On(t),Ab(e,Zp()?Reflect.construct(t,r||[],On(e).constructor):t.apply(e,r))}function Tu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Kp(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,xb(n.key),n)}}function ku(e,t,r){return t&&Kp(e.prototype,t),r&&Kp(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Yp(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Eb(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(c){throw c},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,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return s=c.done,c},e:function(c){a=!0,i=c},f:function(){try{s||r.return==null||r.return()}finally{if(a)throw i}}}}function Iu(){return Iu=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=bb(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Iu.apply(null,arguments)}function On(e){return On=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},On(e)}function Sb(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&&Ru(e,t)}function Zp(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Zp=function(){return!!e})()}function Ab(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 yb(e)}function Ru(e,t){return Ru=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Ru(e,t)}function bb(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=On(e))!==null;);return e}function wb(e,t,r,n){var o=Iu(On(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function Cb(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 xb(e){var t=Cb(e,"string");return typeof t=="symbol"?t:t+""}function Eb(e,t){if(e){if(typeof e=="string")return Wp(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)?Wp(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function Ib(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 Rb(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 Xp=function(){function e(){Tu(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return ku(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,s=o.length;i<s;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(),s=function(){var g=i[a];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)},a=0,c=i.length;a<c;a++)s();return!r.defaultPrevented}}}])}(),_u=function(e){function t(){var r;return Tu(this,t),r=vb(this,t),r.listeners||Xp.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 Sb(t,e),ku(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)),wb(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 Ji;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 Ji;function i(){o.abort(this.reason),s()}function s(){var g=Yp(n),v;try{for(g.s();!(v=g.n()).done;){var w=v.value;w.removeEventListener("abort",i)}}catch(h){g.e(h)}finally{g.f()}}var a=Yp(n),c;try{for(a.s();!(c=a.n()).done;){var u=c.value;if(u.aborted){o.abort(u.reason);break}else u.addEventListener("abort",i)}}catch(g){a.e(g)}finally{a.f()}return o.signal}}])}(Xp),Ji=function(){function e(){Tu(this,e),Object.defineProperty(this,"signal",{value:new _u,writable:!0,configurable:!0})}return ku(e,[{key:"abort",value:function(r){var n=Rb(r),o=Ib(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Ji.prototype[Symbol.toStringTag]="AbortController",_u.prototype[Symbol.toStringTag]="AbortSignal");function Tb(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 kb(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,s=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,a=s===void 0?!1:s;if(!Tb({fetch:r,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a}))return{fetch:r,Request:c};var c=o;(c&&!c.prototype.hasOwnProperty("signal")||a)&&(c=function(w,h){var y;h&&h.signal&&(y=h.signal,delete h.signal);var S=new o(w,h);return y&&Object.defineProperty(S,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),S},c.prototype=o.prototype);var u=r,g=function(w,h){var y=c&&c.prototype.isPrototypeOf(w)?w.signal:h?h.signal:void 0;if(y){var S;try{S=new DOMException("Aborted","AbortError")}catch{S=new Error("Aborted"),S.name="AbortError"}if(y.aborted)return Promise.reject(S);var x=new Promise(function(I,_){y.addEventListener("abort",function(){return _(S)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([x,u(w,h)])}return u(w,h)};return{fetch:g,Request:c}}Lo.AbortController=Ji;Lo.AbortSignal=_u;Lo.abortableFetch=kb});var Jp,l,C,f=_n(()=>{"use strict";Jp=Pt(Ou(),1),l=Pt(Ou(),1),{fetch:C}=(0,Jp.abortableFetch)({fetch})});function Pu(e){return typeof e!="string"||e in{}}function Nu(){return Object.create(null)}function ef(e){return typeof e=="string"&&!!e.trim()}function Fu(e,t){var r=e.split(";").filter(ef),n=r.shift();if(!n)return null;var o=_b(n),i=o.name,s=o.value;if(t=t?Object.assign({},es,t):es,Pu(i))return null;try{s=t.decodeValues?decodeURIComponent(s):s}catch(c){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",c)}var a=Nu();return a.name=i,a.value=s,r.forEach(function(c){var u=c.split("="),g=u.shift().trim().toLowerCase();if(!Pu(g)){var v=u.join("=").trim();if(g==="expires")a.expires=new Date(v);else if(g==="max-age"){var w=parseInt(v,10);Number.isNaN(w)||(a.maxAge=w)}else g==="secure"?a.secure=!0:g==="httponly"?a.httpOnly=!0:g==="samesite"?a.sameSite=v:g==="partitioned"?a.partitioned=!0:g&&(a[g]=v)}}),a}function _b(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function Pn(e,t){if(t=t?Object.assign({},es,t):es,!e)return t.map?Nu():[];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(s){return s.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(ef),n&&(e=e.map(ts).flat()),t.map){var i=Nu();return e.reduce(function(s,a){var c=Fu(a,t);return c&&!Pu(c.name)&&(s[c.name]=c),s},i)}else return e.map(function(s){return Fu(s,t)}).filter(Boolean)}function ts(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,i,s,a;function c(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function u(){return o=e.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<e.length;){for(n=r,a=!1;c();)if(o=e.charAt(r),o===","){for(i=r,r+=1,c(),s=r;r<e.length&&u();)r+=1;r<e.length&&e.charAt(r)==="="?(a=!0,r=s,t.push(e.substring(n,i)),n=r):r=i+1}else r+=1;(!a||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var es,tf=_n(()=>{"use strict";m();d();f();p();es={decodeValues:!0,map:!1,silent:!1,split:"auto"};Pn.parseSetCookie=Pn;Pn.parse=Pn;Pn.parseString=Fu;Pn.splitCookiesString=ts});function jo(e){if(Ob.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Du(e){return e.replace(Pb,"")}function qo(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||!Nb(r))return!1}return!0}function Nb(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function nf(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 Ob,rf,Pb,of,Nn,Mu,sf,E,cf=_n(()=>{"use strict";m();d();f();p();tf();Ob=/[^a-z0-9\-#$%&'*+.^_`|~]/i;rf=[`
19
- `,"\r","\t"," "],Pb=new RegExp(`(^[${rf.join("")}]|$[${rf.join("")}])`,"g");Nn=Symbol("normalizedHeaders"),Mu=Symbol("rawHeaderNames"),sf=", ",E=class af{constructor(t){this[Nn]={},this[Mu]=new Map,this[of]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof af||typeof b.Headers<"u"&&t instanceof b.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(sf):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(sf):n)})}[(of=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[Nn]).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(!qo(t))throw new TypeError(`Invalid header name "${t}"`);return this[Nn].hasOwnProperty(jo(t))}get(t){if(!qo(t))throw TypeError(`Invalid header name "${t}"`);return this[Nn][jo(t)]??null}set(t,r){if(!qo(t)||!nf(r))return;let n=jo(t),o=Du(r);this[Nn][n]=Du(o),this[Mu].set(n,t)}append(t,r){if(!qo(t)||!nf(r))return;let n=jo(t),o=Du(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!qo(t)||!this.has(t))return;let r=jo(t);delete this[Nn][r],this[Mu].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===""?[""]:ts(t)}}});var m=_n(()=>{"use strict";cf()});var uf=Ye(Uo=>{"use strict";m();d();f();p();var rs=Uo&&Uo.__assign||function(){return rs=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},rs.apply(this,arguments)};Object.defineProperty(Uo,"__esModule",{value:!0});var Fb={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function Db(e){var t=rs(rs({},Fb),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Uo.getSanitizedOptions=Db});var lf=Ye(Lu=>{"use strict";m();d();f();p();Object.defineProperty(Lu,"__esModule",{value:!0});function Mb(e){var t=Math.random()*e;return Math.round(t)}Lu.fullJitter=Mb});var df=Ye(ju=>{"use strict";m();d();f();p();Object.defineProperty(ju,"__esModule",{value:!0});function Lb(e){return e}ju.noJitter=Lb});var pf=Ye(qu=>{"use strict";m();d();f();p();Object.defineProperty(qu,"__esModule",{value:!0});var jb=lf(),qb=df();function Ub(e){return e.jitter==="full"?jb.fullJitter:qb.noJitter}qu.JitterFactory=Ub});var Vu=Ye(Uu=>{"use strict";m();d();f();p();Object.defineProperty(Uu,"__esModule",{value:!0});var Vb=pf(),Bb=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=Vb.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}();Uu.Delay=Bb});var ff=Ye(rr=>{"use strict";m();d();f();p();var Gb=rr&&rr.__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)}}(),$b=rr&&rr.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(g){try{u(n.next(g))}catch(v){s(v)}}function c(g){try{u(n.throw(g))}catch(v){s(v)}}function u(g){g.done?i(g.value):o(g.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},Qb=rr&&rr.__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,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(g){return c([u,g])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(g){u=[6,g],o=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(rr,"__esModule",{value:!0});var Hb=Vu(),zb=function(e){Gb(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return $b(this,void 0,void 0,function(){return Qb(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}(Hb.Delay);rr.SkipFirstDelay=zb});var mf=Ye(Vo=>{"use strict";m();d();f();p();var Wb=Vo&&Vo.__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(Vo,"__esModule",{value:!0});var Kb=Vu(),Yb=function(e){Wb(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Kb.Delay);Vo.AlwaysDelay=Yb});var gf=Ye(Bu=>{"use strict";m();d();f();p();Object.defineProperty(Bu,"__esModule",{value:!0});var Xb=ff(),Zb=mf();function Jb(e,t){var r=ew(e);return r.setAttemptNumber(t),r}Bu.DelayFactory=Jb;function ew(e){return e.delayFirstAttempt?new Zb.AlwaysDelay(e):new Xb.SkipFirstDelay(e)}});var hf=Ye(qr=>{"use strict";m();d();f();p();var Gu=qr&&qr.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(g){try{u(n.next(g))}catch(v){s(v)}}function c(g){try{u(n.throw(g))}catch(v){s(v)}}function u(g){g.done?i(g.value):o(g.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},$u=qr&&qr.__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,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(g){return c([u,g])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(g){u=[6,g],o=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(qr,"__esModule",{value:!0});var tw=uf(),rw=gf();function nw(e,t){return t===void 0&&(t={}),Gu(this,void 0,void 0,function(){var r,n;return $u(this,function(o){switch(o.label){case 0:return r=tw.getSanitizedOptions(t),n=new ow(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}qr.backOff=nw;var ow=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return Gu(this,void 0,void 0,function(){var t,r;return $u(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 Gu(this,void 0,void 0,function(){var t;return $u(this,function(r){switch(r.label){case 0:return t=rw.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var Ea=Ye((gd,hd)=>{"use strict";m();d();f();p();(function(e,t){typeof gd=="object"&&typeof hd<"u"?hd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs=t()})(gd,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",s="hour",a="day",c="week",u="month",g="quarter",v="year",w="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+)?$/,S=/\[([^\]]+)]|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(O){var P=["th","st","nd","rd"],N=O%100;return"["+O+(P[(N-20)%10]||P[N]||P[0])+"]"}},I=function(O,P,N){var Q=String(O);return!Q||Q.length>=P?O:""+Array(P+1-Q.length).join(N)+O},_={s:I,z:function(O){var P=-O.utcOffset(),N=Math.abs(P),Q=Math.floor(N/60),$=N%60;return(P<=0?"+":"-")+I(Q,2,"0")+":"+I($,2,"0")},m:function O(P,N){if(P.date()<N.date())return-O(N,P);var Q=12*(N.year()-P.year())+(N.month()-P.month()),$=P.clone().add(Q,u),Y=N-$<0,K=P.clone().add(Q+(Y?-1:1),u);return+(-(Q+(N-$)/(Y?$-K:K-$))||0)},a:function(O){return O<0?Math.ceil(O)||0:Math.floor(O)},p:function(O){return{M:u,y:v,w:c,d:a,D:w,h:s,m:i,s:o,ms:n,Q:g}[O]||String(O||"").toLowerCase().replace(/s$/,"")},u:function(O){return O===void 0}},R="en",T={};T[R]=x;var k="$isDayjsObject",F=function(O){return O instanceof j||!(!O||!O[k])},V=function O(P,N,Q){var $;if(!P)return R;if(typeof P=="string"){var Y=P.toLowerCase();T[Y]&&($=Y),N&&(T[Y]=N,$=Y);var K=P.split("-");if(!$&&K.length>1)return O(K[0])}else{var H=P.name;T[H]=P,$=H}return!Q&&$&&(R=$),$||!Q&&R},U=function(O,P){if(F(O))return O.clone();var N=typeof P=="object"?P:{};return N.date=O,N.args=arguments,new j(N)},L=_;L.l=V,L.i=F,L.w=function(O,P){return U(O,{locale:P.$L,utc:P.$u,x:P.$x,$offset:P.$offset})};var j=function(){function O(N){this.$L=V(N.locale,null,!0),this.parse(N),this.$x=this.$x||N.x||{},this[k]=!0}var P=O.prototype;return P.parse=function(N){this.$d=function(Q){var $=Q.date,Y=Q.utc;if($===null)return new Date(NaN);if(L.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var K=$.match(y);if(K){var H=K[2]-1||0,J=(K[7]||"0").substring(0,3);return Y?new Date(Date.UTC(K[1],H,K[3]||1,K[4]||0,K[5]||0,K[6]||0,J)):new Date(K[1],H,K[3]||1,K[4]||0,K[5]||0,K[6]||0,J)}}return new Date($)}(N),this.init()},P.init=function(){var N=this.$d;this.$y=N.getFullYear(),this.$M=N.getMonth(),this.$D=N.getDate(),this.$W=N.getDay(),this.$H=N.getHours(),this.$m=N.getMinutes(),this.$s=N.getSeconds(),this.$ms=N.getMilliseconds()},P.$utils=function(){return L},P.isValid=function(){return this.$d.toString()!==h},P.isSame=function(N,Q){var $=U(N);return this.startOf(Q)<=$&&$<=this.endOf(Q)},P.isAfter=function(N,Q){return U(N)<this.startOf(Q)},P.isBefore=function(N,Q){return this.endOf(Q)<U(N)},P.$g=function(N,Q,$){return L.u(N)?this[Q]:this.set($,N)},P.unix=function(){return Math.floor(this.valueOf()/1e3)},P.valueOf=function(){return this.$d.getTime()},P.startOf=function(N,Q){var $=this,Y=!!L.u(Q)||Q,K=L.p(N),H=function(pe,de){var he=L.w($.$u?Date.UTC($.$y,de,pe):new Date($.$y,de,pe),$);return Y?he:he.endOf(a)},J=function(pe,de){return L.w($.toDate()[pe].apply($.toDate("s"),(Y?[0,0,0,0]:[23,59,59,999]).slice(de)),$)},se=this.$W,be=this.$M,Ne=this.$D,Ie="set"+(this.$u?"UTC":"");switch(K){case v:return Y?H(1,0):H(31,11);case u:return Y?H(1,be):H(0,be+1);case c:var ke=this.$locale().weekStart||0,_e=(se<ke?se+7:se)-ke;return H(Y?Ne-_e:Ne+(6-_e),be);case a:case w:return J(Ie+"Hours",0);case s:return J(Ie+"Minutes",1);case i:return J(Ie+"Seconds",2);case o:return J(Ie+"Milliseconds",3);default:return this.clone()}},P.endOf=function(N){return this.startOf(N,!1)},P.$set=function(N,Q){var $,Y=L.p(N),K="set"+(this.$u?"UTC":""),H=($={},$[a]=K+"Date",$[w]=K+"Date",$[u]=K+"Month",$[v]=K+"FullYear",$[s]=K+"Hours",$[i]=K+"Minutes",$[o]=K+"Seconds",$[n]=K+"Milliseconds",$)[Y],J=Y===a?this.$D+(Q-this.$W):Q;if(Y===u||Y===v){var se=this.clone().set(w,1);se.$d[H](J),se.init(),this.$d=se.set(w,Math.min(this.$D,se.daysInMonth())).$d}else H&&this.$d[H](J);return this.init(),this},P.set=function(N,Q){return this.clone().$set(N,Q)},P.get=function(N){return this[L.p(N)]()},P.add=function(N,Q){var $,Y=this;N=Number(N);var K=L.p(Q),H=function(be){var Ne=U(Y);return L.w(Ne.date(Ne.date()+Math.round(be*N)),Y)};if(K===u)return this.set(u,this.$M+N);if(K===v)return this.set(v,this.$y+N);if(K===a)return H(1);if(K===c)return H(7);var J=($={},$[i]=t,$[s]=r,$[o]=e,$)[K]||1,se=this.$d.getTime()+N*J;return L.w(se,this)},P.subtract=function(N,Q){return this.add(-1*N,Q)},P.format=function(N){var Q=this,$=this.$locale();if(!this.isValid())return $.invalidDate||h;var Y=N||"YYYY-MM-DDTHH:mm:ssZ",K=L.z(this),H=this.$H,J=this.$m,se=this.$M,be=$.weekdays,Ne=$.months,Ie=$.meridiem,ke=function(de,he,fe,Be){return de&&(de[he]||de(Q,Y))||fe[he].slice(0,Be)},_e=function(de){return L.s(H%12||12,de,"0")},pe=Ie||function(de,he,fe){var Be=de<12?"AM":"PM";return fe?Be.toLowerCase():Be};return Y.replace(S,function(de,he){return he||function(fe){switch(fe){case"YY":return String(Q.$y).slice(-2);case"YYYY":return L.s(Q.$y,4,"0");case"M":return se+1;case"MM":return L.s(se+1,2,"0");case"MMM":return ke($.monthsShort,se,Ne,3);case"MMMM":return ke(Ne,se);case"D":return Q.$D;case"DD":return L.s(Q.$D,2,"0");case"d":return String(Q.$W);case"dd":return ke($.weekdaysMin,Q.$W,be,2);case"ddd":return ke($.weekdaysShort,Q.$W,be,3);case"dddd":return be[Q.$W];case"H":return String(H);case"HH":return L.s(H,2,"0");case"h":return _e(1);case"hh":return _e(2);case"a":return pe(H,J,!0);case"A":return pe(H,J,!1);case"m":return String(J);case"mm":return L.s(J,2,"0");case"s":return String(Q.$s);case"ss":return L.s(Q.$s,2,"0");case"SSS":return L.s(Q.$ms,3,"0");case"Z":return K}return null}(de)||K.replace(":","")})},P.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},P.diff=function(N,Q,$){var Y,K=this,H=L.p(Q),J=U(N),se=(J.utcOffset()-this.utcOffset())*t,be=this-J,Ne=function(){return L.m(K,J)};switch(H){case v:Y=Ne()/12;break;case u:Y=Ne();break;case g:Y=Ne()/3;break;case c:Y=(be-se)/6048e5;break;case a:Y=(be-se)/864e5;break;case s:Y=be/r;break;case i:Y=be/t;break;case o:Y=be/e;break;default:Y=be}return $?Y:L.a(Y)},P.daysInMonth=function(){return this.endOf(u).$D},P.$locale=function(){return T[this.$L]},P.locale=function(N,Q){if(!N)return this.$L;var $=this.clone(),Y=V(N,Q,!0);return Y&&($.$L=Y),$},P.clone=function(){return L.w(this.$d,this)},P.toDate=function(){return new Date(this.valueOf())},P.toJSON=function(){return this.isValid()?this.toISOString():null},P.toISOString=function(){return this.$d.toISOString()},P.toString=function(){return this.$d.toUTCString()},O}(),M=j.prototype;return U.prototype=M,[["$ms",n],["$s",o],["$m",i],["$H",s],["$W",a],["$M",u],["$y",v],["$D",w]].forEach(function(O){M[O[1]]=function(P){return this.$g(P,O[0],O[1])}}),U.extend=function(O,P){return O.$i||(O(P,j,U),O.$i=!0),U},U.locale=V,U.isDayjs=F,U.unix=function(O){return U(1e3*O)},U.en=T[R],U.Ls=T,U.p={},U})});var Oh=Ye((yd,vd)=>{"use strict";m();d();f();p();(function(e,t){typeof yd=="object"&&typeof vd<"u"?vd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_quarterOfYear=t()})(yd,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(a){return this.$utils().u(a)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(a-1))};var i=o.add;o.add=function(a,c){return a=Number(a),this.$utils().p(c)===t?this.add(3*a,e):i.bind(this)(a,c)};var s=o.startOf;o.startOf=function(a,c){var u=this.$utils(),g=!!u.u(c)||c;if(u.p(a)===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 s.bind(this)(a,c)}}})});var Ph=Ye((Sd,Ad)=>{"use strict";m();d();f();p();(function(e,t){typeof Sd=="object"&&typeof Ad<"u"?Ad.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_customParseFormat=t()})(Sd,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]+/,s={},a=function(y){return(y=+y)+(y>68?1900:2e3)},c=function(y){return function(S){this[y]=+S}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(S){if(!S||S==="Z")return 0;var x=S.match(/([+-]|\d\d)/g),I=60*x[1]+(+x[2]||0);return I===0?0:x[0]==="+"?-I:I}(y)}],g=function(y){var S=s[y];return S&&(S.indexOf?S:S.s.concat(S.f))},v=function(y,S){var x,I=s.meridiem;if(I){for(var _=1;_<=24;_+=1)if(y.indexOf(I(_,0,S))>-1){x=_>12;break}}else x=y===(S?"pm":"PM");return x},w={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,c("seconds")],ss:[o,c("seconds")],m:[o,c("minutes")],mm:[o,c("minutes")],H:[o,c("hours")],h:[o,c("hours")],HH:[o,c("hours")],hh:[o,c("hours")],D:[o,c("day")],DD:[n,c("day")],Do:[i,function(y){var S=s.ordinal,x=y.match(/\d+/);if(this.day=x[0],S)for(var I=1;I<=31;I+=1)S(I).replace(/\[|\]/g,"")===y&&(this.day=I)}],w:[o,c("week")],ww:[n,c("week")],M:[o,c("month")],MM:[n,c("month")],MMM:[i,function(y){var S=g("months"),x=(g("monthsShort")||S.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 S=g("months").indexOf(y)+1;if(S<1)throw new Error;this.month=S%12||S}],Y:[/[+-]?\d+/,c("year")],YY:[n,function(y){this.year=a(y)}],YYYY:[/\d{4}/,c("year")],Z:u,ZZ:u};function h(y){var S,x;S=y,x=s&&s.formats;for(var I=(y=S.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(U,L,j){var M=j&&j.toUpperCase();return L||x[j]||e[j]||x[M].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(O,P,N){return P||N.slice(1)})})).match(t),_=I.length,R=0;R<_;R+=1){var T=I[R],k=w[T],F=k&&k[0],V=k&&k[1];I[R]=V?{regex:F,parser:V}:T.replace(/^\[|\]$/g,"")}return function(U){for(var L={},j=0,M=0;j<_;j+=1){var O=I[j];if(typeof O=="string")M+=O.length;else{var P=O.regex,N=O.parser,Q=U.slice(M),$=P.exec(Q)[0];N.call(L,$),U=U.replace($,"")}}return function(Y){var K=Y.afternoon;if(K!==void 0){var H=Y.hours;K?H<12&&(Y.hours+=12):H===12&&(Y.hours=0),delete Y.afternoon}}(L),L}}return function(y,S,x){x.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(a=y.parseTwoDigitYear);var I=S.prototype,_=I.parse;I.parse=function(R){var T=R.date,k=R.utc,F=R.args;this.$u=k;var V=F[1];if(typeof V=="string"){var U=F[2]===!0,L=F[3]===!0,j=U||L,M=F[2];L&&(M=F[2]),s=this.$locale(),!U&&M&&(s=x.Ls[M]),this.$d=function(Q,$,Y,K){try{if(["x","X"].indexOf($)>-1)return new Date(($==="X"?1e3:1)*Q);var H=h($)(Q),J=H.year,se=H.month,be=H.day,Ne=H.hours,Ie=H.minutes,ke=H.seconds,_e=H.milliseconds,pe=H.zone,de=H.week,he=new Date,fe=be||(J||se?1:he.getDate()),Be=J||he.getFullYear(),ze=0;J&&!se||(ze=se>0?se-1:he.getMonth());var _t,gt=Ne||0,Ut=Ie||0,bt=ke||0,Ot=_e||0;return pe?new Date(Date.UTC(Be,ze,fe,gt,Ut,bt,Ot+60*pe.offset*1e3)):Y?new Date(Date.UTC(Be,ze,fe,gt,Ut,bt,Ot)):(_t=new Date(Be,ze,fe,gt,Ut,bt,Ot),de&&(_t=K(_t).week(de).toDate()),_t)}catch{return new Date("")}}(T,V,k,x),this.init(),M&&M!==!0&&(this.$L=this.locale(M).$L),j&&T!=this.format(V)&&(this.$d=new Date("")),s={}}else if(V instanceof Array)for(var O=V.length,P=1;P<=O;P+=1){F[1]=V[P-1];var N=x.apply(this,F);if(N.isValid()){this.$d=N.$d,this.$L=N.$L,this.init();break}P===O&&(this.$d=new Date(""))}else _.call(this,R)}}})});var xy=Ye((Dd,Md)=>{"use strict";m();d();f();p();(function(e,t){typeof Dd=="object"&&typeof Md<"u"?Md.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_timezone=t()})(Dd,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,s=function(g,v,w){w===void 0&&(w={});var h=new Date(g),y=function(S,x){x===void 0&&(x={});var I=x.timeZoneName||"short",_=S+"|"+I,R=t[_];return R||(R=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:S,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:I}),t[_]=R),R}(v,w);return y.formatToParts(h)},a=function(g,v){for(var w=s(g,v),h=[],y=0;y<w.length;y+=1){var S=w[y],x=S.type,I=S.value,_=e[x];_>=0&&(h[_]=parseInt(I,10))}var R=h[3],T=R===24?0:R,k=h[0]+"-"+h[1]+"-"+h[2]+" "+T+":"+h[4]+":"+h[5]+":000",F=+g;return(o.utc(k).valueOf()-(F-=F%1e3))/6e4},c=n.prototype;c.tz=function(g,v){if(g===void 0&&(g=i),!this.isValid())return this;var w,h=this.utcOffset(),y=this.toDate(),S=y.toLocaleString("en-US",{timeZone:g}),x=a(+y,g);if(!Number(x))w=this.utcOffset(0,v);else if(w=o(S,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(x,!0),v){var I=w.utcOffset();w=w.add(h-I,"minute")}return w.$x.$timezone=g,w},c.offsetName=function(g){var v=this.$x.$timezone||o.tz.guess(),w=s(this.valueOf(),v,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return w&&w.value};var u=c.startOf;c.startOf=function(g,v){if(!this.$x||!this.$x.$timezone)return u.call(this,g,v);var w=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return u.call(w,g,v).tz(this.$x.$timezone,!0)},o.tz=function(g,v,w){var h=w&&v,y=w||v||i,S=a(+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(F,V,U){var L=F-60*V*1e3,j=a(L,U);if(V===j)return[L,V];var M=a(L-=60*(j-V)*1e3,U);return j===M?[L,j]:[F-60*Math.min(j,M)*1e3,Math.max(j,M)]}(x,S,y),R=_[0],T=_[1],k=o(R).utcOffset(T);return k.$x.$timezone=y,k},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var Ey=Ye((Ld,jd)=>{"use strict";m();d();f();p();(function(e,t){typeof Ld=="object"&&typeof jd<"u"?jd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_utc=t()})(Ld,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,i){var s=o.prototype;i.utc=function(h){var y={date:h,utc:!0,args:arguments};return new o(y)},s.utc=function(h){var y=i(this.toDate(),{locale:this.$L,utc:!0});return h?y.add(this.utcOffset(),e):y},s.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var a=s.parse;s.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),a.call(this,h)};var c=s.init;s.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 c.call(this)};var u=s.utcOffset;s.utcOffset=function(h,y){var S=this.$utils().u;if(S(h))return this.$u?0:S(this.$offset)?u.call(this):this.$offset;if(typeof h=="string"&&(h=function(R){R===void 0&&(R="");var T=R.match(t);if(!T)return null;var k=(""+T[0]).match(r)||["-",0,0],F=k[0],V=60*+k[1]+ +k[2];return V===0?0:F==="+"?V:-V}(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=s.format;s.format=function(h){var y=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,y)},s.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},s.isUTC=function(){return!!this.$u},s.toISOString=function(){return this.toDate().toISOString()},s.toString=function(){return this.toDate().toUTCString()};var v=s.toDate;s.toDate=function(h){return h==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var w=s.diff;s.diff=function(h,y,S){if(h&&this.$u===h.$u)return w.call(this,h,y,S);var x=this.local(),I=i(h).local();return w.call(x,I,y,S)}}})});var SA=Ye((Xae,vA)=>{"use strict";m();d();f();p();function EO(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}vA.exports=IO;function IO(e,t,r){var n=r&&r.stringify||EO,o=1;if(typeof e=="object"&&e!==null){var i=t.length+o;if(i===1)return e;var s=new Array(i);s[0]=n(e);for(var a=1;a<i;a++)s[a]=n(t[a]);return s.join(" ")}if(typeof e!="string")return e;var c=t.length;if(c===0)return e;for(var u="",g=1-o,v=-1,w=e&&e.length||0,h=0;h<w;){if(e.charCodeAt(h)===37&&h+1<w){switch(v=v>-1?v:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=c||t[g]==null)break;v<h&&(u+=e.slice(v,h)),u+=Number(t[g]),v=h+2,h++;break;case 105:if(g>=c||t[g]==null)break;v<h&&(u+=e.slice(v,h)),u+=Math.floor(Number(t[g])),v=h+2,h++;break;case 79:case 111:case 106:if(g>=c||t[g]===void 0)break;v<h&&(u+=e.slice(v,h));var y=typeof t[g];if(y==="string"){u+="'"+t[g]+"'",v=h+2,h++;break}if(y==="function"){u+=t[g].name||"<anonymous>",v=h+2,h++;break}u+=n(t[g]),v=h+2,h++;break;case 115:if(g>=c)break;v<h&&(u+=e.slice(v,h)),u+=String(t[g]),v=h+2,h++;break;case 37:v<h&&(u+=e.slice(v,h)),u+="%",v=h+2,h++,g--;break}++g}++h}return v===-1?e:(v<w&&(u+=e.slice(v)),u)}});var IA=Ye((rce,vu)=>{"use strict";m();d();f();p();var AA=SA();vu.exports=gr;var Wi=VO().console||{},RO={mapHttpRequest:yu,mapHttpResponse:yu,wrapRequestSerializer:Dp,wrapResponseSerializer:Dp,wrapErrorSerializer:Dp,req:yu,res:yu,err:wA,errWithCause:wA};function Mr(e,t){return e==="silent"?1/0:t.levels.values[e]}var jp=Symbol("pino.logFuncs"),Mp=Symbol("pino.hierarchy"),TO={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function bA(e,t){let r={logger:t,parent:e[Mp]};t[Mp]=r}function kO(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Wi[o]||Wi[TO[o]||"log"]||Oo}),e[jp]=n}function _O(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function gr(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||Wi;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=_O(e.browser.serialize,n),i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);let s=Object.keys(e.customLevels||{}),a=["error","fatal","warn","info","debug","trace"].concat(s);typeof r=="function"&&a.forEach(function(S){r[S]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let c=e.level||"info",u=Object.create(r);u.log||(u.log=Oo),kO(u,a,r),bA({},u),Object.defineProperty(u,"levelVal",{get:v}),Object.defineProperty(u,"level",{get:w,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:a,timestamp:jO(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Oo};u.levels=OO(e),u.level=c,u.isLevelEnabled=function(S){return this.levels.values[S]?this.levels.values[S]>=this.levels.values[this.level]:!1},u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Oo,u.serializers=n,u._serialize=o,u._stdErrSerialize=i,u.child=function(...S){return y.call(this,g,...S)},t&&(u._logEvent=Lp());function v(){return Mr(this.level,this)}function w(){return this._level}function h(S){if(S!=="silent"&&!this.levels.values[S])throw Error("unknown level "+S);this._level=S,Tn(this,g,u,"error"),Tn(this,g,u,"fatal"),Tn(this,g,u,"warn"),Tn(this,g,u,"info"),Tn(this,g,u,"debug"),Tn(this,g,u,"trace"),s.forEach(x=>{Tn(this,g,u,x)})}function y(S,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 R=Object.assign({},n,_),T=e.browser.serialize===!0?Object.keys(R):o;delete x.serializers,qp([x],T,R,this._stdErrSerialize)}function k(V){this._childLevel=(V._childLevel|0)+1,this.bindings=x,R&&(this.serializers=R,this._serialize=T),t&&(this._logEvent=Lp([].concat(V._logEvent.bindings,x)))}k.prototype=this;let F=new k(this);return bA(this,F),F.child=function(...V){return y.call(this,S,...V)},F.level=I.level||this.level,S.onChild(F),F}return u}function OO(e){let t=e.customLevels||{},r=Object.assign({},gr.levels.values,t),n=Object.assign({},gr.levels.labels,PO(t));return{values:r,labels:n}}function PO(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}gr.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"}};gr.stdSerializers=RO;gr.stdTimeFunctions=Object.assign({},{nullTime:xA,epochTime:EA,unixTime:qO,isoTime:UO});function NO(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[Mp];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Tn(e,t,r,n){if(Object.defineProperty(e,n,{value:Mr(e.level,r)>Mr(n,r)?Oo:r[jp][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===Oo){if(!t.transmit)return;let i=t.transmit.level||e.level,s=Mr(i,r);if(Mr(n,r)<s)return}e[n]=DO(e,t,r,n);let o=NO(e);o.length!==0&&(e[n]=FO(o,e[n]))}function FO(e,t){return function(){return t.apply(this,[...e,...arguments])}}function DO(e,t,r,n){return function(o){return function(){let s=t.timestamp(),a=new Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Wi?Wi:this;for(var u=0;u<a.length;u++)a[u]=arguments[u];var g=!1;if(t.serialize&&(qp(a,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let v=MO(this,n,a,s,t);if(t.reportCaller&&v&&v.length>0&&v[0]&&typeof v[0]=="object")try{let w=CA();w&&(v[0].caller=w)}catch{}o.call(c,...v)}else{if(t.reportCaller)try{let v=CA();v&&a.push(v)}catch{}o.apply(c,a)}if(t.transmit){let v=t.transmit.level||e._level,w=Mr(v,r),h=Mr(n,r);if(h<w)return;LO(this,{ts:s,methodLevel:n,methodValue:h,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Mr(e._level,r)},a,g)}}}(e[jp][n])}function MO(e,t,r,n,o){let{level:i,log:s=v=>v}=o.formatters||{},a=r.slice(),c=a[0],u={},g=(e._childLevel|0)+1;if(g<1&&(g=1),n&&(u.time=n),i){let v=i(t,e.levels.values[t]);Object.assign(u,v)}else u.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(c!==null&&typeof c=="object")for(;g--&&typeof a[0]=="object";)Object.assign(u,a.shift());return[s(u),...a]}else{if(c!==null&&typeof c=="object"){for(;g--&&typeof a[0]=="object";)Object.assign(u,a.shift());c=a.length?AA(a.shift(),a):void 0}else typeof c=="string"&&(c=AA(a.shift(),a));return c!==void 0&&(u[o.messageKey]=c),[s(u)]}}function qp(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=gr.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 LO(e,t,r,n=!1){let o=t.send,i=t.ts,s=t.methodLevel,a=t.methodValue,c=t.val,u=e._logEvent.bindings;n||qp(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 u.indexOf(g)===-1}),e._logEvent.level.label=s,e._logEvent.level.value=a,o(s,e._logEvent,c),e._logEvent=Lp(u)}function Lp(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function wA(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let r in e)t[r]===void 0&&(t[r]=e[r]);return t}function jO(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?xA:EA}function yu(){return{}}function Dp(e){return e}function Oo(){}function xA(){return!1}function EA(){return Date.now()}function qO(){return Math.round(Date.now()/1e3)}function UO(){return new Date(Date.now()).toISOString()}function VO(){function e(t){return typeof t<"u"&&t}try{return typeof b<"u"?b:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),b)}catch{return e(self)||e(window)||e(this)||{}}}vu.exports.default=gr;vu.exports.pino=gr;function CA(){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],s=o[2],a=o[3];return i+":"+s+":"+a}}return null}});var pP={};Xi(pP,{ResultTemplatesHelpers:()=>Hh,buildCaseAssistEngine:()=>PA,buildCaseField:()=>zA,buildCaseInput:()=>WA,buildController:()=>tr,buildDocumentSuggestion:()=>Vp,buildDocumentSuggestionList:()=>Vp,buildInteractiveResult:()=>YA,buildQuickview:()=>eb,getAnalyticsNextApiBaseUrl:()=>os,getOrganizationEndpoint:()=>ot,loadCaseAssistAnalyticsActions:()=>cP,loadCaseFieldActions:()=>uP,loadCaseInputActions:()=>lP,loadDocumentSuggestionActions:()=>dP,loadGenericAnalyticsActions:()=>aP});module.exports=pb(pP);m();d();f();p();m();d();f();p();var Cf=Pt(hf(),1);m();d();f();p();var wt=new Error("Failed to load reducers."),Fn=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."}},Ur=class extends Error{constructor(r,n){super();oe(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 yf(e){return Array.isArray(e)}function vf(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}var iw=new Set(["1",1,"yes",!0]);function Qu(){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=>iw.has(r))}function Sf(e){let t={};for(let[r,n]of e)t[r]=n;return t}function Bo(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function ns(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)}}m();d();f();p();function Af(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function bf(e){return typeof e!="object"||!e?!1:Object.values(e).every(sw)}function sw(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function wf(e){return e===429}var yr=class e{static call(t){return _asyncToGenerator(function*(){let r=aw(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:i,...s}=o,a=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let c=yield C(i,s);if(wf(c.status))throw c;return c});return function a(){return _ref.apply(this,arguments)}}();try{let c=yield(0,Cf.backOff)(a,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(u){let g=u&&wf(u.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(c.status){case 419:case 401:throw n.info("Platform renewing token"),new Fn;case 404:throw new Ur(i,c.status);default:return n.info({response:c,requestInfo:o},"Platform response"),c}}catch(c){return c.message==="Failed to fetch"?new Ur(i):c}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:s}=r,{signal:a,...c}=t,u=Bo(c);try{let g=yield o(t,n,s);return{...t,...g}}catch(g){i.error(g,"Platform request preprocessing failed. Returning default request options.")}return u})()}};function ot(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Dn(e,t,r="prod"){return e??ot(t,r)}function Mn(e,t="prod"){return`${ot(e,t)}/rest/search/v2`}function os(e,t="prod"){return`${ot(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function aw(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:s}=e,a=e.method==="POST"||e.method==="PUT",c=cw(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(a&&{body:c}),signal:s}}function cw(e,t){return t==="application/x-www-form-urlencoded"?bf(e)?Af(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();function uw(e,t){let r=`
17
+ */(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessCaseAssist",["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["CoveoHeadlessCaseAssist"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var ub=Object.create;var Lo=Object.defineProperty;var lb=Object.getOwnPropertyDescriptor;var db=Object.getOwnPropertyNames;var pb=Object.getPrototypeOf,fb=Object.prototype.hasOwnProperty;var mb=(e,t,r)=>t in e?Lo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var _n=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var Ye=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Xi=(e,t)=>{for(var r in t)Lo(e,r,{get:t[r],enumerable:!0})},Yp=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of db(t))!fb.call(e,o)&&o!==r&&Lo(e,o,{get:()=>t[o],enumerable:!(n=lb(t,o))||n.enumerable});return e};var Pt=(e,t,r)=>(r=e!=null?ub(pb(e)):{},Yp(t||!e||!e.__esModule?Lo(r,"default",{value:e,enumerable:!0}):r,e)),gb=e=>Yp(Lo({},"__esModule",{value:!0}),e);var oe=(e,t,r)=>mb(e,typeof t!="symbol"?t+"":t,r);var b,d=_n(()=>{"use strict";b=typeof globalThis<"u"?globalThis:window});function Zi(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Zi=function(t){return typeof t}:Zi=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zi(e)}function vb(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=Sb.bind(this))}function Sb(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","*/*"),hb(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):yb(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var hb,yb,p=_n(()=>{"use strict";hb=function(t){return typeof t=="string"},yb=function(t){return t instanceof Blob};vb.call((typeof window>"u"?"undefined":Zi(window))==="object"?window:{})});var Nu=Ye(jo=>{"use strict";m();d();f();p();Object.defineProperty(jo,"__esModule",{value:!0});function Xp(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 Ab(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bb(e,t,r){return t=On(t),Cb(e,tf()?Reflect.construct(t,r||[],On(e).constructor):t.apply(e,r))}function _u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zp(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,Rb(n.key),n)}}function Ou(e,t,r){return t&&Zp(e.prototype,t),r&&Zp(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Jp(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Tb(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(c){throw c},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,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return s=c.done,c},e:function(c){a=!0,i=c},f:function(){try{s||r.return==null||r.return()}finally{if(a)throw i}}}}function Tu(){return Tu=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=xb(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Tu.apply(null,arguments)}function On(e){return On=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},On(e)}function wb(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&&ku(e,t)}function tf(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tf=function(){return!!e})()}function Cb(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 Ab(e)}function ku(e,t){return ku=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},ku(e,t)}function xb(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=On(e))!==null;);return e}function Eb(e,t,r,n){var o=Tu(On(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function Ib(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 Rb(e){var t=Ib(e,"string");return typeof t=="symbol"?t:t+""}function Tb(e,t){if(e){if(typeof e=="string")return Xp(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)?Xp(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function kb(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 _b(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 ef=function(){function e(){_u(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Ou(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,s=o.length;i<s;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(),s=function(){var g=i[a];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)},a=0,c=i.length;a<c;a++)s();return!r.defaultPrevented}}}])}(),Pu=function(e){function t(){var r;return _u(this,t),r=bb(this,t),r.listeners||ef.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 wb(t,e),Ou(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)),Eb(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 Ji;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 Ji;function i(){o.abort(this.reason),s()}function s(){var g=Jp(n),v;try{for(g.s();!(v=g.n()).done;){var w=v.value;w.removeEventListener("abort",i)}}catch(h){g.e(h)}finally{g.f()}}var a=Jp(n),c;try{for(a.s();!(c=a.n()).done;){var u=c.value;if(u.aborted){o.abort(u.reason);break}else u.addEventListener("abort",i)}}catch(g){a.e(g)}finally{a.f()}return o.signal}}])}(ef),Ji=function(){function e(){_u(this,e),Object.defineProperty(this,"signal",{value:new Pu,writable:!0,configurable:!0})}return Ou(e,[{key:"abort",value:function(r){var n=_b(r),o=kb(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Ji.prototype[Symbol.toStringTag]="AbortController",Pu.prototype[Symbol.toStringTag]="AbortSignal");function Ob(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 Pb(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,s=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,a=s===void 0?!1:s;if(!Ob({fetch:r,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a}))return{fetch:r,Request:c};var c=o;(c&&!c.prototype.hasOwnProperty("signal")||a)&&(c=function(w,h){var y;h&&h.signal&&(y=h.signal,delete h.signal);var S=new o(w,h);return y&&Object.defineProperty(S,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),S},c.prototype=o.prototype);var u=r,g=function(w,h){var y=c&&c.prototype.isPrototypeOf(w)?w.signal:h?h.signal:void 0;if(y){var S;try{S=new DOMException("Aborted","AbortError")}catch{S=new Error("Aborted"),S.name="AbortError"}if(y.aborted)return Promise.reject(S);var x=new Promise(function(I,_){y.addEventListener("abort",function(){return _(S)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([x,u(w,h)])}return u(w,h)};return{fetch:g,Request:c}}jo.AbortController=Ji;jo.AbortSignal=Pu;jo.abortableFetch=Pb});var rf,l,C,f=_n(()=>{"use strict";rf=Pt(Nu(),1),l=Pt(Nu(),1),{fetch:C}=(0,rf.abortableFetch)({fetch})});function Fu(e){return typeof e!="string"||e in{}}function Du(){return Object.create(null)}function nf(e){return typeof e=="string"&&!!e.trim()}function Mu(e,t){var r=e.split(";").filter(nf),n=r.shift();if(!n)return null;var o=Nb(n),i=o.name,s=o.value;if(t=t?Object.assign({},es,t):es,Fu(i))return null;try{s=t.decodeValues?decodeURIComponent(s):s}catch(c){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",c)}var a=Du();return a.name=i,a.value=s,r.forEach(function(c){var u=c.split("="),g=u.shift().trim().toLowerCase();if(!Fu(g)){var v=u.join("=").trim();if(g==="expires")a.expires=new Date(v);else if(g==="max-age"){var w=parseInt(v,10);Number.isNaN(w)||(a.maxAge=w)}else g==="secure"?a.secure=!0:g==="httponly"?a.httpOnly=!0:g==="samesite"?a.sameSite=v:g==="partitioned"?a.partitioned=!0:g&&(a[g]=v)}}),a}function Nb(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function Pn(e,t){if(t=t?Object.assign({},es,t):es,!e)return t.map?Du():[];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(s){return s.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(nf),n&&(e=e.map(ts).flat()),t.map){var i=Du();return e.reduce(function(s,a){var c=Mu(a,t);return c&&!Fu(c.name)&&(s[c.name]=c),s},i)}else return e.map(function(s){return Mu(s,t)}).filter(Boolean)}function ts(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,i,s,a;function c(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function u(){return o=e.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<e.length;){for(n=r,a=!1;c();)if(o=e.charAt(r),o===","){for(i=r,r+=1,c(),s=r;r<e.length&&u();)r+=1;r<e.length&&e.charAt(r)==="="?(a=!0,r=s,t.push(e.substring(n,i)),n=r):r=i+1}else r+=1;(!a||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var es,of=_n(()=>{"use strict";m();d();f();p();es={decodeValues:!0,map:!1,silent:!1,split:"auto"};Pn.parseSetCookie=Pn;Pn.parse=Pn;Pn.parseString=Mu;Pn.splitCookiesString=ts});function qo(e){if(Fb.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Lu(e){return e.replace(Db,"")}function Uo(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||!Mb(r))return!1}return!0}function Mb(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function af(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 Fb,sf,Db,cf,Nn,ju,uf,E,df=_n(()=>{"use strict";m();d();f();p();of();Fb=/[^a-z0-9\-#$%&'*+.^_`|~]/i;sf=[`
19
+ `,"\r","\t"," "],Db=new RegExp(`(^[${sf.join("")}]|$[${sf.join("")}])`,"g");Nn=Symbol("normalizedHeaders"),ju=Symbol("rawHeaderNames"),uf=", ",E=class lf{constructor(t){this[Nn]={},this[ju]=new Map,this[cf]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof lf||typeof b.Headers<"u"&&t instanceof b.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(uf):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(uf):n)})}[(cf=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[Nn]).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(!Uo(t))throw new TypeError(`Invalid header name "${t}"`);return this[Nn].hasOwnProperty(qo(t))}get(t){if(!Uo(t))throw TypeError(`Invalid header name "${t}"`);return this[Nn][qo(t)]??null}set(t,r){if(!Uo(t)||!af(r))return;let n=qo(t),o=Lu(r);this[Nn][n]=Lu(o),this[ju].set(n,t)}append(t,r){if(!Uo(t)||!af(r))return;let n=qo(t),o=Lu(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!Uo(t)||!this.has(t))return;let r=qo(t);delete this[Nn][r],this[ju].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===""?[""]:ts(t)}}});var m=_n(()=>{"use strict";df()});var pf=Ye(Vo=>{"use strict";m();d();f();p();var rs=Vo&&Vo.__assign||function(){return rs=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},rs.apply(this,arguments)};Object.defineProperty(Vo,"__esModule",{value:!0});var Lb={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function jb(e){var t=rs(rs({},Lb),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Vo.getSanitizedOptions=jb});var ff=Ye(qu=>{"use strict";m();d();f();p();Object.defineProperty(qu,"__esModule",{value:!0});function qb(e){var t=Math.random()*e;return Math.round(t)}qu.fullJitter=qb});var mf=Ye(Uu=>{"use strict";m();d();f();p();Object.defineProperty(Uu,"__esModule",{value:!0});function Ub(e){return e}Uu.noJitter=Ub});var gf=Ye(Vu=>{"use strict";m();d();f();p();Object.defineProperty(Vu,"__esModule",{value:!0});var Vb=ff(),Bb=mf();function Gb(e){return e.jitter==="full"?Vb.fullJitter:Bb.noJitter}Vu.JitterFactory=Gb});var Gu=Ye(Bu=>{"use strict";m();d();f();p();Object.defineProperty(Bu,"__esModule",{value:!0});var $b=gf(),Qb=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=$b.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}();Bu.Delay=Qb});var hf=Ye(rr=>{"use strict";m();d();f();p();var Hb=rr&&rr.__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)}}(),zb=rr&&rr.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(g){try{u(n.next(g))}catch(v){s(v)}}function c(g){try{u(n.throw(g))}catch(v){s(v)}}function u(g){g.done?i(g.value):o(g.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},Wb=rr&&rr.__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,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(g){return c([u,g])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(g){u=[6,g],o=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(rr,"__esModule",{value:!0});var Kb=Gu(),Yb=function(e){Hb(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return zb(this,void 0,void 0,function(){return Wb(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}(Kb.Delay);rr.SkipFirstDelay=Yb});var yf=Ye(Bo=>{"use strict";m();d();f();p();var Xb=Bo&&Bo.__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(Bo,"__esModule",{value:!0});var Zb=Gu(),Jb=function(e){Xb(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Zb.Delay);Bo.AlwaysDelay=Jb});var vf=Ye($u=>{"use strict";m();d();f();p();Object.defineProperty($u,"__esModule",{value:!0});var ew=hf(),tw=yf();function rw(e,t){var r=nw(e);return r.setAttemptNumber(t),r}$u.DelayFactory=rw;function nw(e){return e.delayFirstAttempt?new tw.AlwaysDelay(e):new ew.SkipFirstDelay(e)}});var Sf=Ye(qr=>{"use strict";m();d();f();p();var Qu=qr&&qr.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(g){try{u(n.next(g))}catch(v){s(v)}}function c(g){try{u(n.throw(g))}catch(v){s(v)}}function u(g){g.done?i(g.value):o(g.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},Hu=qr&&qr.__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,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(g){return c([u,g])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(g){u=[6,g],o=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(qr,"__esModule",{value:!0});var ow=pf(),iw=vf();function sw(e,t){return t===void 0&&(t={}),Qu(this,void 0,void 0,function(){var r,n;return Hu(this,function(o){switch(o.label){case 0:return r=ow.getSanitizedOptions(t),n=new aw(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}qr.backOff=sw;var aw=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return Qu(this,void 0,void 0,function(){var t,r;return Hu(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 Qu(this,void 0,void 0,function(){var t;return Hu(this,function(r){switch(r.label){case 0:return t=iw.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var Ra=Ye((vd,Sd)=>{"use strict";m();d();f();p();(function(e,t){typeof vd=="object"&&typeof Sd<"u"?Sd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs=t()})(vd,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",s="hour",a="day",c="week",u="month",g="quarter",v="year",w="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+)?$/,S=/\[([^\]]+)]|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(O){var P=["th","st","nd","rd"],N=O%100;return"["+O+(P[(N-20)%10]||P[N]||P[0])+"]"}},I=function(O,P,N){var Q=String(O);return!Q||Q.length>=P?O:""+Array(P+1-Q.length).join(N)+O},_={s:I,z:function(O){var P=-O.utcOffset(),N=Math.abs(P),Q=Math.floor(N/60),$=N%60;return(P<=0?"+":"-")+I(Q,2,"0")+":"+I($,2,"0")},m:function O(P,N){if(P.date()<N.date())return-O(N,P);var Q=12*(N.year()-P.year())+(N.month()-P.month()),$=P.clone().add(Q,u),Y=N-$<0,K=P.clone().add(Q+(Y?-1:1),u);return+(-(Q+(N-$)/(Y?$-K:K-$))||0)},a:function(O){return O<0?Math.ceil(O)||0:Math.floor(O)},p:function(O){return{M:u,y:v,w:c,d:a,D:w,h:s,m:i,s:o,ms:n,Q:g}[O]||String(O||"").toLowerCase().replace(/s$/,"")},u:function(O){return O===void 0}},R="en",T={};T[R]=x;var k="$isDayjsObject",F=function(O){return O instanceof j||!(!O||!O[k])},V=function O(P,N,Q){var $;if(!P)return R;if(typeof P=="string"){var Y=P.toLowerCase();T[Y]&&($=Y),N&&(T[Y]=N,$=Y);var K=P.split("-");if(!$&&K.length>1)return O(K[0])}else{var H=P.name;T[H]=P,$=H}return!Q&&$&&(R=$),$||!Q&&R},U=function(O,P){if(F(O))return O.clone();var N=typeof P=="object"?P:{};return N.date=O,N.args=arguments,new j(N)},L=_;L.l=V,L.i=F,L.w=function(O,P){return U(O,{locale:P.$L,utc:P.$u,x:P.$x,$offset:P.$offset})};var j=function(){function O(N){this.$L=V(N.locale,null,!0),this.parse(N),this.$x=this.$x||N.x||{},this[k]=!0}var P=O.prototype;return P.parse=function(N){this.$d=function(Q){var $=Q.date,Y=Q.utc;if($===null)return new Date(NaN);if(L.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var K=$.match(y);if(K){var H=K[2]-1||0,J=(K[7]||"0").substring(0,3);return Y?new Date(Date.UTC(K[1],H,K[3]||1,K[4]||0,K[5]||0,K[6]||0,J)):new Date(K[1],H,K[3]||1,K[4]||0,K[5]||0,K[6]||0,J)}}return new Date($)}(N),this.init()},P.init=function(){var N=this.$d;this.$y=N.getFullYear(),this.$M=N.getMonth(),this.$D=N.getDate(),this.$W=N.getDay(),this.$H=N.getHours(),this.$m=N.getMinutes(),this.$s=N.getSeconds(),this.$ms=N.getMilliseconds()},P.$utils=function(){return L},P.isValid=function(){return this.$d.toString()!==h},P.isSame=function(N,Q){var $=U(N);return this.startOf(Q)<=$&&$<=this.endOf(Q)},P.isAfter=function(N,Q){return U(N)<this.startOf(Q)},P.isBefore=function(N,Q){return this.endOf(Q)<U(N)},P.$g=function(N,Q,$){return L.u(N)?this[Q]:this.set($,N)},P.unix=function(){return Math.floor(this.valueOf()/1e3)},P.valueOf=function(){return this.$d.getTime()},P.startOf=function(N,Q){var $=this,Y=!!L.u(Q)||Q,K=L.p(N),H=function(pe,de){var he=L.w($.$u?Date.UTC($.$y,de,pe):new Date($.$y,de,pe),$);return Y?he:he.endOf(a)},J=function(pe,de){return L.w($.toDate()[pe].apply($.toDate("s"),(Y?[0,0,0,0]:[23,59,59,999]).slice(de)),$)},se=this.$W,be=this.$M,Ne=this.$D,Ie="set"+(this.$u?"UTC":"");switch(K){case v:return Y?H(1,0):H(31,11);case u:return Y?H(1,be):H(0,be+1);case c:var ke=this.$locale().weekStart||0,_e=(se<ke?se+7:se)-ke;return H(Y?Ne-_e:Ne+(6-_e),be);case a:case w:return J(Ie+"Hours",0);case s:return J(Ie+"Minutes",1);case i:return J(Ie+"Seconds",2);case o:return J(Ie+"Milliseconds",3);default:return this.clone()}},P.endOf=function(N){return this.startOf(N,!1)},P.$set=function(N,Q){var $,Y=L.p(N),K="set"+(this.$u?"UTC":""),H=($={},$[a]=K+"Date",$[w]=K+"Date",$[u]=K+"Month",$[v]=K+"FullYear",$[s]=K+"Hours",$[i]=K+"Minutes",$[o]=K+"Seconds",$[n]=K+"Milliseconds",$)[Y],J=Y===a?this.$D+(Q-this.$W):Q;if(Y===u||Y===v){var se=this.clone().set(w,1);se.$d[H](J),se.init(),this.$d=se.set(w,Math.min(this.$D,se.daysInMonth())).$d}else H&&this.$d[H](J);return this.init(),this},P.set=function(N,Q){return this.clone().$set(N,Q)},P.get=function(N){return this[L.p(N)]()},P.add=function(N,Q){var $,Y=this;N=Number(N);var K=L.p(Q),H=function(be){var Ne=U(Y);return L.w(Ne.date(Ne.date()+Math.round(be*N)),Y)};if(K===u)return this.set(u,this.$M+N);if(K===v)return this.set(v,this.$y+N);if(K===a)return H(1);if(K===c)return H(7);var J=($={},$[i]=t,$[s]=r,$[o]=e,$)[K]||1,se=this.$d.getTime()+N*J;return L.w(se,this)},P.subtract=function(N,Q){return this.add(-1*N,Q)},P.format=function(N){var Q=this,$=this.$locale();if(!this.isValid())return $.invalidDate||h;var Y=N||"YYYY-MM-DDTHH:mm:ssZ",K=L.z(this),H=this.$H,J=this.$m,se=this.$M,be=$.weekdays,Ne=$.months,Ie=$.meridiem,ke=function(de,he,fe,Ve){return de&&(de[he]||de(Q,Y))||fe[he].slice(0,Ve)},_e=function(de){return L.s(H%12||12,de,"0")},pe=Ie||function(de,he,fe){var Ve=de<12?"AM":"PM";return fe?Ve.toLowerCase():Ve};return Y.replace(S,function(de,he){return he||function(fe){switch(fe){case"YY":return String(Q.$y).slice(-2);case"YYYY":return L.s(Q.$y,4,"0");case"M":return se+1;case"MM":return L.s(se+1,2,"0");case"MMM":return ke($.monthsShort,se,Ne,3);case"MMMM":return ke(Ne,se);case"D":return Q.$D;case"DD":return L.s(Q.$D,2,"0");case"d":return String(Q.$W);case"dd":return ke($.weekdaysMin,Q.$W,be,2);case"ddd":return ke($.weekdaysShort,Q.$W,be,3);case"dddd":return be[Q.$W];case"H":return String(H);case"HH":return L.s(H,2,"0");case"h":return _e(1);case"hh":return _e(2);case"a":return pe(H,J,!0);case"A":return pe(H,J,!1);case"m":return String(J);case"mm":return L.s(J,2,"0");case"s":return String(Q.$s);case"ss":return L.s(Q.$s,2,"0");case"SSS":return L.s(Q.$ms,3,"0");case"Z":return K}return null}(de)||K.replace(":","")})},P.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},P.diff=function(N,Q,$){var Y,K=this,H=L.p(Q),J=U(N),se=(J.utcOffset()-this.utcOffset())*t,be=this-J,Ne=function(){return L.m(K,J)};switch(H){case v:Y=Ne()/12;break;case u:Y=Ne();break;case g:Y=Ne()/3;break;case c:Y=(be-se)/6048e5;break;case a:Y=(be-se)/864e5;break;case s:Y=be/r;break;case i:Y=be/t;break;case o:Y=be/e;break;default:Y=be}return $?Y:L.a(Y)},P.daysInMonth=function(){return this.endOf(u).$D},P.$locale=function(){return T[this.$L]},P.locale=function(N,Q){if(!N)return this.$L;var $=this.clone(),Y=V(N,Q,!0);return Y&&($.$L=Y),$},P.clone=function(){return L.w(this.$d,this)},P.toDate=function(){return new Date(this.valueOf())},P.toJSON=function(){return this.isValid()?this.toISOString():null},P.toISOString=function(){return this.$d.toISOString()},P.toString=function(){return this.$d.toUTCString()},O}(),M=j.prototype;return U.prototype=M,[["$ms",n],["$s",o],["$m",i],["$H",s],["$W",a],["$M",u],["$y",v],["$D",w]].forEach(function(O){M[O[1]]=function(P){return this.$g(P,O[0],O[1])}}),U.extend=function(O,P){return O.$i||(O(P,j,U),O.$i=!0),U},U.locale=V,U.isDayjs=F,U.unix=function(O){return U(1e3*O)},U.en=T[R],U.Ls=T,U.p={},U})});var Fh=Ye((Ad,bd)=>{"use strict";m();d();f();p();(function(e,t){typeof Ad=="object"&&typeof bd<"u"?bd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_quarterOfYear=t()})(Ad,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(a){return this.$utils().u(a)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(a-1))};var i=o.add;o.add=function(a,c){return a=Number(a),this.$utils().p(c)===t?this.add(3*a,e):i.bind(this)(a,c)};var s=o.startOf;o.startOf=function(a,c){var u=this.$utils(),g=!!u.u(c)||c;if(u.p(a)===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 s.bind(this)(a,c)}}})});var Dh=Ye((wd,Cd)=>{"use strict";m();d();f();p();(function(e,t){typeof wd=="object"&&typeof Cd<"u"?Cd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_customParseFormat=t()})(wd,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]+/,s={},a=function(y){return(y=+y)+(y>68?1900:2e3)},c=function(y){return function(S){this[y]=+S}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(S){if(!S||S==="Z")return 0;var x=S.match(/([+-]|\d\d)/g),I=60*x[1]+(+x[2]||0);return I===0?0:x[0]==="+"?-I:I}(y)}],g=function(y){var S=s[y];return S&&(S.indexOf?S:S.s.concat(S.f))},v=function(y,S){var x,I=s.meridiem;if(I){for(var _=1;_<=24;_+=1)if(y.indexOf(I(_,0,S))>-1){x=_>12;break}}else x=y===(S?"pm":"PM");return x},w={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,c("seconds")],ss:[o,c("seconds")],m:[o,c("minutes")],mm:[o,c("minutes")],H:[o,c("hours")],h:[o,c("hours")],HH:[o,c("hours")],hh:[o,c("hours")],D:[o,c("day")],DD:[n,c("day")],Do:[i,function(y){var S=s.ordinal,x=y.match(/\d+/);if(this.day=x[0],S)for(var I=1;I<=31;I+=1)S(I).replace(/\[|\]/g,"")===y&&(this.day=I)}],w:[o,c("week")],ww:[n,c("week")],M:[o,c("month")],MM:[n,c("month")],MMM:[i,function(y){var S=g("months"),x=(g("monthsShort")||S.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 S=g("months").indexOf(y)+1;if(S<1)throw new Error;this.month=S%12||S}],Y:[/[+-]?\d+/,c("year")],YY:[n,function(y){this.year=a(y)}],YYYY:[/\d{4}/,c("year")],Z:u,ZZ:u};function h(y){var S,x;S=y,x=s&&s.formats;for(var I=(y=S.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(U,L,j){var M=j&&j.toUpperCase();return L||x[j]||e[j]||x[M].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(O,P,N){return P||N.slice(1)})})).match(t),_=I.length,R=0;R<_;R+=1){var T=I[R],k=w[T],F=k&&k[0],V=k&&k[1];I[R]=V?{regex:F,parser:V}:T.replace(/^\[|\]$/g,"")}return function(U){for(var L={},j=0,M=0;j<_;j+=1){var O=I[j];if(typeof O=="string")M+=O.length;else{var P=O.regex,N=O.parser,Q=U.slice(M),$=P.exec(Q)[0];N.call(L,$),U=U.replace($,"")}}return function(Y){var K=Y.afternoon;if(K!==void 0){var H=Y.hours;K?H<12&&(Y.hours+=12):H===12&&(Y.hours=0),delete Y.afternoon}}(L),L}}return function(y,S,x){x.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(a=y.parseTwoDigitYear);var I=S.prototype,_=I.parse;I.parse=function(R){var T=R.date,k=R.utc,F=R.args;this.$u=k;var V=F[1];if(typeof V=="string"){var U=F[2]===!0,L=F[3]===!0,j=U||L,M=F[2];L&&(M=F[2]),s=this.$locale(),!U&&M&&(s=x.Ls[M]),this.$d=function(Q,$,Y,K){try{if(["x","X"].indexOf($)>-1)return new Date(($==="X"?1e3:1)*Q);var H=h($)(Q),J=H.year,se=H.month,be=H.day,Ne=H.hours,Ie=H.minutes,ke=H.seconds,_e=H.milliseconds,pe=H.zone,de=H.week,he=new Date,fe=be||(J||se?1:he.getDate()),Ve=J||he.getFullYear(),ze=0;J&&!se||(ze=se>0?se-1:he.getMonth());var _t,gt=Ne||0,Ut=Ie||0,bt=ke||0,Ot=_e||0;return pe?new Date(Date.UTC(Ve,ze,fe,gt,Ut,bt,Ot+60*pe.offset*1e3)):Y?new Date(Date.UTC(Ve,ze,fe,gt,Ut,bt,Ot)):(_t=new Date(Ve,ze,fe,gt,Ut,bt,Ot),de&&(_t=K(_t).week(de).toDate()),_t)}catch{return new Date("")}}(T,V,k,x),this.init(),M&&M!==!0&&(this.$L=this.locale(M).$L),j&&T!=this.format(V)&&(this.$d=new Date("")),s={}}else if(V instanceof Array)for(var O=V.length,P=1;P<=O;P+=1){F[1]=V[P-1];var N=x.apply(this,F);if(N.isValid()){this.$d=N.$d,this.$L=N.$L,this.init();break}P===O&&(this.$d=new Date(""))}else _.call(this,R)}}})});var Ry=Ye((jd,qd)=>{"use strict";m();d();f();p();(function(e,t){typeof jd=="object"&&typeof qd<"u"?qd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_timezone=t()})(jd,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,s=function(g,v,w){w===void 0&&(w={});var h=new Date(g),y=function(S,x){x===void 0&&(x={});var I=x.timeZoneName||"short",_=S+"|"+I,R=t[_];return R||(R=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:S,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:I}),t[_]=R),R}(v,w);return y.formatToParts(h)},a=function(g,v){for(var w=s(g,v),h=[],y=0;y<w.length;y+=1){var S=w[y],x=S.type,I=S.value,_=e[x];_>=0&&(h[_]=parseInt(I,10))}var R=h[3],T=R===24?0:R,k=h[0]+"-"+h[1]+"-"+h[2]+" "+T+":"+h[4]+":"+h[5]+":000",F=+g;return(o.utc(k).valueOf()-(F-=F%1e3))/6e4},c=n.prototype;c.tz=function(g,v){if(g===void 0&&(g=i),!this.isValid())return this;var w,h=this.utcOffset(),y=this.toDate(),S=y.toLocaleString("en-US",{timeZone:g}),x=a(+y,g);if(!Number(x))w=this.utcOffset(0,v);else if(w=o(S,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(x,!0),v){var I=w.utcOffset();w=w.add(h-I,"minute")}return w.$x.$timezone=g,w},c.offsetName=function(g){var v=this.$x.$timezone||o.tz.guess(),w=s(this.valueOf(),v,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return w&&w.value};var u=c.startOf;c.startOf=function(g,v){if(!this.$x||!this.$x.$timezone)return u.call(this,g,v);var w=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return u.call(w,g,v).tz(this.$x.$timezone,!0)},o.tz=function(g,v,w){var h=w&&v,y=w||v||i,S=a(+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(F,V,U){var L=F-60*V*1e3,j=a(L,U);if(V===j)return[L,V];var M=a(L-=60*(j-V)*1e3,U);return j===M?[L,j]:[F-60*Math.min(j,M)*1e3,Math.max(j,M)]}(x,S,y),R=_[0],T=_[1],k=o(R).utcOffset(T);return k.$x.$timezone=y,k},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var Ty=Ye((Ud,Vd)=>{"use strict";m();d();f();p();(function(e,t){typeof Ud=="object"&&typeof Vd<"u"?Vd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_utc=t()})(Ud,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,i){var s=o.prototype;i.utc=function(h){var y={date:h,utc:!0,args:arguments};return new o(y)},s.utc=function(h){var y=i(this.toDate(),{locale:this.$L,utc:!0});return h?y.add(this.utcOffset(),e):y},s.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var a=s.parse;s.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),a.call(this,h)};var c=s.init;s.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 c.call(this)};var u=s.utcOffset;s.utcOffset=function(h,y){var S=this.$utils().u;if(S(h))return this.$u?0:S(this.$offset)?u.call(this):this.$offset;if(typeof h=="string"&&(h=function(R){R===void 0&&(R="");var T=R.match(t);if(!T)return null;var k=(""+T[0]).match(r)||["-",0,0],F=k[0],V=60*+k[1]+ +k[2];return V===0?0:F==="+"?V:-V}(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=s.format;s.format=function(h){var y=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,y)},s.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},s.isUTC=function(){return!!this.$u},s.toISOString=function(){return this.toDate().toISOString()},s.toString=function(){return this.toDate().toUTCString()};var v=s.toDate;s.toDate=function(h){return h==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var w=s.diff;s.diff=function(h,y,S){if(h&&this.$u===h.$u)return w.call(this,h,y,S);var x=this.local(),I=i(h).local();return w.call(x,I,y,S)}}})});var wA=Ye((ice,bA)=>{"use strict";m();d();f();p();function NO(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}bA.exports=FO;function FO(e,t,r){var n=r&&r.stringify||NO,o=1;if(typeof e=="object"&&e!==null){var i=t.length+o;if(i===1)return e;var s=new Array(i);s[0]=n(e);for(var a=1;a<i;a++)s[a]=n(t[a]);return s.join(" ")}if(typeof e!="string")return e;var c=t.length;if(c===0)return e;for(var u="",g=1-o,v=-1,w=e&&e.length||0,h=0;h<w;){if(e.charCodeAt(h)===37&&h+1<w){switch(v=v>-1?v:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=c||t[g]==null)break;v<h&&(u+=e.slice(v,h)),u+=Number(t[g]),v=h+2,h++;break;case 105:if(g>=c||t[g]==null)break;v<h&&(u+=e.slice(v,h)),u+=Math.floor(Number(t[g])),v=h+2,h++;break;case 79:case 111:case 106:if(g>=c||t[g]===void 0)break;v<h&&(u+=e.slice(v,h));var y=typeof t[g];if(y==="string"){u+="'"+t[g]+"'",v=h+2,h++;break}if(y==="function"){u+=t[g].name||"<anonymous>",v=h+2,h++;break}u+=n(t[g]),v=h+2,h++;break;case 115:if(g>=c)break;v<h&&(u+=e.slice(v,h)),u+=String(t[g]),v=h+2,h++;break;case 37:v<h&&(u+=e.slice(v,h)),u+="%",v=h+2,h++,g--;break}++g}++h}return v===-1?e:(v<w&&(u+=e.slice(v)),u)}});var kA=Ye((lce,Au)=>{"use strict";m();d();f();p();var CA=wA();Au.exports=gr;var Wi=KO().console||{},DO={mapHttpRequest:Su,mapHttpResponse:Su,wrapRequestSerializer:jp,wrapResponseSerializer:jp,wrapErrorSerializer:jp,req:Su,res:Su,err:EA,errWithCause:EA};function Mr(e,t){return e==="silent"?1/0:t.levels.values[e]}var Vp=Symbol("pino.logFuncs"),qp=Symbol("pino.hierarchy"),MO={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function xA(e,t){let r={logger:t,parent:e[qp]};t[qp]=r}function LO(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Wi[o]||Wi[MO[o]||"log"]||Po}),e[Vp]=n}function jO(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function gr(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||Wi;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=jO(e.browser.serialize,n),i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);let s=Object.keys(e.customLevels||{}),a=["error","fatal","warn","info","debug","trace"].concat(s);typeof r=="function"&&a.forEach(function(S){r[S]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let c=e.level||"info",u=Object.create(r);u.log||(u.log=Po),LO(u,a,r),xA({},u),Object.defineProperty(u,"levelVal",{get:v}),Object.defineProperty(u,"level",{get:w,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:a,timestamp:HO(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Po};u.levels=qO(e),u.level=c,u.isLevelEnabled=function(S){return this.levels.values[S]?this.levels.values[S]>=this.levels.values[this.level]:!1},u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Po,u.serializers=n,u._serialize=o,u._stdErrSerialize=i,u.child=function(...S){return y.call(this,g,...S)},t&&(u._logEvent=Up());function v(){return Mr(this.level,this)}function w(){return this._level}function h(S){if(S!=="silent"&&!this.levels.values[S])throw Error("unknown level "+S);this._level=S,Tn(this,g,u,"error"),Tn(this,g,u,"fatal"),Tn(this,g,u,"warn"),Tn(this,g,u,"info"),Tn(this,g,u,"debug"),Tn(this,g,u,"trace"),s.forEach(x=>{Tn(this,g,u,x)})}function y(S,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 R=Object.assign({},n,_),T=e.browser.serialize===!0?Object.keys(R):o;delete x.serializers,Bp([x],T,R,this._stdErrSerialize)}function k(V){this._childLevel=(V._childLevel|0)+1,this.bindings=x,R&&(this.serializers=R,this._serialize=T),t&&(this._logEvent=Up([].concat(V._logEvent.bindings,x)))}k.prototype=this;let F=new k(this);return xA(this,F),F.child=function(...V){return y.call(this,S,...V)},F.level=I.level||this.level,S.onChild(F),F}return u}function qO(e){let t=e.customLevels||{},r=Object.assign({},gr.levels.values,t),n=Object.assign({},gr.levels.labels,UO(t));return{values:r,labels:n}}function UO(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}gr.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"}};gr.stdSerializers=DO;gr.stdTimeFunctions=Object.assign({},{nullTime:RA,epochTime:TA,unixTime:zO,isoTime:WO});function VO(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[qp];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Tn(e,t,r,n){if(Object.defineProperty(e,n,{value:Mr(e.level,r)>Mr(n,r)?Po:r[Vp][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===Po){if(!t.transmit)return;let i=t.transmit.level||e.level,s=Mr(i,r);if(Mr(n,r)<s)return}e[n]=GO(e,t,r,n);let o=VO(e);o.length!==0&&(e[n]=BO(o,e[n]))}function BO(e,t){return function(){return t.apply(this,[...e,...arguments])}}function GO(e,t,r,n){return function(o){return function(){let s=t.timestamp(),a=new Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Wi?Wi:this;for(var u=0;u<a.length;u++)a[u]=arguments[u];var g=!1;if(t.serialize&&(Bp(a,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let v=$O(this,n,a,s,t);if(t.reportCaller&&v&&v.length>0&&v[0]&&typeof v[0]=="object")try{let w=IA();w&&(v[0].caller=w)}catch{}o.call(c,...v)}else{if(t.reportCaller)try{let v=IA();v&&a.push(v)}catch{}o.apply(c,a)}if(t.transmit){let v=t.transmit.level||e._level,w=Mr(v,r),h=Mr(n,r);if(h<w)return;QO(this,{ts:s,methodLevel:n,methodValue:h,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Mr(e._level,r)},a,g)}}}(e[Vp][n])}function $O(e,t,r,n,o){let{level:i,log:s=v=>v}=o.formatters||{},a=r.slice(),c=a[0],u={},g=(e._childLevel|0)+1;if(g<1&&(g=1),n&&(u.time=n),i){let v=i(t,e.levels.values[t]);Object.assign(u,v)}else u.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(c!==null&&typeof c=="object")for(;g--&&typeof a[0]=="object";)Object.assign(u,a.shift());return[s(u),...a]}else{if(c!==null&&typeof c=="object"){for(;g--&&typeof a[0]=="object";)Object.assign(u,a.shift());c=a.length?CA(a.shift(),a):void 0}else typeof c=="string"&&(c=CA(a.shift(),a));return c!==void 0&&(u[o.messageKey]=c),[s(u)]}}function Bp(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=gr.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 QO(e,t,r,n=!1){let o=t.send,i=t.ts,s=t.methodLevel,a=t.methodValue,c=t.val,u=e._logEvent.bindings;n||Bp(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 u.indexOf(g)===-1}),e._logEvent.level.label=s,e._logEvent.level.value=a,o(s,e._logEvent,c),e._logEvent=Up(u)}function Up(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function EA(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 HO(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?RA:TA}function Su(){return{}}function jp(e){return e}function Po(){}function RA(){return!1}function TA(){return Date.now()}function zO(){return Math.round(Date.now()/1e3)}function WO(){return new Date(Date.now()).toISOString()}function KO(){function e(t){return typeof t<"u"&&t}try{return typeof b<"u"?b:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),b)}catch{return e(self)||e(window)||e(this)||{}}}Au.exports.default=gr;Au.exports.pino=gr;function IA(){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],s=o[2],a=o[3];return i+":"+s+":"+a}}return null}});var AP={};Xi(AP,{ResultTemplatesHelpers:()=>Kh,buildCaseAssistEngine:()=>DA,buildCaseField:()=>YA,buildCaseInput:()=>XA,buildController:()=>tr,buildDocumentSuggestion:()=>$p,buildDocumentSuggestionList:()=>$p,buildInteractiveResult:()=>JA,buildQuickview:()=>nb,getAnalyticsNextApiBaseUrl:()=>os,getOrganizationEndpoint:()=>ot,loadCaseAssistAnalyticsActions:()=>hP,loadCaseFieldActions:()=>yP,loadCaseInputActions:()=>vP,loadDocumentSuggestionActions:()=>SP,loadGenericAnalyticsActions:()=>gP});module.exports=gb(AP);m();d();f();p();m();d();f();p();var If=Pt(Sf(),1);m();d();f();p();var wt=new Error("Failed to load reducers."),Fn=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."}},Ur=class extends Error{constructor(r,n){super();oe(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 Af(e){return Array.isArray(e)}function bf(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}var cw=new Set(["1",1,"yes",!0]);function zu(){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=>cw.has(r))}function wf(e){let t={};for(let[r,n]of e)t[r]=n;return t}function Go(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function ns(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)}}m();d();f();p();function Cf(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function xf(e){return typeof e!="object"||!e?!1:Object.values(e).every(uw)}function uw(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Ef(e){return e===429}var yr=class e{static call(t){return _asyncToGenerator(function*(){let r=lw(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:i,...s}=o,a=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let c=yield C(i,s);if(Ef(c.status))throw c;return c});return function a(){return _ref.apply(this,arguments)}}();try{let c=yield(0,If.backOff)(a,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(u){let g=u&&Ef(u.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(c.status){case 419:case 401:throw n.info("Platform renewing token"),new Fn;case 404:throw new Ur(i,c.status);default:return n.info({response:c,requestInfo:o},"Platform response"),c}}catch(c){return c.message==="Failed to fetch"?new Ur(i):c}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:s}=r,{signal:a,...c}=t,u=Go(c);try{let g=yield o(t,n,s);return{...t,...g}}catch(g){i.error(g,"Platform request preprocessing failed. Returning default request options.")}return u})()}};function ot(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Dn(e,t,r="prod"){return e??ot(t,r)}function Mn(e,t="prod"){return`${ot(e,t)}/rest/search/v2`}function os(e,t="prod"){return`${ot(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function lw(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:s}=e,a=e.method==="POST"||e.method==="PUT",c=dw(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(a&&{body:c}),signal:s}}function dw(e,t){return t==="application/x-www-form-urlencoded"?xf(e)?Cf(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();function pw(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 Hu(r)}var Hu=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Nt=class{constructor(e){oe(this,"definition");this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let i=this.definition[o].validate(r[o]);i&&n.push(`${o}: ${i}`)}if(n.length)throw uw(n,t);return r}get default(){let e={};for(let t in this.definition){let r=this.definition[t].default;r!==void 0&&(e[t]=r)}return e}},Vr=class{constructor(e={}){oe(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&ce(e)?"value is required.":null}get default(){return this.baseConfig.default instanceof Function?this.baseConfig.default():this.baseConfig.default}get required(){return this.baseConfig.required===!0}};function Ln(e){return e===void 0}function lw(e){return e===null}function ce(e){return Ln(e)||lw(e)}var je=class{constructor(e={}){oe(this,"value");this.value=new Vr(e)}validate(e){let t=this.value.validate(e);return t||(dw(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function dw(e){return Ln(e)||xf(e)}function xf(e){return typeof e=="boolean"}var Le=class{constructor(e={}){oe(this,"config");oe(this,"value");this.config=e,this.value=new Vr(e)}validate(e){let t=this.value.validate(e);return t||(pw(e)?e<this.config.min?`minimum value of ${this.config.min} not respected.`:e>this.config.max?`maximum value of ${this.config.max} not respected.`:null:"value is not a number.")}get default(){return this.value.default}get required(){return this.value.required}};function pw(e){return Ln(e)||Ef(e)}function Ef(e){return typeof e=="number"&&!Number.isNaN(e)}var fw=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,re=class{constructor(e={}){oe(this,"value");oe(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Vr(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:i}=this.config,s=this.value.validate(e);if(s)return s;if(Ln(e))return null;if(!If(e))return"value is not a string.";if(!t&&!e.length)return"value is an empty string.";if(r)try{new URL(e)}catch{return"value is not a valid URL."}return n&&!n.test(e)?`value did not match provided regex ${n}`:o&&!o.includes(e)?`value should be one of: ${o.join(", ")}.`:i&&!(fw.test(e)&&new Date(e).toString()!=="Invalid Date")?"value is not a valid ISO8601 date string":null}get default(){return this.value.default}get required(){return this.value.required}};function If(e){return Object.prototype.toString.call(e)==="[object String]"}var xe=class{constructor(e={}){oe(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Ln(e))return this.config.options.required?"value is required and is currently undefined":null;if(!Rf(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ce(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],i=n.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function Rf(e){return e!==void 0&&typeof e=="object"}var Ft=class{constructor(e={}){oe(this,"config");oe(this,"value");this.config=e,this.value=new Vr(this.config)}validate(e){if(!ce(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ce(e))return null;if(this.config.max!==void 0&&e.length>this.config.max)return`value contains more than ${this.config.max}`;if(this.config.min!==void 0&&e.length<this.config.min)return`value contains less than ${this.config.min}`;if(this.config.each!==void 0){let r="";return e.forEach(n=>{this.config.each.required&&ce(n)&&(r=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(n,this.config.each);o!==null&&(r+=` ${o}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return xf(e)||If(e)||Ef(e)||Rf(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Tf(e){return Array.isArray(e)}var zu=class{constructor(e){oe(this,"config");oe(this,"value");this.config=e,this.value=new Vr(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Ln(e)||Object.values(this.config.enum).find(n=>n===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();f();p();var is=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();var jn=class{constructor(t){oe(this,"_basePath");oe(this,"_params",{});this._basePath=t}addParam(t,r){this._params={...this.params,[t]:r}}get basePath(){return this._basePath}get params(){return this._params}get hasParams(){return Object.entries(this._params).length}get href(){return this.hasParams?`${this.basePath}?${Object.entries(this.params).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}`:this.basePath}};m();d();f();p();function Wu(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Ku=e=>{let{response:t}=e;return t.body?mw(e):gw(t)},mw=e=>yw(e)?vw(e):hw(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},gw=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function hw(e){return e.body.statusCode!==void 0}function yw(e){return e.body.exception!==void 0}var vw=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();function kf(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var Yu=(e,t,r,n)=>{let o=new jn(`${e.url}${n}`);return o.addParam("organizationId",e.organizationId),e.authentication&&o.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:o.href,origin:"searchApiFetch"}};var _f=(e,t)=>{let r=new jn(`${e.url}${t}`);return r.addParam("access_token",e.accessToken),r.addParam("organizationId",e.organizationId),r.addParam("uniqueId",e.uniqueId),e.authentication&&r.addParam("authentication",e.authentication),e.q!==void 0&&r.addParam("q",e.q),e.enableNavigation!==void 0&&r.addParam("enableNavigation",`${e.enableNavigation}`),e.requestedOutputSize!==void 0&&r.addParam("requestedOutputSize",`${e.requestedOutputSize}`),r.href},Xu=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield yr.call({...Yu(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Wu(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=kf(r),o=yield r.arrayBuffer(),s=new TextDecoder(n).decode(o);return Sw(s)?{success:s}:{error:Ku({response:r,body:s})}});return function Xu(_x3,_x4){return _ref3.apply(this,arguments)}}();function Sw(e){return typeof e=="string"}m();d();f();p();function Aw(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function bw(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function ss(e,t){if(t&&e.name==="AbortError")return{error:bw(e)};if(e instanceof Ur)return{error:Aw(e)};throw e}m();d();f();p();m();d();f();p();var as=(e,t,r,n,o={})=>{ww(e);let i=`${e.url}/rest/organizations/${e.organizationId}/caseassists/${e.caseAssistId}${n}`,s=Cw(o),a=s?`${i}?${s}`:i;return{accessToken:e.accessToken,method:t,contentType:r,url:a,origin:"caseAssistApiFetch"}},cs=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r],t),{}),us=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r].value,t),{}),ww=e=>{if(!e.url)throw new Error("The 'url' attribute must contain a valid platform URL.");if(!e.organizationId)throw new Error("The 'organizationId' attribute must contain a valid organization ID.");if(!e.accessToken)throw new Error("The 'accessToken' attribute must contain a valid platform access token.");if(!e.caseAssistId)throw new Error("The 'caseAssistId' attribute must contain a valid Case Assist configuration ID.")},Cw=e=>Object.keys(e).map(t=>`${t}=${encodeURIComponent(e[t])}`).join("&");var Of=e=>{let t=e.debug?{debug:"1"}:{};return{...as(e,"POST","application/json","/classify",t),requestParams:xw(e)}},xw=e=>({clientId:e.clientId,locale:e.locale,fields:cs(e.fields)});m();d();f();p();var Pf=e=>{let t={};return e.debug&&(t.debug="1"),e.numberOfResults&&(t.numberOfResults=e.numberOfResults.toString()),{...as(e,"POST","application/json","/documents/suggest",t),requestParams:Ew(e)}},Ew=e=>({clientId:e.clientId,locale:e.locale,fields:cs(e.fields),context:e.context,analytics:e.analytics});var ls=class{constructor(t){oe(this,"options",t)}getCaseClassifications(t){var _this=this;return _asyncToGenerator(function*(){let r=yield yr.call({...Of(t),..._this.options});if(r instanceof Error)return ss(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}getDocumentSuggestions(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield yr.call({...Pf(t),..._this2.options});if(r instanceof Error)return ss(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this3=this;return _asyncToGenerator(function*(){return Xu(t,_this3.options)})()}};m();d();f();p();m();d();f();p();m();d();f();p();function Xe(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Iw=typeof Symbol=="function"&&Symbol.observable||"@@observable",Nf=Iw,Zu=()=>Math.random().toString(36).substring(7).split("").join("."),Rw={INIT:`@@redux/INIT${Zu()}`,REPLACE:`@@redux/REPLACE${Zu()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Zu()}`},ds=Rw;function Vt(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Ju(e,t,r){if(typeof e!="function")throw new Error(Xe(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Xe(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Xe(1));return r(Ju)(e,t)}let n=e,o=t,i=new Map,s=i,a=0,c=!1;function u(){s===i&&(s=new Map,i.forEach((x,I)=>{s.set(I,x)}))}function g(){if(c)throw new Error(Xe(3));return o}function v(x){if(typeof x!="function")throw new Error(Xe(4));if(c)throw new Error(Xe(5));let I=!0;u();let _=a++;return s.set(_,x),function(){if(I){if(c)throw new Error(Xe(6));I=!1,u(),s.delete(_),i=null}}}function w(x){if(!Vt(x))throw new Error(Xe(7));if(typeof x.type>"u")throw new Error(Xe(8));if(typeof x.type!="string")throw new Error(Xe(17));if(c)throw new Error(Xe(9));try{c=!0,o=n(o,x)}finally{c=!1}return(i=s).forEach(_=>{_()}),x}function h(x){if(typeof x!="function")throw new Error(Xe(10));n=x,w({type:ds.REPLACE})}function y(){let x=v;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(Xe(11));function _(){let T=I;T.next&&T.next(g())}return _(),{unsubscribe:x(_)}},[Nf](){return this}}}return w({type:ds.INIT}),{dispatch:w,subscribe:v,getState:g,replaceReducer:h,[Nf]:y}}function Tw(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:ds.INIT})>"u")throw new Error(Xe(12));if(typeof r(void 0,{type:ds.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Xe(13))})}function qn(e){let t=Object.keys(e),r={};for(let s=0;s<t.length;s++){let a=t[s];typeof e[a]=="function"&&(r[a]=e[a])}let n=Object.keys(r),o,i;try{Tw(r)}catch(s){i=s}return function(a={},c){if(i)throw i;let u=!1,g={};for(let v=0;v<n.length;v++){let w=n[v],h=r[w],y=a[w],S=h(y,c);if(typeof S>"u"){let x=c&&c.type;throw new Error(Xe(14))}g[w]=S,u=u||S!==y}return u=u||n.length!==Object.keys(a).length,u?g:a}}function Go(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Ff(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(Xe(15))},s={getState:o.getState,dispatch:(c,...u)=>i(c,...u)},a=e.map(c=>c(s));return i=Go(...a)(o.dispatch),{...o,dispatch:i}}}function $o(e){return Vt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var cl=Symbol.for("immer-nothing"),Qo=Symbol.for("immer-draftable"),$e=Symbol.for("immer-state");function Ze(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ht=Object,Gr=ht.getPrototypeOf,Ho="constructor",Xo="prototype",rl="configurable",gs="enumerable",fs="writable",zo="value",ct=e=>!!e&&!!e[$e];function it(e){return e?Bf(e)||Jo(e)||!!e[Qo]||!!e[Ho]?.[Qo]||ei(e)||ti(e):!1}var kw=ht[Xo][Ho].toString(),Df=new WeakMap;function Bf(e){if(!e||!Vn(e))return!1;let t=Gr(e);if(t===null||t===ht[Xo])return!0;let r=ht.hasOwnProperty.call(t,Ho)&&t[Ho];if(r===Object)return!0;if(!Br(r))return!1;let n=Df.get(r);return n===void 0&&(n=Function.toString.call(r),Df.set(r,n)),n===kw}function Gf(e){return ct(e)||Ze(15,e),e[$e].base_}function Zo(e,t,r=!0){$r(e)===0?(r?Reflect.ownKeys(e):ht.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function $r(e){let t=e[$e];return t?t.type_:Jo(e)?1:ei(e)?2:ti(e)?3:0}var Un=(e,t,r=$r(e))=>r===2?e.has(t):ht[Xo].hasOwnProperty.call(e,t),nr=(e,t,r=$r(e))=>r===2?e.get(t):e[t],hs=(e,t,r,n=$r(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function _w(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Jo=Array.isArray,ei=e=>e instanceof Map,ti=e=>e instanceof Set,Vn=e=>typeof e=="object",Br=e=>typeof e=="function",el=e=>typeof e=="boolean";function Ow(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Pw=e=>Vn(e)?e?.[$e]:null,or=e=>e.copy_||e.base_;var ul=e=>e.modified_?e.copy_:e.base_;function nl(e,t){if(ei(e))return new Map(e);if(ti(e))return new Set(e);if(Jo(e))return Array[Xo].slice.call(e);let r=Bf(e);if(t===!0||t==="class_only"&&!r){let n=ht.getOwnPropertyDescriptors(e);delete n[$e];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let s=o[i],a=n[s];a[fs]===!1&&(a[fs]=!0,a[rl]=!0),(a.get||a.set)&&(n[s]={[rl]:!0,[fs]:!0,[gs]:a[gs],[zo]:e[s]})}return ht.create(Gr(e),n)}else{let n=Gr(e);if(n!==null&&r)return{...e};let o=ht.create(n);return ht.assign(o,e)}}function ll(e,t=!1){return ws(e)||ct(e)||!it(e)||($r(e)>1&&ht.defineProperties(e,{set:ps,add:ps,clear:ps,delete:ps}),ht.freeze(e),t&&Zo(e,(r,n)=>{ll(n,!0)},!1)),e}function Nw(){Ze(2)}var ps={[zo]:Nw};function ws(e){return e===null||!Vn(e)?!0:ht.isFrozen(e)}var ys="MapSet",vs="Patches",Mf="ArrayMethods",Ss={};function Qr(e){let t=Ss[e];return t||Ze(0,e),t}var Lf=e=>!!Ss[e];function Fw(e,t){Ss[e]||(Ss[e]=t)}var Wo,$f=()=>Wo,Dw=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Lf(ys)?Qr(ys):void 0,arrayMethodsPlugin_:Lf(Mf)?Qr(Mf):void 0});function jf(e,t){t&&(e.patchPlugin_=Qr(vs),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ol(e){il(e),e.drafts_.forEach(Mw),e.drafts_=null}function il(e){e===Wo&&(Wo=e.parent_)}var qf=e=>Wo=Dw(Wo,e);function Mw(e){let t=e[$e];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Uf(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[$e].modified_&&(ol(t),Ze(4)),it(e)&&(e=Vf(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[$e].base_,e,t)}else e=Vf(t,r);return Lw(t,e,!0),ol(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==cl?e:void 0}function Vf(e,t){if(ws(t))return t;let r=t[$e];if(!r)return As(t,e.handledSet_,e);if(!Cs(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){let{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);zf(r,e)}return r.copy_}function Lw(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ll(t,r)}function Qf(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Cs=(e,t)=>e.scope_===t,jw=[];function Hf(e,t,r,n){let o=or(e),i=e.type_;if(n!==void 0&&nr(o,n,i)===t){hs(o,n,r,i);return}if(!e.draftLocations_){let a=e.draftLocations_=new Map;Zo(o,(c,u)=>{if(ct(u)){let g=a.get(u)||[];g.push(c),a.set(u,g)}})}let s=e.draftLocations_.get(t)??jw;for(let a of s)hs(o,a,r,i)}function qw(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!Cs(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let s=ul(i);Hf(e,i.draft_??i,s,r),zf(i,o)})}function zf(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let o=n.getPath(e);o&&n.generatePatches_(e,o,t)}Qf(e)}}function Uw(e,t,r){let{scope_:n}=e;if(ct(r)){let o=r[$e];Cs(o,n)&&o.callbacks_.push(function(){ms(e);let s=ul(o);Hf(e,r,s,t)})}else it(r)&&e.callbacks_.push(function(){let i=or(e);e.type_===3?i.has(r)&&As(r,n.handledSet_,n):nr(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&As(nr(e.copy_,t,e.type_),n.handledSet_,n)})}function As(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||ct(e)||t.has(e)||!it(e)||ws(e)||(t.add(e),Zo(e,(n,o)=>{if(ct(o)){let i=o[$e];if(Cs(i,r)){let s=ul(i);hs(e,n,s,e.type_),Qf(i)}}else it(o)&&As(o,t,r)})),e}function Vw(e,t){let r=Jo(e),n={type_:r?1:0,scope_:t?t.scope_:$f(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=n,i=bs;r&&(o=[n],i=Ko);let{revoke:s,proxy:a}=Proxy.revocable(o,i);return n.draft_=a,n.revoke_=s,[a,n]}var bs={get(e,t){if(t===$e)return e;let r=e.scope_.arrayMethodsPlugin_,n=e.type_===1&&typeof t=="string";if(n&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let o=or(e);if(!Un(o,t,e.type_))return Gw(e,o,t);let i=o[t];if(e.finalized_||!it(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Ow(t))return i;if(i===tl(e.base_,t)||Bw(e,t,i)){ms(e);let s=e.type_===1?+t:t,a=al(e.scope_,i,e,s);return e.copy_[s]=a}return i},has(e,t){return t in or(e)},ownKeys(e){return Reflect.ownKeys(or(e))},set(e,t,r){let n=Wf(or(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=tl(or(e),t),i=o?.[$e];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(_w(r,o)&&(r!==void 0||Un(e.base_,t,e.type_)))return!0;ms(e),sl(e)}return e.copy_[t]===r&&(r!==void 0||Un(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Uw(e,t,r)),!0},deleteProperty(e,t){return ms(e),tl(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),sl(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=or(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[fs]:!0,[rl]:e.type_!==1||t!=="length",[gs]:n[gs],[zo]:r[t]}},defineProperty(){Ze(11)},getPrototypeOf(e){return Gr(e.base_)},setPrototypeOf(){Ze(12)}},Ko={};for(let e in bs){let t=bs[e];Ko[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Ko.deleteProperty=function(e,t){return Ko.set.call(this,e,t,void 0)};Ko.set=function(e,t,r){return bs.set.call(this,e[0],t,r,e[0])};function tl(e,t){let r=e[$e];return(r?or(r):e)[t]}function Bw(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!it(r)||r[$e]?!1:e.baseRefs_.has(r)}function Gw(e,t,r){let n=Wf(t,r);return n?zo in n?n[zo]:n.get?.call(e.draft_):void 0}function Wf(e,t){if(!(t in e))return;let r=Gr(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Gr(r)}}function sl(e){e.modified_||(e.modified_=!0,e.parent_&&sl(e.parent_))}function ms(e){e.copy_||(e.assigned_=new Map,e.copy_=nl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var $w=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Br(t)&&!Br(r)){let i=r;r=t;let s=this;return function(c=i,...u){return s.produce(c,g=>r.call(this,g,...u))}}Br(r)||Ze(6),n!==void 0&&!Br(n)&&Ze(7);let o;if(it(t)){let i=qf(this),s=al(i,t,void 0),a=!0;try{o=r(s),a=!1}finally{a?ol(i):il(i)}return jf(i,n),Uf(o,i)}else if(!t||!Vn(t)){if(o=r(t),o===void 0&&(o=t),o===cl&&(o=void 0),this.autoFreeze_&&ll(o,!0),n){let i=[],s=[];Qr(vs).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:s}),n(i,s)}return o}else Ze(1,t)},this.produceWithPatches=(t,r)=>{if(Br(t))return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let n,o;return[this.produce(t,r,(s,a)=>{n=s,o=a}),n,o]},el(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),el(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),el(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){it(e)||Ze(8),ct(e)&&(e=xs(e));let t=qf(this),r=al(t,e,void 0);return r[$e].isManual_=!0,il(t),r}finishDraft(e,t){let r=e&&e[$e];(!r||!r.isManual_)&&Ze(9);let{scope_:n}=r;return jf(n,t),Uf(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let o=t[r];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}r>-1&&(t=t.slice(r+1));let n=Qr(vs).applyPatches_;return ct(e)?n(e,t):this.produce(e,o=>n(o,t))}};function al(e,t,r,n){let[o,i]=ei(t)?Qr(ys).proxyMap_(t,r):ti(t)?Qr(ys).proxySet_(t,r):Vw(t,r);return(r?.scope_??$f()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?qw(r,i,n):i.callbacks_.push(function(c){c.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:u}=c;i.modified_&&u&&u.generatePatches_(i,[],c)}),o}function xs(e){return ct(e)||Ze(10,e),Kf(e)}function Kf(e){if(!it(e)||ws(e))return e;let t=e[$e],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=nl(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=nl(e,!0);return Zo(r,(o,i)=>{hs(r,o,Kf(i))},n),t&&(t.finalized_=!1),r}function Yf(){function t(y,S=[]){if(y.key_!==void 0){let x=y.parent_.copy_??y.parent_.base_,I=Pw(nr(x,y.key_)),_=nr(x,y.key_);if(_===void 0||_!==y.draft_&&_!==y.base_&&_!==y.copy_||I!=null&&I.base_!==y.base_)return null;let R=y.parent_.type_===3,T;if(R){let k=y.parent_;T=Array.from(k.drafts_.keys()).indexOf(y.key_)}else T=y.key_;if(!(R&&x.size>T||Un(x,T)))return null;S.push(T)}if(y.parent_)return t(y.parent_,S);S.reverse();try{r(y.copy_,S)}catch{return null}return S}function r(y,S){let x=y;for(let I=0;I<S.length-1;I++){let _=S[I];if(x=nr(x,_),!Vn(x)||x===null)throw new Error(`Cannot resolve path at '${S.join("/")}'`)}return x}let n="replace",o="add",i="remove";function s(y,S,x){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:I,inversePatches_:_}=x;switch(y.type_){case 0:case 2:return c(y,S,I,_);case 1:return a(y,S,I,_);case 3:return u(y,S,I,_)}}function a(y,S,x,I){let{base_:_,assigned_:R}=y,T=y.copy_;T.length<_.length&&([_,T]=[T,_],[x,I]=[I,x]);let k=y.allIndicesReassigned_===!0;for(let F=0;F<_.length;F++){let V=T[F],U=_[F];if((k||R?.get(F.toString()))&&V!==U){let j=V?.[$e];if(j&&j.modified_)continue;let M=S.concat([F]);x.push({op:n,path:M,value:h(V)}),I.push({op:n,path:M,value:h(U)})}}for(let F=_.length;F<T.length;F++){let V=S.concat([F]);x.push({op:o,path:V,value:h(T[F])})}for(let F=T.length-1;_.length<=F;--F){let V=S.concat([F]);I.push({op:i,path:V})}}function c(y,S,x,I){let{base_:_,copy_:R,type_:T}=y;Zo(y.assigned_,(k,F)=>{let V=nr(_,k,T),U=nr(R,k,T),L=F?Un(_,k)?n:o:i;if(V===U&&L===n)return;let j=S.concat(k);x.push(L===i?{op:L,path:j}:{op:L,path:j,value:h(U)}),I.push(L===o?{op:i,path:j}:L===i?{op:o,path:j,value:h(V)}:{op:n,path:j,value:h(V)})})}function u(y,S,x,I){let{base_:_,copy_:R}=y,T=0;_.forEach(k=>{if(!R.has(k)){let F=S.concat([T]);x.push({op:i,path:F,value:k}),I.unshift({op:o,path:F,value:k})}T++}),T=0,R.forEach(k=>{if(!_.has(k)){let F=S.concat([T]);x.push({op:o,path:F,value:k}),I.unshift({op:i,path:F,value:k})}T++})}function g(y,S,x){let{patches_:I,inversePatches_:_}=x;I.push({op:n,path:[],value:S===cl?void 0:S}),_.push({op:n,path:[],value:y})}function v(y,S){return S.forEach(x=>{let{path:I,op:_}=x,R=y;for(let V=0;V<I.length-1;V++){let U=$r(R),L=I[V];typeof L!="string"&&typeof L!="number"&&(L=""+L),(U===0||U===1)&&(L==="__proto__"||L===Ho)&&Ze(19),Br(R)&&L===Xo&&Ze(19),R=nr(R,L),(R===null||!Vn(R))&&Ze(18,I.join("/"))}let T=$r(R),k=w(x.value),F=I[I.length-1];switch(_){case n:switch(T){case 2:return R.set(F,k);case 3:Ze(16);default:return R[F]=k}case o:switch(T){case 1:return F==="-"?R.push(k):R.splice(F,0,k);case 2:return R.set(F,k);case 3:return R.add(k);default:return R[F]=k}case i:switch(T){case 1:return R.splice(F,1);case 2:return R.delete(F);case 3:return R.delete(x.value);default:return delete R[F]}default:Ze(17,_)}}),y}function w(y){if(!it(y))return y;if(Jo(y))return y.map(w);if(ei(y))return new Map(Array.from(y.entries()).map(([x,I])=>[x,w(I)]));if(ti(y))return new Set(Array.from(y).map(w));let S=Object.create(Gr(y));for(let x in y)S[x]=w(y[x]);return Un(y,Qo)&&(S[Qo]=y[Qo]),S}function h(y){return ct(y)?w(y):y}Fw(vs,{applyPatches_:v,generatePatches_:s,generateReplacementPatches_:g,getPath:t})}var Qw=b.Iterator,PD=typeof Qw?.from=="function";var Yo=new $w,Hr=Yo.produce,dl=Yo.produceWithPatches.bind(Yo);var pl=Yo.applyPatches.bind(Yo);m();d();f();p();function Hw(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function zw(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){let r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var Xf=e=>Array.isArray(e)?e:[e];function Ww(e){let t=Array.isArray(e[0])?e[0]:e;return zw(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Kw(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var Yw=class{constructor(e){this.value=e}deref(){return this.value}},Xw=()=>typeof WeakRef>"u"?Yw:WeakRef,Jf=Xw(),Zw=0,Zf=1;function Es(){return{s:Zw,v:void 0,o:null,p:null}}function Jw(e){return e instanceof Jf?e.deref():e}function ri(e,t={}){let r=Es(),{resultEqualityCheck:n}=t,o,i=0;function s(){let a=r,{length:c}=arguments;for(let v=0,w=c;v<w;v++){let h=arguments[v];if(typeof h=="function"||typeof h=="object"&&h!==null){let y=a.o;y===null&&(a.o=y=new WeakMap);let S=y.get(h);S===void 0?(a=Es(),y.set(h,a)):a=S}else{let y=a.p;y===null&&(a.p=y=new Map);let S=y.get(h);S===void 0?(a=Es(),y.set(h,a)):a=S}}let u=a,g;if(a.s===Zf)g=a.v;else if(g=e.apply(null,arguments),i++,n){let v=Jw(o);v!=null&&n(v,g)&&(g=v,i!==0&&i--),o=typeof g=="object"&&g!==null||typeof g=="function"?new Jf(g):g}return u.s=Zf,u.v=g,g}return s.clearCache=()=>{r=Es(),s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function eC(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,s=0,a,c={},u=o.pop();typeof u=="object"&&(c=u,u=o.pop()),Hw(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);let g={...r,...c},{memoize:v,memoizeOptions:w=[],argsMemoize:h=ri,argsMemoizeOptions:y=[]}=g,S=Xf(w),x=Xf(y),I=Ww(o),_=v(function(){return i++,u.apply(null,arguments)},...S),R=!0,T=h(function(){s++;let F=Kw(I,arguments);return a=_.apply(null,F),a},...x);return Object.assign(T,{resultFunc:u,memoizedResultFunc:_,dependencies:I,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>a,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var Ue=eC(ri);m();d();f();p();function em(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var tm=em(),rm=em;var tC=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Go:Go.apply(null,arguments)},rM=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},rC=e=>e&&typeof e.match=="function";function B(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(ut(0));return{type:e,payload:o.payload,...("meta"in o&&{meta:o.meta}),...("error"in o&&{error:o.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>$o(n)&&n.type===e,r}var lm=class ni extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,ni.prototype)}static get[Symbol.species](){return ni}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new ni(...t[0].concat(this)):new ni(...t.concat(this))}};function nm(e){return it(e)?Hr(e,()=>{}):e}function Is(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function nC(e){return typeof e=="boolean"}var oC=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},s=new lm;return r&&(nC(r)?s.push(tm):s.push(rm(r.extraArgument))),s},oi="RTK_autoBatch",$n=()=>e=>({payload:e,meta:{[oi]:!0}}),om=e=>t=>{setTimeout(t,e)},iC=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(i),clearTimeout(s),r())},i=e(o),s=setTimeout(o,t)},sC=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,s=!1,a=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?iC(window.requestAnimationFrame,100):om(10):e.type==="callback"?e.queueNotification:om(e.timeout),u=()=>{s=!1,i&&(i=!1,a.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let v=()=>o&&g(),w=n.subscribe(v);return a.add(g),()=>{w(),a.delete(g)}},dispatch(g){try{return o=!g?.meta?.[oi],i=!o,i&&(s||(s=!0,c(u))),n.dispatch(g)}finally{o=!0}}})},aC=e=>function(r){let{autoBatch:n=!0}=r??{},o=new lm(e);return n&&o.push(sC(typeof n=="object"?n:void 0)),o};function dm(e){let t=oC(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:s=void 0,enhancers:a=void 0}=e||{},c;if(typeof r=="function")c=r;else if(Vt(r))c=qn(r);else throw new Error(ut(1));let u;typeof n=="function"?u=n(t):u=t();let g=Go;o&&(g=tC({trace:!1,...(typeof o=="object"&&o)}));let v=Ff(...u),w=aC(v),h=typeof a=="function"?a(w):w(),y=g(...h);return Ju(c,s,y)}function pm(e){let t={},r=[],n,o={addCase(i,s){let a=typeof i=="string"?i:i.type;if(!a)throw new Error(ut(28));if(a in t)throw new Error(ut(29));return t[a]=s,o},addAsyncThunk(i,s){return s.pending&&(t[i.pending.type]=s.pending),s.rejected&&(t[i.rejected.type]=s.rejected),s.fulfilled&&(t[i.fulfilled.type]=s.fulfilled),s.settled&&r.push({matcher:i.settled,reducer:s.settled}),o},addMatcher(i,s){return r.push({matcher:i,reducer:s}),o},addDefaultCase(i){return n=i,o}};return e(o),[t,r,n]}function cC(e){return typeof e=="function"}function Qe(e,t){let[r,n,o]=pm(t),i;if(cC(e))i=()=>nm(e());else{let a=nm(e);i=()=>a}function s(a=i(),c){let u=[r[c.type],...n.filter(({matcher:g})=>g(c)).map(({reducer:g})=>g)];return u.filter(g=>!!g).length===0&&(u=[o]),u.reduce((g,v)=>{if(v)if(ct(g)){let h=v(g,c);return h===void 0?g:h}else{if(it(g))return Hr(g,w=>v(w,c));{let w=v(g,c);if(w===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return w}}return g},a)}return s.getInitialState=i,s}var fm=(e,t)=>rC(e)?e.match(t):e(t);function Bt(...e){return t=>e.some(r=>fm(r,t))}function Gn(...e){return t=>e.every(r=>fm(r,t))}function _s(e,t){if(!e||!e.meta)return!1;let r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function ii(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Os(...e){return e.length===0?t=>_s(t,["pending"]):ii(e)?Bt(...e.map(t=>t.pending)):Os()(e[0])}function Wr(...e){return e.length===0?t=>_s(t,["rejected"]):ii(e)?Bt(...e.map(t=>t.rejected)):Wr()(e[0])}function si(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Gn(Wr(...e),t):ii(e)?Gn(Wr(...e),t):si()(e[0])}function ir(...e){return e.length===0?t=>_s(t,["fulfilled"]):ii(e)?Bt(...e.map(t=>t.fulfilled)):ir()(e[0])}function Ps(...e){return e.length===0?t=>_s(t,["pending","fulfilled","rejected"]):ii(e)?Bt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Ps()(e[0])}var uC="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",ai=(e=21)=>{let t="",r=e;for(;r--;)t+=uC[Math.random()*64|0];return t},lC=["name","message","stack","code"],fl=class{constructor(e,t){oe(this,"payload");oe(this,"meta");oe(this,"_type");this.payload=e,this.meta=t}},im=class{constructor(e,t){oe(this,"payload");oe(this,"meta");oe(this,"_type");this.payload=e,this.meta=t}},dC=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of lC)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},sm="External signal was aborted",Ce=(()=>{function e(t,r,n){let o=B(t+"/fulfilled",(c,u,g,v)=>({payload:c,meta:{...(v||{}),arg:g,requestId:u,requestStatus:"fulfilled"}})),i=B(t+"/pending",(c,u,g)=>({payload:void 0,meta:{...(g||{}),arg:u,requestId:c,requestStatus:"pending"}})),s=B(t+"/rejected",(c,u,g,v,w)=>({payload:v,error:(n&&n.serializeError||dC)(c||"Rejected"),meta:{...(w||{}),arg:g,requestId:u,rejectedWithValue:!!v,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function a(c,{signal:u}={}){return(g,v,w)=>{let h=n?.idGenerator?n.idGenerator(c):ai(),y=new l.AbortController,S,x;function I(R){x=R,y.abort()}u&&(u.aborted?I(sm):u.addEventListener("abort",()=>I(sm),{once:!0}));let _=_asyncToGenerator(function*(){let R;try{let k=n?.condition?.(c,{getState:v,extra:w});if(fC(k)&&(k=yield k),k===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let F=new Promise((V,U)=>{S=()=>{U({name:"AbortError",message:x||"Aborted"})},y.signal.addEventListener("abort",S,{once:!0})});g(i(h,c,n?.getPendingMeta?.({requestId:h,arg:c},{getState:v,extra:w}))),R=yield Promise.race([F,Promise.resolve(r(c,{dispatch:g,getState:v,extra:w,requestId:h,signal:y.signal,abort:I,rejectWithValue:(V,U)=>new fl(V,U),fulfillWithValue:(V,U)=>new im(V,U)})).then(V=>{if(V instanceof fl)throw V;return V instanceof im?o(V.payload,h,c,V.meta):o(V,h,c)})])}catch(k){R=k instanceof fl?s(null,h,c,k.payload,k.meta):s(k,h,c)}finally{S&&y.signal.removeEventListener("abort",S)}return n&&!n.dispatchConditionRejection&&s.match(R)&&R.meta.condition||g(R),R})();return Object.assign(_,{abort:I,requestId:h,arg:c,unwrap(){return _.then(pC)}})}}return Object.assign(a,{pending:i,rejected:s,fulfilled:o,settled:Bt(s,o),typePrefix:t})}return e.withTypes=()=>e,e})();function pC(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function fC(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var mm=Symbol.for("rtk-slice-createasyncthunk"),oM={[mm]:Ce};function mC(e,t){return`${e}/${t}`}function gC({creators:e}={}){let t=e?.asyncThunk?.[mm];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(ut(11));typeof process<"u";let s=(typeof n.reducers=="function"?n.reducers(yC()):n.reducers)||{},a=Object.keys(s),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(R,T){let k=typeof R=="string"?R:R.type;if(!k)throw new Error(ut(12));if(k in c.sliceCaseReducersByType)throw new Error(ut(13));return c.sliceCaseReducersByType[k]=T,u},addMatcher(R,T){return c.sliceMatchers.push({matcher:R,reducer:T}),u},exposeAction(R,T){return c.actionCreators[R]=T,u},exposeCaseReducer(R,T){return c.sliceCaseReducersByName[R]=T,u}};a.forEach(R=>{let T=s[R],k={reducerName:R,type:mC(o,R),createNotation:typeof n.reducers=="function"};SC(T)?bC(k,T,u,t):vC(k,T,u)});function g(){let[R={},T=[],k=void 0]=typeof n.extraReducers=="function"?pm(n.extraReducers):[n.extraReducers],F={...R,...c.sliceCaseReducersByType};return Qe(n.initialState,V=>{for(let U in F)V.addCase(U,F[U]);for(let U of c.sliceMatchers)V.addMatcher(U.matcher,U.reducer);for(let U of T)V.addMatcher(U.matcher,U.reducer);k&&V.addDefaultCase(k)})}let v=R=>R,w=new Map,h=new WeakMap,y;function S(R,T){return y||(y=g()),y(R,T)}function x(){return y||(y=g()),y.getInitialState()}function I(R,T=!1){function k(V){let U=V[R];return typeof U>"u"&&T&&(U=Is(h,k,x)),U}function F(V=v){let U=Is(w,T,()=>new WeakMap);return Is(U,V,()=>{let L={};for(let[j,M]of Object.entries(n.selectors??{}))L[j]=hC(M,V,()=>Is(h,V,x),T);return L})}return{reducerPath:R,getSelectors:F,get selectors(){return F(k)},selectSlice:k}}let _={name:o,reducer:S,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:x,...I(i),injectInto(R,{reducerPath:T,...k}={}){let F=T??i;return R.inject({reducerPath:F,reducer:S},k),{..._,...I(F,!0)}}};return _}}function hC(e,t,r,n){function o(i,...s){let a=t(i);return typeof a>"u"&&n&&(a=r()),e(a,...s)}return o.unwrapped=e,o}var Kr=gC();function yC(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function vC({type:e,reducerName:t,createNotation:r},n,o){let i,s;if("reducer"in n){if(r&&!AC(n))throw new Error(ut(17));i=n.reducer,s=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?B(e,s):B(e))}function SC(e){return e._reducerDefinitionType==="asyncThunk"}function AC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function bC({type:e,reducerName:t},r,n,o){if(!o)throw new Error(ut(18));let{payloadCreator:i,fulfilled:s,pending:a,rejected:c,settled:u,options:g}=r,v=o(e,i,g);n.exposeAction(t,v),s&&n.addCase(v.fulfilled,s),a&&n.addCase(v.pending,a),c&&n.addCase(v.rejected,c),u&&n.addMatcher(v.settled,u),n.exposeCaseReducer(t,{fulfilled:s||Rs,pending:a||Rs,rejected:c||Rs,settled:u||Rs})}function Rs(){}var wC="task",gm="listener",hm="completed",hl="cancelled",CC=`task-${hl}`,xC=`task-${hm}`,ml=`${gm}-${hl}`,EC=`${gm}-${hm}`,Ns=class{constructor(e){oe(this,"code");oe(this,"name","TaskAbortError");oe(this,"message");this.code=e,this.message=`${wC} ${hl} (reason: ${e})`}},yl=(e,t)=>{if(typeof e!="function")throw new TypeError(ut(32))},Ts=()=>{},ym=(e,t=Ts)=>(e.catch(t),e),vm=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),zr=e=>{if(e.aborted)throw new Ns(e.reason)};function Sm(e,t){let r=Ts;return new Promise((n,o)=>{let i=()=>o(new Ns(e.reason));if(e.aborted){i();return}r=vm(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=Ts})}var IC=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof Ns?"cancelled":"rejected",error:r}}finally{t?.()}});return function IC(_x5,_x6){return _ref5.apply(this,arguments)}}(),ks=e=>t=>ym(Sm(e,t).then(r=>(zr(e),r))),Am=e=>{let t=ks(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Bn}=Object,am={},Fs="listenerMiddleware",RC=(e,t)=>{let r=n=>vm(e,()=>n.abort(e.reason));return(n,o)=>{yl(n,"taskExecutor");let i=new l.AbortController;r(i);let s=IC(/*#__PURE__*/_asyncToGenerator(function*(){zr(e),zr(i.signal);let a=yield n({pause:ks(i.signal),delay:Am(i.signal),signal:i.signal});return zr(i.signal),a}),()=>i.abort(xC));return o?.autoJoin&&t.push(s.catch(Ts)),{result:ks(e)(s),cancel(){i.abort(CC)}}}},TC=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){zr(t);let i=()=>{},a=[new Promise((c,u)=>{let g=e({predicate:n,effect:(v,w)=>{w.unsubscribe(),c([v,w.getState(),w.getOriginalState()])}});i=()=>{g(),u()}})];o!=null&&a.push(new Promise(c=>setTimeout(c,o,null)));try{let c=yield Sm(t,Promise.race(a));return zr(t),c}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>ym(r(n,o))},bm=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=B(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(ut(21));return yl(i,"options.listener"),{predicate:o,type:t,effect:i}},wm=Bn(e=>{let{type:t,predicate:r,effect:n}=bm(e);return{id:ai(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(ut(22))}}},{withTypes:()=>wm}),cm=(e,t)=>{let{type:r,effect:n,predicate:o}=bm(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},gl=e=>{e.pending.forEach(t=>{t.abort(ml)})},kC=(e,t)=>()=>{for(let r of t.keys())gl(r);e.clear()},um=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Cm=Bn(B(`${Fs}/add`),{withTypes:()=>Cm}),_C=B(`${Fs}/removeAll`),xm=Bn(B(`${Fs}/remove`),{withTypes:()=>xm}),OC=(...e)=>{console.error(`${Fs}/error`,...e)},Em=(e={})=>{let t=new Map,r=new Map,n=h=>{let y=r.get(h)??0;r.set(h,y+1)},o=h=>{let y=r.get(h)??1;y===1?r.delete(h):r.set(h,y-1)},{extra:i,onError:s=OC}=e;yl(s,"onError");let a=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&gl(h)}),c=h=>{let y=cm(t,h)??wm(h);return a(y)};Bn(c,{withTypes:()=>c});let u=h=>{let y=cm(t,h);return y&&(y.unsubscribe(),h.cancelActive&&gl(y)),!!y};Bn(u,{withTypes:()=>u});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,S,x){let I=new l.AbortController,_=TC(c,I.signal),R=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(y,Bn({},S,{getOriginalState:x,condition:(T,k)=>_(T,k).then(Boolean),take:_,delay:Am(I.signal),pause:ks(I.signal),extra:i,signal:I.signal,fork:RC(I.signal,R),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((T,k,F)=>{T!==I&&(T.abort(ml),F.delete(T))})},cancel:()=>{I.abort(ml),h.pending.delete(I)},throwIfCancelled:()=>{zr(I.signal)}})))}catch(T){T instanceof Ns||um(s,T,{raisedBy:"effect"})}finally{yield Promise.all(R),I.abort(EC),o(h),h.pending.delete(I)}});return function g(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),v=kC(t,r);return{middleware:h=>y=>S=>{if(!$o(S))return y(S);if(Cm.match(S))return c(S.payload);if(_C.match(S)){v();return}if(xm.match(S))return u(S.payload);let x=h.getState(),I=()=>{if(x===am)throw new Error(ut(23));return x},_;try{if(_=y(S),t.size>0){let R=h.getState(),T=Array.from(t.values());for(let k of T){let F=!1;try{F=k.predicate(S,R,x)}catch(V){F=!1,um(s,V,{raisedBy:"predicate"})}F&&g(k,S,h,I)}}}finally{x=am}return _},startListening:c,stopListening:u,clearListeners:v}};function ut(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}m();d();f();p();var ee=new re({required:!0,emptyAllowed:!1}),He=new re({required:!1,emptyAllowed:!1}),Dt=new re({required:!0,emptyAllowed:!0}),hM=new re({required:!1,emptyAllowed:!0}),Im=new Ft({each:ee,required:!0}),Rm=new re({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Tm=new re({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),yM=new re({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),PC=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),vl=(e,t)=>{if("required"in t)return{payload:new Nt({value:t}).validate({value:e}).value};let o=new xe({options:{required:!0},values:t}).validate(e);if(o)throw new Hu(o);return{payload:e}},W=(e,t)=>{try{return vl(e,t)}catch(r){return{payload:e,error:PC(r)}}};var Ds=(e,t,r,n)=>{let o=`Check the options of ${n}`;return NC(e,t,r,o,"Controller initialization error")},NC=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};var Ms=B("caseAssistConfiguration/set",e=>W(e,{caseAssistId:ee,locale:He,proxyBaseUrl:new re({required:!1,url:!0})}));m();d();f();p();m();d();f();p();var km=()=>({caseAssistId:"",locale:"en-US"});var vr=Qe(km(),e=>{e.addCase(Ms,(t,r)=>{t.caseAssistId=r.payload.caseAssistId,t.locale=r.payload.locale,t.apiBaseUrl=r.payload.proxyBaseUrl})});m();d();f();p();m();d();f();p();m();d();f();p();var _m={q:new re,enableQuerySyntax:new je,aq:new re,cq:new re,firstResult:new Le({min:0}),numberOfResults:new Le({min:0}),sortCriteria:new re,f:new xe,fExcluded:new xe,cf:new xe,nf:new xe,mnf:new xe,df:new xe,debug:new je,sf:new xe,tab:new re,af:new xe};var Ls=B("searchParameters/restore",e=>W(e,_m)),Om=B("searchParameters/restoreTab",e=>W(e,ee));m();d();f();p();var Pm=B("debug/enable"),Nm=B("debug/disable");m();d();f();p();var js=()=>!1;var Fm=Qe(js(),e=>{e.addCase(Pm,()=>!0).addCase(Nm,()=>!1).addCase(Ls,(t,r)=>r.payload.debug??t)});m();d();f();p();var qs=B("searchHub/set",e=>W(e,new re({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var Qn="3.55.4",Dm=["@coveo/atomic","@coveo/quantic"];var Sl=()=>He,Mm=()=>ee,Hn=B("configuration/updateBasicConfiguration",e=>W(e,{accessToken:He,environment:new re({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:He})),Us=B("configuration/updateSearchConfiguration",e=>W(e,{proxyBaseUrl:new re({required:!1,url:!0}),pipeline:new re({required:!1,emptyAllowed:!0}),searchHub:He,timezone:He,locale:He,authenticationProviders:new Ft({required:!1,each:ee})})),FC={enabled:new je({default:!0}),originContext:Sl(),originLevel2:Sl(),originLevel3:Sl(),proxyBaseUrl:new re({required:!1,url:!0}),runtimeEnvironment:new Vr,anonymous:new je({default:!1}),deviceId:He,userDisplayName:He,documentLocation:He,trackingId:Tm,analyticsMode:new re({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new xe({options:{required:!1},values:Dm.reduce((e,t)=>(e[t]=Rm,e),{})})},Vs=B("configuration/updateAnalyticsConfiguration",e=>W(e,FC)),Bs=B("configuration/analytics/disable"),Gs=B("configuration/analytics/enable"),Lm=B("configuration/analytics/originlevel2",e=>W(e,{originLevel2:Mm()})),jm=B("configuration/analytics/originlevel3",e=>W(e,{originLevel3:Mm()})),qm=B("knowledge/setAgentId",e=>W(e,new re({required:!0})));m();d();f();p();var DC=B("history/undo"),MC=B("history/redo"),Gt=B("history/snapshot"),zL=Ce("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(DC()),yield t($s())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),WL=Ce("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(MC()),yield t($s())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),$s=Ce("history/change",/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x15,_x16){return _ref1.apply(this,arguments)}}());m();d();f();p();var zn=()=>"default";var Um=Qe(zn(),e=>{e.addCase(qs,(t,r)=>r.payload).addCase($s.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Us,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function Vm(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}m();d();f();p();m();d();f();p();m();d();f();p();var Bm=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function LC(e){return typeof e=="string"&&Bm.test(e)}var Al=LC;m();d();f();p();var Je=[];for(let e=0;e<256;++e)Je.push((e+256).toString(16).slice(1));function Gm(e,t=0){return(Je[e[t+0]]+Je[e[t+1]]+Je[e[t+2]]+Je[e[t+3]]+"-"+Je[e[t+4]]+Je[e[t+5]]+"-"+Je[e[t+6]]+Je[e[t+7]]+"-"+Je[e[t+8]]+Je[e[t+9]]+"-"+Je[e[t+10]]+Je[e[t+11]]+Je[e[t+12]]+Je[e[t+13]]+Je[e[t+14]]+Je[e[t+15]]).toLowerCase()}m();d();f();p();var jC=new Uint8Array(16);function bl(){return crypto.getRandomValues(jC)}m();d();f();p();function qC(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():UC(e,t,r)}function UC(e,t,r){e=e||{};let n=e.random??e.rng?.()??bl();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return Gm(n)}var wl=qC;function VC(_x17){return _VC.apply(this,arguments)}function _VC(){_VC=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:i,mode:s}=e;if(s!=="disabled")return n.call(r),t.send(o,i,r)});return _VC.apply(this,arguments)}var Km="2.1.3",Cl=128,Ym=192,$m=224,Qm=240,BC=248;function GC(e){return(e&BC)===Qm?4:(e&Qm)===$m?3:(e&$m)===Ym?2:1}function $C(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&Cl)!=Cl)break;if(r-=3,(n&Ym)!=Cl){t-r>=GC(n)*3&&(r=t);break}}return e.substring(0,r)}function QC(e){let{trackingId:t}=e;return{trackingId:t}}function HC(e){return(e.source||[]).concat([`relay@${Km}`])}function Xm(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,s=QC(t),a=r.getClientId();return Object.freeze({type:e,config:s,ts:Date.now(),source:HC(t),clientId:a,userAgent:i(),referrer:Hm(n()),location:Hm(o())})}function Hm(e){return e!==null?$C(e,1024):null}function zC(e,t,r,n){return{...t,meta:Xm(e,r,n)}}var WC="*";function KC(){let e=[];function t({type:c,callback:u}){return e.findIndex(g=>g.type===c&&g.callback===u)}function r(c,u){return c.type==="*"||u===c.type}function n(c){return t(c)<0&&e.push(c),()=>a(c.type,c.callback)}function o(c){e.forEach(u=>{if(r(u,c.meta.type))try{u.callback(c)}catch(g){console.error(g)}})}function i(c){if(c===WC)e.length=0;else for(let u=e.length-1;u>=0;u--)e[u].type===c&&e.splice(u,1)}function s(c){let u=t(c);u>=0&&e.splice(u,1)}function a(c,u){u?s({type:c,callback:u}):i(c)}return{add:n,call:o,remove:a}}function zm({url:e,token:t,trackingId:r,...n}){return Object.freeze({url:e,token:t,trackingId:r,...(!!n.mode&&{mode:n.mode}),...(!!n.source&&{source:n.source}),...(!!n.environment&&{environment:n.environment})})}function YC(e){let t=zm(e);return{get:()=>t,update:r=>{t=zm({...t,...r})}}}var xl=XC();function XC(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,o=document.cookie.split(";");for(let i of o){let s=i.replace(/^\s+/,"");if(s.lastIndexOf(n,0)===0)return s.substring(n.length,s.length)}return null},setItem(r,n,o){let i=t(window.location.hostname),s=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,a=i?`;domain=${i}`:"";document.cookie=`${e}${r}=${n}${s}${a};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function ZC(){return{getItem(e){return xl.getItem(e)||localStorage.getItem(e)},removeItem(e){xl.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),xl.setItem(e,t,31556952e3)}}}var Wm="visitorId";function JC(){let e=document.referrer;return e===""?null:e}function El(){let e=ZC();return{runtime:"browser",send:function(){var _ref10=_asyncToGenerator(function*(t,r,n){let o=C(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});Vm().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let s=yield o;if(s?.ok){let a;try{a=yield s.json()}catch{return}for(let c of a.events)if(!c.accepted)throw new Error(`Received event was rejected for processing: ${c.errorMessage}`)}else throw new Error(`Error ${s.status}: Failed to send the event(s).`)});return function send(_x18,_x19,_x20){return _ref10.apply(this,arguments)}}(),getReferrer:()=>JC(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(Wm);if(t&&Al(t))return t;let r=wl();return e.setItem(Wm,r),r}}}function ex(){try{let e="__storage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return e instanceof DOMException&&e.name==="QuotaExceededError"&&localStorage&&localStorage.length!==0}}function tx(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function rx(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=tx();return t&&r?{...r,runtime:"custom"}:t&&nx()&&ex()?El():n}function nx(){try{return typeof window=="object"}catch{return!1}}function ox(e){return{get:()=>Object.freeze(rx(e))}}function Zm(e){let t=YC(e),r=KC(),n=ox(t);return{emit:function(){var _ref11=_asyncToGenerator(function*(o,i){let s=t.get(),a=n.get(),c=zC(o,i,s,a);return VC({config:s,environment:a,event:c,listenerManager:r})});return function emit(_x21,_x22){return _ref11.apply(this,arguments)}}(),getMeta:o=>Xm(o,t.get(),n.get()),on:(o,i)=>r.add({type:o,callback:i}),off:(o,i)=>r.remove(o,i),updateConfig:o=>t.update(o),version:Km}}m();d();f();p();function Jm(){return typeof window<"u"&&typeof document<"u"}m();d();f();p();var Wn=Ue(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Qn}`));var ci=Ue(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Wn(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},s,a)=>{let c=sx(a);return Zm({mode:i?"emit":"disabled",url:o??os(e,t),token:r,trackingId:n??null,source:s,environment:c})}),ix={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref12=_asyncToGenerator(function*(){});return function send(){return _ref12.apply(this,arguments)}}()},sx=e=>{if(!e)return;let t=e();return{...(Jm()?El():ix),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();m();d();f();p();m();d();f();p();var eg=class extends Error{constructor(t){super(t[0].message);oe(this,"issues");this.name="SchemaError",this.issues=t}};var ar="uninitialized",Tl="pending",li="fulfilled",di="rejected";function tg(e){return{status:e,isUninitialized:e===ar,isLoading:e===Tl,isSuccess:e===li,isError:e===di}}var rg=Vt;function hg(e,t){if(e===t||!(rg(e)&&rg(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),o=r.length===n.length,i=Array.isArray(t)?[]:{};for(let s of r)i[s]=hg(e[s],t[s]),o&&(o=e[s]===i[s]);return o?e:i}function kl(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function ax(e){return new RegExp("(^|:)//").test(e)}function cx(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Nl(e){return e!=null}function ng(e){return[...(e?.values()??[])].filter(Nl)}function ux(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var lx=e=>e.replace(/\/$/,""),dx=e=>e.replace(/^\//,"");function px(e,t){if(!e)return t;if(!t)return e;if(ax(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=lx(e),t=dx(t),`${e}${r}${t}`}function zs(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var _l=()=>new Map,fx=e=>{let t=new l.AbortController;return setTimeout(()=>{let r="signal timed out",n="TimeoutError";t.abort(typeof DOMException<"u"?new DOMException(r,n):Object.assign(new Error(r),{name:n}))},e),t.signal},mx=(...e)=>{for(let r of e)if(r.aborted)return l.AbortSignal.abort(r.reason);let t=new l.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},og=(...e)=>C(...e),gx=e=>e.status>=200&&e.status<=299,hx=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function ig(e){if(!Vt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var yx=e=>typeof e=="object"&&(Vt(e)||Array.isArray(e)||typeof e.toJSON=="function");function yg({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=og,paramsSerializer:n,isJsonContentType:o=hx,jsonContentType:i="application/json",jsonReplacer:s,timeout:a,responseHandler:c,validateStatus:u,...g}={}){return typeof C>"u"&&r===og&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*(w,h,y){let{getState:S,extra:x,endpoint:I,forced:_,type:R}=h,T,{url:k,headers:F=new E(g.headers),params:V=void 0,responseHandler:U=c??"json",validateStatus:L=u??gx,timeout:j=a,...M}=typeof w=="string"?{url:w}:w,O={...g,signal:j?mx(h.signal,fx(j)):h.signal,...M};F=new E(ig(F)),O.headers=(yield t(F,{getState:S,arg:w,extra:x,endpoint:I,forced:_,type:R,extraOptions:y}))||F;let P=yx(O.body);if(O.body!=null&&!P&&typeof O.body!="string"&&O.headers.delete("content-type"),!O.headers.has("content-type")&&P&&O.headers.set("content-type",i),P&&o(O.headers)&&(O.body=JSON.stringify(O.body,s)),O.headers.has("accept")||(U==="json"?O.headers.set("accept","application/json"):U==="text"&&O.headers.set("accept","text/plain, text/html, */*")),V){let J=~k.indexOf("?")?"&":"?",se=n?n(V):new URLSearchParams(ig(V));k+=J+se}k=px(e,k);let N=new Request(k,O);T={request:new Request(k,O)};let $;try{$=yield r(N)}catch(J){return{error:{status:(J instanceof Error||typeof DOMException<"u"&&J instanceof DOMException)&&J.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(J)},meta:T}}let Y=$.clone();T.response=Y;let K,H="";try{let J;if(yield Promise.all([v($,U).then(se=>K=se,se=>J=se),Y.text().then(se=>H=se,()=>{})]),J)throw J}catch(J){return{error:{status:"PARSING_ERROR",originalStatus:$.status,data:H,error:String(J)},meta:T}}return L($,K)?{data:K,meta:T}:{error:{status:$.status,data:K},meta:T}});return function(_x23,_x24,_x25){return _ref13.apply(this,arguments)}}());function v(_x26,_x27){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(w,h){if(typeof h=="function")return h(w);if(h==="content-type"&&(h=o(w.headers)?"json":"text"),h==="json"){let y=yield w.text();return y.length?JSON.parse(y):null}return w.text()});return _v2.apply(this,arguments)}}var Kn=class{constructor(e,t=void 0){oe(this,"value");oe(this,"meta");this.value=e,this.meta=t}};function vx(){return _vx.apply(this,arguments)}function _vx(){_vx=_asyncToGenerator(function*(e=0,t=5,r){let n=Math.min(e,t),o=~~((Math.random()+.4)*(300<<n));yield new Promise((i,s)=>{let a=setTimeout(()=>i(),o);if(r){let c=()=>{clearTimeout(a),s(new Error("Aborted"))};r.aborted?(clearTimeout(a),s(new Error("Aborted"))):r.addEventListener("abort",c,{once:!0})}})});return _vx.apply(this,arguments)}function vg(e,t){throw Object.assign(new Kn({error:e,meta:t}),{throwImmediately:!0})}function Il(e){e.aborted&&vg({status:"CUSTOM_ERROR",error:"Aborted"})}var sg={},Sx=(e,t)=>(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(r,n,o){let i=[5,(t||sg).maxRetries,(o||sg).maxRetries].filter(g=>g!==void 0),[s]=i.slice(-1),c={maxRetries:s,backoff:vx,retryCondition:(g,v,{attempt:w})=>w<=s,...t,...o},u=0;for(;;){Il(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Kn(g);return g}catch(g){if(u++,g.throwImmediately){if(g instanceof Kn)return g.value;throw g}if(g instanceof Kn){if(!c.retryCondition(g.value.error,r,{attempt:u,baseQueryApi:n,extraOptions:o}))return g.value}else if(u>c.maxRetries)return{error:g};Il(n.signal);try{yield c.backoff(u,c.maxRetries,n.signal)}catch(v){throw Il(n.signal),v}}}});return function(_x28,_x29,_x30){return _ref14.apply(this,arguments)}}()),Sg=Object.assign(Sx,{fail:vg}),Ks="__rtkq/",Ax="online",bx="offline";var Ag="focused";var Fl=B(`${Ks}${Ag}`),bg=B(`${Ks}un${Ag}`),Dl=B(`${Ks}${Ax}`),wg=B(`${Ks}${bx}`);var mi="query",Cg="mutation",xg="infinitequery";function Ys(e){return e.type===mi}function wx(e){return e.type===Cg}function Xs(e){return e.type===xg}function Ws(e){return Ys(e)||Xs(e)}function Ml(e,t,r,n,o,i){let s=Cx(e)?e(t,r,n,o):e;return s?kl(s,Nl,a=>i(Eg(a))):[]}function Cx(e){return typeof e=="function"}function Eg(e){return typeof e=="string"?{type:e}:e}function xx(e,t){return e.catch(t)}var Yn=(e,t)=>e.endpointDefinitions[t],pi=Symbol("forceQueryFn"),Ol=e=>typeof e[pi]=="function";function Ex({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:s}){let a=k=>s(k)?.runningQueries,c=k=>s(k)?.runningMutations,{unsubscribeQueryResult:u,removeMutationResult:g,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:_,buildInitiateInfiniteQuery:R,buildInitiateMutation:T,getRunningQueryThunk:w,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:S};function w(k,F){return V=>{let U=Yn(i,k),L=e({queryArgs:F,endpointDefinition:U,endpointName:k});return a(V)?.get(L)}}function h(k,F){return V=>c(V)?.get(F)}function y(){return k=>ng(a(k))}function S(){return k=>ng(c(k))}function x(k){}function I(k,F){let V=(U,{subscribe:L=!0,forceRefetch:j,subscriptionOptions:M,[pi]:O,...P}={})=>(N,Q)=>{let $=e({queryArgs:U,endpointDefinition:F,endpointName:k}),Y,K={...P,type:mi,subscribe:L,forceRefetch:j,subscriptionOptions:M,endpointName:k,originalArgs:U,queryCacheKey:$,[pi]:O};if(Ys(F))Y=t(K);else{let{direction:de,initialPageParam:he,refetchCachedPages:fe}=P;Y=r({...K,direction:de,initialPageParam:he,refetchCachedPages:fe})}let H=o.endpoints[k].select(U),J=N(Y),se=H(Q());let{requestId:be,abort:Ne}=J,Ie=se.requestId!==be,ke=a(N)?.get($),_e=()=>H(Q()),pe=Object.assign(O?J.then(_e):Ie&&!ke?Promise.resolve(se):Promise.all([ke,J]).then(_e),{arg:U,requestId:be,subscriptionOptions:M,queryCacheKey:$,abort:Ne,unwrap(){return _asyncToGenerator(function*(){let de=yield pe;if(de.isError)throw de.error;return de.data})()},refetch:de=>N(V(U,{subscribe:!1,forceRefetch:!0,...de})),unsubscribe(){L&&N(u({queryCacheKey:$,requestId:be}))},updateSubscriptionOptions(de){pe.subscriptionOptions=de,N(v({endpointName:k,requestId:be,queryCacheKey:$,options:de}))}});if(!ke&&!Ie&&!O){let de=a(N);de.set($,pe),pe.then(()=>{de.delete($)})}return pe};return V}function _(k,F){return I(k,F)}function R(k,F){return I(k,F)}function T(k){return(F,{track:V=!0,fixedCacheKey:U}={})=>(L,j)=>{let M=n({type:"mutation",endpointName:k,originalArgs:F,track:V,fixedCacheKey:U}),O=L(M);let{requestId:P,abort:N,unwrap:Q}=O,$=xx(O.unwrap().then(J=>({data:J})),J=>({error:J})),Y=()=>{L(g({requestId:P,fixedCacheKey:U}))},K=Object.assign($,{arg:O.arg,requestId:P,abort:N,unwrap:Q,reset:Y}),H=c(L);return H.set(P,K),K.then(()=>{H.delete(P)}),U&&(H.set(U,K),K.then(()=>{H.get(U)===K&&H.delete(U)})),K}}}var Ig=class extends eg{constructor(t,r,n,o){super(t);oe(this,"value");oe(this,"schemaName");oe(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},Yr=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function Xr(_x31,_x32,_x33,_x34){return _Xr.apply(this,arguments)}function _Xr(){_Xr=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new Ig(o.issues,t,r,n);return o.value});return _Xr.apply(this,arguments)}function ag(e){return e}var ui=(e={})=>({...e,[oi]:!0});function Ix({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:s,onSchemaFailure:a,catchSchemaFailure:c,skipSchemaValidation:u}){let g=(M,O,P,N)=>(Q,$)=>{let Y=r[M],K=n({queryArgs:O,endpointDefinition:Y,endpointName:M});if(Q(o.internalActions.queryResultPatched({queryCacheKey:K,patches:P})),!N)return;let H=o.endpoints[M].select(O)($()),J=Ml(Y.providesTags,H.data,void 0,O,{},i);Q(o.internalActions.updateProvidedBy([{queryCacheKey:K,providedTags:J}]))};function v(M,O,P=0){let N=[O,...M];return P&&N.length>P?N.slice(0,-1):N}function w(M,O,P=0){let N=[...M,O];return P&&N.length>P?N.slice(1):N}let h=(M,O,P,N=!0)=>(Q,$)=>{let K=o.endpoints[M].select(O)($()),H={patches:[],inversePatches:[],undo:()=>Q(o.util.patchQueryData(M,O,H.inversePatches,N))};if(K.status===ar)return H;let J;if("data"in K)if(it(K.data)){let[se,be,Ne]=dl(K.data,P);H.patches.push(...be),H.inversePatches.push(...Ne),J=se}else J=P(K.data),H.patches.push({op:"replace",path:[],value:J}),H.inversePatches.push({op:"replace",path:[],value:K.data});return H.patches.length===0||Q(o.util.patchQueryData(M,O,H.patches,N)),H},y=(M,O,P)=>N=>N(o.endpoints[M].initiate(O,{subscribe:!1,forceRefetch:!0,[pi]:()=>({data:P})})),S=(M,O)=>M.query&&M[O]?M[O]:ag,x=/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(M,{signal:O,abort:P,rejectWithValue:N,fulfillWithValue:Q,dispatch:$,getState:Y,extra:K}){let H=r[M.endpointName],{metaSchema:J,skipSchemaValidation:se=u}=H,be=M.type===mi;try{let Ne=ag,Ie={signal:O,abort:P,dispatch:$,getState:Y,extra:K,endpoint:M.endpointName,type:M.type,forced:be?I(M,Y()):void 0,queryCacheKey:be?M.queryCacheKey:void 0},ke=be?M[pi]:void 0,_e,pe=/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(he,fe,Be,ze){if(fe==null&&he.pages.length)return Promise.resolve({data:he});let _t={queryArg:M.originalArgs,pageParam:fe},gt=yield de(_t),Ut=ze?v:w;return{data:{pages:Ut(he.pages,gt.data,Be),pageParams:Ut(he.pageParams,fe,Be)},meta:gt.meta}});return function pe(_x37,_x38,_x39,_x40){return _ref16.apply(this,arguments)}}();function de(_x41){return _de.apply(this,arguments)}function _de(){_de=_asyncToGenerator(function*(he){let fe,{extraOptions:Be,argSchema:ze,rawResponseSchema:_t,responseSchema:gt}=H;if(ze&&!Yr(se,"arg")&&(he=yield Xr(ze,he,"argSchema",{})),ke?fe=ke():H.query?(Ne=S(H,"transformResponse"),fe=yield t(H.query(he),Ie,Be)):fe=yield H.queryFn(he,Ie,Be,Ot=>t(Ot,Ie,Be)),typeof process<"u",fe.error)throw new Kn(fe.error,fe.meta);let{data:Ut}=fe;_t&&!Yr(se,"rawResponse")&&(Ut=yield Xr(_t,fe.data,"rawResponseSchema",fe.meta));let bt=yield Ne(Ut,fe.meta,he);return gt&&!Yr(se,"response")&&(bt=yield Xr(gt,bt,"responseSchema",fe.meta)),{...fe,data:bt}});return _de.apply(this,arguments)}if(be&&"infiniteQueryOptions"in H){let{infiniteQueryOptions:he}=H,{maxPages:fe=1/0}=he,Be=M.refetchCachedPages??he.refetchCachedPages??!0,ze,_t={pages:[],pageParams:[]},gt=s.selectQueryEntry(Y(),M.queryCacheKey)?.data,bt=I(M,Y())&&!M.direction||!gt?_t:gt;if("direction"in M&&M.direction&&bt.pages.length){let Ot=M.direction==="backward",Yi=(Ot?Rg:Pl)(he,bt,M.originalArgs);ze=yield pe(bt,Yi,fe,Ot)}else{let{initialPageParam:Ot=he.initialPageParam}=M,Do=gt?.pageParams??[],Yi=Do[0]??Ot,ob=Do.length;if(ze=yield pe(bt,Yi,fe),ke&&(ze={data:ze.data.pages[0]}),Be)for(let Hp=1;Hp<ob;Hp++){let ib=Pl(he,ze.data,M.originalArgs);ze=yield pe(ze.data,ib,fe)}}_e=ze}else _e=yield de(M.originalArgs);return J&&!Yr(se,"meta")&&_e.meta&&(_e.meta=yield Xr(J,_e.meta,"metaSchema",_e.meta)),Q(_e.data,ui({fulfilledTimeStamp:Date.now(),baseQueryMeta:_e.meta}))}catch(Ne){let Ie=Ne;if(Ie instanceof Kn){let ke=S(H,"transformErrorResponse"),{rawErrorResponseSchema:_e,errorResponseSchema:pe}=H,{value:de,meta:he}=Ie;try{_e&&!Yr(se,"rawErrorResponse")&&(de=yield Xr(_e,de,"rawErrorResponseSchema",he)),J&&!Yr(se,"meta")&&(he=yield Xr(J,he,"metaSchema",he));let fe=yield ke(de,he,M.originalArgs);return pe&&!Yr(se,"errorResponse")&&(fe=yield Xr(pe,fe,"errorResponseSchema",he)),N(fe,ui({baseQueryMeta:he}))}catch(fe){Ie=fe}}try{if(Ie instanceof Ig){let ke={endpoint:M.endpointName,arg:M.originalArgs,type:M.type,queryCacheKey:be?M.queryCacheKey:void 0};H.onSchemaFailure?.(Ie,ke),a?.(Ie,ke);let{catchSchemaFailure:_e=c}=H;if(_e)return N(_e(Ie,ke),ui({baseQueryMeta:Ie._bqMeta}))}}catch(ke){Ie=ke}throw typeof process<"u",console.error(Ie),Ie}});return function x(_x35,_x36){return _ref15.apply(this,arguments)}}();function I(M,O){let P=s.selectQueryEntry(O,M.queryCacheKey),N=s.selectConfig(O).refetchOnMountOrArgChange,Q=P?.fulfilledTimeStamp,$=M.forceRefetch??(M.subscribe&&N);return $?$===!0||(Number(new Date)-Number(Q))/1e3>=$:!1}let _=()=>Ce(`${e}/executeQuery`,x,{getPendingMeta({arg:O}){let P=r[O.endpointName];return ui({startedTimeStamp:Date.now(),...(Xs(P)?{direction:O.direction}:{})})},condition(O,{getState:P}){let N=P(),Q=s.selectQueryEntry(N,O.queryCacheKey),$=Q?.fulfilledTimeStamp,Y=O.originalArgs,K=Q?.originalArgs,H=r[O.endpointName],J=O.direction;return Ol(O)?!0:Q?.status==="pending"?!1:I(O,N)||Ys(H)&&H?.forceRefetch?.({currentArg:Y,previousArg:K,endpointState:Q,state:N})?!0:!($&&!J)},dispatchConditionRejection:!0}),R=_(),T=_(),k=Ce(`${e}/executeMutation`,x,{getPendingMeta(){return ui({startedTimeStamp:Date.now()})}}),F=M=>"force"in M,V=M=>"ifOlderThan"in M,U=(M,O,P={})=>(N,Q)=>{let $=F(P)&&P.force,Y=V(P)&&P.ifOlderThan,K=(J=!0)=>{let se={forceRefetch:J,subscribe:!1};return o.endpoints[M].initiate(O,se)},H=o.endpoints[M].select(O)(Q());if($)N(K());else if(Y){let J=H?.fulfilledTimeStamp;if(!J){N(K());return}(Number(new Date)-Number(new Date(J)))/1e3>=Y&&N(K())}else N(K(!1))};function L(M){return O=>O?.meta?.arg?.endpointName===M}function j(M,O){return{matchPending:Gn(Os(M),L(O)),matchFulfilled:Gn(ir(M),L(O)),matchRejected:Gn(Wr(M),L(O))}}return{queryThunk:R,mutationThunk:k,infiniteQueryThunk:T,prefetch:U,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:j}}function Pl(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function Rg(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function Tg(e,t,r,n){return Ml(r[e.meta.arg.endpointName][t],ir(e)?e.payload:void 0,si(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function cg(e){return ct(e)?xs(e):e}function Qs(e,t,r){let n=e[t];n&&r(n)}function fi(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function ug(e,t,r){let n=e[fi(t)];n&&r(n)}var Hs={};function Rx({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:s,hasRehydrationInfo:a},assertTagType:c,config:u}){let g=B(`${e}/resetApiState`);function v(L,j,M,O){var P;L[P=j.queryCacheKey]??(L[P]={status:ar,endpointName:j.endpointName}),Qs(L,j.queryCacheKey,N=>{N.status=Tl,N.requestId=M&&N.requestId?N.requestId:O.requestId,j.originalArgs!==void 0&&(N.originalArgs=j.originalArgs),N.startedTimeStamp=O.startedTimeStamp;let Q=o[O.arg.endpointName];Xs(Q)&&"direction"in j&&(N.direction=j.direction)})}function w(L,j,M,O){Qs(L,j.arg.queryCacheKey,P=>{if(P.requestId!==j.requestId&&!O)return;let{merge:N}=o[j.arg.endpointName];if(P.status=li,N){if(P.data!==void 0){let{fulfilledTimeStamp:Q,arg:$,baseQueryMeta:Y,requestId:K}=j,H=Hr(P.data,J=>N(J,M,{arg:$.originalArgs,baseQueryMeta:Y,fulfilledTimeStamp:Q,requestId:K}));P.data=H}else P.data=M;}else P.data=o[j.arg.endpointName].structuralSharing??!0?hg(ct(P.data)?Gf(P.data):P.data,M):M;delete P.error,P.fulfilledTimeStamp=j.fulfilledTimeStamp})}let h=Kr({name:`${e}/queries`,initialState:Hs,reducers:{removeQueryResult:{reducer(L,{payload:{queryCacheKey:j}}){delete L[j]},prepare:$n()},cacheEntriesUpserted:{reducer(L,j){for(let M of j.payload){let{queryDescription:O,value:P}=M;v(L,O,!0,{arg:O,requestId:j.meta.requestId,startedTimeStamp:j.meta.timestamp}),w(L,{arg:O,requestId:j.meta.requestId,fulfilledTimeStamp:j.meta.timestamp,baseQueryMeta:{}},P,!0)}},prepare:L=>({payload:L.map(O=>{let{endpointName:P,arg:N,value:Q}=O,$=o[P];return{queryDescription:{type:mi,endpointName:P,originalArgs:O.arg,queryCacheKey:n({queryArgs:N,endpointDefinition:$,endpointName:P})},value:Q}}),meta:{[oi]:!0,requestId:ai(),timestamp:Date.now()}})},queryResultPatched:{reducer(L,{payload:{queryCacheKey:j,patches:M}}){Qs(L,j,O=>{O.data=pl(O.data,M.concat())})},prepare:$n()}},extraReducers(L){L.addCase(t.pending,(j,{meta:M,meta:{arg:O}})=>{let P=Ol(O);v(j,O,P,M)}).addCase(t.fulfilled,(j,{meta:M,payload:O})=>{let P=Ol(M.arg);w(j,M,O,P)}).addCase(t.rejected,(j,{meta:{condition:M,arg:O,requestId:P},error:N,payload:Q})=>{Qs(j,O.queryCacheKey,$=>{if(!M){if($.requestId!==P)return;$.status=di,$.error=Q??N}})}).addMatcher(a,(j,M)=>{let{queries:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===li||N?.status===di)&&(j[P]=N)})}}),y=Kr({name:`${e}/mutations`,initialState:Hs,reducers:{removeMutationResult:{reducer(L,{payload:j}){let M=fi(j);M in L&&delete L[M]},prepare:$n()}},extraReducers(L){L.addCase(r.pending,(j,{meta:M,meta:{requestId:O,arg:P,startedTimeStamp:N}})=>{P.track&&(j[fi(M)]={requestId:O,status:Tl,endpointName:P.endpointName,startedTimeStamp:N})}).addCase(r.fulfilled,(j,{payload:M,meta:O})=>{O.arg.track&&ug(j,O,P=>{P.requestId===O.requestId&&(P.status=li,P.data=M,P.fulfilledTimeStamp=O.fulfilledTimeStamp)})}).addCase(r.rejected,(j,{payload:M,error:O,meta:P})=>{P.arg.track&&ug(j,P,N=>{N.requestId===P.requestId&&(N.status=di,N.error=M??O)})}).addMatcher(a,(j,M)=>{let{mutations:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===li||N?.status===di)&&P!==N?.requestId&&(j[P]=N)})}}),S={tags:{},keys:{}},x=Kr({name:`${e}/invalidation`,initialState:S,reducers:{updateProvidedBy:{reducer(L,j){var M,O,P;for(let{queryCacheKey:N,providedTags:Q}of j.payload){I(L,N);for(let{type:$,id:Y}of Q){let K=(O=(M=L.tags)[$]??(M[$]={}))[P=Y||"__internal_without_id"]??(O[P]=[]);K.includes(N)||K.push(N)}L.keys[N]=Q}},prepare:$n()}},extraReducers(L){L.addCase(h.actions.removeQueryResult,(j,{payload:{queryCacheKey:M}})=>{I(j,M)}).addMatcher(a,(j,M)=>{var P,N,Q;let{provided:O}=s(M);for(let[$,Y]of Object.entries(O.tags??{}))for(let[K,H]of Object.entries(Y)){let J=(N=(P=j.tags)[$]??(P[$]={}))[Q=K||"__internal_without_id"]??(N[Q]=[]);for(let se of H)J.includes(se)||J.push(se),j.keys[se]=O.keys[se]}}).addMatcher(Bt(ir(t),si(t)),(j,M)=>{_(j,[M])}).addMatcher(h.actions.cacheEntriesUpserted.match,(j,M)=>{let O=M.payload.map(({queryDescription:P,value:N})=>({type:"UNKNOWN",payload:N,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:P}}));_(j,O)})}});function I(L,j){let M=cg(L.keys[j]??[]);for(let O of M){let P=O.type,N=O.id??"__internal_without_id",Q=L.tags[P]?.[N];Q&&(L.tags[P][N]=cg(Q).filter($=>$!==j))}delete L.keys[j]}function _(L,j){let M=j.map(O=>{let P=Tg(O,"providesTags",o,c),{queryCacheKey:N}=O.meta.arg;return{queryCacheKey:N,providedTags:P}});x.caseReducers.updateProvidedBy(L,x.actions.updateProvidedBy(M))}let R=Kr({name:`${e}/subscriptions`,initialState:Hs,reducers:{updateSubscriptionOptions(L,j){},unsubscribeQueryResult(L,j){},internal_getRTKQSubscriptions(){}}}),T=Kr({name:`${e}/internalSubscriptions`,initialState:Hs,reducers:{subscriptionsUpdated:{reducer(L,j){return pl(L,j.payload)},prepare:$n()}}}),k=Kr({name:`${e}/config`,initialState:{online:ux(),focused:cx(),middlewareRegistered:!1,...u},reducers:{middlewareRegistered(L,{payload:j}){L.middlewareRegistered=L.middlewareRegistered==="conflict"||i!==j?"conflict":!0}},extraReducers:L=>{L.addCase(Dl,j=>{j.online=!0}).addCase(wg,j=>{j.online=!1}).addCase(Fl,j=>{j.focused=!0}).addCase(bg,j=>{j.focused=!1}).addMatcher(a,j=>({...j}))}}),F=qn({queries:h.reducer,mutations:y.reducer,provided:x.reducer,subscriptions:T.reducer,config:k.reducer}),V=(L,j)=>F(g.match(j)?void 0:L,j),U={...k.actions,...h.actions,...R.actions,...T.actions,...y.actions,...x.actions,resetApiState:g};return{reducer:V,actions:U}}var Rl=Symbol.for("RTKQ/skipToken"),kg={status:ar},lg=Hr(kg,()=>{}),dg=Hr(kg,()=>{});function Tx({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=R=>lg,o=R=>dg;return{buildQuerySelector:w,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:S,selectCachedArgsForQuery:x,selectApiState:s,selectQueries:a,selectMutations:u,selectQueryEntry:c,selectConfig:g};function i(R){return{...R,...tg(R.status)}}function s(R){return R[t]}function a(R){return s(R)?.queries}function c(R,T){return a(R)?.[T]}function u(R){return s(R)?.mutations}function g(R){return s(R)?.config}function v(R,T,k){return F=>{if(F===Rl)return r(n,k);let V=e({queryArgs:F,endpointDefinition:T,endpointName:R});return r(L=>c(L,V)??lg,k)}}function w(R,T){return v(R,T,i)}function h(R,T){let{infiniteQueryOptions:k}=T;function F(V){let U={...V,...tg(V.status)},{isLoading:L,isError:j,direction:M}=U,O=M==="forward",P=M==="backward";return{...U,hasNextPage:I(k,U.data,U.originalArgs),hasPreviousPage:_(k,U.data,U.originalArgs),isFetchingNextPage:L&&O,isFetchingPreviousPage:L&&P,isFetchNextPageError:j&&O,isFetchPreviousPageError:j&&P}}return v(R,T,F)}function y(){return R=>{let T;return typeof R=="object"?T=fi(R)??Rl:T=R,r(T===Rl?o:V=>s(V)?.mutations?.[T]??dg,i)}}function S(R,T){let k=R[t],F=new Set,V=kl(T,Nl,Eg);for(let U of V){let L=k.provided.tags[U.type];if(!L)continue;let j=(U.id!==void 0?L[U.id]:Object.values(L).flat())??[];for(let M of j)F.add(M)}return Array.from(F.values()).flatMap(U=>{let L=k.queries[U];return L?{queryCacheKey:U,endpointName:L.endpointName,originalArgs:L.originalArgs}:[]})}function x(R,T){return kl(Object.values(a(R)),k=>k?.endpointName===T&&k.status!==ar,k=>k.originalArgs)}function I(R,T,k){return T?Pl(R,T,k)!=null:!1}function _(R,T,k){return!T||!R.getPreviousPageParam?!1:Rg(R,T,k)!=null}}var pg=WeakMap?new WeakMap:void 0,fg=({endpointName:e,queryArgs:t})=>{let r="",n=pg?.get(t);if(typeof n=="string")r=n;else{let o=JSON.stringify(t,(i,s)=>(s=typeof s=="bigint"?{$bigint:s.toString()}:s,s=Vt(s)?Object.keys(s).sort().reduce((a,c)=>(a[c]=s[c],a),{}):s,s));Vt(t)&&pg?.set(t,o),r=o}return`${e}(${r})`};function kx(...e){return function(r){let n=ri(u=>r.extractRehydrationInfo?.(u,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(u){let g=fg;if("serializeQueryArgs"in u.endpointDefinition){let v=u.endpointDefinition.serializeQueryArgs;g=w=>{let h=v(w);return typeof h=="string"?h:fg({...w,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(u)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(u){u()},apiUid:ai(),extractRehydrationInfo:n,hasRehydrationInfo:ri(u=>n(u)!=null)},s={injectEndpoints:c,enhanceEndpoints({addTagTypes:u,endpoints:g}){if(u)for(let v of u)o.tagTypes.includes(v)||o.tagTypes.push(v);if(g)for(let[v,w]of Object.entries(g))typeof w=="function"?w(Yn(i,v)):Object.assign(Yn(i,v)||{},w);return s}},a=e.map(u=>u.init(s,o,i));function c(u){let g=u.endpoints({query:v=>({...v,type:mi}),mutation:v=>({...v,type:Cg}),infiniteQuery:v=>({...v,type:xg})});for(let[v,w]of Object.entries(g)){if(u.overrideExisting!==!0&&v in i.endpointDefinitions){if(u.overrideExisting==="throw")throw new Error(ut(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[v]=w;for(let h of a)h.injectEndpoint(v,w)}return s}return s.injectEndpoints({endpoints:r.endpoints})}}function sr(e,...t){return Object.assign(e,...t)}var _x=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,i=null,s=null,{updateSubscriptionOptions:a,unsubscribeQueryResult:c}=e.internalActions,u=(S,x)=>{if(a.match(x)){let{queryCacheKey:_,requestId:R,options:T}=x.payload,k=S.get(_);return k?.has(R)&&k.set(R,T),!0}if(c.match(x)){let{queryCacheKey:_,requestId:R}=x.payload,T=S.get(_);return T&&T.delete(R),!0}if(e.internalActions.removeQueryResult.match(x))return S.delete(x.payload.queryCacheKey),!0;if(t.pending.match(x)){let{meta:{arg:_,requestId:R}}=x,T=zs(S,_.queryCacheKey,_l);return _.subscribe&&T.set(R,_.subscriptionOptions??T.get(R)??{}),!0}let I=!1;if(t.rejected.match(x)){let{meta:{condition:_,arg:R,requestId:T}}=x;if(_&&R.subscribe){let k=zs(S,R.queryCacheKey,_l);k.set(T,R.subscriptionOptions??k.get(T)??{}),I=!0}}return I},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:S=>g().get(S)?.size??0,isRequestSubscribed:(S,x)=>!!g()?.get(S)?.get(x)};function y(S){return JSON.parse(JSON.stringify(Object.fromEntries([...S].map(([x,I])=>[x,Object.fromEntries(I)]))))}return(S,x)=>{if(i||(i=y(r.currentSubscriptions)),e.util.resetApiState.match(S))return i={},r.currentSubscriptions.clear(),s=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(S))return[!1,h];let I=u(r.currentSubscriptions,S),_=!0;if(I){s||(s=setTimeout(()=>{let k=y(r.currentSubscriptions),[,F]=dl(i,()=>k);x.next(e.internalActions.subscriptionsUpdated(F)),i=k,s=null},500));let R=typeof S.type=="string"&&!!S.type.startsWith(o),T=t.rejected.match(S)&&S.meta.condition&&!!S.meta.arg.subscribe;_=!R&&!T}return[_,!1]}},Ox=2147483647/1e3-1,Px=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:s},getRunningQueryThunk:a,mwApi:c})=>{let{removeQueryResult:u,unsubscribeQueryResult:g,cacheEntriesUpserted:v}=t.internalActions,w=Bt(g.match,r.fulfilled,r.rejected,v.match);function h(R){let T=o.currentSubscriptions.get(R);return T?T.size>0:!1}let y={};function S(R){for(let T of R.values())T?.abort?.()}let x=(R,T)=>{let k=T.getState(),F=s(k);if(w(R)){let V;if(v.match(R))V=R.payload.map(U=>U.queryDescription.queryCacheKey);else{let{queryCacheKey:U}=g.match(R)?R.payload:R.meta.arg;V=[U]}I(V,T,F)}if(t.util.resetApiState.match(R)){for(let[V,U]of Object.entries(y))U&&clearTimeout(U),delete y[V];S(o.runningQueries),S(o.runningMutations)}if(n.hasRehydrationInfo(R)){let{queries:V}=n.extractRehydrationInfo(R);I(Object.keys(V),T,F)}};function I(R,T,k){let F=T.getState();for(let V of R){let U=i(F,V);U?.endpointName&&_(V,U.endpointName,T,k)}}function _(R,T,k,F){let U=Yn(n,T)?.keepUnusedDataFor??F.keepUnusedDataFor;if(U===1/0)return;let L=Math.max(0,Math.min(U,Ox));if(!h(R)){let j=y[R];j&&clearTimeout(j),y[R]=setTimeout(()=>{if(!h(R)){let M=i(k.getState(),R);M?.endpointName&&k.dispatch(a(M.endpointName,M.originalArgs))?.abort(),k.dispatch(u({queryCacheKey:R}))}delete y[R]},L*1e3)}}return x},mg=new Error("Promise never resolved before cacheEntryRemoved."),Nx=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:s,selectApiState:a}})=>{let c=Ps(n),u=Ps(o),g=ir(n,o),v={},{removeQueryResult:w,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function S(k,F,V){let U=v[k];U?.valueResolved&&(U.valueResolved({data:F,meta:V}),delete U.valueResolved)}function x(k){let F=v[k];F&&(delete v[k],F.cacheEntryRemoved())}function I(k){let{arg:F,requestId:V}=k.meta,{endpointName:U,originalArgs:L}=F;return[U,L,V]}let _=(k,F,V)=>{let U=R(k);function L(j,M,O,P){let N=s(V,M),Q=s(F.getState(),M);!N&&Q&&T(j,P,M,F,O)}if(n.pending.match(k)){let[j,M,O]=I(k);L(j,U,O,M)}else if(y.match(k))for(let{queryDescription:j,value:M}of k.payload){let{endpointName:O,originalArgs:P,queryCacheKey:N}=j;L(O,N,k.meta.requestId,P),S(N,M,{})}else if(o.pending.match(k)){if(F.getState()[t].mutations[U]){let[M,O,P]=I(k);T(M,O,U,F,P)}}else if(g(k))S(U,k.payload,k.meta.baseQueryMeta);else if(w.match(k)||h.match(k))x(U);else if(e.util.resetApiState.match(k))for(let j of Object.keys(v))x(j)};function R(k){return c(k)?k.meta.arg.queryCacheKey:u(k)?k.meta.arg.fixedCacheKey??k.meta.requestId:w.match(k)?k.payload.queryCacheKey:h.match(k)?fi(k.payload):""}function T(k,F,V,U,L){let j=Yn(r,k),M=j?.onCacheEntryAdded;if(!M)return;let O={},P=new Promise(H=>{O.cacheEntryRemoved=H}),N=Promise.race([new Promise(H=>{O.valueResolved=H}),P.then(()=>{throw mg})]);N.catch(()=>{}),v[V]=O;let Q=e.endpoints[k].select(Ws(j)?F:V),$=U.dispatch((H,J,se)=>se),Y={...U,getCacheEntry:()=>Q(U.getState()),requestId:L,extra:$,updateCachedData:Ws(j)?H=>U.dispatch(e.util.updateQueryData(k,F,H)):void 0,cacheDataLoaded:N,cacheEntryRemoved:P},K=M(F,Y);Promise.resolve(K).catch(H=>{if(H!==mg)throw H})}return _},Fx=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},Dx=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:s,refetchQuery:a,internalState:c})=>{let{removeQueryResult:u}=i.internalActions,g=Bt(ir(n),si(n)),v=Bt(ir(o,n),Wr(o,n)),w=[],h=0,y=(I,_)=>{(o.pending.match(I)||n.pending.match(I))&&h++,v(I)&&(h=Math.max(0,h-1)),g(I)?x(Tg(I,"invalidatesTags",r,s),_):v(I)?x([],_):i.util.invalidateTags.match(I)&&x(Ml(I.payload,void 0,void 0,void 0,void 0,s),_)};function S(){return h>0}function x(I,_){let R=_.getState(),T=R[e];if(w.push(...I),T.config.invalidationBehavior==="delayed"&&S())return;let k=w;if(w=[],k.length===0)return;let F=i.util.selectInvalidatedBy(R,k);t.batch(()=>{let V=Array.from(F.values());for(let{queryCacheKey:U}of V){let L=T.queries[U],j=zs(c.currentSubscriptions,U,_l);L&&(j.size===0?_.dispatch(u({queryCacheKey:U})):L.status!==ar&&_.dispatch(a(L)))}})}return y},Mx=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:s}=o,a=new Set,c=null,u=(x,I)=>{(r.internalActions.updateSubscriptionOptions.match(x)||r.internalActions.unsubscribeQueryResult.match(x))&&g(x.payload.queryCacheKey,I),(t.pending.match(x)||t.rejected.match(x)&&x.meta.condition)&&g(x.meta.arg.queryCacheKey,I),(t.fulfilled.match(x)||t.rejected.match(x)&&!x.meta.condition)&&v(x.meta.arg,I),r.util.resetApiState.match(x)&&(y(),c&&(clearTimeout(c),c=null),a.clear())};function g(x,I){a.add(x),c||(c=setTimeout(()=>{for(let _ of a)w({queryCacheKey:_},I);a.clear(),c=null},0))}function v({queryCacheKey:x},I){let _=I.getState()[e],R=_.queries[x],T=s.get(x);if(!R||R.status===ar)return;let{lowestPollingInterval:k,skipPollingIfUnfocused:F}=S(T);if(!Number.isFinite(k))return;let V=i.get(x);V?.timeout&&(clearTimeout(V.timeout),V.timeout=void 0);let U=Date.now()+k;i.set(x,{nextPollTimestamp:U,pollingInterval:k,timeout:setTimeout(()=>{(_.config.focused||!F)&&I.dispatch(n(R)),v({queryCacheKey:x},I)},k)})}function w({queryCacheKey:x},I){let R=I.getState()[e].queries[x],T=s.get(x);if(!R||R.status===ar)return;let{lowestPollingInterval:k}=S(T);if(!Number.isFinite(k)){h(x);return}let F=i.get(x),V=Date.now()+k;(!F||V<F.nextPollTimestamp)&&v({queryCacheKey:x},I)}function h(x){let I=i.get(x);I?.timeout&&clearTimeout(I.timeout),i.delete(x)}function y(){for(let x of i.keys())h(x)}function S(x=new Map){let I=!1,_=Number.POSITIVE_INFINITY;for(let R of x.values())R.pollingInterval&&(_=Math.min(R.pollingInterval,_),I=R.skipPollingIfUnfocused||I);return{lowestPollingInterval:_,skipPollingIfUnfocused:I}}return u},Lx=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=Os(r,n),i=Wr(r,n),s=ir(r,n),a={};return(u,g)=>{if(o(u)){let{requestId:v,arg:{endpointName:w,originalArgs:h}}=u.meta,y=Yn(t,w),S=y?.onQueryStarted;if(S){let x={},I=new Promise((k,F)=>{x.resolve=k,x.reject=F});I.catch(()=>{}),a[v]=x;let _=e.endpoints[w].select(Ws(y)?h:v),R=g.dispatch((k,F,V)=>V),T={...g,getCacheEntry:()=>_(g.getState()),requestId:v,extra:R,updateCachedData:Ws(y)?k=>g.dispatch(e.util.updateQueryData(w,h,k)):void 0,queryFulfilled:I};S(h,T)}}else if(s(u)){let{requestId:v,baseQueryMeta:w}=u.meta;a[v]?.resolve({data:u.payload,meta:w}),delete a[v]}else if(i(u)){let{requestId:v,rejectedWithValue:w,baseQueryMeta:h}=u.meta;a[v]?.reject({error:u.payload??u.error,isUnhandledError:!w,meta:h}),delete a[v]}}},jx=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,s=(c,u)=>{Fl.match(c)&&a(u,"refetchOnFocus"),Dl.match(c)&&a(u,"refetchOnReconnect")};function a(c,u){let g=c.getState()[e],v=g.queries,w=o.currentSubscriptions;t.batch(()=>{for(let h of w.keys()){let y=v[h],S=w.get(h);if(!S||!y)continue;let x=[...S.values()];(x.some(_=>_[u]===!0)||x.every(_=>_[u]===void 0)&&g.config[u])&&(S.size===0?c.dispatch(i({queryCacheKey:h})):y.status!==ar&&c.dispatch(n(y)))}})}return s};function qx(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:s}=o,a={invalidateTags:B(`${t}/invalidateTags`)},c=w=>w.type.startsWith(`${t}/`),u=[Fx,Px,Dx,Mx,Nx,Lx];return{middleware:w=>{let h=!1,y=i(w.dispatch),S={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:c,mwApi:w},x=u.map(R=>R(S)),I=_x(S),_=jx(S);return R=>T=>{if(!$o(T))return R(T);h||(h=!0,w.dispatch(n.internalActions.middlewareRegistered(s)));let k={...w,next:R},F=w.getState(),[V,U]=I(T,k,F),L;if(V?L=R(T):L=U,w.getState()[t]&&(_(T,k,F),c(T)||o.hasRehydrationInfo(T)))for(let j of x)j(T,k,F);return L}},actions:a};function v(w){return e.api.endpoints[w.endpointName].initiate(w.originalArgs,{subscribe:!1,forceRefetch:!0})}}var gg=Symbol(),Ux=({createSelector:e=Ue}={})=>({name:gg,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:s,refetchOnMountOrArgChange:a,refetchOnFocus:c,refetchOnReconnect:u,invalidationBehavior:g,onSchemaFailure:v,catchSchemaFailure:w,skipSchemaValidation:h},y){Yf();let S=pe=>(typeof process<"u",pe);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:Dl,onOffline:wg,onFocus:Fl,onFocusLost:bg},util:{}});let x=Tx({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:_,buildQuerySelector:R,buildInfiniteQuerySelector:T,buildMutationSelector:k}=x;sr(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:_});let{queryThunk:F,infiniteQueryThunk:V,mutationThunk:U,patchQueryData:L,updateQueryData:j,upsertQueryData:M,prefetch:O,buildMatchThunkActions:P}=Ix({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:S,selectors:x,onSchemaFailure:v,catchSchemaFailure:w,skipSchemaValidation:h}),{reducer:N,actions:Q}=Rx({context:y,queryThunk:F,infiniteQueryThunk:V,mutationThunk:U,serializeQueryArgs:i,reducerPath:o,assertTagType:S,config:{refetchOnFocus:c,refetchOnReconnect:u,refetchOnMountOrArgChange:a,keepUnusedDataFor:s,reducerPath:o,invalidationBehavior:g}});sr(t.util,{patchQueryData:L,updateQueryData:j,upsertQueryData:M,prefetch:O,resetApiState:Q.resetApiState,upsertQueryEntries:Q.cacheEntriesUpserted}),sr(t.internalActions,Q);let $=new WeakMap,Y=pe=>zs($,pe,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:K,buildInitiateInfiniteQuery:H,buildInitiateMutation:J,getRunningMutationThunk:se,getRunningMutationsThunk:be,getRunningQueriesThunk:Ne,getRunningQueryThunk:Ie}=Ex({queryThunk:F,mutationThunk:U,infiniteQueryThunk:V,api:t,serializeQueryArgs:i,context:y,getInternalState:Y});sr(t.util,{getRunningMutationThunk:se,getRunningMutationsThunk:be,getRunningQueryThunk:Ie,getRunningQueriesThunk:Ne});let{middleware:ke,actions:_e}=qx({reducerPath:o,context:y,queryThunk:F,mutationThunk:U,infiniteQueryThunk:V,api:t,assertTagType:S,selectors:x,getRunningQueryThunk:Ie,getInternalState:Y});return sr(t.util,_e),sr(t,{reducer:N,middleware:ke}),{name:gg,injectEndpoint(pe,de){var Be;let fe=(Be=t.endpoints)[pe]??(Be[pe]={});Ys(de)&&sr(fe,{name:pe,select:R(pe,de),initiate:K(pe,de)},P(F,pe)),wx(de)&&sr(fe,{name:pe,select:k(),initiate:J(pe)},P(U,pe)),Xs(de)&&sr(fe,{name:pe,select:T(pe,de),initiate:H(pe,de)},P(F,pe))}}}}),_g=kx(Ux());m();d();f();p();m();d();f();p();var Zr=e=>e.query,Og=e=>e.query?.enableQuerySyntax;var iU=Ue(e=>Zr(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,r,n,o)=>({q:e,requestId:t,cannotAnswer:r,analyticsMode:n,actionCause:o})),Vx=Ue(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function cr(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function q(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(g){try{u(n.next(g))}catch(v){s(v)}}function c(g){try{u(n.throw(g))}catch(v){s(v)}}function u(g){g.done?i(g.value):o(g.value).then(a,c)}u((n=n.apply(e,t||[])).next())})}var ve;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(ve||(ve={}));function ql(){return typeof window<"u"}function Zl(){return typeof navigator<"u"}function Xn(){return typeof document<"u"}function Ul(){try{return typeof localStorage<"u"}catch{return!1}}function Bx(){try{return typeof sessionStorage<"u"}catch{return!1}}function $g(){return Zl()&&navigator.cookieEnabled}var Gx=[ve.click,ve.custom,ve.search,ve.view],$x=(e,t)=>Gx.indexOf(e)!==-1?Object.assign({language:Xn()?document.documentElement.lang:"unknown",userAgent:Zl()?navigator.userAgent:"unknown"},t):t,hi=class e{static set(t,r,n){var o,i,s,a;n&&(i=new Date,i.setTime(i.getTime()+n)),a=window.location.hostname,a.indexOf(".")===-1?Pg(t,r,i):(s=a.split("."),o=s[s.length-2]+"."+s[s.length-1],Pg(t,r,i,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function Pg(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function Qx(){return Ul()?localStorage:$g()?new yi:Bx()?sessionStorage:new Jn}var yi=class e{getItem(t){return hi.get(`${e.prefix}${t}`)}removeItem(t){hi.erase(`${e.prefix}${t}`)}setItem(t,r,n){hi.set(`${e.prefix}${t}`,r,n)}};yi.prefix="coveo_";var Vl=class{constructor(){this.cookieStorage=new yi}getItem(t){return localStorage.getItem(t)||this.cookieStorage.getItem(t)}removeItem(t){this.cookieStorage.removeItem(t),localStorage.removeItem(t)}setItem(t,r){localStorage.setItem(t,r),this.cookieStorage.setItem(t,r,31556926e3)}},Jn=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Zs="__coveo.analytics.history",Hx=20,zx=1e3*60,Wx=75,ea=class{constructor(t){this.store=t||Qx()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){return q(this,void 0,void 0,function*(){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=yield this.getHistoryWithInternalTimeAsync();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])})}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){return q(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(Zs);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return q(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(Zs);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Zs,JSON.stringify(t.slice(0,Hx)))}catch{}}clear(){try{this.store.removeItem(Zs)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,Wx)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>zx:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var Kx=(e,t)=>q(void 0,void 0,void 0,function*(){return e===ve.view?(yield Yx(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),Yx=e=>q(void 0,void 0,void 0,function*(){let t=new ea,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),Xx=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function ta(e){return typeof e=="string"&&Xx.test(e)}function Ng(e){if(!ta(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var et=[];for(let e=0;e<256;++e)et.push((e+256).toString(16).slice(1));function Qg(e,t=0){return(et[e[t+0]]+et[e[t+1]]+et[e[t+2]]+et[e[t+3]]+"-"+et[e[t+4]]+et[e[t+5]]+"-"+et[e[t+6]]+et[e[t+7]]+"-"+et[e[t+8]]+et[e[t+9]]+"-"+et[e[t+10]]+et[e[t+11]]+et[e[t+12]]+et[e[t+13]]+et[e[t+14]]+et[e[t+15]]).toLowerCase()}var Zx=new Uint8Array(16);function Jx(){return crypto.getRandomValues(Zx)}function eE(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}var tE="6ba7b810-9dad-11d1-80b4-00c04fd430c8",rE="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function nE(e,t,r,n,o,i){let s=typeof r=="string"?eE(r):r,a=typeof n=="string"?Ng(n):n;if(typeof n=="string"&&(n=Ng(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+s.length);return c.set(a),c.set(s,a.length),c=t(c),c[6]=c[6]&15|e,c[8]=c[8]&63|128,Qg(c)}function Jr(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():oE(e,t,r)}function oE(e,t,r){e=e||{};let n=e.random??e.rng?.()??Jx();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return Qg(n)}function iE(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function Ll(e,t){return e<<t|e>>>32-t}function sE(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,i=Math.ceil(o/16),s=new Array(i);for(let a=0;a<i;++a){let c=new Uint32Array(16);for(let u=0;u<16;++u)c[u]=e[a*64+u*4]<<24|e[a*64+u*4+1]<<16|e[a*64+u*4+2]<<8|e[a*64+u*4+3];s[a]=c}s[i-1][14]=(e.length-1)*8/2**32,s[i-1][14]=Math.floor(s[i-1][14]),s[i-1][15]=(e.length-1)*8&4294967295;for(let a=0;a<i;++a){let c=new Uint32Array(80);for(let y=0;y<16;++y)c[y]=s[a][y];for(let y=16;y<80;++y)c[y]=Ll(c[y-3]^c[y-8]^c[y-14]^c[y-16],1);let u=r[0],g=r[1],v=r[2],w=r[3],h=r[4];for(let y=0;y<80;++y){let S=Math.floor(y/20),x=Ll(u,5)+iE(S,g,v,w)+h+t[S]+c[y]>>>0;h=w,w=v,v=Ll(g,30)>>>0,g=u,u=x}r[0]=r[0]+u>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+v>>>0,r[3]=r[3]+w>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function ra(e,t,r,n){return nE(80,sE,e,t)}ra.DNS=tE;ra.URL=rE;var Hg="2.33.0",Fg=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,gi={pageview:"pageview",event:"event"},na=class{constructor({client:t,uuidGenerator:r=Jr}){this.client=t,this.uuidGenerator=r}},Bl=class extends na{constructor({client:t,uuidGenerator:r=Jr}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=Fg(window.location),this.lastReferrer=Xn()?document.referrer:"",this.addHooks()}getApi(t){return t==="setAction"?this.setAction:null}setAction(t,r){this.action=t,this.actionData=r}clearData(){this.clearPluginData(),this.action=void 0,this.actionData={}}getLocationInformation(t,r){return Object.assign({hitType:t},this.getNextValues(t,r))}updateLocationInformation(t,r){this.updateLocationForNextPageView(t,r)}getDefaultContextInformation(t){let r={title:Xn()?document.title:"",encoding:Xn()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},i={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},i),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:i}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=i,t===gi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===gi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===gi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===gi.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=o=>o.replace(/^\/?(.*)$/,"/$1");return`${(o=>o.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return Fg(window.location)}},Sr=class e{constructor(t,r){if(!ta(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(r/1e3)}toString(){return this.clientId.replace(/-/g,"")+"."+this.creationDate.toString()}get expired(){let t=Math.floor(Date.now()/1e3)-this.creationDate;return t<0||t>e.expirationTime}validate(t,r){return!this.expired&&this.matchReferrer(t,r)}matchReferrer(t,r){try{let n=new URL(t);return r.some(o=>new RegExp(o.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(n.host))}catch{return!1}}static fromString(t){let r=t.split(".");if(r.length!==2)return null;let[n,o]=r;if(n.length!==32||isNaN(parseInt(o)))return null;let i=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return ta(i)?new e(i,Number.parseInt(o)*1e3):null}};Sr.cvo_cid="cvo_cid";Sr.expirationTime=120;var Gl=class extends na{constructor({client:t,uuidGenerator:r=Jr}){super({client:t,uuidGenerator:r})}getApi(t){switch(t){case"decorate":return this.decorate;case"acceptFrom":return this.acceptFrom;default:return null}}decorate(t){return q(this,void 0,void 0,function*(){if(!this.client.getCurrentVisitorId)throw new Error("Could not retrieve current clientId");try{let r=new URL(t),n=yield this.client.getCurrentVisitorId();return r.searchParams.set(Sr.cvo_cid,new Sr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Gl.Id="link";var xt=Object.keys;function Js(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var jl=128,zg=192,Dg=224,Mg=240;function aE(e){return(e&248)===Mg?4:(e&Mg)===Dg?3:(e&Dg)===zg?2:1}function cE(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&jl)!=jl)break;if(r-=3,(n&zg)!=jl){t-r>=aE(n)*3&&(r=t);break}}return e.substring(0,r)}var $l={id:"svc_ticket_id",subject:"svc_ticket_subject",description:"svc_ticket_description",category:"svc_ticket_category",productId:"svc_ticket_product_id",custom:"svc_ticket_custom"},uE=xt($l).map(e=>$l[e]),lE=[...uE].join("|"),dE=new RegExp(`^(${lE}$)`),pE={svcAction:"svc_action",svcActionData:"svc_action_data"},fE=e=>xt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=$l[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),mE=e=>dE.test(e),gE=[mE],Lg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},jg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},st={action:"pa",list:"pal",listSource:"pls"},oa={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},hE=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Ql={id:"quoteId",affiliation:"quoteAffiliation"},Hl={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},yE={add:st,bookmark_add:st,bookmark_remove:st,click:st,checkout:st,checkout_option:st,detail:st,impression:st,remove:st,refund:Object.assign(Object.assign({},st),oa),purchase:Object.assign(Object.assign({},st),oa),quickview:st,quote:Object.assign(Object.assign({},st),Ql),review:Object.assign(Object.assign({},st),Hl)},vE=xt(Lg).map(e=>Lg[e]),SE=xt(jg).map(e=>jg[e]),AE=xt(st).map(e=>st[e]),bE=xt(oa).map(e=>oa[e]),wE=xt(Hl).map(e=>Hl[e]),CE=xt(Ql).map(e=>Ql[e]),xE=[...vE,"custom"].join("|"),EE=[...SE,"custom"].join("|"),Wg="(pr[0-9]+)",Kg="(il[0-9]+pi[0-9]+)",IE=new RegExp(`^${Wg}(${xE})$`),RE=new RegExp(`^(${Kg}(${EE}))|(il[0-9]+nm)$`),TE=new RegExp(`^(${AE.join("|")})$`),kE=new RegExp(`^(${bE.join("|")})$`),_E=new RegExp(`^${Wg}custom$`),OE=new RegExp(`^${Kg}custom$`),PE=new RegExp(`^(${[...hE,...wE,...CE].join("|")})$`),NE=e=>IE.test(e),FE=e=>RE.test(e),DE=e=>TE.test(e),ME=e=>kE.test(e),LE=e=>PE.test(e),jE=[FE,NE,DE,ME,LE],qE=[_E,OE],UE={anonymizeIp:"aip"},VE={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},BE={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},GE=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],$E=Object.assign(Object.assign(Object.assign(Object.assign({},UE),VE),BE),GE.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),zl=Object.assign(Object.assign({},$E),pE),QE=e=>{let t=!!e.action&&yE[e.action]||{};return xt(e).reduce((r,n)=>{let o=t[n]||zl[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},HE=xt(zl).map(e=>zl[e]),zE=e=>HE.indexOf(e)!==-1,WE=e=>e==="custom",KE=e=>[...jE,...gE,zE,WE].some(t=>t(e)),YE=e=>xt(e).reduce((t,r)=>{let n=XE(r);return n?Object.assign(Object.assign({},t),ZE(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),XE=e=>{let t;return[...qE].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},ZE=(e,t)=>xt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),Wl=class{constructor(t){this.opts=t}sendEvent(t,r){return q(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:o}=this.opts,i=yield this.getQueryParamsForEventType(t),{url:s,payload:a}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),c=this.encodeForEventType(t,a),u=new Blob([c],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(s,u)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return q(this,void 0,void 0,function*(){let o=t,i=r;if(n){let s=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:a,body:c}=s;o=a||t;try{i=JSON.parse(c)}catch(u){console.error("Unable to process the request body as a JSON string",u)}}return{payload:i,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return q(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(i=>!!i).join("&")})}isEventTypeLegacy(t){return[ve.click,ve.custom,ve.search,ve.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let o=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(o=`access_token=${encodeURIComponent(n)}&${o}`),o}},Kl=class{sendEvent(t,r){return q(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return q(this,void 0,void 0,function*(){return Promise.resolve()})}},qg=b.fetch,ia=class{constructor(t){this.opts=t}sendEvent(t,r){return q(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:i}=this.opts,s=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",a={url:`${n}/analytics/${t}${s}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},c=Object.assign(Object.assign({},a),i?yield i(a,"analyticsFetch"):{}),{url:u}=c,g=cr(c,["url"]),v;try{v=yield qg(u,g)}catch(w){console.error("An error has occurred when sending the event.",w);return}if(v.ok){let w=yield v.json();return w.visitorId&&o.setCurrentVisitorId(w.visitorId),w}else{try{v.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,v,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return q(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield qg(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[ve.click,ve.custom,ve.search,ve.view].indexOf(t)!==-1}getVisitorIdParam(){return q(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,r=yield t.getCurrentVisitorId();return r?`?visitor=${r}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},Yl=class{constructor(t,r){Ul()&&$g()?this.storage=new Vl:Ul()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Jn),this.client=new ia(t),this.beaconClient=new Wl(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:i}of n)this.beaconClient.sendEvent(o,i)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},Xl=class{constructor(t,r){this.storage=r||new Jn,this.client=new ia(t)}getClientDependingOnEventType(t){return this.client}},sa=class{constructor(){this.storage=new Jn,this.client=new Kl}getClientDependingOnEventType(t){return this.client}},JE="xx",eI=e=>e?.startsWith(JE)||!1,tI=`
27
+ `;return new Wu(r)}var Wu=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Nt=class{constructor(e){oe(this,"definition");this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let i=this.definition[o].validate(r[o]);i&&n.push(`${o}: ${i}`)}if(n.length)throw pw(n,t);return r}get default(){let e={};for(let t in this.definition){let r=this.definition[t].default;r!==void 0&&(e[t]=r)}return e}},Vr=class{constructor(e={}){oe(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&ce(e)?"value is required.":null}get default(){return this.baseConfig.default instanceof Function?this.baseConfig.default():this.baseConfig.default}get required(){return this.baseConfig.required===!0}};function Ln(e){return e===void 0}function fw(e){return e===null}function ce(e){return Ln(e)||fw(e)}var je=class{constructor(e={}){oe(this,"value");this.value=new Vr(e)}validate(e){let t=this.value.validate(e);return t||(mw(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function mw(e){return Ln(e)||Rf(e)}function Rf(e){return typeof e=="boolean"}var Le=class{constructor(e={}){oe(this,"config");oe(this,"value");this.config=e,this.value=new Vr(e)}validate(e){let t=this.value.validate(e);return t||(gw(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 gw(e){return Ln(e)||Tf(e)}function Tf(e){return typeof e=="number"&&!Number.isNaN(e)}var hw=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,re=class{constructor(e={}){oe(this,"value");oe(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Vr(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:i}=this.config,s=this.value.validate(e);if(s)return s;if(Ln(e))return null;if(!kf(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&&!(hw.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 kf(e){return Object.prototype.toString.call(e)==="[object String]"}var xe=class{constructor(e={}){oe(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Ln(e))return this.config.options.required?"value is required and is currently undefined":null;if(!_f(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 _f(e){return e!==void 0&&typeof e=="object"}var Ft=class{constructor(e={}){oe(this,"config");oe(this,"value");this.config=e,this.value=new Vr(this.config)}validate(e){if(!ce(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ce(e))return null;if(this.config.max!==void 0&&e.length>this.config.max)return`value contains more than ${this.config.max}`;if(this.config.min!==void 0&&e.length<this.config.min)return`value contains less than ${this.config.min}`;if(this.config.each!==void 0){let r="";return e.forEach(n=>{this.config.each.required&&ce(n)&&(r=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(n,this.config.each);o!==null&&(r+=` ${o}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return Rf(e)||kf(e)||Tf(e)||_f(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Of(e){return Array.isArray(e)}var Ku=class{constructor(e){oe(this,"config");oe(this,"value");this.config=e,this.value=new Vr(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Ln(e)||Object.values(this.config.enum).find(n=>n===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();f();p();var is=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();var jn=class{constructor(t){oe(this,"_basePath");oe(this,"_params",{});this._basePath=t}addParam(t,r){this._params={...this.params,[t]:r}}get basePath(){return this._basePath}get params(){return this._params}get hasParams(){return Object.entries(this._params).length}get href(){return this.hasParams?`${this.basePath}?${Object.entries(this.params).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}`:this.basePath}};m();d();f();p();function Yu(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Xu=e=>{let{response:t}=e;return t.body?yw(e):vw(t)},yw=e=>Aw(e)?bw(e):Sw(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},vw=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function Sw(e){return e.body.statusCode!==void 0}function Aw(e){return e.body.exception!==void 0}var bw=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();function Pf(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var Zu=(e,t,r,n)=>{let o=new jn(`${e.url}${n}`);return o.addParam("organizationId",e.organizationId),e.authentication&&o.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:o.href,origin:"searchApiFetch"}};var Nf=(e,t)=>{let r=new jn(`${e.url}${t}`);return r.addParam("access_token",e.accessToken),r.addParam("organizationId",e.organizationId),r.addParam("uniqueId",e.uniqueId),e.authentication&&r.addParam("authentication",e.authentication),e.q!==void 0&&r.addParam("q",e.q),e.enableNavigation!==void 0&&r.addParam("enableNavigation",`${e.enableNavigation}`),e.requestedOutputSize!==void 0&&r.addParam("requestedOutputSize",`${e.requestedOutputSize}`),r.href},Ju=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield yr.call({...Zu(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Yu(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Pf(r),o=yield r.arrayBuffer(),s=new TextDecoder(n).decode(o);return ww(s)?{success:s}:{error:Xu({response:r,body:s})}});return function Ju(_x3,_x4){return _ref3.apply(this,arguments)}}();function ww(e){return typeof e=="string"}m();d();f();p();function Cw(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function xw(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function ss(e,t){if(t&&e.name==="AbortError")return{error:xw(e)};if(e instanceof Ur)return{error:Cw(e)};throw e}m();d();f();p();m();d();f();p();var as=(e,t,r,n,o={})=>{Ew(e);let i=`${e.url}/rest/organizations/${e.organizationId}/caseassists/${e.caseAssistId}${n}`,s=Iw(o),a=s?`${i}?${s}`:i;return{accessToken:e.accessToken,method:t,contentType:r,url:a,origin:"caseAssistApiFetch"}},cs=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r],t),{}),us=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r].value,t),{}),Ew=e=>{if(!e.url)throw new Error("The 'url' attribute must contain a valid platform URL.");if(!e.organizationId)throw new Error("The 'organizationId' attribute must contain a valid organization ID.");if(!e.accessToken)throw new Error("The 'accessToken' attribute must contain a valid platform access token.");if(!e.caseAssistId)throw new Error("The 'caseAssistId' attribute must contain a valid Case Assist configuration ID.")},Iw=e=>Object.keys(e).map(t=>`${t}=${encodeURIComponent(e[t])}`).join("&");var Ff=e=>{let t=e.debug?{debug:"1"}:{};return{...as(e,"POST","application/json","/classify",t),requestParams:Rw(e)}},Rw=e=>({clientId:e.clientId,locale:e.locale,fields:cs(e.fields)});m();d();f();p();var Df=e=>{let t={};return e.debug&&(t.debug="1"),e.numberOfResults&&(t.numberOfResults=e.numberOfResults.toString()),{...as(e,"POST","application/json","/documents/suggest",t),requestParams:Tw(e)}},Tw=e=>({clientId:e.clientId,locale:e.locale,fields:cs(e.fields),context:e.context,analytics:e.analytics});var ls=class{constructor(t){oe(this,"options",t)}getCaseClassifications(t){var _this=this;return _asyncToGenerator(function*(){let r=yield yr.call({...Ff(t),..._this.options});if(r instanceof Error)return ss(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}getDocumentSuggestions(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield yr.call({...Df(t),..._this2.options});if(r instanceof Error)return ss(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this3=this;return _asyncToGenerator(function*(){return Ju(t,_this3.options)})()}};m();d();f();p();m();d();f();p();m();d();f();p();function Xe(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var kw=typeof Symbol=="function"&&Symbol.observable||"@@observable",Mf=kw,el=()=>Math.random().toString(36).substring(7).split("").join("."),_w={INIT:`@@redux/INIT${el()}`,REPLACE:`@@redux/REPLACE${el()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${el()}`},ds=_w;function Vt(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function tl(e,t,r){if(typeof e!="function")throw new Error(Xe(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Xe(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Xe(1));return r(tl)(e,t)}let n=e,o=t,i=new Map,s=i,a=0,c=!1;function u(){s===i&&(s=new Map,i.forEach((x,I)=>{s.set(I,x)}))}function g(){if(c)throw new Error(Xe(3));return o}function v(x){if(typeof x!="function")throw new Error(Xe(4));if(c)throw new Error(Xe(5));let I=!0;u();let _=a++;return s.set(_,x),function(){if(I){if(c)throw new Error(Xe(6));I=!1,u(),s.delete(_),i=null}}}function w(x){if(!Vt(x))throw new Error(Xe(7));if(typeof x.type>"u")throw new Error(Xe(8));if(typeof x.type!="string")throw new Error(Xe(17));if(c)throw new Error(Xe(9));try{c=!0,o=n(o,x)}finally{c=!1}return(i=s).forEach(_=>{_()}),x}function h(x){if(typeof x!="function")throw new Error(Xe(10));n=x,w({type:ds.REPLACE})}function y(){let x=v;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(Xe(11));function _(){let T=I;T.next&&T.next(g())}return _(),{unsubscribe:x(_)}},[Mf](){return this}}}return w({type:ds.INIT}),{dispatch:w,subscribe:v,getState:g,replaceReducer:h,[Mf]:y}}function Ow(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:ds.INIT})>"u")throw new Error(Xe(12));if(typeof r(void 0,{type:ds.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Xe(13))})}function qn(e){let t=Object.keys(e),r={};for(let s=0;s<t.length;s++){let a=t[s];typeof e[a]=="function"&&(r[a]=e[a])}let n=Object.keys(r),o,i;try{Ow(r)}catch(s){i=s}return function(a={},c){if(i)throw i;let u=!1,g={};for(let v=0;v<n.length;v++){let w=n[v],h=r[w],y=a[w],S=h(y,c);if(typeof S>"u"){let x=c&&c.type;throw new Error(Xe(14))}g[w]=S,u=u||S!==y}return u=u||n.length!==Object.keys(a).length,u?g:a}}function $o(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Lf(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(Xe(15))},s={getState:o.getState,dispatch:(c,...u)=>i(c,...u)},a=e.map(c=>c(s));return i=$o(...a)(o.dispatch),{...o,dispatch:i}}}function Qo(e){return Vt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var ll=Symbol.for("immer-nothing"),Ho=Symbol.for("immer-draftable"),$e=Symbol.for("immer-state");function Ze(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ht=Object,Gr=ht.getPrototypeOf,zo="constructor",Zo="prototype",ol="configurable",gs="enumerable",fs="writable",Wo="value",ct=e=>!!e&&!!e[$e];function it(e){return e?Qf(e)||ei(e)||!!e[Ho]||!!e[zo]?.[Ho]||ti(e)||ri(e):!1}var Pw=ht[Zo][zo].toString(),jf=new WeakMap;function Qf(e){if(!e||!Vn(e))return!1;let t=Gr(e);if(t===null||t===ht[Zo])return!0;let r=ht.hasOwnProperty.call(t,zo)&&t[zo];if(r===Object)return!0;if(!Br(r))return!1;let n=jf.get(r);return n===void 0&&(n=Function.toString.call(r),jf.set(r,n)),n===Pw}function Hf(e){return ct(e)||Ze(15,e),e[$e].base_}function Jo(e,t,r=!0){$r(e)===0?(r?Reflect.ownKeys(e):ht.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function $r(e){let t=e[$e];return t?t.type_:ei(e)?1:ti(e)?2:ri(e)?3:0}var Un=(e,t,r=$r(e))=>r===2?e.has(t):ht[Zo].hasOwnProperty.call(e,t),nr=(e,t,r=$r(e))=>r===2?e.get(t):e[t],hs=(e,t,r,n=$r(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function Nw(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var ei=Array.isArray,ti=e=>e instanceof Map,ri=e=>e instanceof Set,Vn=e=>typeof e=="object",Br=e=>typeof e=="function",rl=e=>typeof e=="boolean";function Fw(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Dw=e=>Vn(e)?e?.[$e]:null,or=e=>e.copy_||e.base_;var dl=e=>e.modified_?e.copy_:e.base_;function il(e,t){if(ti(e))return new Map(e);if(ri(e))return new Set(e);if(ei(e))return Array[Zo].slice.call(e);let r=Qf(e);if(t===!0||t==="class_only"&&!r){let n=ht.getOwnPropertyDescriptors(e);delete n[$e];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let s=o[i],a=n[s];a[fs]===!1&&(a[fs]=!0,a[ol]=!0),(a.get||a.set)&&(n[s]={[ol]:!0,[fs]:!0,[gs]:a[gs],[Wo]:e[s]})}return ht.create(Gr(e),n)}else{let n=Gr(e);if(n!==null&&r)return{...e};let o=ht.create(n);return ht.assign(o,e)}}function pl(e,t=!1){return ws(e)||ct(e)||!it(e)||($r(e)>1&&ht.defineProperties(e,{set:ps,add:ps,clear:ps,delete:ps}),ht.freeze(e),t&&Jo(e,(r,n)=>{pl(n,!0)},!1)),e}function Mw(){Ze(2)}var ps={[Wo]:Mw};function ws(e){return e===null||!Vn(e)?!0:ht.isFrozen(e)}var ys="MapSet",vs="Patches",qf="ArrayMethods",Ss={};function Qr(e){let t=Ss[e];return t||Ze(0,e),t}var Uf=e=>!!Ss[e];function Lw(e,t){Ss[e]||(Ss[e]=t)}var Ko,zf=()=>Ko,jw=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Uf(ys)?Qr(ys):void 0,arrayMethodsPlugin_:Uf(qf)?Qr(qf):void 0});function Vf(e,t){t&&(e.patchPlugin_=Qr(vs),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function sl(e){al(e),e.drafts_.forEach(qw),e.drafts_=null}function al(e){e===Ko&&(Ko=e.parent_)}var Bf=e=>Ko=jw(Ko,e);function qw(e){let t=e[$e];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Gf(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[$e].modified_&&(sl(t),Ze(4)),it(e)&&(e=$f(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[$e].base_,e,t)}else e=$f(t,r);return Uw(t,e,!0),sl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ll?e:void 0}function $f(e,t){if(ws(t))return t;let r=t[$e];if(!r)return As(t,e.handledSet_,e);if(!Cs(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){let{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);Yf(r,e)}return r.copy_}function Uw(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&pl(t,r)}function Wf(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Cs=(e,t)=>e.scope_===t,Vw=[];function Kf(e,t,r,n){let o=or(e),i=e.type_;if(n!==void 0&&nr(o,n,i)===t){hs(o,n,r,i);return}if(!e.draftLocations_){let a=e.draftLocations_=new Map;Jo(o,(c,u)=>{if(ct(u)){let g=a.get(u)||[];g.push(c),a.set(u,g)}})}let s=e.draftLocations_.get(t)??Vw;for(let a of s)hs(o,a,r,i)}function Bw(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!Cs(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let s=dl(i);Kf(e,i.draft_??i,s,r),Yf(i,o)})}function Yf(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)}Wf(e)}}function Gw(e,t,r){let{scope_:n}=e;if(ct(r)){let o=r[$e];Cs(o,n)&&o.callbacks_.push(function(){ms(e);let s=dl(o);Kf(e,r,s,t)})}else it(r)&&e.callbacks_.push(function(){let i=or(e);e.type_===3?i.has(r)&&As(r,n.handledSet_,n):nr(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&As(nr(e.copy_,t,e.type_),n.handledSet_,n)})}function As(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||ct(e)||t.has(e)||!it(e)||ws(e)||(t.add(e),Jo(e,(n,o)=>{if(ct(o)){let i=o[$e];if(Cs(i,r)){let s=dl(i);hs(e,n,s,e.type_),Wf(i)}}else it(o)&&As(o,t,r)})),e}function $w(e,t){let r=ei(e),n={type_:r?1:0,scope_:t?t.scope_:zf(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=n,i=bs;r&&(o=[n],i=Yo);let{revoke:s,proxy:a}=Proxy.revocable(o,i);return n.draft_=a,n.revoke_=s,[a,n]}var bs={get(e,t){if(t===$e)return e;let r=e.scope_.arrayMethodsPlugin_,n=e.type_===1&&typeof t=="string";if(n&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let o=or(e);if(!Un(o,t,e.type_))return Hw(e,o,t);let i=o[t];if(e.finalized_||!it(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Fw(t))return i;if(i===nl(e.base_,t)||Qw(e,t,i)){ms(e);let s=e.type_===1?+t:t,a=ul(e.scope_,i,e,s);return e.copy_[s]=a}return i},has(e,t){return t in or(e)},ownKeys(e){return Reflect.ownKeys(or(e))},set(e,t,r){let n=Xf(or(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=nl(or(e),t),i=o?.[$e];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(Nw(r,o)&&(r!==void 0||Un(e.base_,t,e.type_)))return!0;ms(e),cl(e)}return e.copy_[t]===r&&(r!==void 0||Un(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Gw(e,t,r)),!0},deleteProperty(e,t){return ms(e),nl(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),cl(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=or(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[fs]:!0,[ol]:e.type_!==1||t!=="length",[gs]:n[gs],[Wo]:r[t]}},defineProperty(){Ze(11)},getPrototypeOf(e){return Gr(e.base_)},setPrototypeOf(){Ze(12)}},Yo={};for(let e in bs){let t=bs[e];Yo[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Yo.deleteProperty=function(e,t){return Yo.set.call(this,e,t,void 0)};Yo.set=function(e,t,r){return bs.set.call(this,e[0],t,r,e[0])};function nl(e,t){let r=e[$e];return(r?or(r):e)[t]}function Qw(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!it(r)||r[$e]?!1:e.baseRefs_.has(r)}function Hw(e,t,r){let n=Xf(t,r);return n?Wo in n?n[Wo]:n.get?.call(e.draft_):void 0}function Xf(e,t){if(!(t in e))return;let r=Gr(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Gr(r)}}function cl(e){e.modified_||(e.modified_=!0,e.parent_&&cl(e.parent_))}function ms(e){e.copy_||(e.assigned_=new Map,e.copy_=il(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var zw=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Br(t)&&!Br(r)){let i=r;r=t;let s=this;return function(c=i,...u){return s.produce(c,g=>r.call(this,g,...u))}}Br(r)||Ze(6),n!==void 0&&!Br(n)&&Ze(7);let o;if(it(t)){let i=Bf(this),s=ul(i,t,void 0),a=!0;try{o=r(s),a=!1}finally{a?sl(i):al(i)}return Vf(i,n),Gf(o,i)}else if(!t||!Vn(t)){if(o=r(t),o===void 0&&(o=t),o===ll&&(o=void 0),this.autoFreeze_&&pl(o,!0),n){let i=[],s=[];Qr(vs).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:s}),n(i,s)}return o}else Ze(1,t)},this.produceWithPatches=(t,r)=>{if(Br(t))return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let n,o;return[this.produce(t,r,(s,a)=>{n=s,o=a}),n,o]},rl(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),rl(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),rl(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){it(e)||Ze(8),ct(e)&&(e=xs(e));let t=Bf(this),r=ul(t,e,void 0);return r[$e].isManual_=!0,al(t),r}finishDraft(e,t){let r=e&&e[$e];(!r||!r.isManual_)&&Ze(9);let{scope_:n}=r;return Vf(n,t),Gf(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let o=t[r];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}r>-1&&(t=t.slice(r+1));let n=Qr(vs).applyPatches_;return ct(e)?n(e,t):this.produce(e,o=>n(o,t))}};function ul(e,t,r,n){let[o,i]=ti(t)?Qr(ys).proxyMap_(t,r):ri(t)?Qr(ys).proxySet_(t,r):$w(t,r);return(r?.scope_??zf()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?Bw(r,i,n):i.callbacks_.push(function(c){c.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:u}=c;i.modified_&&u&&u.generatePatches_(i,[],c)}),o}function xs(e){return ct(e)||Ze(10,e),Zf(e)}function Zf(e){if(!it(e)||ws(e))return e;let t=e[$e],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=il(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=il(e,!0);return Jo(r,(o,i)=>{hs(r,o,Zf(i))},n),t&&(t.finalized_=!1),r}function Jf(){function t(y,S=[]){if(y.key_!==void 0){let x=y.parent_.copy_??y.parent_.base_,I=Dw(nr(x,y.key_)),_=nr(x,y.key_);if(_===void 0||_!==y.draft_&&_!==y.base_&&_!==y.copy_||I!=null&&I.base_!==y.base_)return null;let R=y.parent_.type_===3,T;if(R){let k=y.parent_;T=Array.from(k.drafts_.keys()).indexOf(y.key_)}else T=y.key_;if(!(R&&x.size>T||Un(x,T)))return null;S.push(T)}if(y.parent_)return t(y.parent_,S);S.reverse();try{r(y.copy_,S)}catch{return null}return S}function r(y,S){let x=y;for(let I=0;I<S.length-1;I++){let _=S[I];if(x=nr(x,_),!Vn(x)||x===null)throw new Error(`Cannot resolve path at '${S.join("/")}'`)}return x}let n="replace",o="add",i="remove";function s(y,S,x){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:I,inversePatches_:_}=x;switch(y.type_){case 0:case 2:return c(y,S,I,_);case 1:return a(y,S,I,_);case 3:return u(y,S,I,_)}}function a(y,S,x,I){let{base_:_,assigned_:R}=y,T=y.copy_;T.length<_.length&&([_,T]=[T,_],[x,I]=[I,x]);let k=y.allIndicesReassigned_===!0;for(let F=0;F<_.length;F++){let V=T[F],U=_[F];if((k||R?.get(F.toString()))&&V!==U){let j=V?.[$e];if(j&&j.modified_)continue;let M=S.concat([F]);x.push({op:n,path:M,value:h(V)}),I.push({op:n,path:M,value:h(U)})}}for(let F=_.length;F<T.length;F++){let V=S.concat([F]);x.push({op:o,path:V,value:h(T[F])})}for(let F=T.length-1;_.length<=F;--F){let V=S.concat([F]);I.push({op:i,path:V})}}function c(y,S,x,I){let{base_:_,copy_:R,type_:T}=y;Jo(y.assigned_,(k,F)=>{let V=nr(_,k,T),U=nr(R,k,T),L=F?Un(_,k)?n:o:i;if(V===U&&L===n)return;let j=S.concat(k);x.push(L===i?{op:L,path:j}:{op:L,path:j,value:h(U)}),I.push(L===o?{op:i,path:j}:L===i?{op:o,path:j,value:h(V)}:{op:n,path:j,value:h(V)})})}function u(y,S,x,I){let{base_:_,copy_:R}=y,T=0;_.forEach(k=>{if(!R.has(k)){let F=S.concat([T]);x.push({op:i,path:F,value:k}),I.unshift({op:o,path:F,value:k})}T++}),T=0,R.forEach(k=>{if(!_.has(k)){let F=S.concat([T]);x.push({op:o,path:F,value:k}),I.unshift({op:i,path:F,value:k})}T++})}function g(y,S,x){let{patches_:I,inversePatches_:_}=x;I.push({op:n,path:[],value:S===ll?void 0:S}),_.push({op:n,path:[],value:y})}function v(y,S){return S.forEach(x=>{let{path:I,op:_}=x,R=y;for(let V=0;V<I.length-1;V++){let U=$r(R),L=I[V];typeof L!="string"&&typeof L!="number"&&(L=""+L),(U===0||U===1)&&(L==="__proto__"||L===zo)&&Ze(19),Br(R)&&L===Zo&&Ze(19),R=nr(R,L),(R===null||!Vn(R))&&Ze(18,I.join("/"))}let T=$r(R),k=w(x.value),F=I[I.length-1];switch(_){case n:switch(T){case 2:return R.set(F,k);case 3:Ze(16);default:return R[F]=k}case o:switch(T){case 1:return F==="-"?R.push(k):R.splice(F,0,k);case 2:return R.set(F,k);case 3:return R.add(k);default:return R[F]=k}case i:switch(T){case 1:return R.splice(F,1);case 2:return R.delete(F);case 3:return R.delete(x.value);default:return delete R[F]}default:Ze(17,_)}}),y}function w(y){if(!it(y))return y;if(ei(y))return y.map(w);if(ti(y))return new Map(Array.from(y.entries()).map(([x,I])=>[x,w(I)]));if(ri(y))return new Set(Array.from(y).map(w));let S=Object.create(Gr(y));for(let x in y)S[x]=w(y[x]);return Un(y,Ho)&&(S[Ho]=y[Ho]),S}function h(y){return ct(y)?w(y):y}Lw(vs,{applyPatches_:v,generatePatches_:s,generateReplacementPatches_:g,getPath:t})}var Ww=b.Iterator,UD=typeof Ww?.from=="function";var Xo=new zw,Hr=Xo.produce,fl=Xo.produceWithPatches.bind(Xo);var ml=Xo.applyPatches.bind(Xo);m();d();f();p();var Is=Symbol("NOT_FOUND");function Kw(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Yw(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 em=e=>Array.isArray(e)?e:[e];function Xw(e){let t=Array.isArray(e[0])?e[0]:e;return Yw(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Zw(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}function Jw(e){let t;return{get(r){return t&&e(t.key,r)?t.value:Is},put(r,n){t={key:r,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function eC(e,t){let r=[];function n(a){let c=r.findIndex(u=>t(a,u.key));if(c>-1){let u=r[c];return c>0&&(r.splice(c,1),r.unshift(u)),u.value}return Is}function o(a,c){n(a)===Is&&(r.unshift({key:a,value:c}),r.length>e&&r.pop())}function i(){return r}function s(){r=[]}return{get:n,put:o,getEntries:i,clear:s}}var tC=(e,t)=>e===t;function rC(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 gl(e,t){let r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:n=tC,maxSize:o=1,resultEqualityCheck:i}=r,s=rC(n),a=0,c=o<=1?Jw(s):eC(o,s);function u(){let g=c.get(arguments);if(g===Is){if(g=e.apply(null,arguments),a++,i){let w=c.getEntries().find(h=>i(h.value,g));w&&(g=w.value,a!==0&&a--)}c.put(arguments,g)}return g}return u.clearCache=()=>{c.clear(),u.resetResultsCount()},u.resultsCount=()=>a,u.resetResultsCount=()=>{a=0},u}var nC=class{constructor(e){this.value=e}deref(){return this.value}},oC=()=>typeof WeakRef>"u"?nC:WeakRef,rm=oC(),iC=0,tm=1;function Es(){return{s:iC,v:void 0,o:null,p:null}}function sC(e){return e instanceof rm?e.deref():e}function Bn(e,t={}){let r=Es(),{resultEqualityCheck:n}=t,o,i=0;function s(){let a=r,{length:c}=arguments;for(let v=0,w=c;v<w;v++){let h=arguments[v];if(typeof h=="function"||typeof h=="object"&&h!==null){let y=a.o;y===null&&(a.o=y=new WeakMap);let S=y.get(h);S===void 0?(a=Es(),y.set(h,a)):a=S}else{let y=a.p;y===null&&(a.p=y=new Map);let S=y.get(h);S===void 0?(a=Es(),y.set(h,a)):a=S}}let u=a,g;if(a.s===tm)g=a.v;else if(g=e.apply(null,arguments),i++,n){let v=sC(o);v!=null&&n(v,g)&&(g=v,i!==0&&i--),o=typeof g=="object"&&g!==null||typeof g=="function"?new rm(g):g}return u.s=tm,u.v=g,g}return s.clearCache=()=>{r=Es(),s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function Rs(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,s=0,a,c={},u=o.pop();typeof u=="object"&&(c=u,u=o.pop()),Kw(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);let g={...r,...c},{memoize:v,memoizeOptions:w=[],argsMemoize:h=Bn,argsMemoizeOptions:y=[]}=g,S=em(w),x=em(y),I=Xw(o),_=v(function(){return i++,u.apply(null,arguments)},...S),R=!0,T=h(function(){s++;let F=Zw(I,arguments);return a=_.apply(null,F),a},...x);return Object.assign(T,{resultFunc:u,memoizedResultFunc:_,dependencies:I,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>a,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var Be=Rs(Bn);m();d();f();p();function nm(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var om=nm(),im=nm;var aC=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?$o:$o.apply(null,arguments)},lM=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},cC=e=>e&&typeof e.match=="function";function B(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(ut(0));return{type:e,payload:o.payload,...("meta"in o&&{meta:o.meta}),...("error"in o&&{error:o.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Qo(n)&&n.type===e,r}var fm=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 sm(e){return it(e)?Hr(e,()=>{}):e}function Ts(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function uC(e){return typeof e=="boolean"}var lC=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},s=new fm;return r&&(uC(r)?s.push(om):s.push(im(r.extraArgument))),s},oi="RTK_autoBatch",Qn=()=>e=>({payload:e,meta:{[oi]:!0}}),am=e=>t=>{setTimeout(t,e)},dC=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(i),clearTimeout(s),r())},i=e(o),s=setTimeout(o,t)},pC=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,s=!1,a=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?dC(window.requestAnimationFrame,100):am(10):e.type==="callback"?e.queueNotification:am(e.timeout),u=()=>{s=!1,i&&(i=!1,a.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let v=()=>o&&g(),w=n.subscribe(v);return a.add(g),()=>{w(),a.delete(g)}},dispatch(g){try{return o=!g?.meta?.[oi],i=!o,i&&(s||(s=!0,c(u))),n.dispatch(g)}finally{o=!0}}})},fC=e=>function(r){let{autoBatch:n=!0}=r??{},o=new fm(e);return n&&o.push(pC(typeof n=="object"?n:void 0)),o};function mm(e){let t=lC(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:s=void 0,enhancers:a=void 0}=e||{},c;if(typeof r=="function")c=r;else if(Vt(r))c=qn(r);else throw new Error(ut(1));let u;typeof n=="function"?u=n(t):u=t();let g=$o;o&&(g=aC({trace:!1,...(typeof o=="object"&&o)}));let v=Lf(...u),w=fC(v),h=typeof a=="function"?a(w):w(),y=g(...h);return tl(c,s,y)}function gm(e){let t={},r=[],n,o={addCase(i,s){let a=typeof i=="string"?i:i.type;if(!a)throw new Error(ut(28));if(a in t)throw new Error(ut(29));return t[a]=s,o},addAsyncThunk(i,s){return s.pending&&(t[i.pending.type]=s.pending),s.rejected&&(t[i.rejected.type]=s.rejected),s.fulfilled&&(t[i.fulfilled.type]=s.fulfilled),s.settled&&r.push({matcher:i.settled,reducer:s.settled}),o},addMatcher(i,s){return r.push({matcher:i,reducer:s}),o},addDefaultCase(i){return n=i,o}};return e(o),[t,r,n]}function mC(e){return typeof e=="function"}function Qe(e,t){let[r,n,o]=gm(t),i;if(mC(e))i=()=>sm(e());else{let a=sm(e);i=()=>a}function s(a=i(),c){let u=[r[c.type],...n.filter(({matcher:g})=>g(c)).map(({reducer:g})=>g)];return u.filter(g=>!!g).length===0&&(u=[o]),u.reduce((g,v)=>{if(v)if(ct(g)){let h=v(g,c);return h===void 0?g:h}else{if(it(g))return Hr(g,w=>v(w,c));{let w=v(g,c);if(w===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return w}}return g},a)}return s.getInitialState=i,s}var hm=(e,t)=>cC(e)?e.match(t):e(t);function Bt(...e){return t=>e.some(r=>hm(r,t))}function $n(...e){return t=>e.every(r=>hm(r,t))}function Ps(e,t){if(!e||!e.meta)return!1;let r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function ii(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Ns(...e){return e.length===0?t=>Ps(t,["pending"]):ii(e)?Bt(...e.map(t=>t.pending)):Ns()(e[0])}function Wr(...e){return e.length===0?t=>Ps(t,["rejected"]):ii(e)?Bt(...e.map(t=>t.rejected)):Wr()(e[0])}function si(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?$n(Wr(...e),t):ii(e)?$n(Wr(...e),t):si()(e[0])}function ir(...e){return e.length===0?t=>Ps(t,["fulfilled"]):ii(e)?Bt(...e.map(t=>t.fulfilled)):ir()(e[0])}function Fs(...e){return e.length===0?t=>Ps(t,["pending","fulfilled","rejected"]):ii(e)?Bt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Fs()(e[0])}var gC="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",ai=(e=21)=>{let t="",r=e;for(;r--;)t+=gC[Math.random()*64|0];return t},hC=["name","message","stack","code"],hl=class{constructor(e,t){oe(this,"payload");oe(this,"meta");oe(this,"_type");this.payload=e,this.meta=t}},cm=class{constructor(e,t){oe(this,"payload");oe(this,"meta");oe(this,"_type");this.payload=e,this.meta=t}},yC=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of hC)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},um="External signal was aborted",Ce=(()=>{function e(t,r,n){let o=B(t+"/fulfilled",(c,u,g,v)=>({payload:c,meta:{...(v||{}),arg:g,requestId:u,requestStatus:"fulfilled"}})),i=B(t+"/pending",(c,u,g)=>({payload:void 0,meta:{...(g||{}),arg:u,requestId:c,requestStatus:"pending"}})),s=B(t+"/rejected",(c,u,g,v,w)=>({payload:v,error:(n&&n.serializeError||yC)(c||"Rejected"),meta:{...(w||{}),arg:g,requestId:u,rejectedWithValue:!!v,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function a(c,{signal:u}={}){return(g,v,w)=>{let h=n?.idGenerator?n.idGenerator(c):ai(),y=new l.AbortController,S,x;function I(R){x=R,y.abort()}u&&(u.aborted?I(um):u.addEventListener("abort",()=>I(um),{once:!0}));let _=_asyncToGenerator(function*(){let R;try{let k=n?.condition?.(c,{getState:v,extra:w});if(SC(k)&&(k=yield k),k===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let F=new Promise((V,U)=>{S=()=>{U({name:"AbortError",message:x||"Aborted"})},y.signal.addEventListener("abort",S,{once:!0})});g(i(h,c,n?.getPendingMeta?.({requestId:h,arg:c},{getState:v,extra:w}))),R=yield Promise.race([F,Promise.resolve(r(c,{dispatch:g,getState:v,extra:w,requestId:h,signal:y.signal,abort:I,rejectWithValue:(V,U)=>new hl(V,U),fulfillWithValue:(V,U)=>new cm(V,U)})).then(V=>{if(V instanceof hl)throw V;return V instanceof cm?o(V.payload,h,c,V.meta):o(V,h,c)})])}catch(k){R=k instanceof hl?s(null,h,c,k.payload,k.meta):s(k,h,c)}finally{S&&y.signal.removeEventListener("abort",S)}return n&&!n.dispatchConditionRejection&&s.match(R)&&R.meta.condition||g(R),R})();return Object.assign(_,{abort:I,requestId:h,arg:c,unwrap(){return _.then(vC)}})}}return Object.assign(a,{pending:i,rejected:s,fulfilled:o,settled:Bt(s,o),typePrefix:t})}return e.withTypes=()=>e,e})();function vC(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function SC(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var ym=Symbol.for("rtk-slice-createasyncthunk"),pM={[ym]:Ce};function AC(e,t){return`${e}/${t}`}function bC({creators:e}={}){let t=e?.asyncThunk?.[ym];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(ut(11));typeof process<"u";let s=(typeof n.reducers=="function"?n.reducers(CC()):n.reducers)||{},a=Object.keys(s),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(R,T){let k=typeof R=="string"?R:R.type;if(!k)throw new Error(ut(12));if(k in c.sliceCaseReducersByType)throw new Error(ut(13));return c.sliceCaseReducersByType[k]=T,u},addMatcher(R,T){return c.sliceMatchers.push({matcher:R,reducer:T}),u},exposeAction(R,T){return c.actionCreators[R]=T,u},exposeCaseReducer(R,T){return c.sliceCaseReducersByName[R]=T,u}};a.forEach(R=>{let T=s[R],k={reducerName:R,type:AC(o,R),createNotation:typeof n.reducers=="function"};EC(T)?RC(k,T,u,t):xC(k,T,u)});function g(){let[R={},T=[],k=void 0]=typeof n.extraReducers=="function"?gm(n.extraReducers):[n.extraReducers],F={...R,...c.sliceCaseReducersByType};return Qe(n.initialState,V=>{for(let U in F)V.addCase(U,F[U]);for(let U of c.sliceMatchers)V.addMatcher(U.matcher,U.reducer);for(let U of T)V.addMatcher(U.matcher,U.reducer);k&&V.addDefaultCase(k)})}let v=R=>R,w=new Map,h=new WeakMap,y;function S(R,T){return y||(y=g()),y(R,T)}function x(){return y||(y=g()),y.getInitialState()}function I(R,T=!1){function k(V){let U=V[R];return typeof U>"u"&&T&&(U=Ts(h,k,x)),U}function F(V=v){let U=Ts(w,T,()=>new WeakMap);return Ts(U,V,()=>{let L={};for(let[j,M]of Object.entries(n.selectors??{}))L[j]=wC(M,V,()=>Ts(h,V,x),T);return L})}return{reducerPath:R,getSelectors:F,get selectors(){return F(k)},selectSlice:k}}let _={name:o,reducer:S,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:x,...I(i),injectInto(R,{reducerPath:T,...k}={}){let F=T??i;return R.inject({reducerPath:F,reducer:S},k),{..._,...I(F,!0)}}};return _}}function wC(e,t,r,n){function o(i,...s){let a=t(i);return typeof a>"u"&&n&&(a=r()),e(a,...s)}return o.unwrapped=e,o}var Kr=bC();function CC(){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 xC({type:e,reducerName:t,createNotation:r},n,o){let i,s;if("reducer"in n){if(r&&!IC(n))throw new Error(ut(17));i=n.reducer,s=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?B(e,s):B(e))}function EC(e){return e._reducerDefinitionType==="asyncThunk"}function IC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function RC({type:e,reducerName:t},r,n,o){if(!o)throw new Error(ut(18));let{payloadCreator:i,fulfilled:s,pending:a,rejected:c,settled:u,options:g}=r,v=o(e,i,g);n.exposeAction(t,v),s&&n.addCase(v.fulfilled,s),a&&n.addCase(v.pending,a),c&&n.addCase(v.rejected,c),u&&n.addMatcher(v.settled,u),n.exposeCaseReducer(t,{fulfilled:s||ks,pending:a||ks,rejected:c||ks,settled:u||ks})}function ks(){}var TC="task",vm="listener",Sm="completed",Sl="cancelled",kC=`task-${Sl}`,_C=`task-${Sm}`,yl=`${vm}-${Sl}`,OC=`${vm}-${Sm}`,Ds=class{constructor(e){oe(this,"code");oe(this,"name","TaskAbortError");oe(this,"message");this.code=e,this.message=`${TC} ${Sl} (reason: ${e})`}},Al=(e,t)=>{if(typeof e!="function")throw new TypeError(ut(32))},_s=()=>{},Am=(e,t=_s)=>(e.catch(t),e),bm=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),zr=e=>{if(e.aborted)throw new Ds(e.reason)};function wm(e,t){let r=_s;return new Promise((n,o)=>{let i=()=>o(new Ds(e.reason));if(e.aborted){i();return}r=bm(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=_s})}var PC=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof Ds?"cancelled":"rejected",error:r}}finally{t?.()}});return function PC(_x5,_x6){return _ref5.apply(this,arguments)}}(),Os=e=>t=>Am(wm(e,t).then(r=>(zr(e),r))),Cm=e=>{let t=Os(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Gn}=Object,lm={},Ms="listenerMiddleware",NC=(e,t)=>{let r=n=>bm(e,()=>n.abort(e.reason));return(n,o)=>{Al(n,"taskExecutor");let i=new l.AbortController;r(i);let s=PC(/*#__PURE__*/_asyncToGenerator(function*(){zr(e),zr(i.signal);let a=yield n({pause:Os(i.signal),delay:Cm(i.signal),signal:i.signal});return zr(i.signal),a}),()=>i.abort(_C));return o?.autoJoin&&t.push(s.catch(_s)),{result:Os(e)(s),cancel(){i.abort(kC)}}}},FC=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){zr(t);let i=()=>{},a=[new Promise((c,u)=>{let g=e({predicate:n,effect:(v,w)=>{w.unsubscribe(),c([v,w.getState(),w.getOriginalState()])}});i=()=>{g(),u()}})];o!=null&&a.push(new Promise(c=>setTimeout(c,o,null)));try{let c=yield wm(t,Promise.race(a));return zr(t),c}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>Am(r(n,o))},xm=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=B(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(ut(21));return Al(i,"options.listener"),{predicate:o,type:t,effect:i}},Em=Gn(e=>{let{type:t,predicate:r,effect:n}=xm(e);return{id:ai(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(ut(22))}}},{withTypes:()=>Em}),dm=(e,t)=>{let{type:r,effect:n,predicate:o}=xm(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},vl=e=>{e.pending.forEach(t=>{t.abort(yl)})},DC=(e,t)=>()=>{for(let r of t.keys())vl(r);e.clear()},pm=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Im=Gn(B(`${Ms}/add`),{withTypes:()=>Im}),MC=B(`${Ms}/removeAll`),Rm=Gn(B(`${Ms}/remove`),{withTypes:()=>Rm}),LC=(...e)=>{console.error(`${Ms}/error`,...e)},Tm=(e={})=>{let t=new Map,r=new Map,n=h=>{let y=r.get(h)??0;r.set(h,y+1)},o=h=>{let y=r.get(h)??1;y===1?r.delete(h):r.set(h,y-1)},{extra:i,onError:s=LC}=e;Al(s,"onError");let a=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&vl(h)}),c=h=>{let y=dm(t,h)??Em(h);return a(y)};Gn(c,{withTypes:()=>c});let u=h=>{let y=dm(t,h);return y&&(y.unsubscribe(),h.cancelActive&&vl(y)),!!y};Gn(u,{withTypes:()=>u});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,S,x){let I=new l.AbortController,_=FC(c,I.signal),R=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(y,Gn({},S,{getOriginalState:x,condition:(T,k)=>_(T,k).then(Boolean),take:_,delay:Cm(I.signal),pause:Os(I.signal),extra:i,signal:I.signal,fork:NC(I.signal,R),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((T,k,F)=>{T!==I&&(T.abort(yl),F.delete(T))})},cancel:()=>{I.abort(yl),h.pending.delete(I)},throwIfCancelled:()=>{zr(I.signal)}})))}catch(T){T instanceof Ds||pm(s,T,{raisedBy:"effect"})}finally{yield Promise.all(R),I.abort(OC),o(h),h.pending.delete(I)}});return function g(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),v=DC(t,r);return{middleware:h=>y=>S=>{if(!Qo(S))return y(S);if(Im.match(S))return c(S.payload);if(MC.match(S)){v();return}if(Rm.match(S))return u(S.payload);let x=h.getState(),I=()=>{if(x===lm)throw new Error(ut(23));return x},_;try{if(_=y(S),t.size>0){let R=h.getState(),T=Array.from(t.values());for(let k of T){let F=!1;try{F=k.predicate(S,R,x)}catch(V){F=!1,pm(s,V,{raisedBy:"predicate"})}F&&g(k,S,h,I)}}}finally{x=lm}return _},startListening:c,stopListening:u,clearListeners:v}};function ut(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}m();d();f();p();var ee=new re({required:!0,emptyAllowed:!1}),He=new re({required:!1,emptyAllowed:!1}),Dt=new re({required:!0,emptyAllowed:!0}),xM=new re({required:!1,emptyAllowed:!0}),km=new Ft({each:ee,required:!0}),_m=new re({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Om=new re({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),EM=new re({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),jC=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),bl=(e,t)=>{if("required"in t)return{payload:new Nt({value:t}).validate({value:e}).value};let o=new xe({options:{required:!0},values:t}).validate(e);if(o)throw new Wu(o);return{payload:e}},W=(e,t)=>{try{return bl(e,t)}catch(r){return{payload:e,error:jC(r)}}};var Ls=(e,t,r,n)=>{let o=`Check the options of ${n}`;return qC(e,t,r,o,"Controller initialization error")},qC=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};var js=B("caseAssistConfiguration/set",e=>W(e,{caseAssistId:ee,locale:He,proxyBaseUrl:new re({required:!1,url:!0})}));m();d();f();p();m();d();f();p();var Pm=()=>({caseAssistId:"",locale:"en-US"});var vr=Qe(Pm(),e=>{e.addCase(js,(t,r)=>{t.caseAssistId=r.payload.caseAssistId,t.locale=r.payload.locale,t.apiBaseUrl=r.payload.proxyBaseUrl})});m();d();f();p();m();d();f();p();m();d();f();p();var Nm={q:new re,enableQuerySyntax:new je,aq:new re,cq:new re,firstResult:new Le({min:0}),numberOfResults:new Le({min:0}),sortCriteria:new re,f:new xe,fExcluded:new xe,cf:new xe,nf:new xe,mnf:new xe,df:new xe,debug:new je,sf:new xe,tab:new re,af:new xe};var qs=B("searchParameters/restore",e=>W(e,Nm)),Fm=B("searchParameters/restoreTab",e=>W(e,ee));m();d();f();p();var Dm=B("debug/enable"),Mm=B("debug/disable");m();d();f();p();var Us=()=>!1;var Lm=Qe(Us(),e=>{e.addCase(Dm,()=>!0).addCase(Mm,()=>!1).addCase(qs,(t,r)=>r.payload.debug??t)});m();d();f();p();var Vs=B("searchHub/set",e=>W(e,new re({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var Hn="3.56.0",jm=["@coveo/atomic","@coveo/quantic"];var wl=()=>He,qm=()=>ee,zn=B("configuration/updateBasicConfiguration",e=>W(e,{accessToken:He,environment:new re({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:He})),Bs=B("configuration/updateSearchConfiguration",e=>W(e,{proxyBaseUrl:new re({required:!1,url:!0}),pipeline:new re({required:!1,emptyAllowed:!0}),searchHub:He,timezone:He,locale:He,authenticationProviders:new Ft({required:!1,each:ee})})),UC={enabled:new je({default:!0}),originContext:wl(),originLevel2:wl(),originLevel3:wl(),proxyBaseUrl:new re({required:!1,url:!0}),runtimeEnvironment:new Vr,anonymous:new je({default:!1}),deviceId:He,userDisplayName:He,documentLocation:He,trackingId:Om,analyticsMode:new re({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new xe({options:{required:!1},values:jm.reduce((e,t)=>(e[t]=_m,e),{})})},Gs=B("configuration/updateAnalyticsConfiguration",e=>W(e,UC)),$s=B("configuration/analytics/disable"),Qs=B("configuration/analytics/enable"),Um=B("configuration/analytics/originlevel2",e=>W(e,{originLevel2:qm()})),Vm=B("configuration/analytics/originlevel3",e=>W(e,{originLevel3:qm()})),Bm=B("knowledge/setAgentId",e=>W(e,new re({required:!0})));m();d();f();p();var VC=B("history/undo"),BC=B("history/redo"),Gt=B("history/snapshot"),tj=Ce("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(VC()),yield t(Hs())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),rj=Ce("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(BC()),yield t(Hs())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),Hs=Ce("history/change",/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x15,_x16){return _ref1.apply(this,arguments)}}());m();d();f();p();var Wn=()=>"default";var Gm=Qe(Wn(),e=>{e.addCase(Vs,(t,r)=>r.payload).addCase(Hs.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Bs,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function $m(){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 Qm=/^(?:[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 GC(e){return typeof e=="string"&&Qm.test(e)}var Cl=GC;m();d();f();p();var Je=[];for(let e=0;e<256;++e)Je.push((e+256).toString(16).slice(1));function Hm(e,t=0){return(Je[e[t+0]]+Je[e[t+1]]+Je[e[t+2]]+Je[e[t+3]]+"-"+Je[e[t+4]]+Je[e[t+5]]+"-"+Je[e[t+6]]+Je[e[t+7]]+"-"+Je[e[t+8]]+Je[e[t+9]]+"-"+Je[e[t+10]]+Je[e[t+11]]+Je[e[t+12]]+Je[e[t+13]]+Je[e[t+14]]+Je[e[t+15]]).toLowerCase()}m();d();f();p();var $C=new Uint8Array(16);function xl(){return crypto.getRandomValues($C)}m();d();f();p();function QC(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():HC(e,t,r)}function HC(e,t,r){e=e||{};let n=e.random??e.rng?.()??xl();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 Hm(n)}var El=QC;function zC(_x17){return _zC.apply(this,arguments)}function _zC(){_zC=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:i,mode:s}=e;if(s!=="disabled")return n.call(r),t.send(o,i,r)});return _zC.apply(this,arguments)}var Zm="2.1.3",Il=128,Jm=192,zm=224,Wm=240,WC=248;function KC(e){return(e&WC)===Wm?4:(e&Wm)===zm?3:(e&zm)===Jm?2:1}function YC(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&Il)!=Il)break;if(r-=3,(n&Jm)!=Il){t-r>=KC(n)*3&&(r=t);break}}return e.substring(0,r)}function XC(e){let{trackingId:t}=e;return{trackingId:t}}function ZC(e){return(e.source||[]).concat([`relay@${Zm}`])}function eg(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,s=XC(t),a=r.getClientId();return Object.freeze({type:e,config:s,ts:Date.now(),source:ZC(t),clientId:a,userAgent:i(),referrer:Km(n()),location:Km(o())})}function Km(e){return e!==null?YC(e,1024):null}function JC(e,t,r,n){return{...t,meta:eg(e,r,n)}}var ex="*";function tx(){let e=[];function t({type:c,callback:u}){return e.findIndex(g=>g.type===c&&g.callback===u)}function r(c,u){return c.type==="*"||u===c.type}function n(c){return t(c)<0&&e.push(c),()=>a(c.type,c.callback)}function o(c){e.forEach(u=>{if(r(u,c.meta.type))try{u.callback(c)}catch(g){console.error(g)}})}function i(c){if(c===ex)e.length=0;else for(let u=e.length-1;u>=0;u--)e[u].type===c&&e.splice(u,1)}function s(c){let u=t(c);u>=0&&e.splice(u,1)}function a(c,u){u?s({type:c,callback:u}):i(c)}return{add:n,call:o,remove:a}}function Ym({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 rx(e){let t=Ym(e);return{get:()=>t,update:r=>{t=Ym({...t,...r})}}}var Rl=nx();function nx(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,o=document.cookie.split(";");for(let i of o){let s=i.replace(/^\s+/,"");if(s.lastIndexOf(n,0)===0)return s.substring(n.length,s.length)}return null},setItem(r,n,o){let i=t(window.location.hostname),s=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,a=i?`;domain=${i}`:"";document.cookie=`${e}${r}=${n}${s}${a};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function ox(){return{getItem(e){return Rl.getItem(e)||localStorage.getItem(e)},removeItem(e){Rl.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Rl.setItem(e,t,31556952e3)}}}var Xm="visitorId";function ix(){let e=document.referrer;return e===""?null:e}function Tl(){let e=ox();return{runtime:"browser",send:function(){var _ref10=_asyncToGenerator(function*(t,r,n){let o=C(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});$m().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let s=yield o;if(s?.ok){let a;try{a=yield s.json()}catch{return}for(let c of a.events)if(!c.accepted)throw new Error(`Received event was rejected for processing: ${c.errorMessage}`)}else throw new Error(`Error ${s.status}: Failed to send the event(s).`)});return function send(_x18,_x19,_x20){return _ref10.apply(this,arguments)}}(),getReferrer:()=>ix(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(Xm);if(t&&Cl(t))return t;let r=El();return e.setItem(Xm,r),r}}}function sx(){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 ax(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function cx(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=ax();return t&&r?{...r,runtime:"custom"}:t&&ux()&&sx()?Tl():n}function ux(){try{return typeof window=="object"}catch{return!1}}function lx(e){return{get:()=>Object.freeze(cx(e))}}function tg(e){let t=rx(e),r=tx(),n=lx(t);return{emit:function(){var _ref11=_asyncToGenerator(function*(o,i){let s=t.get(),a=n.get(),c=JC(o,i,s,a);return zC({config:s,environment:a,event:c,listenerManager:r})});return function emit(_x21,_x22){return _ref11.apply(this,arguments)}}(),getMeta:o=>eg(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:Zm}}m();d();f();p();function rg(){return typeof window<"u"&&typeof document<"u"}m();d();f();p();var Kn=Be(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Hn}`));var dx=50,px=Rs({memoize:gl,memoizeOptions:{maxSize:dx}}),ci=px(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Kn(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},s,a)=>{let c=mx(a);return tg({mode:i?"emit":"disabled",url:o??os(e,t),token:r,trackingId:n??null,source:s,environment:c})}),fx={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref12=_asyncToGenerator(function*(){});return function send(){return _ref12.apply(this,arguments)}}()},mx=e=>{if(!e)return;let t=e();return{...(rg()?Tl():fx),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();m();d();f();p();m();d();f();p();var ng=class extends Error{constructor(t){super(t[0].message);oe(this,"issues");this.name="SchemaError",this.issues=t}};var ar="uninitialized",Ol="pending",li="fulfilled",di="rejected";function og(e){return{status:e,isUninitialized:e===ar,isLoading:e===Ol,isSuccess:e===li,isError:e===di}}var ig=Vt;function Sg(e,t){if(e===t||!(ig(e)&&ig(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),o=r.length===n.length,i=Array.isArray(t)?[]:{};for(let s of r)i[s]=Sg(e[s],t[s]),o&&(o=e[s]===i[s]);return o?e:i}function Pl(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function gx(e){return new RegExp("(^|:)//").test(e)}function hx(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Ml(e){return e!=null}function sg(e){return[...(e?.values()??[])].filter(Ml)}function yx(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var vx=e=>e.replace(/\/$/,""),Sx=e=>e.replace(/^\//,"");function Ax(e,t){if(!e)return t;if(!t)return e;if(gx(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=vx(e),t=Sx(t),`${e}${r}${t}`}function Ks(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var Nl=()=>new Map,bx=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},wx=(...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},ag=(...e)=>C(...e),Cx=e=>e.status>=200&&e.status<=299,xx=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function cg(e){if(!Vt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var Ex=e=>typeof e=="object"&&(Vt(e)||Array.isArray(e)||typeof e.toJSON=="function");function Ag({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=ag,paramsSerializer:n,isJsonContentType:o=xx,jsonContentType:i="application/json",jsonReplacer:s,timeout:a,responseHandler:c,validateStatus:u,...g}={}){return typeof C>"u"&&r===ag&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*(w,h,y){let{getState:S,extra:x,endpoint:I,forced:_,type:R}=h,T,{url:k,headers:F=new E(g.headers),params:V=void 0,responseHandler:U=c??"json",validateStatus:L=u??Cx,timeout:j=a,...M}=typeof w=="string"?{url:w}:w,O={...g,signal:j?wx(h.signal,bx(j)):h.signal,...M};F=new E(cg(F)),O.headers=(yield t(F,{getState:S,arg:w,extra:x,endpoint:I,forced:_,type:R,extraOptions:y}))||F;let P=Ex(O.body);if(O.body!=null&&!P&&typeof O.body!="string"&&O.headers.delete("content-type"),!O.headers.has("content-type")&&P&&O.headers.set("content-type",i),P&&o(O.headers)&&(O.body=JSON.stringify(O.body,s)),O.headers.has("accept")||(U==="json"?O.headers.set("accept","application/json"):U==="text"&&O.headers.set("accept","text/plain, text/html, */*")),V){let J=~k.indexOf("?")?"&":"?",se=n?n(V):new URLSearchParams(cg(V));k+=J+se}k=Ax(e,k);let N=new Request(k,O);T={request:new Request(k,O)};let $;try{$=yield r(N)}catch(J){return{error:{status:(J instanceof Error||typeof DOMException<"u"&&J instanceof DOMException)&&J.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(J)},meta:T}}let Y=$.clone();T.response=Y;let K,H="";try{let J;if(yield Promise.all([v($,U).then(se=>K=se,se=>J=se),Y.text().then(se=>H=se,()=>{})]),J)throw J}catch(J){return{error:{status:"PARSING_ERROR",originalStatus:$.status,data:H,error:String(J)},meta:T}}return L($,K)?{data:K,meta:T}:{error:{status:$.status,data:K},meta:T}});return function(_x23,_x24,_x25){return _ref13.apply(this,arguments)}}());function v(_x26,_x27){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(w,h){if(typeof h=="function")return h(w);if(h==="content-type"&&(h=o(w.headers)?"json":"text"),h==="json"){let y=yield w.text();return y.length?JSON.parse(y):null}return w.text()});return _v2.apply(this,arguments)}}var Yn=class{constructor(e,t=void 0){oe(this,"value");oe(this,"meta");this.value=e,this.meta=t}};function Ix(){return _Ix.apply(this,arguments)}function _Ix(){_Ix=_asyncToGenerator(function*(e=0,t=5,r){let n=Math.min(e,t),o=~~((Math.random()+.4)*(300<<n));yield new Promise((i,s)=>{let a=setTimeout(()=>i(),o);if(r){let c=()=>{clearTimeout(a),s(new Error("Aborted"))};r.aborted?(clearTimeout(a),s(new Error("Aborted"))):r.addEventListener("abort",c,{once:!0})}})});return _Ix.apply(this,arguments)}function bg(e,t){throw Object.assign(new Yn({error:e,meta:t}),{throwImmediately:!0})}function kl(e){e.aborted&&bg({status:"CUSTOM_ERROR",error:"Aborted"})}var ug={},Rx=(e,t)=>(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(r,n,o){let i=[5,(t||ug).maxRetries,(o||ug).maxRetries].filter(g=>g!==void 0),[s]=i.slice(-1),c={maxRetries:s,backoff:Ix,retryCondition:(g,v,{attempt:w})=>w<=s,...t,...o},u=0;for(;;){kl(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Yn(g);return g}catch(g){if(u++,g.throwImmediately){if(g instanceof Yn)return g.value;throw g}if(g instanceof Yn){if(!c.retryCondition(g.value.error,r,{attempt:u,baseQueryApi:n,extraOptions:o}))return g.value}else if(u>c.maxRetries)return{error:g};kl(n.signal);try{yield c.backoff(u,c.maxRetries,n.signal)}catch(v){throw kl(n.signal),v}}}});return function(_x28,_x29,_x30){return _ref14.apply(this,arguments)}}()),wg=Object.assign(Rx,{fail:bg}),Xs="__rtkq/",Tx="online",kx="offline";var Cg="focused";var Ll=B(`${Xs}${Cg}`),xg=B(`${Xs}un${Cg}`),jl=B(`${Xs}${Tx}`),Eg=B(`${Xs}${kx}`);var mi="query",Ig="mutation",Rg="infinitequery";function Zs(e){return e.type===mi}function _x(e){return e.type===Ig}function Js(e){return e.type===Rg}function Ys(e){return Zs(e)||Js(e)}function ql(e,t,r,n,o,i){let s=Ox(e)?e(t,r,n,o):e;return s?Pl(s,Ml,a=>i(Tg(a))):[]}function Ox(e){return typeof e=="function"}function Tg(e){return typeof e=="string"?{type:e}:e}function Px(e,t){return e.catch(t)}var Xn=(e,t)=>e.endpointDefinitions[t],pi=Symbol("forceQueryFn"),Fl=e=>typeof e[pi]=="function";function Nx({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:s}){let a=k=>s(k)?.runningQueries,c=k=>s(k)?.runningMutations,{unsubscribeQueryResult:u,removeMutationResult:g,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:_,buildInitiateInfiniteQuery:R,buildInitiateMutation:T,getRunningQueryThunk:w,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:S};function w(k,F){return V=>{let U=Xn(i,k),L=e({queryArgs:F,endpointDefinition:U,endpointName:k});return a(V)?.get(L)}}function h(k,F){return V=>c(V)?.get(F)}function y(){return k=>sg(a(k))}function S(){return k=>sg(c(k))}function x(k){}function I(k,F){let V=(U,{subscribe:L=!0,forceRefetch:j,subscriptionOptions:M,[pi]:O,...P}={})=>(N,Q)=>{let $=e({queryArgs:U,endpointDefinition:F,endpointName:k}),Y,K={...P,type:mi,subscribe:L,forceRefetch:j,subscriptionOptions:M,endpointName:k,originalArgs:U,queryCacheKey:$,[pi]:O};if(Zs(F))Y=t(K);else{let{direction:de,initialPageParam:he,refetchCachedPages:fe}=P;Y=r({...K,direction:de,initialPageParam:he,refetchCachedPages:fe})}let H=o.endpoints[k].select(U),J=N(Y),se=H(Q());let{requestId:be,abort:Ne}=J,Ie=se.requestId!==be,ke=a(N)?.get($),_e=()=>H(Q()),pe=Object.assign(O?J.then(_e):Ie&&!ke?Promise.resolve(se):Promise.all([ke,J]).then(_e),{arg:U,requestId:be,subscriptionOptions:M,queryCacheKey:$,abort:Ne,unwrap(){return _asyncToGenerator(function*(){let de=yield pe;if(de.isError)throw de.error;return de.data})()},refetch:de=>N(V(U,{subscribe:!1,forceRefetch:!0,...de})),unsubscribe(){L&&N(u({queryCacheKey:$,requestId:be}))},updateSubscriptionOptions(de){pe.subscriptionOptions=de,N(v({endpointName:k,requestId:be,queryCacheKey:$,options:de}))}});if(!ke&&!Ie&&!O){let de=a(N);de.set($,pe),pe.then(()=>{de.delete($)})}return pe};return V}function _(k,F){return I(k,F)}function R(k,F){return I(k,F)}function T(k){return(F,{track:V=!0,fixedCacheKey:U}={})=>(L,j)=>{let M=n({type:"mutation",endpointName:k,originalArgs:F,track:V,fixedCacheKey:U}),O=L(M);let{requestId:P,abort:N,unwrap:Q}=O,$=Px(O.unwrap().then(J=>({data:J})),J=>({error:J})),Y=()=>{L(g({requestId:P,fixedCacheKey:U}))},K=Object.assign($,{arg:O.arg,requestId:P,abort:N,unwrap:Q,reset:Y}),H=c(L);return H.set(P,K),K.then(()=>{H.delete(P)}),U&&(H.set(U,K),K.then(()=>{H.get(U)===K&&H.delete(U)})),K}}}var kg=class extends ng{constructor(t,r,n,o){super(t);oe(this,"value");oe(this,"schemaName");oe(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},Yr=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function Xr(_x31,_x32,_x33,_x34){return _Xr.apply(this,arguments)}function _Xr(){_Xr=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new kg(o.issues,t,r,n);return o.value});return _Xr.apply(this,arguments)}function lg(e){return e}var ui=(e={})=>({...e,[oi]:!0});function Fx({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:s,onSchemaFailure:a,catchSchemaFailure:c,skipSchemaValidation:u}){let g=(M,O,P,N)=>(Q,$)=>{let Y=r[M],K=n({queryArgs:O,endpointDefinition:Y,endpointName:M});if(Q(o.internalActions.queryResultPatched({queryCacheKey:K,patches:P})),!N)return;let H=o.endpoints[M].select(O)($()),J=ql(Y.providesTags,H.data,void 0,O,{},i);Q(o.internalActions.updateProvidedBy([{queryCacheKey:K,providedTags:J}]))};function v(M,O,P=0){let N=[O,...M];return P&&N.length>P?N.slice(0,-1):N}function w(M,O,P=0){let N=[...M,O];return P&&N.length>P?N.slice(1):N}let h=(M,O,P,N=!0)=>(Q,$)=>{let K=o.endpoints[M].select(O)($()),H={patches:[],inversePatches:[],undo:()=>Q(o.util.patchQueryData(M,O,H.inversePatches,N))};if(K.status===ar)return H;let J;if("data"in K)if(it(K.data)){let[se,be,Ne]=fl(K.data,P);H.patches.push(...be),H.inversePatches.push(...Ne),J=se}else J=P(K.data),H.patches.push({op:"replace",path:[],value:J}),H.inversePatches.push({op:"replace",path:[],value:K.data});return H.patches.length===0||Q(o.util.patchQueryData(M,O,H.patches,N)),H},y=(M,O,P)=>N=>N(o.endpoints[M].initiate(O,{subscribe:!1,forceRefetch:!0,[pi]:()=>({data:P})})),S=(M,O)=>M.query&&M[O]?M[O]:lg,x=/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(M,{signal:O,abort:P,rejectWithValue:N,fulfillWithValue:Q,dispatch:$,getState:Y,extra:K}){let H=r[M.endpointName],{metaSchema:J,skipSchemaValidation:se=u}=H,be=M.type===mi;try{let Ne=lg,Ie={signal:O,abort:P,dispatch:$,getState:Y,extra:K,endpoint:M.endpointName,type:M.type,forced:be?I(M,Y()):void 0,queryCacheKey:be?M.queryCacheKey:void 0},ke=be?M[pi]:void 0,_e,pe=/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(he,fe,Ve,ze){if(fe==null&&he.pages.length)return Promise.resolve({data:he});let _t={queryArg:M.originalArgs,pageParam:fe},gt=yield de(_t),Ut=ze?v:w;return{data:{pages:Ut(he.pages,gt.data,Ve),pageParams:Ut(he.pageParams,fe,Ve)},meta:gt.meta}});return function pe(_x37,_x38,_x39,_x40){return _ref16.apply(this,arguments)}}();function de(_x41){return _de.apply(this,arguments)}function _de(){_de=_asyncToGenerator(function*(he){let fe,{extraOptions:Ve,argSchema:ze,rawResponseSchema:_t,responseSchema:gt}=H;if(ze&&!Yr(se,"arg")&&(he=yield Xr(ze,he,"argSchema",{})),ke?fe=ke():H.query?(Ne=S(H,"transformResponse"),fe=yield t(H.query(he),Ie,Ve)):fe=yield H.queryFn(he,Ie,Ve,Ot=>t(Ot,Ie,Ve)),typeof process<"u",fe.error)throw new Yn(fe.error,fe.meta);let{data:Ut}=fe;_t&&!Yr(se,"rawResponse")&&(Ut=yield Xr(_t,fe.data,"rawResponseSchema",fe.meta));let bt=yield Ne(Ut,fe.meta,he);return gt&&!Yr(se,"response")&&(bt=yield Xr(gt,bt,"responseSchema",fe.meta)),{...fe,data:bt}});return _de.apply(this,arguments)}if(be&&"infiniteQueryOptions"in H){let{infiniteQueryOptions:he}=H,{maxPages:fe=1/0}=he,Ve=M.refetchCachedPages??he.refetchCachedPages??!0,ze,_t={pages:[],pageParams:[]},gt=s.selectQueryEntry(Y(),M.queryCacheKey)?.data,bt=I(M,Y())&&!M.direction||!gt?_t:gt;if("direction"in M&&M.direction&&bt.pages.length){let Ot=M.direction==="backward",Yi=(Ot?_g:Dl)(he,bt,M.originalArgs);ze=yield pe(bt,Yi,fe,Ot)}else{let{initialPageParam:Ot=he.initialPageParam}=M,Mo=gt?.pageParams??[],Yi=Mo[0]??Ot,ab=Mo.length;if(ze=yield pe(bt,Yi,fe),ke&&(ze={data:ze.data.pages[0]}),Ve)for(let Kp=1;Kp<ab;Kp++){let cb=Dl(he,ze.data,M.originalArgs);ze=yield pe(ze.data,cb,fe)}}_e=ze}else _e=yield de(M.originalArgs);return J&&!Yr(se,"meta")&&_e.meta&&(_e.meta=yield Xr(J,_e.meta,"metaSchema",_e.meta)),Q(_e.data,ui({fulfilledTimeStamp:Date.now(),baseQueryMeta:_e.meta}))}catch(Ne){let Ie=Ne;if(Ie instanceof Yn){let ke=S(H,"transformErrorResponse"),{rawErrorResponseSchema:_e,errorResponseSchema:pe}=H,{value:de,meta:he}=Ie;try{_e&&!Yr(se,"rawErrorResponse")&&(de=yield Xr(_e,de,"rawErrorResponseSchema",he)),J&&!Yr(se,"meta")&&(he=yield Xr(J,he,"metaSchema",he));let fe=yield ke(de,he,M.originalArgs);return pe&&!Yr(se,"errorResponse")&&(fe=yield Xr(pe,fe,"errorResponseSchema",he)),N(fe,ui({baseQueryMeta:he}))}catch(fe){Ie=fe}}try{if(Ie instanceof kg){let ke={endpoint:M.endpointName,arg:M.originalArgs,type:M.type,queryCacheKey:be?M.queryCacheKey:void 0};H.onSchemaFailure?.(Ie,ke),a?.(Ie,ke);let{catchSchemaFailure:_e=c}=H;if(_e)return N(_e(Ie,ke),ui({baseQueryMeta:Ie._bqMeta}))}}catch(ke){Ie=ke}throw typeof process<"u",console.error(Ie),Ie}});return function x(_x35,_x36){return _ref15.apply(this,arguments)}}();function I(M,O){let P=s.selectQueryEntry(O,M.queryCacheKey),N=s.selectConfig(O).refetchOnMountOrArgChange,Q=P?.fulfilledTimeStamp,$=M.forceRefetch??(M.subscribe&&N);return $?$===!0||(Number(new Date)-Number(Q))/1e3>=$:!1}let _=()=>Ce(`${e}/executeQuery`,x,{getPendingMeta({arg:O}){let P=r[O.endpointName];return ui({startedTimeStamp:Date.now(),...(Js(P)?{direction:O.direction}:{})})},condition(O,{getState:P}){let N=P(),Q=s.selectQueryEntry(N,O.queryCacheKey),$=Q?.fulfilledTimeStamp,Y=O.originalArgs,K=Q?.originalArgs,H=r[O.endpointName],J=O.direction;return Fl(O)?!0:Q?.status==="pending"?!1:I(O,N)||Zs(H)&&H?.forceRefetch?.({currentArg:Y,previousArg:K,endpointState:Q,state:N})?!0:!($&&!J)},dispatchConditionRejection:!0}),R=_(),T=_(),k=Ce(`${e}/executeMutation`,x,{getPendingMeta(){return ui({startedTimeStamp:Date.now()})}}),F=M=>"force"in M,V=M=>"ifOlderThan"in M,U=(M,O,P={})=>(N,Q)=>{let $=F(P)&&P.force,Y=V(P)&&P.ifOlderThan,K=(J=!0)=>{let se={forceRefetch:J,subscribe:!1};return o.endpoints[M].initiate(O,se)},H=o.endpoints[M].select(O)(Q());if($)N(K());else if(Y){let J=H?.fulfilledTimeStamp;if(!J){N(K());return}(Number(new Date)-Number(new Date(J)))/1e3>=Y&&N(K())}else N(K(!1))};function L(M){return O=>O?.meta?.arg?.endpointName===M}function j(M,O){return{matchPending:$n(Ns(M),L(O)),matchFulfilled:$n(ir(M),L(O)),matchRejected:$n(Wr(M),L(O))}}return{queryThunk:R,mutationThunk:k,infiniteQueryThunk:T,prefetch:U,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:j}}function Dl(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function _g(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function Og(e,t,r,n){return ql(r[e.meta.arg.endpointName][t],ir(e)?e.payload:void 0,si(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function dg(e){return ct(e)?xs(e):e}function zs(e,t,r){let n=e[t];n&&r(n)}function fi(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function pg(e,t,r){let n=e[fi(t)];n&&r(n)}var Ws={};function Dx({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:s,hasRehydrationInfo:a},assertTagType:c,config:u}){let g=B(`${e}/resetApiState`);function v(L,j,M,O){var P;L[P=j.queryCacheKey]??(L[P]={status:ar,endpointName:j.endpointName}),zs(L,j.queryCacheKey,N=>{N.status=Ol,N.requestId=M&&N.requestId?N.requestId:O.requestId,j.originalArgs!==void 0&&(N.originalArgs=j.originalArgs),N.startedTimeStamp=O.startedTimeStamp;let Q=o[O.arg.endpointName];Js(Q)&&"direction"in j&&(N.direction=j.direction)})}function w(L,j,M,O){zs(L,j.arg.queryCacheKey,P=>{if(P.requestId!==j.requestId&&!O)return;let{merge:N}=o[j.arg.endpointName];if(P.status=li,N){if(P.data!==void 0){let{fulfilledTimeStamp:Q,arg:$,baseQueryMeta:Y,requestId:K}=j,H=Hr(P.data,J=>N(J,M,{arg:$.originalArgs,baseQueryMeta:Y,fulfilledTimeStamp:Q,requestId:K}));P.data=H}else P.data=M;}else P.data=o[j.arg.endpointName].structuralSharing??!0?Sg(ct(P.data)?Hf(P.data):P.data,M):M;delete P.error,P.fulfilledTimeStamp=j.fulfilledTimeStamp})}let h=Kr({name:`${e}/queries`,initialState:Ws,reducers:{removeQueryResult:{reducer(L,{payload:{queryCacheKey:j}}){delete L[j]},prepare:Qn()},cacheEntriesUpserted:{reducer(L,j){for(let M of j.payload){let{queryDescription:O,value:P}=M;v(L,O,!0,{arg:O,requestId:j.meta.requestId,startedTimeStamp:j.meta.timestamp}),w(L,{arg:O,requestId:j.meta.requestId,fulfilledTimeStamp:j.meta.timestamp,baseQueryMeta:{}},P,!0)}},prepare:L=>({payload:L.map(O=>{let{endpointName:P,arg:N,value:Q}=O,$=o[P];return{queryDescription:{type:mi,endpointName:P,originalArgs:O.arg,queryCacheKey:n({queryArgs:N,endpointDefinition:$,endpointName:P})},value:Q}}),meta:{[oi]:!0,requestId:ai(),timestamp:Date.now()}})},queryResultPatched:{reducer(L,{payload:{queryCacheKey:j,patches:M}}){zs(L,j,O=>{O.data=ml(O.data,M.concat())})},prepare:Qn()}},extraReducers(L){L.addCase(t.pending,(j,{meta:M,meta:{arg:O}})=>{let P=Fl(O);v(j,O,P,M)}).addCase(t.fulfilled,(j,{meta:M,payload:O})=>{let P=Fl(M.arg);w(j,M,O,P)}).addCase(t.rejected,(j,{meta:{condition:M,arg:O,requestId:P},error:N,payload:Q})=>{zs(j,O.queryCacheKey,$=>{if(!M){if($.requestId!==P)return;$.status=di,$.error=Q??N}})}).addMatcher(a,(j,M)=>{let{queries:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===li||N?.status===di)&&(j[P]=N)})}}),y=Kr({name:`${e}/mutations`,initialState:Ws,reducers:{removeMutationResult:{reducer(L,{payload:j}){let M=fi(j);M in L&&delete L[M]},prepare:Qn()}},extraReducers(L){L.addCase(r.pending,(j,{meta:M,meta:{requestId:O,arg:P,startedTimeStamp:N}})=>{P.track&&(j[fi(M)]={requestId:O,status:Ol,endpointName:P.endpointName,startedTimeStamp:N})}).addCase(r.fulfilled,(j,{payload:M,meta:O})=>{O.arg.track&&pg(j,O,P=>{P.requestId===O.requestId&&(P.status=li,P.data=M,P.fulfilledTimeStamp=O.fulfilledTimeStamp)})}).addCase(r.rejected,(j,{payload:M,error:O,meta:P})=>{P.arg.track&&pg(j,P,N=>{N.requestId===P.requestId&&(N.status=di,N.error=M??O)})}).addMatcher(a,(j,M)=>{let{mutations:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===li||N?.status===di)&&P!==N?.requestId&&(j[P]=N)})}}),S={tags:{},keys:{}},x=Kr({name:`${e}/invalidation`,initialState:S,reducers:{updateProvidedBy:{reducer(L,j){var M,O,P;for(let{queryCacheKey:N,providedTags:Q}of j.payload){I(L,N);for(let{type:$,id:Y}of Q){let K=(O=(M=L.tags)[$]??(M[$]={}))[P=Y||"__internal_without_id"]??(O[P]=[]);K.includes(N)||K.push(N)}L.keys[N]=Q}},prepare:Qn()}},extraReducers(L){L.addCase(h.actions.removeQueryResult,(j,{payload:{queryCacheKey:M}})=>{I(j,M)}).addMatcher(a,(j,M)=>{var P,N,Q;let{provided:O}=s(M);for(let[$,Y]of Object.entries(O.tags??{}))for(let[K,H]of Object.entries(Y)){let J=(N=(P=j.tags)[$]??(P[$]={}))[Q=K||"__internal_without_id"]??(N[Q]=[]);for(let se of H)J.includes(se)||J.push(se),j.keys[se]=O.keys[se]}}).addMatcher(Bt(ir(t),si(t)),(j,M)=>{_(j,[M])}).addMatcher(h.actions.cacheEntriesUpserted.match,(j,M)=>{let O=M.payload.map(({queryDescription:P,value:N})=>({type:"UNKNOWN",payload:N,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:P}}));_(j,O)})}});function I(L,j){let M=dg(L.keys[j]??[]);for(let O of M){let P=O.type,N=O.id??"__internal_without_id",Q=L.tags[P]?.[N];Q&&(L.tags[P][N]=dg(Q).filter($=>$!==j))}delete L.keys[j]}function _(L,j){let M=j.map(O=>{let P=Og(O,"providesTags",o,c),{queryCacheKey:N}=O.meta.arg;return{queryCacheKey:N,providedTags:P}});x.caseReducers.updateProvidedBy(L,x.actions.updateProvidedBy(M))}let R=Kr({name:`${e}/subscriptions`,initialState:Ws,reducers:{updateSubscriptionOptions(L,j){},unsubscribeQueryResult(L,j){},internal_getRTKQSubscriptions(){}}}),T=Kr({name:`${e}/internalSubscriptions`,initialState:Ws,reducers:{subscriptionsUpdated:{reducer(L,j){return ml(L,j.payload)},prepare:Qn()}}}),k=Kr({name:`${e}/config`,initialState:{online:yx(),focused:hx(),middlewareRegistered:!1,...u},reducers:{middlewareRegistered(L,{payload:j}){L.middlewareRegistered=L.middlewareRegistered==="conflict"||i!==j?"conflict":!0}},extraReducers:L=>{L.addCase(jl,j=>{j.online=!0}).addCase(Eg,j=>{j.online=!1}).addCase(Ll,j=>{j.focused=!0}).addCase(xg,j=>{j.focused=!1}).addMatcher(a,j=>({...j}))}}),F=qn({queries:h.reducer,mutations:y.reducer,provided:x.reducer,subscriptions:T.reducer,config:k.reducer}),V=(L,j)=>F(g.match(j)?void 0:L,j),U={...k.actions,...h.actions,...R.actions,...T.actions,...y.actions,...x.actions,resetApiState:g};return{reducer:V,actions:U}}var _l=Symbol.for("RTKQ/skipToken"),Pg={status:ar},fg=Hr(Pg,()=>{}),mg=Hr(Pg,()=>{});function Mx({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=R=>fg,o=R=>mg;return{buildQuerySelector:w,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:S,selectCachedArgsForQuery:x,selectApiState:s,selectQueries:a,selectMutations:u,selectQueryEntry:c,selectConfig:g};function i(R){return{...R,...og(R.status)}}function s(R){return R[t]}function a(R){return s(R)?.queries}function c(R,T){return a(R)?.[T]}function u(R){return s(R)?.mutations}function g(R){return s(R)?.config}function v(R,T,k){return F=>{if(F===_l)return r(n,k);let V=e({queryArgs:F,endpointDefinition:T,endpointName:R});return r(L=>c(L,V)??fg,k)}}function w(R,T){return v(R,T,i)}function h(R,T){let{infiniteQueryOptions:k}=T;function F(V){let U={...V,...og(V.status)},{isLoading:L,isError:j,direction:M}=U,O=M==="forward",P=M==="backward";return{...U,hasNextPage:I(k,U.data,U.originalArgs),hasPreviousPage:_(k,U.data,U.originalArgs),isFetchingNextPage:L&&O,isFetchingPreviousPage:L&&P,isFetchNextPageError:j&&O,isFetchPreviousPageError:j&&P}}return v(R,T,F)}function y(){return R=>{let T;return typeof R=="object"?T=fi(R)??_l:T=R,r(T===_l?o:V=>s(V)?.mutations?.[T]??mg,i)}}function S(R,T){let k=R[t],F=new Set,V=Pl(T,Ml,Tg);for(let U of V){let L=k.provided.tags[U.type];if(!L)continue;let j=(U.id!==void 0?L[U.id]:Object.values(L).flat())??[];for(let M of j)F.add(M)}return Array.from(F.values()).flatMap(U=>{let L=k.queries[U];return L?{queryCacheKey:U,endpointName:L.endpointName,originalArgs:L.originalArgs}:[]})}function x(R,T){return Pl(Object.values(a(R)),k=>k?.endpointName===T&&k.status!==ar,k=>k.originalArgs)}function I(R,T,k){return T?Dl(R,T,k)!=null:!1}function _(R,T,k){return!T||!R.getPreviousPageParam?!1:_g(R,T,k)!=null}}var gg=WeakMap?new WeakMap:void 0,hg=({endpointName:e,queryArgs:t})=>{let r="",n=gg?.get(t);if(typeof n=="string")r=n;else{let o=JSON.stringify(t,(i,s)=>(s=typeof s=="bigint"?{$bigint:s.toString()}:s,s=Vt(s)?Object.keys(s).sort().reduce((a,c)=>(a[c]=s[c],a),{}):s,s));Vt(t)&&gg?.set(t,o),r=o}return`${e}(${r})`};function Lx(...e){return function(r){let n=Bn(u=>r.extractRehydrationInfo?.(u,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(u){let g=hg;if("serializeQueryArgs"in u.endpointDefinition){let v=u.endpointDefinition.serializeQueryArgs;g=w=>{let h=v(w);return typeof h=="string"?h:hg({...w,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(u)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(u){u()},apiUid:ai(),extractRehydrationInfo:n,hasRehydrationInfo:Bn(u=>n(u)!=null)},s={injectEndpoints:c,enhanceEndpoints({addTagTypes:u,endpoints:g}){if(u)for(let v of u)o.tagTypes.includes(v)||o.tagTypes.push(v);if(g)for(let[v,w]of Object.entries(g))typeof w=="function"?w(Xn(i,v)):Object.assign(Xn(i,v)||{},w);return s}},a=e.map(u=>u.init(s,o,i));function c(u){let g=u.endpoints({query:v=>({...v,type:mi}),mutation:v=>({...v,type:Ig}),infiniteQuery:v=>({...v,type:Rg})});for(let[v,w]of Object.entries(g)){if(u.overrideExisting!==!0&&v in i.endpointDefinitions){if(u.overrideExisting==="throw")throw new Error(ut(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[v]=w;for(let h of a)h.injectEndpoint(v,w)}return s}return s.injectEndpoints({endpoints:r.endpoints})}}function sr(e,...t){return Object.assign(e,...t)}var jx=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,i=null,s=null,{updateSubscriptionOptions:a,unsubscribeQueryResult:c}=e.internalActions,u=(S,x)=>{if(a.match(x)){let{queryCacheKey:_,requestId:R,options:T}=x.payload,k=S.get(_);return k?.has(R)&&k.set(R,T),!0}if(c.match(x)){let{queryCacheKey:_,requestId:R}=x.payload,T=S.get(_);return T&&T.delete(R),!0}if(e.internalActions.removeQueryResult.match(x))return S.delete(x.payload.queryCacheKey),!0;if(t.pending.match(x)){let{meta:{arg:_,requestId:R}}=x,T=Ks(S,_.queryCacheKey,Nl);return _.subscribe&&T.set(R,_.subscriptionOptions??T.get(R)??{}),!0}let I=!1;if(t.rejected.match(x)){let{meta:{condition:_,arg:R,requestId:T}}=x;if(_&&R.subscribe){let k=Ks(S,R.queryCacheKey,Nl);k.set(T,R.subscriptionOptions??k.get(T)??{}),I=!0}}return I},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:S=>g().get(S)?.size??0,isRequestSubscribed:(S,x)=>!!g()?.get(S)?.get(x)};function y(S){return JSON.parse(JSON.stringify(Object.fromEntries([...S].map(([x,I])=>[x,Object.fromEntries(I)]))))}return(S,x)=>{if(i||(i=y(r.currentSubscriptions)),e.util.resetApiState.match(S))return i={},r.currentSubscriptions.clear(),s=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(S))return[!1,h];let I=u(r.currentSubscriptions,S),_=!0;if(I){s||(s=setTimeout(()=>{let k=y(r.currentSubscriptions),[,F]=fl(i,()=>k);x.next(e.internalActions.subscriptionsUpdated(F)),i=k,s=null},500));let R=typeof S.type=="string"&&!!S.type.startsWith(o),T=t.rejected.match(S)&&S.meta.condition&&!!S.meta.arg.subscribe;_=!R&&!T}return[_,!1]}},qx=2147483647/1e3-1,Ux=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:s},getRunningQueryThunk:a,mwApi:c})=>{let{removeQueryResult:u,unsubscribeQueryResult:g,cacheEntriesUpserted:v}=t.internalActions,w=Bt(g.match,r.fulfilled,r.rejected,v.match);function h(R){let T=o.currentSubscriptions.get(R);return T?T.size>0:!1}let y={};function S(R){for(let T of R.values())T?.abort?.()}let x=(R,T)=>{let k=T.getState(),F=s(k);if(w(R)){let V;if(v.match(R))V=R.payload.map(U=>U.queryDescription.queryCacheKey);else{let{queryCacheKey:U}=g.match(R)?R.payload:R.meta.arg;V=[U]}I(V,T,F)}if(t.util.resetApiState.match(R)){for(let[V,U]of Object.entries(y))U&&clearTimeout(U),delete y[V];S(o.runningQueries),S(o.runningMutations)}if(n.hasRehydrationInfo(R)){let{queries:V}=n.extractRehydrationInfo(R);I(Object.keys(V),T,F)}};function I(R,T,k){let F=T.getState();for(let V of R){let U=i(F,V);U?.endpointName&&_(V,U.endpointName,T,k)}}function _(R,T,k,F){let U=Xn(n,T)?.keepUnusedDataFor??F.keepUnusedDataFor;if(U===1/0)return;let L=Math.max(0,Math.min(U,qx));if(!h(R)){let j=y[R];j&&clearTimeout(j),y[R]=setTimeout(()=>{if(!h(R)){let M=i(k.getState(),R);M?.endpointName&&k.dispatch(a(M.endpointName,M.originalArgs))?.abort(),k.dispatch(u({queryCacheKey:R}))}delete y[R]},L*1e3)}}return x},yg=new Error("Promise never resolved before cacheEntryRemoved."),Vx=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:s,selectApiState:a}})=>{let c=Fs(n),u=Fs(o),g=ir(n,o),v={},{removeQueryResult:w,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function S(k,F,V){let U=v[k];U?.valueResolved&&(U.valueResolved({data:F,meta:V}),delete U.valueResolved)}function x(k){let F=v[k];F&&(delete v[k],F.cacheEntryRemoved())}function I(k){let{arg:F,requestId:V}=k.meta,{endpointName:U,originalArgs:L}=F;return[U,L,V]}let _=(k,F,V)=>{let U=R(k);function L(j,M,O,P){let N=s(V,M),Q=s(F.getState(),M);!N&&Q&&T(j,P,M,F,O)}if(n.pending.match(k)){let[j,M,O]=I(k);L(j,U,O,M)}else if(y.match(k))for(let{queryDescription:j,value:M}of k.payload){let{endpointName:O,originalArgs:P,queryCacheKey:N}=j;L(O,N,k.meta.requestId,P),S(N,M,{})}else if(o.pending.match(k)){if(F.getState()[t].mutations[U]){let[M,O,P]=I(k);T(M,O,U,F,P)}}else if(g(k))S(U,k.payload,k.meta.baseQueryMeta);else if(w.match(k)||h.match(k))x(U);else if(e.util.resetApiState.match(k))for(let j of Object.keys(v))x(j)};function R(k){return c(k)?k.meta.arg.queryCacheKey:u(k)?k.meta.arg.fixedCacheKey??k.meta.requestId:w.match(k)?k.payload.queryCacheKey:h.match(k)?fi(k.payload):""}function T(k,F,V,U,L){let j=Xn(r,k),M=j?.onCacheEntryAdded;if(!M)return;let O={},P=new Promise(H=>{O.cacheEntryRemoved=H}),N=Promise.race([new Promise(H=>{O.valueResolved=H}),P.then(()=>{throw yg})]);N.catch(()=>{}),v[V]=O;let Q=e.endpoints[k].select(Ys(j)?F:V),$=U.dispatch((H,J,se)=>se),Y={...U,getCacheEntry:()=>Q(U.getState()),requestId:L,extra:$,updateCachedData:Ys(j)?H=>U.dispatch(e.util.updateQueryData(k,F,H)):void 0,cacheDataLoaded:N,cacheEntryRemoved:P},K=M(F,Y);Promise.resolve(K).catch(H=>{if(H!==yg)throw H})}return _},Bx=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},Gx=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:s,refetchQuery:a,internalState:c})=>{let{removeQueryResult:u}=i.internalActions,g=Bt(ir(n),si(n)),v=Bt(ir(o,n),Wr(o,n)),w=[],h=0,y=(I,_)=>{(o.pending.match(I)||n.pending.match(I))&&h++,v(I)&&(h=Math.max(0,h-1)),g(I)?x(Og(I,"invalidatesTags",r,s),_):v(I)?x([],_):i.util.invalidateTags.match(I)&&x(ql(I.payload,void 0,void 0,void 0,void 0,s),_)};function S(){return h>0}function x(I,_){let R=_.getState(),T=R[e];if(w.push(...I),T.config.invalidationBehavior==="delayed"&&S())return;let k=w;if(w=[],k.length===0)return;let F=i.util.selectInvalidatedBy(R,k);t.batch(()=>{let V=Array.from(F.values());for(let{queryCacheKey:U}of V){let L=T.queries[U],j=Ks(c.currentSubscriptions,U,Nl);L&&(j.size===0?_.dispatch(u({queryCacheKey:U})):L.status!==ar&&_.dispatch(a(L)))}})}return y},$x=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:s}=o,a=new Set,c=null,u=(x,I)=>{(r.internalActions.updateSubscriptionOptions.match(x)||r.internalActions.unsubscribeQueryResult.match(x))&&g(x.payload.queryCacheKey,I),(t.pending.match(x)||t.rejected.match(x)&&x.meta.condition)&&g(x.meta.arg.queryCacheKey,I),(t.fulfilled.match(x)||t.rejected.match(x)&&!x.meta.condition)&&v(x.meta.arg,I),r.util.resetApiState.match(x)&&(y(),c&&(clearTimeout(c),c=null),a.clear())};function g(x,I){a.add(x),c||(c=setTimeout(()=>{for(let _ of a)w({queryCacheKey:_},I);a.clear(),c=null},0))}function v({queryCacheKey:x},I){let _=I.getState()[e],R=_.queries[x],T=s.get(x);if(!R||R.status===ar)return;let{lowestPollingInterval:k,skipPollingIfUnfocused:F}=S(T);if(!Number.isFinite(k))return;let V=i.get(x);V?.timeout&&(clearTimeout(V.timeout),V.timeout=void 0);let U=Date.now()+k;i.set(x,{nextPollTimestamp:U,pollingInterval:k,timeout:setTimeout(()=>{(_.config.focused||!F)&&I.dispatch(n(R)),v({queryCacheKey:x},I)},k)})}function w({queryCacheKey:x},I){let R=I.getState()[e].queries[x],T=s.get(x);if(!R||R.status===ar)return;let{lowestPollingInterval:k}=S(T);if(!Number.isFinite(k)){h(x);return}let F=i.get(x),V=Date.now()+k;(!F||V<F.nextPollTimestamp)&&v({queryCacheKey:x},I)}function h(x){let I=i.get(x);I?.timeout&&clearTimeout(I.timeout),i.delete(x)}function y(){for(let x of i.keys())h(x)}function S(x=new Map){let I=!1,_=Number.POSITIVE_INFINITY;for(let R of x.values())R.pollingInterval&&(_=Math.min(R.pollingInterval,_),I=R.skipPollingIfUnfocused||I);return{lowestPollingInterval:_,skipPollingIfUnfocused:I}}return u},Qx=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=Ns(r,n),i=Wr(r,n),s=ir(r,n),a={};return(u,g)=>{if(o(u)){let{requestId:v,arg:{endpointName:w,originalArgs:h}}=u.meta,y=Xn(t,w),S=y?.onQueryStarted;if(S){let x={},I=new Promise((k,F)=>{x.resolve=k,x.reject=F});I.catch(()=>{}),a[v]=x;let _=e.endpoints[w].select(Ys(y)?h:v),R=g.dispatch((k,F,V)=>V),T={...g,getCacheEntry:()=>_(g.getState()),requestId:v,extra:R,updateCachedData:Ys(y)?k=>g.dispatch(e.util.updateQueryData(w,h,k)):void 0,queryFulfilled:I};S(h,T)}}else if(s(u)){let{requestId:v,baseQueryMeta:w}=u.meta;a[v]?.resolve({data:u.payload,meta:w}),delete a[v]}else if(i(u)){let{requestId:v,rejectedWithValue:w,baseQueryMeta:h}=u.meta;a[v]?.reject({error:u.payload??u.error,isUnhandledError:!w,meta:h}),delete a[v]}}},Hx=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,s=(c,u)=>{Ll.match(c)&&a(u,"refetchOnFocus"),jl.match(c)&&a(u,"refetchOnReconnect")};function a(c,u){let g=c.getState()[e],v=g.queries,w=o.currentSubscriptions;t.batch(()=>{for(let h of w.keys()){let y=v[h],S=w.get(h);if(!S||!y)continue;let x=[...S.values()];(x.some(_=>_[u]===!0)||x.every(_=>_[u]===void 0)&&g.config[u])&&(S.size===0?c.dispatch(i({queryCacheKey:h})):y.status!==ar&&c.dispatch(n(y)))}})}return s};function zx(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:s}=o,a={invalidateTags:B(`${t}/invalidateTags`)},c=w=>w.type.startsWith(`${t}/`),u=[Bx,Ux,Gx,$x,Vx,Qx];return{middleware:w=>{let h=!1,y=i(w.dispatch),S={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:c,mwApi:w},x=u.map(R=>R(S)),I=jx(S),_=Hx(S);return R=>T=>{if(!Qo(T))return R(T);h||(h=!0,w.dispatch(n.internalActions.middlewareRegistered(s)));let k={...w,next:R},F=w.getState(),[V,U]=I(T,k,F),L;if(V?L=R(T):L=U,w.getState()[t]&&(_(T,k,F),c(T)||o.hasRehydrationInfo(T)))for(let j of x)j(T,k,F);return L}},actions:a};function v(w){return e.api.endpoints[w.endpointName].initiate(w.originalArgs,{subscribe:!1,forceRefetch:!0})}}var vg=Symbol(),Wx=({createSelector:e=Be}={})=>({name:vg,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:s,refetchOnMountOrArgChange:a,refetchOnFocus:c,refetchOnReconnect:u,invalidationBehavior:g,onSchemaFailure:v,catchSchemaFailure:w,skipSchemaValidation:h},y){Jf();let S=pe=>(typeof process<"u",pe);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:jl,onOffline:Eg,onFocus:Ll,onFocusLost:xg},util:{}});let x=Mx({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:_,buildQuerySelector:R,buildInfiniteQuerySelector:T,buildMutationSelector:k}=x;sr(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:_});let{queryThunk:F,infiniteQueryThunk:V,mutationThunk:U,patchQueryData:L,updateQueryData:j,upsertQueryData:M,prefetch:O,buildMatchThunkActions:P}=Fx({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:S,selectors:x,onSchemaFailure:v,catchSchemaFailure:w,skipSchemaValidation:h}),{reducer:N,actions:Q}=Dx({context:y,queryThunk:F,infiniteQueryThunk:V,mutationThunk:U,serializeQueryArgs:i,reducerPath:o,assertTagType:S,config:{refetchOnFocus:c,refetchOnReconnect:u,refetchOnMountOrArgChange:a,keepUnusedDataFor:s,reducerPath:o,invalidationBehavior:g}});sr(t.util,{patchQueryData:L,updateQueryData:j,upsertQueryData:M,prefetch:O,resetApiState:Q.resetApiState,upsertQueryEntries:Q.cacheEntriesUpserted}),sr(t.internalActions,Q);let $=new WeakMap,Y=pe=>Ks($,pe,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:K,buildInitiateInfiniteQuery:H,buildInitiateMutation:J,getRunningMutationThunk:se,getRunningMutationsThunk:be,getRunningQueriesThunk:Ne,getRunningQueryThunk:Ie}=Nx({queryThunk:F,mutationThunk:U,infiniteQueryThunk:V,api:t,serializeQueryArgs:i,context:y,getInternalState:Y});sr(t.util,{getRunningMutationThunk:se,getRunningMutationsThunk:be,getRunningQueryThunk:Ie,getRunningQueriesThunk:Ne});let{middleware:ke,actions:_e}=zx({reducerPath:o,context:y,queryThunk:F,mutationThunk:U,infiniteQueryThunk:V,api:t,assertTagType:S,selectors:x,getRunningQueryThunk:Ie,getInternalState:Y});return sr(t.util,_e),sr(t,{reducer:N,middleware:ke}),{name:vg,injectEndpoint(pe,de){var Ve;let fe=(Ve=t.endpoints)[pe]??(Ve[pe]={});Zs(de)&&sr(fe,{name:pe,select:R(pe,de),initiate:K(pe,de)},P(F,pe)),_x(de)&&sr(fe,{name:pe,select:k(),initiate:J(pe)},P(U,pe)),Js(de)&&sr(fe,{name:pe,select:T(pe,de),initiate:H(pe,de)},P(F,pe))}}}}),Ng=Lx(Wx());m();d();f();p();m();d();f();p();var Zr=e=>e.query,Fg=e=>e.query?.enableQuerySyntax;var fU=Be(e=>Zr(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,r,n,o)=>({q:e,requestId:t,cannotAnswer:r,analyticsMode:n,actionCause:o})),Kx=Be(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function cr(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function q(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(g){try{u(n.next(g))}catch(v){s(v)}}function c(g){try{u(n.throw(g))}catch(v){s(v)}}function u(g){g.done?i(g.value):o(g.value).then(a,c)}u((n=n.apply(e,t||[])).next())})}var ve;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(ve||(ve={}));function Bl(){return typeof window<"u"}function td(){return typeof navigator<"u"}function Zn(){return typeof document<"u"}function Gl(){try{return typeof localStorage<"u"}catch{return!1}}function Yx(){try{return typeof sessionStorage<"u"}catch{return!1}}function zg(){return td()&&navigator.cookieEnabled}var Xx=[ve.click,ve.custom,ve.search,ve.view],Zx=(e,t)=>Xx.indexOf(e)!==-1?Object.assign({language:Zn()?document.documentElement.lang:"unknown",userAgent:td()?navigator.userAgent:"unknown"},t):t,hi=class e{static set(t,r,n){var o,i,s,a;n&&(i=new Date,i.setTime(i.getTime()+n)),a=window.location.hostname,a.indexOf(".")===-1?Dg(t,r,i):(s=a.split("."),o=s[s.length-2]+"."+s[s.length-1],Dg(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 Dg(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function Jx(){return Gl()?localStorage:zg()?new yi:Yx()?sessionStorage:new eo}var yi=class e{getItem(t){return hi.get(`${e.prefix}${t}`)}removeItem(t){hi.erase(`${e.prefix}${t}`)}setItem(t,r,n){hi.set(`${e.prefix}${t}`,r,n)}};yi.prefix="coveo_";var $l=class{constructor(){this.cookieStorage=new yi}getItem(t){return localStorage.getItem(t)||this.cookieStorage.getItem(t)}removeItem(t){this.cookieStorage.removeItem(t),localStorage.removeItem(t)}setItem(t,r){localStorage.setItem(t,r),this.cookieStorage.setItem(t,r,31556926e3)}},eo=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},ea="__coveo.analytics.history",eE=20,tE=1e3*60,rE=75,ra=class{constructor(t){this.store=t||Jx()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){return q(this,void 0,void 0,function*(){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=yield this.getHistoryWithInternalTimeAsync();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])})}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){return q(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(ea);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return q(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(ea);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(ea,JSON.stringify(t.slice(0,eE)))}catch{}}clear(){try{this.store.removeItem(ea)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,rE)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>tE:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var nE=(e,t)=>q(void 0,void 0,void 0,function*(){return e===ve.view?(yield oE(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),oE=e=>q(void 0,void 0,void 0,function*(){let t=new ra,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),iE=/^(?:[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 na(e){return typeof e=="string"&&iE.test(e)}function Mg(e){if(!na(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var et=[];for(let e=0;e<256;++e)et.push((e+256).toString(16).slice(1));function Wg(e,t=0){return(et[e[t+0]]+et[e[t+1]]+et[e[t+2]]+et[e[t+3]]+"-"+et[e[t+4]]+et[e[t+5]]+"-"+et[e[t+6]]+et[e[t+7]]+"-"+et[e[t+8]]+et[e[t+9]]+"-"+et[e[t+10]]+et[e[t+11]]+et[e[t+12]]+et[e[t+13]]+et[e[t+14]]+et[e[t+15]]).toLowerCase()}var sE=new Uint8Array(16);function aE(){return crypto.getRandomValues(sE)}function cE(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 uE="6ba7b810-9dad-11d1-80b4-00c04fd430c8",lE="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function dE(e,t,r,n,o,i){let s=typeof r=="string"?cE(r):r,a=typeof n=="string"?Mg(n):n;if(typeof n=="string"&&(n=Mg(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+s.length);return c.set(a),c.set(s,a.length),c=t(c),c[6]=c[6]&15|e,c[8]=c[8]&63|128,Wg(c)}function Jr(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():pE(e,t,r)}function pE(e,t,r){e=e||{};let n=e.random??e.rng?.()??aE();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 Wg(n)}function fE(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 Ul(e,t){return e<<t|e>>>32-t}function mE(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,i=Math.ceil(o/16),s=new Array(i);for(let a=0;a<i;++a){let c=new Uint32Array(16);for(let u=0;u<16;++u)c[u]=e[a*64+u*4]<<24|e[a*64+u*4+1]<<16|e[a*64+u*4+2]<<8|e[a*64+u*4+3];s[a]=c}s[i-1][14]=(e.length-1)*8/2**32,s[i-1][14]=Math.floor(s[i-1][14]),s[i-1][15]=(e.length-1)*8&4294967295;for(let a=0;a<i;++a){let c=new Uint32Array(80);for(let y=0;y<16;++y)c[y]=s[a][y];for(let y=16;y<80;++y)c[y]=Ul(c[y-3]^c[y-8]^c[y-14]^c[y-16],1);let u=r[0],g=r[1],v=r[2],w=r[3],h=r[4];for(let y=0;y<80;++y){let S=Math.floor(y/20),x=Ul(u,5)+fE(S,g,v,w)+h+t[S]+c[y]>>>0;h=w,w=v,v=Ul(g,30)>>>0,g=u,u=x}r[0]=r[0]+u>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+v>>>0,r[3]=r[3]+w>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function oa(e,t,r,n){return dE(80,mE,e,t)}oa.DNS=uE;oa.URL=lE;var Kg="2.33.0",Lg=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,gi={pageview:"pageview",event:"event"},ia=class{constructor({client:t,uuidGenerator:r=Jr}){this.client=t,this.uuidGenerator=r}},Ql=class extends ia{constructor({client:t,uuidGenerator:r=Jr}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=Lg(window.location),this.lastReferrer=Zn()?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:Zn()?document.title:"",encoding:Zn()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},i={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},i),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:i}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=i,t===gi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===gi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===gi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===gi.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=o=>o.replace(/^\/?(.*)$/,"/$1");return`${(o=>o.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return Lg(window.location)}},Sr=class e{constructor(t,r){if(!na(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 na(i)?new e(i,Number.parseInt(o)*1e3):null}};Sr.cvo_cid="cvo_cid";Sr.expirationTime=120;var Hl=class extends ia{constructor({client:t,uuidGenerator:r=Jr}){super({client:t,uuidGenerator:r})}getApi(t){switch(t){case"decorate":return this.decorate;case"acceptFrom":return this.acceptFrom;default:return null}}decorate(t){return q(this,void 0,void 0,function*(){if(!this.client.getCurrentVisitorId)throw new Error("Could not retrieve current clientId");try{let r=new URL(t),n=yield this.client.getCurrentVisitorId();return r.searchParams.set(Sr.cvo_cid,new Sr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Hl.Id="link";var xt=Object.keys;function ta(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Vl=128,Yg=192,jg=224,qg=240;function gE(e){return(e&248)===qg?4:(e&qg)===jg?3:(e&jg)===Yg?2:1}function hE(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&Vl)!=Vl)break;if(r-=3,(n&Yg)!=Vl){t-r>=gE(n)*3&&(r=t);break}}return e.substring(0,r)}var zl={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"},yE=xt(zl).map(e=>zl[e]),vE=[...yE].join("|"),SE=new RegExp(`^(${vE}$)`),AE={svcAction:"svc_action",svcActionData:"svc_action_data"},bE=e=>xt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=zl[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),wE=e=>SE.test(e),CE=[wE],Ug={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Vg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},st={action:"pa",list:"pal",listSource:"pls"},sa={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},xE=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Wl={id:"quoteId",affiliation:"quoteAffiliation"},Kl={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},EE={add:st,bookmark_add:st,bookmark_remove:st,click:st,checkout:st,checkout_option:st,detail:st,impression:st,remove:st,refund:Object.assign(Object.assign({},st),sa),purchase:Object.assign(Object.assign({},st),sa),quickview:st,quote:Object.assign(Object.assign({},st),Wl),review:Object.assign(Object.assign({},st),Kl)},IE=xt(Ug).map(e=>Ug[e]),RE=xt(Vg).map(e=>Vg[e]),TE=xt(st).map(e=>st[e]),kE=xt(sa).map(e=>sa[e]),_E=xt(Kl).map(e=>Kl[e]),OE=xt(Wl).map(e=>Wl[e]),PE=[...IE,"custom"].join("|"),NE=[...RE,"custom"].join("|"),Xg="(pr[0-9]+)",Zg="(il[0-9]+pi[0-9]+)",FE=new RegExp(`^${Xg}(${PE})$`),DE=new RegExp(`^(${Zg}(${NE}))|(il[0-9]+nm)$`),ME=new RegExp(`^(${TE.join("|")})$`),LE=new RegExp(`^(${kE.join("|")})$`),jE=new RegExp(`^${Xg}custom$`),qE=new RegExp(`^${Zg}custom$`),UE=new RegExp(`^(${[...xE,..._E,...OE].join("|")})$`),VE=e=>FE.test(e),BE=e=>DE.test(e),GE=e=>ME.test(e),$E=e=>LE.test(e),QE=e=>UE.test(e),HE=[BE,VE,GE,$E,QE],zE=[jE,qE],WE={anonymizeIp:"aip"},KE={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},YE={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},XE=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],ZE=Object.assign(Object.assign(Object.assign(Object.assign({},WE),KE),YE),XE.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Yl=Object.assign(Object.assign({},ZE),AE),JE=e=>{let t=!!e.action&&EE[e.action]||{};return xt(e).reduce((r,n)=>{let o=t[n]||Yl[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},eI=xt(Yl).map(e=>Yl[e]),tI=e=>eI.indexOf(e)!==-1,rI=e=>e==="custom",nI=e=>[...HE,...CE,tI,rI].some(t=>t(e)),oI=e=>xt(e).reduce((t,r)=>{let n=iI(r);return n?Object.assign(Object.assign({},t),sI(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),iI=e=>{let t;return[...zE].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},sI=(e,t)=>xt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),Xl=class{constructor(t){this.opts=t}sendEvent(t,r){return q(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:o}=this.opts,i=yield this.getQueryParamsForEventType(t),{url:s,payload:a}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),c=this.encodeForEventType(t,a),u=new Blob([c],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(s,u)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return q(this,void 0,void 0,function*(){let o=t,i=r;if(n){let s=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:a,body:c}=s;o=a||t;try{i=JSON.parse(c)}catch(u){console.error("Unable to process the request body as a JSON string",u)}}return{payload:i,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return q(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(i=>!!i).join("&")})}isEventTypeLegacy(t){return[ve.click,ve.custom,ve.search,ve.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let o=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(o=`access_token=${encodeURIComponent(n)}&${o}`),o}},Zl=class{sendEvent(t,r){return q(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return q(this,void 0,void 0,function*(){return Promise.resolve()})}},Bg=b.fetch,aa=class{constructor(t){this.opts=t}sendEvent(t,r){return q(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:i}=this.opts,s=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",a={url:`${n}/analytics/${t}${s}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},c=Object.assign(Object.assign({},a),i?yield i(a,"analyticsFetch"):{}),{url:u}=c,g=cr(c,["url"]),v;try{v=yield Bg(u,g)}catch(w){console.error("An error has occurred when sending the event.",w);return}if(v.ok){let w=yield v.json();return w.visitorId&&o.setCurrentVisitorId(w.visitorId),w}else{try{v.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,v,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return q(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield Bg(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[ve.click,ve.custom,ve.search,ve.view].indexOf(t)!==-1}getVisitorIdParam(){return q(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,r=yield t.getCurrentVisitorId();return r?`?visitor=${r}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},Jl=class{constructor(t,r){Gl()&&zg()?this.storage=new $l:Gl()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new eo),this.client=new aa(t),this.beaconClient=new Xl(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}},ed=class{constructor(t,r){this.storage=r||new eo,this.client=new aa(t)}getClientDependingOnEventType(t){return this.client}},ca=class{constructor(){this.storage=new eo,this.client=new Zl}getClientDependingOnEventType(t){return this.client}},aI="xx",cI=e=>e?.startsWith(aI)||!1,uI=`
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 rI(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var nI=["1",1,"yes",!0];function oI(){let e=[];return ql()&&e.push(window.doNotTrack),Zl()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>nI.indexOf(t)!==-1)}function aa(e){return e===!0?!1:oI()}var Yg="v15",Xg={default:"https://analytics.cloud.coveo.com/rest/ua"};function iI(e=Xg.default,t=Yg,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 sI="38824e1f-37f5-42d3-8372-a4b8fa9df946",$t=class{get defaultOptions(){return{endpoint:Xg.default,isCustomEndpoint:!1,token:"",version:Yg,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Hg}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=[Kx,$x].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};aa(this.options.disableBrowserPrivacySignals)?this.runtime=new sa:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(ve.view,{newEventType:ve.view,addClientIdParameter:!0}),this.addEventTypeMapping(ve.click,{newEventType:ve.click,addClientIdParameter:!0}),this.addEventTypeMapping(ve.custom,{newEventType:ve.custom,addClientIdParameter:!0}),this.addEventTypeMapping(ve.search,{newEventType:ve.search,addClientIdParameter:!0})}initRuntime(t){return ql()&&Xn()?new Yl(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(rI()&&console.warn(tI),new Xl(t))}get storage(){return this.runtime.storage}determineVisitorId(){return q(this,void 0,void 0,function*(){try{return ql()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Jr()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Jr()}})}getCurrentVisitorId(){return q(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return q(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return q(this,void 0,void 0,function*(){if(ta(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(ra(t,ra(r,sI)))}})}getParameters(t,...r){return q(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return q(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(Jr()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(aa(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(Sr.cvo_cid);if(r==null)return null;let n=Sr.fromString(r);return!n||!Xn()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return q(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:i=!1,addClientIdParameter:s=!1}=this.eventTypeMapping[t]||{};return yield[h=>n.length>0?this.parseVariableArgumentsPayload(n,h):h[0],h=>q(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>q(this,void 0,void 0,function*(){return s?Object.assign(Object.assign({},h),{clientId:yield this.getCurrentVisitorId()}):h}),h=>i?this.ensureAnonymousUserWhenUsingApiKey(h):h,h=>this.beforeSendHooks.reduce((y,S)=>q(this,void 0,void 0,function*(){let x=yield y;return yield S(t,x)}),h)].reduce((h,y)=>q(this,void 0,void 0,function*(){let S=yield h;return yield y(S)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return q(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?QE(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,w)=>q(this,void 0,void 0,function*(){let h=yield v;return yield w(h)}),Promise.resolve(r))})}makeEvent(t,...r){return q(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:s=>q(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},i),s)}),yield Promise.all(this.afterSendHooks.map(a=>a(t,Object.assign(Object.assign({},o),s)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return q(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return q(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 ea().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ve.search,t)})}sendSearchEvent(t){return q(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=cr(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ve.click,t)})}sendClickEvent(t){return q(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=cr(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ve.custom,t)})}sendCustomEvent(t){return q(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=cr(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ve.view,t)})}sendViewEvent(t){return q(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return q(this,void 0,void 0,function*(){let r=yield(yield C(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return q(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 s=r[o];if(typeof s=="string")n[t[o]]=s;else if(typeof s=="object")return Object.assign(Object.assign({},n),s)}return n}isKeyAllowedEmpty(t,r){return({[ve.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(KE(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=cr(t,["custom"]),o={};r&&Js(r)&&(o=this.lowercaseKeys(r));let i=YE(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=cr(t,["custom"]);if(r&&Js(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=cr(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==ve.view||r==ve.click||r==ve.search||r==ve.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==ve.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=cr(t,["userId"]);return eI(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=cr(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Js(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Js(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 iI(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},ur;(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"})(ur||(ur={}));var G;(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"})(G||(G={}));var Ug={[G.triggerNotify]:"queryPipelineTriggers",[G.triggerExecute]:"queryPipelineTriggers",[G.triggerQuery]:"queryPipelineTriggers",[G.triggerRedirect]:"queryPipelineTriggers",[G.queryErrorBack]:"errors",[G.queryErrorClear]:"errors",[G.queryErrorRetry]:"errors",[G.pagerNext]:"getMoreResults",[G.pagerPrevious]:"getMoreResults",[G.pagerNumber]:"getMoreResults",[G.pagerResize]:"getMoreResults",[G.pagerScrolling]:"getMoreResults",[G.facetSearch]:"facet",[G.facetShowLess]:"facet",[G.facetShowMore]:"facet",[G.recommendation]:"recommendation",[G.likeSmartSnippet]:"smartSnippet",[G.dislikeSmartSnippet]:"smartSnippet",[G.expandSmartSnippet]:"smartSnippet",[G.collapseSmartSnippet]:"smartSnippet",[G.openSmartSnippetFeedbackModal]:"smartSnippet",[G.closeSmartSnippetFeedbackModal]:"smartSnippet",[G.sendSmartSnippetReason]:"smartSnippet",[G.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[G.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[G.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[G.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[G.clearRecentQueries]:"recentQueries",[G.recentResultClick]:"recentlyClickedDocuments",[G.clearRecentResults]:"recentlyClickedDocuments",[G.showLessFoldedResults]:"folding",[G.caseDetach]:"case",[G.likeGeneratedAnswer]:"generatedAnswer",[G.dislikeGeneratedAnswer]:"generatedAnswer",[G.openGeneratedAnswerSource]:"generatedAnswer",[G.generatedAnswerOpenInlineLink]:"generatedAnswer",[G.generatedAnswerFollowupOpenSource]:"generatedAnswer",[G.generatedAnswerStreamEnd]:"generatedAnswer",[G.generatedAnswerSourceHover]:"generatedAnswer",[G.generatedAnswerCopyToClipboard]:"generatedAnswer",[G.generatedAnswerHideAnswers]:"generatedAnswer",[G.generatedAnswerShowAnswers]:"generatedAnswer",[G.generatedAnswerExpand]:"generatedAnswer",[G.generatedAnswerCollapse]:"generatedAnswer",[G.generatedAnswerFeedbackSubmit]:"generatedAnswer",[G.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[ur.expandToFullUI]:"interface",[ur.openUserActions]:"User Actions",[ur.showPrecedingSessions]:"User Actions",[ur.showFollowingSessions]:"User Actions",[ur.clickViewedDocument]:"User Actions",[ur.clickPageView]:"User Actions",[ur.createArticle]:"createArticle"},eo=class{constructor(){this.runtime=new sa,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(ve.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(ve.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(ve.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(ve.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return Hg}};function aI(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function cI(e){return e.map(t=>t.replace(/;/g,""))}function Zg(e){let r=e.join(";");return r.length<=256?r:Zg(e.slice(1))}var Vg=e=>{let t=cI(e),r=aI(t);return Zg(r)};function Bg(e){let t=typeof e.partialQueries=="string"?e.partialQueries:Vg(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:Vg(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var ca=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||aa(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new eo:new $t(t)}disable(){this.coveoAnalyticsClient=new eo}enable(){this.coveoAnalyticsClient=new $t(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(G.interfaceLoad)}logInterfaceLoad(){return q(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(G.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(G.recommendation)}logRecommendation(){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent(G.recommendationOpen,t,r)}logRecommendationOpen(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(G.staticFilterClearAll,t)}logStaticFilterClearAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent(G.staticFilterSelect,t)}logStaticFilterSelect(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent(G.staticFilterDeselect,t)}logStaticFilterDeselect(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(G.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return q(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent(G.interfaceChange,t)}logInterfaceChange(t){return q(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(G.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(G.didyoumeanClick)}logDidYouMeanClick(){return q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(G.resultsSort,t)}logResultsSort(t){return q(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(G.searchboxSubmit)}logSearchboxSubmit(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(G.searchboxClear)}logSearchboxClear(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(G.searchboxAsYouType)}logSearchboxAsYouType(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(G.breadcrumbFacet,t)}logBreadcrumbFacet(t){return q(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(G.breadcrumbResetAll)}logBreadcrumbResetAll(){return q(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent(G.documentQuickview,t,r)}logDocumentQuickview(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent(G.documentOpen,t,r)}logDocumentOpen(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(G.omniboxAnalytics,Bg(t))}logOmniboxAnalytics(t){return q(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(G.omniboxFromLink,Bg(t))}logOmniboxFromLink(t){return q(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(G.searchFromLink)}logSearchFromLink(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(G.triggerNotify,t)}logTriggerNotify(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(G.triggerExecute,t)}logTriggerExecute(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(G.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(G.undoTriggerQuery,t)}logUndoTriggerQuery(t){return q(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(G.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(G.pagerResize,t)}logPagerResize(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(G.pagerNumber,t)}logPagerNumber(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(G.pagerNext,t)}logPagerNext(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(G.pagerPrevious,t)}logPagerPrevious(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(G.pagerScrolling)}logPagerScrolling(){return q(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(G.facetClearAll,t)}logFacetClearAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(G.facetSearch,t)}logFacetSearch(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(G.facetSelect,t)}logFacetSelect(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(G.facetDeselect,t)}logFacetDeselect(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(G.facetExclude,t)}logFacetExclude(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(G.facetUnexclude,t)}logFacetUnexclude(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(G.facetSelectAll,t)}logFacetSelectAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(G.facetUpdateSort,t)}logFacetUpdateSort(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(G.facetShowMore,t)}logFacetShowMore(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(G.facetShowLess,t)}logFacetShowLess(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(G.queryError,t)}logQueryError(t){return q(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(G.queryErrorBack);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(G.queryErrorBack)})}})}logQueryErrorBack(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(G.queryErrorRetry);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(G.queryErrorRetry)})}})}logQueryErrorRetry(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(G.queryErrorClear);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(G.queryErrorClear)})}})}logQueryErrorClear(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(G.likeSmartSnippet)}logLikeSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(G.dislikeSmartSnippet)}logDislikeSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(G.expandSmartSnippet)}logExpandSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(G.collapseSmartSnippet)}logCollapseSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(G.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(G.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return q(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent(G.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(G.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent(G.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent(G.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent(G.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent(G.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent(G.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(G.copyToClipboard,t,r)}logCopyToClipboard(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent(G.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent(G.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(G.recentQueryClick)}logRecentQueryClick(){return q(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(G.clearRecentQueries)}logClearRecentQueries(){return q(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent(G.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(G.clearRecentResults)}logClearRecentResults(){return q(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(G.noResultsBack)}logNoResultsBack(){return q(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent(G.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(G.showLessFoldedResults)}logShowLessFoldedResults(){return q(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 q(this,arguments,void 0,function*(n,o,i=Ug[n]){this.coveoAnalyticsClient.getParameters;let s=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),a=Object.assign(Object.assign({},yield this.getBaseEventRequest(s)),{eventType:i,eventValue:n}),c=yield this.coveoAnalyticsClient.makeCustomEvent(a);return{description:this.makeEventDescription(c,n),log:({searchUID:u})=>c.log({lastSearchQueryUid:u})}})}logCustomEvent(t,r){return q(this,arguments,void 0,function*(n,o,i=Ug[n]){return(yield this.makeCustomEvent(n,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return q(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}),s=yield this.coveoAnalyticsClient.makeCustomEvent(i);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({lastSearchQueryUid:a})}})}logCustomEventWithType(t,r,n){return q(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return q(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 q(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}),s=yield this.coveoAnalyticsClient.makeClickEvent(i);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({searchQueryUid:a})}})}logClickEvent(t,r,n,o){return q(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return q(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 q(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 $t?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(G.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(G.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(G.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return q(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent(G.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(G.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent(G.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(G.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(G.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(G.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(G.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(G.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(G.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(G.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(G.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(G.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(G.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return q(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(G.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},ua=Object.assign({},gi),Gg=Object.keys(ua).map(e=>ua[e]),Zn=class extends Bl{constructor({client:t,uuidGenerator:r=Jr}){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])=>Gg.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Gg.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(ua.pageview,{newEventType:ve.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(ua.event,{newEventType:ve.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 fE(this.ticket)}};Zn.Id="svc";var la;(function(e){e.click="click",e.flowStart="flowStart"})(la||(la={}));var Ct;(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"})(Ct||(Ct={}));var da;(function(e){e.quit="Quit",e.solved="Solved"})(da||(da={}));var pa=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!aa(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new $t(t):new eo,this.svc=new Zn({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new eo,this.svc=new Zn({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new $t(this.options),this.svc=new Zn({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(Ct.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(Ct.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(Ct.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(Ct.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(Ct.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(Ct.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(Ct.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(Ct.caseCancelled,{reason:da.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(Ct.caseSolved,{reason:da.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(Ct.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",la.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",la.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return q(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 $t?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 q(this,void 0,void 0,function*(){var i,s;let a=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:(s=(i=this.provider)===null||i===void 0?void 0:i.getSearchUID())!==null&&s!==void 0?s:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(a)})}};m();d();f();p();var uI=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},en=class{constructor(t){oe(this,"getState",t);oe(this,"state");this.state=t()}getLanguage(){return uI(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[i,s]of Object.entries(n)){let a=`context_${i}`;o[a]=s}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=Qn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||zn()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};m();d();f();p();var to=e=>new $t(e).getCurrentVisitorId(),vi=(e,t)=>typeof t=="function"?(...r)=>{let n=Bo(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,Si=(e,t)=>(...r)=>{let n=Bo(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var Ai=class extends en{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Jg=({logger:e,getState:t,analyticsClientMiddleware:r=(s,a)=>a,preprocessRequest:n,provider:o=new Ai(t),disableBrowserPrivacySignals:i})=>{let s=t(),a=s.configuration.accessToken,c=s.configuration.analytics.apiBaseUrl??ot(s.configuration.organizationId,s.configuration.environment,"analytics"),u=s.configuration.analytics.runtimeEnvironment,g=s.configuration.analytics.enabled,v=new pa({enableAnalytics:g,token:a,endpoint:c,runtimeEnvironment:u,disableBrowserPrivacySignals:i,preprocessRequest:vi(e,n),beforeSendHooks:[Si(e,r),(w,h)=>(e.info({...h,type:w,endpoint:c,token:a},"Analytics request"),h)]},o);return g||v.disable(),v};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function fa(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function eh(e){let{activeValue:t,ancestryMap:r}=pI(e);return t?fI(t,r):[]}function pI(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 fI(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var mI=(e,t)=>e.categoryFacetSet[t]?.request;var Jl=(e,t)=>{let r=mI(e,t);return eh(r?.currentValues??[])};m();d();f();p();function ma(){return{}}m();d();f();p();function ga(){return{}}m();d();f();p();function ha(){return{}}m();d();f();p();function ya(){return{}}function ed(e){return{facetSet:e.facetSet??ya(),categoryFacetSet:e.categoryFacetSet??ma(),dateFacetSet:e.dateFacetSet??ga(),numericFacetSet:e.numericFacetSet??ha(),automaticFacetSet:e.automaticFacetSet??fa()}}var td=e=>{let t=[];return yI(e).forEach((r,n)=>{let o=EI(e,r.facetId),i=CI(r,n+1);if(hI(r)){if(!!!Jl(e,r.facetId).length)return;t.push({...i,...bI(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((s,a)=>{if(s.state==="idle")return;let c=th(s,a+1,o),u=gI(r)?rh(s):SI(s);t.push({...i,...c,...u})})}),vI(e).forEach((r,n)=>{let o=wI(r,n+1);r.values.forEach((i,s)=>{if(i.state==="idle")return;let a=th(i,s+1,"specific"),c=rh(i);t.push({...o,...a,...c})})}),t},gI=e=>e.type==="specific",hI=e=>e.type==="hierarchical",yI=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),vI=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),th=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),SI=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),rh=e=>({displayValue:e.value,value:e.value}),AI=(e,t)=>Jl(e,t).map(n=>n.value).join(";"),bI=(e,t)=>{let n=AI(e,t);return{value:n,valuePosition:1,displayValue:n}},wI=(e,t)=>({title:nh(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),CI=(e,t)=>({title:nh(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),nh=(e,t)=>`${e}_${t}`,xI=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,EI=(e,t)=>{let r=xI(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var rd=e=>e.configuration.search.locale,oh=e=>e.configuration.search.timezone,ih=e=>e.configuration.accessToken,sh=e=>e.configuration.organizationId,ah=e=>e.configuration.environment,va=e=>e.configuration?.knowledge?.agentId,ch=e=>e.configuration.knowledge.debugAgentSession;var Oe=e=>{if(II(e)||nd(e))return e.generatedAnswer?.answerId;if(RI(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},II=e=>"answer"in e&&"generatedAnswer"in e&&!ce(e.generatedAnswer?.answerConfigurationId),nd=e=>{let t=va(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},RI=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",od=e=>e.generatedAnswer?.fieldsToIncludeInCitations,Ar=e=>e.followUpAnswers?.conversationId,TI=e=>e.generatedAnswer?.citations,kI=e=>e.followUpAnswers?.followUpAnswers,_I=Ue(kI,e=>e?.flatMap(t=>t.citations)),OI=(e,t)=>t,ro=Ue(TI,_I,OI,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));m();d();f();p();var Mt=()=>({q:"",enableQuerySyntax:!1});m();d();f();p();function id(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Qt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:id(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:id(),extendedResults:{},searchAction:void 0}}m();d();f();p();m();d();f();p();m();d();f();p();var uh=(r=>(r.Ascending="ascending",r.Descending="descending",r))(uh||{}),lh=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(lh||{}),sd=e=>{if(Tf(e))return e.map(t=>sd(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""}},dh=()=>({by:"relevancy"});var _V=new xe({values:{by:new zu({enum:lh,required:!0}),order:new zu({enum:uh}),field:new re}});function Sa(){return sd(dh())}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function PI(){return typeof navigator<"u"}function ph(){try{return typeof localStorage<"u"}catch{return!1}}function fh(){try{return typeof sessionStorage<"u"}catch{return!1}}function mh(){return PI()&&navigator.cookieEnabled}m();d();f();p();var no=class e{static set(t,r,n){var o,i,s,a;n&&(i=new Date,i.setTime(i.getTime()+n)),a=window.location.hostname,a.indexOf(".")===-1?gh(t,r,i):(s=a.split("."),o=s[s.length-2]+"."+s[s.length-1],gh(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 gh(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function hh(){return ph()?localStorage:mh()?new Aa:fh()?sessionStorage:new ad}var Aa=class e{getItem(t){return no.get(`${e.prefix}${t}`)}removeItem(t){no.erase(`${e.prefix}${t}`)}setItem(t,r,n){no.set(`${e.prefix}${t}`,r,n)}};Aa.prefix="coveo_";var ad=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var ba="__coveo.analytics.history",NI=20,FI=1e3*60,DI=75,wa=class{constructor(t){this.store=t||hh()}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 _this4=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this4.cropQueryElement(_this4.stripEmptyQuery(t));let r=yield _this4.getHistoryWithInternalTimeAsync();r!=null?_this4.isValidEntry(t)&&_this4.setHistory([t].concat(r)):_this4.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this5=this;return _asyncToGenerator(function*(){let t=yield _this5.getHistoryWithInternalTimeAsync();return _this5.stripEmptyQueries(_this5.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(ba);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this6=this;return _asyncToGenerator(function*(){try{let t=yield _this6.store.getItem(ba);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(ba,JSON.stringify(t.slice(0,NI)))}catch{}}clear(){try{this.store.removeItem(ba)}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,DI)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>FI:!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 tn=class tn extends wa{static getInstance(t){return tn.instance||(tn.instance=new tn(t)),tn.instance}constructor(t){super(t)}};oe(tn,"instance",null);var yt=tn;var bi=class bi extends en{constructor(){super(...arguments);oe(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 td(ed(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||bi.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||Qt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||bi.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=Oe(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??Sa()}}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(u=>u.expression),s=o.partialQueries.length-1,a=o.partialQueries[s]||"",c=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(n),partialQuery:a,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:i.length>0?i:"",querySuggestResponseId:c}}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||Mt().q}get responseTime(){return this.state.search?.duration||Qt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Qt().response.totalCountFiltered}};oe(bi,"fallbackPipelineName","default");var br=bi,yh=({logger:e,getState:t,analyticsClientMiddleware:r=(s,a)=>a,preprocessRequest:n,provider:o,disableBrowserPrivacySignals:i})=>{let s=t(),a=s.configuration.accessToken,c=s.configuration.analytics.apiBaseUrl??ot(s.configuration.organizationId,s.configuration.environment,"analytics"),u=s.configuration.analytics.runtimeEnvironment,g=s.configuration.analytics.enabled,v=new ca({token:a,endpoint:c,runtimeEnvironment:u,disableBrowserPrivacySignals:i,preprocessRequest:vi(e,n),beforeSendHooks:[Si(e,r),(w,h)=>(e.info({...h,type:w,endpoint:c,token:a},"Analytics request"),h)]},o);return g||v.disable(),v},cd=()=>{let t=yt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};m();d();f();p();function vh(e){let t=Sh(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return vf([e,...t,...r],o=>o.uniqueId)}function Sh(e){return e.childResults?e.childResults.flatMap(t=>[t,...Sh(t)]):[]}m();d();f();p();var oo=()=>"";function bh(e,t){return{...new br(t).getBaseMetadata(),actionCause:e,type:e}}function MI(e){return Object.assign(e,{instantlyCallable:!0})}function LI(e,t){let r=i=>{let s=Ce(e,i);return MI(Object.assign(s,{type:s.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*(i,{getState:s,extra:a}){let{analyticsClientMiddleware:c,preprocessRequest:u,logger:g,disableBrowserPrivacySignals:v}=a;return yield(yield t({getState:s,analyticsClientMiddleware:c,preprocessRequest:u,logger:g,disableBrowserPrivacySignals:v})).log({state:s(),extra:a})});return function(_x42,_x43){return _ref17.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref18=_asyncToGenerator(function*({getState:i,analyticsClientMiddleware:s,preprocessRequest:a,logger:c,disableBrowserPrivacySignals:u}){let{description:g,log:v}=yield t({getState:i,analyticsClientMiddleware:s,preprocessRequest:a,logger:c,disableBrowserPrivacySignals:u});return{description:g,action:r(/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(w,{getState:h,extra:y}){return yield v({state:h(),extra:y})});return function(_x45,_x46){return _ref19.apply(this,arguments)}}())}});return function prepare(_x44){return _ref18.apply(this,arguments)}}()}),n}var wh=(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 UI(i)}return n},jI=e=>e.configuration.analytics.analyticsMode==="legacy",qI=e=>e.configuration.analytics.analyticsMode==="next",UI=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:s})=>(r??(r=a=>new s(a)),LI(e,/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*({getState:a,analyticsClientMiddleware:c,preprocessRequest:u,logger:g,disableBrowserPrivacySignals:v}){let w=[],h={log:function(){var _ref21=_asyncToGenerator(function*({state:_}){for(let R of w)yield R(_)});return function log(_x48){return _ref21.apply(this,arguments)}}()},y=a(),S=i({getState:a,logger:g,analyticsClientMiddleware:c,preprocessRequest:u,disableBrowserPrivacySignals:v,provider:r(a)}),x=yield t(S,a());h.description=x?.description,w.push(/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(_){jI(_)&&(yield VI(x,r,_,g,S.coveoAnalyticsClient))});return function(_x49){return _ref22.apply(this,arguments)}}());let{emit:I}=ci(y);return w.push(/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(_){if(qI(_)&&o&&n){let R=n(_);yield KI(I,o,R)}});return function(_x50){return _ref23.apply(this,arguments)}}()),h});return function(_x47){return _ref20.apply(this,arguments)}}()));function VI(_x51,_x52,_x53,_x54,_x55){return _VI.apply(this,arguments)}function _VI(){_VI=_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 _VI.apply(this,arguments)}var BI=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref24=_asyncToGenerator(function*(i){r(n,o)});return function log(_x56){return _ref24.apply(this,arguments)}}()}),Re=wh(e=>yh({...e,provider:e.provider||new br(e.getState)}),e=>e,br),vt=wh(Jg,BI("caseAssist"),Ai);var ud=(e,t)=>{let r=i=>i+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=kh(e,o),n<0&&(n=WI(e,o)),n<0&&(n=0),GI(e,r(n),t)};var Ch=(e,t)=>({sourceName:Eh(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||oo()}),xh=(e,t)=>({sourceName:Eh(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||oo()});function Eh(e){let t=e.source;return ce(t)?"unknown":t}var Ih=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function GI(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:HI(e),...(Ah(e)?{documentCategory:Ah(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:zI(e),queryPipeline:r.pipeline||oo()}}function Ah(e){return e.raw?.objecttype||void 0}var ld=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||""}),Rh={urihash:new re,sourcetype:new re,permanentid:new re},Th={uniqueId:ee,raw:new xe({values:Rh}),title:ee,uri:ee,clickUri:ee,rankingModifier:new re({required:!1,emptyAllowed:!0})};function $I(e){return Object.assign({},...Object.keys(Rh).map(t=>({[t]:e[t]})))}function QI(e){return Object.assign({},...Object.keys(Th).map(t=>({[t]:e[t]})),{raw:$I(e.raw)})}function HI(e){let t=e.raw.author;return ce(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function zI(e){let t=e.raw.source;return ce(t)?"unknown":t}var dd=e=>new Nt(Th).validate(QI(e));function WI(e,t){for(let[r,n]of t.entries()){let o=vh(n);if(kh(e,o)!==-1)return r}return-1}function kh(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function KI(_x57,_x58,_x59){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 Ca=e=>{if(e==="yes")return!0;if(e==="no")return!1},YI=()=>Re("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function XI(e,t){return Re({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??Oe(n),i=ro(n,e);if(!o||!i)return null;let s=Ar(n);return r.makeGeneratedAnswerCitationClick(Ch(i,n),{generativeQuestionAnsweringId:o,citationId:i.id,documentId:Ih(i),...(s&&{conversationId:s})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=ro(r,e);return{answerId:t??Oe(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function ZI(e,t,r){return Re({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let i=r??Oe(o),s=ro(o,e);if(!i||!s)return null;let a=Ar(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:i,permanentId:s.permanentid,citationId:s.id,citationHoverTimeMs:t,...(a&&{conversationId:a})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=ro(n,e);return{answerId:r??Oe(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function JI(e,t){return Re({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function eR(e){return Re({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??Oe(r);if(!n)return null;let o=Ar(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Oe(t)??"",action:"like"})})}function tR(e){return Re({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??Oe(r);if(!n)return null;let o=Ar(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Oe(t)??"",action:"dislike"})})}var rR=e=>Re({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Oe(r);return n?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Oe(t),{helpful:n,readable:o,documented:i,hallucinationFree:s,correctTopic:a,documentUrl:c,details:u}=e;return{answerId:r??"",helpful:n,details:{readable:Ca(o),documented:Ca(i),correctTopic:Ca(a),hallucinationFree:Ca(s)},additionalNotes:u,correctAnswerUrl:c}}}),pd=(e,t,r)=>Re({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let i=t??Oe(o);if(!i)return null;let s=Ar(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:r,...(s&&{conversationId:s})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Oe(n)??"",answerGenerated:e??!1})}),io=e=>Re({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Oe(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),nR=()=>Re({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Oe(t);return r?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Oe(e)??"",action:"show"})}),oR=()=>Re({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Oe(t);return r?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Oe(e)??"",action:"hide"})}),iR=()=>Re({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Oe(t);return r?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Oe(e)??"",action:"expand"})}),sR=()=>Re({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Oe(t);return r?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Oe(e)??"",action:"collapse"})});function aR(e){return Re({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??Oe(r);if(!n)return null;let o=Ar(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Oe(t)??"",action:"copyToClipboard"})})}function cR(e,t){return Re({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=ro(n,e);if(!o)return null;let i=Ar(n);return i?r.makeGeneratedAnswerFollowupOpenSource({...xh(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:i}):null}})}var xa={logCopyGeneratedAnswer:aR,logGeneratedAnswerHideAnswers:oR,logGeneratedAnswerShowAnswers:nR,logGeneratedAnswerStreamEnd:pd,logGeneratedAnswerFeedback:rR,logDislikeGeneratedAnswer:tR,logLikeGeneratedAnswer:eR,logGeneratedAnswerOpenInlineLink:JI,logHoverCitation:ZI,logOpenGeneratedAnswerSource:XI,logOpenGeneratedAnswerFollowUpSource:cR,logRetryGeneratedAnswer:YI,logGeneratedAnswerExpand:iR,logGeneratedAnswerCollapse:sR};m();d();f();p();m();d();f();p();var _h=Ue(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 rn=(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:Wn(e)}});m();d();f();p();var fd=e=>e.context;m();d();f();p();var md=e=>e.pipeline;m();d();f();p();m();d();f();p();var Ci=Pt(Ea(),1),Mh=Pt(Oh(),1);m();d();f();p();var Nh=Pt(Ea(),1),Fh=Pt(Ph(),1);Nh.default.extend(Fh.default);var uR="YYYY/MM/DD@HH:mm:ss";function Dh(e){return e.format(uR)}Ci.default.extend(Mh.default);var lR=["past","now","next"],dR=["minute","hour","day","week","month","quarter","year"];function pR(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Ci.default)().subtract(r,n);case"next":return(0,Ci.default)().add(r,n);case"now":return(0,Ci.default)()}}function bd(e){return Dh(pR(fR(e)))}function Lh(e){return e.toLocaleLowerCase().split("-")}function wd(e){let[t,r,n]=Lh(e);if(t==="now")return!0;if(!lR.includes(t)||!dR.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function fR(e){let[t,r,n]=Lh(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function jh(e){return e.type==="dateRange"}function qh(e){return`start${e}`}function Uh(e){return`end${e}`}var Cd=()=>({dateFacetValueMap:{}});function mR(e,t,r){let n=e.start,o=e.end;return wd(n)&&(n=bd(n),r.dateFacetValueMap[t][qh(n)]=e.start),wd(o)&&(o=bd(o),r.dateFacetValueMap[t][Uh(o)]=e.end),{...e,start:n,end:o}}function xd(e,t){if(jh(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>mR(o,r,t))}}return e}function wr(e){let t=Cd();return{request:{...e,facets:e.facets?.map(n=>xd(n,t))},mappings:t}}function gR(e,t,r){return{...e,start:r.dateFacetValueMap[t][qh(e.start)]||e.start,end:r.dateFacetValueMap[t][Uh(e.end)]||e.end}}function hR(e,t){return e.facetId in t.dateFacetValueMap}function yR(e,t){return hR(e,t)?{...e,values:e.values.map(r=>gR(r,e.facetId,t))}:e}function Ia(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>yR(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function Cr(e){return Object.values(e).map(t=>t.request)}function Ed(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 Vh(e){return Cr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Id={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function vR(e){return Cr(e).map(t=>{let r=Id[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function SR(e){return[...vR(e.facetSet??{}),...Vh(e.numericFacetSet??{}),...Vh(e.dateFacetSet??{}),...Cr(e.categoryFacetSet??{})]}function AR(e){return SR(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function Ra(e){return Ed(AR(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();m();d();f();p();var Bh=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield to(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}),...(cd()&&{pageId:cd()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:Wn(e)})}}});return function Bh(_x60,_x61){return _ref25.apply(this,arguments)}}();var so=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Mn(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:yt.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 Bh(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 so(_x62,_x63){return _ref26.apply(this,arguments)}}();m();d();f();p();var Ta=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Mn(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&&rn(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 Gh=Ue(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 xr=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t,r){let n=Td(e),o=bR(e),i=wR(e),s=e.configuration.analytics.analyticsMode==="legacy"?yield so(e,r):Ta(e,t,r);return wr({...s,...(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:Rd(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 xr(_x64,_x65,_x66){return _ref27.apply(this,arguments)}}();function Rd(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function bR(e){return Ed(xR(e),e.facetOrder??[])}function wR(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(CR).filter(r=>r.currentValues.length>0):void 0}function CR(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function xR(e){return ER(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function ER(e){return[...IR(e.facetSet??{}),...$h(e.numericFacetSet??{}),...$h(e.dateFacetSet??{}),...Cr(e.categoryFacetSet??{})]}function IR(e){return Cr(e).map(t=>{let r=Id[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function $h(e){return Cr(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 Td(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=Gh(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();f();p();m();d();f();p();var Ei=(e,t)=>{let r=e;return ce(r[t])?ce(e.raw[t])?null:e.raw[t]:r[t]},RR=e=>t=>e.every(r=>!ce(Ei(t,r))),TR=e=>t=>e.every(r=>ce(Ei(t,r))),kR=(e,t)=>r=>{let n=Qh(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},_R=(e,t)=>r=>{let n=Qh(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},Qh=(e,t)=>{let r=Ei(t,e);return yf(r)?r:[r]},Hh={getResultProperty:Ei,fieldsMustBeDefined:RR,fieldsMustNotBeDefined:TR,fieldMustMatch:kR,fieldMustNotMatch:_R};var kd=Ue(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var _d=e=>e.searchHub;m();d();f();p();var ka=Ue(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),Y3=Ue(e=>e,e=>{let t=ka(e);return t&&e?e[t].expression:""});m();d();f();p();var zh=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var Wh=e=>e.excerptLength?.length;m();d();f();p();var Kh=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var Yh=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 Xh=e=>e.sortCriteria;var Zh=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Dn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function Zh(_x67){return _ref28.apply(this,arguments)}}(),Jh=(e,t)=>{let r=Zr(e)?.q,{aq:n,cq:o,dq:i,lq:s}=ry(e),a=fd(e),c=rn(e.configuration.analytics,t,{actionCause:kd(e)}),u=_d(e),g=md(e),v=od(e)??[],w=ty(e),h=ka(e.tabSet)||"default",y=rd(e),S=oh(e),x=t.referrer||"",I=Kh(e),_=Xh(e),R=OR(e),T=Wh(e),k=Yh(e),F=zh(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(s&&{lq:s}),...(e.query&&{enableQuerySyntax:Og(e)}),...(a?.contextValues&&{context:a.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(u?.length&&{searchHub:u}),...(g?.length&&{pipeline:g}),...(w.length&&{facets:w}),...(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:Rd(e),firstResult:e.pagination.firstResult}),tab:h,locale:y,timezone:S,...(e.debug!==void 0&&{debug:e.debug}),referrer:x,...R,...(k??{}),...(T&&{excerptLength:T}),...(F&&{dictionaryFieldContext:F}),sortCriteria:_,...(I&&{facetOptions:I}),...c,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},ey=(e,t)=>{let r=Zr(e)?.q,n=ty(e),o=rn(e.configuration.analytics,t,{actionCause:kd(e)}),i=rd(e),s=ka(e.tabSet)||"default",a=t.referrer,{aq:c,cq:u}=ry(e),g=_d(e),v=md(e),w=fd(e),h=od(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(v?.length&&{pipeline:v}),...(w?.contextValues&&{context:w.contextValues}),...(c&&{aq:c}),...(u&&{cq:u}),tab:s,referrer:a,...o,locale:i}},ty=e=>Ra(e)?.map(t=>xd(t,Cd())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),OR=e=>({actionsHistory:e.configuration.analytics.enabled?yt.getInstance().getHistory():[]}),ry=e=>{let t=_h(e),r=Td(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var _a=["searching","thinking","answering"];function Oa(e){return e.toLowerCase()}var Pa=["search","generic"];m();d();f();p();var ny=["text/plain","text/markdown"];var ao=new re({required:!0}),oy=new re,co=new je({required:!0}),Od={id:ao,title:ao,uri:ao,permanentid:ao,clickUri:oy},Na=new re({required:!0,constrainTo:ny}),iy=new re({required:!0,constrainTo:_a}),sy=e=>({...e,name:Oa(e.name)}),hQ=B("generatedAnswer/setIsVisible",e=>W(e,co)),Fa=B("generatedAnswer/setAnswerId",e=>W(e,ee)),yQ=B("generatedAnswer/setAnswerGenerationMode",e=>W(e,new re({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),vQ=B("generatedAnswer/setIsEnabled",e=>W(e,co)),Ri=B("generatedAnswer/updateMessage",e=>W(e,{textDelta:ao})),Ti=B("generatedAnswer/updateCitations",e=>W(e,{citations:new Ft({required:!0,each:new xe({values:Od})})})),ki=B("generatedAnswer/updateError",e=>W(e,{message:oy,code:new Le({min:0})})),Da=B("generatedAnswer/resetAnswer"),SQ=B("generatedAnswer/like"),AQ=B("generatedAnswer/dislike"),bQ=B("generatedAnswer/feedbackModal/open"),wQ=B("generatedAnswer/expand"),CQ=B("generatedAnswer/collapse"),xQ=B("generatedAnswer/setId",e=>W(e,{id:new re({required:!0})})),EQ=B("generatedAnswer/feedbackModal/close"),IQ=B("generatedAnswer/sendFeedback"),Er=B("generatedAnswer/setIsLoading",e=>W(e,co)),Ii=B("generatedAnswer/setIsStreaming",e=>W(e,co)),_i=B("generatedAnswer/setAnswerContentFormat",e=>W(e,Na)),RQ=B("generatedAnswer/updateResponseFormat",e=>W(e,{contentFormat:new Ft({each:Na,default:["text/plain"]})})),TQ=B("knowledge/updateAnswerConfigurationId",e=>W(e,ao)),kQ=B("generatedAnswer/registerFieldsToIncludeInCitations",e=>W(e,Im)),Pd=B("generatedAnswer/setIsAnswerGenerated",e=>W(e,co)),Oi=B("generatedAnswer/setCannotAnswer",e=>W(e,co)),PR=B("generatedAnswer/setAnswerApiQueryParams",e=>W(e,new xe({}))),ay=B("generatedAnswer/startStep",e=>W(sy(e),{name:iy,startedAt:new Le({min:0,required:!0})})),cy=B("generatedAnswer/finishStep",e=>W(sy(e),{name:iy,finishedAt:new Le({min:0,required:!0})})),uy=B("generatedAnswer/startToolCall",e=>W(e,{toolCallName:ee,startedAt:new Le({min:0,required:!0}),toolCallId:ee})),ly=B("generatedAnswer/finishToolCall",e=>W(e,{finishedAt:new Le({min:0,required:!0}),toolCallId:ee})),Ma=B("generatedAnswer/toolCallArgs",e=>W(e,{toolCallId:ee,args:new xe({options:{required:!0}}),type:new re({required:!0,constrainTo:Pa})})),_Q=Ce("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:i}=t,{generatedAnswerAnalyticsClient:s}=o,{search:a}=i(),{queryExecuted:c}=a,{setAbortControllerRef:u}=e,g=yield Zh(r),v=(y,S)=>{switch(y){case"genqa.headerMessageType":{let x=JSON.parse(S);n(_i(x.contentFormat));break}case"genqa.messageType":n(Ri(JSON.parse(S)));break;case"genqa.citationsType":n(Ti(JSON.parse(S)));break;case"genqa.endOfStreamType":{let x=JSON.parse(S).answerGenerated,{answerId:I,answer:_}=i().generatedAnswer,T=c.length!==0&&!x,k=!_?.trim();n(Oi(T)),n(Ii(!1)),n(Pd(x)),n((s??xa).logGeneratedAnswerStreamEnd(x,I,x?k:void 0)),n(io());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${y}"`)}};n(Er(!0));let w=y=>y.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:y=>{w(g)&&(n(Er(!1)),y.payload&&y.payloadType&&v(y.payloadType,y.payload))},abort:y=>{w(g)&&n(ki(y))},close:()=>{w(g)&&n(Ii(!1))},resetAnswer:()=>{w(g)&&n(Da())}});h?u(h):n(Er(!1))});return function(_x68,_x69){return _ref29.apply(this,arguments)}}()),OQ=Ce("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(Da());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 s=Jh(i,n);r(PR(s)),yield r(dy(s))}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(_x70,_x71){return _ref30.apply(this,arguments)}}());m();d();f();p();m();d();f();p();function fy(_x72,_x73){return _fy.apply(this,arguments)}function _fy(){_fy=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _fy.apply(this,arguments)}function my(e){let t,r,n,o=!1;return function(s){t===void 0?(t=s,r=0,n=-1):t=FR(t,s);let a=t.length,c=0;for(;r<a;){o&&(t[r]===10&&(c=++r),o=!1);let u=-1;for(;r<a&&u===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-c);break;case 13:o=!0,u=r;break;case 10:u=r;break}if(u===-1)break;e(t.subarray(c,u),n),c=r,n=-1}c===a?t=void 0:c!==0&&(t=t.subarray(c),r-=c)}}function gy(e,t,r){let n=py(),o=new TextDecoder;return function(s,a){if(s.length===0)r?.(n),n=py();else if(a>0){let c=o.decode(s.subarray(0,a)),u=a+(s[a+1]===32?2:1),g=o.decode(s.subarray(u));switch(c){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":NR(g,n,t);break}}}}function NR(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function FR(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function py(){return{data:"",event:"",id:"",retry:void 0}}var Nd="text/event-stream",DR=1e3,hy="last-event-id";function yy(){return typeof window<"u"}function vy(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:s,openWhenHidden:a,fetch:c,...u}){return new Promise((g,v)=>{let w={...r};w.accept||(w.accept=Nd);let h;function y(){h?.abort(),document.hidden||T()}!a&&yy()&&document.addEventListener("visibilitychange",y);let S=DR,x;function I(){yy()&&document.removeEventListener("visibilitychange",y),clearTimeout(x),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let _=c??C,R=n??MR;function T(){return _T2.apply(this,arguments)}function _T2(){_T2=_asyncToGenerator(function*(){h=l.AbortController?new l.AbortController:null;try{let k=yield _(e,{...u,headers:w,signal:h?.signal});yield R(k),yield fy(k.body,my(gy(F=>{F?w[hy]=F:delete w[hy]},F=>{S=F},o))),i?.(),I(),g()}catch(k){if(!h?.signal?.aborted)try{let F=s?.(k)??S;clearTimeout(x),x=setTimeout(T,F)}catch(F){I(),v(F)}}});return _T2.apply(this,arguments)}T()})}function MR(e){let t=e.headers.get("content-type");if(!t?.startsWith(Nd))throw new Error(`Expected content-type to be ${Nd}, Actual: ${t}`)}m();d();f();p();var LR=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:i,organizationId:s}=n.configuration,a=n.generatedAnswer.answerConfigurationId,c={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let u=Dn(n.configuration.search?.apiBaseUrl,s,i);return yg({baseUrl:`${u}/rest/organizations/${s}/answer/v1/configs/${a}`,fetchFn:function(){var _ref32=_asyncToGenerator(function*(g){if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let v=g.url,w={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{w[h]=g[h]}),w.duplex="half",w.body=yield g.text(),C(v,w)});return function fetchFn(_x77){return _ref32.apply(this,arguments)}}()})(c,{...t,signal:null},r)}catch(u){return{error:u}}});return function LR(_x74,_x75,_x76){return _ref31.apply(this,arguments)}}(),Sy=_g({reducerPath:"answer",baseQuery:Sg(LR,{maxRetries:3}),endpoints:()=>({})});var jR=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},qR=(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)},UR=(e,t)=>{delete e.error,e.citations=t.citations},VR=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},BR=(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})`)},GR=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&BR(t,o);let i=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":i.contentFormat&&(jR(t,i),r(_i(i.contentFormat)));break;case"genqa.messageType":typeof i.textDelta=="string"&&(qR(t,i),r(Ri({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(UR(t,i),r(Ti({citations:i.citations})));break;case"genqa.endOfStreamType":{VR(t,i);let s=t.answerId,a=i.answerGenerated??!1,c=a?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(a,s,c)),r(io());break}}},$R=(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`},Fd=Sy.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(_x78,_x79){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:i,extra:s}){yield n;let{configuration:a,generatedAnswer:c,insightConfiguration:u}=r(),{generatedAnswerAnalyticsClient:g}=s,{organizationId:v,environment:w,accessToken:h}=a,y=Dn(a.search.apiBaseUrl,v,w),S=$R(y,v,c.answerConfigurationId,u?.insightId);yield vy(S,{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 _ref33=_asyncToGenerator(function*(x){let I=x.headers.get("x-answer-id");I&&o(_=>{_.answerId=I,i(Fa(I))})});return function onopen(_x80){return _ref33.apply(this,arguments)}}(),onmessage:x=>{o(I=>{GR(x,I,i,g??xa)})},onerror:x=>{throw x},onclose:()=>{o(x=>{i(Oi(!x.generated))})}})}).apply(this,arguments)}})})}),dy=e=>Fd.endpoints.getAnswer.initiate(e);m();d();f();p();var Ay=Qe(Qn,e=>e);m();d();f();p();function QR(e){let t=e.payload?.analyticsAction;return by(e)&&!ce(t)}function by(e){return"type"in e}var wy=e=>t=>r=>{let n;QR(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return by(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 TH=B("tab/register",e=>{let t=new xe({values:{id:ee,expression:Dt}});return W(e,t)}),Cy=B("tab/updateActiveTab",e=>W(e,ee));m();d();f();p();var La=Pt(Ea(),1),Iy=Pt(xy(),1),Ry=Pt(Ey(),1);La.default.extend(Ry.default);La.default.extend(Iy.default);var Ty=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:La.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 HR=/(^|; )Coveo-Pendragon=([^;]*)/,zR=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function ky(){return typeof window>"u"?!1:HR.exec(document.cookie)?.pop()||null}function _y(){return typeof window>"u"?!1:zR.test(document.cookie)}var Oy=Qe(Ty(),e=>e.addCase(Hn,(t,r)=>{WR(t,r.payload)}).addCase(Us,(t,r)=>{KR(t,r.payload)}).addCase(Vs,(t,r)=>{YR(t,r.payload)}).addCase(Bs,t=>{t.analytics.enabled=!1}).addCase(Gs,t=>{t.analytics.enabled=!0}).addCase(Lm,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(jm,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(Cy,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Om,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Ls,(t,r)=>{ce(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(qm,(t,{payload:r})=>{XR(t,r)}));function WR(e,t){ce(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ce(t.organizationId)||(e.organizationId=t.organizationId)}function KR(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 YR(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=ky();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 XR(e,t){e.knowledge.agentId=t;try{_y()&&(e.knowledge.debugAgentSession=!0)}catch{}}var St=Oy;m();d();f();p();function ZR(e){return e.instantlyCallable}var Py=()=>e=>t=>e(ZR(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 tt=[];for(let e=0;e<256;++e)tt.push((e+256).toString(16).slice(1));function Ny(e,t=0){return(tt[e[t+0]]+tt[e[t+1]]+tt[e[t+2]]+tt[e[t+3]]+"-"+tt[e[t+4]]+tt[e[t+5]]+"-"+tt[e[t+6]]+tt[e[t+7]]+"-"+tt[e[t+8]]+tt[e[t+9]]+"-"+tt[e[t+10]]+tt[e[t+11]]+tt[e[t+12]]+tt[e[t+13]]+tt[e[t+14]]+tt[e[t+15]]).toLowerCase()}m();d();f();p();var qd,JR=new Uint8Array(16);function Ud(){if(!qd){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");qd=crypto.getRandomValues.bind(crypto)}return qd(JR)}m();d();f();p();m();d();f();p();var eT=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Vd={randomUUID:eT};function tT(e,t,r){if(Vd.randomUUID&&!t&&!e)return Vd.randomUUID();e=e||{};let n=e.random??e.rng?.()??Ud();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 Ny(n)}var Ir=tT;m();d();f();p();m();d();f();p();var A={};Xi(A,{BRAND:()=>RT,DIRTY:()=>nn,EMPTY_PATH:()=>iT,INVALID:()=>ue,NEVER:()=>dk,OK:()=>at,ParseStatus:()=>rt,Schema:()=>ye,ZodAny:()=>kr,ZodArray:()=>fr,ZodBigInt:()=>sn,ZodBoolean:()=>an,ZodBranded:()=>Ni,ZodCatch:()=>vn,ZodDate:()=>cn,ZodDefault:()=>yn,ZodDiscriminatedUnion:()=>Ua,ZodEffects:()=>Rt,ZodEnum:()=>gn,ZodError:()=>lt,ZodFirstPartyTypeKind:()=>le,ZodFunction:()=>Ba,ZodIntersection:()=>pn,ZodIssueCode:()=>z,ZodLazy:()=>fn,ZodLiteral:()=>mn,ZodMap:()=>go,ZodNaN:()=>yo,ZodNativeEnum:()=>hn,ZodNever:()=>Lt,ZodNull:()=>ln,ZodNullable:()=>Wt,ZodNumber:()=>on,ZodObject:()=>dt,ZodOptional:()=>Et,ZodParsedType:()=>te,ZodPipeline:()=>Fi,ZodPromise:()=>_r,ZodReadonly:()=>Sn,ZodRecord:()=>Va,ZodSchema:()=>ye,ZodSet:()=>ho,ZodString:()=>Tr,ZodSymbol:()=>fo,ZodTransformer:()=>Rt,ZodTuple:()=>zt,ZodType:()=>ye,ZodUndefined:()=>un,ZodUnion:()=>dn,ZodUnknown:()=>pr,ZodVoid:()=>mo,addIssueToContext:()=>Z,any:()=>MT,array:()=>UT,bigint:()=>OT,boolean:()=>$y,coerce:()=>lk,custom:()=>Vy,date:()=>PT,datetimeRegex:()=>qy,defaultErrorMap:()=>lr,discriminatedUnion:()=>$T,effect:()=>rk,enum:()=>JT,function:()=>YT,getErrorMap:()=>uo,getParsedType:()=>Ht,instanceof:()=>kT,intersection:()=>QT,isAborted:()=>ja,isAsync:()=>lo,isDirty:()=>qa,isValid:()=>Rr,late:()=>TT,lazy:()=>XT,literal:()=>ZT,makeIssue:()=>Pi,map:()=>WT,nan:()=>_T,nativeEnum:()=>ek,never:()=>jT,null:()=>DT,nullable:()=>ok,number:()=>Gy,object:()=>VT,objectUtil:()=>Bd,oboolean:()=>uk,onumber:()=>ck,optional:()=>nk,ostring:()=>ak,pipeline:()=>sk,preprocess:()=>ik,promise:()=>tk,quotelessJson:()=>rT,record:()=>zT,set:()=>KT,setErrorMap:()=>oT,strictObject:()=>BT,string:()=>By,symbol:()=>NT,transformer:()=>rk,tuple:()=>HT,undefined:()=>FT,union:()=>GT,unknown:()=>LT,util:()=>Ae,void:()=>qT});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Ae;(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 s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},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 s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},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(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ae||(Ae={}));var Bd;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Bd||(Bd={}));var te=Ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ht=e=>{switch(typeof e){case"undefined":return te.undefined;case"string":return te.string;case"number":return Number.isNaN(e)?te.nan:te.number;case"boolean":return te.boolean;case"function":return te.function;case"bigint":return te.bigint;case"symbol":return te.symbol;case"object":return Array.isArray(e)?te.array:e===null?te.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?te.promise:typeof Map<"u"&&e instanceof Map?te.map:typeof Set<"u"&&e instanceof Set?te.set:typeof Date<"u"&&e instanceof Date?te.date:te.object;default:return te.unknown}};var z=Ae.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"]),rT=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),lt=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 s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};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,Ae.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()}};lt.create=e=>new lt(e);var nT=(e,t)=>{let r;switch(e.code){case z.invalid_type:e.received===te.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ae.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ae.joinValues(e.keys,", ")}`;break;case z.invalid_union:r="Invalid input";break;case z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ae.joinValues(e.options)}`;break;case z.invalid_enum_value:r=`Invalid enum value. Expected ${Ae.joinValues(e.options)}, received '${e.received}'`;break;case z.invalid_arguments:r="Invalid function arguments";break;case z.invalid_return_type:r="Invalid function return type";break;case z.invalid_date:r="Invalid date";break;case z.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}"`:Ae.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case z.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 z.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 z.custom:r="Invalid input";break;case z.invalid_intersection_types:r="Intersection results could not be merged";break;case z.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case z.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ae.assertNever(e)}return{message:r}},lr=nT;var Fy=lr;function oT(e){Fy=e}function uo(){return Fy}m();d();f();p();var Pi=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...(o.path||[])],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},iT=[];function Z(e,t){let r=uo(),n=Pi({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===lr?void 0:lr].filter(o=>!!o)});e.common.issues.push(n)}var rt=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 ue;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,s=yield o.value;n.push({key:i,value:s})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return ue;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},ue=Object.freeze({status:"aborted"}),nn=e=>({status:"dirty",value:e}),at=e=>({status:"valid",value:e}),ja=e=>e.status==="aborted",qa=e=>e.status==="dirty",Rr=e=>e.status==="valid",lo=e=>typeof Promise<"u"&&e instanceof Promise;m();d();f();p();m();d();f();p();var ne;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ne||(ne={}));var It=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}},Dy=(e,t)=>{if(Rr(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 lt(e.common.issues);return this._error=r,this._error}}};function me(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:(s,a)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}var ye=class{get description(){return this._def.description}_getType(t){return Ht(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Ht(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new rt,ctx:{common:t.parent.common,data:t.data,parsedType:Ht(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(lo(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:Ht(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Dy(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ht(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Rr(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=>Rr(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this7=this;return _asyncToGenerator(function*(){let n=yield _this7.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this8=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this8._def.errorMap,parent:null,data:t,parsedType:Ht(t)},o=_this8._parse({data:t,path:n.path,parent:n}),i=yield lo(o)?o:Promise.resolve(o);return Dy(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 s=t(o),a=()=>i.addIssue({code:z.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!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 Rt({schema:this,typeName:le.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 Et.create(this,this._def)}nullable(){return Wt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fr.create(this)}promise(){return _r.create(this,this._def)}or(t){return dn.create([this,t],this._def)}and(t){return pn.create(this,t,this._def)}transform(t){return new Rt({...me(this._def),schema:this,typeName:le.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new yn({...me(this._def),innerType:this,defaultValue:r,typeName:le.ZodDefault})}brand(){return new Ni({typeName:le.ZodBranded,type:this,...me(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new vn({...me(this._def),innerType:this,catchValue:r,typeName:le.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Fi.create(this,t)}readonly(){return Sn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},sT=/^c[^\s-]{8,}$/i,aT=/^[0-9a-z]+$/,cT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,uT=/^[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,lT=/^[a-z0-9_-]{21}$/i,dT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,pT=/^[-+]?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)?)??$/,fT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Gd,gT=/^(?:(?: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])$/,hT=/^(?:(?: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])$/,yT=/^(([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]))$/,vT=/^(([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])$/,ST=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,AT=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ly="((\\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])))",bT=new RegExp(`^${Ly}$`);function jy(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 wT(e){return new RegExp(`^${jy(e)}$`)}function qy(e){let t=`${Ly}T${jy(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 CT(e,t){return!!((t==="v4"||!t)&&gT.test(e)||(t==="v6"||!t)&&yT.test(e))}function xT(e,t){if(!dT.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 ET(e,t){return!!((t==="v4"||!t)&&hT.test(e)||(t==="v6"||!t)&&vT.test(e))}var Tr=class e extends ye{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==te.string){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_type,expected:te.string,received:i.parsedType}),ue}let n=new rt,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:z.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),Z(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?Z(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&Z(o,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")fT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"email",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Gd||(Gd=new RegExp(mT,"u")),Gd.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"emoji",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")uT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"uuid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")lT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"nanoid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")sT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cuid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")aT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cuid2",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")cT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"ulid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),Z(o,{validation:"url",code:z.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),Z(o,{validation:"regex",code:z.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),Z(o,{code:z.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),Z(o,{code:z.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?qy(i).test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?bT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?wT(i).test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?pT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"duration",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?CT(t.data,i.version)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"ip",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?xT(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"jwt",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?ET(t.data,i.version)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cidr",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?ST.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"base64",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?AT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"base64url",code:z.invalid_string,message:i.message}),n.dirty()):Ae.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:z.invalid_string,...ne.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ne.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ne.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ne.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ne.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ne.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ne.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ne.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ne.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ne.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ne.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ne.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ne.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ne.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,...ne.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,...ne.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ne.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ne.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ne.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ne.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ne.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ne.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ne.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ne.errToObj(r)})}nonempty(t){return this.min(1,ne.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}};Tr.create=e=>new Tr({checks:[],typeName:le.ZodString,coerce:e?.coerce??!1,...me(e)});function IT(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(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var on=class e extends ye{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==te.number){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_type,expected:te.number,received:i.parsedType}),ue}let n,o=new rt;for(let i of this._def.checks)i.kind==="int"?Ae.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),Z(n,{code:z.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),Z(n,{code:z.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),Z(n,{code:z.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?IT(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),Z(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),Z(n,{code:z.not_finite,message:i.message}),o.dirty()):Ae.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ne.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ne.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ne.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ne.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ne.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ne.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ne.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ne.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ne.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ne.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ne.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ne.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ne.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ne.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"&&Ae.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)}};on.create=e=>new on({checks:[],typeName:le.ZodNumber,coerce:e?.coerce||!1,...me(e)});var sn=class e extends ye{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==te.bigint)return this._getInvalidInput(t);let n,o=new rt;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),Z(n,{code:z.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),Z(n,{code:z.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),Z(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ae.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Z(r,{code:z.invalid_type,expected:te.bigint,received:r.parsedType}),ue}gte(t,r){return this.setLimit("min",t,!0,ne.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ne.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ne.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ne.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ne.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:ne.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ne.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ne.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ne.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ne.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}};sn.create=e=>new sn({checks:[],typeName:le.ZodBigInt,coerce:e?.coerce??!1,...me(e)});var an=class extends ye{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==te.boolean){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.boolean,received:n.parsedType}),ue}return at(t.data)}};an.create=e=>new an({typeName:le.ZodBoolean,coerce:e?.coerce||!1,...me(e)});var cn=class e extends ye{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==te.date){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_type,expected:te.date,received:i.parsedType}),ue}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_date}),ue}let n=new rt,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:z.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),Z(o,{code:z.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Ae.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:ne.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ne.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}};cn.create=e=>new cn({checks:[],coerce:e?.coerce||!1,typeName:le.ZodDate,...me(e)});var fo=class extends ye{_parse(t){if(this._getType(t)!==te.symbol){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.symbol,received:n.parsedType}),ue}return at(t.data)}};fo.create=e=>new fo({typeName:le.ZodSymbol,...me(e)});var un=class extends ye{_parse(t){if(this._getType(t)!==te.undefined){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.undefined,received:n.parsedType}),ue}return at(t.data)}};un.create=e=>new un({typeName:le.ZodUndefined,...me(e)});var ln=class extends ye{_parse(t){if(this._getType(t)!==te.null){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.null,received:n.parsedType}),ue}return at(t.data)}};ln.create=e=>new ln({typeName:le.ZodNull,...me(e)});var kr=class extends ye{constructor(){super(...arguments),this._any=!0}_parse(t){return at(t.data)}};kr.create=e=>new kr({typeName:le.ZodAny,...me(e)});var pr=class extends ye{constructor(){super(...arguments),this._unknown=!0}_parse(t){return at(t.data)}};pr.create=e=>new pr({typeName:le.ZodUnknown,...me(e)});var Lt=class extends ye{_parse(t){let r=this._getOrReturnCtx(t);return Z(r,{code:z.invalid_type,expected:te.never,received:r.parsedType}),ue}};Lt.create=e=>new Lt({typeName:le.ZodNever,...me(e)});var mo=class extends ye{_parse(t){if(this._getType(t)!==te.undefined){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.void,received:n.parsedType}),ue}return at(t.data)}};mo.create=e=>new mo({typeName:le.ZodVoid,...me(e)});var fr=class e extends ye{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==te.array)return Z(r,{code:z.invalid_type,expected:te.array,received:r.parsedType}),ue;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&(Z(r,{code:s?z.too_big:z.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?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&&(Z(r,{code:z.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&&(Z(r,{code:z.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((s,a)=>o.type._parseAsync(new It(r,s,r.path,a)))).then(s=>rt.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new It(r,s,r.path,a)));return rt.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:ne.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ne.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ne.toString(r)}})}nonempty(t){return this.min(1,t)}};fr.create=(e,t)=>new fr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:le.ZodArray,...me(t)});function po(e){if(e instanceof dt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Et.create(po(n))}return new dt({...e._def,shape:()=>t})}else return e instanceof fr?new fr({...e._def,type:po(e.element)}):e instanceof Et?Et.create(po(e.unwrap())):e instanceof Wt?Wt.create(po(e.unwrap())):e instanceof zt?zt.create(e.items.map(t=>po(t))):e}var dt=class e extends ye{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=Ae.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==te.object){let u=this._getOrReturnCtx(t);return Z(u,{code:z.invalid_type,expected:te.object,received:u.parsedType}),ue}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Lt&&this._def.unknownKeys==="strip"))for(let u in o.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let g=i[u],v=o.data[u];c.push({key:{status:"valid",value:u},value:g._parse(new It(o,v,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof Lt){let u=this._def.unknownKeys;if(u==="passthrough")for(let g of a)c.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(u==="strict")a.length>0&&(Z(o,{code:z.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let g of a){let v=o.data[g];c.push({key:{status:"valid",value:g},value:u._parse(new It(o,v,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let u=[];for(let g of c){let v=yield g.key,w=yield g.value;u.push({key:v,value:w,alwaysSet:g.alwaysSet})}return u})).then(u=>rt.mergeObjectSync(n,u)):rt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return ne.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:ne.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:le.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 Ae.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 Ae.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return po(this)}partial(t){let r={};for(let n of Ae.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 Ae.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Et;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Uy(Ae.objectKeys(this.shape))}};dt.create=(e,t)=>new dt({shape:()=>e,unknownKeys:"strip",catchall:Lt.create(),typeName:le.ZodObject,...me(t)});dt.strictCreate=(e,t)=>new dt({shape:()=>e,unknownKeys:"strict",catchall:Lt.create(),typeName:le.ZodObject,...me(t)});dt.lazycreate=(e,t)=>new dt({shape:e,unknownKeys:"strip",catchall:Lt.create(),typeName:le.ZodObject,...me(t)});var dn=class extends ye{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new lt(a.ctx.common.issues));return Z(r,{code:z.invalid_union,unionErrors:s}),ue}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(i){let s={...r,common:{...r.common,issues:[]},parent:null};return{result:yield i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}});return function(_x81){return _ref35.apply(this,arguments)}}())).then(o);{let i,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},g=c._parseSync({data:r.data,path:r.path,parent:u});if(g.status==="valid")return g;g.status==="dirty"&&!i&&(i={result:g,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(c=>new lt(c));return Z(r,{code:z.invalid_union,unionErrors:a}),ue}}get options(){return this._def.options}};dn.create=(e,t)=>new dn({options:e,typeName:le.ZodUnion,...me(t)});var dr=e=>e instanceof fn?dr(e.schema):e instanceof Rt?dr(e.innerType()):e instanceof mn?[e.value]:e instanceof gn?e.options:e instanceof hn?Ae.objectValues(e.enum):e instanceof yn?dr(e._def.innerType):e instanceof un?[void 0]:e instanceof ln?[null]:e instanceof Et?[void 0,...dr(e.unwrap())]:e instanceof Wt?[null,...dr(e.unwrap())]:e instanceof Ni||e instanceof Sn?dr(e.unwrap()):e instanceof vn?dr(e._def.innerType):[],Ua=class e extends ye{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.object)return Z(r,{code:z.invalid_type,expected:te.object,received:r.parsedType}),ue;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}):(Z(r,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ue)}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 s=dr(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new e({typeName:le.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...me(n)})}};function $d(e,t){let r=Ht(e),n=Ht(t);if(e===t)return{valid:!0,data:e};if(r===te.object&&n===te.object){let o=Ae.objectKeys(t),i=Ae.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let c=$d(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===te.array&&n===te.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],c=$d(s,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===te.date&&n===te.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var pn=class extends ye{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,s)=>{if(ja(i)||ja(s))return ue;let a=$d(i.value,s.value);return a.valid?((qa(i)||qa(s))&&r.dirty(),{status:r.value,value:a.data}):(Z(n,{code:z.invalid_intersection_types}),ue)};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,s])=>o(i,s)):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}))}};pn.create=(e,t,r)=>new pn({left:e,right:t,typeName:le.ZodIntersection,...me(r)});var zt=class e extends ye{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.array)return Z(n,{code:z.invalid_type,expected:te.array,received:n.parsedType}),ue;if(n.data.length<this._def.items.length)return Z(n,{code:z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ue;!this._def.rest&&n.data.length>this._def.items.length&&(Z(n,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new It(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>rt.mergeArray(r,s)):rt.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};zt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new zt({items:e,typeName:le.ZodTuple,rest:null,...me(t)})};var Va=class e extends ye{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.object)return Z(n,{code:z.invalid_type,expected:te.object,received:n.parsedType}),ue;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new It(n,a,n.path,a)),value:s._parse(new It(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?rt.mergeObjectAsync(r,o):rt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof ye?new e({keyType:t,valueType:r,typeName:le.ZodRecord,...me(n)}):new e({keyType:Tr.create(),valueType:t,typeName:le.ZodRecord,...me(r)})}},go=class extends ye{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.map)return Z(n,{code:z.invalid_type,expected:te.map,received:n.parsedType}),ue;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new It(n,a,n.path,[u,"key"])),value:i._parse(new It(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let c of s){let u=yield c.key,g=yield c.value;if(u.status==="aborted"||g.status==="aborted")return ue;(u.status==="dirty"||g.status==="dirty")&&r.dirty(),a.set(u.value,g.value)}return{status:r.value,value:a}}))}else{let a=new Map;for(let c of s){let u=c.key,g=c.value;if(u.status==="aborted"||g.status==="aborted")return ue;(u.status==="dirty"||g.status==="dirty")&&r.dirty(),a.set(u.value,g.value)}return{status:r.value,value:a}}}};go.create=(e,t,r)=>new go({valueType:t,keyType:e,typeName:le.ZodMap,...me(r)});var ho=class e extends ye{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.set)return Z(n,{code:z.invalid_type,expected:te.set,received:n.parsedType}),ue;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(Z(n,{code:z.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&&(Z(n,{code:z.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let u=new Set;for(let g of c){if(g.status==="aborted")return ue;g.status==="dirty"&&r.dirty(),u.add(g.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>i._parse(new It(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:ne.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ne.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};ho.create=(e,t)=>new ho({valueType:e,minSize:null,maxSize:null,typeName:le.ZodSet,...me(t)});var Ba=class e extends ye{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.function)return Z(r,{code:z.invalid_type,expected:te.function,received:r.parsedType}),ue;function n(a,c){return Pi({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,uo(),lr].filter(u=>!!u),issueData:{code:z.invalid_arguments,argumentsError:c}})}function o(a,c){return Pi({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,uo(),lr].filter(u=>!!u),issueData:{code:z.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof _r){let a=this;return at(/*#__PURE__*/_asyncToGenerator(function*(...c){let u=new lt([]),g=yield a._def.args.parseAsync(c,i).catch(h=>{throw u.addIssue(n(c,h)),u}),v=yield Reflect.apply(s,this,g);return yield a._def.returns._def.type.parseAsync(v,i).catch(h=>{throw u.addIssue(o(v,h)),u})}))}else{let a=this;return at(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new lt([n(c,u.error)]);let g=Reflect.apply(s,this,u.data),v=a._def.returns.safeParse(g,i);if(!v.success)throw new lt([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:zt.create(t).rest(pr.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||zt.create([]).rest(pr.create()),returns:r||pr.create(),typeName:le.ZodFunction,...me(n)})}},fn=class extends ye{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})}};fn.create=(e,t)=>new fn({getter:e,typeName:le.ZodLazy,...me(t)});var mn=class extends ye{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Z(r,{received:r.data,code:z.invalid_literal,expected:this._def.value}),ue}return{status:"valid",value:t.data}}get value(){return this._def.value}};mn.create=(e,t)=>new mn({value:e,typeName:le.ZodLiteral,...me(t)});function Uy(e,t){return new gn({values:e,typeName:le.ZodEnum,...me(t)})}var gn=class e extends ye{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return Z(r,{expected:Ae.joinValues(n),received:r.parsedType,code:z.invalid_type}),ue}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 Z(r,{received:r.data,code:z.invalid_enum_value,options:n}),ue}return at(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})}};gn.create=Uy;var hn=class extends ye{_parse(t){let r=Ae.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==te.string&&n.parsedType!==te.number){let o=Ae.objectValues(r);return Z(n,{expected:Ae.joinValues(o),received:n.parsedType,code:z.invalid_type}),ue}if(this._cache||(this._cache=new Set(Ae.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Ae.objectValues(r);return Z(n,{received:n.data,code:z.invalid_enum_value,options:o}),ue}return at(t.data)}get enum(){return this._def.values}};hn.create=(e,t)=>new hn({values:e,typeName:le.ZodNativeEnum,...me(t)});var _r=class extends ye{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.promise&&r.common.async===!1)return Z(r,{code:z.invalid_type,expected:te.promise,received:r.parsedType}),ue;let n=r.parsedType===te.promise?r.data:Promise.resolve(r.data);return at(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};_r.create=(e,t)=>new _r({type:e,typeName:le.ZodPromise,...me(t)});var Rt=class extends ye{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===le.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this9=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{Z(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(a){if(r.value==="aborted")return ue;let c=yield _this9._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?ue:c.status==="dirty"?nn(c.value):r.value==="dirty"?nn(c.value):c});return function(_x82){return _ref38.apply(this,arguments)}}());{if(r.value==="aborted")return ue;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ue:a.status==="dirty"?nn(a.value):r.value==="dirty"?nn(a.value):a}}if(o.type==="refinement"){let s=a=>{let c=o.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ue:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ue:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Rr(s))return ue;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Rr(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):ue);Ae.assertNever(o)}};Rt.create=(e,t,r)=>new Rt({schema:e,typeName:le.ZodEffects,effect:t,...me(r)});Rt.createWithPreprocess=(e,t,r)=>new Rt({schema:t,effect:{type:"preprocess",transform:e},typeName:le.ZodEffects,...me(r)});var Et=class extends ye{_parse(t){return this._getType(t)===te.undefined?at(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Et.create=(e,t)=>new Et({innerType:e,typeName:le.ZodOptional,...me(t)});var Wt=class extends ye{_parse(t){return this._getType(t)===te.null?at(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Wt.create=(e,t)=>new Wt({innerType:e,typeName:le.ZodNullable,...me(t)});var yn=class extends ye{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===te.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};yn.create=(e,t)=>new yn({innerType:e,typeName:le.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...me(t)});var vn=class extends ye{_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 lo(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new lt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new lt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};vn.create=(e,t)=>new vn({innerType:e,typeName:le.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...me(t)});var yo=class extends ye{_parse(t){if(this._getType(t)!==te.nan){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.nan,received:n.parsedType}),ue}return{status:"valid",value:t.data}}};yo.create=e=>new yo({typeName:le.ZodNaN,...me(e)});var RT=Symbol("zod_brand"),Ni=class extends ye{_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}},Fi=class e extends ye{_parse(t){var _this0=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let i=yield _this0._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ue:i.status==="dirty"?(r.dirty(),nn(i.value)):_this0._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"?ue: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:le.ZodPipeline})}},Sn=class extends ye{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Rr(o)&&(o.value=Object.freeze(o.value)),o);return lo(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Sn.create=(e,t)=>new Sn({innerType:e,typeName:le.ZodReadonly,...me(t)});function My(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Vy(e,t={},r){return e?kr.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=My(t,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!i){let s=My(t,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):kr.create()}var TT={object:dt.lazycreate},le;(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"})(le||(le={}));var kT=(e,t={message:`Input not instance of ${e.name}`})=>Vy(r=>r instanceof e,t),By=Tr.create,Gy=on.create,_T=yo.create,OT=sn.create,$y=an.create,PT=cn.create,NT=fo.create,FT=un.create,DT=ln.create,MT=kr.create,LT=pr.create,jT=Lt.create,qT=mo.create,UT=fr.create,VT=dt.create,BT=dt.strictCreate,GT=dn.create,$T=Ua.create,QT=pn.create,HT=zt.create,zT=Va.create,WT=go.create,KT=ho.create,YT=Ba.create,XT=fn.create,ZT=mn.create,JT=gn.create,ek=hn.create,tk=_r.create,rk=Rt.create,nk=Et.create,ok=Wt.create,ik=Rt.createWithPreprocess,sk=Fi.create,ak=()=>By().optional(),ck=()=>Gy().optional(),uk=()=>$y().optional(),lk={string:e=>Tr.create({...e,coerce:!0}),number:e=>on.create({...e,coerce:!0}),boolean:e=>an.create({...e,coerce:!0}),bigint:e=>sn.create({...e,coerce:!0}),date:e=>cn.create({...e,coerce:!0})};var dk=ue;var pk=A.object({name:A.string(),arguments:A.string()}),fk=A.object({id:A.string(),type:A.literal("function"),function:pk,encryptedValue:A.string().optional()}),Ga=A.object({id:A.string(),role:A.string(),content:A.string().optional(),name:A.string().optional(),encryptedValue:A.string().optional()}),mk=A.object({type:A.literal("text"),text:A.string()}),gk=A.object({type:A.literal("data"),value:A.string(),mimeType:A.string()}),hk=A.object({type:A.literal("url"),value:A.string(),mimeType:A.string().optional()}),$a=A.discriminatedUnion("type",[gk,hk]),yk=A.object({type:A.literal("image"),source:$a,metadata:A.unknown().optional()}),vk=A.object({type:A.literal("audio"),source:$a,metadata:A.unknown().optional()}),Sk=A.object({type:A.literal("video"),source:$a,metadata:A.unknown().optional()}),Ak=A.object({type:A.literal("document"),source:$a,metadata:A.unknown().optional()});var Qy=A.object({type:A.literal("binary"),mimeType:A.string(),id:A.string().optional(),url:A.string().optional(),data:A.string().optional(),filename:A.string().optional()}),Hy=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:A.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},iW=Qy.superRefine((e,t)=>{Hy(e,t)}),bk=A.discriminatedUnion("type",[mk,yk,vk,Sk,Ak,Qy]),wk=bk.superRefine((e,t)=>{e.type==="binary"&&Hy(e,t)}),Ck=Ga.extend({role:A.literal("developer"),content:A.string()}),xk=Ga.extend({role:A.literal("system"),content:A.string()}),Ek=Ga.extend({role:A.literal("assistant"),content:A.string().optional(),toolCalls:A.array(fk).optional()}),Ik=Ga.extend({role:A.literal("user"),content:A.union([A.string(),A.array(wk)])}),Rk=A.object({id:A.string(),content:A.string(),role:A.literal("tool"),toolCallId:A.string(),error:A.string().optional(),encryptedValue:A.string().optional()}),Tk=A.object({id:A.string(),role:A.literal("activity"),activityType:A.string(),content:A.record(A.any())}),kk=A.object({id:A.string(),role:A.literal("reasoning"),content:A.string(),encryptedValue:A.string().optional()}),zy=A.discriminatedUnion("role",[Ck,xk,Ek,Ik,Rk,Tk,kk]),sW=A.union([A.literal("developer"),A.literal("system"),A.literal("assistant"),A.literal("user"),A.literal("tool"),A.literal("activity"),A.literal("reasoning")]),_k=A.object({description:A.string(),value:A.string()}),Wy=A.object({name:A.string(),description:A.string(),parameters:A.any(),metadata:A.record(A.any()).optional()}),Ok=A.object({id:A.string(),reason:A.string(),message:A.string().optional(),toolCallId:A.string().optional(),responseSchema:A.record(A.any()).optional(),expiresAt:A.string().optional(),metadata:A.record(A.any()).optional()}),Pk=A.object({interruptId:A.string(),status:A.enum(["resolved","cancelled"]),payload:A.any().optional()}),Nk=A.object({threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),state:A.any(),messages:A.array(zy),tools:A.array(Wy),context:A.array(_k),forwardedProps:A.any(),resume:A.array(Pk).optional()}),Fk=A.any(),Fe=class extends Error{constructor(e){super(e)}},Qd=class extends Fe{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},Dk=A.object({name:A.string(),description:A.string().optional()}),Mk=A.object({name:A.string().optional(),type:A.string().optional(),description:A.string().optional(),version:A.string().optional(),provider:A.string().optional(),documentationUrl:A.string().optional(),metadata:A.record(A.unknown()).optional()}),Lk=A.object({streaming:A.boolean().optional(),websocket:A.boolean().optional(),httpBinary:A.boolean().optional(),pushNotifications:A.boolean().optional(),resumable:A.boolean().optional()}),jk=A.object({supported:A.boolean().optional(),items:A.array(Wy).optional(),parallelCalls:A.boolean().optional(),clientProvided:A.boolean().optional()}),qk=A.object({structuredOutput:A.boolean().optional(),supportedMimeTypes:A.array(A.string()).optional()}),Uk=A.object({snapshots:A.boolean().optional(),deltas:A.boolean().optional(),memory:A.boolean().optional(),persistentState:A.boolean().optional()}),Vk=A.object({supported:A.boolean().optional(),delegation:A.boolean().optional(),handoffs:A.boolean().optional(),subAgents:A.array(Dk).optional()}),Bk=A.object({supported:A.boolean().optional(),streaming:A.boolean().optional(),encrypted:A.boolean().optional()}),Gk=A.object({image:A.boolean().optional(),audio:A.boolean().optional(),video:A.boolean().optional(),pdf:A.boolean().optional(),file:A.boolean().optional()}),$k=A.object({image:A.boolean().optional(),audio:A.boolean().optional()}),Qk=A.object({input:Gk.optional(),output:$k.optional()}),Hk=A.object({codeExecution:A.boolean().optional(),sandboxed:A.boolean().optional(),maxIterations:A.number().optional(),maxExecutionTime:A.number().optional()}),zk=A.object({supported:A.boolean().optional(),approvals:A.boolean().optional(),interventions:A.boolean().optional(),feedback:A.boolean().optional(),interrupts:A.boolean().optional(),approveWithEdits:A.boolean().optional()}),aW=A.object({identity:Mk.optional(),transport:Lk.optional(),tools:jk.optional(),output:qk.optional(),state:Uk.optional(),multiAgent:Vk.optional(),reasoning:Bk.optional(),multimodal:Qk.optional(),execution:Hk.optional(),humanInTheLoop:zk.optional(),custom:A.record(A.unknown()).optional()}),Ky=A.union([A.literal("developer"),A.literal("system"),A.literal("assistant"),A.literal("user")]),D=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}({}),Ee=A.object({type:A.nativeEnum(D),timestamp:A.number().optional(),rawEvent:A.any().optional()}).passthrough(),Wk=Ee.extend({type:A.literal(D.TEXT_MESSAGE_START),messageId:A.string(),role:Ky.default("assistant"),name:A.string().optional()}),Yy=Ee.extend({type:A.literal(D.TEXT_MESSAGE_CONTENT),messageId:A.string(),delta:A.string()}),Kk=Ee.extend({type:A.literal(D.TEXT_MESSAGE_END),messageId:A.string()}),Yk=Ee.extend({type:A.literal(D.TEXT_MESSAGE_CHUNK),messageId:A.string().optional(),role:Ky.optional(),delta:A.string().optional(),name:A.string().optional()}),Xk=Ee.extend({type:A.literal(D.THINKING_TEXT_MESSAGE_START)}),Zk=Yy.omit({messageId:!0,type:!0}).extend({type:A.literal(D.THINKING_TEXT_MESSAGE_CONTENT)}),Jk=Ee.extend({type:A.literal(D.THINKING_TEXT_MESSAGE_END)}),e0=Ee.extend({type:A.literal(D.TOOL_CALL_START),toolCallId:A.string(),toolCallName:A.string(),parentMessageId:A.string().nullable().optional().transform(e=>e??void 0)}),t0=Ee.extend({type:A.literal(D.TOOL_CALL_ARGS),toolCallId:A.string(),delta:A.string()}),r0=Ee.extend({type:A.literal(D.TOOL_CALL_END),toolCallId:A.string()}),n0=Ee.extend({messageId:A.string(),type:A.literal(D.TOOL_CALL_RESULT),toolCallId:A.string(),content:A.string(),role:A.literal("tool").optional()}),o0=Ee.extend({type:A.literal(D.TOOL_CALL_CHUNK),toolCallId:A.string().optional(),toolCallName:A.string().optional(),parentMessageId:A.string().nullable().optional().transform(e=>e??void 0),delta:A.string().optional()}),i0=Ee.extend({type:A.literal(D.THINKING_START),title:A.string().optional()}),s0=Ee.extend({type:A.literal(D.THINKING_END)}),a0=Ee.extend({type:A.literal(D.STATE_SNAPSHOT),snapshot:Fk}),c0=Ee.extend({type:A.literal(D.STATE_DELTA),delta:A.array(A.any())}),u0=Ee.extend({type:A.literal(D.MESSAGES_SNAPSHOT),messages:A.array(zy)}),l0=Ee.extend({type:A.literal(D.ACTIVITY_SNAPSHOT),messageId:A.string(),activityType:A.string(),content:A.record(A.any()),replace:A.boolean().optional().default(!0)}),d0=Ee.extend({type:A.literal(D.ACTIVITY_DELTA),messageId:A.string(),activityType:A.string(),patch:A.array(A.any())}),p0=Ee.extend({type:A.literal(D.RAW),event:A.any(),source:A.string().optional()}),f0=Ee.extend({type:A.literal(D.CUSTOM),name:A.string(),value:A.any()}),m0=Ee.extend({type:A.literal(D.RUN_STARTED),threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),input:Nk.optional()}),g0=A.object({type:A.literal("success")}).strict(),h0=A.object({type:A.literal("interrupt"),interrupts:A.array(Ok).min(1)}).strict(),y0=A.discriminatedUnion("type",[g0,h0]),Xy=A.object({provider:A.string().optional(),model:A.string().optional(),inputTokens:A.number().int().nonnegative().optional(),outputTokens:A.number().int().nonnegative().optional(),totalTokens:A.number().int().nonnegative().optional(),reasoningTokens:A.number().int().nonnegative().optional(),cachedInputTokens:A.number().int().nonnegative().optional()}),v0=Ee.extend({type:A.literal(D.RUN_FINISHED),threadId:A.string(),runId:A.string(),result:A.any().optional(),outcome:y0.nullable().optional().transform(e=>e??void 0),usage:A.array(Xy).optional()}),S0=Ee.extend({type:A.literal(D.RUN_ERROR),message:A.string(),code:A.string().optional(),usage:A.array(Xy).optional()}),A0=Ee.extend({type:A.literal(D.STEP_STARTED),stepName:A.string()}),b0=Ee.extend({type:A.literal(D.STEP_FINISHED),stepName:A.string()}),w0=A.union([A.literal("tool-call"),A.literal("message")]),C0=Ee.extend({type:A.literal(D.REASONING_START),messageId:A.string()}),x0=Ee.extend({type:A.literal(D.REASONING_MESSAGE_START),messageId:A.string(),role:A.literal("reasoning")}),E0=Ee.extend({type:A.literal(D.REASONING_MESSAGE_CONTENT),messageId:A.string(),delta:A.string()}),I0=Ee.extend({type:A.literal(D.REASONING_MESSAGE_END),messageId:A.string()}),R0=Ee.extend({type:A.literal(D.REASONING_MESSAGE_CHUNK),messageId:A.string().optional(),delta:A.string().optional()}),T0=Ee.extend({type:A.literal(D.REASONING_END),messageId:A.string()}),k0=Ee.extend({type:A.literal(D.REASONING_ENCRYPTED_VALUE),subtype:w0,entityId:A.string(),encryptedValue:A.string()}),Qa=A.discriminatedUnion("type",[Wk,Yy,Kk,Yk,i0,s0,Xk,Zk,Jk,e0,t0,r0,o0,n0,a0,c0,u0,l0,d0,p0,f0,m0,v0,S0,A0,b0,C0,x0,E0,I0,R0,T0,k0]);m();d();f();p();var Hd={};Xi(Hd,{JsonPatchError:()=>Ve,_areEquals:()=>Li,applyOperation:()=>An,applyPatch:()=>Za,applyReducer:()=>F0,deepClone:()=>P0,getValueByPointer:()=>Ya,validate:()=>Jy,validator:()=>Xa});m();d();f();p();m();d();f();p();var _0=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)}}(),O0=Object.prototype.hasOwnProperty;function za(e,t){return O0.call(e,t)}function Wa(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)za(e,o)&&n.push(o);return n}function nt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Ka(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 Kt(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Di(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Ha(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Ha(e[t]))return!0}else if(typeof e=="object"){for(var n=Wa(e),o=n.length,i=0;i<o;i++)if(Ha(e[n[i]]))return!0}}return!1}function Zy(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 Mi=function(e){_0(t,e);function t(r,n,o,i,s){var a=this.constructor,c=e.call(this,Zy(r,{name:n,index:o,operation:i,tree:s}))||this;return c.name=n,c.index=o,c.operation=i,c.tree=s,Object.setPrototypeOf(c,a.prototype),c.message=Zy(r,{name:n,index:o,operation:i,tree:s}),c}return t}(Error);var Ve=Mi,P0=nt,vo={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=Ya(r,this.path);n&&(n=nt(n));var o=An(r,{op:"remove",path:this.from}).removed;return An(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Ya(r,this.from);return An(r,{op:"add",path:this.path,value:nt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Li(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},N0={add:function(e,t,r){return Ka(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:vo.move,copy:vo.copy,test:vo.test,_get:vo._get};function Ya(e,t){if(t=="")return e;var r={op:"_get",path:t};return An(e,r),r.value}function An(e,t,r,n,o,i){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),i===void 0&&(i=0),r&&(typeof r=="function"?r(t,0,e,t.path):Xa(t,0)),t.path===""){var s={newDocument:e};if(t.op==="add")return s.newDocument=t.value,s;if(t.op==="replace")return s.newDocument=t.value,s.removed=e,s;if(t.op==="move"||t.op==="copy")return s.newDocument=Ya(e,t.from),t.op==="move"&&(s.removed=e),s;if(t.op==="test"){if(s.test=Li(e,t.value),s.test===!1)throw new Ve("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s.newDocument=e,s}else{if(t.op==="remove")return s.removed=e,s.newDocument=null,s;if(t.op==="_get")return t.value=e,s;if(r)throw new Ve("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return s}}else{n||(e=nt(e));var a=t.path||"",c=a.split("/"),u=e,g=1,v=c.length,w=void 0,h=void 0,y=void 0;for(typeof r=="function"?y=r:y=Xa;;){if(h=c[g],h&&h.indexOf("~")!=-1&&(h=Di(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&c[g-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&w===void 0&&(u[h]===void 0?w=c.slice(0,g).join("/"):g==v-1&&(w=t.path),w!==void 0&&y(t,0,e,w)),g++,Array.isArray(u)){if(h==="-")h=u.length;else{if(r&&!Ka(h))throw new Ve("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,t,e);Ka(h)&&(h=~~h)}if(g>=v){if(r&&t.op==="add"&&h>u.length)throw new Ve("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);var s=N0[t.op].call(t,u,h,e);if(s.test===!1)throw new Ve("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}}else if(g>=v){var s=vo[t.op].call(t,u,h,e);if(s.test===!1)throw new Ve("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}if(u=u[h],r&&g<v&&(!u||typeof u!="object"))throw new Ve("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function Za(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new Ve("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=nt(e));for(var i=new Array(t.length),s=0,a=t.length;s<a;s++)i[s]=An(e,t[s],r,!0,o,s),e=i[s].newDocument;return i.newDocument=e,i}function F0(e,t,r){var n=An(e,t);if(n.test===!1)throw new Ve("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Xa(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Ve("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(vo[e.op]){if(typeof e.path!="string")throw new Ve("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Ve("Operation `path` property must start with \"/\"","OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new Ve("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new Ve("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&Ha(e.value))throw new Ve("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var o=e.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new Ve("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new Ve("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var s={op:"_get",path:e.from,value:void 0},a=Jy([s],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new Ve("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Ve("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function Jy(e,t,r){try{if(!Array.isArray(e))throw new Ve("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Za(nt(t),nt(e),r||!0);else{r=r||Xa;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof Ve)return o;throw o}}function Li(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),o,i,s;if(r&&n){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!Li(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var a=Object.keys(e);if(i=a.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(a[o]))return!1;for(o=i;o--!==0;)if(s=a[o],!Li(e[s],t[s]))return!1;return!0}return e!==e&&t!==t}var Yd={};Xi(Yd,{compare:()=>B0,generate:()=>zd,observe:()=>V0,unobserve:()=>U0});m();d();f();p();var Wd=new WeakMap,D0=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),M0=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function L0(e){return Wd.get(e)}function j0(e,t){return e.observers.get(t)}function q0(e,t){e.observers.delete(t.callback)}function U0(e,t){t.unobserve()}function V0(e,t){var r=[],n,o=L0(e);if(!o)o=new D0(e),Wd.set(e,o);else{var i=j0(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=nt(e),t){n.callback=t,n.next=null;var s=function(){zd(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(s)};typeof window<"u"&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return n.patches=r,n.object=e,n.unobserve=function(){zd(n),clearTimeout(n.next),q0(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},o.observers.set(t,new M0(t,n)),n}function zd(e,t){t===void 0&&(t=!1);var r=Wd.get(e.object);Kd(r.value,e.object,e.patches,"",t),e.patches.length&&Za(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Kd(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=Wa(t),s=Wa(e),a=!1,c=!1,u=s.length-1;u>=0;u--){var g=s[u],v=e[g];if(za(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var w=t[g];typeof v=="object"&&v!=null&&typeof w=="object"&&w!=null&&Array.isArray(v)===Array.isArray(w)?Kd(v,w,r,n+"/"+Kt(g),o):v!==w&&(a=!0,o&&r.push({op:"test",path:n+"/"+Kt(g),value:nt(v)}),r.push({op:"replace",path:n+"/"+Kt(g),value:nt(w)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+Kt(g),value:nt(v)}),r.push({op:"remove",path:n+"/"+Kt(g)}),c=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),a=!0)}if(!(!c&&i.length==s.length))for(var u=0;u<i.length;u++){var g=i[u];!za(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+Kt(g),value:nt(t[g])})}}}function B0(e,t,r){r===void 0&&(r=!1);var n=[];return Kd(e,t,n,"",r),n}var Ja=Object.assign({},Hd,Yd,{JsonPatchError:Mi,deepClone:nt,escapePathComponent:Kt,unescapePathComponent:Di});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Xd=function(e,t){return Xd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},Xd(e,t)};function Yt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Xd(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function ev(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(g){try{u(n.next(g))}catch(v){s(v)}}function c(g){try{u(n.throw(g))}catch(v){s(v)}}function u(g){g.done?i(g.value):o(g.value).then(a,c)}u((n=n.apply(e,t||[])).next())})}function ec(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(g){return c([u,g])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(r=0)),r;)try{if(n=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(g){u=[6,g],o=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function mr(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function So(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-->0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function Ao(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function bn(e){return this instanceof bn?(this.v=e,this):new bn(e)}function tv(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(h){return function(y){return Promise.resolve(y).then(h,v)}}function a(h,y){n[h]&&(o[h]=function(S){return new Promise(function(x,I){i.push([h,S,x,I])>1||c(h,S)})},y&&(o[h]=y(o[h])))}function c(h,y){try{u(n[h](y))}catch(S){w(i[0][3],S)}}function u(h){h.value instanceof bn?Promise.resolve(h.value.v).then(g,v):w(i[0][2],h)}function g(h){c("next",h)}function v(h){c("throw",h)}function w(h,y){h(y),i.shift(),i.length&&c(i[0][0],i[0][1])}}function rv(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof mr=="function"?mr(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(s){return new Promise(function(a,c){s=e[i](s),o(a,c,s.done,s.value)})}}function o(i,s,a,c){Promise.resolve(c).then(function(u){i({value:u,done:a})},s)}}m();d();f();p();function Se(e){return typeof e=="function"}m();d();f();p();m();d();f();p();m();d();f();p();function bo(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var tc=bo(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
31
+ `;function lI(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var dI=["1",1,"yes",!0];function pI(){let e=[];return Bl()&&e.push(window.doNotTrack),td()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>dI.indexOf(t)!==-1)}function ua(e){return e===!0?!1:pI()}var Jg="v15",eh={default:"https://analytics.cloud.coveo.com/rest/ua"};function fI(e=eh.default,t=Jg,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 mI="38824e1f-37f5-42d3-8372-a4b8fa9df946",$t=class{get defaultOptions(){return{endpoint:eh.default,isCustomEndpoint:!1,token:"",version:Jg,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Kg}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=[nE,Zx].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};ua(this.options.disableBrowserPrivacySignals)?this.runtime=new ca:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(ve.view,{newEventType:ve.view,addClientIdParameter:!0}),this.addEventTypeMapping(ve.click,{newEventType:ve.click,addClientIdParameter:!0}),this.addEventTypeMapping(ve.custom,{newEventType:ve.custom,addClientIdParameter:!0}),this.addEventTypeMapping(ve.search,{newEventType:ve.search,addClientIdParameter:!0})}initRuntime(t){return Bl()&&Zn()?new Jl(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(lI()&&console.warn(uI),new ed(t))}get storage(){return this.runtime.storage}determineVisitorId(){return q(this,void 0,void 0,function*(){try{return Bl()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Jr()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Jr()}})}getCurrentVisitorId(){return q(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return q(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return q(this,void 0,void 0,function*(){if(na(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(oa(t,oa(r,mI)))}})}getParameters(t,...r){return q(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return q(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(Jr()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(ua(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(Sr.cvo_cid);if(r==null)return null;let n=Sr.fromString(r);return!n||!Zn()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return q(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:i=!1,addClientIdParameter:s=!1}=this.eventTypeMapping[t]||{};return yield[h=>n.length>0?this.parseVariableArgumentsPayload(n,h):h[0],h=>q(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>q(this,void 0,void 0,function*(){return s?Object.assign(Object.assign({},h),{clientId:yield this.getCurrentVisitorId()}):h}),h=>i?this.ensureAnonymousUserWhenUsingApiKey(h):h,h=>this.beforeSendHooks.reduce((y,S)=>q(this,void 0,void 0,function*(){let x=yield y;return yield S(t,x)}),h)].reduce((h,y)=>q(this,void 0,void 0,function*(){let S=yield h;return yield y(S)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return q(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?JE(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,w)=>q(this,void 0,void 0,function*(){let h=yield v;return yield w(h)}),Promise.resolve(r))})}makeEvent(t,...r){return q(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:s=>q(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},i),s)}),yield Promise.all(this.afterSendHooks.map(a=>a(t,Object.assign(Object.assign({},o),s)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return q(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return q(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 ra().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ve.search,t)})}sendSearchEvent(t){return q(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=cr(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ve.click,t)})}sendClickEvent(t){return q(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=cr(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ve.custom,t)})}sendCustomEvent(t){return q(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=cr(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ve.view,t)})}sendViewEvent(t){return q(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return q(this,void 0,void 0,function*(){let r=yield(yield C(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return q(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 s=r[o];if(typeof s=="string")n[t[o]]=s;else if(typeof s=="object")return Object.assign(Object.assign({},n),s)}return n}isKeyAllowedEmpty(t,r){return({[ve.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(nI(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=cr(t,["custom"]),o={};r&&ta(r)&&(o=this.lowercaseKeys(r));let i=oI(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=cr(t,["custom"]);if(r&&ta(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=cr(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==ve.view||r==ve.click||r==ve.search||r==ve.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==ve.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=cr(t,["userId"]);return cI(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=cr(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&ta(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&ta(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"?hE(t,r):t}get baseUrl(){return fI(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},ur;(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"})(ur||(ur={}));var G;(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"})(G||(G={}));var Gg={[G.triggerNotify]:"queryPipelineTriggers",[G.triggerExecute]:"queryPipelineTriggers",[G.triggerQuery]:"queryPipelineTriggers",[G.triggerRedirect]:"queryPipelineTriggers",[G.queryErrorBack]:"errors",[G.queryErrorClear]:"errors",[G.queryErrorRetry]:"errors",[G.pagerNext]:"getMoreResults",[G.pagerPrevious]:"getMoreResults",[G.pagerNumber]:"getMoreResults",[G.pagerResize]:"getMoreResults",[G.pagerScrolling]:"getMoreResults",[G.facetSearch]:"facet",[G.facetShowLess]:"facet",[G.facetShowMore]:"facet",[G.recommendation]:"recommendation",[G.likeSmartSnippet]:"smartSnippet",[G.dislikeSmartSnippet]:"smartSnippet",[G.expandSmartSnippet]:"smartSnippet",[G.collapseSmartSnippet]:"smartSnippet",[G.openSmartSnippetFeedbackModal]:"smartSnippet",[G.closeSmartSnippetFeedbackModal]:"smartSnippet",[G.sendSmartSnippetReason]:"smartSnippet",[G.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[G.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[G.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[G.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[G.clearRecentQueries]:"recentQueries",[G.recentResultClick]:"recentlyClickedDocuments",[G.clearRecentResults]:"recentlyClickedDocuments",[G.showLessFoldedResults]:"folding",[G.caseDetach]:"case",[G.likeGeneratedAnswer]:"generatedAnswer",[G.dislikeGeneratedAnswer]:"generatedAnswer",[G.openGeneratedAnswerSource]:"generatedAnswer",[G.generatedAnswerOpenInlineLink]:"generatedAnswer",[G.generatedAnswerFollowupOpenSource]:"generatedAnswer",[G.generatedAnswerStreamEnd]:"generatedAnswer",[G.generatedAnswerSourceHover]:"generatedAnswer",[G.generatedAnswerCopyToClipboard]:"generatedAnswer",[G.generatedAnswerHideAnswers]:"generatedAnswer",[G.generatedAnswerShowAnswers]:"generatedAnswer",[G.generatedAnswerExpand]:"generatedAnswer",[G.generatedAnswerCollapse]:"generatedAnswer",[G.generatedAnswerFeedbackSubmit]:"generatedAnswer",[G.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[ur.expandToFullUI]:"interface",[ur.openUserActions]:"User Actions",[ur.showPrecedingSessions]:"User Actions",[ur.showFollowingSessions]:"User Actions",[ur.clickViewedDocument]:"User Actions",[ur.clickPageView]:"User Actions",[ur.createArticle]:"createArticle"},to=class{constructor(){this.runtime=new ca,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(ve.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(ve.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(ve.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(ve.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return Kg}};function gI(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function hI(e){return e.map(t=>t.replace(/;/g,""))}function th(e){let r=e.join(";");return r.length<=256?r:th(e.slice(1))}var $g=e=>{let t=hI(e),r=gI(t);return th(r)};function Qg(e){let t=typeof e.partialQueries=="string"?e.partialQueries:$g(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:$g(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var la=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||ua(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new to:new $t(t)}disable(){this.coveoAnalyticsClient=new to}enable(){this.coveoAnalyticsClient=new $t(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(G.interfaceLoad)}logInterfaceLoad(){return q(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(G.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(G.recommendation)}logRecommendation(){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent(G.recommendationOpen,t,r)}logRecommendationOpen(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(G.staticFilterClearAll,t)}logStaticFilterClearAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent(G.staticFilterSelect,t)}logStaticFilterSelect(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent(G.staticFilterDeselect,t)}logStaticFilterDeselect(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(G.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return q(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent(G.interfaceChange,t)}logInterfaceChange(t){return q(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(G.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(G.didyoumeanClick)}logDidYouMeanClick(){return q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(G.resultsSort,t)}logResultsSort(t){return q(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(G.searchboxSubmit)}logSearchboxSubmit(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(G.searchboxClear)}logSearchboxClear(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(G.searchboxAsYouType)}logSearchboxAsYouType(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(G.breadcrumbFacet,t)}logBreadcrumbFacet(t){return q(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(G.breadcrumbResetAll)}logBreadcrumbResetAll(){return q(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent(G.documentQuickview,t,r)}logDocumentQuickview(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent(G.documentOpen,t,r)}logDocumentOpen(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(G.omniboxAnalytics,Qg(t))}logOmniboxAnalytics(t){return q(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(G.omniboxFromLink,Qg(t))}logOmniboxFromLink(t){return q(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(G.searchFromLink)}logSearchFromLink(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(G.triggerNotify,t)}logTriggerNotify(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(G.triggerExecute,t)}logTriggerExecute(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(G.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(G.undoTriggerQuery,t)}logUndoTriggerQuery(t){return q(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(G.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(G.pagerResize,t)}logPagerResize(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(G.pagerNumber,t)}logPagerNumber(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(G.pagerNext,t)}logPagerNext(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(G.pagerPrevious,t)}logPagerPrevious(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(G.pagerScrolling)}logPagerScrolling(){return q(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(G.facetClearAll,t)}logFacetClearAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(G.facetSearch,t)}logFacetSearch(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(G.facetSelect,t)}logFacetSelect(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(G.facetDeselect,t)}logFacetDeselect(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(G.facetExclude,t)}logFacetExclude(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(G.facetUnexclude,t)}logFacetUnexclude(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(G.facetSelectAll,t)}logFacetSelectAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(G.facetUpdateSort,t)}logFacetUpdateSort(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(G.facetShowMore,t)}logFacetShowMore(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(G.facetShowLess,t)}logFacetShowLess(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(G.queryError,t)}logQueryError(t){return q(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(G.queryErrorBack);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(G.queryErrorBack)})}})}logQueryErrorBack(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(G.queryErrorRetry);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(G.queryErrorRetry)})}})}logQueryErrorRetry(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(G.queryErrorClear);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(G.queryErrorClear)})}})}logQueryErrorClear(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(G.likeSmartSnippet)}logLikeSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(G.dislikeSmartSnippet)}logDislikeSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(G.expandSmartSnippet)}logExpandSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(G.collapseSmartSnippet)}logCollapseSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(G.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(G.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return q(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent(G.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(G.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent(G.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent(G.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent(G.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent(G.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent(G.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(G.copyToClipboard,t,r)}logCopyToClipboard(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent(G.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent(G.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(G.recentQueryClick)}logRecentQueryClick(){return q(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(G.clearRecentQueries)}logClearRecentQueries(){return q(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent(G.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(G.clearRecentResults)}logClearRecentResults(){return q(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(G.noResultsBack)}logNoResultsBack(){return q(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent(G.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(G.showLessFoldedResults)}logShowLessFoldedResults(){return q(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 q(this,arguments,void 0,function*(n,o,i=Gg[n]){this.coveoAnalyticsClient.getParameters;let s=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),a=Object.assign(Object.assign({},yield this.getBaseEventRequest(s)),{eventType:i,eventValue:n}),c=yield this.coveoAnalyticsClient.makeCustomEvent(a);return{description:this.makeEventDescription(c,n),log:({searchUID:u})=>c.log({lastSearchQueryUid:u})}})}logCustomEvent(t,r){return q(this,arguments,void 0,function*(n,o,i=Gg[n]){return(yield this.makeCustomEvent(n,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return q(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}),s=yield this.coveoAnalyticsClient.makeCustomEvent(i);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({lastSearchQueryUid:a})}})}logCustomEventWithType(t,r,n){return q(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return q(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 q(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}),s=yield this.coveoAnalyticsClient.makeClickEvent(i);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({searchQueryUid:a})}})}logClickEvent(t,r,n,o){return q(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return q(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 q(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 $t?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(G.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(G.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(G.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return q(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent(G.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(G.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent(G.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(G.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(G.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(G.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(G.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(G.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(G.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(G.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(G.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(G.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(G.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return q(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(G.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},da=Object.assign({},gi),Hg=Object.keys(da).map(e=>da[e]),Jn=class extends Ql{constructor({client:t,uuidGenerator:r=Jr}){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])=>Hg.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Hg.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(da.pageview,{newEventType:ve.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(da.event,{newEventType:ve.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 bE(this.ticket)}};Jn.Id="svc";var pa;(function(e){e.click="click",e.flowStart="flowStart"})(pa||(pa={}));var Ct;(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"})(Ct||(Ct={}));var fa;(function(e){e.quit="Quit",e.solved="Solved"})(fa||(fa={}));var ma=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!ua(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new $t(t):new to,this.svc=new Jn({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new to,this.svc=new Jn({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new $t(this.options),this.svc=new Jn({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(Ct.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(Ct.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(Ct.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(Ct.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(Ct.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(Ct.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(Ct.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(Ct.caseCancelled,{reason:fa.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(Ct.caseSolved,{reason:fa.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(Ct.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",pa.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",pa.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return q(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 $t?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 q(this,void 0,void 0,function*(){var i,s;let a=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:(s=(i=this.provider)===null||i===void 0?void 0:i.getSearchUID())!==null&&s!==void 0?s:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(a)})}};m();d();f();p();var yI=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},en=class{constructor(t){oe(this,"getState",t);oe(this,"state");this.state=t()}getLanguage(){return yI(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[i,s]of Object.entries(n)){let a=`context_${i}`;o[a]=s}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=Hn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||Wn()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};m();d();f();p();var ro=e=>new $t(e).getCurrentVisitorId(),vi=(e,t)=>typeof t=="function"?(...r)=>{let n=Go(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,Si=(e,t)=>(...r)=>{let n=Go(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var Ai=class extends en{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},rh=({logger:e,getState:t,analyticsClientMiddleware:r=(s,a)=>a,preprocessRequest:n,provider:o=new Ai(t),disableBrowserPrivacySignals:i})=>{let s=t(),a=s.configuration.accessToken,c=s.configuration.analytics.apiBaseUrl??ot(s.configuration.organizationId,s.configuration.environment,"analytics"),u=s.configuration.analytics.runtimeEnvironment,g=s.configuration.analytics.enabled,v=new ma({enableAnalytics:g,token:a,endpoint:c,runtimeEnvironment:u,disableBrowserPrivacySignals:i,preprocessRequest:vi(e,n),beforeSendHooks:[Si(e,r),(w,h)=>(e.info({...h,type:w,endpoint:c,token:a},"Analytics request"),h)]},o);return g||v.disable(),v};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function ga(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function nh(e){let{activeValue:t,ancestryMap:r}=AI(e);return t?bI(t,r):[]}function AI(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 bI(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var wI=(e,t)=>e.categoryFacetSet[t]?.request;var rd=(e,t)=>{let r=wI(e,t);return nh(r?.currentValues??[])};m();d();f();p();function ha(){return{}}m();d();f();p();function ya(){return{}}m();d();f();p();function va(){return{}}m();d();f();p();function Sa(){return{}}function nd(e){return{facetSet:e.facetSet??Sa(),categoryFacetSet:e.categoryFacetSet??ha(),dateFacetSet:e.dateFacetSet??ya(),numericFacetSet:e.numericFacetSet??va(),automaticFacetSet:e.automaticFacetSet??ga()}}var od=e=>{let t=[];return EI(e).forEach((r,n)=>{let o=NI(e,r.facetId),i=OI(r,n+1);if(xI(r)){if(!!!rd(e,r.facetId).length)return;t.push({...i,...kI(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((s,a)=>{if(s.state==="idle")return;let c=oh(s,a+1,o),u=CI(r)?ih(s):RI(s);t.push({...i,...c,...u})})}),II(e).forEach((r,n)=>{let o=_I(r,n+1);r.values.forEach((i,s)=>{if(i.state==="idle")return;let a=oh(i,s+1,"specific"),c=ih(i);t.push({...o,...a,...c})})}),t},CI=e=>e.type==="specific",xI=e=>e.type==="hierarchical",EI=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),II=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),oh=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),RI=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),ih=e=>({displayValue:e.value,value:e.value}),TI=(e,t)=>rd(e,t).map(n=>n.value).join(";"),kI=(e,t)=>{let n=TI(e,t);return{value:n,valuePosition:1,displayValue:n}},_I=(e,t)=>({title:sh(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),OI=(e,t)=>({title:sh(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),sh=(e,t)=>`${e}_${t}`,PI=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,NI=(e,t)=>{let r=PI(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var id=e=>e.configuration.search.locale,ah=e=>e.configuration.search.timezone,ch=e=>e.configuration.accessToken,uh=e=>e.configuration.organizationId,lh=e=>e.configuration.environment,Aa=e=>e.configuration?.knowledge?.agentId,dh=e=>e.configuration.knowledge.debugAgentSession;var Oe=e=>{if(FI(e)||sd(e))return e.generatedAnswer?.answerId;if(DI(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},FI=e=>"answer"in e&&"generatedAnswer"in e&&!ce(e.generatedAnswer?.answerConfigurationId),sd=e=>{let t=Aa(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},DI=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",ad=e=>e.generatedAnswer?.fieldsToIncludeInCitations,Ar=e=>e.followUpAnswers?.conversationId,MI=e=>e.generatedAnswer?.citations,LI=e=>e.followUpAnswers?.followUpAnswers,jI=Be(LI,e=>e?.flatMap(t=>t.citations)),qI=(e,t)=>t,no=Be(MI,jI,qI,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));m();d();f();p();var Mt=()=>({q:"",enableQuerySyntax:!1});m();d();f();p();function cd(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Qt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:cd(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:cd(),extendedResults:{},searchAction:void 0}}m();d();f();p();m();d();f();p();m();d();f();p();var ph=(r=>(r.Ascending="ascending",r.Descending="descending",r))(ph||{}),fh=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(fh||{}),ud=e=>{if(Of(e))return e.map(t=>ud(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""}},mh=()=>({by:"relevancy"});var jV=new xe({values:{by:new Ku({enum:fh,required:!0}),order:new Ku({enum:ph}),field:new re}});function ba(){return ud(mh())}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function UI(){return typeof navigator<"u"}function gh(){try{return typeof localStorage<"u"}catch{return!1}}function hh(){try{return typeof sessionStorage<"u"}catch{return!1}}function yh(){return UI()&&navigator.cookieEnabled}m();d();f();p();var oo=class e{static set(t,r,n){var o,i,s,a;n&&(i=new Date,i.setTime(i.getTime()+n)),a=window.location.hostname,a.indexOf(".")===-1?vh(t,r,i):(s=a.split("."),o=s[s.length-2]+"."+s[s.length-1],vh(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 vh(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function Sh(){return gh()?localStorage:yh()?new wa:hh()?sessionStorage:new ld}var wa=class e{getItem(t){return oo.get(`${e.prefix}${t}`)}removeItem(t){oo.erase(`${e.prefix}${t}`)}setItem(t,r,n){oo.set(`${e.prefix}${t}`,r,n)}};wa.prefix="coveo_";var ld=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var Ca="__coveo.analytics.history",VI=20,BI=1e3*60,GI=75,xa=class{constructor(t){this.store=t||Sh()}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 _this4=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this4.cropQueryElement(_this4.stripEmptyQuery(t));let r=yield _this4.getHistoryWithInternalTimeAsync();r!=null?_this4.isValidEntry(t)&&_this4.setHistory([t].concat(r)):_this4.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this5=this;return _asyncToGenerator(function*(){let t=yield _this5.getHistoryWithInternalTimeAsync();return _this5.stripEmptyQueries(_this5.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(Ca);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this6=this;return _asyncToGenerator(function*(){try{let t=yield _this6.store.getItem(Ca);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(Ca,JSON.stringify(t.slice(0,VI)))}catch{}}clear(){try{this.store.removeItem(Ca)}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,GI)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>BI:!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 tn=class tn extends xa{static getInstance(t){return tn.instance||(tn.instance=new tn(t)),tn.instance}constructor(t){super(t)}};oe(tn,"instance",null);var yt=tn;var bi=class bi extends en{constructor(){super(...arguments);oe(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 od(nd(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||bi.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||Qt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||bi.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=Oe(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??ba()}}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(u=>u.expression),s=o.partialQueries.length-1,a=o.partialQueries[s]||"",c=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(n),partialQuery:a,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:i.length>0?i:"",querySuggestResponseId:c}}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||Mt().q}get responseTime(){return this.state.search?.duration||Qt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Qt().response.totalCountFiltered}};oe(bi,"fallbackPipelineName","default");var br=bi,Ah=({logger:e,getState:t,analyticsClientMiddleware:r=(s,a)=>a,preprocessRequest:n,provider:o,disableBrowserPrivacySignals:i})=>{let s=t(),a=s.configuration.accessToken,c=s.configuration.analytics.apiBaseUrl??ot(s.configuration.organizationId,s.configuration.environment,"analytics"),u=s.configuration.analytics.runtimeEnvironment,g=s.configuration.analytics.enabled,v=new la({token:a,endpoint:c,runtimeEnvironment:u,disableBrowserPrivacySignals:i,preprocessRequest:vi(e,n),beforeSendHooks:[Si(e,r),(w,h)=>(e.info({...h,type:w,endpoint:c,token:a},"Analytics request"),h)]},o);return g||v.disable(),v},dd=()=>{let t=yt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};m();d();f();p();function bh(e){let t=wh(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return bf([e,...t,...r],o=>o.uniqueId)}function wh(e){return e.childResults?e.childResults.flatMap(t=>[t,...wh(t)]):[]}m();d();f();p();var io=()=>"";function xh(e,t){return{...new br(t).getBaseMetadata(),actionCause:e,type:e}}function $I(e){return Object.assign(e,{instantlyCallable:!0})}function QI(e,t){let r=i=>{let s=Ce(e,i);return $I(Object.assign(s,{type:s.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*(i,{getState:s,extra:a}){let{analyticsClientMiddleware:c,preprocessRequest:u,logger:g,disableBrowserPrivacySignals:v}=a;return yield(yield t({getState:s,analyticsClientMiddleware:c,preprocessRequest:u,logger:g,disableBrowserPrivacySignals:v})).log({state:s(),extra:a})});return function(_x42,_x43){return _ref17.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref18=_asyncToGenerator(function*({getState:i,analyticsClientMiddleware:s,preprocessRequest:a,logger:c,disableBrowserPrivacySignals:u}){let{description:g,log:v}=yield t({getState:i,analyticsClientMiddleware:s,preprocessRequest:a,logger:c,disableBrowserPrivacySignals:u});return{description:g,action:r(/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(w,{getState:h,extra:y}){return yield v({state:h(),extra:y})});return function(_x45,_x46){return _ref19.apply(this,arguments)}}())}});return function prepare(_x44){return _ref18.apply(this,arguments)}}()}),n}var Eh=(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},HI=e=>e.configuration.analytics.analyticsMode==="legacy",zI=e=>e.configuration.analytics.analyticsMode==="next",WI=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:s})=>(r??(r=a=>new s(a)),QI(e,/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*({getState:a,analyticsClientMiddleware:c,preprocessRequest:u,logger:g,disableBrowserPrivacySignals:v}){let w=[],h={log:function(){var _ref21=_asyncToGenerator(function*({state:_}){for(let R of w)yield R(_)});return function log(_x48){return _ref21.apply(this,arguments)}}()},y=a(),S=i({getState:a,logger:g,analyticsClientMiddleware:c,preprocessRequest:u,disableBrowserPrivacySignals:v,provider:r(a)}),x=yield t(S,a());h.description=x?.description,w.push(/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(_){HI(_)&&(yield KI(x,r,_,g,S.coveoAnalyticsClient))});return function(_x49){return _ref22.apply(this,arguments)}}());let{emit:I}=ci(y);return w.push(/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(_){if(zI(_)&&o&&n){let R=n(_);yield nR(I,o,R)}});return function(_x50){return _ref23.apply(this,arguments)}}()),h});return function(_x47){return _ref20.apply(this,arguments)}}()));function KI(_x51,_x52,_x53,_x54,_x55){return _KI.apply(this,arguments)}function _KI(){_KI=_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 _KI.apply(this,arguments)}var YI=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref24=_asyncToGenerator(function*(i){r(n,o)});return function log(_x56){return _ref24.apply(this,arguments)}}()}),Re=Eh(e=>Ah({...e,provider:e.provider||new br(e.getState)}),e=>e,br),vt=Eh(rh,YI("caseAssist"),Ai);var pd=(e,t)=>{let r=i=>i+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=Ph(e,o),n<0&&(n=rR(e,o)),n<0&&(n=0),XI(e,r(n),t)};var Ih=(e,t)=>({sourceName:Th(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||io()}),Rh=(e,t)=>({sourceName:Th(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||io()});function Th(e){let t=e.source;return ce(t)?"unknown":t}var kh=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function XI(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:eR(e),...(Ch(e)?{documentCategory:Ch(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:tR(e),queryPipeline:r.pipeline||io()}}function Ch(e){return e.raw?.objecttype||void 0}var fd=e=>(e.raw.permanentid||console.warn("Missing field permanentid on result. This might cause many issues with your Coveo deployment. See https://docs.coveo.com/en/1913 and https://docs.coveo.com/en/1640 for more information.",e),{contentIDKey:"permanentid",contentIDValue:e.raw.permanentid||""}),_h={urihash:new re,sourcetype:new re,permanentid:new re},Oh={uniqueId:ee,raw:new xe({values:_h}),title:ee,uri:ee,clickUri:ee,rankingModifier:new re({required:!1,emptyAllowed:!0})};function ZI(e){return Object.assign({},...Object.keys(_h).map(t=>({[t]:e[t]})))}function JI(e){return Object.assign({},...Object.keys(Oh).map(t=>({[t]:e[t]})),{raw:ZI(e.raw)})}function eR(e){let t=e.raw.author;return ce(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function tR(e){let t=e.raw.source;return ce(t)?"unknown":t}var md=e=>new Nt(Oh).validate(JI(e));function rR(e,t){for(let[r,n]of t.entries()){let o=bh(n);if(Ph(e,o)!==-1)return r}return-1}function Ph(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function nR(_x57,_x58,_x59){return _nR.apply(this,arguments)}function _nR(){_nR=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _nR.apply(this,arguments)}m();d();f();p();var Ea=e=>{if(e==="yes")return!0;if(e==="no")return!1},oR=()=>Re("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function iR(e,t){return Re({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??Oe(n),i=no(n,e);if(!o||!i)return null;let s=Ar(n);return r.makeGeneratedAnswerCitationClick(Ih(i,n),{generativeQuestionAnsweringId:o,citationId:i.id,documentId:kh(i),...(s&&{conversationId:s})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=no(r,e);return{answerId:t??Oe(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function sR(e,t,r){return Re({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let i=r??Oe(o),s=no(o,e);if(!i||!s)return null;let a=Ar(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:i,permanentId:s.permanentid,citationId:s.id,citationHoverTimeMs:t,...(a&&{conversationId:a})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=no(n,e);return{answerId:r??Oe(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function aR(e,t){return Re({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function cR(e){return Re({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??Oe(r);if(!n)return null;let o=Ar(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Oe(t)??"",action:"like"})})}function uR(e){return Re({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??Oe(r);if(!n)return null;let o=Ar(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Oe(t)??"",action:"dislike"})})}var lR=e=>Re({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Oe(r);return n?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Oe(t),{helpful:n,readable:o,documented:i,hallucinationFree:s,correctTopic:a,documentUrl:c,details:u}=e;return{answerId:r??"",helpful:n,details:{readable:Ea(o),documented:Ea(i),correctTopic:Ea(a),hallucinationFree:Ea(s)},additionalNotes:u,correctAnswerUrl:c}}}),gd=(e,t,r)=>Re({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let i=t??Oe(o);if(!i)return null;let s=Ar(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:r,...(s&&{conversationId:s})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Oe(n)??"",answerGenerated:e??!1})}),so=e=>Re({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Oe(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),dR=()=>Re({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Oe(t);return r?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Oe(e)??"",action:"show"})}),pR=()=>Re({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Oe(t);return r?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Oe(e)??"",action:"hide"})}),fR=()=>Re({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Oe(t);return r?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Oe(e)??"",action:"expand"})}),mR=()=>Re({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Oe(t);return r?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Oe(e)??"",action:"collapse"})});function gR(e){return Re({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??Oe(r);if(!n)return null;let o=Ar(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Oe(t)??"",action:"copyToClipboard"})})}function hR(e,t){return Re({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=no(n,e);if(!o)return null;let i=Ar(n);return i?r.makeGeneratedAnswerFollowupOpenSource({...Rh(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:i}):null}})}var Ia={logCopyGeneratedAnswer:gR,logGeneratedAnswerHideAnswers:pR,logGeneratedAnswerShowAnswers:dR,logGeneratedAnswerStreamEnd:gd,logGeneratedAnswerFeedback:lR,logDislikeGeneratedAnswer:uR,logLikeGeneratedAnswer:cR,logGeneratedAnswerOpenInlineLink:aR,logHoverCitation:sR,logOpenGeneratedAnswerSource:iR,logOpenGeneratedAnswerFollowUpSource:hR,logRetryGeneratedAnswer:oR,logGeneratedAnswerExpand:fR,logGeneratedAnswerCollapse:mR};m();d();f();p();m();d();f();p();var Nh=Be(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 rn=(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:Kn(e)}});m();d();f();p();var hd=e=>e.context;m();d();f();p();var yd=e=>e.pipeline;m();d();f();p();m();d();f();p();var Ci=Pt(Ra(),1),qh=Pt(Fh(),1);m();d();f();p();var Mh=Pt(Ra(),1),Lh=Pt(Dh(),1);Mh.default.extend(Lh.default);var yR="YYYY/MM/DD@HH:mm:ss";function jh(e){return e.format(yR)}Ci.default.extend(qh.default);var vR=["past","now","next"],SR=["minute","hour","day","week","month","quarter","year"];function AR(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Ci.default)().subtract(r,n);case"next":return(0,Ci.default)().add(r,n);case"now":return(0,Ci.default)()}}function xd(e){return jh(AR(bR(e)))}function Uh(e){return e.toLocaleLowerCase().split("-")}function Ed(e){let[t,r,n]=Uh(e);if(t==="now")return!0;if(!vR.includes(t)||!SR.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function bR(e){let[t,r,n]=Uh(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function Vh(e){return e.type==="dateRange"}function Bh(e){return`start${e}`}function Gh(e){return`end${e}`}var Id=()=>({dateFacetValueMap:{}});function wR(e,t,r){let n=e.start,o=e.end;return Ed(n)&&(n=xd(n),r.dateFacetValueMap[t][Bh(n)]=e.start),Ed(o)&&(o=xd(o),r.dateFacetValueMap[t][Gh(o)]=e.end),{...e,start:n,end:o}}function Rd(e,t){if(Vh(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>wR(o,r,t))}}return e}function wr(e){let t=Id();return{request:{...e,facets:e.facets?.map(n=>Rd(n,t))},mappings:t}}function CR(e,t,r){return{...e,start:r.dateFacetValueMap[t][Bh(e.start)]||e.start,end:r.dateFacetValueMap[t][Gh(e.end)]||e.end}}function xR(e,t){return e.facetId in t.dateFacetValueMap}function ER(e,t){return xR(e,t)?{...e,values:e.values.map(r=>CR(r,e.facetId,t))}:e}function Ta(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>ER(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function Cr(e){return Object.values(e).map(t=>t.request)}function Td(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 $h(e){return Cr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var kd={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function IR(e){return Cr(e).map(t=>{let r=kd[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function RR(e){return[...IR(e.facetSet??{}),...$h(e.numericFacetSet??{}),...$h(e.dateFacetSet??{}),...Cr(e.categoryFacetSet??{})]}function TR(e){return RR(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function ka(e){return Td(TR(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();m();d();f();p();var Qh=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield ro(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}),...(dd()&&{pageId:dd()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:Kn(e)})}}});return function Qh(_x60,_x61){return _ref25.apply(this,arguments)}}();var ao=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Mn(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:yt.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 Qh(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 ao(_x62,_x63){return _ref26.apply(this,arguments)}}();m();d();f();p();var _a=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Mn(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&&rn(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 Hh=Be(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 xr=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t,r){let n=Od(e),o=kR(e),i=_R(e),s=e.configuration.analytics.analyticsMode==="legacy"?yield ao(e,r):_a(e,t,r);return wr({...s,...(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:_d(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 xr(_x64,_x65,_x66){return _ref27.apply(this,arguments)}}();function _d(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function kR(e){return Td(PR(e),e.facetOrder??[])}function _R(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(OR).filter(r=>r.currentValues.length>0):void 0}function OR(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function PR(e){return NR(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function NR(e){return[...FR(e.facetSet??{}),...zh(e.numericFacetSet??{}),...zh(e.dateFacetSet??{}),...Cr(e.categoryFacetSet??{})]}function FR(e){return Cr(e).map(t=>{let r=kd[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function zh(e){return Cr(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 Od(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=Hh(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();f();p();m();d();f();p();var Ei=(e,t)=>{let r=e;return ce(r[t])?ce(e.raw[t])?null:e.raw[t]:r[t]},DR=e=>t=>e.every(r=>!ce(Ei(t,r))),MR=e=>t=>e.every(r=>ce(Ei(t,r))),LR=(e,t)=>r=>{let n=Wh(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},jR=(e,t)=>r=>{let n=Wh(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},Wh=(e,t)=>{let r=Ei(t,e);return Af(r)?r:[r]},Kh={getResultProperty:Ei,fieldsMustBeDefined:DR,fieldsMustNotBeDefined:MR,fieldMustMatch:LR,fieldMustNotMatch:jR};var Pd=Be(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var Nd=e=>e.searchHub;m();d();f();p();var Oa=Be(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),o$=Be(e=>e,e=>{let t=Oa(e);return t&&e?e[t].expression:""});m();d();f();p();var Yh=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var Xh=e=>e.excerptLength?.length;m();d();f();p();var Zh=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var Jh=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 ey=e=>e.sortCriteria;var ty=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Dn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function ty(_x67){return _ref28.apply(this,arguments)}}(),ry=(e,t)=>{let r=Zr(e)?.q,{aq:n,cq:o,dq:i,lq:s}=iy(e),a=hd(e),c=rn(e.configuration.analytics,t,{actionCause:Pd(e)}),u=Nd(e),g=yd(e),v=ad(e)??[],w=oy(e),h=Oa(e.tabSet)||"default",y=id(e),S=ah(e),x=t.referrer||"",I=Zh(e),_=ey(e),R=qR(e),T=Xh(e),k=Jh(e),F=Yh(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(s&&{lq:s}),...(e.query&&{enableQuerySyntax:Fg(e)}),...(a?.contextValues&&{context:a.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(u?.length&&{searchHub:u}),...(g?.length&&{pipeline:g}),...(w.length&&{facets:w}),...(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:_d(e),firstResult:e.pagination.firstResult}),tab:h,locale:y,timezone:S,...(e.debug!==void 0&&{debug:e.debug}),referrer:x,...R,...(k??{}),...(T&&{excerptLength:T}),...(F&&{dictionaryFieldContext:F}),sortCriteria:_,...(I&&{facetOptions:I}),...c,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},ny=(e,t)=>{let r=Zr(e)?.q,n=oy(e),o=rn(e.configuration.analytics,t,{actionCause:Pd(e)}),i=id(e),s=Oa(e.tabSet)||"default",a=t.referrer,{aq:c,cq:u}=iy(e),g=Nd(e),v=yd(e),w=hd(e),h=ad(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(v?.length&&{pipeline:v}),...(w?.contextValues&&{context:w.contextValues}),...(c&&{aq:c}),...(u&&{cq:u}),tab:s,referrer:a,...o,locale:i}},oy=e=>ka(e)?.map(t=>Rd(t,Id())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),qR=e=>({actionsHistory:e.configuration.analytics.enabled?yt.getInstance().getHistory():[]}),iy=e=>{let t=Nh(e),r=Od(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var Pa=["searching","thinking","answering"];function Na(e){return e.toLowerCase()}var Fa=["search","generic"];m();d();f();p();var sy=["text/plain","text/markdown"];var co=new re({required:!0}),ay=new re,uo=new je({required:!0}),Fd={id:co,title:co,uri:co,permanentid:co,clickUri:ay},Da=new re({required:!0,constrainTo:sy}),cy=new re({required:!0,constrainTo:Pa}),uy=e=>({...e,name:Na(e.name)}),xQ=B("generatedAnswer/setIsVisible",e=>W(e,uo)),Ma=B("generatedAnswer/setAnswerId",e=>W(e,ee)),EQ=B("generatedAnswer/setAnswerGenerationMode",e=>W(e,new re({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),IQ=B("generatedAnswer/setIsEnabled",e=>W(e,uo)),Ri=B("generatedAnswer/updateMessage",e=>W(e,{textDelta:co})),Ti=B("generatedAnswer/updateCitations",e=>W(e,{citations:new Ft({required:!0,each:new xe({values:Fd})})})),ki=B("generatedAnswer/updateError",e=>W(e,{message:ay,code:new Le({min:0})})),La=B("generatedAnswer/resetAnswer"),RQ=B("generatedAnswer/like"),TQ=B("generatedAnswer/dislike"),kQ=B("generatedAnswer/feedbackModal/open"),_Q=B("generatedAnswer/expand"),OQ=B("generatedAnswer/collapse"),PQ=B("generatedAnswer/setId",e=>W(e,{id:new re({required:!0})})),NQ=B("generatedAnswer/feedbackModal/close"),FQ=B("generatedAnswer/sendFeedback"),Er=B("generatedAnswer/setIsLoading",e=>W(e,uo)),Ii=B("generatedAnswer/setIsStreaming",e=>W(e,uo)),_i=B("generatedAnswer/setAnswerContentFormat",e=>W(e,Da)),DQ=B("generatedAnswer/updateResponseFormat",e=>W(e,{contentFormat:new Ft({each:Da,default:["text/plain"]})})),MQ=B("knowledge/updateAnswerConfigurationId",e=>W(e,co)),LQ=B("generatedAnswer/registerFieldsToIncludeInCitations",e=>W(e,km)),Dd=B("generatedAnswer/setIsAnswerGenerated",e=>W(e,uo)),Oi=B("generatedAnswer/setCannotAnswer",e=>W(e,uo)),UR=B("generatedAnswer/setAnswerApiQueryParams",e=>W(e,new xe({}))),ly=B("generatedAnswer/startStep",e=>W(uy(e),{name:cy,startedAt:new Le({min:0,required:!0})})),dy=B("generatedAnswer/finishStep",e=>W(uy(e),{name:cy,finishedAt:new Le({min:0,required:!0})})),py=B("generatedAnswer/startToolCall",e=>W(e,{toolCallName:ee,startedAt:new Le({min:0,required:!0}),toolCallId:ee})),fy=B("generatedAnswer/finishToolCall",e=>W(e,{finishedAt:new Le({min:0,required:!0}),toolCallId:ee})),ja=B("generatedAnswer/toolCallArgs",e=>W(e,{toolCallId:ee,args:new xe({options:{required:!0}}),type:new re({required:!0,constrainTo:Fa})})),jQ=Ce("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:i}=t,{generatedAnswerAnalyticsClient:s}=o,{search:a}=i(),{queryExecuted:c}=a,{setAbortControllerRef:u}=e,g=yield ty(r),v=(y,S)=>{switch(y){case"genqa.headerMessageType":{let x=JSON.parse(S);n(_i(x.contentFormat));break}case"genqa.messageType":n(Ri(JSON.parse(S)));break;case"genqa.citationsType":n(Ti(JSON.parse(S)));break;case"genqa.endOfStreamType":{let x=JSON.parse(S).answerGenerated,{answerId:I,answer:_}=i().generatedAnswer,T=c.length!==0&&!x,k=!_?.trim();n(Oi(T)),n(Ii(!1)),n(Dd(x)),n((s??Ia).logGeneratedAnswerStreamEnd(x,I,x?k:void 0)),n(so());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${y}"`)}};n(Er(!0));let w=y=>y.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:y=>{w(g)&&(n(Er(!1)),y.payload&&y.payloadType&&v(y.payloadType,y.payload))},abort:y=>{w(g)&&n(ki(y))},close:()=>{w(g)&&n(Ii(!1))},resetAnswer:()=>{w(g)&&n(La())}});h?u(h):n(Er(!1))});return function(_x68,_x69){return _ref29.apply(this,arguments)}}()),qQ=Ce("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(La());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 s=ry(i,n);r(UR(s)),yield r(my(s))}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(_x70,_x71){return _ref30.apply(this,arguments)}}());m();d();f();p();m();d();f();p();function hy(_x72,_x73){return _hy.apply(this,arguments)}function _hy(){_hy=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _hy.apply(this,arguments)}function yy(e){let t,r,n,o=!1;return function(s){t===void 0?(t=s,r=0,n=-1):t=BR(t,s);let a=t.length,c=0;for(;r<a;){o&&(t[r]===10&&(c=++r),o=!1);let u=-1;for(;r<a&&u===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-c);break;case 13:o=!0,u=r;break;case 10:u=r;break}if(u===-1)break;e(t.subarray(c,u),n),c=r,n=-1}c===a?t=void 0:c!==0&&(t=t.subarray(c),r-=c)}}function vy(e,t,r){let n=gy(),o=new TextDecoder;return function(s,a){if(s.length===0)r?.(n),n=gy();else if(a>0){let c=o.decode(s.subarray(0,a)),u=a+(s[a+1]===32?2:1),g=o.decode(s.subarray(u));switch(c){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":VR(g,n,t);break}}}}function VR(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function BR(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function gy(){return{data:"",event:"",id:"",retry:void 0}}var Md="text/event-stream",GR=1e3,Sy="last-event-id";function Ay(){return typeof window<"u"}function by(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:s,openWhenHidden:a,fetch:c,...u}){return new Promise((g,v)=>{let w={...r};w.accept||(w.accept=Md);let h;function y(){h?.abort(),document.hidden||T()}!a&&Ay()&&document.addEventListener("visibilitychange",y);let S=GR,x;function I(){Ay()&&document.removeEventListener("visibilitychange",y),clearTimeout(x),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let _=c??C,R=n??$R;function T(){return _T2.apply(this,arguments)}function _T2(){_T2=_asyncToGenerator(function*(){h=l.AbortController?new l.AbortController:null;try{let k=yield _(e,{...u,headers:w,signal:h?.signal});yield R(k),yield hy(k.body,yy(vy(F=>{F?w[Sy]=F:delete w[Sy]},F=>{S=F},o))),i?.(),I(),g()}catch(k){if(!h?.signal?.aborted)try{let F=s?.(k)??S;clearTimeout(x),x=setTimeout(T,F)}catch(F){I(),v(F)}}});return _T2.apply(this,arguments)}T()})}function $R(e){let t=e.headers.get("content-type");if(!t?.startsWith(Md))throw new Error(`Expected content-type to be ${Md}, Actual: ${t}`)}m();d();f();p();var QR=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:i,organizationId:s}=n.configuration,a=n.generatedAnswer.answerConfigurationId,c={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let u=Dn(n.configuration.search?.apiBaseUrl,s,i);return Ag({baseUrl:`${u}/rest/organizations/${s}/answer/v1/configs/${a}`,fetchFn:function(){var _ref32=_asyncToGenerator(function*(g){if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let v=g.url,w={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{w[h]=g[h]}),w.duplex="half",w.body=yield g.text(),C(v,w)});return function fetchFn(_x77){return _ref32.apply(this,arguments)}}()})(c,{...t,signal:null},r)}catch(u){return{error:u}}});return function QR(_x74,_x75,_x76){return _ref31.apply(this,arguments)}}(),wy=Ng({reducerPath:"answer",baseQuery:wg(QR,{maxRetries:3}),endpoints:()=>({})});var HR=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},zR=(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)},WR=(e,t)=>{delete e.error,e.citations=t.citations},KR=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},YR=(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})`)},XR=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&YR(t,o);let i=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":i.contentFormat&&(HR(t,i),r(_i(i.contentFormat)));break;case"genqa.messageType":typeof i.textDelta=="string"&&(zR(t,i),r(Ri({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(WR(t,i),r(Ti({citations:i.citations})));break;case"genqa.endOfStreamType":{KR(t,i);let s=t.answerId,a=i.answerGenerated??!1,c=a?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(a,s,c)),r(so());break}}},ZR=(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`},Ld=wy.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(_x78,_x79){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:i,extra:s}){yield n;let{configuration:a,generatedAnswer:c,insightConfiguration:u}=r(),{generatedAnswerAnalyticsClient:g}=s,{organizationId:v,environment:w,accessToken:h}=a,y=Dn(a.search.apiBaseUrl,v,w),S=ZR(y,v,c.answerConfigurationId,u?.insightId);yield by(S,{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 _ref33=_asyncToGenerator(function*(x){let I=x.headers.get("x-answer-id");I&&o(_=>{_.answerId=I,i(Ma(I))})});return function onopen(_x80){return _ref33.apply(this,arguments)}}(),onmessage:x=>{o(I=>{XR(x,I,i,g??Ia)})},onerror:x=>{throw x},onclose:()=>{o(x=>{i(Oi(!x.generated))})}})}).apply(this,arguments)}})})}),my=e=>Ld.endpoints.getAnswer.initiate(e);m();d();f();p();var Cy=Qe(Hn,e=>e);m();d();f();p();function JR(e){let t=e.payload?.analyticsAction;return xy(e)&&!ce(t)}function xy(e){return"type"in e}var Ey=e=>t=>r=>{let n;JR(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return xy(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 MH=B("tab/register",e=>{let t=new xe({values:{id:ee,expression:Dt}});return W(e,t)}),Iy=B("tab/updateActiveTab",e=>W(e,ee));m();d();f();p();var qa=Pt(Ra(),1),ky=Pt(Ry(),1),_y=Pt(Ty(),1);qa.default.extend(_y.default);qa.default.extend(ky.default);var Oy=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:qa.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 eT=/(^|; )Coveo-Pendragon=([^;]*)/,tT=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function Py(){return typeof window>"u"?!1:eT.exec(document.cookie)?.pop()||null}function Ny(){return typeof window>"u"?!1:tT.test(document.cookie)}var Fy=Qe(Oy(),e=>e.addCase(zn,(t,r)=>{rT(t,r.payload)}).addCase(Bs,(t,r)=>{nT(t,r.payload)}).addCase(Gs,(t,r)=>{oT(t,r.payload)}).addCase($s,t=>{t.analytics.enabled=!1}).addCase(Qs,t=>{t.analytics.enabled=!0}).addCase(Um,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(Vm,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(Iy,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Fm,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(qs,(t,r)=>{ce(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Bm,(t,{payload:r})=>{iT(t,r)}));function rT(e,t){ce(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ce(t.organizationId)||(e.organizationId=t.organizationId)}function nT(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 oT(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=Py();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 iT(e,t){e.knowledge.agentId=t;try{Ny()&&(e.knowledge.debugAgentSession=!0)}catch{}}var St=Fy;m();d();f();p();function sT(e){return e.instantlyCallable}var Dy=()=>e=>t=>e(sT(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 tt=[];for(let e=0;e<256;++e)tt.push((e+256).toString(16).slice(1));function My(e,t=0){return(tt[e[t+0]]+tt[e[t+1]]+tt[e[t+2]]+tt[e[t+3]]+"-"+tt[e[t+4]]+tt[e[t+5]]+"-"+tt[e[t+6]]+tt[e[t+7]]+"-"+tt[e[t+8]]+tt[e[t+9]]+"-"+tt[e[t+10]]+tt[e[t+11]]+tt[e[t+12]]+tt[e[t+13]]+tt[e[t+14]]+tt[e[t+15]]).toLowerCase()}m();d();f();p();var Bd,aT=new Uint8Array(16);function Gd(){if(!Bd){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Bd=crypto.getRandomValues.bind(crypto)}return Bd(aT)}m();d();f();p();m();d();f();p();var cT=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),$d={randomUUID:cT};function uT(e,t,r){if($d.randomUUID&&!t&&!e)return $d.randomUUID();e=e||{};let n=e.random??e.rng?.()??Gd();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 My(n)}var Ir=uT;m();d();f();p();m();d();f();p();var A={};Xi(A,{BRAND:()=>DT,DIRTY:()=>nn,EMPTY_PATH:()=>fT,INVALID:()=>ue,NEVER:()=>Sk,OK:()=>at,ParseStatus:()=>rt,Schema:()=>ye,ZodAny:()=>kr,ZodArray:()=>fr,ZodBigInt:()=>sn,ZodBoolean:()=>an,ZodBranded:()=>Ni,ZodCatch:()=>vn,ZodDate:()=>cn,ZodDefault:()=>yn,ZodDiscriminatedUnion:()=>Ba,ZodEffects:()=>Rt,ZodEnum:()=>gn,ZodError:()=>lt,ZodFirstPartyTypeKind:()=>le,ZodFunction:()=>$a,ZodIntersection:()=>pn,ZodIssueCode:()=>z,ZodLazy:()=>fn,ZodLiteral:()=>mn,ZodMap:()=>ho,ZodNaN:()=>vo,ZodNativeEnum:()=>hn,ZodNever:()=>Lt,ZodNull:()=>ln,ZodNullable:()=>Wt,ZodNumber:()=>on,ZodObject:()=>dt,ZodOptional:()=>Et,ZodParsedType:()=>te,ZodPipeline:()=>Fi,ZodPromise:()=>_r,ZodReadonly:()=>Sn,ZodRecord:()=>Ga,ZodSchema:()=>ye,ZodSet:()=>yo,ZodString:()=>Tr,ZodSymbol:()=>mo,ZodTransformer:()=>Rt,ZodTuple:()=>zt,ZodType:()=>ye,ZodUndefined:()=>un,ZodUnion:()=>dn,ZodUnknown:()=>pr,ZodVoid:()=>go,addIssueToContext:()=>Z,any:()=>$T,array:()=>WT,bigint:()=>qT,boolean:()=>zy,coerce:()=>vk,custom:()=>$y,date:()=>UT,datetimeRegex:()=>By,defaultErrorMap:()=>lr,discriminatedUnion:()=>ZT,effect:()=>lk,enum:()=>ak,function:()=>ok,getErrorMap:()=>lo,getParsedType:()=>Ht,instanceof:()=>LT,intersection:()=>JT,isAborted:()=>Ua,isAsync:()=>po,isDirty:()=>Va,isValid:()=>Rr,late:()=>MT,lazy:()=>ik,literal:()=>sk,makeIssue:()=>Pi,map:()=>rk,nan:()=>jT,nativeEnum:()=>ck,never:()=>HT,null:()=>GT,nullable:()=>pk,number:()=>Hy,object:()=>KT,objectUtil:()=>Qd,oboolean:()=>yk,onumber:()=>hk,optional:()=>dk,ostring:()=>gk,pipeline:()=>mk,preprocess:()=>fk,promise:()=>uk,quotelessJson:()=>lT,record:()=>tk,set:()=>nk,setErrorMap:()=>pT,strictObject:()=>YT,string:()=>Qy,symbol:()=>VT,transformer:()=>lk,tuple:()=>ek,undefined:()=>BT,union:()=>XT,unknown:()=>QT,util:()=>Ae,void:()=>zT});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Ae;(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 s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},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 s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},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(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ae||(Ae={}));var Qd;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Qd||(Qd={}));var te=Ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ht=e=>{switch(typeof e){case"undefined":return te.undefined;case"string":return te.string;case"number":return Number.isNaN(e)?te.nan:te.number;case"boolean":return te.boolean;case"function":return te.function;case"bigint":return te.bigint;case"symbol":return te.symbol;case"object":return Array.isArray(e)?te.array:e===null?te.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?te.promise:typeof Map<"u"&&e instanceof Map?te.map:typeof Set<"u"&&e instanceof Set?te.set:typeof Date<"u"&&e instanceof Date?te.date:te.object;default:return te.unknown}};var z=Ae.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"]),lT=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),lt=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 s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};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,Ae.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()}};lt.create=e=>new lt(e);var dT=(e,t)=>{let r;switch(e.code){case z.invalid_type:e.received===te.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ae.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ae.joinValues(e.keys,", ")}`;break;case z.invalid_union:r="Invalid input";break;case z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ae.joinValues(e.options)}`;break;case z.invalid_enum_value:r=`Invalid enum value. Expected ${Ae.joinValues(e.options)}, received '${e.received}'`;break;case z.invalid_arguments:r="Invalid function arguments";break;case z.invalid_return_type:r="Invalid function return type";break;case z.invalid_date:r="Invalid date";break;case z.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}"`:Ae.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case z.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 z.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 z.custom:r="Invalid input";break;case z.invalid_intersection_types:r="Intersection results could not be merged";break;case z.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case z.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ae.assertNever(e)}return{message:r}},lr=dT;var Ly=lr;function pT(e){Ly=e}function lo(){return Ly}m();d();f();p();var Pi=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...(o.path||[])],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},fT=[];function Z(e,t){let r=lo(),n=Pi({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===lr?void 0:lr].filter(o=>!!o)});e.common.issues.push(n)}var rt=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 ue;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,s=yield o.value;n.push({key:i,value:s})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return ue;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},ue=Object.freeze({status:"aborted"}),nn=e=>({status:"dirty",value:e}),at=e=>({status:"valid",value:e}),Ua=e=>e.status==="aborted",Va=e=>e.status==="dirty",Rr=e=>e.status==="valid",po=e=>typeof Promise<"u"&&e instanceof Promise;m();d();f();p();m();d();f();p();var ne;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ne||(ne={}));var It=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}},jy=(e,t)=>{if(Rr(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 lt(e.common.issues);return this._error=r,this._error}}};function me(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:(s,a)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}var ye=class{get description(){return this._def.description}_getType(t){return Ht(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Ht(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new rt,ctx:{common:t.parent.common,data:t.data,parsedType:Ht(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(po(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:Ht(t)},o=this._parseSync({data:t,path:n.path,parent:n});return jy(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ht(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Rr(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=>Rr(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this7=this;return _asyncToGenerator(function*(){let n=yield _this7.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this8=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this8._def.errorMap,parent:null,data:t,parsedType:Ht(t)},o=_this8._parse({data:t,path:n.path,parent:n}),i=yield po(o)?o:Promise.resolve(o);return jy(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 s=t(o),a=()=>i.addIssue({code:z.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!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 Rt({schema:this,typeName:le.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 Et.create(this,this._def)}nullable(){return Wt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fr.create(this)}promise(){return _r.create(this,this._def)}or(t){return dn.create([this,t],this._def)}and(t){return pn.create(this,t,this._def)}transform(t){return new Rt({...me(this._def),schema:this,typeName:le.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new yn({...me(this._def),innerType:this,defaultValue:r,typeName:le.ZodDefault})}brand(){return new Ni({typeName:le.ZodBranded,type:this,...me(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new vn({...me(this._def),innerType:this,catchValue:r,typeName:le.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Fi.create(this,t)}readonly(){return Sn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},mT=/^c[^\s-]{8,}$/i,gT=/^[0-9a-z]+$/,hT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yT=/^[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,vT=/^[a-z0-9_-]{21}$/i,ST=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,AT=/^[-+]?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)?)??$/,bT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Hd,CT=/^(?:(?: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])$/,xT=/^(?:(?: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])$/,ET=/^(([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]))$/,IT=/^(([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])$/,RT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,TT=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Uy="((\\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])))",kT=new RegExp(`^${Uy}$`);function Vy(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 _T(e){return new RegExp(`^${Vy(e)}$`)}function By(e){let t=`${Uy}T${Vy(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 OT(e,t){return!!((t==="v4"||!t)&&CT.test(e)||(t==="v6"||!t)&&ET.test(e))}function PT(e,t){if(!ST.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 NT(e,t){return!!((t==="v4"||!t)&&xT.test(e)||(t==="v6"||!t)&&IT.test(e))}var Tr=class e extends ye{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==te.string){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_type,expected:te.string,received:i.parsedType}),ue}let n=new rt,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:z.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),Z(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?Z(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&Z(o,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")bT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"email",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Hd||(Hd=new RegExp(wT,"u")),Hd.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"emoji",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")yT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"uuid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")vT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"nanoid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")mT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cuid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")gT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cuid2",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")hT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"ulid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),Z(o,{validation:"url",code:z.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),Z(o,{validation:"regex",code:z.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),Z(o,{code:z.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),Z(o,{code:z.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?By(i).test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?kT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?_T(i).test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?AT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"duration",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?OT(t.data,i.version)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"ip",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?PT(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"jwt",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?NT(t.data,i.version)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cidr",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?RT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"base64",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?TT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"base64url",code:z.invalid_string,message:i.message}),n.dirty()):Ae.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:z.invalid_string,...ne.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ne.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ne.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ne.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ne.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ne.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ne.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ne.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ne.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ne.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ne.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ne.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ne.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ne.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,...ne.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,...ne.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ne.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ne.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ne.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ne.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ne.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ne.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ne.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ne.errToObj(r)})}nonempty(t){return this.min(1,ne.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}};Tr.create=e=>new Tr({checks:[],typeName:le.ZodString,coerce:e?.coerce??!1,...me(e)});function FT(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(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var on=class e extends ye{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==te.number){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_type,expected:te.number,received:i.parsedType}),ue}let n,o=new rt;for(let i of this._def.checks)i.kind==="int"?Ae.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),Z(n,{code:z.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),Z(n,{code:z.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),Z(n,{code:z.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?FT(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),Z(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),Z(n,{code:z.not_finite,message:i.message}),o.dirty()):Ae.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ne.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ne.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ne.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ne.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ne.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ne.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ne.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ne.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ne.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ne.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ne.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ne.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ne.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ne.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"&&Ae.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)}};on.create=e=>new on({checks:[],typeName:le.ZodNumber,coerce:e?.coerce||!1,...me(e)});var sn=class e extends ye{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==te.bigint)return this._getInvalidInput(t);let n,o=new rt;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),Z(n,{code:z.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),Z(n,{code:z.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),Z(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ae.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Z(r,{code:z.invalid_type,expected:te.bigint,received:r.parsedType}),ue}gte(t,r){return this.setLimit("min",t,!0,ne.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ne.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ne.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ne.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ne.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:ne.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ne.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ne.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ne.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ne.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}};sn.create=e=>new sn({checks:[],typeName:le.ZodBigInt,coerce:e?.coerce??!1,...me(e)});var an=class extends ye{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==te.boolean){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.boolean,received:n.parsedType}),ue}return at(t.data)}};an.create=e=>new an({typeName:le.ZodBoolean,coerce:e?.coerce||!1,...me(e)});var cn=class e extends ye{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==te.date){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_type,expected:te.date,received:i.parsedType}),ue}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_date}),ue}let n=new rt,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:z.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),Z(o,{code:z.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Ae.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:ne.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ne.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}};cn.create=e=>new cn({checks:[],coerce:e?.coerce||!1,typeName:le.ZodDate,...me(e)});var mo=class extends ye{_parse(t){if(this._getType(t)!==te.symbol){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.symbol,received:n.parsedType}),ue}return at(t.data)}};mo.create=e=>new mo({typeName:le.ZodSymbol,...me(e)});var un=class extends ye{_parse(t){if(this._getType(t)!==te.undefined){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.undefined,received:n.parsedType}),ue}return at(t.data)}};un.create=e=>new un({typeName:le.ZodUndefined,...me(e)});var ln=class extends ye{_parse(t){if(this._getType(t)!==te.null){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.null,received:n.parsedType}),ue}return at(t.data)}};ln.create=e=>new ln({typeName:le.ZodNull,...me(e)});var kr=class extends ye{constructor(){super(...arguments),this._any=!0}_parse(t){return at(t.data)}};kr.create=e=>new kr({typeName:le.ZodAny,...me(e)});var pr=class extends ye{constructor(){super(...arguments),this._unknown=!0}_parse(t){return at(t.data)}};pr.create=e=>new pr({typeName:le.ZodUnknown,...me(e)});var Lt=class extends ye{_parse(t){let r=this._getOrReturnCtx(t);return Z(r,{code:z.invalid_type,expected:te.never,received:r.parsedType}),ue}};Lt.create=e=>new Lt({typeName:le.ZodNever,...me(e)});var go=class extends ye{_parse(t){if(this._getType(t)!==te.undefined){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.void,received:n.parsedType}),ue}return at(t.data)}};go.create=e=>new go({typeName:le.ZodVoid,...me(e)});var fr=class e extends ye{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==te.array)return Z(r,{code:z.invalid_type,expected:te.array,received:r.parsedType}),ue;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&(Z(r,{code:s?z.too_big:z.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?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&&(Z(r,{code:z.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&&(Z(r,{code:z.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((s,a)=>o.type._parseAsync(new It(r,s,r.path,a)))).then(s=>rt.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new It(r,s,r.path,a)));return rt.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:ne.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ne.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ne.toString(r)}})}nonempty(t){return this.min(1,t)}};fr.create=(e,t)=>new fr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:le.ZodArray,...me(t)});function fo(e){if(e instanceof dt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Et.create(fo(n))}return new dt({...e._def,shape:()=>t})}else return e instanceof fr?new fr({...e._def,type:fo(e.element)}):e instanceof Et?Et.create(fo(e.unwrap())):e instanceof Wt?Wt.create(fo(e.unwrap())):e instanceof zt?zt.create(e.items.map(t=>fo(t))):e}var dt=class e extends ye{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=Ae.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==te.object){let u=this._getOrReturnCtx(t);return Z(u,{code:z.invalid_type,expected:te.object,received:u.parsedType}),ue}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Lt&&this._def.unknownKeys==="strip"))for(let u in o.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let g=i[u],v=o.data[u];c.push({key:{status:"valid",value:u},value:g._parse(new It(o,v,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof Lt){let u=this._def.unknownKeys;if(u==="passthrough")for(let g of a)c.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(u==="strict")a.length>0&&(Z(o,{code:z.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let g of a){let v=o.data[g];c.push({key:{status:"valid",value:g},value:u._parse(new It(o,v,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let u=[];for(let g of c){let v=yield g.key,w=yield g.value;u.push({key:v,value:w,alwaysSet:g.alwaysSet})}return u})).then(u=>rt.mergeObjectSync(n,u)):rt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return ne.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:ne.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:le.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 Ae.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 Ae.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return fo(this)}partial(t){let r={};for(let n of Ae.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 Ae.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Et;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Gy(Ae.objectKeys(this.shape))}};dt.create=(e,t)=>new dt({shape:()=>e,unknownKeys:"strip",catchall:Lt.create(),typeName:le.ZodObject,...me(t)});dt.strictCreate=(e,t)=>new dt({shape:()=>e,unknownKeys:"strict",catchall:Lt.create(),typeName:le.ZodObject,...me(t)});dt.lazycreate=(e,t)=>new dt({shape:e,unknownKeys:"strip",catchall:Lt.create(),typeName:le.ZodObject,...me(t)});var dn=class extends ye{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new lt(a.ctx.common.issues));return Z(r,{code:z.invalid_union,unionErrors:s}),ue}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(i){let s={...r,common:{...r.common,issues:[]},parent:null};return{result:yield i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}});return function(_x81){return _ref35.apply(this,arguments)}}())).then(o);{let i,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},g=c._parseSync({data:r.data,path:r.path,parent:u});if(g.status==="valid")return g;g.status==="dirty"&&!i&&(i={result:g,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(c=>new lt(c));return Z(r,{code:z.invalid_union,unionErrors:a}),ue}}get options(){return this._def.options}};dn.create=(e,t)=>new dn({options:e,typeName:le.ZodUnion,...me(t)});var dr=e=>e instanceof fn?dr(e.schema):e instanceof Rt?dr(e.innerType()):e instanceof mn?[e.value]:e instanceof gn?e.options:e instanceof hn?Ae.objectValues(e.enum):e instanceof yn?dr(e._def.innerType):e instanceof un?[void 0]:e instanceof ln?[null]:e instanceof Et?[void 0,...dr(e.unwrap())]:e instanceof Wt?[null,...dr(e.unwrap())]:e instanceof Ni||e instanceof Sn?dr(e.unwrap()):e instanceof vn?dr(e._def.innerType):[],Ba=class e extends ye{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.object)return Z(r,{code:z.invalid_type,expected:te.object,received:r.parsedType}),ue;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}):(Z(r,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ue)}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 s=dr(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new e({typeName:le.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...me(n)})}};function zd(e,t){let r=Ht(e),n=Ht(t);if(e===t)return{valid:!0,data:e};if(r===te.object&&n===te.object){let o=Ae.objectKeys(t),i=Ae.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let c=zd(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===te.array&&n===te.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],c=zd(s,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===te.date&&n===te.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var pn=class extends ye{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,s)=>{if(Ua(i)||Ua(s))return ue;let a=zd(i.value,s.value);return a.valid?((Va(i)||Va(s))&&r.dirty(),{status:r.value,value:a.data}):(Z(n,{code:z.invalid_intersection_types}),ue)};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,s])=>o(i,s)):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}))}};pn.create=(e,t,r)=>new pn({left:e,right:t,typeName:le.ZodIntersection,...me(r)});var zt=class e extends ye{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.array)return Z(n,{code:z.invalid_type,expected:te.array,received:n.parsedType}),ue;if(n.data.length<this._def.items.length)return Z(n,{code:z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ue;!this._def.rest&&n.data.length>this._def.items.length&&(Z(n,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new It(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>rt.mergeArray(r,s)):rt.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};zt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new zt({items:e,typeName:le.ZodTuple,rest:null,...me(t)})};var Ga=class e extends ye{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.object)return Z(n,{code:z.invalid_type,expected:te.object,received:n.parsedType}),ue;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new It(n,a,n.path,a)),value:s._parse(new It(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?rt.mergeObjectAsync(r,o):rt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof ye?new e({keyType:t,valueType:r,typeName:le.ZodRecord,...me(n)}):new e({keyType:Tr.create(),valueType:t,typeName:le.ZodRecord,...me(r)})}},ho=class extends ye{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.map)return Z(n,{code:z.invalid_type,expected:te.map,received:n.parsedType}),ue;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new It(n,a,n.path,[u,"key"])),value:i._parse(new It(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let c of s){let u=yield c.key,g=yield c.value;if(u.status==="aborted"||g.status==="aborted")return ue;(u.status==="dirty"||g.status==="dirty")&&r.dirty(),a.set(u.value,g.value)}return{status:r.value,value:a}}))}else{let a=new Map;for(let c of s){let u=c.key,g=c.value;if(u.status==="aborted"||g.status==="aborted")return ue;(u.status==="dirty"||g.status==="dirty")&&r.dirty(),a.set(u.value,g.value)}return{status:r.value,value:a}}}};ho.create=(e,t,r)=>new ho({valueType:t,keyType:e,typeName:le.ZodMap,...me(r)});var yo=class e extends ye{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.set)return Z(n,{code:z.invalid_type,expected:te.set,received:n.parsedType}),ue;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(Z(n,{code:z.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&&(Z(n,{code:z.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let u=new Set;for(let g of c){if(g.status==="aborted")return ue;g.status==="dirty"&&r.dirty(),u.add(g.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>i._parse(new It(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:ne.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ne.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};yo.create=(e,t)=>new yo({valueType:e,minSize:null,maxSize:null,typeName:le.ZodSet,...me(t)});var $a=class e extends ye{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.function)return Z(r,{code:z.invalid_type,expected:te.function,received:r.parsedType}),ue;function n(a,c){return Pi({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,lo(),lr].filter(u=>!!u),issueData:{code:z.invalid_arguments,argumentsError:c}})}function o(a,c){return Pi({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,lo(),lr].filter(u=>!!u),issueData:{code:z.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof _r){let a=this;return at(/*#__PURE__*/_asyncToGenerator(function*(...c){let u=new lt([]),g=yield a._def.args.parseAsync(c,i).catch(h=>{throw u.addIssue(n(c,h)),u}),v=yield Reflect.apply(s,this,g);return yield a._def.returns._def.type.parseAsync(v,i).catch(h=>{throw u.addIssue(o(v,h)),u})}))}else{let a=this;return at(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new lt([n(c,u.error)]);let g=Reflect.apply(s,this,u.data),v=a._def.returns.safeParse(g,i);if(!v.success)throw new lt([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:zt.create(t).rest(pr.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||zt.create([]).rest(pr.create()),returns:r||pr.create(),typeName:le.ZodFunction,...me(n)})}},fn=class extends ye{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})}};fn.create=(e,t)=>new fn({getter:e,typeName:le.ZodLazy,...me(t)});var mn=class extends ye{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Z(r,{received:r.data,code:z.invalid_literal,expected:this._def.value}),ue}return{status:"valid",value:t.data}}get value(){return this._def.value}};mn.create=(e,t)=>new mn({value:e,typeName:le.ZodLiteral,...me(t)});function Gy(e,t){return new gn({values:e,typeName:le.ZodEnum,...me(t)})}var gn=class e extends ye{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return Z(r,{expected:Ae.joinValues(n),received:r.parsedType,code:z.invalid_type}),ue}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 Z(r,{received:r.data,code:z.invalid_enum_value,options:n}),ue}return at(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})}};gn.create=Gy;var hn=class extends ye{_parse(t){let r=Ae.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==te.string&&n.parsedType!==te.number){let o=Ae.objectValues(r);return Z(n,{expected:Ae.joinValues(o),received:n.parsedType,code:z.invalid_type}),ue}if(this._cache||(this._cache=new Set(Ae.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Ae.objectValues(r);return Z(n,{received:n.data,code:z.invalid_enum_value,options:o}),ue}return at(t.data)}get enum(){return this._def.values}};hn.create=(e,t)=>new hn({values:e,typeName:le.ZodNativeEnum,...me(t)});var _r=class extends ye{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.promise&&r.common.async===!1)return Z(r,{code:z.invalid_type,expected:te.promise,received:r.parsedType}),ue;let n=r.parsedType===te.promise?r.data:Promise.resolve(r.data);return at(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};_r.create=(e,t)=>new _r({type:e,typeName:le.ZodPromise,...me(t)});var Rt=class extends ye{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===le.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this9=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{Z(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(a){if(r.value==="aborted")return ue;let c=yield _this9._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?ue:c.status==="dirty"?nn(c.value):r.value==="dirty"?nn(c.value):c});return function(_x82){return _ref38.apply(this,arguments)}}());{if(r.value==="aborted")return ue;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ue:a.status==="dirty"?nn(a.value):r.value==="dirty"?nn(a.value):a}}if(o.type==="refinement"){let s=a=>{let c=o.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ue:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ue:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Rr(s))return ue;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Rr(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):ue);Ae.assertNever(o)}};Rt.create=(e,t,r)=>new Rt({schema:e,typeName:le.ZodEffects,effect:t,...me(r)});Rt.createWithPreprocess=(e,t,r)=>new Rt({schema:t,effect:{type:"preprocess",transform:e},typeName:le.ZodEffects,...me(r)});var Et=class extends ye{_parse(t){return this._getType(t)===te.undefined?at(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Et.create=(e,t)=>new Et({innerType:e,typeName:le.ZodOptional,...me(t)});var Wt=class extends ye{_parse(t){return this._getType(t)===te.null?at(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Wt.create=(e,t)=>new Wt({innerType:e,typeName:le.ZodNullable,...me(t)});var yn=class extends ye{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===te.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};yn.create=(e,t)=>new yn({innerType:e,typeName:le.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...me(t)});var vn=class extends ye{_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 po(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new lt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new lt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};vn.create=(e,t)=>new vn({innerType:e,typeName:le.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...me(t)});var vo=class extends ye{_parse(t){if(this._getType(t)!==te.nan){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:te.nan,received:n.parsedType}),ue}return{status:"valid",value:t.data}}};vo.create=e=>new vo({typeName:le.ZodNaN,...me(e)});var DT=Symbol("zod_brand"),Ni=class extends ye{_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}},Fi=class e extends ye{_parse(t){var _this0=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let i=yield _this0._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ue:i.status==="dirty"?(r.dirty(),nn(i.value)):_this0._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"?ue: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:le.ZodPipeline})}},Sn=class extends ye{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Rr(o)&&(o.value=Object.freeze(o.value)),o);return po(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Sn.create=(e,t)=>new Sn({innerType:e,typeName:le.ZodReadonly,...me(t)});function qy(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function $y(e,t={},r){return e?kr.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=qy(t,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!i){let s=qy(t,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):kr.create()}var MT={object:dt.lazycreate},le;(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"})(le||(le={}));var LT=(e,t={message:`Input not instance of ${e.name}`})=>$y(r=>r instanceof e,t),Qy=Tr.create,Hy=on.create,jT=vo.create,qT=sn.create,zy=an.create,UT=cn.create,VT=mo.create,BT=un.create,GT=ln.create,$T=kr.create,QT=pr.create,HT=Lt.create,zT=go.create,WT=fr.create,KT=dt.create,YT=dt.strictCreate,XT=dn.create,ZT=Ba.create,JT=pn.create,ek=zt.create,tk=Ga.create,rk=ho.create,nk=yo.create,ok=$a.create,ik=fn.create,sk=mn.create,ak=gn.create,ck=hn.create,uk=_r.create,lk=Rt.create,dk=Et.create,pk=Wt.create,fk=Rt.createWithPreprocess,mk=Fi.create,gk=()=>Qy().optional(),hk=()=>Hy().optional(),yk=()=>zy().optional(),vk={string:e=>Tr.create({...e,coerce:!0}),number:e=>on.create({...e,coerce:!0}),boolean:e=>an.create({...e,coerce:!0}),bigint:e=>sn.create({...e,coerce:!0}),date:e=>cn.create({...e,coerce:!0})};var Sk=ue;var Ak=A.object({name:A.string(),arguments:A.string()}),bk=A.object({id:A.string(),type:A.literal("function"),function:Ak,encryptedValue:A.string().optional()}),Qa=A.object({id:A.string(),role:A.string(),content:A.string().optional(),name:A.string().optional(),encryptedValue:A.string().optional()}),wk=A.object({type:A.literal("text"),text:A.string()}),Ck=A.object({type:A.literal("data"),value:A.string(),mimeType:A.string()}),xk=A.object({type:A.literal("url"),value:A.string(),mimeType:A.string().optional()}),Ha=A.discriminatedUnion("type",[Ck,xk]),Ek=A.object({type:A.literal("image"),source:Ha,metadata:A.unknown().optional()}),Ik=A.object({type:A.literal("audio"),source:Ha,metadata:A.unknown().optional()}),Rk=A.object({type:A.literal("video"),source:Ha,metadata:A.unknown().optional()}),Tk=A.object({type:A.literal("document"),source:Ha,metadata:A.unknown().optional()});var Wy=A.object({type:A.literal("binary"),mimeType:A.string(),id:A.string().optional(),url:A.string().optional(),data:A.string().optional(),filename:A.string().optional()}),Ky=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:A.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},fW=Wy.superRefine((e,t)=>{Ky(e,t)}),kk=A.discriminatedUnion("type",[wk,Ek,Ik,Rk,Tk,Wy]),_k=kk.superRefine((e,t)=>{e.type==="binary"&&Ky(e,t)}),Ok=Qa.extend({role:A.literal("developer"),content:A.string()}),Pk=Qa.extend({role:A.literal("system"),content:A.string()}),Nk=Qa.extend({role:A.literal("assistant"),content:A.string().optional(),toolCalls:A.array(bk).optional()}),Fk=Qa.extend({role:A.literal("user"),content:A.union([A.string(),A.array(_k)])}),Dk=A.object({id:A.string(),content:A.string(),role:A.literal("tool"),toolCallId:A.string(),error:A.string().optional(),encryptedValue:A.string().optional()}),Mk=A.object({id:A.string(),role:A.literal("activity"),activityType:A.string(),content:A.record(A.any())}),Lk=A.object({id:A.string(),role:A.literal("reasoning"),content:A.string(),encryptedValue:A.string().optional()}),Yy=A.discriminatedUnion("role",[Ok,Pk,Nk,Fk,Dk,Mk,Lk]),mW=A.union([A.literal("developer"),A.literal("system"),A.literal("assistant"),A.literal("user"),A.literal("tool"),A.literal("activity"),A.literal("reasoning")]),jk=A.object({description:A.string(),value:A.string()}),Xy=A.object({name:A.string(),description:A.string(),parameters:A.any(),metadata:A.record(A.any()).optional()}),qk=A.object({id:A.string(),reason:A.string(),message:A.string().optional(),toolCallId:A.string().optional(),responseSchema:A.record(A.any()).optional(),expiresAt:A.string().optional(),metadata:A.record(A.any()).optional()}),Uk=A.object({interruptId:A.string(),status:A.enum(["resolved","cancelled"]),payload:A.any().optional()}),Vk=A.object({threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),state:A.any(),messages:A.array(Yy),tools:A.array(Xy),context:A.array(jk),forwardedProps:A.any(),resume:A.array(Uk).optional()}),Bk=A.any(),Fe=class extends Error{constructor(e){super(e)}},Wd=class extends Fe{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},Gk=A.object({name:A.string(),description:A.string().optional()}),$k=A.object({name:A.string().optional(),type:A.string().optional(),description:A.string().optional(),version:A.string().optional(),provider:A.string().optional(),documentationUrl:A.string().optional(),metadata:A.record(A.unknown()).optional()}),Qk=A.object({streaming:A.boolean().optional(),websocket:A.boolean().optional(),httpBinary:A.boolean().optional(),pushNotifications:A.boolean().optional(),resumable:A.boolean().optional()}),Hk=A.object({supported:A.boolean().optional(),items:A.array(Xy).optional(),parallelCalls:A.boolean().optional(),clientProvided:A.boolean().optional()}),zk=A.object({structuredOutput:A.boolean().optional(),supportedMimeTypes:A.array(A.string()).optional()}),Wk=A.object({snapshots:A.boolean().optional(),deltas:A.boolean().optional(),memory:A.boolean().optional(),persistentState:A.boolean().optional()}),Kk=A.object({supported:A.boolean().optional(),delegation:A.boolean().optional(),handoffs:A.boolean().optional(),subAgents:A.array(Gk).optional()}),Yk=A.object({supported:A.boolean().optional(),streaming:A.boolean().optional(),encrypted:A.boolean().optional()}),Xk=A.object({image:A.boolean().optional(),audio:A.boolean().optional(),video:A.boolean().optional(),pdf:A.boolean().optional(),file:A.boolean().optional()}),Zk=A.object({image:A.boolean().optional(),audio:A.boolean().optional()}),Jk=A.object({input:Xk.optional(),output:Zk.optional()}),e0=A.object({codeExecution:A.boolean().optional(),sandboxed:A.boolean().optional(),maxIterations:A.number().optional(),maxExecutionTime:A.number().optional()}),t0=A.object({supported:A.boolean().optional(),approvals:A.boolean().optional(),interventions:A.boolean().optional(),feedback:A.boolean().optional(),interrupts:A.boolean().optional(),approveWithEdits:A.boolean().optional()}),gW=A.object({identity:$k.optional(),transport:Qk.optional(),tools:Hk.optional(),output:zk.optional(),state:Wk.optional(),multiAgent:Kk.optional(),reasoning:Yk.optional(),multimodal:Jk.optional(),execution:e0.optional(),humanInTheLoop:t0.optional(),custom:A.record(A.unknown()).optional()}),Zy=A.union([A.literal("developer"),A.literal("system"),A.literal("assistant"),A.literal("user")]),D=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}({}),Ee=A.object({type:A.nativeEnum(D),timestamp:A.number().optional(),rawEvent:A.any().optional()}).passthrough(),r0=Ee.extend({type:A.literal(D.TEXT_MESSAGE_START),messageId:A.string(),role:Zy.default("assistant"),name:A.string().optional()}),Jy=Ee.extend({type:A.literal(D.TEXT_MESSAGE_CONTENT),messageId:A.string(),delta:A.string()}),n0=Ee.extend({type:A.literal(D.TEXT_MESSAGE_END),messageId:A.string()}),o0=Ee.extend({type:A.literal(D.TEXT_MESSAGE_CHUNK),messageId:A.string().optional(),role:Zy.optional(),delta:A.string().optional(),name:A.string().optional()}),i0=Ee.extend({type:A.literal(D.THINKING_TEXT_MESSAGE_START)}),s0=Jy.omit({messageId:!0,type:!0}).extend({type:A.literal(D.THINKING_TEXT_MESSAGE_CONTENT)}),a0=Ee.extend({type:A.literal(D.THINKING_TEXT_MESSAGE_END)}),c0=Ee.extend({type:A.literal(D.TOOL_CALL_START),toolCallId:A.string(),toolCallName:A.string(),parentMessageId:A.string().nullable().optional().transform(e=>e??void 0)}),u0=Ee.extend({type:A.literal(D.TOOL_CALL_ARGS),toolCallId:A.string(),delta:A.string()}),l0=Ee.extend({type:A.literal(D.TOOL_CALL_END),toolCallId:A.string()}),d0=Ee.extend({messageId:A.string(),type:A.literal(D.TOOL_CALL_RESULT),toolCallId:A.string(),content:A.string(),role:A.literal("tool").optional()}),p0=Ee.extend({type:A.literal(D.TOOL_CALL_CHUNK),toolCallId:A.string().optional(),toolCallName:A.string().optional(),parentMessageId:A.string().nullable().optional().transform(e=>e??void 0),delta:A.string().optional()}),f0=Ee.extend({type:A.literal(D.THINKING_START),title:A.string().optional()}),m0=Ee.extend({type:A.literal(D.THINKING_END)}),g0=Ee.extend({type:A.literal(D.STATE_SNAPSHOT),snapshot:Bk}),h0=Ee.extend({type:A.literal(D.STATE_DELTA),delta:A.array(A.any())}),y0=Ee.extend({type:A.literal(D.MESSAGES_SNAPSHOT),messages:A.array(Yy)}),v0=Ee.extend({type:A.literal(D.ACTIVITY_SNAPSHOT),messageId:A.string(),activityType:A.string(),content:A.record(A.any()),replace:A.boolean().optional().default(!0)}),S0=Ee.extend({type:A.literal(D.ACTIVITY_DELTA),messageId:A.string(),activityType:A.string(),patch:A.array(A.any())}),A0=Ee.extend({type:A.literal(D.RAW),event:A.any(),source:A.string().optional()}),b0=Ee.extend({type:A.literal(D.CUSTOM),name:A.string(),value:A.any()}),w0=Ee.extend({type:A.literal(D.RUN_STARTED),threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),input:Vk.optional()}),C0=A.object({type:A.literal("success")}).strict(),x0=A.object({type:A.literal("interrupt"),interrupts:A.array(qk).min(1)}).strict(),E0=A.discriminatedUnion("type",[C0,x0]),ev=A.object({provider:A.string().optional(),model:A.string().optional(),inputTokens:A.number().int().nonnegative().optional(),outputTokens:A.number().int().nonnegative().optional(),totalTokens:A.number().int().nonnegative().optional(),reasoningTokens:A.number().int().nonnegative().optional(),cachedInputTokens:A.number().int().nonnegative().optional()}),I0=Ee.extend({type:A.literal(D.RUN_FINISHED),threadId:A.string(),runId:A.string(),result:A.any().optional(),outcome:E0.nullable().optional().transform(e=>e??void 0),usage:A.array(ev).optional()}),R0=Ee.extend({type:A.literal(D.RUN_ERROR),message:A.string(),code:A.string().optional(),usage:A.array(ev).optional()}),T0=Ee.extend({type:A.literal(D.STEP_STARTED),stepName:A.string()}),k0=Ee.extend({type:A.literal(D.STEP_FINISHED),stepName:A.string()}),_0=A.union([A.literal("tool-call"),A.literal("message")]),O0=Ee.extend({type:A.literal(D.REASONING_START),messageId:A.string()}),P0=Ee.extend({type:A.literal(D.REASONING_MESSAGE_START),messageId:A.string(),role:A.literal("reasoning")}),N0=Ee.extend({type:A.literal(D.REASONING_MESSAGE_CONTENT),messageId:A.string(),delta:A.string()}),F0=Ee.extend({type:A.literal(D.REASONING_MESSAGE_END),messageId:A.string()}),D0=Ee.extend({type:A.literal(D.REASONING_MESSAGE_CHUNK),messageId:A.string().optional(),delta:A.string().optional()}),M0=Ee.extend({type:A.literal(D.REASONING_END),messageId:A.string()}),L0=Ee.extend({type:A.literal(D.REASONING_ENCRYPTED_VALUE),subtype:_0,entityId:A.string(),encryptedValue:A.string()}),za=A.discriminatedUnion("type",[r0,Jy,n0,o0,f0,m0,i0,s0,a0,c0,u0,l0,p0,d0,g0,h0,y0,v0,S0,A0,b0,w0,I0,R0,T0,k0,O0,P0,N0,F0,D0,M0,L0]);m();d();f();p();var Kd={};Xi(Kd,{JsonPatchError:()=>Ue,_areEquals:()=>Li,applyOperation:()=>An,applyPatch:()=>ec,applyReducer:()=>B0,deepClone:()=>U0,getValueByPointer:()=>Za,validate:()=>rv,validator:()=>Ja});m();d();f();p();m();d();f();p();var j0=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)}}(),q0=Object.prototype.hasOwnProperty;function Ka(e,t){return q0.call(e,t)}function Ya(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)Ka(e,o)&&n.push(o);return n}function nt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Xa(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 Kt(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Di(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Wa(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Wa(e[t]))return!0}else if(typeof e=="object"){for(var n=Ya(e),o=n.length,i=0;i<o;i++)if(Wa(e[n[i]]))return!0}}return!1}function tv(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 Mi=function(e){j0(t,e);function t(r,n,o,i,s){var a=this.constructor,c=e.call(this,tv(r,{name:n,index:o,operation:i,tree:s}))||this;return c.name=n,c.index=o,c.operation=i,c.tree=s,Object.setPrototypeOf(c,a.prototype),c.message=tv(r,{name:n,index:o,operation:i,tree:s}),c}return t}(Error);var Ue=Mi,U0=nt,So={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=Za(r,this.path);n&&(n=nt(n));var o=An(r,{op:"remove",path:this.from}).removed;return An(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Za(r,this.from);return An(r,{op:"add",path:this.path,value:nt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Li(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},V0={add:function(e,t,r){return Xa(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:So.move,copy:So.copy,test:So.test,_get:So._get};function Za(e,t){if(t=="")return e;var r={op:"_get",path:t};return An(e,r),r.value}function An(e,t,r,n,o,i){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),i===void 0&&(i=0),r&&(typeof r=="function"?r(t,0,e,t.path):Ja(t,0)),t.path===""){var s={newDocument:e};if(t.op==="add")return s.newDocument=t.value,s;if(t.op==="replace")return s.newDocument=t.value,s.removed=e,s;if(t.op==="move"||t.op==="copy")return s.newDocument=Za(e,t.from),t.op==="move"&&(s.removed=e),s;if(t.op==="test"){if(s.test=Li(e,t.value),s.test===!1)throw new Ue("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s.newDocument=e,s}else{if(t.op==="remove")return s.removed=e,s.newDocument=null,s;if(t.op==="_get")return t.value=e,s;if(r)throw new Ue("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return s}}else{n||(e=nt(e));var a=t.path||"",c=a.split("/"),u=e,g=1,v=c.length,w=void 0,h=void 0,y=void 0;for(typeof r=="function"?y=r:y=Ja;;){if(h=c[g],h&&h.indexOf("~")!=-1&&(h=Di(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&c[g-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&w===void 0&&(u[h]===void 0?w=c.slice(0,g).join("/"):g==v-1&&(w=t.path),w!==void 0&&y(t,0,e,w)),g++,Array.isArray(u)){if(h==="-")h=u.length;else{if(r&&!Xa(h))throw new Ue("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);Xa(h)&&(h=~~h)}if(g>=v){if(r&&t.op==="add"&&h>u.length)throw new Ue("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);var s=V0[t.op].call(t,u,h,e);if(s.test===!1)throw new Ue("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}}else if(g>=v){var s=So[t.op].call(t,u,h,e);if(s.test===!1)throw new Ue("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}if(u=u[h],r&&g<v&&(!u||typeof u!="object"))throw new Ue("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function ec(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new Ue("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=nt(e));for(var i=new Array(t.length),s=0,a=t.length;s<a;s++)i[s]=An(e,t[s],r,!0,o,s),e=i[s].newDocument;return i.newDocument=e,i}function B0(e,t,r){var n=An(e,t);if(n.test===!1)throw new Ue("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Ja(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Ue("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(So[e.op]){if(typeof e.path!="string")throw new Ue("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Ue("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 Ue("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 Ue("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")&&Wa(e.value))throw new Ue("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 Ue("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 Ue("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var s={op:"_get",path:e.from,value:void 0},a=rv([s],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new Ue("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Ue("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function rv(e,t,r){try{if(!Array.isArray(e))throw new Ue("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)ec(nt(t),nt(e),r||!0);else{r=r||Ja;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof Ue)return o;throw o}}function Li(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),o,i,s;if(r&&n){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!Li(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var a=Object.keys(e);if(i=a.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(a[o]))return!1;for(o=i;o--!==0;)if(s=a[o],!Li(e[s],t[s]))return!1;return!0}return e!==e&&t!==t}var Jd={};Xi(Jd,{compare:()=>Y0,generate:()=>Yd,observe:()=>K0,unobserve:()=>W0});m();d();f();p();var Xd=new WeakMap,G0=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),$0=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function Q0(e){return Xd.get(e)}function H0(e,t){return e.observers.get(t)}function z0(e,t){e.observers.delete(t.callback)}function W0(e,t){t.unobserve()}function K0(e,t){var r=[],n,o=Q0(e);if(!o)o=new G0(e),Xd.set(e,o);else{var i=H0(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=nt(e),t){n.callback=t,n.next=null;var s=function(){Yd(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(s)};typeof window<"u"&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return n.patches=r,n.object=e,n.unobserve=function(){Yd(n),clearTimeout(n.next),z0(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},o.observers.set(t,new $0(t,n)),n}function Yd(e,t){t===void 0&&(t=!1);var r=Xd.get(e.object);Zd(r.value,e.object,e.patches,"",t),e.patches.length&&ec(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Zd(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=Ya(t),s=Ya(e),a=!1,c=!1,u=s.length-1;u>=0;u--){var g=s[u],v=e[g];if(Ka(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var w=t[g];typeof v=="object"&&v!=null&&typeof w=="object"&&w!=null&&Array.isArray(v)===Array.isArray(w)?Zd(v,w,r,n+"/"+Kt(g),o):v!==w&&(a=!0,o&&r.push({op:"test",path:n+"/"+Kt(g),value:nt(v)}),r.push({op:"replace",path:n+"/"+Kt(g),value:nt(w)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+Kt(g),value:nt(v)}),r.push({op:"remove",path:n+"/"+Kt(g)}),c=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),a=!0)}if(!(!c&&i.length==s.length))for(var u=0;u<i.length;u++){var g=i[u];!Ka(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+Kt(g),value:nt(t[g])})}}}function Y0(e,t,r){r===void 0&&(r=!1);var n=[];return Zd(e,t,n,"",r),n}var tc=Object.assign({},Kd,Jd,{JsonPatchError:Mi,deepClone:nt,escapePathComponent:Kt,unescapePathComponent:Di});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var ep=function(e,t){return ep=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])},ep(e,t)};function Yt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ep(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function nv(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(g){try{u(n.next(g))}catch(v){s(v)}}function c(g){try{u(n.throw(g))}catch(v){s(v)}}function u(g){g.done?i(g.value):o(g.value).then(a,c)}u((n=n.apply(e,t||[])).next())})}function rc(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(g){return c([u,g])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(r=0)),r;)try{if(n=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(g){u=[6,g],o=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function mr(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ao(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-->0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function 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 bn(e){return this instanceof bn?(this.v=e,this):new bn(e)}function ov(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(h){return function(y){return Promise.resolve(y).then(h,v)}}function a(h,y){n[h]&&(o[h]=function(S){return new Promise(function(x,I){i.push([h,S,x,I])>1||c(h,S)})},y&&(o[h]=y(o[h])))}function c(h,y){try{u(n[h](y))}catch(S){w(i[0][3],S)}}function u(h){h.value instanceof bn?Promise.resolve(h.value.v).then(g,v):w(i[0][2],h)}function g(h){c("next",h)}function v(h){c("throw",h)}function w(h,y){h(y),i.shift(),i.length&&c(i[0][0],i[0][1])}}function iv(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof mr=="function"?mr(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(s){return new Promise(function(a,c){s=e[i](s),o(a,c,s.done,s.value)})}}function o(i,s,a,c){Promise.resolve(c).then(function(u){i({value:u,done:a})},s)}}m();d();f();p();function Se(e){return typeof e=="function"}m();d();f();p();m();d();f();p();m();d();f();p();function wo(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 nc=wo(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 ji(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var wo=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=mr(s),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(S){t={error:S}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var g=this.initialTeardown;if(Se(g))try{g()}catch(S){i=S instanceof tc?S.errors:[S]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var w=mr(v),h=w.next();!h.done;h=w.next()){var y=h.value;try{nv(y)}catch(S){i=i??[],S instanceof tc?i=Ao(Ao([],So(i)),So(S.errors)):i.push(S)}}}catch(S){n={error:S}}finally{try{h&&!h.done&&(o=w.return)&&o.call(w)}finally{if(n)throw n.error}}}if(i)throw new tc(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)nv(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&ji(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&ji(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Zd=wo.EMPTY;function rc(e){return e instanceof wo||e&&"closed"in e&&Se(e.remove)&&Se(e.add)&&Se(e.unsubscribe)}function nv(e){Se(e)?e():e.unsubscribe()}m();d();f();p();var jt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var Co={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Co.delegate;return o?.setTimeout?o.setTimeout.apply(o,Ao([e,t],So(r))):setTimeout.apply(void 0,Ao([e,t],So(r)))},clearTimeout:function(e){var t=Co.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function nc(e){Co.setTimeout(function(){var t=jt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function qi(){}m();d();f();p();var ov=function(){return Jd("C",void 0,void 0)}();function iv(e){return Jd("E",void 0,e)}function sv(e){return Jd("N",e,void 0)}function Jd(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var wn=null;function xo(e){if(jt.useDeprecatedSynchronousErrorHandling){var t=!wn;if(t&&(wn={errorThrown:!1,error:null}),e(),t){var r=wn,n=r.errorThrown,o=r.error;if(wn=null,n)throw o}}else e()}function av(e){jt.useDeprecatedSynchronousErrorHandling&&wn&&(wn.errorThrown=!0,wn.error=e)}var Ui=function(e){Yt(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,rc(r)&&r.add(n)):n.destination=H0,n}return t.create=function(r,n,o){return new ic(r,n,o)},t.prototype.next=function(r){this.isStopped?tp(sv(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?tp(iv(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?tp(ov,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(wo);var G0=Function.prototype.bind;function ep(e,t){return G0.call(e,t)}var $0=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){oc(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){oc(n)}else oc(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){oc(r)}},e}(),ic=function(e){Yt(t,e);function t(r,n,o){var i=e.call(this)||this,s;if(Se(r)||!r)s={next:r??void 0,error:n??void 0,complete:o??void 0};else{var a;i&&jt.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return i.unsubscribe()},s={next:r.next&&ep(r.next,a),error:r.error&&ep(r.error,a),complete:r.complete&&ep(r.complete,a)}):s=r}return i.destination=new $0(s),i}return t}(Ui);function oc(e){jt.useDeprecatedSynchronousErrorHandling?av(e):nc(e)}function Q0(e){throw e}function tp(e,t){var r=jt.onStoppedNotification;r&&Co.setTimeout(function(){return r(e,t)})}var H0={closed:!0,next:qi,error:Q0,complete:qi};m();d();f();p();var Eo=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function Io(e){return e}function sc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return rp(e)}function rp(e){return e.length===0?Io:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var De=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var o=this,i=W0(t)?t:new ic(t,r,n);return xo(function(){var s=o,a=s.operator,c=s.source;i.add(a?a.call(i,c):c?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=cv(r),new r(function(o,i){var s=new ic({next:function(a){try{t(a)}catch(c){i(c),s.unsubscribe()}},error:i,complete:o});n.subscribe(s)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[Eo]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return rp(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=cv(t),new t(function(n,o){var i;r.subscribe(function(s){return i=s},function(s){return o(s)},function(){return n(i)})})},e.create=function(t){return new e(t)},e}();function cv(e){var t;return(t=e??jt.Promise)!==null&&t!==void 0?t:Promise}function z0(e){return e&&Se(e.next)&&Se(e.error)&&Se(e.complete)}function W0(e){return e&&e instanceof Ui||z0(e)&&rc(e)}m();d();f();p();function K0(e){return Se(e?.lift)}function Ge(e){return function(t){if(K0(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}m();d();f();p();function We(e,t,r,n,o){return new Y0(e,t,r,n,o)}var Y0=function(e){Yt(t,e);function t(r,n,o,i,s,a){var c=e.call(this,r)||this;return c.onFinalize=s,c.shouldUnsubscribe=a,c._next=n?function(u){try{n(u)}catch(g){r.error(g)}}:e.prototype._next,c._error=i?function(u){try{i(u)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=o?function(){try{o()}catch(u){r.error(u)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(Ui);m();d();f();p();m();d();f();p();var uv=bo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Xt=function(e){Yt(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new lv(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new uv},t.prototype.next=function(r){var n=this;xo(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=mr(n.currentObservers),a=s.next();!a.done;a=s.next()){var c=a.value;c.next(r)}}catch(u){o={error:u}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;xo(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},t.prototype.complete=function(){var r=this;xo(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Zd:(this.currentObservers=null,a.push(r),new wo(function(){n.currentObservers=null,ji(a,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},t.prototype.asObservable=function(){var r=new De;return r.source=this,r},t.create=function(r,n){return new lv(r,n)},t}(De);var lv=function(e){Yt(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Zd},t}(Xt);m();d();f();p();m();d();f();p();var np={now:function(){return(np.delegate||Date).now()},delegate:void 0};var ac=function(e){Yt(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=np);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,c=n._windowTime;o||(i.push(r),!s&&i.push(a.now()+c)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),c=0;c<a.length&&!r.closed;c+=i?1:2)r.next(a[c]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,i=r._buffer,s=r._infiniteTimeWindow,a=(s?1:2)*n;if(n<1/0&&a<i.length&&i.splice(0,i.length-a),!s){for(var c=o.now(),u=0,g=1;g<i.length&&i[g]<=c;g+=2)u=g;u&&i.splice(0,u+1)}},t}(Xt);m();d();f();p();var cc=new De(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function dv(e){return e&&Se(e.schedule)}function X0(e){return e[e.length-1]}function pv(e){return dv(X0(e))?e.pop():void 0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var uc=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function lc(e){return Se(e?.then)}m();d();f();p();function dc(e){return Se(e[Eo])}m();d();f();p();function pc(e){return Symbol.asyncIterator&&Se(e?.[Symbol.asyncIterator])}m();d();f();p();function fc(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}m();d();f();p();m();d();f();p();function Z0(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var mc=Z0();function gc(e){return Se(e?.[mc])}m();d();f();p();function hc(e){return tv(this,arguments,function(){var r,n,o,i;return ec(this,function(s){switch(s.label){case 0:r=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,bn(r.read())];case 3:return n=s.sent(),o=n.value,i=n.done,i?[4,bn(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,bn(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function yc(e){return Se(e?.getReader)}function Ke(e){if(e instanceof De)return e;if(e!=null){if(dc(e))return J0(e);if(uc(e))return e_(e);if(lc(e))return t_(e);if(pc(e))return fv(e);if(gc(e))return r_(e);if(yc(e))return n_(e)}throw fc(e)}function J0(e){return new De(function(t){var r=e[Eo]();if(Se(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function e_(e){return new De(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function t_(e){return new De(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,nc)})}function r_(e){return new De(function(t){var r,n;try{for(var o=mr(e),i=o.next();!i.done;i=o.next()){var s=i.value;if(t.next(s),t.closed)return}}catch(a){r={error:a}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function fv(e){return new De(function(t){o_(e,t).catch(function(r){return t.error(r)})})}function n_(e){return fv(hc(e))}function o_(e,t){var r,n,o,i;return ev(this,void 0,void 0,function(){var s,a;return ec(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=rv(e),c.label=1;case 1:return[4,r.next()];case 2:if(n=c.sent(),!!n.done)return[3,4];if(s=n.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}m();d();f();p();m();d();f();p();function Tt(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!o)return i}function vc(e,t){return t===void 0&&(t=0),Ge(function(r,n){r.subscribe(We(n,function(o){return Tt(n,e,function(){return n.next(o)},t)},function(){return Tt(n,e,function(){return n.complete()},t)},function(o){return Tt(n,e,function(){return n.error(o)},t)}))})}m();d();f();p();function Sc(e,t){return t===void 0&&(t=0),Ge(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function mv(e,t){return Ke(e).pipe(Sc(t),vc(t))}m();d();f();p();function gv(e,t){return Ke(e).pipe(Sc(t),vc(t))}m();d();f();p();function hv(e,t){return new De(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}m();d();f();p();function yv(e,t){return new De(function(r){var n;return Tt(r,t,function(){n=e[mc](),Tt(r,t,function(){var o,i,s;try{o=n.next(),i=o.value,s=o.done}catch(a){r.error(a);return}s?r.complete():r.next(i)},0,!0)}),function(){return Se(n?.return)&&n.return()}})}m();d();f();p();function Ac(e,t){if(!e)throw new Error("Iterable cannot be null");return new De(function(r){Tt(r,t,function(){var n=e[Symbol.asyncIterator]();Tt(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}m();d();f();p();function vv(e,t){return Ac(hc(e),t)}function Sv(e,t){if(e!=null){if(dc(e))return mv(e,t);if(uc(e))return hv(e,t);if(lc(e))return gv(e,t);if(pc(e))return Ac(e,t);if(gc(e))return yv(e,t);if(yc(e))return vv(e,t)}throw fc(e)}function Cn(e,t){return t?Sv(e,t):Ke(e)}function qe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=pv(e);return Cn(e,r)}m();d();f();p();function Me(e,t){var r=Se(e)?e:function(){return e},n=function(o){return o.error(r())};return new De(t?function(o){return t.schedule(n,0,o)}:n)}m();d();f();p();m();d();f();p();var Av=bo(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function bc(e,t){var r=typeof t=="object";return new Promise(function(n,o){var i=!1,s;e.subscribe({next:function(a){s=a,i=!0},error:o,complete:function(){i?n(s):r?n(t.defaultValue):o(new Av)}})})}m();d();f();p();function xn(e,t){return Ge(function(r,n){var o=0;r.subscribe(We(n,function(i){n.next(e.call(t,i,o++))}))})}m();d();f();p();m();d();f();p();m();d();f();p();function bv(e,t,r,n,o,i,s,a){var c=[],u=0,g=0,v=!1,w=function(){v&&!c.length&&!u&&t.complete()},h=function(S){return u<n?y(S):c.push(S)},y=function(S){i&&t.next(S),u++;var x=!1;Ke(r(S,g++)).subscribe(We(t,function(I){o?.(I),i?h(I):t.next(I)},function(){x=!0},void 0,function(){if(x)try{u--;for(var I=function(){var _=c.shift();s?Tt(t,s,function(){return y(_)}):y(_)};c.length&&u<n;)I();w()}catch(_){t.error(_)}}))};return e.subscribe(We(t,h,function(){v=!0,w()})),function(){a?.()}}function pt(e,t,r){return r===void 0&&(r=1/0),Se(t)?pt(function(n,o){return xn(function(i,s){return t(n,i,o,s)})(Ke(e(n,o)))},r):(typeof t=="number"&&(r=t),Ge(function(n,o){return bv(n,o,e,r)}))}function op(e){return e===void 0&&(e=1/0),pt(Io,e)}m();d();f();p();function wc(e){return new De(function(t){Ke(e()).subscribe(t)})}m();d();f();p();function Vi(e){return Ge(function(t,r){var n=null,o=!1,i;n=t.subscribe(We(r,void 0,void 0,function(s){i=Ke(e(s,Vi(e)(t))),n?(n.unsubscribe(),n=null,i.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(r))})}m();d();f();p();function Cc(e,t){return Se(t)?pt(e,t,1):pt(e,1)}m();d();f();p();function ip(e){return Ge(function(t,r){var n=!1;t.subscribe(We(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}m();d();f();p();function En(e){return Ge(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function sp(e,t){return Ge(function(r,n){var o=null,i=0,s=!1,a=function(){return s&&!o&&n.complete()};r.subscribe(We(n,function(c){o?.unsubscribe();var u=0,g=i++;Ke(e(c,g)).subscribe(o=We(n,function(v){return n.next(t?t(c,v,g,u++):v)},function(){o=null,a()}))},function(){s=!0,a()}))})}m();d();f();p();function xc(e){return Ge(function(t,r){Ke(e).subscribe(We(r,function(){return r.complete()},qi)),!r.closed&&t.subscribe(r)})}m();d();f();p();function ap(e,t,r){var n=Se(e)||t||r?{next:e,error:t,complete:r}:e;return n?Ge(function(o,i){var s;(s=n.subscribe)===null||s===void 0||s.call(n);var a=!0;o.subscribe(We(i,function(c){var u;(u=n.next)===null||u===void 0||u.call(n,c),i.next(c)},function(){var c;a=!1,(c=n.complete)===null||c===void 0||c.call(n),i.complete()},function(c){var u;a=!1,(u=n.error)===null||u===void 0||u.call(n,c),i.error(c)},function(){var c,u;a&&((c=n.unsubscribe)===null||c===void 0||c.call(n)),(u=n.finalize)===null||u===void 0||u.call(n)}))}):Io}m();d();f();p();m();d();f();p();function wv(e){return` \r
36
- `.indexOf(e)>=0}function Ec(e){for(var t=["topLevel"],r=0,n,o,i,s=function(_){return t.push(_)},a=function(_){return t[t.length-1]=_},c=function(_){n==null&&(n=r,o=t.length,i=_)},u=function(_){_===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},w=function(_){if("0"<=_&&_<="9"){s("number");return}switch(_){case"\"":s("string");return;case"-":s("numberNeedsDigit");return;case"t":s("true");return;case"f":s("false");return;case"n":s("null");return;case"[":s("arrayNeedsValue");return;case"{":s("objectNeedsKey");return}},h=e.length;r<h;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":w(y);break;case"string":switch(y){case"\"":g();break;case"\\":c("stringEscape"),s("stringEscaped");break}break;case"stringEscaped":y==="u"?s("stringUnicode"):(u("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(u("stringEscape"),g());break;case"number":y==="."?a("numberNeedsDigit"):y==="e"||y==="E"?a("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),g());break;case"numberNeedsDigit":a("number");break;case"numberNeedsExponent":a(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),g());break;case"arrayNeedsValue":y==="]"?g():wv(y)||(u("collectionItem"),a("arrayNeedsComma"),w(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(c("collectionItem"),a("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(c("collectionItem"),a("objectNeedsColon"),s("string"));break;case"objectNeedsColon":y===":"&&a("objectNeedsValue");break;case"objectNeedsValue":wv(y)||(u("collectionItem"),a("objectNeedsComma"),w(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(c("collectionItem"),a("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var S=[n!=null?e.slice(0,n):e],x=function(_){return S.push(_.slice(e.length-e.lastIndexOf(_[0])))},I=t.length-1;I>=0;I--)switch(t[I]){case"string":S.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":S.push("0");break;case"true":x("true");break;case"false":x("false");break;case"null":x("null");break;case"arrayNeedsValue":case"arrayNeedsComma":S.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":S.push("}");break}return S.join("")}m();d();f();p();m();d();f();p();m();d();f();p();function xv(){let e=this.buf,t=this.pos,r=0,n=0;for(let i=0;i<28;i+=7){let s=e[t++];if(r|=(s&127)<<i,(s&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}let o=e[t++];if(r|=(o&15)<<28,n=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}for(let i=3;i<=31;i+=7){let s=e[t++];if(n|=(s&127)<<i,(s&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}throw new Error("invalid varint")}var Ic=4294967296;function cp(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(s,a){let c=Number(e.slice(s,a));o*=r,n=n*r+c,n>=Ic&&(o=o+(n/Ic|0),n=n%Ic)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?Iv(n,o):lp(n,o)}function Ev(e,t){let r=lp(e,t),n=r.hi&2147483648;n&&(r=Iv(r.lo,r.hi));let o=up(r.lo,r.hi);return n?"-"+o:o}function up(e,t){if({lo:e,hi:t}=i_(e,t),t<=2097151)return String(Ic*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,i=r+n*6777216+o*6710656,s=n+o*8147497,a=o*2,c=1e7;return i>=c&&(s+=Math.floor(i/c),i%=c),s>=c&&(a+=Math.floor(s/c),s%=c),a.toString()+Cv(s)+Cv(i)}function i_(e,t){return{lo:e>>>0,hi:t>>>0}}function lp(e,t){return{lo:e|0,hi:t|0}}function Iv(e,t){return t=~t,e?e=~e+1:t+=1,lp(e,t)}var Cv=e=>{let t=String(e);return"0000000".slice(t.length)+t};function Rv(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)===0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();f();p();var qt=s_();function s_(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!b.Deno||!!b.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(s){let a=typeof s=="bigint"?s:BigInt(s);if(a>n||a<r)throw new Error(`invalid int64: ${s}`);return a},uParse(s){let a=typeof s=="bigint"?s:BigInt(s);if(a>i||a<o)throw new Error(`invalid uint64: ${s}`);return a},enc(s){return e.setBigInt64(0,this.parse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(s){return e.setBigInt64(0,this.uParse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigInt64(0,!0)},uDec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),Tv(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),kv(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),Tv(r),cp(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),kv(r),cp(r)},dec(r,n){return Ev(r,n)},uDec(r,n){return up(r,n)}}}function Tv(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function kv(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var dp;function a_(e){var t;dp=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:fp(e.encodeUtf8.bind(e))})}function pp(){if(!dp){let e=b;if(!e.TextEncoder||!e.TextDecoder)throw new Error("encoding API missing: install TextEncoder and TextDecoder on globalThis");let t=new e.TextEncoder,r=new e.TextDecoder,n,o={encodeUtf8(s){return t.encode(s)},decodeUtf8(s,a){return a?(n||(n=new e.TextDecoder("utf-8",{fatal:!0})),n.decode(s)):r.decode(s)},checkUtf8(s){try{return encodeURIComponent(s),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let i=String.prototype.isWellFormed;i&&(o.checkUtf8=s=>i.call(s)),a_(o)}return dp}function fp(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var Or;(function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"})(Or||(Or={}));var c_=34028234663852886e22,u_=-34028234663852886e22,l_=4294967295,d_=2147483647,p_=-2147483648,ge=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?fp(t):pp().encodeUtf8Into,this.buffer=Ov,this.viewCache=m_,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||f_;for(;n<r;)n*=2;let o=new Uint8Array(n);this.pos>0&&o.set(this.buffer),this.buffer=o}}view(){let t=this.buffer,r=this.viewCache;if(r.byteLength===t.byteLength)return r;let n=new DataView(t.buffer);return this.viewCache=n,n}finish(){let t=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],t}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(Bi),this.buffer[this.pos++]=0,this}join(){let t=this.stackPos.pop();if(t===void 0)throw new Error("invalid state, fork stack empty");let r=this.pos-t-Bi,n=mp(r);return n>Bi&&(this.ensureCapacity(n-Bi),this.buffer.copyWithin(t+n,t+Bi,this.pos)),this.pos=t,this.uint32(r),this.pos+=r,this}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if(_v(t),this.ensureCapacity(5),t<128)return this.buffer[this.pos++]=t,this;for(;t>127;)this.buffer[this.pos++]=t&127|128,t>>>=7;return this.buffer[this.pos++]=t,this}int32(t){if(gp(t),t>=0)return this.uint32(t);this.ensureCapacity(10);for(let r=0;r<9;r++)this.buffer[this.pos++]=t&127|128,t>>=7;return this.buffer[this.pos++]=1,this}bool(t){return this.ensureCapacity(1),this.buffer[this.pos++]=t?1:0,this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){typeof t!="string"&&(t=String(t));let r=t.length;if(r<=Pv){this.ensureCapacity(r+1);let c=this.buffer,u=this.pos;c[u++]=r;let g=0;for(;g<r;g++){let v=t.charCodeAt(g);if(v>127)break;c[u++]=v}if(g==r)return this.pos=u,this}this.ensureCapacity(r*3+5);let n=mp(r),o=this.buffer,i=this.pos,{written:s}=this.encodeUtf8Into(t,o.subarray(i+n)),a=mp(s);return a!=n&&o.copyWithin(i+a,i+n,i+n+s),this.uint32(s),this.pos+=s,this}float(t){return g_(t),this.ensureCapacity(4),this.view().setFloat32(this.pos,t,!0),this.pos+=4,this}double(t){return this.ensureCapacity(8),this.view().setFloat64(this.pos,t,!0),this.pos+=8,this}fixed32(t){return _v(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return gp(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return gp(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=qt.enc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}fixed64(t){let r=qt.uEnc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}int64(t){let r=qt.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=qt.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return this.writeVarint64(o,i)}uint64(t){let r=qt.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let a=0;a<28;a=a+7){let c=t>>>a,u=!(!(c>>>7)&&r==0);if(n[o++]=(u?c|128:c)&255,!u)return this.pos=o,this}let i=t>>>28&15|(r&7)<<4,s=r>>3!=0;if(n[o++]=(s?i|128:i)&255,!s)return this.pos=o,this;for(let a=3;a<31;a=a+7){let c=r>>>a,u=!!(c>>>7);if(n[o++]=(u?c|128:c)&255,!u)return this.pos=o,this}return n[o++]=r>>>31&1,this.pos=o,this}},f_=128,Bi=1,Ov=new Uint8Array(0),m_=new DataView(Ov.buffer),Pv=32;function mp(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var X=class{constructor(t,r=pp().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=xv,this.uint32=Rv,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.pos,r=this.uint32(),n=this.pos-t;if(n>5||n==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=r>>>3,i=r&7;if(o<=0||i>5)throw new Error("illegal tag: field no "+o+" wire type "+i);return[o,i]}skip(t,r,n=100){let o=this.pos;switch(t){case Or.Varint:for(;this.buf[this.pos++]&128;);break;case Or.Bit64:this.pos+=4;case Or.Bit32:this.pos+=4;break;case Or.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Or.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[s,a]=this.tag();if(a===Or.EndGroup){if(r!==void 0&&s!==r)throw new Error("invalid end group tag");break}this.skip(a,s,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return this.varint64(),qt.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),qt.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,r=this.varint64Hi,n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,qt.dec(t,r)}bool(){let t=this.buf[this.pos];return t<128?(this.pos++,t!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return qt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return qt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){let r=this.bytes(),n=r.length;if(n<=Pv){let o=new Array(n);for(let i=0;i<n;i++){let s=r[i];if(s>127)return this.decodeUtf8(r,t);o[i]=s}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(r,t)}};function gp(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>d_||e<p_)throw new Error("invalid int32: "+e)}function _v(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>l_||e<0)throw new Error("invalid uint32: "+e)}function g_(e){if(typeof e=="string"){let t=e;if(e=Number(e),Number.isNaN(e)&&t!=="NaN")throw new Error("invalid float32: "+t)}else if(typeof e!="number")throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>c_||e<u_))throw new Error("invalid float32: "+e)}var h_=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function hp(){return{fields:{}}}var Gi={encode(e,t=new ge){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&Sp.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=hp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let s=Sp.decode(r,r.uint32());s.value!==void 0&&(o.fields[s.key]=s.value);continue}}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Gi.fromPartial(e??{})},fromPartial(e){let t=hp();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=hp();if(e!==void 0)for(let r of Object.keys(e))t.fields[r]=e[r];return t},unwrap(e){let t={};if(e.fields)for(let r of Object.keys(e.fields))t[r]=e.fields[r];return t}};function Nv(){return{key:"",value:void 0}}var Sp={encode(e,t=new ge){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&ie.encode(ie.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Nv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=r.string();continue;case 2:if(i!==18)break;o.value=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Sp.fromPartial(e??{})},fromPartial(e){let t=Nv();return t.key=e.key??"",t.value=e.value??void 0,t}};function yp(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var ie={encode(e,t=new ge){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&Gi.encode(Gi.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&$i.encode($i.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=yp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.nullValue=r.int32();continue;case 2:if(i!==17)break;o.numberValue=r.double();continue;case 3:if(i!==26)break;o.stringValue=r.string();continue;case 4:if(i!==32)break;o.boolValue=r.bool();continue;case 5:if(i!==42)break;o.structValue=Gi.unwrap(Gi.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=$i.unwrap($i.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ie.fromPartial(e??{})},fromPartial(e){let t=yp();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=yp();if(e===null)t.nullValue=h_.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(b.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new b.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function vp(){return{values:[]}}var $i={encode(e,t=new ge){for(let r of e.values)ie.encode(ie.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=vp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(ie.unwrap(ie.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return $i.fromPartial(e??{})},fromPartial(e){let t=vp();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=vp();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&b.Array.isArray(e.values)?e.values:e}},y_=function(e){return e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.REPLACE=2]="REPLACE",e[e.MOVE=3]="MOVE",e[e.COPY=4]="COPY",e[e.TEST=5]="TEST",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Fv(){return{op:0,path:"",from:void 0,value:void 0}}var Tc={encode(e,t=new ge){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&ie.encode(ie.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Fv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.op=r.int32();continue;case 2:if(i!==18)break;o.path=r.string();continue;case 3:if(i!==26)break;o.from=r.string();continue;case 4:if(i!==34)break;o.value=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Tc.fromPartial(e??{})},fromPartial(e){let t=Fv();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function Dv(){return{id:"",type:"",function:void 0}}var kc={encode(e,t=new ge){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&_c.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Dv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.type=r.string();continue;case 3:if(i!==26)break;o.function=_c.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return kc.fromPartial(e??{})},fromPartial(e){let t=Dv();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?_c.fromPartial(e.function):void 0,t}};function Mv(){return{name:"",arguments:""}}var _c={encode(e,t=new ge){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Mv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.name=r.string();continue;case 2:if(i!==18)break;o.arguments=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return _c.fromPartial(e??{})},fromPartial(e){let t=Mv();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function Lv(){return{value:"",mimeType:""}}var Oc={encode(e,t=new ge){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==""&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Lv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Oc.fromPartial(e??{})},fromPartial(e){let t=Lv();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function jv(){return{value:"",mimeType:void 0}}var Pc={encode(e,t=new ge){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=jv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Pc.fromPartial(e??{})},fromPartial(e){let t=jv();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function qv(){return{data:void 0,url:void 0}}var At={encode(e,t=new ge){return e.data!==void 0&&Oc.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Pc.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=qv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=Oc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=Pc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return At.fromPartial(e??{})},fromPartial(e){let t=qv();return t.data=e.data!==void 0&&e.data!==null?Oc.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Pc.fromPartial(e.url):void 0,t}};function Uv(){return{text:""}}var Nc={encode(e,t=new ge){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Uv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Nc.fromPartial(e??{})},fromPartial(e){let t=Uv();return t.text=e.text??"",t}};function Vv(){return{source:void 0,metadata:void 0}}var Fc={encode(e,t=new ge){return e.source!==void 0&&At.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ie.encode(ie.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Vv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Fc.fromPartial(e??{})},fromPartial(e){let t=Vv();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Bv(){return{source:void 0,metadata:void 0}}var Dc={encode(e,t=new ge){return e.source!==void 0&&At.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ie.encode(ie.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Bv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Dc.fromPartial(e??{})},fromPartial(e){let t=Bv();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Gv(){return{source:void 0,metadata:void 0}}var Mc={encode(e,t=new ge){return e.source!==void 0&&At.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ie.encode(ie.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Gv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Mc.fromPartial(e??{})},fromPartial(e){let t=Gv();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function $v(){return{source:void 0,metadata:void 0}}var Lc={encode(e,t=new ge){return e.source!==void 0&&At.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ie.encode(ie.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=$v();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Lc.fromPartial(e??{})},fromPartial(e){let t=$v();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Qv(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var jc={encode(e,t=new ge){return e.text!==void 0&&Nc.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Fc.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Dc.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Mc.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Lc.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Qv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=Nc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=Fc.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=Dc.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=Mc.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=Lc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return jc.fromPartial(e??{})},fromPartial(e){let t=Qv();return t.text=e.text!==void 0&&e.text!==null?Nc.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Fc.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Dc.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Mc.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Lc.fromPartial(e.document):void 0,t}};function Hv(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var qc={encode(e,t=new ge){e.id!==""&&t.uint32(10).string(e.id),e.role!==""&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let r of e.toolCalls)kc.encode(r,t.uint32(42).fork()).join();e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error);for(let r of e.contentParts)jc.encode(r,t.uint32(66).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Hv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.role=r.string();continue;case 3:if(i!==26)break;o.content=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue;case 5:if(i!==42)break;o.toolCalls.push(kc.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.toolCallId=r.string();continue;case 7:if(i!==58)break;o.error=r.string();continue;case 8:if(i!==66)break;o.contentParts.push(jc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return qc.fromPartial(e??{})},fromPartial(e){let t=Hv();return t.id=e.id??"",t.role=e.role??"",t.content=e.content??void 0,t.name=e.name??void 0,t.toolCalls=e.toolCalls?.map(r=>kc.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>jc.fromPartial(r))||[],t}};function zv(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0}}var Uc={encode(e,t=new ge){return e.id!==""&&t.uint32(10).string(e.id),e.reason!==""&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&ie.encode(ie.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&ie.encode(ie.wrap(e.metadata),t.uint32(58).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=zv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.reason=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.toolCallId=r.string();continue;case 5:if(i!==42)break;o.responseSchema=ie.unwrap(ie.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.expiresAt=r.string();continue;case 7:if(i!==58)break;o.metadata=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Uc.fromPartial(e??{})},fromPartial(e){let t=zv();return t.id=e.id??"",t.reason=e.reason??"",t.message=e.message??void 0,t.toolCallId=e.toolCallId??void 0,t.responseSchema=e.responseSchema??void 0,t.expiresAt=e.expiresAt??void 0,t.metadata=e.metadata??void 0,t}},v_=function(e){return e[e.TEXT_MESSAGE_START=0]="TEXT_MESSAGE_START",e[e.TEXT_MESSAGE_CONTENT=1]="TEXT_MESSAGE_CONTENT",e[e.TEXT_MESSAGE_END=2]="TEXT_MESSAGE_END",e[e.TOOL_CALL_START=3]="TOOL_CALL_START",e[e.TOOL_CALL_ARGS=4]="TOOL_CALL_ARGS",e[e.TOOL_CALL_END=5]="TOOL_CALL_END",e[e.STATE_SNAPSHOT=6]="STATE_SNAPSHOT",e[e.STATE_DELTA=7]="STATE_DELTA",e[e.MESSAGES_SNAPSHOT=8]="MESSAGES_SNAPSHOT",e[e.RAW=9]="RAW",e[e.CUSTOM=10]="CUSTOM",e[e.RUN_STARTED=11]="RUN_STARTED",e[e.RUN_FINISHED=12]="RUN_FINISHED",e[e.RUN_ERROR=13]="RUN_ERROR",e[e.STEP_STARTED=14]="STEP_STARTED",e[e.STEP_FINISHED=15]="STEP_FINISHED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Wv(){return{type:0,timestamp:void 0,rawEvent:void 0}}var ae={encode(e,t=new ge){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&ie.encode(ie.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Wv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.type=r.int32();continue;case 2:if(i!==16)break;o.timestamp=Ro(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ae.fromPartial(e??{})},fromPartial(e){let t=Wv();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function Kv(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var Vc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Kv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Vc.fromPartial(e??{})},fromPartial(e){let t=Kv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function Yv(){return{baseEvent:void 0,messageId:"",delta:""}}var Bc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Yv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Bc.fromPartial(e??{})},fromPartial(e){let t=Yv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function Xv(){return{baseEvent:void 0,messageId:""}}var Gc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Xv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Gc.fromPartial(e??{})},fromPartial(e){let t=Xv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function Zv(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var $c={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Zv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return $c.fromPartial(e??{})},fromPartial(e){let t=Zv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function Jv(){return{baseEvent:void 0,toolCallId:"",delta:""}}var Qc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Jv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Qc.fromPartial(e??{})},fromPartial(e){let t=Jv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function eS(){return{baseEvent:void 0,toolCallId:""}}var Hc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=eS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Hc.fromPartial(e??{})},fromPartial(e){let t=eS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function tS(){return{baseEvent:void 0,snapshot:void 0}}var zc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&ie.encode(ie.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=tS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return zc.fromPartial(e??{})},fromPartial(e){let t=tS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function rS(){return{baseEvent:void 0,delta:[]}}var Wc={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)Tc.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=rS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(Tc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Wc.fromPartial(e??{})},fromPartial(e){let t=rS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>Tc.fromPartial(r))||[],t}};function nS(){return{baseEvent:void 0,messages:[]}}var Kc={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)qc.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=nS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(qc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Kc.fromPartial(e??{})},fromPartial(e){let t=nS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>qc.fromPartial(r))||[],t}};function oS(){return{baseEvent:void 0,event:void 0,source:void 0}}var Yc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&ie.encode(ie.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=oS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=ie.unwrap(ie.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.source=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Yc.fromPartial(e??{})},fromPartial(e){let t=oS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function iS(){return{baseEvent:void 0,name:"",value:void 0}}var Xc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&ie.encode(ie.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=iS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Xc.fromPartial(e??{})},fromPartial(e){let t=iS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function sS(){return{baseEvent:void 0,threadId:"",runId:""}}var Zc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=sS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Zc.fromPartial(e??{})},fromPartial(e){let t=sS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function aS(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var In={encode(e,t=new ge){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=aS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.provider=r.string();continue;case 2:if(i!==18)break;o.model=r.string();continue;case 3:if(i!==24)break;o.inputTokens=Ro(r.int64());continue;case 4:if(i!==32)break;o.outputTokens=Ro(r.int64());continue;case 5:if(i!==40)break;o.totalTokens=Ro(r.int64());continue;case 6:if(i!==48)break;o.reasoningTokens=Ro(r.int64());continue;case 7:if(i!==56)break;o.cachedInputTokens=Ro(r.int64());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return In.fromPartial(e??{})},fromPartial(e){let t=aS();return t.provider=e.provider??void 0,t.model=e.model??void 0,t.inputTokens=e.inputTokens??void 0,t.outputTokens=e.outputTokens??void 0,t.totalTokens=e.totalTokens??void 0,t.reasoningTokens=e.reasoningTokens??void 0,t.cachedInputTokens=e.cachedInputTokens??void 0,t}};function cS(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var Jc={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&ie.encode(ie.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)Uc.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)In.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=cS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue;case 4:if(i!==34)break;o.result=ie.unwrap(ie.decode(r,r.uint32()));continue;case 5:if(i!==42)break;o.outcome=r.string();continue;case 6:if(i!==50)break;o.interrupts.push(Uc.decode(r,r.uint32()));continue;case 7:if(i!==58)break;o.usage.push(In.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Jc.fromPartial(e??{})},fromPartial(e){let t=cS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interrupts=e.interrupts?.map(r=>Uc.fromPartial(r))||[],t.usage=e.usage?.map(r=>In.fromPartial(r))||[],t}};function uS(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var eu={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message);for(let r of e.usage)In.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=uS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.code=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.usage.push(In.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return eu.fromPartial(e??{})},fromPartial(e){let t=uS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>In.fromPartial(r))||[],t}};function lS(){return{baseEvent:void 0,stepName:""}}var tu={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=lS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return tu.fromPartial(e??{})},fromPartial(e){let t=lS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function dS(){return{baseEvent:void 0,stepName:""}}var ru={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=dS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ru.fromPartial(e??{})},fromPartial(e){let t=dS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function pS(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var nu={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=pS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.delta=r.string();continue;case 5:if(i!==42)break;o.name=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return nu.fromPartial(e??{})},fromPartial(e){let t=pS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t}};function fS(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var ou={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=fS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue;case 5:if(i!==42)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ou.fromPartial(e??{})},fromPartial(e){let t=fS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function mS(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0}}var gS={encode(e,t=new ge){return e.textMessageStart!==void 0&&Vc.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Bc.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Gc.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&$c.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Qc.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Hc.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&zc.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Wc.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Kc.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Yc.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Xc.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Zc.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Jc.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&eu.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&tu.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&ru.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&nu.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&ou.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=mS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=Vc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=Bc.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=Gc.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=$c.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=Qc.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=Hc.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=zc.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Wc.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=Kc.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Yc.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Xc.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Zc.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Jc.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=eu.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=tu.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=ru.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=nu.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=ou.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return gS.fromPartial(e??{})},fromPartial(e){let t=mS();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Vc.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Bc.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Gc.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?$c.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Qc.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Hc.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?zc.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Wc.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Kc.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Yc.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Xc.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Zc.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Jc.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?eu.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?tu.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?ru.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?nu.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?ou.fromPartial(e.toolCallChunk):void 0,t}};function Ro(e){let t=b.Number(e.toString());if(t>b.Number.MAX_SAFE_INTEGER)throw new b.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<b.Number.MIN_SAFE_INTEGER)throw new b.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var hS=e=>e&&typeof e=="object"?e:void 0;var Rc=e=>{let t=hS(e);if(t){if(t.data){let r=t.data;return{type:"data",value:r.value,mimeType:r.mimeType}}if(t.url){let r=t.url;return{type:"url",value:r.value,mimeType:r.mimeType}}}},S_=e=>{let t=hS(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:Rc(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:Rc(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:Rc(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:Rc(r.source),metadata:r.metadata}}}};function yS(e){let t=gS.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=v_[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,delete r.baseEvent,r.type===D.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;if(o.role==="user"&&Array.isArray(o.contentParts)){let i=o.contentParts.map(s=>S_(s)).filter(s=>s!==void 0);i.length>0&&(o.content=i)}Array.isArray(o.contentParts)&&o.contentParts.length===0&&(o.contentParts=void 0),o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===D.RUN_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,i=Array.isArray(n.interrupts)?n.interrupts:[];delete n.interrupts,o==="interrupt"?n.outcome={type:"interrupt",interrupts:i}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if((r.type===D.RUN_FINISHED||r.type===D.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===D.STATE_DELTA)for(let n of r.delta)n.op=y_[n.op].toLowerCase(),Object.keys(n).forEach(o=>{n[o]===void 0&&delete n[o]});return Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n]}),Qa.parse(r)}var Ap="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var b_=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,bp=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(b_);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},vS=e=>e==="*"||e==="x"||e==="X",SS=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},w_=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],C_=(e,t)=>{if(vS(e)||vS(t))return 0;let[r,n]=w_(SS(e),SS(t));return r>n?1:r<n?-1:0},wp=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=C_(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Qi=(e,t)=>{let r=bp(e),n=bp(t),o=r.pop(),i=n.pop(),s=wp(r,n);return s!==0?s:o&&i?wp(o.split("."),i.split(".")):o||i?o?-1:1:0};var we=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function Hi(){return Ir()}function Ep(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&Ep(t);return e}var AS=512*1024;function bS(e,t,r){let n=0,o=[e,t],i=new WeakSet;for(;o.length>0;){let s=o.pop();if(typeof s=="string"){if(n+=s.length,n>r)return!0}else if(typeof s=="object"&&s){if(i.has(s))continue;if(i.add(s),Array.isArray(s))for(let a=0;a<s.length;a++)o.push(s[a]);else{let a=Object.keys(s);for(let c=0;c<a.length;c++){let u=a[c];if(n+=u.length,n>r)return!0;o.push(s[u])}}}}return!1}function Te(_x83,_x84,_x85,_x86){return _Te.apply(this,arguments)}function _Te(){_Te=_asyncToGenerator(function*(e,t,r,n){let o=typeof process<"u"&&process.env!==void 0,i=o&&!!process.env.VITEST_WORKER_ID,s=o&&!!process.env.VITEST_WORKER_ID,a=s&&!bS(t,r,AS),c=a?we(t):t,u=a?we(r):r,g=!1,v=!1,w;for(let h of e)try{a&&(Ep(c),Ep(u));let y=yield n(h,c,u);if(y===void 0)continue;let S=!1;if(y.messages!==void 0&&y.messages!==c&&(c=we(y.messages),g=!0,S=!0),y.state!==void 0&&y.state!==u&&(u=we(y.state),v=!0,S=!0),a&&S&&bS(c,u,AS)&&(a=!1),w=y.stopPropagation,w===!0)break}catch(y){if(s&&y instanceof TypeError){if(i)throw y;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",y)}else i||console.error("Subscriber error:",y);continue}return{...(g?{messages:Object.isFrozen(c)?we(c):c}:{}),...(v?{state:Object.isFrozen(u)?we(u):u}:{}),...(w===void 0?{}:{stopPropagation:w})}});return _Te.apply(this,arguments)}function iu(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,r=e.lifecycle??!0,n=e.verbose??!1;return{enabled:t||r,events:t,lifecycle:r,verbose:n}}function zi(e){if(e instanceof Ip)return e;if(e===!0)return new Ip(iu(!0))}var Ip=class{constructor(e){this.config=e}event(e,t,r,n){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof r=="string"?r:JSON.stringify(r)):console.debug(`[${e}] ${t}`,n??r))}lifecycle(e,t,r){this.config.lifecycle&&(r?console.debug(`[${e}] ${t}`,r):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function Cp(e){return e.enabled?new Ip(e):void 0}function x_(e,t,r){if(t){let o=e.find(s=>s.id===t);if(o?.role==="assistant")return o;o&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${o.role}' message, not assistant \u2014 falling back to toolCallId`);let i={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(i),i}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}var RS=(e,t,r,n,o)=>{let i=zi(o),s=we(r.messages),a=we(e.state),c={},u=v=>{v.messages!==void 0&&(s=v.messages,c.messages=v.messages),v.state!==void 0&&(a=v.state,c.state=v.state)},g=()=>{let v=we(c);return c={},v.messages!==void 0||v.state!==void 0?qe(v):cc};return t.pipe(Cc(/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(v){let w=yield Te(n,s,a,(h,y,S)=>h.onEvent?.({event:v,agent:r,input:e,messages:y,state:S}));if(u(w),w.stopPropagation===!0?i?.event("APPLY","Event dropped:",v,{type:v.type,reason:"stopPropagation by subscriber"}):i?.event("APPLY","Event applied:",v,{type:v.type,subscribers:n.length}),w.stopPropagation===!0)return g();switch(v.type){case D.TEXT_MESSAGE_START:{let h=yield Te(n,s,a,(y,S,x)=>y.onTextMessageStartEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{messageId:y,role:S="assistant",name:x}=v;if(!s.find(I=>I.id===y)){let I={id:y,role:S,content:"",...(x!==void 0&&{name:x})};s.push(I),u({messages:s})}}return g()}case D.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,S=s.find(I=>I.id===h);if(!S)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let x=yield Te(n,s,a,(I,_,R)=>I.onTextMessageContentEvent?.({event:v,messages:_,state:R,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}));return u(x),x.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${y}`,u({messages:s})),g()}case D.TEXT_MESSAGE_END:{let{messageId:h}=v,y=s.find(S=>S.id===h);return y?(u(yield Te(n,s,a,(S,x,I)=>S.onTextMessageEndEvent?.({event:v,messages:x,state:I,agent:r,input:e,textMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(S=>{S.onNewMessage?.({message:y,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g())}case D.TOOL_CALL_START:{let h=yield Te(n,s,a,(y,S,x)=>y.onToolCallStartEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:S,parentMessageId:x}=v,I=s.find(R=>R.toolCalls?.some(T=>T.id===y))?.toolCalls?.find(R=>R.id===y);if(I)return I.function.name!==S&&(console.warn(`TOOL_CALL_START: tool call '${y}' already exists with name '${I.function.name}' \u2014 updating it to '${S}'`),I.function.name=S,u({messages:s})),g();let _=x_(s,x,y);_.toolCalls??(_.toolCalls=[]),_.toolCalls.push({id:y,type:"function",function:{name:S,arguments:""}}),u({messages:s})}return g()}case D.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=v,S=s.find(_=>_.toolCalls?.some(R=>R.id===h));if(!S)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let x=S.toolCalls?.find(_=>_.id===h);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=yield Te(n,s,a,(_,R,T)=>{let k=x.function.arguments,F=x.function.name,V={};try{V=Ec(k)}catch{}return _.onToolCallArgsEvent?.({event:v,messages:R,state:T,agent:r,input:e,toolCallBuffer:k,toolCallName:F,partialToolCallArgs:V})});return u(I),I.stopPropagation!==!0&&(x.function.arguments+=y,u({messages:s})),g()}case D.TOOL_CALL_END:{let{toolCallId:h}=v,y=s.find(x=>x.toolCalls?.some(I=>I.id===h));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let S=y.toolCalls?.find(x=>x.id===h);return S?(u(yield Te(n,s,a,(x,I,_)=>{let R=S.function.arguments,T=S.function.name,k={};try{k=JSON.parse(R)}catch{}return x.onToolCallEndEvent?.({event:v,messages:I,state:_,agent:r,input:e,toolCallName:T,toolCallArgs:k})})),yield Promise.all(n.map(x=>{x.onNewToolCall?.({toolCall:S,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g())}case D.TOOL_CALL_RESULT:{let h=yield Te(n,s,a,(y,S,x)=>y.onToolCallResultEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:S,content:x,role:I}=v,_={id:y,toolCallId:S,role:I||"tool",content:x},R=s.findIndex(T=>T.role==="assistant"&&T.toolCalls?.some(k=>k.id===S));if(R===-1)s.push(_);else{let T=R+1;for(;T<s.length&&s[T].role==="tool";)T++;s.splice(T,0,_)}yield Promise.all(n.map(T=>{T.onNewMessage?.({message:_,messages:s,state:a,agent:r,input:e})})),u({messages:s})}return g()}case D.STATE_SNAPSHOT:{let h=yield Te(n,s,a,(y,S,x)=>y.onStateSnapshotEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{snapshot:y}=v;a=y,u({state:a})}return g()}case D.STATE_DELTA:{let h=yield Te(n,s,a,(y,S,x)=>y.onStateDeltaEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{delta:y}=v;try{a=Ja.applyPatch(a,y,!0,!1).newDocument,u({state:a})}catch(S){let x=S instanceof Error?S.message:String(S);console.warn(`Failed to apply state patch:
35
+ `):"",this.name="UnsubscriptionError",this.errors=r}});m();d();f();p();function ji(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Co=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=mr(s),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(S){t={error:S}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var g=this.initialTeardown;if(Se(g))try{g()}catch(S){i=S instanceof nc?S.errors:[S]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var w=mr(v),h=w.next();!h.done;h=w.next()){var y=h.value;try{sv(y)}catch(S){i=i??[],S instanceof nc?i=bo(bo([],Ao(i)),Ao(S.errors)):i.push(S)}}}catch(S){n={error:S}}finally{try{h&&!h.done&&(o=w.return)&&o.call(w)}finally{if(n)throw n.error}}}if(i)throw new nc(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)sv(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&ji(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&ji(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var tp=Co.EMPTY;function oc(e){return e instanceof Co||e&&"closed"in e&&Se(e.remove)&&Se(e.add)&&Se(e.unsubscribe)}function sv(e){Se(e)?e():e.unsubscribe()}m();d();f();p();var jt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var xo={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=xo.delegate;return o?.setTimeout?o.setTimeout.apply(o,bo([e,t],Ao(r))):setTimeout.apply(void 0,bo([e,t],Ao(r)))},clearTimeout:function(e){var t=xo.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function ic(e){xo.setTimeout(function(){var t=jt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function qi(){}m();d();f();p();var av=function(){return rp("C",void 0,void 0)}();function cv(e){return rp("E",void 0,e)}function uv(e){return rp("N",e,void 0)}function rp(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var wn=null;function Eo(e){if(jt.useDeprecatedSynchronousErrorHandling){var t=!wn;if(t&&(wn={errorThrown:!1,error:null}),e(),t){var r=wn,n=r.errorThrown,o=r.error;if(wn=null,n)throw o}}else e()}function lv(e){jt.useDeprecatedSynchronousErrorHandling&&wn&&(wn.errorThrown=!0,wn.error=e)}var Ui=function(e){Yt(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,oc(r)&&r.add(n)):n.destination=e_,n}return t.create=function(r,n,o){return new ac(r,n,o)},t.prototype.next=function(r){this.isStopped?op(uv(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?op(cv(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?op(av,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}(Co);var X0=Function.prototype.bind;function np(e,t){return X0.call(e,t)}var Z0=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){sc(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){sc(n)}else sc(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){sc(r)}},e}(),ac=function(e){Yt(t,e);function t(r,n,o){var i=e.call(this)||this,s;if(Se(r)||!r)s={next:r??void 0,error:n??void 0,complete:o??void 0};else{var a;i&&jt.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return i.unsubscribe()},s={next:r.next&&np(r.next,a),error:r.error&&np(r.error,a),complete:r.complete&&np(r.complete,a)}):s=r}return i.destination=new Z0(s),i}return t}(Ui);function sc(e){jt.useDeprecatedSynchronousErrorHandling?lv(e):ic(e)}function J0(e){throw e}function op(e,t){var r=jt.onStoppedNotification;r&&xo.setTimeout(function(){return r(e,t)})}var e_={closed:!0,next:qi,error:J0,complete:qi};m();d();f();p();var Io=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function Ro(e){return e}function cc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ip(e)}function ip(e){return e.length===0?Ro:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var De=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var o=this,i=r_(t)?t:new ac(t,r,n);return Eo(function(){var s=o,a=s.operator,c=s.source;i.add(a?a.call(i,c):c?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=dv(r),new r(function(o,i){var s=new ac({next:function(a){try{t(a)}catch(c){i(c),s.unsubscribe()}},error:i,complete:o});n.subscribe(s)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[Io]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return ip(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=dv(t),new t(function(n,o){var i;r.subscribe(function(s){return i=s},function(s){return o(s)},function(){return n(i)})})},e.create=function(t){return new e(t)},e}();function dv(e){var t;return(t=e??jt.Promise)!==null&&t!==void 0?t:Promise}function t_(e){return e&&Se(e.next)&&Se(e.error)&&Se(e.complete)}function r_(e){return e&&e instanceof Ui||t_(e)&&oc(e)}m();d();f();p();function n_(e){return Se(e?.lift)}function Ge(e){return function(t){if(n_(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 o_(e,t,r,n,o)}var o_=function(e){Yt(t,e);function t(r,n,o,i,s,a){var c=e.call(this,r)||this;return c.onFinalize=s,c.shouldUnsubscribe=a,c._next=n?function(u){try{n(u)}catch(g){r.error(g)}}:e.prototype._next,c._error=i?function(u){try{i(u)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=o?function(){try{o()}catch(u){r.error(u)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(Ui);m();d();f();p();m();d();f();p();var pv=wo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Xt=function(e){Yt(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new fv(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new pv},t.prototype.next=function(r){var n=this;Eo(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=mr(n.currentObservers),a=s.next();!a.done;a=s.next()){var c=a.value;c.next(r)}}catch(u){o={error:u}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;Eo(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;Eo(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?tp:(this.currentObservers=null,a.push(r),new Co(function(){n.currentObservers=null,ji(a,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},t.prototype.asObservable=function(){var r=new De;return r.source=this,r},t.create=function(r,n){return new fv(r,n)},t}(De);var fv=function(e){Yt(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:tp},t}(Xt);m();d();f();p();m();d();f();p();var sp={now:function(){return(sp.delegate||Date).now()},delegate:void 0};var uc=function(e){Yt(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=sp);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,c=n._windowTime;o||(i.push(r),!s&&i.push(a.now()+c)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),c=0;c<a.length&&!r.closed;c+=i?1:2)r.next(a[c]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,i=r._buffer,s=r._infiniteTimeWindow,a=(s?1:2)*n;if(n<1/0&&a<i.length&&i.splice(0,i.length-a),!s){for(var c=o.now(),u=0,g=1;g<i.length&&i[g]<=c;g+=2)u=g;u&&i.splice(0,u+1)}},t}(Xt);m();d();f();p();var lc=new De(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function mv(e){return e&&Se(e.schedule)}function i_(e){return e[e.length-1]}function gv(e){return mv(i_(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 dc=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function pc(e){return Se(e?.then)}m();d();f();p();function fc(e){return Se(e[Io])}m();d();f();p();function mc(e){return Symbol.asyncIterator&&Se(e?.[Symbol.asyncIterator])}m();d();f();p();function gc(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 s_(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var hc=s_();function yc(e){return Se(e?.[hc])}m();d();f();p();function vc(e){return ov(this,arguments,function(){var r,n,o,i;return rc(this,function(s){switch(s.label){case 0:r=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,bn(r.read())];case 3:return n=s.sent(),o=n.value,i=n.done,i?[4,bn(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,bn(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function Sc(e){return Se(e?.getReader)}function Ke(e){if(e instanceof De)return e;if(e!=null){if(fc(e))return a_(e);if(dc(e))return c_(e);if(pc(e))return u_(e);if(mc(e))return hv(e);if(yc(e))return l_(e);if(Sc(e))return d_(e)}throw gc(e)}function a_(e){return new De(function(t){var r=e[Io]();if(Se(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function c_(e){return new De(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function u_(e){return new De(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,ic)})}function l_(e){return new De(function(t){var r,n;try{for(var o=mr(e),i=o.next();!i.done;i=o.next()){var s=i.value;if(t.next(s),t.closed)return}}catch(a){r={error:a}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function hv(e){return new De(function(t){p_(e,t).catch(function(r){return t.error(r)})})}function d_(e){return hv(vc(e))}function p_(e,t){var r,n,o,i;return nv(this,void 0,void 0,function(){var s,a;return rc(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=iv(e),c.label=1;case 1:return[4,r.next()];case 2:if(n=c.sent(),!!n.done)return[3,4];if(s=n.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}m();d();f();p();m();d();f();p();function Tt(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!o)return i}function Ac(e,t){return t===void 0&&(t=0),Ge(function(r,n){r.subscribe(We(n,function(o){return Tt(n,e,function(){return n.next(o)},t)},function(){return Tt(n,e,function(){return n.complete()},t)},function(o){return Tt(n,e,function(){return n.error(o)},t)}))})}m();d();f();p();function bc(e,t){return t===void 0&&(t=0),Ge(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function yv(e,t){return Ke(e).pipe(bc(t),Ac(t))}m();d();f();p();function vv(e,t){return Ke(e).pipe(bc(t),Ac(t))}m();d();f();p();function Sv(e,t){return new De(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}m();d();f();p();function Av(e,t){return new De(function(r){var n;return Tt(r,t,function(){n=e[hc](),Tt(r,t,function(){var o,i,s;try{o=n.next(),i=o.value,s=o.done}catch(a){r.error(a);return}s?r.complete():r.next(i)},0,!0)}),function(){return Se(n?.return)&&n.return()}})}m();d();f();p();function wc(e,t){if(!e)throw new Error("Iterable cannot be null");return new De(function(r){Tt(r,t,function(){var n=e[Symbol.asyncIterator]();Tt(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}m();d();f();p();function bv(e,t){return wc(vc(e),t)}function wv(e,t){if(e!=null){if(fc(e))return yv(e,t);if(dc(e))return Sv(e,t);if(pc(e))return vv(e,t);if(mc(e))return wc(e,t);if(yc(e))return Av(e,t);if(Sc(e))return bv(e,t)}throw gc(e)}function Cn(e,t){return t?wv(e,t):Ke(e)}function qe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=gv(e);return Cn(e,r)}m();d();f();p();function Me(e,t){var r=Se(e)?e:function(){return e},n=function(o){return o.error(r())};return new De(t?function(o){return t.schedule(n,0,o)}:n)}m();d();f();p();m();d();f();p();var Cv=wo(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Cc(e,t){var r=typeof t=="object";return new Promise(function(n,o){var i=!1,s;e.subscribe({next:function(a){s=a,i=!0},error:o,complete:function(){i?n(s):r?n(t.defaultValue):o(new Cv)}})})}m();d();f();p();function xn(e,t){return Ge(function(r,n){var o=0;r.subscribe(We(n,function(i){n.next(e.call(t,i,o++))}))})}m();d();f();p();m();d();f();p();m();d();f();p();function xv(e,t,r,n,o,i,s,a){var c=[],u=0,g=0,v=!1,w=function(){v&&!c.length&&!u&&t.complete()},h=function(S){return u<n?y(S):c.push(S)},y=function(S){i&&t.next(S),u++;var x=!1;Ke(r(S,g++)).subscribe(We(t,function(I){o?.(I),i?h(I):t.next(I)},function(){x=!0},void 0,function(){if(x)try{u--;for(var I=function(){var _=c.shift();s?Tt(t,s,function(){return y(_)}):y(_)};c.length&&u<n;)I();w()}catch(_){t.error(_)}}))};return e.subscribe(We(t,h,function(){v=!0,w()})),function(){a?.()}}function pt(e,t,r){return r===void 0&&(r=1/0),Se(t)?pt(function(n,o){return xn(function(i,s){return t(n,i,o,s)})(Ke(e(n,o)))},r):(typeof t=="number"&&(r=t),Ge(function(n,o){return xv(n,o,e,r)}))}function ap(e){return e===void 0&&(e=1/0),pt(Ro,e)}m();d();f();p();function xc(e){return new De(function(t){Ke(e()).subscribe(t)})}m();d();f();p();function Vi(e){return Ge(function(t,r){var n=null,o=!1,i;n=t.subscribe(We(r,void 0,void 0,function(s){i=Ke(e(s,Vi(e)(t))),n?(n.unsubscribe(),n=null,i.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(r))})}m();d();f();p();function Ec(e,t){return Se(t)?pt(e,t,1):pt(e,1)}m();d();f();p();function cp(e){return Ge(function(t,r){var n=!1;t.subscribe(We(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}m();d();f();p();function En(e){return Ge(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function up(e,t){return Ge(function(r,n){var o=null,i=0,s=!1,a=function(){return s&&!o&&n.complete()};r.subscribe(We(n,function(c){o?.unsubscribe();var u=0,g=i++;Ke(e(c,g)).subscribe(o=We(n,function(v){return n.next(t?t(c,v,g,u++):v)},function(){o=null,a()}))},function(){s=!0,a()}))})}m();d();f();p();function Ic(e){return Ge(function(t,r){Ke(e).subscribe(We(r,function(){return r.complete()},qi)),!r.closed&&t.subscribe(r)})}m();d();f();p();function lp(e,t,r){var n=Se(e)||t||r?{next:e,error:t,complete:r}:e;return n?Ge(function(o,i){var s;(s=n.subscribe)===null||s===void 0||s.call(n);var a=!0;o.subscribe(We(i,function(c){var u;(u=n.next)===null||u===void 0||u.call(n,c),i.next(c)},function(){var c;a=!1,(c=n.complete)===null||c===void 0||c.call(n),i.complete()},function(c){var u;a=!1,(u=n.error)===null||u===void 0||u.call(n,c),i.error(c)},function(){var c,u;a&&((c=n.unsubscribe)===null||c===void 0||c.call(n)),(u=n.finalize)===null||u===void 0||u.call(n)}))}):Ro}m();d();f();p();m();d();f();p();function Ev(e){return` \r
36
+ `.indexOf(e)>=0}function Rc(e){for(var t=["topLevel"],r=0,n,o,i,s=function(_){return t.push(_)},a=function(_){return t[t.length-1]=_},c=function(_){n==null&&(n=r,o=t.length,i=_)},u=function(_){_===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},w=function(_){if("0"<=_&&_<="9"){s("number");return}switch(_){case"\"":s("string");return;case"-":s("numberNeedsDigit");return;case"t":s("true");return;case"f":s("false");return;case"n":s("null");return;case"[":s("arrayNeedsValue");return;case"{":s("objectNeedsKey");return}},h=e.length;r<h;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":w(y);break;case"string":switch(y){case"\"":g();break;case"\\":c("stringEscape"),s("stringEscaped");break}break;case"stringEscaped":y==="u"?s("stringUnicode"):(u("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(u("stringEscape"),g());break;case"number":y==="."?a("numberNeedsDigit"):y==="e"||y==="E"?a("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),g());break;case"numberNeedsDigit":a("number");break;case"numberNeedsExponent":a(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),g());break;case"arrayNeedsValue":y==="]"?g():Ev(y)||(u("collectionItem"),a("arrayNeedsComma"),w(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(c("collectionItem"),a("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(c("collectionItem"),a("objectNeedsColon"),s("string"));break;case"objectNeedsColon":y===":"&&a("objectNeedsValue");break;case"objectNeedsValue":Ev(y)||(u("collectionItem"),a("objectNeedsComma"),w(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(c("collectionItem"),a("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var S=[n!=null?e.slice(0,n):e],x=function(_){return S.push(_.slice(e.length-e.lastIndexOf(_[0])))},I=t.length-1;I>=0;I--)switch(t[I]){case"string":S.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":S.push("0");break;case"true":x("true");break;case"false":x("false");break;case"null":x("null");break;case"arrayNeedsValue":case"arrayNeedsComma":S.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":S.push("}");break}return S.join("")}m();d();f();p();m();d();f();p();m();d();f();p();function Rv(){let e=this.buf,t=this.pos,r=0,n=0;for(let i=0;i<28;i+=7){let s=e[t++];if(r|=(s&127)<<i,(s&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}let o=e[t++];if(r|=(o&15)<<28,n=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}for(let i=3;i<=31;i+=7){let s=e[t++];if(n|=(s&127)<<i,(s&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}throw new Error("invalid varint")}var Tc=4294967296;function dp(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(s,a){let c=Number(e.slice(s,a));o*=r,n=n*r+c,n>=Tc&&(o=o+(n/Tc|0),n=n%Tc)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?kv(n,o):fp(n,o)}function Tv(e,t){let r=fp(e,t),n=r.hi&2147483648;n&&(r=kv(r.lo,r.hi));let o=pp(r.lo,r.hi);return n?"-"+o:o}function pp(e,t){if({lo:e,hi:t}=f_(e,t),t<=2097151)return String(Tc*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,i=r+n*6777216+o*6710656,s=n+o*8147497,a=o*2,c=1e7;return i>=c&&(s+=Math.floor(i/c),i%=c),s>=c&&(a+=Math.floor(s/c),s%=c),a.toString()+Iv(s)+Iv(i)}function f_(e,t){return{lo:e>>>0,hi:t>>>0}}function fp(e,t){return{lo:e|0,hi:t|0}}function kv(e,t){return t=~t,e?e=~e+1:t+=1,fp(e,t)}var Iv=e=>{let t=String(e);return"0000000".slice(t.length)+t};function _v(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)===0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();f();p();var qt=m_();function m_(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!b.Deno||!!b.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(s){let a=typeof s=="bigint"?s:BigInt(s);if(a>n||a<r)throw new Error(`invalid int64: ${s}`);return a},uParse(s){let a=typeof s=="bigint"?s:BigInt(s);if(a>i||a<o)throw new Error(`invalid uint64: ${s}`);return a},enc(s){return e.setBigInt64(0,this.parse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(s){return e.setBigInt64(0,this.uParse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigInt64(0,!0)},uDec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),Ov(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),Pv(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),Ov(r),dp(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),Pv(r),dp(r)},dec(r,n){return Tv(r,n)},uDec(r,n){return pp(r,n)}}}function Ov(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function Pv(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var mp;function g_(e){var t;mp=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:hp(e.encodeUtf8.bind(e))})}function gp(){if(!mp){let e=b;if(!e.TextEncoder||!e.TextDecoder)throw new Error("encoding API missing: install TextEncoder and TextDecoder on globalThis");let t=new e.TextEncoder,r=new e.TextDecoder,n,o={encodeUtf8(s){return t.encode(s)},decodeUtf8(s,a){return a?(n||(n=new e.TextDecoder("utf-8",{fatal:!0})),n.decode(s)):r.decode(s)},checkUtf8(s){try{return encodeURIComponent(s),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let i=String.prototype.isWellFormed;i&&(o.checkUtf8=s=>i.call(s)),g_(o)}return mp}function hp(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var Or;(function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"})(Or||(Or={}));var h_=34028234663852886e22,y_=-34028234663852886e22,v_=4294967295,S_=2147483647,A_=-2147483648,ge=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?hp(t):gp().encodeUtf8Into,this.buffer=Fv,this.viewCache=w_,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||b_;for(;n<r;)n*=2;let o=new Uint8Array(n);this.pos>0&&o.set(this.buffer),this.buffer=o}}view(){let t=this.buffer,r=this.viewCache;if(r.byteLength===t.byteLength)return r;let n=new DataView(t.buffer);return this.viewCache=n,n}finish(){let t=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],t}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(Bi),this.buffer[this.pos++]=0,this}join(){let t=this.stackPos.pop();if(t===void 0)throw new Error("invalid state, fork stack empty");let r=this.pos-t-Bi,n=yp(r);return n>Bi&&(this.ensureCapacity(n-Bi),this.buffer.copyWithin(t+n,t+Bi,this.pos)),this.pos=t,this.uint32(r),this.pos+=r,this}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if(Nv(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(vp(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<=Dv){this.ensureCapacity(r+1);let c=this.buffer,u=this.pos;c[u++]=r;let g=0;for(;g<r;g++){let v=t.charCodeAt(g);if(v>127)break;c[u++]=v}if(g==r)return this.pos=u,this}this.ensureCapacity(r*3+5);let n=yp(r),o=this.buffer,i=this.pos,{written:s}=this.encodeUtf8Into(t,o.subarray(i+n)),a=yp(s);return a!=n&&o.copyWithin(i+a,i+n,i+n+s),this.uint32(s),this.pos+=s,this}float(t){return C_(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 Nv(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return vp(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return vp(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=qt.enc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}fixed64(t){let r=qt.uEnc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}int64(t){let r=qt.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=qt.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return this.writeVarint64(o,i)}uint64(t){let r=qt.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let a=0;a<28;a=a+7){let c=t>>>a,u=!(!(c>>>7)&&r==0);if(n[o++]=(u?c|128:c)&255,!u)return this.pos=o,this}let i=t>>>28&15|(r&7)<<4,s=r>>3!=0;if(n[o++]=(s?i|128:i)&255,!s)return this.pos=o,this;for(let a=3;a<31;a=a+7){let c=r>>>a,u=!!(c>>>7);if(n[o++]=(u?c|128:c)&255,!u)return this.pos=o,this}return n[o++]=r>>>31&1,this.pos=o,this}},b_=128,Bi=1,Fv=new Uint8Array(0),w_=new DataView(Fv.buffer),Dv=32;function yp(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var X=class{constructor(t,r=gp().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=Rv,this.uint32=_v,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.pos,r=this.uint32(),n=this.pos-t;if(n>5||n==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=r>>>3,i=r&7;if(o<=0||i>5)throw new Error("illegal tag: field no "+o+" wire type "+i);return[o,i]}skip(t,r,n=100){let o=this.pos;switch(t){case Or.Varint:for(;this.buf[this.pos++]&128;);break;case Or.Bit64:this.pos+=4;case Or.Bit32:this.pos+=4;break;case Or.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Or.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[s,a]=this.tag();if(a===Or.EndGroup){if(r!==void 0&&s!==r)throw new Error("invalid end group tag");break}this.skip(a,s,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return this.varint64(),qt.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),qt.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,r=this.varint64Hi,n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,qt.dec(t,r)}bool(){let t=this.buf[this.pos];return t<128?(this.pos++,t!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return qt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return qt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){let r=this.bytes(),n=r.length;if(n<=Dv){let o=new Array(n);for(let i=0;i<n;i++){let s=r[i];if(s>127)return this.decodeUtf8(r,t);o[i]=s}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(r,t)}};function vp(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>S_||e<A_)throw new Error("invalid int32: "+e)}function Nv(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>v_||e<0)throw new Error("invalid uint32: "+e)}function C_(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>h_||e<y_))throw new Error("invalid float32: "+e)}var x_=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Sp(){return{fields:{}}}var Gi={encode(e,t=new ge){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&wp.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Sp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let s=wp.decode(r,r.uint32());s.value!==void 0&&(o.fields[s.key]=s.value);continue}}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Gi.fromPartial(e??{})},fromPartial(e){let t=Sp();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=Sp();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 Mv(){return{key:"",value:void 0}}var wp={encode(e,t=new ge){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&ie.encode(ie.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Mv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=r.string();continue;case 2:if(i!==18)break;o.value=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return wp.fromPartial(e??{})},fromPartial(e){let t=Mv();return t.key=e.key??"",t.value=e.value??void 0,t}};function Ap(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var ie={encode(e,t=new ge){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&Gi.encode(Gi.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&$i.encode($i.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Ap();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.nullValue=r.int32();continue;case 2:if(i!==17)break;o.numberValue=r.double();continue;case 3:if(i!==26)break;o.stringValue=r.string();continue;case 4:if(i!==32)break;o.boolValue=r.bool();continue;case 5:if(i!==42)break;o.structValue=Gi.unwrap(Gi.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=$i.unwrap($i.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ie.fromPartial(e??{})},fromPartial(e){let t=Ap();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=Ap();if(e===null)t.nullValue=x_.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(b.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new b.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function bp(){return{values:[]}}var $i={encode(e,t=new ge){for(let r of e.values)ie.encode(ie.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=bp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(ie.unwrap(ie.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return $i.fromPartial(e??{})},fromPartial(e){let t=bp();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=bp();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&b.Array.isArray(e.values)?e.values:e}},E_=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 Lv(){return{op:0,path:"",from:void 0,value:void 0}}var _c={encode(e,t=new ge){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&ie.encode(ie.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Lv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.op=r.int32();continue;case 2:if(i!==18)break;o.path=r.string();continue;case 3:if(i!==26)break;o.from=r.string();continue;case 4:if(i!==34)break;o.value=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return _c.fromPartial(e??{})},fromPartial(e){let t=Lv();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function jv(){return{id:"",type:"",function:void 0}}var Oc={encode(e,t=new ge){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&Pc.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=jv();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=Pc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Oc.fromPartial(e??{})},fromPartial(e){let t=jv();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?Pc.fromPartial(e.function):void 0,t}};function qv(){return{name:"",arguments:""}}var Pc={encode(e,t=new ge){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=qv();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 Pc.fromPartial(e??{})},fromPartial(e){let t=qv();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function Uv(){return{value:"",mimeType:""}}var Nc={encode(e,t=new ge){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==""&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Uv();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 Nc.fromPartial(e??{})},fromPartial(e){let t=Uv();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function Vv(){return{value:"",mimeType:void 0}}var Fc={encode(e,t=new ge){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Vv();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 Fc.fromPartial(e??{})},fromPartial(e){let t=Vv();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function Bv(){return{data:void 0,url:void 0}}var At={encode(e,t=new ge){return e.data!==void 0&&Nc.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Fc.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Bv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=Nc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=Fc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return At.fromPartial(e??{})},fromPartial(e){let t=Bv();return t.data=e.data!==void 0&&e.data!==null?Nc.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Fc.fromPartial(e.url):void 0,t}};function Gv(){return{text:""}}var Dc={encode(e,t=new ge){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Gv();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 Dc.fromPartial(e??{})},fromPartial(e){let t=Gv();return t.text=e.text??"",t}};function $v(){return{source:void 0,metadata:void 0}}var Mc={encode(e,t=new ge){return e.source!==void 0&&At.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ie.encode(ie.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=$v();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Mc.fromPartial(e??{})},fromPartial(e){let t=$v();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Qv(){return{source:void 0,metadata:void 0}}var Lc={encode(e,t=new ge){return e.source!==void 0&&At.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ie.encode(ie.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Qv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Lc.fromPartial(e??{})},fromPartial(e){let t=Qv();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Hv(){return{source:void 0,metadata:void 0}}var jc={encode(e,t=new ge){return e.source!==void 0&&At.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ie.encode(ie.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Hv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return jc.fromPartial(e??{})},fromPartial(e){let t=Hv();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function zv(){return{source:void 0,metadata:void 0}}var qc={encode(e,t=new ge){return e.source!==void 0&&At.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ie.encode(ie.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=zv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return qc.fromPartial(e??{})},fromPartial(e){let t=zv();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Wv(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var Uc={encode(e,t=new ge){return e.text!==void 0&&Dc.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Mc.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Lc.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&jc.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&qc.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Wv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=Dc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=Mc.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=Lc.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=jc.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=qc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Uc.fromPartial(e??{})},fromPartial(e){let t=Wv();return t.text=e.text!==void 0&&e.text!==null?Dc.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Mc.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Lc.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?jc.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?qc.fromPartial(e.document):void 0,t}};function Kv(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var Vc={encode(e,t=new ge){e.id!==""&&t.uint32(10).string(e.id),e.role!==""&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let r of e.toolCalls)Oc.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)Uc.encode(r,t.uint32(66).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Kv();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(Oc.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(Uc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Vc.fromPartial(e??{})},fromPartial(e){let t=Kv();return t.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=>Oc.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>Uc.fromPartial(r))||[],t}};function Yv(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0}}var Bc={encode(e,t=new ge){return e.id!==""&&t.uint32(10).string(e.id),e.reason!==""&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&ie.encode(ie.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&ie.encode(ie.wrap(e.metadata),t.uint32(58).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Yv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.reason=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.toolCallId=r.string();continue;case 5:if(i!==42)break;o.responseSchema=ie.unwrap(ie.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.expiresAt=r.string();continue;case 7:if(i!==58)break;o.metadata=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Bc.fromPartial(e??{})},fromPartial(e){let t=Yv();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}},I_=function(e){return e[e.TEXT_MESSAGE_START=0]="TEXT_MESSAGE_START",e[e.TEXT_MESSAGE_CONTENT=1]="TEXT_MESSAGE_CONTENT",e[e.TEXT_MESSAGE_END=2]="TEXT_MESSAGE_END",e[e.TOOL_CALL_START=3]="TOOL_CALL_START",e[e.TOOL_CALL_ARGS=4]="TOOL_CALL_ARGS",e[e.TOOL_CALL_END=5]="TOOL_CALL_END",e[e.STATE_SNAPSHOT=6]="STATE_SNAPSHOT",e[e.STATE_DELTA=7]="STATE_DELTA",e[e.MESSAGES_SNAPSHOT=8]="MESSAGES_SNAPSHOT",e[e.RAW=9]="RAW",e[e.CUSTOM=10]="CUSTOM",e[e.RUN_STARTED=11]="RUN_STARTED",e[e.RUN_FINISHED=12]="RUN_FINISHED",e[e.RUN_ERROR=13]="RUN_ERROR",e[e.STEP_STARTED=14]="STEP_STARTED",e[e.STEP_FINISHED=15]="STEP_FINISHED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Xv(){return{type:0,timestamp:void 0,rawEvent:void 0}}var ae={encode(e,t=new ge){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&ie.encode(ie.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Xv();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=To(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ae.fromPartial(e??{})},fromPartial(e){let t=Xv();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function Zv(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var Gc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Zv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Gc.fromPartial(e??{})},fromPartial(e){let t=Zv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function Jv(){return{baseEvent:void 0,messageId:"",delta:""}}var $c={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=Jv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return $c.fromPartial(e??{})},fromPartial(e){let t=Jv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function eS(){return{baseEvent:void 0,messageId:""}}var Qc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=eS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Qc.fromPartial(e??{})},fromPartial(e){let t=eS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function tS(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var Hc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=tS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Hc.fromPartial(e??{})},fromPartial(e){let t=tS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function rS(){return{baseEvent:void 0,toolCallId:"",delta:""}}var zc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=rS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return zc.fromPartial(e??{})},fromPartial(e){let t=rS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function nS(){return{baseEvent:void 0,toolCallId:""}}var Wc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=nS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Wc.fromPartial(e??{})},fromPartial(e){let t=nS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function oS(){return{baseEvent:void 0,snapshot:void 0}}var Kc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&ie.encode(ie.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=oS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Kc.fromPartial(e??{})},fromPartial(e){let t=oS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function iS(){return{baseEvent:void 0,delta:[]}}var Yc={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)_c.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=iS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(_c.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Yc.fromPartial(e??{})},fromPartial(e){let t=iS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>_c.fromPartial(r))||[],t}};function sS(){return{baseEvent:void 0,messages:[]}}var Xc={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Vc.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=sS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(Vc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Xc.fromPartial(e??{})},fromPartial(e){let t=sS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Vc.fromPartial(r))||[],t}};function aS(){return{baseEvent:void 0,event:void 0,source:void 0}}var Zc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&ie.encode(ie.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=aS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=ie.unwrap(ie.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.source=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Zc.fromPartial(e??{})},fromPartial(e){let t=aS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function cS(){return{baseEvent:void 0,name:"",value:void 0}}var Jc={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&ie.encode(ie.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=cS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=ie.unwrap(ie.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Jc.fromPartial(e??{})},fromPartial(e){let t=cS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function uS(){return{baseEvent:void 0,threadId:"",runId:""}}var eu={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=uS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.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 eu.fromPartial(e??{})},fromPartial(e){let t=uS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function lS(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var In={encode(e,t=new ge){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=lS();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=To(r.int64());continue;case 4:if(i!==32)break;o.outputTokens=To(r.int64());continue;case 5:if(i!==40)break;o.totalTokens=To(r.int64());continue;case 6:if(i!==48)break;o.reasoningTokens=To(r.int64());continue;case 7:if(i!==56)break;o.cachedInputTokens=To(r.int64());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return In.fromPartial(e??{})},fromPartial(e){let t=lS();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 dS(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var tu={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&ie.encode(ie.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)Bc.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)In.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=dS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue;case 4:if(i!==34)break;o.result=ie.unwrap(ie.decode(r,r.uint32()));continue;case 5:if(i!==42)break;o.outcome=r.string();continue;case 6:if(i!==50)break;o.interrupts.push(Bc.decode(r,r.uint32()));continue;case 7:if(i!==58)break;o.usage.push(In.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return tu.fromPartial(e??{})},fromPartial(e){let t=dS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interrupts=e.interrupts?.map(r=>Bc.fromPartial(r))||[],t.usage=e.usage?.map(r=>In.fromPartial(r))||[],t}};function pS(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var ru={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message);for(let r of e.usage)In.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=pS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.code=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.usage.push(In.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ru.fromPartial(e??{})},fromPartial(e){let t=pS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>In.fromPartial(r))||[],t}};function fS(){return{baseEvent:void 0,stepName:""}}var nu={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=fS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=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=fS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function mS(){return{baseEvent:void 0,stepName:""}}var ou={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=mS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ou.fromPartial(e??{})},fromPartial(e){let t=mS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function gS(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var iu={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=gS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.delta=r.string();continue;case 5:if(i!==42)break;o.name=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return iu.fromPartial(e??{})},fromPartial(e){let t=gS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t}};function hS(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var su={encode(e,t=new ge){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=hS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue;case 5:if(i!==42)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return su.fromPartial(e??{})},fromPartial(e){let t=hS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function yS(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0}}var vS={encode(e,t=new ge){return e.textMessageStart!==void 0&&Gc.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&$c.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Qc.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Hc.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&zc.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Wc.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Kc.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Yc.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Xc.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Zc.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Jc.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&eu.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&tu.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&ru.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&nu.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&ou.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&iu.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&su.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof X?e:new X(e),n=t===void 0?r.len:r.pos+t,o=yS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=Gc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=$c.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=Qc.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=Hc.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=zc.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=Wc.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=Kc.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Yc.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=Xc.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Zc.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Jc.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=eu.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=tu.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=ru.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=nu.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=ou.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=iu.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=su.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vS.fromPartial(e??{})},fromPartial(e){let t=yS();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Gc.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?$c.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Qc.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Hc.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?zc.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Wc.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Kc.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Yc.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Xc.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Zc.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Jc.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?eu.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?tu.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?ru.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?nu.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?ou.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?iu.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?su.fromPartial(e.toolCallChunk):void 0,t}};function To(e){let t=b.Number(e.toString());if(t>b.Number.MAX_SAFE_INTEGER)throw new b.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<b.Number.MIN_SAFE_INTEGER)throw new b.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var SS=e=>e&&typeof e=="object"?e:void 0;var kc=e=>{let t=SS(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}}}},R_=e=>{let t=SS(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:kc(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:kc(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:kc(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:kc(r.source),metadata:r.metadata}}}};function AS(e){let t=vS.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=I_[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,delete r.baseEvent,r.type===D.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;if(o.role==="user"&&Array.isArray(o.contentParts)){let i=o.contentParts.map(s=>R_(s)).filter(s=>s!==void 0);i.length>0&&(o.content=i)}Array.isArray(o.contentParts)&&o.contentParts.length===0&&(o.contentParts=void 0),o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===D.RUN_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,i=Array.isArray(n.interrupts)?n.interrupts:[];delete n.interrupts,o==="interrupt"?n.outcome={type:"interrupt",interrupts:i}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if((r.type===D.RUN_FINISHED||r.type===D.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===D.STATE_DELTA)for(let n of r.delta)n.op=E_[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]}),za.parse(r)}var Cp="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var k_=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,xp=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(k_);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},bS=e=>e==="*"||e==="x"||e==="X",wS=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},__=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],O_=(e,t)=>{if(bS(e)||bS(t))return 0;let[r,n]=__(wS(e),wS(t));return r>n?1:r<n?-1:0},Ep=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=O_(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Qi=(e,t)=>{let r=xp(e),n=xp(t),o=r.pop(),i=n.pop(),s=Ep(r,n);return s!==0?s:o&&i?Ep(o.split("."),i.split(".")):o||i?o?-1:1:0};var we=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function Hi(){return Ir()}function Tp(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&Tp(t);return e}var CS=512*1024;function xS(e,t,r){let n=0,o=[e,t],i=new WeakSet;for(;o.length>0;){let s=o.pop();if(typeof s=="string"){if(n+=s.length,n>r)return!0}else if(typeof s=="object"&&s){if(i.has(s))continue;if(i.add(s),Array.isArray(s))for(let a=0;a<s.length;a++)o.push(s[a]);else{let a=Object.keys(s);for(let c=0;c<a.length;c++){let u=a[c];if(n+=u.length,n>r)return!0;o.push(s[u])}}}}return!1}function Te(_x83,_x84,_x85,_x86){return _Te.apply(this,arguments)}function _Te(){_Te=_asyncToGenerator(function*(e,t,r,n){let o=typeof process<"u"&&process.env!==void 0,i=o&&!!process.env.VITEST_WORKER_ID,s=o&&!!process.env.VITEST_WORKER_ID,a=s&&!xS(t,r,CS),c=a?we(t):t,u=a?we(r):r,g=!1,v=!1,w;for(let h of e)try{a&&(Tp(c),Tp(u));let y=yield n(h,c,u);if(y===void 0)continue;let S=!1;if(y.messages!==void 0&&y.messages!==c&&(c=we(y.messages),g=!0,S=!0),y.state!==void 0&&y.state!==u&&(u=we(y.state),v=!0,S=!0),a&&S&&xS(c,u,CS)&&(a=!1),w=y.stopPropagation,w===!0)break}catch(y){if(s&&y instanceof TypeError){if(i)throw y;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",y)}else i||console.error("Subscriber error:",y);continue}return{...(g?{messages:Object.isFrozen(c)?we(c):c}:{}),...(v?{state:Object.isFrozen(u)?we(u):u}:{}),...(w===void 0?{}:{stopPropagation:w})}});return _Te.apply(this,arguments)}function au(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,r=e.lifecycle??!0,n=e.verbose??!1;return{enabled:t||r,events:t,lifecycle:r,verbose:n}}function zi(e){if(e instanceof kp)return e;if(e===!0)return new kp(au(!0))}var kp=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 Ip(e){return e.enabled?new kp(e):void 0}function P_(e,t,r){if(t){let o=e.find(s=>s.id===t);if(o?.role==="assistant")return o;o&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${o.role}' message, not assistant \u2014 falling back to toolCallId`);let i={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(i),i}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}var _S=(e,t,r,n,o)=>{let i=zi(o),s=we(r.messages),a=we(e.state),c={},u=v=>{v.messages!==void 0&&(s=v.messages,c.messages=v.messages),v.state!==void 0&&(a=v.state,c.state=v.state)},g=()=>{let v=we(c);return c={},v.messages!==void 0||v.state!==void 0?qe(v):lc};return t.pipe(Ec(/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(v){let w=yield Te(n,s,a,(h,y,S)=>h.onEvent?.({event:v,agent:r,input:e,messages:y,state:S}));if(u(w),w.stopPropagation===!0?i?.event("APPLY","Event dropped:",v,{type:v.type,reason:"stopPropagation by subscriber"}):i?.event("APPLY","Event applied:",v,{type:v.type,subscribers:n.length}),w.stopPropagation===!0)return g();switch(v.type){case D.TEXT_MESSAGE_START:{let h=yield Te(n,s,a,(y,S,x)=>y.onTextMessageStartEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{messageId:y,role:S="assistant",name:x}=v;if(!s.find(I=>I.id===y)){let I={id:y,role:S,content:"",...(x!==void 0&&{name:x})};s.push(I),u({messages:s})}}return g()}case D.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,S=s.find(I=>I.id===h);if(!S)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let x=yield Te(n,s,a,(I,_,R)=>I.onTextMessageContentEvent?.({event:v,messages:_,state:R,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}));return u(x),x.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${y}`,u({messages:s})),g()}case D.TEXT_MESSAGE_END:{let{messageId:h}=v,y=s.find(S=>S.id===h);return y?(u(yield Te(n,s,a,(S,x,I)=>S.onTextMessageEndEvent?.({event:v,messages:x,state:I,agent:r,input:e,textMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(S=>{S.onNewMessage?.({message:y,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g())}case D.TOOL_CALL_START:{let h=yield Te(n,s,a,(y,S,x)=>y.onToolCallStartEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:S,parentMessageId:x}=v,I=s.find(R=>R.toolCalls?.some(T=>T.id===y))?.toolCalls?.find(R=>R.id===y);if(I)return I.function.name!==S&&(console.warn(`TOOL_CALL_START: tool call '${y}' already exists with name '${I.function.name}' \u2014 updating it to '${S}'`),I.function.name=S,u({messages:s})),g();let _=P_(s,x,y);_.toolCalls??(_.toolCalls=[]),_.toolCalls.push({id:y,type:"function",function:{name:S,arguments:""}}),u({messages:s})}return g()}case D.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=v,S=s.find(_=>_.toolCalls?.some(R=>R.id===h));if(!S)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let x=S.toolCalls?.find(_=>_.id===h);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=yield Te(n,s,a,(_,R,T)=>{let k=x.function.arguments,F=x.function.name,V={};try{V=Rc(k)}catch{}return _.onToolCallArgsEvent?.({event:v,messages:R,state:T,agent:r,input:e,toolCallBuffer:k,toolCallName:F,partialToolCallArgs:V})});return u(I),I.stopPropagation!==!0&&(x.function.arguments+=y,u({messages:s})),g()}case D.TOOL_CALL_END:{let{toolCallId:h}=v,y=s.find(x=>x.toolCalls?.some(I=>I.id===h));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let S=y.toolCalls?.find(x=>x.id===h);return S?(u(yield Te(n,s,a,(x,I,_)=>{let R=S.function.arguments,T=S.function.name,k={};try{k=JSON.parse(R)}catch{}return x.onToolCallEndEvent?.({event:v,messages:I,state:_,agent:r,input:e,toolCallName:T,toolCallArgs:k})})),yield Promise.all(n.map(x=>{x.onNewToolCall?.({toolCall:S,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g())}case D.TOOL_CALL_RESULT:{let h=yield Te(n,s,a,(y,S,x)=>y.onToolCallResultEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:S,content:x,role:I}=v,_={id:y,toolCallId:S,role:I||"tool",content:x},R=s.findIndex(T=>T.role==="assistant"&&T.toolCalls?.some(k=>k.id===S));if(R===-1)s.push(_);else{let T=R+1;for(;T<s.length&&s[T].role==="tool";)T++;s.splice(T,0,_)}yield Promise.all(n.map(T=>{T.onNewMessage?.({message:_,messages:s,state:a,agent:r,input:e})})),u({messages:s})}return g()}case D.STATE_SNAPSHOT:{let h=yield Te(n,s,a,(y,S,x)=>y.onStateSnapshotEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{snapshot:y}=v;a=y,u({state:a})}return g()}case D.STATE_DELTA:{let h=yield Te(n,s,a,(y,S,x)=>y.onStateDeltaEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{delta:y}=v;try{a=tc.applyPatch(a,y,!0,!1).newDocument,u({state:a})}catch(S){let x=S instanceof Error?S.message:String(S);console.warn(`Failed to apply state patch:
37
37
  Current state: ${JSON.stringify(a,null,2)}
38
38
  Patch operations: ${JSON.stringify(y,null,2)}
39
- Error: ${x}`)}}return g()}case D.MESSAGES_SNAPSHOT:{let h=yield Te(n,s,a,(y,S,x)=>y.onMessagesSnapshotEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{messages:y}=v,S=new Map(y.map(T=>[T.id,T])),x=y.some(T=>T.role==="activity"),I=y.some(T=>T.role==="reasoning"),_=T=>T.role==="activity"&&!x||T.role==="reasoning"&&!I;s=s.filter(T=>_(T)||S.has(T.id)).map(T=>_(T)?T:S.get(T.id));let R=new Set(s.map(T=>T.id));for(let T of y)R.has(T.id)||s.push(T);u({messages:s})}return g()}case D.ACTIVITY_SNAPSHOT:{let h=v,y=s.findIndex(R=>R.id===h.messageId),S=y>=0?s[y]:void 0,x=S?.role==="activity"?S:void 0,I=h.replace??!0,_=yield Te(n,s,a,(R,T,k)=>R.onActivitySnapshotEvent?.({event:h,messages:T,state:k,agent:r,input:e,activityMessage:x,existingMessage:S}));if(u(_),_.stopPropagation!==!0){let R={id:h.messageId,role:"activity",activityType:h.activityType,content:we(h.content)},T;y===-1?(s.push(R),T=R):x?I&&(s[y]={...x,activityType:h.activityType,content:we(h.content)}):I&&(s[y]=R,T=R),u({messages:s}),T&&(yield Promise.all(n.map(k=>k.onNewMessage?.({message:T,messages:s,state:a,agent:r,input:e}))))}return g()}case D.ACTIVITY_DELTA:{let h=v,y=s.findIndex(_=>_.id===h.messageId);if(y===-1)return g();let S=s[y];if(S.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let x=S,I=yield Te(n,s,a,(_,R,T)=>_.onActivityDeltaEvent?.({event:h,messages:R,state:T,agent:r,input:e,activityMessage:x}));if(u(I),I.stopPropagation!==!0)try{let _=we(x.content??{}),R=Ja.applyPatch(_,h.patch??[],!0,!1).newDocument;s[y]={...x,content:we(R),activityType:h.activityType},u({messages:s})}catch(_){let R=_ instanceof Error?_.message:String(_);console.warn(`Failed to apply activity patch for '${h.messageId}': ${R}`)}return g()}case D.RAW:return u(yield Te(n,s,a,(h,y,S)=>h.onRawEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.CUSTOM:return u(yield Te(n,s,a,(h,y,S)=>h.onCustomEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.RUN_STARTED:{let h=yield Te(n,s,a,(y,S,x)=>y.onRunStartedEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let y=v;if(y.input?.messages){for(let S of y.input.messages)s.find(x=>x.id===S.id)||s.push(S);u({messages:s})}}return g()}case D.RUN_FINISHED:{let h=v,y=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},S=yield Te(n,s,a,(x,I,_)=>x.onRunFinishedEvent?.({...y,messages:I,state:_,agent:r,input:e}));return u(S),S.stopPropagation!==!0&&(r.pendingInterrupts=y.outcome==="interrupt"?[...y.interrupts]:[]),g()}case D.RUN_ERROR:return u(yield Te(n,s,a,(h,y,S)=>h.onRunErrorEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.STEP_STARTED:return u(yield Te(n,s,a,(h,y,S)=>h.onStepStartedEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.STEP_FINISHED:return u(yield Te(n,s,a,(h,y,S)=>h.onStepFinishedEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case D.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case D.THINKING_START:return g();case D.THINKING_END:return g();case D.THINKING_TEXT_MESSAGE_START:return g();case D.THINKING_TEXT_MESSAGE_CONTENT:return g();case D.THINKING_TEXT_MESSAGE_END:return g();case D.REASONING_START:return u(yield Te(n,s,a,(h,y,S)=>h.onReasoningStartEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.REASONING_MESSAGE_START:{let h=yield Te(n,s,a,(y,S,x)=>y.onReasoningMessageStartEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{messageId:y}=v;if(!s.find(S=>S.id===y)){let S={id:y,role:"reasoning",content:""};s.push(S),u({messages:s})}}return g()}case D.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,S=s.find(I=>I.id===h);if(!S)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let x=yield Te(n,s,a,(I,_,R)=>I.onReasoningMessageContentEvent?.({event:v,messages:_,state:R,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}));return u(x),x.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${y}`,u({messages:s})),g()}case D.REASONING_MESSAGE_END:{let{messageId:h}=v,y=s.find(S=>S.id===h);return y?(u(yield Te(n,s,a,(S,x,I)=>S.onReasoningMessageEndEvent?.({event:v,messages:x,state:I,agent:r,input:e,reasoningMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(S=>{S.onNewMessage?.({message:y,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g())}case D.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case D.REASONING_END:return u(yield Te(n,s,a,(h,y,S)=>h.onReasoningEndEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:y,encryptedValue:S}=v,x=yield Te(n,s,a,(I,_,R)=>I.onReasoningEncryptedValueEvent?.({event:v,messages:_,state:R,agent:r,input:e}));if(u(x),x.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let _ of s)if(_.role==="assistant"&&_.toolCalls){let R=_.toolCalls.find(T=>T.id===y);if(R){R.encryptedValue=S,I=!0;break}}}else{let _=s.find(R=>R.id===y);_?.role!=="activity"&&_&&(_.encryptedValue=S,I=!0)}I&&(c.messages=s)}return g()}}return v.type,g()});return function(_x87){return _ref40.apply(this,arguments)}}()),op(),n.length>0?ip({}):v=>v)},xp=e=>t=>{let r=zi(e),n=new Map,o=new Map,i=!1,s=!1,a=!1,c=new Map,u=!1,g=!1,v=!1,w=()=>{n.clear(),o.clear(),c.clear(),u=!1,g=!1,i=!1,s=!1,v=!0};return t.pipe(pt(h=>{let y=h.type;if(r?.event("VERIFY","Event:",h,{type:h.type}),s)return Me(()=>new Fe(`Cannot send event type '${y}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(i&&y!==D.RUN_ERROR&&y!==D.RUN_STARTED)return Me(()=>new Fe(`Cannot send event type '${y}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(a){if(y===D.RUN_STARTED){if(v&&!i)return Me(()=>new Fe("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));i&&w()}}else if(a=!0,y!==D.RUN_STARTED&&y!==D.RUN_ERROR)return Me(()=>new Fe("First event must be 'RUN_STARTED'"));switch(y){case D.TEXT_MESSAGE_START:{let S=h.messageId;return n.has(S)?Me(()=>new Fe(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${S}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(n.set(S,!0),qe(h))}case D.TEXT_MESSAGE_CONTENT:{let S=h.messageId;return n.has(S)?qe(h):Me(()=>new Fe(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${S}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case D.TEXT_MESSAGE_END:{let S=h.messageId;return n.has(S)?(n.delete(S),qe(h)):Me(()=>new Fe(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${S}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case D.TOOL_CALL_START:{let S=h.toolCallId;return o.has(S)?Me(()=>new Fe(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${S}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(o.set(S,!0),qe(h))}case D.TOOL_CALL_ARGS:{let S=h.toolCallId;return o.has(S)?qe(h):Me(()=>new Fe(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${S}'. Start a tool call with 'TOOL_CALL_START' first.`))}case D.TOOL_CALL_END:{let S=h.toolCallId;return o.has(S)?(o.delete(S),qe(h)):Me(()=>new Fe(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${S}'. A 'TOOL_CALL_START' event must be sent first.`))}case D.STEP_STARTED:{let S=h.stepName;return c.has(S)?Me(()=>new Fe(`Step "${S}" is already active for 'STEP_STARTED'`)):(c.set(S,!0),qe(h))}case D.STEP_FINISHED:{let S=h.stepName;return c.has(S)?(c.delete(S),qe(h)):Me(()=>new Fe(`Cannot send 'STEP_FINISHED' for step "${S}" that was not started`))}case D.RUN_STARTED:return v=!0,qe(h);case D.RUN_FINISHED:if(c.size>0){let S=Array.from(c.keys()).join(", ");return Me(()=>new Fe(`Cannot send 'RUN_FINISHED' while steps are still active: ${S}`))}if(n.size>0){let S=Array.from(n.keys()).join(", ");return Me(()=>new Fe(`Cannot send 'RUN_FINISHED' while text messages are still active: ${S}`))}if(o.size>0){let S=Array.from(o.keys()).join(", ");return Me(()=>new Fe(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${S}`))}return i=!0,qe(h);case D.RUN_ERROR:return s=!0,qe(h);case D.CUSTOM:return qe(h);case D.THINKING_TEXT_MESSAGE_START:return u?g?Me(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(g=!0,qe(h)):Me(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case D.THINKING_TEXT_MESSAGE_CONTENT:return g?qe(h):Me(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case D.THINKING_TEXT_MESSAGE_END:return g?(g=!1,qe(h)):Me(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case D.THINKING_START:return u?Me(()=>new Fe("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(u=!0,qe(h));case D.THINKING_END:return u?(u=!1,qe(h)):Me(()=>new Fe("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return qe(h)}}))},Rn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),E_=e=>wc(()=>Cn(e())).pipe(sp(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return Cn(t.text()).pipe(pt(i=>{let s=i;if(o.includes("application/json"))try{s=JSON.parse(i)}catch{}let a=Error(`HTTP ${t.status}: ${typeof s=="string"?s:JSON.stringify(s)}`);return a.status=t.status,a.payload=s,Me(()=>a)}))}let r={type:Rn.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new De(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:s}=yield n.read();if(i)break;let a={type:Rn.DATA,data:s};o.next(a)}o.complete()}catch(i){o.error(i)}})(),()=>{n.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):Me(()=>Error("Failed to getReader() from response"))})),I_=(e,t)=>{let r=zi(t),n=new Xt,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:a=>{if(a.type!==Rn.HEADERS&&a.type===Rn.DATA&&a.data){let c=o.decode(a.data,{stream:!0});i+=c;let u=i.split(/\n\n/);i=u.pop()||"";for(let g of u)s(g)}},error:a=>n.error(a),complete:()=>{i&&(i+=o.decode(),s(i)),n.complete()}});function s(a){let c=a.split(`
39
+ Error: ${x}`)}}return g()}case D.MESSAGES_SNAPSHOT:{let h=yield Te(n,s,a,(y,S,x)=>y.onMessagesSnapshotEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{messages:y}=v,S=new Map(y.map(T=>[T.id,T])),x=y.some(T=>T.role==="activity"),I=y.some(T=>T.role==="reasoning"),_=T=>T.role==="activity"&&!x||T.role==="reasoning"&&!I;s=s.filter(T=>_(T)||S.has(T.id)).map(T=>_(T)?T:S.get(T.id));let R=new Set(s.map(T=>T.id));for(let T of y)R.has(T.id)||s.push(T);u({messages:s})}return g()}case D.ACTIVITY_SNAPSHOT:{let h=v,y=s.findIndex(R=>R.id===h.messageId),S=y>=0?s[y]:void 0,x=S?.role==="activity"?S:void 0,I=h.replace??!0,_=yield Te(n,s,a,(R,T,k)=>R.onActivitySnapshotEvent?.({event:h,messages:T,state:k,agent:r,input:e,activityMessage:x,existingMessage:S}));if(u(_),_.stopPropagation!==!0){let R={id:h.messageId,role:"activity",activityType:h.activityType,content:we(h.content)},T;y===-1?(s.push(R),T=R):x?I&&(s[y]={...x,activityType:h.activityType,content:we(h.content)}):I&&(s[y]=R,T=R),u({messages:s}),T&&(yield Promise.all(n.map(k=>k.onNewMessage?.({message:T,messages:s,state:a,agent:r,input:e}))))}return g()}case D.ACTIVITY_DELTA:{let h=v,y=s.findIndex(_=>_.id===h.messageId);if(y===-1)return g();let S=s[y];if(S.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let x=S,I=yield Te(n,s,a,(_,R,T)=>_.onActivityDeltaEvent?.({event:h,messages:R,state:T,agent:r,input:e,activityMessage:x}));if(u(I),I.stopPropagation!==!0)try{let _=we(x.content??{}),R=tc.applyPatch(_,h.patch??[],!0,!1).newDocument;s[y]={...x,content:we(R),activityType:h.activityType},u({messages:s})}catch(_){let R=_ instanceof Error?_.message:String(_);console.warn(`Failed to apply activity patch for '${h.messageId}': ${R}`)}return g()}case D.RAW:return u(yield Te(n,s,a,(h,y,S)=>h.onRawEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.CUSTOM:return u(yield Te(n,s,a,(h,y,S)=>h.onCustomEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.RUN_STARTED:{let h=yield Te(n,s,a,(y,S,x)=>y.onRunStartedEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let y=v;if(y.input?.messages){for(let S of y.input.messages)s.find(x=>x.id===S.id)||s.push(S);u({messages:s})}}return g()}case D.RUN_FINISHED:{let h=v,y=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},S=yield Te(n,s,a,(x,I,_)=>x.onRunFinishedEvent?.({...y,messages:I,state:_,agent:r,input:e}));return u(S),S.stopPropagation!==!0&&(r.pendingInterrupts=y.outcome==="interrupt"?[...y.interrupts]:[]),g()}case D.RUN_ERROR:return u(yield Te(n,s,a,(h,y,S)=>h.onRunErrorEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.STEP_STARTED:return u(yield Te(n,s,a,(h,y,S)=>h.onStepStartedEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.STEP_FINISHED:return u(yield Te(n,s,a,(h,y,S)=>h.onStepFinishedEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case D.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case D.THINKING_START:return g();case D.THINKING_END:return g();case D.THINKING_TEXT_MESSAGE_START:return g();case D.THINKING_TEXT_MESSAGE_CONTENT:return g();case D.THINKING_TEXT_MESSAGE_END:return g();case D.REASONING_START:return u(yield Te(n,s,a,(h,y,S)=>h.onReasoningStartEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.REASONING_MESSAGE_START:{let h=yield Te(n,s,a,(y,S,x)=>y.onReasoningMessageStartEvent?.({event:v,messages:S,state:x,agent:r,input:e}));if(u(h),h.stopPropagation!==!0){let{messageId:y}=v;if(!s.find(S=>S.id===y)){let S={id:y,role:"reasoning",content:""};s.push(S),u({messages:s})}}return g()}case D.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,S=s.find(I=>I.id===h);if(!S)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let x=yield Te(n,s,a,(I,_,R)=>I.onReasoningMessageContentEvent?.({event:v,messages:_,state:R,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}));return u(x),x.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${y}`,u({messages:s})),g()}case D.REASONING_MESSAGE_END:{let{messageId:h}=v,y=s.find(S=>S.id===h);return y?(u(yield Te(n,s,a,(S,x,I)=>S.onReasoningMessageEndEvent?.({event:v,messages:x,state:I,agent:r,input:e,reasoningMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(S=>{S.onNewMessage?.({message:y,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g())}case D.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case D.REASONING_END:return u(yield Te(n,s,a,(h,y,S)=>h.onReasoningEndEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case D.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:y,encryptedValue:S}=v,x=yield Te(n,s,a,(I,_,R)=>I.onReasoningEncryptedValueEvent?.({event:v,messages:_,state:R,agent:r,input:e}));if(u(x),x.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let _ of s)if(_.role==="assistant"&&_.toolCalls){let R=_.toolCalls.find(T=>T.id===y);if(R){R.encryptedValue=S,I=!0;break}}}else{let _=s.find(R=>R.id===y);_?.role!=="activity"&&_&&(_.encryptedValue=S,I=!0)}I&&(c.messages=s)}return g()}}return v.type,g()});return function(_x87){return _ref40.apply(this,arguments)}}()),ap(),n.length>0?cp({}):v=>v)},Rp=e=>t=>{let r=zi(e),n=new Map,o=new Map,i=!1,s=!1,a=!1,c=new Map,u=!1,g=!1,v=!1,w=()=>{n.clear(),o.clear(),c.clear(),u=!1,g=!1,i=!1,s=!1,v=!0};return t.pipe(pt(h=>{let y=h.type;if(r?.event("VERIFY","Event:",h,{type:h.type}),s)return Me(()=>new Fe(`Cannot send event type '${y}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(i&&y!==D.RUN_ERROR&&y!==D.RUN_STARTED)return Me(()=>new Fe(`Cannot send event type '${y}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(a){if(y===D.RUN_STARTED){if(v&&!i)return Me(()=>new Fe("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));i&&w()}}else if(a=!0,y!==D.RUN_STARTED&&y!==D.RUN_ERROR)return Me(()=>new Fe("First event must be 'RUN_STARTED'"));switch(y){case D.TEXT_MESSAGE_START:{let S=h.messageId;return n.has(S)?Me(()=>new Fe(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${S}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(n.set(S,!0),qe(h))}case D.TEXT_MESSAGE_CONTENT:{let S=h.messageId;return n.has(S)?qe(h):Me(()=>new Fe(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${S}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case D.TEXT_MESSAGE_END:{let S=h.messageId;return n.has(S)?(n.delete(S),qe(h)):Me(()=>new Fe(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${S}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case D.TOOL_CALL_START:{let S=h.toolCallId;return o.has(S)?Me(()=>new Fe(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${S}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(o.set(S,!0),qe(h))}case D.TOOL_CALL_ARGS:{let S=h.toolCallId;return o.has(S)?qe(h):Me(()=>new Fe(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${S}'. Start a tool call with 'TOOL_CALL_START' first.`))}case D.TOOL_CALL_END:{let S=h.toolCallId;return o.has(S)?(o.delete(S),qe(h)):Me(()=>new Fe(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${S}'. A 'TOOL_CALL_START' event must be sent first.`))}case D.STEP_STARTED:{let S=h.stepName;return c.has(S)?Me(()=>new Fe(`Step "${S}" is already active for 'STEP_STARTED'`)):(c.set(S,!0),qe(h))}case D.STEP_FINISHED:{let S=h.stepName;return c.has(S)?(c.delete(S),qe(h)):Me(()=>new Fe(`Cannot send 'STEP_FINISHED' for step "${S}" that was not started`))}case D.RUN_STARTED:return v=!0,qe(h);case D.RUN_FINISHED:if(c.size>0){let S=Array.from(c.keys()).join(", ");return Me(()=>new Fe(`Cannot send 'RUN_FINISHED' while steps are still active: ${S}`))}if(n.size>0){let S=Array.from(n.keys()).join(", ");return Me(()=>new Fe(`Cannot send 'RUN_FINISHED' while text messages are still active: ${S}`))}if(o.size>0){let S=Array.from(o.keys()).join(", ");return Me(()=>new Fe(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${S}`))}return i=!0,qe(h);case D.RUN_ERROR:return s=!0,qe(h);case D.CUSTOM:return qe(h);case D.THINKING_TEXT_MESSAGE_START:return u?g?Me(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(g=!0,qe(h)):Me(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case D.THINKING_TEXT_MESSAGE_CONTENT:return g?qe(h):Me(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case D.THINKING_TEXT_MESSAGE_END:return g?(g=!1,qe(h)):Me(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case D.THINKING_START:return u?Me(()=>new Fe("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(u=!0,qe(h));case D.THINKING_END:return u?(u=!1,qe(h)):Me(()=>new Fe("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return qe(h)}}))},Rn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),N_=e=>xc(()=>Cn(e())).pipe(up(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return Cn(t.text()).pipe(pt(i=>{let s=i;if(o.includes("application/json"))try{s=JSON.parse(i)}catch{}let a=Error(`HTTP ${t.status}: ${typeof s=="string"?s:JSON.stringify(s)}`);return a.status=t.status,a.payload=s,Me(()=>a)}))}let r={type:Rn.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new De(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:s}=yield n.read();if(i)break;let a={type:Rn.DATA,data:s};o.next(a)}o.complete()}catch(i){o.error(i)}})(),()=>{n.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):Me(()=>Error("Failed to getReader() from response"))})),F_=(e,t)=>{let r=zi(t),n=new Xt,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:a=>{if(a.type!==Rn.HEADERS&&a.type===Rn.DATA&&a.data){let c=o.decode(a.data,{stream:!0});i+=c;let u=i.split(/\n\n/);i=u.pop()||"";for(let g of u)s(g)}},error:a=>n.error(a),complete:()=>{i&&(i+=o.decode(),s(i)),n.complete()}});function s(a){let c=a.split(`
40
40
  `),u=[];for(let g of c)g.startsWith("data:")&&u.push(g.slice(5).replace(/^ /,""));if(u.length>0)try{let g=u.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()},R_=e=>{let t=new Xt,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==Rn.HEADERS&&o.type===Rn.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),s=yS(i);t.next(s),r=r.slice(o)}catch(i){let s=i instanceof Error?i.message:String(i);t.error(Error(`Failed to decode protocol buffer message: ${s}`));return}}}return t.asObservable()},T_=(e,t)=>{let r=zi(t),n=new Xt,o=new ac,i=!1;return e.subscribe({next:s=>{if(o.next(s),s.type===Rn.HEADERS&&!i){i=!0;let a=s.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:a,parser:a===Ap?"protobuf":"sse"}),a===Ap?R_(o).subscribe({next:c=>n.next(c),error:c=>n.error(c),complete:()=>n.complete()}):I_(o,r).subscribe({next:c=>{try{let u=Qa.parse(c);r?.event("HTTP","Event validated:",u,{type:u.type,valid:!0}),n.next(u)}catch(u){r?.event("HTTP","Event invalid:",{json:c,error:String(u)}),n.error(u)}},error:c=>{if(c?.name==="AbortError"){n.next({type:D.RUN_ERROR,message:c.message||"Request aborted",code:"abort",rawEvent:c}),n.complete();return}return n.error(c)},complete:()=>n.complete()})}else i||n.error(Error("No headers event received before data events"))},error:s=>{o.error(s),n.error(s)},complete:()=>{o.complete()}}),n.asObservable()},Pe=A.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),k_=A.enum(["LangGraphInterruptEvent","PredictState","Exit"]),__=A.object({type:A.literal(Pe.enum.TextMessageStart),messageId:A.string(),parentMessageId:A.string().optional(),role:A.string().optional()}),O_=A.object({type:A.literal(Pe.enum.TextMessageContent),messageId:A.string(),content:A.string()}),P_=A.object({type:A.literal(Pe.enum.TextMessageEnd),messageId:A.string()}),N_=A.object({type:A.literal(Pe.enum.ActionExecutionStart),actionExecutionId:A.string(),actionName:A.string(),parentMessageId:A.string().optional()}),F_=A.object({type:A.literal(Pe.enum.ActionExecutionArgs),actionExecutionId:A.string(),args:A.string()}),D_=A.object({type:A.literal(Pe.enum.ActionExecutionEnd),actionExecutionId:A.string()}),M_=A.object({type:A.literal(Pe.enum.ActionExecutionResult),actionName:A.string(),actionExecutionId:A.string(),result:A.string()}),L_=A.object({type:A.literal(Pe.enum.AgentStateMessage),threadId:A.string(),agentName:A.string(),nodeName:A.string(),runId:A.string(),active:A.boolean(),role:A.string(),state:A.string(),running:A.boolean()}),j_=A.object({type:A.literal(Pe.enum.MetaEvent),name:k_,value:A.any()}),q_=A.object({type:A.literal(Pe.enum.RunError),message:A.string(),code:A.string().optional()});A.discriminatedUnion("type",[__,O_,P_,N_,F_,D_,M_,L_,j_,q_]),A.object({id:A.string(),role:A.string(),content:A.string(),parentMessageId:A.string().optional()}),A.object({id:A.string(),name:A.string(),arguments:A.any(),parentMessageId:A.string().optional()}),A.object({id:A.string(),result:A.any(),actionExecutionId:A.string(),actionName:A.string()});var U_=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
- `)},V_=(e,t,r)=>n=>{let o={},i=!0,s=!0,a="",c=null,u=null,g=[],v={},w=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(pt(h=>{switch(h.type){case D.TEXT_MESSAGE_START:{let y=h;return[{type:Pe.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case D.TEXT_MESSAGE_CONTENT:{let y=h;return[{type:Pe.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case D.TEXT_MESSAGE_END:{let y=h;return[{type:Pe.enum.TextMessageEnd,messageId:y.messageId}]}case D.TOOL_CALL_START:{let y=h;return g.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),s=!0,v[y.toolCallId]=y.toolCallName,[{type:Pe.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case D.TOOL_CALL_ARGS:{let y=h,S=g.find(I=>I.id===y.toolCallId);if(!S)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];S.function.arguments+=y.delta;let x=!1;if(u){let I=u.find(_=>_.tool==S.function.name);if(I)try{let _=JSON.parse(Ec(S.function.arguments));I.tool_argument&&I.tool_argument in _?(w({...o,[I.state_key]:_[I.tool_argument]}),x=!0):I.tool_argument||(w({...o,[I.state_key]:_}),x=!0)}catch{}}return[{type:Pe.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(x?[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}]:[])]}case D.TOOL_CALL_END:{let y=h;return[{type:Pe.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case D.TOOL_CALL_RESULT:{let y=h;return[{type:Pe.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:v[y.toolCallId]||"unknown"}]}case D.RAW:return[];case D.CUSTOM:{let y=h;switch(y.name){case"Exit":i=!1;break;case"PredictState":u=y.value;break}return[{type:Pe.enum.MetaEvent,name:y.name,value:y.value}]}case D.STATE_SNAPSHOT:return w(h.snapshot),[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}];case D.STATE_DELTA:{let y=h,S=Ja.applyPatch(o,y.delta,!0,!1);return S?(w(S.newDocument),[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}]):[]}case D.MESSAGES_SNAPSHOT:return c=h.messages,[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(c?{messages:c}:{})}),active:!0}];case D.RUN_STARTED:return[];case D.RUN_FINISHED:return c&&(o.messages=c),Object.keys(o).length===0?[]:[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(c?{messages:B_(c)}:{})}),active:!1}];case D.RUN_ERROR:{let y=h;return[{type:Pe.enum.RunError,message:y.message,code:y.code}]}case D.STEP_STARTED:return a=h.stepName,g=[],u=null,[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case D.STEP_FINISHED:return g=[],u=null,[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function B_(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=U_(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 s of i.toolCalls)if(s.id===r.toolCallId){n=s.function.name;break}}let o={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(o)}return t}var su=e=>t=>{let r=zi(e),n,o,i,s,a=()=>{if(!n||s!=="text")throw Error("No text message to close");let v={type:D.TEXT_MESSAGE_END,messageId:n.messageId};return s=void 0,n=void 0,r?.event("TRANSFORM","TEXT_MESSAGE_END",v,{messageId:v.messageId}),v},c=()=>{if(!o||s!=="tool")throw Error("No tool call to close");let v={type:D.TOOL_CALL_END,toolCallId:o.toolCallId};return s=void 0,o=void 0,r?.event("TRANSFORM","TOOL_CALL_END",v,{toolCallId:v.toolCallId}),v},u=()=>{if(!i||s!=="reasoning")throw Error("No reasoning message to close");let v={type:D.REASONING_MESSAGE_END,messageId:i.messageId};return s=void 0,i=void 0,r?.event("TRANSFORM","REASONING_MESSAGE_END",v,{messageId:v.messageId}),v},g=()=>s==="text"?[a()]:s==="tool"?[c()]:s==="reasoning"?[u()]:[];return t.pipe(pt(v=>{switch(v.type){case D.TEXT_MESSAGE_START:case D.TEXT_MESSAGE_CONTENT:case D.TEXT_MESSAGE_END:case D.TOOL_CALL_START:case D.TOOL_CALL_ARGS:case D.TOOL_CALL_END:case D.TOOL_CALL_RESULT:case D.STATE_SNAPSHOT:case D.STATE_DELTA:case D.MESSAGES_SNAPSHOT:case D.CUSTOM:case D.RUN_STARTED:case D.RUN_FINISHED:case D.RUN_ERROR:case D.STEP_STARTED:case D.STEP_FINISHED:case D.THINKING_START:case D.THINKING_END:case D.THINKING_TEXT_MESSAGE_START:case D.THINKING_TEXT_MESSAGE_CONTENT:case D.THINKING_TEXT_MESSAGE_END:case D.REASONING_START:case D.REASONING_MESSAGE_START:case D.REASONING_MESSAGE_CONTENT:case D.REASONING_MESSAGE_END:case D.REASONING_END:return[...g(),v];case D.RAW:case D.ACTIVITY_SNAPSHOT:case D.ACTIVITY_DELTA:case D.REASONING_ENCRYPTED_VALUE:return[v];case D.TEXT_MESSAGE_CHUNK:{let w=v,h=[];if((s!=="text"||w.messageId!==void 0&&w.messageId!==n?.messageId)&&h.push(...g()),s!=="text"){if(w.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");n={messageId:w.messageId,name:w.name},s="text";let y={type:D.TEXT_MESSAGE_START,messageId:w.messageId,role:w.role||"assistant",...(w.name!==void 0&&{name:w.name})};h.push(y),r?.event("TRANSFORM","TEXT_MESSAGE_START",y,{messageId:w.messageId})}if(w.delta!==void 0){let y={type:D.TEXT_MESSAGE_CONTENT,messageId:n.messageId,delta:w.delta};h.push(y),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",y,{messageId:n.messageId})}return h}case D.TOOL_CALL_CHUNK:{let w=v,h=[];if((s!=="tool"||w.toolCallId!==void 0&&w.toolCallId!==o?.toolCallId)&&h.push(...g()),s!=="tool"){if(w.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(w.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");o={toolCallId:w.toolCallId,toolCallName:w.toolCallName,parentMessageId:w.parentMessageId},s="tool";let y={type:D.TOOL_CALL_START,toolCallId:w.toolCallId,toolCallName:w.toolCallName,parentMessageId:w.parentMessageId};h.push(y),r?.event("TRANSFORM","TOOL_CALL_START",y,{toolCallId:w.toolCallId,toolCallName:w.toolCallName})}if(w.delta!==void 0){let y={type:D.TOOL_CALL_ARGS,toolCallId:o.toolCallId,delta:w.delta};h.push(y),r?.event("TRANSFORM","TOOL_CALL_ARGS",y,{toolCallId:o.toolCallId})}return h}case D.REASONING_MESSAGE_CHUNK:{let w=v,h=[];if((s!=="reasoning"||w.messageId&&w.messageId!==i?.messageId)&&h.push(...g()),s!=="reasoning"){if(w.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");i={messageId:w.messageId},s="reasoning";let y={type:D.REASONING_MESSAGE_START,messageId:w.messageId};h.push(y),r?.event("TRANSFORM","REASONING_MESSAGE_START",y,{messageId:w.messageId})}if(w.delta!==void 0){let y={type:D.REASONING_MESSAGE_CONTENT,messageId:i.messageId,delta:w.delta};h.push(y),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",y,{messageId:i.messageId})}return h}}return v.type,[]}),En(()=>{g()}))};function G_(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var au=class{runNext(e,t){return t.run(e).pipe(su(!1))}runNextWithState(e,t){let r=we(e.messages||[]),n=we(e.state||{}),o=new ac;return RS(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(Cc(/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(s=>setTimeout(s,0)),{event:i,messages:we(r),state:we(n)}});return function(_x88){return _ref42.apply(this,arguments)}}()))}},$_=class extends au{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function Q_(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 H_=class extends au{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(Q_)};return this.runNext(o,t)}},wS="THINKING_START",CS="THINKING_END",xS="THINKING_TEXT_MESSAGE_START",ES="THINKING_TEXT_MESSAGE_CONTENT",IS="THINKING_TEXT_MESSAGE_END",z_=class extends au{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(xn(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case wS:{this.currentReasoningId=Hi();let{title:t,...r}=e;return this.warnAboutTransformation(wS,D.REASONING_START),{...r,type:D.REASONING_START,messageId:this.currentReasoningId}}case xS:return this.currentMessageId=Hi(),this.warnAboutTransformation(xS,D.REASONING_MESSAGE_START),{...e,type:D.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case ES:{let{delta:t,...r}=e;return this.warnAboutTransformation(ES,D.REASONING_MESSAGE_CONTENT),{...r,type:D.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Hi(),delta:t}}case IS:{let t=this.currentMessageId??Hi();return this.warnAboutTransformation(IS,D.REASONING_MESSAGE_END),{...e,type:D.REASONING_MESSAGE_END,messageId:t}}case CS:{let t=this.currentReasoningId??Hi();return this.warnAboutTransformation(CS,D.REASONING_END),{...e,type:D.REASONING_END,messageId:t}}default:return e}}};function W_(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function K_(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function Y_(e){let t=W_(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 X_(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>K_(n)?Y_(n):n);return{...e,content:r}}var Z_=class extends au{run(e,t){let r={...e,messages:e.messages.map(X_)};return this.runNext(r,t)}},J_="0.0.58",eO=class{get maxVersion(){return J_}get debug(){return this._debug}set debug(e){this._debug=iu(e),this._debugLogger=Cp(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?Cp(iu(!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??Ir(),this.messages=we(n??[]),this.state=we(o??{}),this._debug=iu(i),this._debugLogger=Cp(this._debug),Qi(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new H_),Qi(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new z_),Qi(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new Z_)}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 $_(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this1=this;return _asyncToGenerator(function*(){try{_this1.isRunning=!0,_this1.agentId=_this1.agentId??Ir();let r=_this1.prepareRunAgentInput(e);_this1.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this1.agentId,threadId:_this1.threadId});let n,o=new Set(_this1.messages.map(c=>c.id)),i=[{onRunFinishedEvent:c=>{c.outcome==="success"&&(n=c.result)}},..._this1.subscribers,t??{}];yield _this1.onInitialize(r,i),_this1.activeRunDetach$=new Xt;let s;_this1.activeRunCompletionPromise=new Promise(c=>{s=c}),yield bc(sc(()=>_this1.middlewares.length===0?_this1.run(r):_this1.middlewares.reduceRight((c,u)=>({run:g=>u.run(g,c),get messages(){return c.messages},get state(){return c.state}}),_this1).run(r),su(_this1.debugLogger),xp(_this1.debugLogger),c=>c.pipe(xc(_this1.activeRunDetach$)),c=>_this1.apply(r,c,i),c=>_this1.processApplyEvents(r,c,i),Vi(c=>(_this1.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this1.agentId,error:c instanceof Error?c.message:String(c)}),_this1.isRunning=!1,_this1.onError(r,c,i))),En(()=>{_this1.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this1.agentId,threadId:_this1.threadId}),_this1.isRunning=!1,_this1.onFinalize(r,i),s?.(),s=void 0,_this1.activeRunCompletionPromise=void 0,_this1.activeRunDetach$=void 0}))(qe(null)));let a=we(_this1.messages).filter(c=>!o.has(c.id));return{result:n,newMessages:a}}finally{_this1.isRunning=!1}})()}connect(e){throw new Qd}connectAgent(e,t){var _this10=this;return _asyncToGenerator(function*(){try{_this10.isRunning=!0,_this10.agentId=_this10.agentId??Ir();let r=_this10.prepareRunAgentInput(e),n,o=new Set(_this10.messages.map(c=>c.id)),i=[{onRunFinishedEvent:c=>{c.outcome==="success"&&(n=c.result)}},..._this10.subscribers,t??{}];yield _this10.onInitialize(r,i),_this10.activeRunDetach$=new Xt;let s;_this10.activeRunCompletionPromise=new Promise(c=>{s=c}),yield bc(sc(()=>wc(()=>_this10.connect(r)),su(_this10.debugLogger),xp(_this10.debugLogger),c=>c.pipe(xc(_this10.activeRunDetach$)),c=>_this10.apply(r,c,i),c=>_this10.processApplyEvents(r,c,i),Vi(c=>(_this10.isRunning=!1,c instanceof Qd?cc:_this10.onError(r,c,i))),En(()=>{_this10.isRunning=!1,_this10.onFinalize(r,i),s?.(),s=void 0,_this10.activeRunCompletionPromise=void 0,_this10.activeRunDetach$=void 0}))(qe(null)),{defaultValue:void 0});let a=we(_this10.messages).filter(c=>!o.has(c.id));return{result:n,newMessages:a}}finally{_this10.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this11=this;return _asyncToGenerator(function*(){if(!_this11.activeRunDetach$)return;let e=_this11.activeRunCompletionPromise??Promise.resolve();_this11.activeRunDetach$.next(),_this11.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return RS(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(ap(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=we(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Ir(),tools:we(e?.tools??[]),context:we(e?.context??[]),forwardedProps:we(e?.forwardedProps??{}),state:we(this.state),messages:t,...(e?.resume===void 0?{}:{resume:we(e.resume)})}}onInitialize(e,t){var _this12=this;return _asyncToGenerator(function*(){if(_this12.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(i=>i.interruptId)),o=_this12.pendingInterrupts.map(i=>i.id).filter(i=>!n.has(i));if(o.length>0)throw new Fe(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let i of _this12.pendingInterrupts)if(G_(i))throw new Fe(`Interrupt ${i.id} expired at ${i.expiresAt}`)}let r=yield Te(t,_this12.messages,_this12.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this12,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this12.messages=r.messages,e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this12.messages,state:_this12.state,agent:_this12,input:e})})),r.state&&(_this12.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this12.state,messages:_this12.messages,agent:_this12,input:e})})))})()}onError(e,t,r){return Cn(Te(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(xn(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 _this13=this;return _asyncToGenerator(function*(){let r=yield Te(t,_this13.messages,_this13.state,(n,o,i)=>n.onRunFinalized?.({messages:o,state:i,agent:_this13,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this13.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this13.messages,state:_this13.state,agent:_this13,input:e})})),r.state!==void 0&&(_this13.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this13.state,messages:_this13.messages,agent:_this13,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=we(this.messages),e.state=we(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=we(this.pendingInterrupts),e}addMessage(e){var _this14=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this14.subscribers)yield t.onNewMessage?.({message:e,messages:_this14.messages,state:_this14.state,agent:_this14});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this14.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this14.messages,state:_this14.state,agent:_this14});for(let t of _this14.subscribers)yield t.onMessagesChanged?.({messages:_this14.messages,state:_this14.state,agent:_this14})})()}addMessages(e){var _this15=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this15.subscribers)yield r.onNewMessage?.({message:t,messages:_this15.messages,state:_this15.state,agent:_this15});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this15.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this15.messages,state:_this15.state,agent:_this15})}for(let t of _this15.subscribers)yield t.onMessagesChanged?.({messages:_this15.messages,state:_this15.state,agent:_this15})})()}setMessages(e){var _this16=this;this.messages=we(e),_asyncToGenerator(function*(){for(let t of _this16.subscribers)yield t.onMessagesChanged?.({messages:_this16.messages,state:_this16.state,agent:_this16})})()}setState(e){var _this17=this;this.state=we(e),_asyncToGenerator(function*(){for(let t of _this17.subscribers)yield t.onStateChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Ir();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(su(this.debugLogger),xp(this.debugLogger),V_(this.threadId,t.runId,this.agentId),r=>r.pipe(xn(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}},TS=class extends eO{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(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=we(e.headers??{}),this.fetch=e.fetch??((t,r)=>C(t,r))}run(e){return T_(E_(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=we(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 kS=(e,t,r)=>{let n=ot(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 Rp=class extends TS{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}}},_S=(e,t,r)=>new Rp({url:`${kS(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var tO=new re({required:!0}),OS=new re({required:!0,constrainTo:_a}),PS=e=>({...e,name:Oa(e.name)}),NS=B("followUpAnswers/setIsEnabled",e=>W(e,new je({required:!0}))),FS=B("followUpAnswers/setFollowUpAnswersConversationId",e=>W(e,ee)),DS=B("followUpAnswers/setFollowUpAnswersConversationToken",e=>W(e,ee)),MS=B("followUpAnswers/clearFollowUpAnswersConversationToken"),yee=B("followUpAnswers/createFollowUpAnswer",e=>W(e,{question:ee})),vee=B("followUpAnswers/setActiveFollowUpAnswerId",e=>W(e,ee)),See=B("followUpAnswers/setFollowUpAnswerContentFormat",e=>W(e,{contentFormat:Na,answerId:ee})),Aee=B("followUpAnswers/setFollowUpIsLoading",e=>W(e,{isLoading:new je({required:!0}),answerId:ee})),bee=B("followUpAnswers/setFollowUpIsStreaming",e=>W(e,{isStreaming:new je({required:!0}),answerId:ee})),wee=B("followUpAnswers/followUpMessageChunkReceived",e=>W(e,{textDelta:tO,answerId:ee})),Cee=B("followUpAnswers/followUpCitationsReceived",e=>W(e,{citations:new Ft({required:!0,each:new xe({values:Od})}),answerId:ee})),xee=B("followUpAnswers/followUpCompleted",e=>W(e,{answerId:ee,cannotAnswer:new je({required:!1})})),Eee=B("followUpAnswers/followUpFailed",e=>W(e,{message:new re,code:new Le({min:0}),answerId:ee})),Iee=B("followUpAnswers/activeFollowUpStartFailed",e=>W(e,{message:new re})),Ree=B("followUpAnswers/likeFollowUp",e=>W(e,{answerId:ee})),Tee=B("followUpAnswers/dislikeFollowUp",e=>W(e,{answerId:ee})),kee=B("followUpAnswers/submitFollowUpFeedback",e=>W(e,{answerId:ee})),LS=B("followUpAnswers/resetFollowUpAnswers"),_ee=B("followUpAnswers/stepStarted",e=>W(PS(e),{answerId:ee,name:OS,startedAt:new Le({min:0,required:!0})})),Oee=B("followUpAnswers/stepFinished",e=>W(PS(e),{answerId:ee,name:OS,finishedAt:new Le({min:0,required:!0})})),Pee=B("followUpAnswers/startToolCall",e=>W(e,{answerId:ee,toolCallName:ee,startedAt:new Le({min:0,required:!0}),toolCallId:ee})),Nee=B("followUpAnswers/finishToolCall",e=>W(e,{answerId:ee,finishedAt:new Le({min:0,required:!0}),toolCallId:ee})),Fee=B("followUpAnswers/toolCallArgs",e=>W(e,{answerId:ee,toolCallId:ee,args:new xe({options:{required:!0}}),type:new re({required:!0,constrainTo:Pa})}));m();d();f();p();var rO={"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 jS(e){return e?rO[e]??1004:1004}var qS=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Fa(n.runId)),e(Er(!1)),e(Ii(!0)),e(FS(n.threadId)),e(MS())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(ay({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(cy({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onToolCallStartEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:i,toolCallId:s,timestamp:a}=n;e(uy({toolCallId:s,toolCallName:i,startedAt:a??Date.now()}))},onToolCallEndEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,timestamp:s}=n;e(ly({toolCallId:i,finishedAt:s??Date.now()}))},onToolCallArgsEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,delta:s}=n;try{let a=JSON.parse(s);typeof a?.q=="string"?e(Ma({toolCallId:i,args:a,type:"search"})):e(Ma({toolCallId:i,args:{raw:s},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${s}`),e(Ma({toolCallId:i,args:{raw:s},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(Ri({textDelta:n.delta})))},onCustomEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{name:i,value:s}=n;switch(i){case"header":{s?.contentFormat&&e(_i(s.contentFormat)),typeof s?.followUpEnabled=="boolean"&&e(NS(s.followUpEnabled)),s?.conversationToken&&e(DS(s.conversationToken));return}case"citations":{e(Ti({citations:s.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=jS(n.code);e(ki({message:n.message,code:i}))},onRunFinishedEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=n.result?.completionReason==="ANSWERED",s=i?!r:void 0;e(Pd(i)),e(Oi(!i)),e(Ii(!1)),e(pd(i,t,s)),e(io())}}};var US=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _ref47=_asyncToGenerator(function*(n,o,i){t();let s=va(n),a=sh(n),c=ah(n),u=ih(n),g=ch(n),v=_S(s,a,c);e=v;let w=qS(o),h=ey(n,i());try{o(Er(!0)),yield v.runAgent({forwardedProps:{params:h,accessToken:u,recordDebugSession:g}},w)}catch(y){o(Er(!1)),o(ki({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});return function run(_x89,_x90,_x91){return _ref47.apply(this,arguments)}}(),abortRun:t}};m();d();f();p();m();d();f();p();var VS=B("breadcrumb/deselectAll"),BS=B("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var GS=B("facet/updateFacetAutoSelection",e=>W(e,{allow:new je({required:!0})}));m();d();f();p();m();d();f();p();var cu=class extends br{constructor(r){super(r);oe(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??Mt().q}get responseTime(){return this.activeInstantResultCache?.duration??Qt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??Qt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var $S=()=>Re("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new cu(e)),QS=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var Tp={id:ee},nO={...Tp,q:Dt},Gte=B("instantResults/register",e=>W(e,Tp)),uu=B("instantResults/updateQuery",e=>W(e,nO)),$te=B("instantResults/clearExpired",e=>W(e,Tp));m();d();f();p();var lu=new Le({required:!0,min:0}),Jte=B("pagination/registerNumberOfResults",e=>W(e,lu)),ere=B("pagination/updateNumberOfResults",e=>W(e,lu)),tre=B("pagination/registerPage",e=>W(e,lu)),HS=B("pagination/updatePage",e=>W(e,lu)),rre=B("pagination/nextPage"),nre=B("pagination/previousPage");m();d();f();p();var To=B("query/updateQuery",e=>W(e,{q:new re,enableQuerySyntax:new je}));m();d();f();p();m();d();f();p();m();d();f();p();var ko=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var kp=()=>Re("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),Pr=e=>Re("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||Mt().q,aq:r.advancedSearchQueries?.aq||ko().aq,cq:r.advancedSearchQueries?.cq||ko().cq,dq:r.advancedSearchQueries?.dq||ko().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();m();d();f();p();var du=e=>e.success!==void 0,ft=e=>e.error!==void 0;m();d();f();p();var ene=B("didYouMean/enable"),tne=B("didYouMean/disable"),rne=B("didYouMean/automaticCorrections/disable"),nne=B("didYouMean/automaticCorrections/enable"),pu=B("didYouMean/correction",e=>W(e,ee)),one=B("didYouMean/automaticCorrections/mode",e=>W(e,new re({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var _p=()=>Re("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var zS=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function WS(){return{contextValues:{}}}m();d();f();p();function KS(){return{contextValues:{}}}m();d();f();p();function YS(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function XS(){return[]}m();d();f();p();function ZS(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function JS(){return{}}m();d();f();p();function eA(){return{}}m();d();f();p();function tA(){return{}}function Zt(e){return{context:e.context||WS(),dictionaryFieldContext:e.dictionaryFieldContext||KS(),facetSet:e.facetSet||ya(),numericFacetSet:e.numericFacetSet||ha(),dateFacetSet:e.dateFacetSet||ga(),categoryFacetSet:e.categoryFacetSet||ma(),automaticFacetSet:e.automaticFacetSet??fa(),pagination:e.pagination||ZS(),query:e.query||Mt(),tabSet:e.tabSet||tA(),advancedSearchQueries:e.advancedSearchQueries||ko(),staticFilterSet:e.staticFilterSet||eA(),querySet:e.querySet||JS(),sortCriteria:e.sortCriteria||Sa(),pipeline:e.pipeline||oo(),searchHub:e.searchHub||zn(),facetOptions:e.facetOptions||YS(),facetOrder:e.facetOrder??XS(),debug:e.debug??js()}}m();d();f();p();var _oe=new xe({values:{undoneQuery:Dt},options:{required:!0}}),rA=()=>Re("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var fu=B("trigger/query/ignore",e=>W(e,new re({emptyAllowed:!0,required:!0}))),mu=B("trigger/query/modification",e=>W(e,new xe({values:{originalQuery:He,modification:He}})));m();d();f();p();var Nr=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=sO(e),n=Ra(e),o=oO(e),i=yield so(e,t),s=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return wr({...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:s(),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 Nr(_x92,_x93){return _ref48.apply(this,arguments)}}();function oO(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(iO).filter(r=>r.currentValues.length>0):void 0}function iO(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function sO(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=aO(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function aO(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 Fr=class{constructor(t,r=n=>{this.dispatch(To({q:n}))}){oe(this,"config",t);oe(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x94,_x95){var _this18=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Ia(yield _this18.extra.apiClient.search(r,n),t),s=Date.now()-o,a=_this18.getState().query?.q||"";return{response:i,duration:s,queryExecuted:a,requestExecuted:r}}).apply(this,arguments)}process(t){var _this19=this;return _asyncToGenerator(function*(){return _this19.processQueryErrorOrContinue(t)??(yield _this19.processQueryCorrectionsOrContinue(t))??(yield _this19.processQueryTriggersOrContinue(t))??_this19.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return ft(t.response)?(this.dispatch(Pr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this20=this;return _asyncToGenerator(function*(){let r=_this20.getState(),n=_this20.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:s,queryCorrections:a,queryCorrection:c}=n;if(!o||!i)return null;let u=s.length===0&&a&&a.length!==0,g=!ce(c)&&!ce(c.correctedQuery);if(!u&&!g)return null;let w=u?yield _this20.processLegacyDidYouMeanAutoCorrection(t):_this20.processModernDidYouMeanAutoCorrection(t);return _this20.dispatch(Gt(Zt(_this20.getState()))),w})()}processLegacyDidYouMeanAutoCorrection(t){var _this21=this;return _asyncToGenerator(function*(){let r=_this21.getCurrentQuery(),n=_this21.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this21.automaticallyRetryQueryWithCorrection(o);return ft(i.response)?(_this21.dispatch(Pr(i.response.error)),_this21.rejectWithValue(i.response.error)):(_this21.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this21.dispatch(Gt(Zt(_this21.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:_p()})})()}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:_p()}}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 _this22=this;return _asyncToGenerator(function*(){let r=_this22.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(a=>a.type==="query")?.content||"";if(!n)return null;if(_this22.getState().triggers?.queryModification.queryToIgnore===n)return _this22.dispatch(fu("")),null;_this22.analyticsAction&&(yield _this22.dispatch(_this22.analyticsAction));let i=_this22.getCurrentQuery(),s=yield _this22.automaticallyRetryQueryWithTriggerModification(n);return ft(s.response)?(_this22.dispatch(Pr(s.response.error)),_this22.rejectWithValue(s.response.error)):(_this22.dispatch(Gt(Zt(_this22.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:rA()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??Mt().enableQuerySyntax},search:{...Qt(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Gt(Zt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return du(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this23=this;return _asyncToGenerator(function*(){_this23.onUpdateQueryForCorrection(t);let r=yield _this23.fetchFromAPI(yield Nr(_this23.getState()),{origin:"mainSearch"});return _this23.dispatch(pu(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.dispatch(mu({newQuery:t,originalQuery:_this24.getCurrentQuery()})),_this24.onUpdateQueryForCorrection(t),yield _this24.fetchFromAPI(yield Nr(_this24.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 _ie=Ce("search/executeSearch",/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t){let r=t.getState();return yield gu(r,t,e)});return function(_x96,_x97){return _ref49.apply(this,arguments)}}()),Oie=Ce("search/fetchPage",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Pp(r,t,e)});return function(_x98,_x99){return _ref50.apply(this,arguments)}}()),Pie=Ce("search/fetchMoreResults",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Np(t,r)});return function(_x100,_x101){return _ref51.apply(this,arguments)}}()),Nie=Ce("search/fetchFacetValues",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield dO(t,e,r)});return function(_x102,_x103){return _ref52.apply(this,arguments)}}()),Fie=Ce("search/fetchInstantResults",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){return Op(e,t)});return function(_x104,_x105){return _ref53.apply(this,arguments)}}()),cO=/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=yield Nr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function cO(_x106,_x107){return _ref54.apply(this,arguments)}}(),uO=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield so(e);return wr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function uO(_x108,_x109,_x110){return _ref55.apply(this,arguments)}}(),lO=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){let r=yield Nr(e,t);return r.request.numberOfResults=0,r});return function lO(_x111,_x112){return _ref56.apply(this,arguments)}}(),nA=e=>{e.configuration.analytics.enabled&&yt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Op(_x113,_x114){return _Op.apply(this,arguments)}function _Op(){_Op=_asyncToGenerator(function*(e,t){W(e,{id:ee,q:ee,maxResultsPerQuery:new Le({required:!0,min:1}),cacheTimeout:new Le});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new Fr({...t,analyticsAction:$S()},u=>{t.dispatch(uu({q:u,id:e.id}))}),s=yield uO(o,r,n),a=yield i.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),c=yield i.process(a);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,analyticsAction:c.analyticsAction,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return _Op.apply(this,arguments)}function Pp(_x115,_x116,_x117){return _Pp.apply(this,arguments)}function _Pp(){_Pp=_asyncToGenerator(function*(e,t,r){nA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:s}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),a=new Fr({...t,analyticsAction:r}),c=yield Nr(e,s),u=yield a.fetchFromAPI(c,{origin:"mainSearch"});return yield a.process(u)});return _Pp.apply(this,arguments)}function Np(_x118,_x119){return _Np.apply(this,arguments)}function _Np(){_Np=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield kp().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),s=new Fr({...e,analyticsAction:kp()}),a=yield cO(t,i),c=yield s.fetchFromAPI(a,{origin:"mainSearch"});return yield s.process(c)});return _Np.apply(this,arguments)}function dO(_x120,_x121,_x122){return _dO.apply(this,arguments)}function _dO(){_dO=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=e.extra,{description:s}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),a=new Fr({...e,analyticsAction:t}),c=yield lO(r,s),u=yield a.fetchFromAPI(c,{origin:"facetValues"});return yield a.process(u)});return _dO.apply(this,arguments)}function gu(_x123,_x124,_x125){return _gu.apply(this,arguments)}function _gu(){_gu=_asyncToGenerator(function*(e,t,r){nA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:s}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),a=yield Nr(e,s),c=new Fr({...t,analyticsAction:r}),u=yield c.fetchFromAPI(a,{origin:"mainSearch"});return yield c.process(u)});return _gu.apply(this,arguments)}m();d();f();p();var Dr=class{constructor(t,r=n=>{this.dispatch(To({q:n}))}){oe(this,"config",t);oe(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x126,_x127){var _this25=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Ia(yield _this25.extra.apiClient.search(r,n),t),s=Date.now()-o,a=_this25.getState().query?.q||"";return{response:i,duration:s,queryExecuted:a,requestExecuted:r}}).apply(this,arguments)}process(t){var _this26=this;return _asyncToGenerator(function*(){return _this26.processQueryErrorOrContinue(t)??(yield _this26.processQueryCorrectionsOrContinue(t))??(yield _this26.processQueryTriggersOrContinue(t))??_this26.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return ft(t.response)?(this.dispatch(Pr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getState(),n=_this27.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:s,queryCorrections:a,queryCorrection:c}=n;if(!o)return null;if(!i)return!ce(c)&&!ce(c.correctedQuery)?_this27.processModernDidYouMeanAutoCorrection(t):null;let u=s.length===0&&a&&a.length!==0,g=!ce(c)&&!ce(c.correctedQuery);if(!u&&!g)return null;let w=u?yield _this27.processLegacyDidYouMeanAutoCorrection(t):_this27.processModernDidYouMeanAutoCorrection(t);return _this27.dispatch(Gt(Zt(_this27.getState()))),w})()}processLegacyDidYouMeanAutoCorrection(t){var _this28=this;return _asyncToGenerator(function*(){let r=_this28.getCurrentQuery(),n=_this28.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this28.automaticallyRetryQueryWithCorrection(o);return ft(i.response)?(_this28.dispatch(Pr(i.response.error)),_this28.rejectWithValue(i.response.error)):(_this28.dispatch(Gt(Zt(_this28.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 _this29=this;return _asyncToGenerator(function*(){let r=_this29.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(a=>a.type==="query")?.content||"";if(!n)return null;if(_this29.getState().triggers?.queryModification.queryToIgnore===n)return _this29.dispatch(fu("")),null;let i=_this29.getCurrentQuery(),s=yield _this29.automaticallyRetryQueryWithTriggerModification(n);return ft(s.response)?(_this29.dispatch(Pr(s.response.error)),_this29.rejectWithValue(s.response.error)):(_this29.dispatch(Gt(Zt(_this29.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Gt(Zt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return du(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this30=this;return _asyncToGenerator(function*(){_this30.onUpdateQueryForCorrection(t);let r=_this30.getState(),{actionCause:n}=zS(),o=yield _this30.fetchFromAPI(yield xr(r,_this30.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this30.dispatch(pu(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.dispatch(mu({newQuery:t,originalQuery:_this31.getCurrentQuery()})),_this31.onUpdateQueryForCorrection(t),yield _this31.fetchFromAPI(yield xr(_this31.getState(),_this31.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 Ase=Ce("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;W(e,{q:new re,enableQuerySyntax:new je,clearFilters:new je}),e.clearFilters&&(r(VS()),r(BS())),r(GS({allow:!0})),r(To({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(HS(1))}),bse=B("search/updateSearchAction"),hu=Ce("search/executeSearch",/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return gu(r,t,e.legacy);sA(r);let n=e.next?aA(e.next):void 0,o=yield xr(r,t.extra.navigatorContext,n),i=new Dr({...t,analyticsAction:n??{}}),s=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(s)});return function(_x128,_x129){return _ref57.apply(this,arguments)}}()),oA=Ce("search/fetchPage",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t){let r=t.getState();if(sA(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Pp(r,t,e.legacy);let n=new Dr({...t,analyticsAction:e.next}),o=yield xr(r,t.extra.navigatorContext,e.next),i=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(i)});return function(_x130,_x131){return _ref58.apply(this,arguments)}}()),iA=Ce("search/fetchMoreResults",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Np(t,r);let n=bh("browseResults",t.getState),o=new Dr({...t,analyticsAction:n}),i=yield pO(r,t.extra.navigatorContext,n),s=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(s)});return function(_x132,_x133){return _ref59.apply(this,arguments)}}()),wse=Ce("search/fetchFacetValues",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return gu(r,t,e.legacy);let n=new Dr({...t,analyticsAction:{}}),o=yield mO(r,t.extra.navigatorContext),i=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(i)});return function(_x134,_x135){return _ref60.apply(this,arguments)}}()),Cse=Ce("search/fetchInstantResults",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Op(e,t);W(e,{id:ee,q:ee,maxResultsPerQuery:new Le({required:!0,min:1}),cacheTimeout:new Le});let{q:n,maxResultsPerQuery:o}=e,i=aA(QS()),s=yield fO(r,t.extra.navigatorContext,n,o,i),a=new Dr({...t,analyticsAction:i},g=>{t.dispatch(uu({q:g,id:e.id}))}),c=yield a.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),u=yield a.process(c);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return function(_x136,_x137){return _ref61.apply(this,arguments)}}()),pO=/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(e,t,r){let n=yield xr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function pO(_x138,_x139,_x140){return _ref62.apply(this,arguments)}}(),fO=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t,r,n,o){let i=Ta(e,t,o);return wr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function fO(_x141,_x142,_x143,_x144,_x145){return _ref63.apply(this,arguments)}}(),mO=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t,r){let n=yield xr(e,t,r);return n.request.numberOfResults=0,n});return function mO(_x146,_x147,_x148){return _ref64.apply(this,arguments)}}(),sA=e=>{e.configuration.analytics.enabled&&yt.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 cA=e=>{let t=Em({extra:e}),r=US();return t.startListening({actionCreator:hu.pending,effect:function(){var _ref65=_asyncToGenerator(function*(n,o){let i=o.getState();if(!nd(i)||(r.abortRun(),o.dispatch(Da()),o.dispatch(LS()),i.generatedAnswer.isEnabled===!1))return;let s=Zr(i)?.q;!s||s.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});return function effect(_x149,_x150){return _ref65.apply(this,arguments)}}()}),t};m();d();f();p();var uA=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)},lA=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var Fp=(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 dA(e,t){let r={...e},n,o=i=>(s,a)=>{let c=i(s,a);return n?n(c,a):c};return{get combinedReducer(){let i=Sf(Object.entries(t).filter(([s])=>!(s in r)).map(([s,a])=>[s,()=>a]));return o(qn({...i,...r}))},containsAll(i){return Object.keys(i).every(a=>a in r)},add(i){Object.keys(i).filter(s=>!(s in r)).forEach(s=>{r[s]=i[s]})},addCrossReducer(i){n=i}}}m();d();f();p();m();d();f();p();var _o=B("app/setError");m();d();f();p();function gO(e){if(!e||!hO(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 pA(e,t=60){if(!e)return!1;let r=gO(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function hO(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function mA(e,t){let r=0,n=null,o=ns(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(v,w=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(S){if(!w)throw S;return null}})().finally(()=>{n=null}));let y=yield n;return h&&y&&v.dispatch(Hn({accessToken:y})),y});return function i(_x151){return _ref66.apply(this,arguments)}}(),s=v=>{let w=SO(v.getState());return!!w&&pA(w)},a=/*#__PURE__*/function(){var _ref68=_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(w){e.warn(w,"Access token renewal failed. A retry will occur if necessary.")}});return function a(_x152){return _ref68.apply(this,arguments)}}(),c=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(v,w,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),fA(v,w.error),w;!n&&(r++,o());try{yield i(v,!0)}catch(S){e.debug(S,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}v.dispatch(h)});return function c(_x153,_x154,_x155){return _ref69.apply(this,arguments)}}(),u=(v,w,h)=>vO(h)?t?c(v,h,w):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),fA(v,h.error),h):h,g=(v,w,h)=>yO(h)?Promise.resolve(h).then(y=>u(v,w,y)):u(v,w,h);return v=>w=>h=>{if(!(typeof h=="function"))return w(h);let S=()=>g(v,h,w(h));return typeof t=="function"&&s(v)?a(v).then(S):S()}}function yO(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function vO(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Fn().name}function fA(e,t){e.dispatch(_o({status:401,statusCode:401,message:t.message,type:t.name}))}function SO(e){return e.configuration.accessToken}m();d();f();p();function gA({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return dm({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(lA(n.logger))})}function AO(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,disableBrowserPrivacySignals:o,...i}=r??{},s={...i,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})},a=s.analyticsMode!=="next",c=s.analyticsMode==="legacy"&&o===!0;return a&&Qu()&&!c?(t.info("Analytics disabled since doNotTrack is active."),{...s,enabled:!1}):(a&&Qu()&&c&&s.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."),s)}function hA(e,t){let r={...e.reducers,configuration:St,version:Ay},n=bO({...e,reducers:r},t,St),{accessToken:o,environment:i,organizationId:s}=e.configuration;n.dispatch(Hn({accessToken:o,environment:i,organizationId:s}));let a=AO(e.configuration,n.logger);return a&&n.dispatch(Vs(a)),n}function bO(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=dA({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let s=t.logger,a={...t,get relay(){return ci(u.state,o)},get navigatorContext(){return Fp(this.relay,o)}},c=wO(e,a,i),u={addReducers(g){i.containsAll(g)||(i.add(g),c.replaceReducer(i.combinedReducer))},dispatch:c.dispatch,subscribe:c.subscribe,enableAnalytics(){c.dispatch(Gs())},disableAnalytics(){c.dispatch(Bs())},get state(){return c.getState()},get relay(){return ci(this.state,o)},get navigatorContext(){return Fp(this.relay,o)},logger:s,store:c};return u}function wO(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",s=CO(e,t.logger,()=>t.navigatorContext);return gA({preloadedState:n,reducer:r.combinedReducer,middlewares:s,thunkExtraArguments:t,name:i})}function CO(e,t,r){let{renewAccessToken:n}=e.configuration,o=mA(t,n),i=cA({getNavigatorContext:r});return[Py,o,uA(t),wy].concat(Fd.middleware,i.middleware,e.middlewares||[])}var xO=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
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()},D_=e=>{let t=new Xt,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==Rn.HEADERS&&o.type===Rn.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),s=AS(i);t.next(s),r=r.slice(o)}catch(i){let s=i instanceof Error?i.message:String(i);t.error(Error(`Failed to decode protocol buffer message: ${s}`));return}}}return t.asObservable()},M_=(e,t)=>{let r=zi(t),n=new Xt,o=new uc,i=!1;return e.subscribe({next:s=>{if(o.next(s),s.type===Rn.HEADERS&&!i){i=!0;let a=s.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:a,parser:a===Cp?"protobuf":"sse"}),a===Cp?D_(o).subscribe({next:c=>n.next(c),error:c=>n.error(c),complete:()=>n.complete()}):F_(o,r).subscribe({next:c=>{try{let u=za.parse(c);r?.event("HTTP","Event validated:",u,{type:u.type,valid:!0}),n.next(u)}catch(u){r?.event("HTTP","Event invalid:",{json:c,error:String(u)}),n.error(u)}},error:c=>{if(c?.name==="AbortError"){n.next({type:D.RUN_ERROR,message:c.message||"Request aborted",code:"abort",rawEvent:c}),n.complete();return}return n.error(c)},complete:()=>n.complete()})}else i||n.error(Error("No headers event received before data events"))},error:s=>{o.error(s),n.error(s)},complete:()=>{o.complete()}}),n.asObservable()},Pe=A.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),L_=A.enum(["LangGraphInterruptEvent","PredictState","Exit"]),j_=A.object({type:A.literal(Pe.enum.TextMessageStart),messageId:A.string(),parentMessageId:A.string().optional(),role:A.string().optional()}),q_=A.object({type:A.literal(Pe.enum.TextMessageContent),messageId:A.string(),content:A.string()}),U_=A.object({type:A.literal(Pe.enum.TextMessageEnd),messageId:A.string()}),V_=A.object({type:A.literal(Pe.enum.ActionExecutionStart),actionExecutionId:A.string(),actionName:A.string(),parentMessageId:A.string().optional()}),B_=A.object({type:A.literal(Pe.enum.ActionExecutionArgs),actionExecutionId:A.string(),args:A.string()}),G_=A.object({type:A.literal(Pe.enum.ActionExecutionEnd),actionExecutionId:A.string()}),$_=A.object({type:A.literal(Pe.enum.ActionExecutionResult),actionName:A.string(),actionExecutionId:A.string(),result:A.string()}),Q_=A.object({type:A.literal(Pe.enum.AgentStateMessage),threadId:A.string(),agentName:A.string(),nodeName:A.string(),runId:A.string(),active:A.boolean(),role:A.string(),state:A.string(),running:A.boolean()}),H_=A.object({type:A.literal(Pe.enum.MetaEvent),name:L_,value:A.any()}),z_=A.object({type:A.literal(Pe.enum.RunError),message:A.string(),code:A.string().optional()});A.discriminatedUnion("type",[j_,q_,U_,V_,B_,G_,$_,Q_,H_,z_]),A.object({id:A.string(),role:A.string(),content:A.string(),parentMessageId:A.string().optional()}),A.object({id:A.string(),name:A.string(),arguments:A.any(),parentMessageId:A.string().optional()}),A.object({id:A.string(),result:A.any(),actionExecutionId:A.string(),actionName:A.string()});var W_=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
+ `)},K_=(e,t,r)=>n=>{let o={},i=!0,s=!0,a="",c=null,u=null,g=[],v={},w=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(pt(h=>{switch(h.type){case D.TEXT_MESSAGE_START:{let y=h;return[{type:Pe.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case D.TEXT_MESSAGE_CONTENT:{let y=h;return[{type:Pe.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case D.TEXT_MESSAGE_END:{let y=h;return[{type:Pe.enum.TextMessageEnd,messageId:y.messageId}]}case D.TOOL_CALL_START:{let y=h;return g.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),s=!0,v[y.toolCallId]=y.toolCallName,[{type:Pe.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case D.TOOL_CALL_ARGS:{let y=h,S=g.find(I=>I.id===y.toolCallId);if(!S)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];S.function.arguments+=y.delta;let x=!1;if(u){let I=u.find(_=>_.tool==S.function.name);if(I)try{let _=JSON.parse(Rc(S.function.arguments));I.tool_argument&&I.tool_argument in _?(w({...o,[I.state_key]:_[I.tool_argument]}),x=!0):I.tool_argument||(w({...o,[I.state_key]:_}),x=!0)}catch{}}return[{type:Pe.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(x?[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}]:[])]}case D.TOOL_CALL_END:{let y=h;return[{type:Pe.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case D.TOOL_CALL_RESULT:{let y=h;return[{type:Pe.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:v[y.toolCallId]||"unknown"}]}case D.RAW:return[];case D.CUSTOM:{let y=h;switch(y.name){case"Exit":i=!1;break;case"PredictState":u=y.value;break}return[{type:Pe.enum.MetaEvent,name:y.name,value:y.value}]}case D.STATE_SNAPSHOT:return w(h.snapshot),[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}];case D.STATE_DELTA:{let y=h,S=tc.applyPatch(o,y.delta,!0,!1);return S?(w(S.newDocument),[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}]):[]}case D.MESSAGES_SNAPSHOT:return c=h.messages,[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(c?{messages:c}:{})}),active:!0}];case D.RUN_STARTED:return[];case D.RUN_FINISHED:return c&&(o.messages=c),Object.keys(o).length===0?[]:[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(c?{messages:Y_(c)}:{})}),active:!1}];case D.RUN_ERROR:{let y=h;return[{type:Pe.enum.RunError,message:y.message,code:y.code}]}case D.STEP_STARTED:return a=h.stepName,g=[],u=null,[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case D.STEP_FINISHED:return g=[],u=null,[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function Y_(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=W_(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 s of i.toolCalls)if(s.id===r.toolCallId){n=s.function.name;break}}let o={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(o)}return t}var cu=e=>t=>{let r=zi(e),n,o,i,s,a=()=>{if(!n||s!=="text")throw Error("No text message to close");let v={type:D.TEXT_MESSAGE_END,messageId:n.messageId};return s=void 0,n=void 0,r?.event("TRANSFORM","TEXT_MESSAGE_END",v,{messageId:v.messageId}),v},c=()=>{if(!o||s!=="tool")throw Error("No tool call to close");let v={type:D.TOOL_CALL_END,toolCallId:o.toolCallId};return s=void 0,o=void 0,r?.event("TRANSFORM","TOOL_CALL_END",v,{toolCallId:v.toolCallId}),v},u=()=>{if(!i||s!=="reasoning")throw Error("No reasoning message to close");let v={type:D.REASONING_MESSAGE_END,messageId:i.messageId};return s=void 0,i=void 0,r?.event("TRANSFORM","REASONING_MESSAGE_END",v,{messageId:v.messageId}),v},g=()=>s==="text"?[a()]:s==="tool"?[c()]:s==="reasoning"?[u()]:[];return t.pipe(pt(v=>{switch(v.type){case D.TEXT_MESSAGE_START:case D.TEXT_MESSAGE_CONTENT:case D.TEXT_MESSAGE_END:case D.TOOL_CALL_START:case D.TOOL_CALL_ARGS:case D.TOOL_CALL_END:case D.TOOL_CALL_RESULT:case D.STATE_SNAPSHOT:case D.STATE_DELTA:case D.MESSAGES_SNAPSHOT:case D.CUSTOM:case D.RUN_STARTED:case D.RUN_FINISHED:case D.RUN_ERROR:case D.STEP_STARTED:case D.STEP_FINISHED:case D.THINKING_START:case D.THINKING_END:case D.THINKING_TEXT_MESSAGE_START:case D.THINKING_TEXT_MESSAGE_CONTENT:case D.THINKING_TEXT_MESSAGE_END:case D.REASONING_START:case D.REASONING_MESSAGE_START:case D.REASONING_MESSAGE_CONTENT:case D.REASONING_MESSAGE_END:case D.REASONING_END:return[...g(),v];case D.RAW:case D.ACTIVITY_SNAPSHOT:case D.ACTIVITY_DELTA:case D.REASONING_ENCRYPTED_VALUE:return[v];case D.TEXT_MESSAGE_CHUNK:{let w=v,h=[];if((s!=="text"||w.messageId!==void 0&&w.messageId!==n?.messageId)&&h.push(...g()),s!=="text"){if(w.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");n={messageId:w.messageId,name:w.name},s="text";let y={type:D.TEXT_MESSAGE_START,messageId:w.messageId,role:w.role||"assistant",...(w.name!==void 0&&{name:w.name})};h.push(y),r?.event("TRANSFORM","TEXT_MESSAGE_START",y,{messageId:w.messageId})}if(w.delta!==void 0){let y={type:D.TEXT_MESSAGE_CONTENT,messageId:n.messageId,delta:w.delta};h.push(y),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",y,{messageId:n.messageId})}return h}case D.TOOL_CALL_CHUNK:{let w=v,h=[];if((s!=="tool"||w.toolCallId!==void 0&&w.toolCallId!==o?.toolCallId)&&h.push(...g()),s!=="tool"){if(w.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(w.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");o={toolCallId:w.toolCallId,toolCallName:w.toolCallName,parentMessageId:w.parentMessageId},s="tool";let y={type:D.TOOL_CALL_START,toolCallId:w.toolCallId,toolCallName:w.toolCallName,parentMessageId:w.parentMessageId};h.push(y),r?.event("TRANSFORM","TOOL_CALL_START",y,{toolCallId:w.toolCallId,toolCallName:w.toolCallName})}if(w.delta!==void 0){let y={type:D.TOOL_CALL_ARGS,toolCallId:o.toolCallId,delta:w.delta};h.push(y),r?.event("TRANSFORM","TOOL_CALL_ARGS",y,{toolCallId:o.toolCallId})}return h}case D.REASONING_MESSAGE_CHUNK:{let w=v,h=[];if((s!=="reasoning"||w.messageId&&w.messageId!==i?.messageId)&&h.push(...g()),s!=="reasoning"){if(w.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");i={messageId:w.messageId},s="reasoning";let y={type:D.REASONING_MESSAGE_START,messageId:w.messageId};h.push(y),r?.event("TRANSFORM","REASONING_MESSAGE_START",y,{messageId:w.messageId})}if(w.delta!==void 0){let y={type:D.REASONING_MESSAGE_CONTENT,messageId:i.messageId,delta:w.delta};h.push(y),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",y,{messageId:i.messageId})}return h}}return v.type,[]}),En(()=>{g()}))};function X_(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var uu=class{runNext(e,t){return t.run(e).pipe(cu(!1))}runNextWithState(e,t){let r=we(e.messages||[]),n=we(e.state||{}),o=new uc;return _S(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(Ec(/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(s=>setTimeout(s,0)),{event:i,messages:we(r),state:we(n)}});return function(_x88){return _ref42.apply(this,arguments)}}()))}},Z_=class extends uu{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function J_(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 eO=class extends uu{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(J_)};return this.runNext(o,t)}},ES="THINKING_START",IS="THINKING_END",RS="THINKING_TEXT_MESSAGE_START",TS="THINKING_TEXT_MESSAGE_CONTENT",kS="THINKING_TEXT_MESSAGE_END",tO=class extends uu{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(xn(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case ES:{this.currentReasoningId=Hi();let{title:t,...r}=e;return this.warnAboutTransformation(ES,D.REASONING_START),{...r,type:D.REASONING_START,messageId:this.currentReasoningId}}case RS:return this.currentMessageId=Hi(),this.warnAboutTransformation(RS,D.REASONING_MESSAGE_START),{...e,type:D.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case TS:{let{delta:t,...r}=e;return this.warnAboutTransformation(TS,D.REASONING_MESSAGE_CONTENT),{...r,type:D.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Hi(),delta:t}}case kS:{let t=this.currentMessageId??Hi();return this.warnAboutTransformation(kS,D.REASONING_MESSAGE_END),{...e,type:D.REASONING_MESSAGE_END,messageId:t}}case IS:{let t=this.currentReasoningId??Hi();return this.warnAboutTransformation(IS,D.REASONING_END),{...e,type:D.REASONING_END,messageId:t}}default:return e}}};function rO(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function nO(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function oO(e){let t=rO(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 iO(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>nO(n)?oO(n):n);return{...e,content:r}}var sO=class extends uu{run(e,t){let r={...e,messages:e.messages.map(iO)};return this.runNext(r,t)}},aO="0.0.58",cO=class{get maxVersion(){return aO}get debug(){return this._debug}set debug(e){this._debug=au(e),this._debugLogger=Ip(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?Ip(au(!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??Ir(),this.messages=we(n??[]),this.state=we(o??{}),this._debug=au(i),this._debugLogger=Ip(this._debug),Qi(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new eO),Qi(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new tO),Qi(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new sO)}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 Z_(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this1=this;return _asyncToGenerator(function*(){try{_this1.isRunning=!0,_this1.agentId=_this1.agentId??Ir();let r=_this1.prepareRunAgentInput(e);_this1.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this1.agentId,threadId:_this1.threadId});let n,o=new Set(_this1.messages.map(c=>c.id)),i=[{onRunFinishedEvent:c=>{c.outcome==="success"&&(n=c.result)}},..._this1.subscribers,t??{}];yield _this1.onInitialize(r,i),_this1.activeRunDetach$=new Xt;let s;_this1.activeRunCompletionPromise=new Promise(c=>{s=c}),yield Cc(cc(()=>_this1.middlewares.length===0?_this1.run(r):_this1.middlewares.reduceRight((c,u)=>({run:g=>u.run(g,c),get messages(){return c.messages},get state(){return c.state}}),_this1).run(r),cu(_this1.debugLogger),Rp(_this1.debugLogger),c=>c.pipe(Ic(_this1.activeRunDetach$)),c=>_this1.apply(r,c,i),c=>_this1.processApplyEvents(r,c,i),Vi(c=>(_this1.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this1.agentId,error:c instanceof Error?c.message:String(c)}),_this1.isRunning=!1,_this1.onError(r,c,i))),En(()=>{_this1.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this1.agentId,threadId:_this1.threadId}),_this1.isRunning=!1,_this1.onFinalize(r,i),s?.(),s=void 0,_this1.activeRunCompletionPromise=void 0,_this1.activeRunDetach$=void 0}))(qe(null)));let a=we(_this1.messages).filter(c=>!o.has(c.id));return{result:n,newMessages:a}}finally{_this1.isRunning=!1}})()}connect(e){throw new Wd}connectAgent(e,t){var _this10=this;return _asyncToGenerator(function*(){try{_this10.isRunning=!0,_this10.agentId=_this10.agentId??Ir();let r=_this10.prepareRunAgentInput(e),n,o=new Set(_this10.messages.map(c=>c.id)),i=[{onRunFinishedEvent:c=>{c.outcome==="success"&&(n=c.result)}},..._this10.subscribers,t??{}];yield _this10.onInitialize(r,i),_this10.activeRunDetach$=new Xt;let s;_this10.activeRunCompletionPromise=new Promise(c=>{s=c}),yield Cc(cc(()=>xc(()=>_this10.connect(r)),cu(_this10.debugLogger),Rp(_this10.debugLogger),c=>c.pipe(Ic(_this10.activeRunDetach$)),c=>_this10.apply(r,c,i),c=>_this10.processApplyEvents(r,c,i),Vi(c=>(_this10.isRunning=!1,c instanceof Wd?lc:_this10.onError(r,c,i))),En(()=>{_this10.isRunning=!1,_this10.onFinalize(r,i),s?.(),s=void 0,_this10.activeRunCompletionPromise=void 0,_this10.activeRunDetach$=void 0}))(qe(null)),{defaultValue:void 0});let a=we(_this10.messages).filter(c=>!o.has(c.id));return{result:n,newMessages:a}}finally{_this10.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this11=this;return _asyncToGenerator(function*(){if(!_this11.activeRunDetach$)return;let e=_this11.activeRunCompletionPromise??Promise.resolve();_this11.activeRunDetach$.next(),_this11.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return _S(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(lp(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=we(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Ir(),tools:we(e?.tools??[]),context:we(e?.context??[]),forwardedProps:we(e?.forwardedProps??{}),state:we(this.state),messages:t,...(e?.resume===void 0?{}:{resume:we(e.resume)})}}onInitialize(e,t){var _this12=this;return _asyncToGenerator(function*(){if(_this12.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(i=>i.interruptId)),o=_this12.pendingInterrupts.map(i=>i.id).filter(i=>!n.has(i));if(o.length>0)throw new Fe(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let i of _this12.pendingInterrupts)if(X_(i))throw new Fe(`Interrupt ${i.id} expired at ${i.expiresAt}`)}let r=yield Te(t,_this12.messages,_this12.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this12,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this12.messages=r.messages,e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this12.messages,state:_this12.state,agent:_this12,input:e})})),r.state&&(_this12.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this12.state,messages:_this12.messages,agent:_this12,input:e})})))})()}onError(e,t,r){return Cn(Te(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(xn(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 _this13=this;return _asyncToGenerator(function*(){let r=yield Te(t,_this13.messages,_this13.state,(n,o,i)=>n.onRunFinalized?.({messages:o,state:i,agent:_this13,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this13.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this13.messages,state:_this13.state,agent:_this13,input:e})})),r.state!==void 0&&(_this13.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this13.state,messages:_this13.messages,agent:_this13,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=we(this.messages),e.state=we(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=we(this.pendingInterrupts),e}addMessage(e){var _this14=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this14.subscribers)yield t.onNewMessage?.({message:e,messages:_this14.messages,state:_this14.state,agent:_this14});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this14.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this14.messages,state:_this14.state,agent:_this14});for(let t of _this14.subscribers)yield t.onMessagesChanged?.({messages:_this14.messages,state:_this14.state,agent:_this14})})()}addMessages(e){var _this15=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this15.subscribers)yield r.onNewMessage?.({message:t,messages:_this15.messages,state:_this15.state,agent:_this15});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this15.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this15.messages,state:_this15.state,agent:_this15})}for(let t of _this15.subscribers)yield t.onMessagesChanged?.({messages:_this15.messages,state:_this15.state,agent:_this15})})()}setMessages(e){var _this16=this;this.messages=we(e),_asyncToGenerator(function*(){for(let t of _this16.subscribers)yield t.onMessagesChanged?.({messages:_this16.messages,state:_this16.state,agent:_this16})})()}setState(e){var _this17=this;this.state=we(e),_asyncToGenerator(function*(){for(let t of _this17.subscribers)yield t.onStateChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Ir();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(cu(this.debugLogger),Rp(this.debugLogger),K_(this.threadId,t.runId,this.agentId),r=>r.pipe(xn(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}},OS=class extends cO{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(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=we(e.headers??{}),this.fetch=e.fetch??((t,r)=>C(t,r))}run(e){return M_(N_(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=we(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 PS=(e,t,r)=>{let n=ot(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 _p=class extends OS{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}}},NS=(e,t,r)=>new _p({url:`${PS(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var uO=new re({required:!0}),FS=new re({required:!0,constrainTo:Pa}),DS=e=>({...e,name:Na(e.name)}),MS=B("followUpAnswers/setIsEnabled",e=>W(e,new je({required:!0}))),LS=B("followUpAnswers/setFollowUpAnswersConversationId",e=>W(e,ee)),jS=B("followUpAnswers/setFollowUpAnswersConversationToken",e=>W(e,ee)),qS=B("followUpAnswers/clearFollowUpAnswersConversationToken"),Eee=B("followUpAnswers/createFollowUpAnswer",e=>W(e,{question:ee})),Iee=B("followUpAnswers/setActiveFollowUpAnswerId",e=>W(e,ee)),Ree=B("followUpAnswers/setFollowUpAnswerContentFormat",e=>W(e,{contentFormat:Da,answerId:ee})),Tee=B("followUpAnswers/setFollowUpIsLoading",e=>W(e,{isLoading:new je({required:!0}),answerId:ee})),kee=B("followUpAnswers/setFollowUpIsStreaming",e=>W(e,{isStreaming:new je({required:!0}),answerId:ee})),_ee=B("followUpAnswers/followUpMessageChunkReceived",e=>W(e,{textDelta:uO,answerId:ee})),Oee=B("followUpAnswers/followUpCitationsReceived",e=>W(e,{citations:new Ft({required:!0,each:new xe({values:Fd})}),answerId:ee})),Pee=B("followUpAnswers/followUpCompleted",e=>W(e,{answerId:ee,cannotAnswer:new je({required:!1})})),Nee=B("followUpAnswers/followUpFailed",e=>W(e,{message:new re,code:new Le({min:0}),answerId:ee})),Fee=B("followUpAnswers/activeFollowUpStartFailed",e=>W(e,{message:new re})),Dee=B("followUpAnswers/likeFollowUp",e=>W(e,{answerId:ee})),Mee=B("followUpAnswers/dislikeFollowUp",e=>W(e,{answerId:ee})),Lee=B("followUpAnswers/submitFollowUpFeedback",e=>W(e,{answerId:ee})),US=B("followUpAnswers/resetFollowUpAnswers"),jee=B("followUpAnswers/stepStarted",e=>W(DS(e),{answerId:ee,name:FS,startedAt:new Le({min:0,required:!0})})),qee=B("followUpAnswers/stepFinished",e=>W(DS(e),{answerId:ee,name:FS,finishedAt:new Le({min:0,required:!0})})),Uee=B("followUpAnswers/startToolCall",e=>W(e,{answerId:ee,toolCallName:ee,startedAt:new Le({min:0,required:!0}),toolCallId:ee})),Vee=B("followUpAnswers/finishToolCall",e=>W(e,{answerId:ee,finishedAt:new Le({min:0,required:!0}),toolCallId:ee})),Bee=B("followUpAnswers/toolCallArgs",e=>W(e,{answerId:ee,toolCallId:ee,args:new xe({options:{required:!0}}),type:new re({required:!0,constrainTo:Fa})}));m();d();f();p();var lO={"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 VS(e){return e?lO[e]??1004:1004}var BS=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Ma(n.runId)),e(Er(!1)),e(Ii(!0)),e(LS(n.threadId)),e(qS())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(ly({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(dy({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onToolCallStartEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:i,toolCallId:s,timestamp:a}=n;e(py({toolCallId:s,toolCallName:i,startedAt:a??Date.now()}))},onToolCallEndEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,timestamp:s}=n;e(fy({toolCallId:i,finishedAt:s??Date.now()}))},onToolCallArgsEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,delta:s}=n;try{let a=JSON.parse(s);typeof a?.q=="string"?e(ja({toolCallId:i,args:a,type:"search"})):e(ja({toolCallId:i,args:{raw:s},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${s}`),e(ja({toolCallId:i,args:{raw:s},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(Ri({textDelta:n.delta})))},onCustomEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{name:i,value:s}=n;switch(i){case"header":{s?.contentFormat&&e(_i(s.contentFormat)),typeof s?.followUpEnabled=="boolean"&&e(MS(s.followUpEnabled)),s?.conversationToken&&e(jS(s.conversationToken));return}case"citations":{e(Ti({citations:s.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=VS(n.code);e(ki({message:n.message,code:i}))},onRunFinishedEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=n.result?.completionReason==="ANSWERED",s=i?!r:void 0;e(Dd(i)),e(Oi(!i)),e(Ii(!1)),e(gd(i,t,s)),e(so())}}};var GS=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _ref47=_asyncToGenerator(function*(n,o,i){t();let s=Aa(n),a=uh(n),c=lh(n),u=ch(n),g=dh(n),v=NS(s,a,c);e=v;let w=BS(o),h=ny(n,i());try{o(Er(!0)),yield v.runAgent({forwardedProps:{params:h,accessToken:u,recordDebugSession:g}},w)}catch(y){o(Er(!1)),o(ki({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});return function run(_x89,_x90,_x91){return _ref47.apply(this,arguments)}}(),abortRun:t}};m();d();f();p();m();d();f();p();var $S=B("breadcrumb/deselectAll"),QS=B("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var HS=B("facet/updateFacetAutoSelection",e=>W(e,{allow:new je({required:!0})}));m();d();f();p();m();d();f();p();var lu=class extends br{constructor(r){super(r);oe(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??Mt().q}get responseTime(){return this.activeInstantResultCache?.duration??Qt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??Qt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var zS=()=>Re("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new lu(e)),WS=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var Op={id:ee},dO={...Op,q:Dt},Xte=B("instantResults/register",e=>W(e,Op)),du=B("instantResults/updateQuery",e=>W(e,dO)),Zte=B("instantResults/clearExpired",e=>W(e,Op));m();d();f();p();var pu=new Le({required:!0,min:0}),are=B("pagination/registerNumberOfResults",e=>W(e,pu)),cre=B("pagination/updateNumberOfResults",e=>W(e,pu)),ure=B("pagination/registerPage",e=>W(e,pu)),KS=B("pagination/updatePage",e=>W(e,pu)),lre=B("pagination/nextPage"),dre=B("pagination/previousPage");m();d();f();p();var ko=B("query/updateQuery",e=>W(e,{q:new re,enableQuerySyntax:new je}));m();d();f();p();m();d();f();p();m();d();f();p();var _o=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var Pp=()=>Re("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),Pr=e=>Re("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||Mt().q,aq:r.advancedSearchQueries?.aq||_o().aq,cq:r.advancedSearchQueries?.cq||_o().cq,dq:r.advancedSearchQueries?.dq||_o().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();m();d();f();p();var fu=e=>e.success!==void 0,ft=e=>e.error!==void 0;m();d();f();p();var cne=B("didYouMean/enable"),une=B("didYouMean/disable"),lne=B("didYouMean/automaticCorrections/disable"),dne=B("didYouMean/automaticCorrections/enable"),mu=B("didYouMean/correction",e=>W(e,ee)),pne=B("didYouMean/automaticCorrections/mode",e=>W(e,new re({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var Np=()=>Re("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var YS=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function XS(){return{contextValues:{}}}m();d();f();p();function ZS(){return{contextValues:{}}}m();d();f();p();function JS(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function eA(){return[]}m();d();f();p();function tA(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function rA(){return{}}m();d();f();p();function nA(){return{}}m();d();f();p();function oA(){return{}}function Zt(e){return{context:e.context||XS(),dictionaryFieldContext:e.dictionaryFieldContext||ZS(),facetSet:e.facetSet||Sa(),numericFacetSet:e.numericFacetSet||va(),dateFacetSet:e.dateFacetSet||ya(),categoryFacetSet:e.categoryFacetSet||ha(),automaticFacetSet:e.automaticFacetSet??ga(),pagination:e.pagination||tA(),query:e.query||Mt(),tabSet:e.tabSet||oA(),advancedSearchQueries:e.advancedSearchQueries||_o(),staticFilterSet:e.staticFilterSet||nA(),querySet:e.querySet||rA(),sortCriteria:e.sortCriteria||ba(),pipeline:e.pipeline||io(),searchHub:e.searchHub||Wn(),facetOptions:e.facetOptions||JS(),facetOrder:e.facetOrder??eA(),debug:e.debug??Us()}}m();d();f();p();var joe=new xe({values:{undoneQuery:Dt},options:{required:!0}}),iA=()=>Re("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var gu=B("trigger/query/ignore",e=>W(e,new re({emptyAllowed:!0,required:!0}))),hu=B("trigger/query/modification",e=>W(e,new xe({values:{originalQuery:He,modification:He}})));m();d();f();p();var Nr=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=mO(e),n=ka(e),o=pO(e),i=yield ao(e,t),s=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return wr({...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:s(),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 Nr(_x92,_x93){return _ref48.apply(this,arguments)}}();function pO(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(fO).filter(r=>r.currentValues.length>0):void 0}function fO(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function mO(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=gO(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function gO(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 Fr=class{constructor(t,r=n=>{this.dispatch(ko({q:n}))}){oe(this,"config",t);oe(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x94,_x95){var _this18=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Ta(yield _this18.extra.apiClient.search(r,n),t),s=Date.now()-o,a=_this18.getState().query?.q||"";return{response:i,duration:s,queryExecuted:a,requestExecuted:r}}).apply(this,arguments)}process(t){var _this19=this;return _asyncToGenerator(function*(){return _this19.processQueryErrorOrContinue(t)??(yield _this19.processQueryCorrectionsOrContinue(t))??(yield _this19.processQueryTriggersOrContinue(t))??_this19.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return ft(t.response)?(this.dispatch(Pr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this20=this;return _asyncToGenerator(function*(){let r=_this20.getState(),n=_this20.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:s,queryCorrections:a,queryCorrection:c}=n;if(!o||!i)return null;let u=s.length===0&&a&&a.length!==0,g=!ce(c)&&!ce(c.correctedQuery);if(!u&&!g)return null;let w=u?yield _this20.processLegacyDidYouMeanAutoCorrection(t):_this20.processModernDidYouMeanAutoCorrection(t);return _this20.dispatch(Gt(Zt(_this20.getState()))),w})()}processLegacyDidYouMeanAutoCorrection(t){var _this21=this;return _asyncToGenerator(function*(){let r=_this21.getCurrentQuery(),n=_this21.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this21.automaticallyRetryQueryWithCorrection(o);return ft(i.response)?(_this21.dispatch(Pr(i.response.error)),_this21.rejectWithValue(i.response.error)):(_this21.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this21.dispatch(Gt(Zt(_this21.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Np()})})()}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:Np()}}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 _this22=this;return _asyncToGenerator(function*(){let r=_this22.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(a=>a.type==="query")?.content||"";if(!n)return null;if(_this22.getState().triggers?.queryModification.queryToIgnore===n)return _this22.dispatch(gu("")),null;_this22.analyticsAction&&(yield _this22.dispatch(_this22.analyticsAction));let i=_this22.getCurrentQuery(),s=yield _this22.automaticallyRetryQueryWithTriggerModification(n);return ft(s.response)?(_this22.dispatch(Pr(s.response.error)),_this22.rejectWithValue(s.response.error)):(_this22.dispatch(Gt(Zt(_this22.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:iA()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??Mt().enableQuerySyntax},search:{...Qt(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Gt(Zt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return fu(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this23=this;return _asyncToGenerator(function*(){_this23.onUpdateQueryForCorrection(t);let r=yield _this23.fetchFromAPI(yield Nr(_this23.getState()),{origin:"mainSearch"});return _this23.dispatch(mu(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.dispatch(hu({newQuery:t,originalQuery:_this24.getCurrentQuery()})),_this24.onUpdateQueryForCorrection(t),yield _this24.fetchFromAPI(yield Nr(_this24.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 jie=Ce("search/executeSearch",/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t){let r=t.getState();return yield yu(r,t,e)});return function(_x96,_x97){return _ref49.apply(this,arguments)}}()),qie=Ce("search/fetchPage",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Dp(r,t,e)});return function(_x98,_x99){return _ref50.apply(this,arguments)}}()),Uie=Ce("search/fetchMoreResults",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Mp(t,r)});return function(_x100,_x101){return _ref51.apply(this,arguments)}}()),Vie=Ce("search/fetchFacetValues",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield SO(t,e,r)});return function(_x102,_x103){return _ref52.apply(this,arguments)}}()),Bie=Ce("search/fetchInstantResults",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){return Fp(e,t)});return function(_x104,_x105){return _ref53.apply(this,arguments)}}()),hO=/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=yield Nr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function hO(_x106,_x107){return _ref54.apply(this,arguments)}}(),yO=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield ao(e);return wr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function yO(_x108,_x109,_x110){return _ref55.apply(this,arguments)}}(),vO=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){let r=yield Nr(e,t);return r.request.numberOfResults=0,r});return function vO(_x111,_x112){return _ref56.apply(this,arguments)}}(),sA=e=>{e.configuration.analytics.enabled&&yt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Fp(_x113,_x114){return _Fp.apply(this,arguments)}function _Fp(){_Fp=_asyncToGenerator(function*(e,t){W(e,{id:ee,q:ee,maxResultsPerQuery:new Le({required:!0,min:1}),cacheTimeout:new Le});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new Fr({...t,analyticsAction:zS()},u=>{t.dispatch(du({q:u,id:e.id}))}),s=yield yO(o,r,n),a=yield i.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),c=yield i.process(a);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,analyticsAction:c.analyticsAction,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return _Fp.apply(this,arguments)}function Dp(_x115,_x116,_x117){return _Dp.apply(this,arguments)}function _Dp(){_Dp=_asyncToGenerator(function*(e,t,r){sA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:s}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),a=new Fr({...t,analyticsAction:r}),c=yield Nr(e,s),u=yield a.fetchFromAPI(c,{origin:"mainSearch"});return yield a.process(u)});return _Dp.apply(this,arguments)}function Mp(_x118,_x119){return _Mp.apply(this,arguments)}function _Mp(){_Mp=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield Pp().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),s=new Fr({...e,analyticsAction:Pp()}),a=yield hO(t,i),c=yield s.fetchFromAPI(a,{origin:"mainSearch"});return yield s.process(c)});return _Mp.apply(this,arguments)}function SO(_x120,_x121,_x122){return _SO.apply(this,arguments)}function _SO(){_SO=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=e.extra,{description:s}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),a=new Fr({...e,analyticsAction:t}),c=yield vO(r,s),u=yield a.fetchFromAPI(c,{origin:"facetValues"});return yield a.process(u)});return _SO.apply(this,arguments)}function yu(_x123,_x124,_x125){return _yu.apply(this,arguments)}function _yu(){_yu=_asyncToGenerator(function*(e,t,r){sA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:s}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),a=yield Nr(e,s),c=new Fr({...t,analyticsAction:r}),u=yield c.fetchFromAPI(a,{origin:"mainSearch"});return yield c.process(u)});return _yu.apply(this,arguments)}m();d();f();p();var Dr=class{constructor(t,r=n=>{this.dispatch(ko({q:n}))}){oe(this,"config",t);oe(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x126,_x127){var _this25=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Ta(yield _this25.extra.apiClient.search(r,n),t),s=Date.now()-o,a=_this25.getState().query?.q||"";return{response:i,duration:s,queryExecuted:a,requestExecuted:r}}).apply(this,arguments)}process(t){var _this26=this;return _asyncToGenerator(function*(){return _this26.processQueryErrorOrContinue(t)??(yield _this26.processQueryCorrectionsOrContinue(t))??(yield _this26.processQueryTriggersOrContinue(t))??_this26.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return ft(t.response)?(this.dispatch(Pr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getState(),n=_this27.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:s,queryCorrections:a,queryCorrection:c}=n;if(!o)return null;if(!i)return!ce(c)&&!ce(c.correctedQuery)?_this27.processModernDidYouMeanAutoCorrection(t):null;let u=s.length===0&&a&&a.length!==0,g=!ce(c)&&!ce(c.correctedQuery);if(!u&&!g)return null;let w=u?yield _this27.processLegacyDidYouMeanAutoCorrection(t):_this27.processModernDidYouMeanAutoCorrection(t);return _this27.dispatch(Gt(Zt(_this27.getState()))),w})()}processLegacyDidYouMeanAutoCorrection(t){var _this28=this;return _asyncToGenerator(function*(){let r=_this28.getCurrentQuery(),n=_this28.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this28.automaticallyRetryQueryWithCorrection(o);return ft(i.response)?(_this28.dispatch(Pr(i.response.error)),_this28.rejectWithValue(i.response.error)):(_this28.dispatch(Gt(Zt(_this28.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 _this29=this;return _asyncToGenerator(function*(){let r=_this29.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(a=>a.type==="query")?.content||"";if(!n)return null;if(_this29.getState().triggers?.queryModification.queryToIgnore===n)return _this29.dispatch(gu("")),null;let i=_this29.getCurrentQuery(),s=yield _this29.automaticallyRetryQueryWithTriggerModification(n);return ft(s.response)?(_this29.dispatch(Pr(s.response.error)),_this29.rejectWithValue(s.response.error)):(_this29.dispatch(Gt(Zt(_this29.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Gt(Zt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return fu(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this30=this;return _asyncToGenerator(function*(){_this30.onUpdateQueryForCorrection(t);let r=_this30.getState(),{actionCause:n}=YS(),o=yield _this30.fetchFromAPI(yield xr(r,_this30.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this30.dispatch(mu(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.dispatch(hu({newQuery:t,originalQuery:_this31.getCurrentQuery()})),_this31.onUpdateQueryForCorrection(t),yield _this31.fetchFromAPI(yield xr(_this31.getState(),_this31.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 Tse=Ce("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;W(e,{q:new re,enableQuerySyntax:new je,clearFilters:new je}),e.clearFilters&&(r($S()),r(QS())),r(HS({allow:!0})),r(ko({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(KS(1))}),kse=B("search/updateSearchAction"),vu=Ce("search/executeSearch",/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return yu(r,t,e.legacy);uA(r);let n=e.next?lA(e.next):void 0,o=yield xr(r,t.extra.navigatorContext,n),i=new Dr({...t,analyticsAction:n??{}}),s=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(s)});return function(_x128,_x129){return _ref57.apply(this,arguments)}}()),aA=Ce("search/fetchPage",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t){let r=t.getState();if(uA(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Dp(r,t,e.legacy);let n=new Dr({...t,analyticsAction:e.next}),o=yield xr(r,t.extra.navigatorContext,e.next),i=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(i)});return function(_x130,_x131){return _ref58.apply(this,arguments)}}()),cA=Ce("search/fetchMoreResults",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Mp(t,r);let n=xh("browseResults",t.getState),o=new Dr({...t,analyticsAction:n}),i=yield AO(r,t.extra.navigatorContext,n),s=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(s)});return function(_x132,_x133){return _ref59.apply(this,arguments)}}()),_se=Ce("search/fetchFacetValues",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return yu(r,t,e.legacy);let n=new Dr({...t,analyticsAction:{}}),o=yield wO(r,t.extra.navigatorContext),i=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(i)});return function(_x134,_x135){return _ref60.apply(this,arguments)}}()),Ose=Ce("search/fetchInstantResults",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Fp(e,t);W(e,{id:ee,q:ee,maxResultsPerQuery:new Le({required:!0,min:1}),cacheTimeout:new Le});let{q:n,maxResultsPerQuery:o}=e,i=lA(WS()),s=yield bO(r,t.extra.navigatorContext,n,o,i),a=new Dr({...t,analyticsAction:i},g=>{t.dispatch(du({q:g,id:e.id}))}),c=yield a.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),u=yield a.process(c);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return function(_x136,_x137){return _ref61.apply(this,arguments)}}()),AO=/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(e,t,r){let n=yield xr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function AO(_x138,_x139,_x140){return _ref62.apply(this,arguments)}}(),bO=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t,r,n,o){let i=_a(e,t,o);return wr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function bO(_x141,_x142,_x143,_x144,_x145){return _ref63.apply(this,arguments)}}(),wO=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t,r){let n=yield xr(e,t,r);return n.request.numberOfResults=0,n});return function wO(_x146,_x147,_x148){return _ref64.apply(this,arguments)}}(),uA=e=>{e.configuration.analytics.enabled&&yt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},lA=e=>({actionCause:e.actionCause,type:e.actionCause});var dA=e=>{let t=Tm({extra:e}),r=GS();return t.startListening({actionCreator:vu.pending,effect:function(){var _ref65=_asyncToGenerator(function*(n,o){let i=o.getState();if(!sd(i)||(r.abortRun(),o.dispatch(La()),o.dispatch(US()),i.generatedAnswer.isEnabled===!1))return;let s=Zr(i)?.q;!s||s.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});return function effect(_x149,_x150){return _ref65.apply(this,arguments)}}()}),t};m();d();f();p();var pA=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)},fA=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var Lp=(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 mA(e,t){let r={...e},n,o=i=>(s,a)=>{let c=i(s,a);return n?n(c,a):c};return{get combinedReducer(){let i=wf(Object.entries(t).filter(([s])=>!(s in r)).map(([s,a])=>[s,()=>a]));return o(qn({...i,...r}))},containsAll(i){return Object.keys(i).every(a=>a in r)},add(i){Object.keys(i).filter(s=>!(s in r)).forEach(s=>{r[s]=i[s]})},addCrossReducer(i){n=i}}}m();d();f();p();m();d();f();p();var Oo=B("app/setError");m();d();f();p();function CO(e){if(!e||!xO(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 gA(e,t=60){if(!e)return!1;let r=CO(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function xO(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function yA(e,t){let r=0,n=null,o=ns(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(v,w=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(S){if(!w)throw S;return null}})().finally(()=>{n=null}));let y=yield n;return h&&y&&v.dispatch(zn({accessToken:y})),y});return function i(_x151){return _ref66.apply(this,arguments)}}(),s=v=>{let w=RO(v.getState());return!!w&&gA(w)},a=/*#__PURE__*/function(){var _ref68=_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(w){e.warn(w,"Access token renewal failed. A retry will occur if necessary.")}});return function a(_x152){return _ref68.apply(this,arguments)}}(),c=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(v,w,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),hA(v,w.error),w;!n&&(r++,o());try{yield i(v,!0)}catch(S){e.debug(S,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}v.dispatch(h)});return function c(_x153,_x154,_x155){return _ref69.apply(this,arguments)}}(),u=(v,w,h)=>IO(h)?t?c(v,h,w):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),hA(v,h.error),h):h,g=(v,w,h)=>EO(h)?Promise.resolve(h).then(y=>u(v,w,y)):u(v,w,h);return v=>w=>h=>{if(!(typeof h=="function"))return w(h);let S=()=>g(v,h,w(h));return typeof t=="function"&&s(v)?a(v).then(S):S()}}function EO(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function IO(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Fn().name}function hA(e,t){e.dispatch(Oo({status:401,statusCode:401,message:t.message,type:t.name}))}function RO(e){return e.configuration.accessToken}m();d();f();p();function vA({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return mm({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(fA(n.logger))})}function TO(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,disableBrowserPrivacySignals:o,...i}=r??{},s={...i,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})},a=s.analyticsMode!=="next",c=s.analyticsMode==="legacy"&&o===!0;return a&&zu()&&!c?(t.info("Analytics disabled since doNotTrack is active."),{...s,enabled:!1}):(a&&zu()&&c&&s.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."),s)}function SA(e,t){let r={...e.reducers,configuration:St,version:Cy},n=kO({...e,reducers:r},t,St),{accessToken:o,environment:i,organizationId:s}=e.configuration;n.dispatch(zn({accessToken:o,environment:i,organizationId:s}));let a=TO(e.configuration,n.logger);return a&&n.dispatch(Gs(a)),n}function kO(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=mA({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let s=t.logger,a={...t,get relay(){return ci(u.state,o)},get navigatorContext(){return Lp(this.relay,o)}},c=_O(e,a,i),u={addReducers(g){i.containsAll(g)||(i.add(g),c.replaceReducer(i.combinedReducer))},dispatch:c.dispatch,subscribe:c.subscribe,enableAnalytics(){c.dispatch(Qs())},disableAnalytics(){c.dispatch($s())},get state(){return c.getState()},get relay(){return ci(this.state,o)},get navigatorContext(){return Lp(this.relay,o)},logger:s,store:c};return u}function _O(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",s=OO(e,t.logger,()=>t.navigatorContext);return vA({preloadedState:n,reducer:r.combinedReducer,middlewares:s,thunkExtraArguments:t,name:i})}function OO(e,t,r){let{renewAccessToken:n}=e.configuration,o=yA(t,n),i=dA({getNavigatorContext:r});return[Dy,o,pA(t),Ey].concat(Ld.middleware,i.middleware,e.middlewares||[])}var PO=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
43
43
  However, this mode is not available for Coveo for Service features, and this configuration may not work as expected.
44
44
  Please switch back to the "legacy" analytics mode to ensure proper functionality.
45
- For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function yA(e){e==="next"&&console.warn(xO)}m();d();f();p();var RA=Pt(IA(),1);function TA(e){return(0,RA.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function kA(e,t){let r=BO(e),n=vl,o=GO(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function BO(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function GO(e){return e.preprocessRequest||is}m();d();f();p();m();d();f();p();var _A={organizationId:ee,accessToken:ee,name:new re({required:!1,emptyAllowed:!1}),analytics:new xe({options:{required:!1},values:{enabled:new je({required:!1}),originContext:new re({required:!1}),originLevel2:new re({required:!1}),originLevel3:new re({required:!1}),analyticsMode:new re({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new re({required:!1,url:!0}),trackingId:new re({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new je({required:!1})}}),environment:new re({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};var OA=new Nt({..._A,caseAssistId:ee,locale:He});var $O={debug:Fm,caseAssistConfiguration:vr,searchHub:Um};function PA(e){let t=TA(e.loggerOptions);QO(e.configuration,t);let r=HO(e.configuration,t),n={...kA(e.configuration,t),apiClient:r},o={...e,reducers:$O},i=hA(o,n);yA(i.state.configuration.analytics.analyticsMode);let{caseAssistId:s,locale:a,searchHub:c,proxyBaseUrl:u}=e.configuration;return i.dispatch(Ms({caseAssistId:s,locale:a,proxyBaseUrl:u})),ce(c)||i.dispatch(qs(c)),{...i,get state(){return i.state}}}function QO(e,t){try{OA.validate(e)}catch(r){throw t.error(r,"Case Assist engine configuration error"),r}}function HO(e,t){return new ls({logger:t,preprocessRequest:e.preprocessRequest||is})}m();d();f();p();m();d();f();p();m();d();f();p();var NA=(i=>(i.id="id",i.subject="subject",i.description="description",i.category="category",i.productId="productId",i))(NA||{}),FA=e=>!Object.values(NA).includes(e),mt=e=>{let t=r=>zO(e,r)??KO(e,r);return{id:t("id"),subject:t("subject"),description:t("description"),category:t("category"),productId:t("productId"),custom:{...WO(e),...YO(e)}}},zO=(e,t)=>e?.caseInput?.[t]?.value,WO=e=>Object.keys(e?.caseInput??[]).reduce((t,r)=>{if(FA(r)){let n=e?.caseInput?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),KO=(e,t)=>e?.caseField?.fields[t]?.value,YO=e=>Object.keys(e?.caseField?.fields??[]).reduce((t,r)=>{if(FA(r)){let n=e?.caseField?.fields?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),Up=(e,t,r=!1)=>{let n=Object.keys(e?.caseField?.fields??{}).find(a=>e?.caseField?.fields[a].suggestions.some(c=>c.id===t));if(!n)throw new Error(`Classification with ID '${t}' could not be found.`);let i=e?.caseField?.fields[n]?.suggestions.find(a=>a.id===t),s={classificationId:i?.id??"",responseId:e.caseField?.status.lastResponseId??"",fieldName:n,classification:{value:i?.value??"",confidence:i?.confidence??0}};return r?{...s,autoSelection:r}:s},hr=(e,t,r=!1,n=!1)=>{let o,i=e.documentSuggestion?.documents.find((a,c)=>{let u=a.uniqueId===t;return u&&(o=c+1),u});if(!i)throw new Error(`Document Suggestion with ID '${t}' could not be found.`);let s={suggestionId:i.uniqueId,permanentId:i.fields.permanentid,responseId:e.documentSuggestion?.status.lastResponseId??"",suggestion:{documentUri:i.fields.uri,documentUriHash:i.fields.urihash,documentTitle:i.title,documentUrl:i.clickUri,documentPosition:o??0,sourceName:i.fields.source}};return r?{...s,fromQuickview:r}:n?{...s,openDocument:n}:s};var DA=()=>vt({prefix:"analytics/caseAssist/case/start",__legacy__getBuilder:(e,t)=>e.logEnterInterface({ticket:mt(t)}),analyticsType:"CaseAssist.Start",analyticsPayloadBuilder:()=>({})}),MA=e=>vt("analytics/caseAssist/case/nextStage",(t,r)=>t.logMoveToNextCaseStep({ticket:mt(r),stage:e?.stageName})),LA=()=>vt({prefix:"analytics/caseAssist/case/create",__legacy__getBuilder:(e,t)=>e.logCaseCreated({ticket:mt(t)}),analyticsType:"CaseAssist.CreateTicket",analyticsPayloadBuilder:e=>{let{id:t,category:r,subject:n,description:o,productId:i}=mt(e);return{ticket:{id:t,category:r,subject:n,description:o,system:i}}}}),jA=()=>vt({prefix:"analytics/caseAssist/case/solve",__legacy__getBuilder:(e,t)=>e.logCaseSolved({ticket:mt(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"solved"})}),qA=()=>vt({prefix:"analytics/caseAssist/case/abandon",__legacy__getBuilder:(e,t)=>e.logCaseCancelled({ticket:mt(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"quit"})}),Po=e=>vt({prefix:"analytics/caseAssist/case/field/update",__legacy__getBuilder:(t,r)=>t.logUpdateCaseField({fieldName:e,ticket:mt(r)}),analyticsType:"CaseAssist.UpdateField",analyticsPayloadBuilder:t=>{let r=t.caseField?.fields?.[e]?.value||t.caseInput?.[e]?.value||"";return{fieldName:e,fieldValue:r}}}),UA=e=>vt({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:Up(r,e,!0),ticket:mt(r)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let r=t.caseField?.status?.lastResponseId;if(r)return{autoselected:!0,classificationId:e,responseId:r}}}),Su=e=>vt({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:Up(r,e),ticket:mt(r)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let r=t.caseField?.status?.lastResponseId;if(r)return{autoselected:!1,classificationId:e,responseId:r}}}),VA=e=>vt({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logSelectDocumentSuggestion({suggestion:hr(r,e),ticket:mt(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=hr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),Au=e=>vt({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logQuickviewDocumentSuggestion({suggestion:hr(r,e),ticket:mt(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=hr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),BA=e=>vt({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logSelectDocumentSuggestion({suggestion:hr(r,e,!1,!0),ticket:mt(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=hr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),GA=(e,t)=>vt({prefix:"analytics/caseAssist/documentSuggestion/rate",__legacy__getBuilder:(r,n)=>r.logRateDocumentSuggestion({rating:t,suggestion:hr(n,e),ticket:mt(n)}),analyticsType:"CaseAssist.DocumentSuggestionFeedback",analyticsPayloadBuilder:r=>{let n=r.documentSuggestion?.status?.lastResponseId,o=hr(r,e);if(n)return{responseId:n,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:o.suggestionId,url:o.suggestion.documentUri,title:o.suggestion.documentTitle},liked:!!t}}});m();d();f();p();var No=B("caseAssist/caseField/register",e=>W(e,{fieldName:ee,fieldValue:Dt})),Fo=B("caseAssist/caseField/update",e=>W(e,{fieldName:ee,fieldValue:Dt})),Jt=Ce("caseAssist/classifications/fetch",/*#__PURE__*/function(){var _ref70=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=yield n.getCaseClassifications(yield XO(o));return ft(i)?r(i.error):{response:i.success}});return function(_x156,_x157){return _ref70.apply(this,arguments)}}()),XO=/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??ot(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield to(e.configuration.analytics)}),fields:e.caseInput,context:e.caseField?us(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function XO(_x158){return _ref71.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var $A=()=>({status:{loading:!1,error:null,lastResponseId:""},fields:{}});var Lr=Qe($A(),e=>{e.addCase(No,(t,r)=>{let{fieldName:n,fieldValue:o}=r.payload;t.fields[n]={value:o,suggestions:[]}}).addCase(Fo,(t,r)=>{let{fieldName:n,fieldValue:o}=r.payload;t.fields[n].value=o}).addCase(Jt.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase(Jt.fulfilled,(t,r)=>{let n={value:"",suggestions:[]};Object.entries(r.payload.response.fields).forEach(([o,i])=>{t.fields[o]||(t.fields[o]={...n}),t.fields[o].suggestions=i.predictions}),t.status.lastResponseId=r.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase(Jt.pending,t=>{t.status.loading=!0}).addCase(_o,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();m();d();f();p();var kn=B("caseAssist/caseInput/update",e=>W(e,{fieldName:ee,fieldValue:Dt}));m();d();f();p();var QA=()=>({});var jr=Qe(QA(),e=>{e.addCase(kn,(t,r)=>{t[r.payload.fieldName]={value:r.payload.fieldValue}})});m();d();f();p();var kt=Ce("caseAssist/documentSuggestions/fetch",/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),s=yield n.getDocumentSuggestions(yield ZO(i,o));return ft(s)?r(s.error):{response:s.success}});return function(_x159,_x160){return _ref72.apply(this,arguments)}}()),ZO=/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??ot(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield to(e.configuration.analytics)}),...(e.configuration.analytics.enabled&&rn(e.configuration.analytics,t,{actionCause:"documentSuggestion"})),fields:e.caseInput,context:e.caseField?us(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function ZO(_x161,_x162){return _ref73.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var HA=()=>({status:{loading:!1,error:null,lastResponseId:""},documents:[]});var er=Qe(HA(),e=>{e.addCase(kt.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase(kt.fulfilled,(t,r)=>{t.documents=r.payload.response.documents,t.status.lastResponseId=r.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase(kt.pending,t=>{t.status.loading=!0}).addCase(_o,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();function tr(e){let t,r=new Map,n=()=>r.size===0,o=i=>{try{let s=JSON.stringify(i),a=t!==s;return t=s,a}catch(s){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",s),!0}};return{subscribe(i){i();let s=Symbol(),a;return n()&&(t=JSON.stringify(this.state),a=e.subscribe(()=>{o(this.state)&&r.forEach(c=>c())})),r.set(s,i),()=>{r.delete(s),n()&&a?.()}},get state(){return{}}}}var JO=new Nt({field:ee});function zA(e,t={}){if(!eP(e))throw wt;let r=tr(e),{dispatch:n}=e,o=Ds(e,JO,t.options,"buildCaseField"),i=()=>e.state;return i().caseField?.fields?.[o.field]||n(No({fieldName:o.field,fieldValue:""})),{...r,get state(){let a=i().caseField?.status?.loading??!1,c=i().caseField?.status?.error??null,u=i().caseField?.fields?.[o.field],g=u?.value??"",v=u?.suggestions??[];return{loading:a,error:c,value:g,suggestions:v}},update(a,c,u){let g=i().caseField?.fields?.[o.field]?.suggestions?.find(v=>v.value===a)?.id;g&&n(u?UA(g):Su(g)),n(Fo({fieldName:o.field,fieldValue:a})),!u&&n(Po(o.field)),c?.caseClassifications&&n(Jt()),c?.documentSuggestions&&n(kt())}}}function eP(e){return e.addReducers({configuration:St,caseAssistConfiguration:vr,caseInput:jr,caseField:Lr,documentSuggestion:er}),!0}m();d();f();p();function tP(e,t){let r=new Nt({field:ee});Ds(e,r,t,"buildCaseInput")}function WA(e,t){if(!rP(e))throw wt;let r=tr(e),{dispatch:n}=e,o=()=>e.state;tP(e,t.options);let i=t.options.field;return o().caseInput?.[i]||n(kn({fieldName:i,fieldValue:""})),{...r,update(a,c){n(kn({fieldName:i,fieldValue:a})),n(Po(i)),c?.caseClassifications&&n(Jt()),c?.documentSuggestions&&n(kt())},get state(){return o().caseInput[i]}}}function rP(e){return e.addReducers({configuration:St,caseAssistConfiguration:vr,caseInput:jr,caseField:Lr,documentSuggestion:er}),!0}m();d();f();p();m();d();f();p();function KA(e,t,r){if(!nP(e))throw wt;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:ns(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function nP(e){return e.addReducers({configuration:St}),!0}function YA(e,t){let r=!1;return KA(e,t,()=>{r||(r=!0,e.dispatch(BA(t.options.result.uniqueId)))})}m();d();f();p();function Vp(e){if(!oP(e))throw wt;let t=tr(e),{dispatch:r}=e,n=()=>e.state;return{...t,fetch(){r(kt())},get state(){let o=n().documentSuggestion;return{loading:o.status.loading,error:o.status.error,documents:o.documents}}}}function oP(e){return e.addReducers({configuration:St,caseAssistConfiguration:vr,caseInput:jr,caseField:Lr,documentSuggestion:er}),!0}m();d();f();p();m();d();f();p();m();d();f();p();function bu(_x163,_x164){return _bu.apply(this,arguments)}function _bu(){_bu=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:o}=e.configuration,i=e.query?.q||"";return{url:r.apiBaseUrl??Mn(e.configuration.organizationId,e.configuration.environment),accessToken:n,organizationId:o,enableNavigation:!1,q:i,...t,requestedOutputSize:t.requestedOutputSize||0,...(r.authenticationProviders.length&&{authentication:r.authenticationProviders.join(",")})}});return _bu.apply(this,arguments)}var Ki=Ce("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),i=yield bu(o,e),s=yield t.apiClient.html(i);return ft(s)?n(s.error):{content:s.success,uniqueId:e.uniqueId}});return function(_x165,_x166){return _ref74.apply(this,arguments)}}()),wu=B("resultPreview/next"),Cu=B("resultPreview/previous"),xu=B("resultPreview/prepare",e=>W(e,{results:new Ft({required:!0})})),XA=2048,Eu=Ce("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=_f(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>XA&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${XA} characters.`),{contentURL:o}});return function(_x167,_x168){return _ref75.apply(this,arguments)}}());m();d();f();p();m();d();f();p();m();d();f();p();function Bp(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var Gp=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=Bp();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},$p=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),ZA=Qe(Bp(),e=>{e.addCase(Ki.pending,t=>{t.isLoading=!0}).addCase(Ki.fulfilled,(t,r)=>{let{content:n,uniqueId:o}=r.payload;t.position=t.resultsWithPreview.indexOf(o),t.content=n,t.uniqueId=o,t.isLoading=!1}).addCase(hu.fulfilled,(t,r)=>{Gp(t),t.resultsWithPreview=$p(r.payload.response.results)}).addCase(iA.fulfilled,(t,r)=>{Gp(t),t.resultsWithPreview=t.resultsWithPreview.concat($p(r.payload.response.results))}).addCase(oA.fulfilled,Gp).addCase(xu,(t,r)=>{t.resultsWithPreview=$p(r.payload.results)}).addCase(wu,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(Cu,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(Eu.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});function JA(e,t,r,n,o){if(!iP(e))throw wt;let{dispatch:i}=e,s=()=>e.state,a=tr(e),{result:c,maximumPreviewSize:u}=t.options,g=()=>{let{resultsWithPreview:w,position:h}=s().resultPreview;return w[h]},v=w=>{i(Eu({uniqueId:w,requestedOutputSize:u,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||i(Ki({uniqueId:w,requestedOutputSize:u})),o&&o()};return{...a,fetchResultContent(){v(c.uniqueId)},next(){i(wu()),v(g())},previous(){i(Cu()),v(g())},get state(){let w=s(),h=c.hasHtmlVersion,y=w.resultPreview,S=c.uniqueId===y.uniqueId?y.content:"",x=y.isLoading,I=y.contentURL,_=g();return{content:S,resultHasPreview:h,isLoading:x,contentURL:I,currentResultUniqueId:_}}}}function iP(e){return e.addReducers({configuration:St,resultPreview:ZA}),!0}function eb(e,t){if(!sP(e))throw wt;let{dispatch:r}=e,n=()=>e.state,o=()=>n().documentSuggestion.documents,a=JA(e,t,bu,"/html",()=>{e.dispatch(Au(t.options.result.uniqueId))});return r(xu({results:o()})),{...a,get state(){return{...a.state,currentDocument:o().findIndex(c=>c.uniqueId===a.state.currentResultUniqueId)+1,totalDocuments:o().length}}}}function sP(e){return e.addReducers({documentSuggestion:er}),!0}m();d();f();p();m();d();f();p();var Qp=e=>W(e,{evt:ee,type:He}),tb=e=>Re("analytics/generic/search",t=>{Qp(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),rb=e=>Re("analytics/generic/click",(t,r)=>(dd(e.result),Qp(e),t.makeClickEvent(e.evt,ud(e.result,r),ld(e.result),e.meta))),nb=e=>Re("analytics/generic/custom",t=>(Qp(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));function aP(e){return e.addReducers({}),{logSearchEvent:tb,logClickEvent:rb,logCustomEvent:nb}}m();d();f();p();function cP(e){return e.addReducers({}),{logCaseStart:DA,logCaseNextStage:MA,logCreateCase:LA,logSolveCase:jA,logAbandonCase:qA,logUpdateCaseField:Po,logClassificationClick:Su,logDocumentSuggestionClick:VA,logDocumentSuggestionRating:GA,logQuickviewDocumentSuggestionClick:Au}}m();d();f();p();function uP(e){return e.addReducers({caseField:Lr}),{registerCaseField:No,updateCaseField:Fo,fetchCaseClassifications:Jt}}m();d();f();p();function lP(e){return e.addReducers({caseInput:jr}),{updateCaseInput:kn}}m();d();f();p();function dP(e){return e.addReducers({documentSuggestion:er}),{fetchDocumentSuggestions:kt}}/**
45
+ For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function AA(e){e==="next"&&console.warn(PO)}m();d();f();p();var _A=Pt(kA(),1);function OA(e){return(0,_A.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function PA(e,t){let r=YO(e),n=bl,o=XO(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function YO(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function XO(e){return e.preprocessRequest||is}m();d();f();p();m();d();f();p();var NA={organizationId:ee,accessToken:ee,name:new re({required:!1,emptyAllowed:!1}),analytics:new xe({options:{required:!1},values:{enabled:new je({required:!1}),originContext:new re({required:!1}),originLevel2:new re({required:!1}),originLevel3:new re({required:!1}),analyticsMode:new re({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new re({required:!1,url:!0}),trackingId:new re({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new je({required:!1})}}),environment:new re({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};var FA=new Nt({...NA,caseAssistId:ee,locale:He});var ZO={debug:Lm,caseAssistConfiguration:vr,searchHub:Gm};function DA(e){let t=OA(e.loggerOptions);JO(e.configuration,t);let r=eP(e.configuration,t),n={...PA(e.configuration,t),apiClient:r},o={...e,reducers:ZO},i=SA(o,n);AA(i.state.configuration.analytics.analyticsMode);let{caseAssistId:s,locale:a,searchHub:c,proxyBaseUrl:u}=e.configuration;return i.dispatch(js({caseAssistId:s,locale:a,proxyBaseUrl:u})),ce(c)||i.dispatch(Vs(c)),{...i,get state(){return i.state}}}function JO(e,t){try{FA.validate(e)}catch(r){throw t.error(r,"Case Assist engine configuration error"),r}}function eP(e,t){return new ls({logger:t,preprocessRequest:e.preprocessRequest||is})}m();d();f();p();m();d();f();p();m();d();f();p();var MA=(i=>(i.id="id",i.subject="subject",i.description="description",i.category="category",i.productId="productId",i))(MA||{}),LA=e=>!Object.values(MA).includes(e),mt=e=>{let t=r=>tP(e,r)??nP(e,r);return{id:t("id"),subject:t("subject"),description:t("description"),category:t("category"),productId:t("productId"),custom:{...rP(e),...oP(e)}}},tP=(e,t)=>e?.caseInput?.[t]?.value,rP=e=>Object.keys(e?.caseInput??[]).reduce((t,r)=>{if(LA(r)){let n=e?.caseInput?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),nP=(e,t)=>e?.caseField?.fields[t]?.value,oP=e=>Object.keys(e?.caseField?.fields??[]).reduce((t,r)=>{if(LA(r)){let n=e?.caseField?.fields?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),Gp=(e,t,r=!1)=>{let n=Object.keys(e?.caseField?.fields??{}).find(a=>e?.caseField?.fields[a].suggestions.some(c=>c.id===t));if(!n)throw new Error(`Classification with ID '${t}' could not be found.`);let i=e?.caseField?.fields[n]?.suggestions.find(a=>a.id===t),s={classificationId:i?.id??"",responseId:e.caseField?.status.lastResponseId??"",fieldName:n,classification:{value:i?.value??"",confidence:i?.confidence??0}};return r?{...s,autoSelection:r}:s},hr=(e,t,r=!1,n=!1)=>{let o,i=e.documentSuggestion?.documents.find((a,c)=>{let u=a.uniqueId===t;return u&&(o=c+1),u});if(!i)throw new Error(`Document Suggestion with ID '${t}' could not be found.`);let s={suggestionId:i.uniqueId,permanentId:i.fields.permanentid,responseId:e.documentSuggestion?.status.lastResponseId??"",suggestion:{documentUri:i.fields.uri,documentUriHash:i.fields.urihash,documentTitle:i.title,documentUrl:i.clickUri,documentPosition:o??0,sourceName:i.fields.source}};return r?{...s,fromQuickview:r}:n?{...s,openDocument:n}:s};var jA=()=>vt({prefix:"analytics/caseAssist/case/start",__legacy__getBuilder:(e,t)=>e.logEnterInterface({ticket:mt(t)}),analyticsType:"CaseAssist.Start",analyticsPayloadBuilder:()=>({})}),qA=e=>vt("analytics/caseAssist/case/nextStage",(t,r)=>t.logMoveToNextCaseStep({ticket:mt(r),stage:e?.stageName})),UA=()=>vt({prefix:"analytics/caseAssist/case/create",__legacy__getBuilder:(e,t)=>e.logCaseCreated({ticket:mt(t)}),analyticsType:"CaseAssist.CreateTicket",analyticsPayloadBuilder:e=>{let{id:t,category:r,subject:n,description:o,productId:i}=mt(e);return{ticket:{id:t,category:r,subject:n,description:o,system:i}}}}),VA=()=>vt({prefix:"analytics/caseAssist/case/solve",__legacy__getBuilder:(e,t)=>e.logCaseSolved({ticket:mt(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"solved"})}),BA=()=>vt({prefix:"analytics/caseAssist/case/abandon",__legacy__getBuilder:(e,t)=>e.logCaseCancelled({ticket:mt(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"quit"})}),No=e=>vt({prefix:"analytics/caseAssist/case/field/update",__legacy__getBuilder:(t,r)=>t.logUpdateCaseField({fieldName:e,ticket:mt(r)}),analyticsType:"CaseAssist.UpdateField",analyticsPayloadBuilder:t=>{let r=t.caseField?.fields?.[e]?.value||t.caseInput?.[e]?.value||"";return{fieldName:e,fieldValue:r}}}),GA=e=>vt({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:Gp(r,e,!0),ticket:mt(r)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let r=t.caseField?.status?.lastResponseId;if(r)return{autoselected:!0,classificationId:e,responseId:r}}}),bu=e=>vt({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:Gp(r,e),ticket:mt(r)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let r=t.caseField?.status?.lastResponseId;if(r)return{autoselected:!1,classificationId:e,responseId:r}}}),$A=e=>vt({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logSelectDocumentSuggestion({suggestion:hr(r,e),ticket:mt(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=hr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),wu=e=>vt({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logQuickviewDocumentSuggestion({suggestion:hr(r,e),ticket:mt(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=hr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),QA=e=>vt({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logSelectDocumentSuggestion({suggestion:hr(r,e,!1,!0),ticket:mt(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=hr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),HA=(e,t)=>vt({prefix:"analytics/caseAssist/documentSuggestion/rate",__legacy__getBuilder:(r,n)=>r.logRateDocumentSuggestion({rating:t,suggestion:hr(n,e),ticket:mt(n)}),analyticsType:"CaseAssist.DocumentSuggestionFeedback",analyticsPayloadBuilder:r=>{let n=r.documentSuggestion?.status?.lastResponseId,o=hr(r,e);if(n)return{responseId:n,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:o.suggestionId,url:o.suggestion.documentUri,title:o.suggestion.documentTitle},liked:!!t}}});m();d();f();p();var Fo=B("caseAssist/caseField/register",e=>W(e,{fieldName:ee,fieldValue:Dt})),Do=B("caseAssist/caseField/update",e=>W(e,{fieldName:ee,fieldValue:Dt})),Jt=Ce("caseAssist/classifications/fetch",/*#__PURE__*/function(){var _ref70=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=yield n.getCaseClassifications(yield iP(o));return ft(i)?r(i.error):{response:i.success}});return function(_x156,_x157){return _ref70.apply(this,arguments)}}()),iP=/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??ot(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield ro(e.configuration.analytics)}),fields:e.caseInput,context:e.caseField?us(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function iP(_x158){return _ref71.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var zA=()=>({status:{loading:!1,error:null,lastResponseId:""},fields:{}});var Lr=Qe(zA(),e=>{e.addCase(Fo,(t,r)=>{let{fieldName:n,fieldValue:o}=r.payload;t.fields[n]={value:o,suggestions:[]}}).addCase(Do,(t,r)=>{let{fieldName:n,fieldValue:o}=r.payload;t.fields[n].value=o}).addCase(Jt.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase(Jt.fulfilled,(t,r)=>{let n={value:"",suggestions:[]};Object.entries(r.payload.response.fields).forEach(([o,i])=>{t.fields[o]||(t.fields[o]={...n}),t.fields[o].suggestions=i.predictions}),t.status.lastResponseId=r.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase(Jt.pending,t=>{t.status.loading=!0}).addCase(Oo,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();m();d();f();p();var kn=B("caseAssist/caseInput/update",e=>W(e,{fieldName:ee,fieldValue:Dt}));m();d();f();p();var WA=()=>({});var jr=Qe(WA(),e=>{e.addCase(kn,(t,r)=>{t[r.payload.fieldName]={value:r.payload.fieldValue}})});m();d();f();p();var kt=Ce("caseAssist/documentSuggestions/fetch",/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),s=yield n.getDocumentSuggestions(yield sP(i,o));return ft(s)?r(s.error):{response:s.success}});return function(_x159,_x160){return _ref72.apply(this,arguments)}}()),sP=/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??ot(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield ro(e.configuration.analytics)}),...(e.configuration.analytics.enabled&&rn(e.configuration.analytics,t,{actionCause:"documentSuggestion"})),fields:e.caseInput,context:e.caseField?us(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function sP(_x161,_x162){return _ref73.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var KA=()=>({status:{loading:!1,error:null,lastResponseId:""},documents:[]});var er=Qe(KA(),e=>{e.addCase(kt.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase(kt.fulfilled,(t,r)=>{t.documents=r.payload.response.documents,t.status.lastResponseId=r.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase(kt.pending,t=>{t.status.loading=!0}).addCase(Oo,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();function tr(e){let t,r=new Map,n=()=>r.size===0,o=i=>{try{let s=JSON.stringify(i),a=t!==s;return t=s,a}catch(s){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",s),!0}};return{subscribe(i){i();let s=Symbol(),a;return n()&&(t=JSON.stringify(this.state),a=e.subscribe(()=>{o(this.state)&&r.forEach(c=>c())})),r.set(s,i),()=>{r.delete(s),n()&&a?.()}},get state(){return{}}}}var aP=new Nt({field:ee});function YA(e,t={}){if(!cP(e))throw wt;let r=tr(e),{dispatch:n}=e,o=Ls(e,aP,t.options,"buildCaseField"),i=()=>e.state;return i().caseField?.fields?.[o.field]||n(Fo({fieldName:o.field,fieldValue:""})),{...r,get state(){let a=i().caseField?.status?.loading??!1,c=i().caseField?.status?.error??null,u=i().caseField?.fields?.[o.field],g=u?.value??"",v=u?.suggestions??[];return{loading:a,error:c,value:g,suggestions:v}},update(a,c,u){let g=i().caseField?.fields?.[o.field]?.suggestions?.find(v=>v.value===a)?.id;g&&n(u?GA(g):bu(g)),n(Do({fieldName:o.field,fieldValue:a})),!u&&n(No(o.field)),c?.caseClassifications&&n(Jt()),c?.documentSuggestions&&n(kt())}}}function cP(e){return e.addReducers({configuration:St,caseAssistConfiguration:vr,caseInput:jr,caseField:Lr,documentSuggestion:er}),!0}m();d();f();p();function uP(e,t){let r=new Nt({field:ee});Ls(e,r,t,"buildCaseInput")}function XA(e,t){if(!lP(e))throw wt;let r=tr(e),{dispatch:n}=e,o=()=>e.state;uP(e,t.options);let i=t.options.field;return o().caseInput?.[i]||n(kn({fieldName:i,fieldValue:""})),{...r,update(a,c){n(kn({fieldName:i,fieldValue:a})),n(No(i)),c?.caseClassifications&&n(Jt()),c?.documentSuggestions&&n(kt())},get state(){return o().caseInput[i]}}}function lP(e){return e.addReducers({configuration:St,caseAssistConfiguration:vr,caseInput:jr,caseField:Lr,documentSuggestion:er}),!0}m();d();f();p();m();d();f();p();function ZA(e,t,r){if(!dP(e))throw wt;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:ns(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function dP(e){return e.addReducers({configuration:St}),!0}function JA(e,t){let r=!1;return ZA(e,t,()=>{r||(r=!0,e.dispatch(QA(t.options.result.uniqueId)))})}m();d();f();p();function $p(e){if(!pP(e))throw wt;let t=tr(e),{dispatch:r}=e,n=()=>e.state;return{...t,fetch(){r(kt())},get state(){let o=n().documentSuggestion;return{loading:o.status.loading,error:o.status.error,documents:o.documents}}}}function pP(e){return e.addReducers({configuration:St,caseAssistConfiguration:vr,caseInput:jr,caseField:Lr,documentSuggestion:er}),!0}m();d();f();p();m();d();f();p();m();d();f();p();function Cu(_x163,_x164){return _Cu.apply(this,arguments)}function _Cu(){_Cu=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:o}=e.configuration,i=e.query?.q||"";return{url:r.apiBaseUrl??Mn(e.configuration.organizationId,e.configuration.environment),accessToken:n,organizationId:o,enableNavigation:!1,q:i,...t,requestedOutputSize:t.requestedOutputSize||0,...(r.authenticationProviders.length&&{authentication:r.authenticationProviders.join(",")})}});return _Cu.apply(this,arguments)}var Ki=Ce("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),i=yield Cu(o,e),s=yield t.apiClient.html(i);return ft(s)?n(s.error):{content:s.success,uniqueId:e.uniqueId}});return function(_x165,_x166){return _ref74.apply(this,arguments)}}()),xu=B("resultPreview/next"),Eu=B("resultPreview/previous"),Iu=B("resultPreview/prepare",e=>W(e,{results:new Ft({required:!0})})),eb=2048,Ru=Ce("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=Nf(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>eb&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${eb} characters.`),{contentURL:o}});return function(_x167,_x168){return _ref75.apply(this,arguments)}}());m();d();f();p();m();d();f();p();m();d();f();p();function Qp(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var Hp=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=Qp();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},zp=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),tb=Qe(Qp(),e=>{e.addCase(Ki.pending,t=>{t.isLoading=!0}).addCase(Ki.fulfilled,(t,r)=>{let{content:n,uniqueId:o}=r.payload;t.position=t.resultsWithPreview.indexOf(o),t.content=n,t.uniqueId=o,t.isLoading=!1}).addCase(vu.fulfilled,(t,r)=>{Hp(t),t.resultsWithPreview=zp(r.payload.response.results)}).addCase(cA.fulfilled,(t,r)=>{Hp(t),t.resultsWithPreview=t.resultsWithPreview.concat(zp(r.payload.response.results))}).addCase(aA.fulfilled,Hp).addCase(Iu,(t,r)=>{t.resultsWithPreview=zp(r.payload.results)}).addCase(xu,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(Eu,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(Ru.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});function rb(e,t,r,n,o){if(!fP(e))throw wt;let{dispatch:i}=e,s=()=>e.state,a=tr(e),{result:c,maximumPreviewSize:u}=t.options,g=()=>{let{resultsWithPreview:w,position:h}=s().resultPreview;return w[h]},v=w=>{i(Ru({uniqueId:w,requestedOutputSize:u,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||i(Ki({uniqueId:w,requestedOutputSize:u})),o&&o()};return{...a,fetchResultContent(){v(c.uniqueId)},next(){i(xu()),v(g())},previous(){i(Eu()),v(g())},get state(){let w=s(),h=c.hasHtmlVersion,y=w.resultPreview,S=c.uniqueId===y.uniqueId?y.content:"",x=y.isLoading,I=y.contentURL,_=g();return{content:S,resultHasPreview:h,isLoading:x,contentURL:I,currentResultUniqueId:_}}}}function fP(e){return e.addReducers({configuration:St,resultPreview:tb}),!0}function nb(e,t){if(!mP(e))throw wt;let{dispatch:r}=e,n=()=>e.state,o=()=>n().documentSuggestion.documents,a=rb(e,t,Cu,"/html",()=>{e.dispatch(wu(t.options.result.uniqueId))});return r(Iu({results:o()})),{...a,get state(){return{...a.state,currentDocument:o().findIndex(c=>c.uniqueId===a.state.currentResultUniqueId)+1,totalDocuments:o().length}}}}function mP(e){return e.addReducers({documentSuggestion:er}),!0}m();d();f();p();m();d();f();p();var Wp=e=>W(e,{evt:ee,type:He}),ob=e=>Re("analytics/generic/search",t=>{Wp(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),ib=e=>Re("analytics/generic/click",(t,r)=>(md(e.result),Wp(e),t.makeClickEvent(e.evt,pd(e.result,r),fd(e.result),e.meta))),sb=e=>Re("analytics/generic/custom",t=>(Wp(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));function gP(e){return e.addReducers({}),{logSearchEvent:ob,logClickEvent:ib,logCustomEvent:sb}}m();d();f();p();function hP(e){return e.addReducers({}),{logCaseStart:jA,logCaseNextStage:qA,logCreateCase:UA,logSolveCase:VA,logAbandonCase:BA,logUpdateCaseField:No,logClassificationClick:bu,logDocumentSuggestionClick:$A,logDocumentSuggestionRating:HA,logQuickviewDocumentSuggestionClick:wu}}m();d();f();p();function yP(e){return e.addReducers({caseField:Lr}),{registerCaseField:Fo,updateCaseField:Do,fetchCaseClassifications:Jt}}m();d();f();p();function vP(e){return e.addReducers({caseInput:jr}),{updateCaseInput:kn}}m();d();f();p();function SP(e){return e.addReducers({documentSuggestion:er}),{fetchDocumentSuggestions:kt}}/**
46
46
  * @license
47
47
  *
48
48
  * Copyright 2026 Coveo Solutions Inc.
@@ -75,4 +75,4 @@ fast-json-patch/module/duplex.mjs:
75
75
  *)
76
76
  */if(__exports!=exports)module.exports=exports;return module.exports});
77
77
 
78
- window.coveoQuanticVersion = '3.44.3';
78
+ window.coveoQuanticVersion = '3.45.0';