@coveo/quantic 3.44.0 → 3.44.1

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.
@@ -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 ZA=Object.create;var Fo=Object.defineProperty;var JA=Object.getOwnPropertyDescriptor;var eb=Object.getOwnPropertyNames;var tb=Object.getPrototypeOf,rb=Object.prototype.hasOwnProperty;var nb=(e,t,r)=>t in e?Fo(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}},Wi=(e,t)=>{for(var r in t)Fo(e,r,{get:t[r],enumerable:!0})},$p=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of eb(t))!rb.call(e,o)&&o!==r&&Fo(e,o,{get:()=>t[o],enumerable:!(n=JA(t,o))||n.enumerable});return e};var Pt=(e,t,r)=>(r=e!=null?ZA(tb(e)):{},$p(t||!e||!e.__esModule?Fo(r,"default",{value:e,enumerable:!0}):r,e)),ob=e=>$p(Fo({},"__esModule",{value:!0}),e);var oe=(e,t,r)=>nb(e,typeof t!="symbol"?t+"":t,r);var b,d=_n(()=>{"use strict";b=typeof globalThis<"u"?globalThis:window});function Ki(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ki=function(t){return typeof t}:Ki=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ki(e)}function ab(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=cb.bind(this))}function cb(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","*/*"),ib(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):sb(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var ib,sb,p=_n(()=>{"use strict";ib=function(t){return typeof t=="string"},sb=function(t){return t instanceof Blob};ab.call((typeof window>"u"?"undefined":Ki(window))==="object"?window:{})});var _u=Ye(Do=>{"use strict";m();d();f();p();Object.defineProperty(Do,"__esModule",{value:!0});function Qp(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 ub(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function lb(e,t,r){return t=kn(t),pb(e,Kp()?Reflect.construct(t,r||[],kn(e).constructor):t.apply(e,r))}function Iu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hp(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,hb(n.key),n)}}function Ru(e,t,r){return t&&Hp(e.prototype,t),r&&Hp(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function zp(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=yb(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 xu(){return xu=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=fb(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},xu.apply(null,arguments)}function kn(e){return kn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},kn(e)}function db(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&&Eu(e,t)}function Kp(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Kp=function(){return!!e})()}function pb(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 ub(e)}function Eu(e,t){return Eu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Eu(e,t)}function fb(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=kn(e))!==null;);return e}function mb(e,t,r,n){var o=xu(kn(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function gb(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 hb(e){var t=gb(e,"string");return typeof t=="symbol"?t:t+""}function yb(e,t){if(e){if(typeof e=="string")return Qp(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)?Qp(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function vb(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 Sb(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 Wp=function(){function e(){Iu(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Ru(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}}}])}(),Tu=function(e){function t(){var r;return Iu(this,t),r=lb(this,t),r.listeners||Wp.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 db(t,e),Ru(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)),mb(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 Yi;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 Yi;function i(){o.abort(this.reason),s()}function s(){var g=zp(n),v;try{for(g.s();!(v=g.n()).done;){var E=v.value;E.removeEventListener("abort",i)}}catch(y){g.e(y)}finally{g.f()}}var a=zp(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}}])}(Wp),Yi=function(){function e(){Iu(this,e),Object.defineProperty(this,"signal",{value:new Tu,writable:!0,configurable:!0})}return Ru(e,[{key:"abort",value:function(r){var n=Sb(r),o=vb(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Yi.prototype[Symbol.toStringTag]="AbortController",Tu.prototype[Symbol.toStringTag]="AbortSignal");function Ab(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 bb(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(!Ab({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(E,y){var h;y&&y.signal&&(h=y.signal,delete y.signal);var S=new o(E,y);return h&&Object.defineProperty(S,"signal",{writable:!1,enumerable:!1,configurable:!0,value:h}),S},c.prototype=o.prototype);var u=r,g=function(E,y){var h=c&&c.prototype.isPrototypeOf(E)?E.signal:y?y.signal:void 0;if(h){var S;try{S=new DOMException("Aborted","AbortError")}catch{S=new Error("Aborted"),S.name="AbortError"}if(h.aborted)return Promise.reject(S);var w=new Promise(function(I,T){h.addEventListener("abort",function(){return T(S)},{once:!0})});return y&&y.signal&&delete y.signal,Promise.race([w,u(E,y)])}return u(E,y)};return{fetch:g,Request:c}}Do.AbortController=Yi;Do.AbortSignal=Tu;Do.abortableFetch=bb});var Yp,l,C,f=_n(()=>{"use strict";Yp=Pt(_u(),1),l=Pt(_u(),1),{fetch:C}=(0,Yp.abortableFetch)({fetch})});function ku(e){return typeof e!="string"||e in{}}function Ou(){return Object.create(null)}function Xp(e){return typeof e=="string"&&!!e.trim()}function Pu(e,t){var r=e.split(";").filter(Xp),n=r.shift();if(!n)return null;var o=wb(n),i=o.name,s=o.value;if(t=t?Object.assign({},Xi,t):Xi,ku(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=Ou();return a.name=i,a.value=s,r.forEach(function(c){var u=c.split("="),g=u.shift().trim().toLowerCase();if(!ku(g)){var v=u.join("=").trim();if(g==="expires")a.expires=new Date(v);else if(g==="max-age"){var E=parseInt(v,10);Number.isNaN(E)||(a.maxAge=E)}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 wb(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function On(e,t){if(t=t?Object.assign({},Xi,t):Xi,!e)return t.map?Ou():[];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(Xp),n&&(e=e.map(Zi).flat()),t.map){var i=Ou();return e.reduce(function(s,a){var c=Pu(a,t);return c&&!ku(c.name)&&(s[c.name]=c),s},i)}else return e.map(function(s){return Pu(s,t)}).filter(Boolean)}function Zi(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 Xi,Zp=_n(()=>{"use strict";m();d();f();p();Xi={decodeValues:!0,map:!1,silent:!1,split:"auto"};On.parseSetCookie=On;On.parse=On;On.parseString=Pu;On.splitCookiesString=Zi});function Mo(e){if(Cb.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Nu(e){return e.replace(xb,"")}function Lo(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||!Eb(r))return!1}return!0}function Eb(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function ef(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 Cb,Jp,xb,tf,Pn,Fu,rf,x,of=_n(()=>{"use strict";m();d();f();p();Zp();Cb=/[^a-z0-9\-#$%&'*+.^_`|~]/i;Jp=[`
19
- `,"\r","\t"," "],xb=new RegExp(`(^[${Jp.join("")}]|$[${Jp.join("")}])`,"g");Pn=Symbol("normalizedHeaders"),Fu=Symbol("rawHeaderNames"),rf=", ",x=class nf{constructor(t){this[Pn]={},this[Fu]=new Map,this[tf]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof nf||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(rf):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(rf):n)})}[(tf=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[Pn]).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(!Lo(t))throw new TypeError(`Invalid header name "${t}"`);return this[Pn].hasOwnProperty(Mo(t))}get(t){if(!Lo(t))throw TypeError(`Invalid header name "${t}"`);return this[Pn][Mo(t)]??null}set(t,r){if(!Lo(t)||!ef(r))return;let n=Mo(t),o=Nu(r);this[Pn][n]=Nu(o),this[Fu].set(n,t)}append(t,r){if(!Lo(t)||!ef(r))return;let n=Mo(t),o=Nu(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!Lo(t)||!this.has(t))return;let r=Mo(t);delete this[Pn][r],this[Fu].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===""?[""]:Zi(t)}}});var m=_n(()=>{"use strict";of()});var sf=Ye(jo=>{"use strict";m();d();f();p();var Ji=jo&&jo.__assign||function(){return Ji=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},Ji.apply(this,arguments)};Object.defineProperty(jo,"__esModule",{value:!0});var Ib={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function Rb(e){var t=Ji(Ji({},Ib),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}jo.getSanitizedOptions=Rb});var af=Ye(Du=>{"use strict";m();d();f();p();Object.defineProperty(Du,"__esModule",{value:!0});function Tb(e){var t=Math.random()*e;return Math.round(t)}Du.fullJitter=Tb});var cf=Ye(Mu=>{"use strict";m();d();f();p();Object.defineProperty(Mu,"__esModule",{value:!0});function _b(e){return e}Mu.noJitter=_b});var uf=Ye(Lu=>{"use strict";m();d();f();p();Object.defineProperty(Lu,"__esModule",{value:!0});var kb=af(),Ob=cf();function Pb(e){return e.jitter==="full"?kb.fullJitter:Ob.noJitter}Lu.JitterFactory=Pb});var qu=Ye(ju=>{"use strict";m();d();f();p();Object.defineProperty(ju,"__esModule",{value:!0});var Nb=uf(),Fb=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=Nb.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}();ju.Delay=Fb});var lf=Ye(rr=>{"use strict";m();d();f();p();var Db=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)}}(),Mb=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())})},Lb=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 jb=qu(),qb=function(e){Db(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return Mb(this,void 0,void 0,function(){return Lb(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}(jb.Delay);rr.SkipFirstDelay=qb});var df=Ye(qo=>{"use strict";m();d();f();p();var Ub=qo&&qo.__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(qo,"__esModule",{value:!0});var Vb=qu(),Gb=function(e){Ub(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Vb.Delay);qo.AlwaysDelay=Gb});var pf=Ye(Uu=>{"use strict";m();d();f();p();Object.defineProperty(Uu,"__esModule",{value:!0});var Bb=lf(),$b=df();function Qb(e,t){var r=Hb(e);return r.setAttemptNumber(t),r}Uu.DelayFactory=Qb;function Hb(e){return e.delayFirstAttempt?new $b.AlwaysDelay(e):new Bb.SkipFirstDelay(e)}});var ff=Ye(qr=>{"use strict";m();d();f();p();var Vu=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())})},Gu=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 zb=sf(),Wb=pf();function Kb(e,t){return t===void 0&&(t={}),Vu(this,void 0,void 0,function(){var r,n;return Gu(this,function(o){switch(o.label){case 0:return r=zb.getSanitizedOptions(t),n=new Yb(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}qr.backOff=Kb;var Yb=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return Vu(this,void 0,void 0,function(){var t,r;return Gu(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 Vu(this,void 0,void 0,function(){var t;return Gu(this,function(r){switch(r.label){case 0:return t=Wb.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var wa=Ye((fd,md)=>{"use strict";m();d();f();p();(function(e,t){typeof fd=="object"&&typeof md<"u"?md.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs=t()})(fd,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",E="date",y="Invalid Date",h=/^(\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,w={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},T={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:E,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",k={};k[R]=w;var _="$isDayjsObject",F=function(O){return O instanceof U||!(!O||!O[_])},V=function O(P,N,Q){var $;if(!P)return R;if(typeof P=="string"){var Y=P.toLowerCase();k[Y]&&($=Y),N&&(k[Y]=N,$=Y);var K=P.split("-");if(!$&&K.length>1)return O(K[0])}else{var H=P.name;k[H]=P,$=H}return!Q&&$&&(R=$),$||!Q&&R},j=function(O,P){if(F(O))return O.clone();var N=typeof P=="object"?P:{};return N.date=O,N.args=arguments,new U(N)},L=T;L.l=V,L.i=F,L.w=function(O,P){return j(O,{locale:P.$L,utc:P.$u,x:P.$x,$offset:P.$offset})};var U=function(){function O(N){this.$L=V(N.locale,null,!0),this.parse(N),this.$x=this.$x||N.x||{},this[_]=!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(h);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()!==y},P.isSame=function(N,Q){var $=j(N);return this.startOf(Q)<=$&&$<=this.endOf(Q)},P.isAfter=function(N,Q){return j(N)<this.startOf(Q)},P.isBefore=function(N,Q){return this.endOf(Q)<j(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 _e=this.$locale().weekStart||0,ke=(se<_e?se+7:se)-_e;return H(Y?Ne-ke:Ne+(6-ke),be);case a:case E: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",$[E]=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(E,1);se.$d[H](J),se.init(),this.$d=se.set(E,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=j(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||y;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,_e=function(de,he,fe,Ge){return de&&(de[he]||de(Q,Y))||fe[he].slice(0,Ge)},ke=function(de){return L.s(H%12||12,de,"0")},pe=Ie||function(de,he,fe){var Ge=de<12?"AM":"PM";return fe?Ge.toLowerCase():Ge};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 _e($.monthsShort,se,Ne,3);case"MMMM":return _e(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 _e($.weekdaysMin,Q.$W,be,2);case"ddd":return _e($.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 ke(1);case"hh":return ke(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=j(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 k[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=U.prototype;return j.prototype=M,[["$ms",n],["$s",o],["$m",i],["$H",s],["$W",a],["$M",u],["$y",v],["$D",E]].forEach(function(O){M[O[1]]=function(P){return this.$g(P,O[0],O[1])}}),j.extend=function(O,P){return O.$i||(O(P,U,j),O.$i=!0),j},j.locale=V,j.isDayjs=F,j.unix=function(O){return j(1e3*O)},j.en=k[R],j.Ls=k,j.p={},j})});var Th=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_plugin_quarterOfYear=t()})(gd,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 _h=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_customParseFormat=t()})(yd,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(h){return(h=+h)+(h>68?1900:2e3)},c=function(h){return function(S){this[h]=+S}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(h){(this.zone||(this.zone={})).offset=function(S){if(!S||S==="Z")return 0;var w=S.match(/([+-]|\d\d)/g),I=60*w[1]+(+w[2]||0);return I===0?0:w[0]==="+"?-I:I}(h)}],g=function(h){var S=s[h];return S&&(S.indexOf?S:S.s.concat(S.f))},v=function(h,S){var w,I=s.meridiem;if(I){for(var T=1;T<=24;T+=1)if(h.indexOf(I(T,0,S))>-1){w=T>12;break}}else w=h===(S?"pm":"PM");return w},E={A:[i,function(h){this.afternoon=v(h,!1)}],a:[i,function(h){this.afternoon=v(h,!0)}],Q:[r,function(h){this.month=3*(h-1)+1}],S:[r,function(h){this.milliseconds=100*+h}],SS:[n,function(h){this.milliseconds=10*+h}],SSS:[/\d{3}/,function(h){this.milliseconds=+h}],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(h){var S=s.ordinal,w=h.match(/\d+/);if(this.day=w[0],S)for(var I=1;I<=31;I+=1)S(I).replace(/\[|\]/g,"")===h&&(this.day=I)}],w:[o,c("week")],ww:[n,c("week")],M:[o,c("month")],MM:[n,c("month")],MMM:[i,function(h){var S=g("months"),w=(g("monthsShort")||S.map(function(I){return I.slice(0,3)})).indexOf(h)+1;if(w<1)throw new Error;this.month=w%12||w}],MMMM:[i,function(h){var S=g("months").indexOf(h)+1;if(S<1)throw new Error;this.month=S%12||S}],Y:[/[+-]?\d+/,c("year")],YY:[n,function(h){this.year=a(h)}],YYYY:[/\d{4}/,c("year")],Z:u,ZZ:u};function y(h){var S,w;S=h,w=s&&s.formats;for(var I=(h=S.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(j,L,U){var M=U&&U.toUpperCase();return L||w[U]||e[U]||w[M].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(O,P,N){return P||N.slice(1)})})).match(t),T=I.length,R=0;R<T;R+=1){var k=I[R],_=E[k],F=_&&_[0],V=_&&_[1];I[R]=V?{regex:F,parser:V}:k.replace(/^\[|\]$/g,"")}return function(j){for(var L={},U=0,M=0;U<T;U+=1){var O=I[U];if(typeof O=="string")M+=O.length;else{var P=O.regex,N=O.parser,Q=j.slice(M),$=P.exec(Q)[0];N.call(L,$),j=j.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(h,S,w){w.p.customParseFormat=!0,h&&h.parseTwoDigitYear&&(a=h.parseTwoDigitYear);var I=S.prototype,T=I.parse;I.parse=function(R){var k=R.date,_=R.utc,F=R.args;this.$u=_;var V=F[1];if(typeof V=="string"){var j=F[2]===!0,L=F[3]===!0,U=j||L,M=F[2];L&&(M=F[2]),s=this.$locale(),!j&&M&&(s=w.Ls[M]),this.$d=function(Q,$,Y,K){try{if(["x","X"].indexOf($)>-1)return new Date(($==="X"?1e3:1)*Q);var H=y($)(Q),J=H.year,se=H.month,be=H.day,Ne=H.hours,Ie=H.minutes,_e=H.seconds,ke=H.milliseconds,pe=H.zone,de=H.week,he=new Date,fe=be||(J||se?1:he.getDate()),Ge=J||he.getFullYear(),ze=0;J&&!se||(ze=se>0?se-1:he.getMonth());var kt,gt=Ne||0,Ut=Ie||0,bt=_e||0,Ot=ke||0;return pe?new Date(Date.UTC(Ge,ze,fe,gt,Ut,bt,Ot+60*pe.offset*1e3)):Y?new Date(Date.UTC(Ge,ze,fe,gt,Ut,bt,Ot)):(kt=new Date(Ge,ze,fe,gt,Ut,bt,Ot),de&&(kt=K(kt).week(de).toDate()),kt)}catch{return new Date("")}}(k,V,_,w),this.init(),M&&M!==!0&&(this.$L=this.locale(M).$L),U&&k!=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=w.apply(this,F);if(N.isValid()){this.$d=N.$d,this.$L=N.$L,this.init();break}P===O&&(this.$d=new Date(""))}else T.call(this,R)}}})});var by=Ye((Nd,Fd)=>{"use strict";m();d();f();p();(function(e,t){typeof Nd=="object"&&typeof Fd<"u"?Fd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_timezone=t()})(Nd,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,E){E===void 0&&(E={});var y=new Date(g),h=function(S,w){w===void 0&&(w={});var I=w.timeZoneName||"short",T=S+"|"+I,R=t[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[T]=R),R}(v,E);return h.formatToParts(y)},a=function(g,v){for(var E=s(g,v),y=[],h=0;h<E.length;h+=1){var S=E[h],w=S.type,I=S.value,T=e[w];T>=0&&(y[T]=parseInt(I,10))}var R=y[3],k=R===24?0:R,_=y[0]+"-"+y[1]+"-"+y[2]+" "+k+":"+y[4]+":"+y[5]+":000",F=+g;return(o.utc(_).valueOf()-(F-=F%1e3))/6e4},c=n.prototype;c.tz=function(g,v){g===void 0&&(g=i);var E,y=this.utcOffset(),h=this.toDate(),S=h.toLocaleString("en-US",{timeZone:g}),w=Math.round((h-new Date(S))/1e3/60),I=15*-Math.round(h.getTimezoneOffset()/15)-w;if(!Number(I))E=this.utcOffset(0,v);else if(E=o(S,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(I,!0),v){var T=E.utcOffset();E=E.add(y-T,"minute")}return E.$x.$timezone=g,E},c.offsetName=function(g){var v=this.$x.$timezone||o.tz.guess(),E=s(this.valueOf(),v,{timeZoneName:g}).find(function(y){return y.type.toLowerCase()==="timezonename"});return E&&E.value};var u=c.startOf;c.startOf=function(g,v){if(!this.$x||!this.$x.$timezone)return u.call(this,g,v);var E=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return u.call(E,g,v).tz(this.$x.$timezone,!0)},o.tz=function(g,v,E){var y=E&&v,h=E||v||i,S=a(+o(),h);if(typeof g!="string")return o(g).tz(h);var w=function(k,_,F){var V=k-60*_*1e3,j=a(V,F);if(_===j)return[V,_];var L=a(V-=60*(j-_)*1e3,F);return j===L?[V,j]:[k-60*Math.min(j,L)*1e3,Math.max(j,L)]}(o.utc(g,y).valueOf(),S,h),I=w[0],T=w[1],R=o(I).utcOffset(T);return R.$x.$timezone=h,R},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var wy=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_utc=t()})(Dd,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(y){var h={date:y,utc:!0,args:arguments};return new o(h)},s.utc=function(y){var h=i(this.toDate(),{locale:this.$L,utc:!0});return y?h.add(this.utcOffset(),e):h},s.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var a=s.parse;s.parse=function(y){y.utc&&(this.$u=!0),this.$utils().u(y.$offset)||(this.$offset=y.$offset),a.call(this,y)};var c=s.init;s.init=function(){if(this.$u){var y=this.$d;this.$y=y.getUTCFullYear(),this.$M=y.getUTCMonth(),this.$D=y.getUTCDate(),this.$W=y.getUTCDay(),this.$H=y.getUTCHours(),this.$m=y.getUTCMinutes(),this.$s=y.getUTCSeconds(),this.$ms=y.getUTCMilliseconds()}else c.call(this)};var u=s.utcOffset;s.utcOffset=function(y,h){var S=this.$utils().u;if(S(y))return this.$u?0:S(this.$offset)?u.call(this):this.$offset;if(typeof y=="string"&&(y=function(R){R===void 0&&(R="");var k=R.match(t);if(!k)return null;var _=(""+k[0]).match(r)||["-",0,0],F=_[0],V=60*+_[1]+ +_[2];return V===0?0:F==="+"?V:-V}(y),y===null))return this;var w=Math.abs(y)<=16?60*y:y;if(w===0)return this.utc(h);var I=this.clone();if(h)return I.$offset=w,I.$u=!1,I;var T=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(I=this.local().add(w+T,e)).$offset=w,I.$x.$localOffset=T,I};var g=s.format;s.format=function(y){var h=y||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,h)},s.valueOf=function(){var y=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*y},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(y){return y==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var E=s.diff;s.diff=function(y,h,S){if(y&&this.$u===y.$u)return E.call(this,y,h,S);var w=this.local(),I=i(y).local();return E.call(w,I,h,S)}}})});var dA=Ye((jae,lA)=>{"use strict";m();d();f();p();function fO(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}lA.exports=mO;function mO(e,t,r){var n=r&&r.stringify||fO,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,E=e&&e.length||0,y=0;y<E;){if(e.charCodeAt(y)===37&&y+1<E){switch(v=v>-1?v:0,e.charCodeAt(y+1)){case 100:case 102:if(g>=c||t[g]==null)break;v<y&&(u+=e.slice(v,y)),u+=Number(t[g]),v=y+2,y++;break;case 105:if(g>=c||t[g]==null)break;v<y&&(u+=e.slice(v,y)),u+=Math.floor(Number(t[g])),v=y+2,y++;break;case 79:case 111:case 106:if(g>=c||t[g]===void 0)break;v<y&&(u+=e.slice(v,y));var h=typeof t[g];if(h==="string"){u+="'"+t[g]+"'",v=y+2,y++;break}if(h==="function"){u+=t[g].name||"<anonymous>",v=y+2,y++;break}u+=n(t[g]),v=y+2,y++;break;case 115:if(g>=c)break;v<y&&(u+=e.slice(v,y)),u+=String(t[g]),v=y+2,y++;break;case 37:v<y&&(u+=e.slice(v,y)),u+="%",v=y+2,y++,g--;break}++g}++y}return v===-1?e:(v<E&&(u+=e.slice(v)),u)}});var vA=Ye((Bae,hu)=>{"use strict";m();d();f();p();var pA=dA();hu.exports=gr;var Qi=_O().console||{},gO={mapHttpRequest:gu,mapHttpResponse:gu,wrapRequestSerializer:Pp,wrapResponseSerializer:Pp,wrapErrorSerializer:Pp,req:gu,res:gu,err:mA,errWithCause:mA};function Mr(e,t){return e==="silent"?1/0:t.levels.values[e]}var Dp=Symbol("pino.logFuncs"),Np=Symbol("pino.hierarchy"),hO={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function fA(e,t){let r={logger:t,parent:e[Np]};t[Np]=r}function yO(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Qi[o]||Qi[hO[o]||"log"]||_o}),e[Dp]=n}function vO(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||Qi;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=vO(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=_o),yO(u,a,r),fA({},u),Object.defineProperty(u,"levelVal",{get:v}),Object.defineProperty(u,"level",{get:E,set:y});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:IO(e),messageKey:e.messageKey||"msg",onChild:e.onChild||_o};u.levels=SO(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=_o,u.serializers=n,u._serialize=o,u._stdErrSerialize=i,u.child=function(...S){return h.call(this,g,...S)},t&&(u._logEvent=Fp());function v(){return Mr(this.level,this)}function E(){return this._level}function y(S){if(S!=="silent"&&!this.levels.values[S])throw Error("unknown level "+S);this._level=S,Rn(this,g,u,"error"),Rn(this,g,u,"fatal"),Rn(this,g,u,"warn"),Rn(this,g,u,"info"),Rn(this,g,u,"debug"),Rn(this,g,u,"trace"),s.forEach(w=>{Rn(this,g,u,w)})}function h(S,w,I){if(!w)throw new Error("missing bindings for child Pino");I=I||{},o&&w.serializers&&(I.serializers=w.serializers);let T=I.serializers;if(o&&T){var R=Object.assign({},n,T),k=e.browser.serialize===!0?Object.keys(R):o;delete w.serializers,Mp([w],k,R,this._stdErrSerialize)}function _(V){this._childLevel=(V._childLevel|0)+1,this.bindings=w,R&&(this.serializers=R,this._serialize=k),t&&(this._logEvent=Fp([].concat(V._logEvent.bindings,w)))}_.prototype=this;let F=new _(this);return fA(this,F),F.child=function(...V){return h.call(this,S,...V)},F.level=I.level||this.level,S.onChild(F),F}return u}function SO(e){let t=e.customLevels||{},r=Object.assign({},gr.levels.values,t),n=Object.assign({},gr.levels.labels,AO(t));return{values:r,labels:n}}function AO(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=gO;gr.stdTimeFunctions=Object.assign({},{nullTime:hA,epochTime:yA,unixTime:RO,isoTime:TO});function bO(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[Np];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Rn(e,t,r,n){if(Object.defineProperty(e,n,{value:Mr(e.level,r)>Mr(n,r)?_o:r[Dp][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===_o){if(!t.transmit)return;let i=t.transmit.level||e.level,s=Mr(i,r);if(Mr(n,r)<s)return}e[n]=CO(e,t,r,n);let o=bO(e);o.length!==0&&(e[n]=wO(o,e[n]))}function wO(e,t){return function(){return t.apply(this,[...e,...arguments])}}function CO(e,t,r,n){return function(o){return function(){let s=t.timestamp(),a=new Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Qi?Qi:this;for(var u=0;u<a.length;u++)a[u]=arguments[u];var g=!1;if(t.serialize&&(Mp(a,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let v=xO(this,n,a,s,t);if(t.reportCaller&&v&&v.length>0&&v[0]&&typeof v[0]=="object")try{let E=gA();E&&(v[0].caller=E)}catch{}o.call(c,...v)}else{if(t.reportCaller)try{let v=gA();v&&a.push(v)}catch{}o.apply(c,a)}if(t.transmit){let v=t.transmit.level||e._level,E=Mr(v,r),y=Mr(n,r);if(y<E)return;EO(this,{ts:s,methodLevel:n,methodValue:y,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Mr(e._level,r)},a,g)}}}(e[Dp][n])}function xO(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?pA(a.shift(),a):void 0}else typeof c=="string"&&(c=pA(a.shift(),a));return c!==void 0&&(u[o.messageKey]=c),[s(u)]}}function Mp(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 EO(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||Mp(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=Fp(u)}function Fp(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function mA(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 IO(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?hA:yA}function gu(){return{}}function Pp(e){return e}function _o(){}function hA(){return!1}function yA(){return Date.now()}function RO(){return Math.round(Date.now()/1e3)}function TO(){return new Date(Date.now()).toISOString()}function _O(){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)||{}}}hu.exports.default=gr;hu.exports.pino=gr;function gA(){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 eP={};Wi(eP,{ResultTemplatesHelpers:()=>Bh,buildCaseAssistEngine:()=>xA,buildCaseField:()=>qA,buildCaseInput:()=>UA,buildController:()=>tr,buildDocumentSuggestion:()=>jp,buildDocumentSuggestionList:()=>jp,buildInteractiveResult:()=>GA,buildQuickview:()=>HA,getAnalyticsNextApiBaseUrl:()=>ts,getOrganizationEndpoint:()=>ot,loadCaseAssistAnalyticsActions:()=>YO,loadCaseFieldActions:()=>XO,loadCaseInputActions:()=>ZO,loadDocumentSuggestionActions:()=>JO,loadGenericAnalyticsActions:()=>KO});module.exports=ob(eP);m();d();f();p();m();d();f();p();var Af=Pt(ff(),1);m();d();f();p();var wt=new Error("Failed to load reducers."),Nn=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 mf(e){return Array.isArray(e)}function gf(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}var Xb=new Set(["1",1,"yes",!0]);function Bu(){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=>Xb.has(r))}function hf(e){let t={};for(let[r,n]of e)t[r]=n;return t}function Uo(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function es(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 yf(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function vf(e){return typeof e!="object"||!e?!1:Object.values(e).every(Zb)}function Zb(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Sf(e){return e===429}var yr=class e{static call(t){return _asyncToGenerator(function*(){let r=Jb(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(Sf(c.status))throw c;return c});return function a(){return _ref.apply(this,arguments)}}();try{let c=yield(0,Af.backOff)(a,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(u){let g=u&&Sf(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 Nn;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=Uo(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 Fn(e,t,r="prod"){return e??ot(t,r)}function Dn(e,t="prod"){return`${ot(e,t)}/rest/search/v2`}function ts(e,t="prod"){return`${ot(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function Jb(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:s}=e,a=e.method==="POST"||e.method==="PUT",c=ew(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(a&&{body:c}),signal:s}}function ew(e,t){return t==="application/x-www-form-urlencoded"?vf(e)?yf(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();function tw(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 tb=Object.create;var Fo=Object.defineProperty;var rb=Object.getOwnPropertyDescriptor;var nb=Object.getOwnPropertyNames;var ob=Object.getPrototypeOf,ib=Object.prototype.hasOwnProperty;var sb=(e,t,r)=>t in e?Fo(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}},Ki=(e,t)=>{for(var r in t)Fo(e,r,{get:t[r],enumerable:!0})},Qp=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of nb(t))!ib.call(e,o)&&o!==r&&Fo(e,o,{get:()=>t[o],enumerable:!(n=rb(t,o))||n.enumerable});return e};var Pt=(e,t,r)=>(r=e!=null?tb(ob(e)):{},Qp(t||!e||!e.__esModule?Fo(r,"default",{value:e,enumerable:!0}):r,e)),ab=e=>Qp(Fo({},"__esModule",{value:!0}),e);var oe=(e,t,r)=>sb(e,typeof t!="symbol"?t+"":t,r);var b,d=_n(()=>{"use strict";b=typeof globalThis<"u"?globalThis:window});function Yi(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Yi=function(t){return typeof t}:Yi=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yi(e)}function lb(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=db.bind(this))}function db(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","*/*"),cb(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):ub(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var cb,ub,p=_n(()=>{"use strict";cb=function(t){return typeof t=="string"},ub=function(t){return t instanceof Blob};lb.call((typeof window>"u"?"undefined":Yi(window))==="object"?window:{})});var _u=Ye(Do=>{"use strict";m();d();f();p();Object.defineProperty(Do,"__esModule",{value:!0});function Hp(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 pb(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function fb(e,t,r){return t=kn(t),gb(e,Yp()?Reflect.construct(t,r||[],kn(e).constructor):t.apply(e,r))}function Iu(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,Sb(n.key),n)}}function Ru(e,t,r){return t&&zp(e.prototype,t),r&&zp(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Wp(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Ab(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 xu(){return xu=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=hb(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},xu.apply(null,arguments)}function kn(e){return kn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},kn(e)}function mb(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&&Eu(e,t)}function Yp(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Yp=function(){return!!e})()}function gb(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 pb(e)}function Eu(e,t){return Eu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Eu(e,t)}function hb(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=kn(e))!==null;);return e}function yb(e,t,r,n){var o=xu(kn(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function vb(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 Sb(e){var t=vb(e,"string");return typeof t=="symbol"?t:t+""}function Ab(e,t){if(e){if(typeof e=="string")return Hp(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)?Hp(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function bb(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 wb(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 Kp=function(){function e(){Iu(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Ru(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}}}])}(),Tu=function(e){function t(){var r;return Iu(this,t),r=fb(this,t),r.listeners||Kp.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 mb(t,e),Ru(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)),yb(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 Xi;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 Xi;function i(){o.abort(this.reason),s()}function s(){var g=Wp(n),v;try{for(g.s();!(v=g.n()).done;){var E=v.value;E.removeEventListener("abort",i)}}catch(y){g.e(y)}finally{g.f()}}var a=Wp(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}}])}(Kp),Xi=function(){function e(){Iu(this,e),Object.defineProperty(this,"signal",{value:new Tu,writable:!0,configurable:!0})}return Ru(e,[{key:"abort",value:function(r){var n=wb(r),o=bb(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Xi.prototype[Symbol.toStringTag]="AbortController",Tu.prototype[Symbol.toStringTag]="AbortSignal");function Cb(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 xb(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(!Cb({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(E,y){var h;y&&y.signal&&(h=y.signal,delete y.signal);var S=new o(E,y);return h&&Object.defineProperty(S,"signal",{writable:!1,enumerable:!1,configurable:!0,value:h}),S},c.prototype=o.prototype);var u=r,g=function(E,y){var h=c&&c.prototype.isPrototypeOf(E)?E.signal:y?y.signal:void 0;if(h){var S;try{S=new DOMException("Aborted","AbortError")}catch{S=new Error("Aborted"),S.name="AbortError"}if(h.aborted)return Promise.reject(S);var w=new Promise(function(I,T){h.addEventListener("abort",function(){return T(S)},{once:!0})});return y&&y.signal&&delete y.signal,Promise.race([w,u(E,y)])}return u(E,y)};return{fetch:g,Request:c}}Do.AbortController=Xi;Do.AbortSignal=Tu;Do.abortableFetch=xb});var Xp,l,C,f=_n(()=>{"use strict";Xp=Pt(_u(),1),l=Pt(_u(),1),{fetch:C}=(0,Xp.abortableFetch)({fetch})});function ku(e){return typeof e!="string"||e in{}}function Ou(){return Object.create(null)}function Zp(e){return typeof e=="string"&&!!e.trim()}function Pu(e,t){var r=e.split(";").filter(Zp),n=r.shift();if(!n)return null;var o=Eb(n),i=o.name,s=o.value;if(t=t?Object.assign({},Zi,t):Zi,ku(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=Ou();return a.name=i,a.value=s,r.forEach(function(c){var u=c.split("="),g=u.shift().trim().toLowerCase();if(!ku(g)){var v=u.join("=").trim();if(g==="expires")a.expires=new Date(v);else if(g==="max-age"){var E=parseInt(v,10);Number.isNaN(E)||(a.maxAge=E)}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 Eb(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function On(e,t){if(t=t?Object.assign({},Zi,t):Zi,!e)return t.map?Ou():[];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(Zp),n&&(e=e.map(Ji).flat()),t.map){var i=Ou();return e.reduce(function(s,a){var c=Pu(a,t);return c&&!ku(c.name)&&(s[c.name]=c),s},i)}else return e.map(function(s){return Pu(s,t)}).filter(Boolean)}function Ji(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 Zi,Jp=_n(()=>{"use strict";m();d();f();p();Zi={decodeValues:!0,map:!1,silent:!1,split:"auto"};On.parseSetCookie=On;On.parse=On;On.parseString=Pu;On.splitCookiesString=Ji});function Mo(e){if(Ib.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Nu(e){return e.replace(Rb,"")}function Lo(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||!Tb(r))return!1}return!0}function Tb(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function tf(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 Ib,ef,Rb,rf,Pn,Fu,nf,x,sf=_n(()=>{"use strict";m();d();f();p();Jp();Ib=/[^a-z0-9\-#$%&'*+.^_`|~]/i;ef=[`
19
+ `,"\r","\t"," "],Rb=new RegExp(`(^[${ef.join("")}]|$[${ef.join("")}])`,"g");Pn=Symbol("normalizedHeaders"),Fu=Symbol("rawHeaderNames"),nf=", ",x=class of{constructor(t){this[Pn]={},this[Fu]=new Map,this[rf]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof of||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(nf):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(nf):n)})}[(rf=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[Pn]).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(!Lo(t))throw new TypeError(`Invalid header name "${t}"`);return this[Pn].hasOwnProperty(Mo(t))}get(t){if(!Lo(t))throw TypeError(`Invalid header name "${t}"`);return this[Pn][Mo(t)]??null}set(t,r){if(!Lo(t)||!tf(r))return;let n=Mo(t),o=Nu(r);this[Pn][n]=Nu(o),this[Fu].set(n,t)}append(t,r){if(!Lo(t)||!tf(r))return;let n=Mo(t),o=Nu(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!Lo(t)||!this.has(t))return;let r=Mo(t);delete this[Pn][r],this[Fu].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===""?[""]:Ji(t)}}});var m=_n(()=>{"use strict";sf()});var af=Ye(jo=>{"use strict";m();d();f();p();var es=jo&&jo.__assign||function(){return es=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},es.apply(this,arguments)};Object.defineProperty(jo,"__esModule",{value:!0});var _b={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function kb(e){var t=es(es({},_b),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}jo.getSanitizedOptions=kb});var cf=Ye(Du=>{"use strict";m();d();f();p();Object.defineProperty(Du,"__esModule",{value:!0});function Ob(e){var t=Math.random()*e;return Math.round(t)}Du.fullJitter=Ob});var uf=Ye(Mu=>{"use strict";m();d();f();p();Object.defineProperty(Mu,"__esModule",{value:!0});function Pb(e){return e}Mu.noJitter=Pb});var lf=Ye(Lu=>{"use strict";m();d();f();p();Object.defineProperty(Lu,"__esModule",{value:!0});var Nb=cf(),Fb=uf();function Db(e){return e.jitter==="full"?Nb.fullJitter:Fb.noJitter}Lu.JitterFactory=Db});var qu=Ye(ju=>{"use strict";m();d();f();p();Object.defineProperty(ju,"__esModule",{value:!0});var Mb=lf(),Lb=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=Mb.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}();ju.Delay=Lb});var df=Ye(rr=>{"use strict";m();d();f();p();var jb=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)}}(),qb=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())})},Ub=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 Vb=qu(),Gb=function(e){jb(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return qb(this,void 0,void 0,function(){return Ub(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}(Vb.Delay);rr.SkipFirstDelay=Gb});var pf=Ye(qo=>{"use strict";m();d();f();p();var Bb=qo&&qo.__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(qo,"__esModule",{value:!0});var $b=qu(),Qb=function(e){Bb(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}($b.Delay);qo.AlwaysDelay=Qb});var ff=Ye(Uu=>{"use strict";m();d();f();p();Object.defineProperty(Uu,"__esModule",{value:!0});var Hb=df(),zb=pf();function Wb(e,t){var r=Kb(e);return r.setAttemptNumber(t),r}Uu.DelayFactory=Wb;function Kb(e){return e.delayFirstAttempt?new zb.AlwaysDelay(e):new Hb.SkipFirstDelay(e)}});var mf=Ye(qr=>{"use strict";m();d();f();p();var Vu=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())})},Gu=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 Yb=af(),Xb=ff();function Zb(e,t){return t===void 0&&(t={}),Vu(this,void 0,void 0,function(){var r,n;return Gu(this,function(o){switch(o.label){case 0:return r=Yb.getSanitizedOptions(t),n=new Jb(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}qr.backOff=Zb;var Jb=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return Vu(this,void 0,void 0,function(){var t,r;return Gu(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 Vu(this,void 0,void 0,function(){var t;return Gu(this,function(r){switch(r.label){case 0:return t=Xb.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var Ca=Ye((fd,md)=>{"use strict";m();d();f();p();(function(e,t){typeof fd=="object"&&typeof md<"u"?md.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs=t()})(fd,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",E="date",y="Invalid Date",h=/^(\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,w={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},T={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:E,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",k={};k[R]=w;var _="$isDayjsObject",F=function(O){return O instanceof U||!(!O||!O[_])},V=function O(P,N,Q){var $;if(!P)return R;if(typeof P=="string"){var Y=P.toLowerCase();k[Y]&&($=Y),N&&(k[Y]=N,$=Y);var K=P.split("-");if(!$&&K.length>1)return O(K[0])}else{var H=P.name;k[H]=P,$=H}return!Q&&$&&(R=$),$||!Q&&R},j=function(O,P){if(F(O))return O.clone();var N=typeof P=="object"?P:{};return N.date=O,N.args=arguments,new U(N)},L=T;L.l=V,L.i=F,L.w=function(O,P){return j(O,{locale:P.$L,utc:P.$u,x:P.$x,$offset:P.$offset})};var U=function(){function O(N){this.$L=V(N.locale,null,!0),this.parse(N),this.$x=this.$x||N.x||{},this[_]=!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(h);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()!==y},P.isSame=function(N,Q){var $=j(N);return this.startOf(Q)<=$&&$<=this.endOf(Q)},P.isAfter=function(N,Q){return j(N)<this.startOf(Q)},P.isBefore=function(N,Q){return this.endOf(Q)<j(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 _e=this.$locale().weekStart||0,ke=(se<_e?se+7:se)-_e;return H(Y?Ne-ke:Ne+(6-ke),be);case a:case E: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",$[E]=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(E,1);se.$d[H](J),se.init(),this.$d=se.set(E,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=j(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||y;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,_e=function(de,he,fe,Ge){return de&&(de[he]||de(Q,Y))||fe[he].slice(0,Ge)},ke=function(de){return L.s(H%12||12,de,"0")},pe=Ie||function(de,he,fe){var Ge=de<12?"AM":"PM";return fe?Ge.toLowerCase():Ge};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 _e($.monthsShort,se,Ne,3);case"MMMM":return _e(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 _e($.weekdaysMin,Q.$W,be,2);case"ddd":return _e($.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 ke(1);case"hh":return ke(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=j(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 k[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=U.prototype;return j.prototype=M,[["$ms",n],["$s",o],["$m",i],["$H",s],["$W",a],["$M",u],["$y",v],["$D",E]].forEach(function(O){M[O[1]]=function(P){return this.$g(P,O[0],O[1])}}),j.extend=function(O,P){return O.$i||(O(P,U,j),O.$i=!0),j},j.locale=V,j.isDayjs=F,j.unix=function(O){return j(1e3*O)},j.en=k[R],j.Ls=k,j.p={},j})});var _h=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_plugin_quarterOfYear=t()})(gd,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 kh=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_customParseFormat=t()})(yd,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(h){return(h=+h)+(h>68?1900:2e3)},c=function(h){return function(S){this[h]=+S}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(h){(this.zone||(this.zone={})).offset=function(S){if(!S||S==="Z")return 0;var w=S.match(/([+-]|\d\d)/g),I=60*w[1]+(+w[2]||0);return I===0?0:w[0]==="+"?-I:I}(h)}],g=function(h){var S=s[h];return S&&(S.indexOf?S:S.s.concat(S.f))},v=function(h,S){var w,I=s.meridiem;if(I){for(var T=1;T<=24;T+=1)if(h.indexOf(I(T,0,S))>-1){w=T>12;break}}else w=h===(S?"pm":"PM");return w},E={A:[i,function(h){this.afternoon=v(h,!1)}],a:[i,function(h){this.afternoon=v(h,!0)}],Q:[r,function(h){this.month=3*(h-1)+1}],S:[r,function(h){this.milliseconds=100*+h}],SS:[n,function(h){this.milliseconds=10*+h}],SSS:[/\d{3}/,function(h){this.milliseconds=+h}],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(h){var S=s.ordinal,w=h.match(/\d+/);if(this.day=w[0],S)for(var I=1;I<=31;I+=1)S(I).replace(/\[|\]/g,"")===h&&(this.day=I)}],w:[o,c("week")],ww:[n,c("week")],M:[o,c("month")],MM:[n,c("month")],MMM:[i,function(h){var S=g("months"),w=(g("monthsShort")||S.map(function(I){return I.slice(0,3)})).indexOf(h)+1;if(w<1)throw new Error;this.month=w%12||w}],MMMM:[i,function(h){var S=g("months").indexOf(h)+1;if(S<1)throw new Error;this.month=S%12||S}],Y:[/[+-]?\d+/,c("year")],YY:[n,function(h){this.year=a(h)}],YYYY:[/\d{4}/,c("year")],Z:u,ZZ:u};function y(h){var S,w;S=h,w=s&&s.formats;for(var I=(h=S.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(j,L,U){var M=U&&U.toUpperCase();return L||w[U]||e[U]||w[M].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(O,P,N){return P||N.slice(1)})})).match(t),T=I.length,R=0;R<T;R+=1){var k=I[R],_=E[k],F=_&&_[0],V=_&&_[1];I[R]=V?{regex:F,parser:V}:k.replace(/^\[|\]$/g,"")}return function(j){for(var L={},U=0,M=0;U<T;U+=1){var O=I[U];if(typeof O=="string")M+=O.length;else{var P=O.regex,N=O.parser,Q=j.slice(M),$=P.exec(Q)[0];N.call(L,$),j=j.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(h,S,w){w.p.customParseFormat=!0,h&&h.parseTwoDigitYear&&(a=h.parseTwoDigitYear);var I=S.prototype,T=I.parse;I.parse=function(R){var k=R.date,_=R.utc,F=R.args;this.$u=_;var V=F[1];if(typeof V=="string"){var j=F[2]===!0,L=F[3]===!0,U=j||L,M=F[2];L&&(M=F[2]),s=this.$locale(),!j&&M&&(s=w.Ls[M]),this.$d=function(Q,$,Y,K){try{if(["x","X"].indexOf($)>-1)return new Date(($==="X"?1e3:1)*Q);var H=y($)(Q),J=H.year,se=H.month,be=H.day,Ne=H.hours,Ie=H.minutes,_e=H.seconds,ke=H.milliseconds,pe=H.zone,de=H.week,he=new Date,fe=be||(J||se?1:he.getDate()),Ge=J||he.getFullYear(),ze=0;J&&!se||(ze=se>0?se-1:he.getMonth());var kt,gt=Ne||0,Ut=Ie||0,bt=_e||0,Ot=ke||0;return pe?new Date(Date.UTC(Ge,ze,fe,gt,Ut,bt,Ot+60*pe.offset*1e3)):Y?new Date(Date.UTC(Ge,ze,fe,gt,Ut,bt,Ot)):(kt=new Date(Ge,ze,fe,gt,Ut,bt,Ot),de&&(kt=K(kt).week(de).toDate()),kt)}catch{return new Date("")}}(k,V,_,w),this.init(),M&&M!==!0&&(this.$L=this.locale(M).$L),U&&k!=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=w.apply(this,F);if(N.isValid()){this.$d=N.$d,this.$L=N.$L,this.init();break}P===O&&(this.$d=new Date(""))}else T.call(this,R)}}})});var wy=Ye((Nd,Fd)=>{"use strict";m();d();f();p();(function(e,t){typeof Nd=="object"&&typeof Fd<"u"?Fd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_timezone=t()})(Nd,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,E){E===void 0&&(E={});var y=new Date(g),h=function(S,w){w===void 0&&(w={});var I=w.timeZoneName||"short",T=S+"|"+I,R=t[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[T]=R),R}(v,E);return h.formatToParts(y)},a=function(g,v){for(var E=s(g,v),y=[],h=0;h<E.length;h+=1){var S=E[h],w=S.type,I=S.value,T=e[w];T>=0&&(y[T]=parseInt(I,10))}var R=y[3],k=R===24?0:R,_=y[0]+"-"+y[1]+"-"+y[2]+" "+k+":"+y[4]+":"+y[5]+":000",F=+g;return(o.utc(_).valueOf()-(F-=F%1e3))/6e4},c=n.prototype;c.tz=function(g,v){g===void 0&&(g=i);var E,y=this.utcOffset(),h=this.toDate(),S=h.toLocaleString("en-US",{timeZone:g}),w=Math.round((h-new Date(S))/1e3/60),I=15*-Math.round(h.getTimezoneOffset()/15)-w;if(!Number(I))E=this.utcOffset(0,v);else if(E=o(S,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(I,!0),v){var T=E.utcOffset();E=E.add(y-T,"minute")}return E.$x.$timezone=g,E},c.offsetName=function(g){var v=this.$x.$timezone||o.tz.guess(),E=s(this.valueOf(),v,{timeZoneName:g}).find(function(y){return y.type.toLowerCase()==="timezonename"});return E&&E.value};var u=c.startOf;c.startOf=function(g,v){if(!this.$x||!this.$x.$timezone)return u.call(this,g,v);var E=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return u.call(E,g,v).tz(this.$x.$timezone,!0)},o.tz=function(g,v,E){var y=E&&v,h=E||v||i,S=a(+o(),h);if(typeof g!="string")return o(g).tz(h);var w=function(k,_,F){var V=k-60*_*1e3,j=a(V,F);if(_===j)return[V,_];var L=a(V-=60*(j-_)*1e3,F);return j===L?[V,j]:[k-60*Math.min(j,L)*1e3,Math.max(j,L)]}(o.utc(g,y).valueOf(),S,h),I=w[0],T=w[1],R=o(I).utcOffset(T);return R.$x.$timezone=h,R},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var Cy=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_utc=t()})(Dd,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(y){var h={date:y,utc:!0,args:arguments};return new o(h)},s.utc=function(y){var h=i(this.toDate(),{locale:this.$L,utc:!0});return y?h.add(this.utcOffset(),e):h},s.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var a=s.parse;s.parse=function(y){y.utc&&(this.$u=!0),this.$utils().u(y.$offset)||(this.$offset=y.$offset),a.call(this,y)};var c=s.init;s.init=function(){if(this.$u){var y=this.$d;this.$y=y.getUTCFullYear(),this.$M=y.getUTCMonth(),this.$D=y.getUTCDate(),this.$W=y.getUTCDay(),this.$H=y.getUTCHours(),this.$m=y.getUTCMinutes(),this.$s=y.getUTCSeconds(),this.$ms=y.getUTCMilliseconds()}else c.call(this)};var u=s.utcOffset;s.utcOffset=function(y,h){var S=this.$utils().u;if(S(y))return this.$u?0:S(this.$offset)?u.call(this):this.$offset;if(typeof y=="string"&&(y=function(R){R===void 0&&(R="");var k=R.match(t);if(!k)return null;var _=(""+k[0]).match(r)||["-",0,0],F=_[0],V=60*+_[1]+ +_[2];return V===0?0:F==="+"?V:-V}(y),y===null))return this;var w=Math.abs(y)<=16?60*y:y;if(w===0)return this.utc(h);var I=this.clone();if(h)return I.$offset=w,I.$u=!1,I;var T=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(I=this.local().add(w+T,e)).$offset=w,I.$x.$localOffset=T,I};var g=s.format;s.format=function(y){var h=y||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,h)},s.valueOf=function(){var y=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*y},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(y){return y==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var E=s.diff;s.diff=function(y,h,S){if(y&&this.$u===y.$u)return E.call(this,y,h,S);var w=this.local(),I=i(y).local();return E.call(w,I,h,S)}}})});var mA=Ye(($ae,fA)=>{"use strict";m();d();f();p();function SO(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}fA.exports=AO;function AO(e,t,r){var n=r&&r.stringify||SO,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,E=e&&e.length||0,y=0;y<E;){if(e.charCodeAt(y)===37&&y+1<E){switch(v=v>-1?v:0,e.charCodeAt(y+1)){case 100:case 102:if(g>=c||t[g]==null)break;v<y&&(u+=e.slice(v,y)),u+=Number(t[g]),v=y+2,y++;break;case 105:if(g>=c||t[g]==null)break;v<y&&(u+=e.slice(v,y)),u+=Math.floor(Number(t[g])),v=y+2,y++;break;case 79:case 111:case 106:if(g>=c||t[g]===void 0)break;v<y&&(u+=e.slice(v,y));var h=typeof t[g];if(h==="string"){u+="'"+t[g]+"'",v=y+2,y++;break}if(h==="function"){u+=t[g].name||"<anonymous>",v=y+2,y++;break}u+=n(t[g]),v=y+2,y++;break;case 115:if(g>=c)break;v<y&&(u+=e.slice(v,y)),u+=String(t[g]),v=y+2,y++;break;case 37:v<y&&(u+=e.slice(v,y)),u+="%",v=y+2,y++,g--;break}++g}++y}return v===-1?e:(v<E&&(u+=e.slice(v)),u)}});var bA=Ye((Kae,hu)=>{"use strict";m();d();f();p();var gA=mA();hu.exports=gr;var Hi=DO().console||{},bO={mapHttpRequest:gu,mapHttpResponse:gu,wrapRequestSerializer:Np,wrapResponseSerializer:Np,wrapErrorSerializer:Np,req:gu,res:gu,err:yA,errWithCause:yA};function Mr(e,t){return e==="silent"?1/0:t.levels.values[e]}var Mp=Symbol("pino.logFuncs"),Fp=Symbol("pino.hierarchy"),wO={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function hA(e,t){let r={logger:t,parent:e[Fp]};t[Fp]=r}function CO(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Hi[o]||Hi[wO[o]||"log"]||_o}),e[Mp]=n}function xO(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||Hi;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=xO(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=_o),CO(u,a,r),hA({},u),Object.defineProperty(u,"levelVal",{get:v}),Object.defineProperty(u,"level",{get:E,set:y});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:PO(e),messageKey:e.messageKey||"msg",onChild:e.onChild||_o};u.levels=EO(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=_o,u.serializers=n,u._serialize=o,u._stdErrSerialize=i,u.child=function(...S){return h.call(this,g,...S)},t&&(u._logEvent=Dp());function v(){return Mr(this.level,this)}function E(){return this._level}function y(S){if(S!=="silent"&&!this.levels.values[S])throw Error("unknown level "+S);this._level=S,Rn(this,g,u,"error"),Rn(this,g,u,"fatal"),Rn(this,g,u,"warn"),Rn(this,g,u,"info"),Rn(this,g,u,"debug"),Rn(this,g,u,"trace"),s.forEach(w=>{Rn(this,g,u,w)})}function h(S,w,I){if(!w)throw new Error("missing bindings for child Pino");I=I||{},o&&w.serializers&&(I.serializers=w.serializers);let T=I.serializers;if(o&&T){var R=Object.assign({},n,T),k=e.browser.serialize===!0?Object.keys(R):o;delete w.serializers,Lp([w],k,R,this._stdErrSerialize)}function _(V){this._childLevel=(V._childLevel|0)+1,this.bindings=w,R&&(this.serializers=R,this._serialize=k),t&&(this._logEvent=Dp([].concat(V._logEvent.bindings,w)))}_.prototype=this;let F=new _(this);return hA(this,F),F.child=function(...V){return h.call(this,S,...V)},F.level=I.level||this.level,S.onChild(F),F}return u}function EO(e){let t=e.customLevels||{},r=Object.assign({},gr.levels.values,t),n=Object.assign({},gr.levels.labels,IO(t));return{values:r,labels:n}}function IO(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=bO;gr.stdTimeFunctions=Object.assign({},{nullTime:SA,epochTime:AA,unixTime:NO,isoTime:FO});function RO(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[Fp];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Rn(e,t,r,n){if(Object.defineProperty(e,n,{value:Mr(e.level,r)>Mr(n,r)?_o:r[Mp][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===_o){if(!t.transmit)return;let i=t.transmit.level||e.level,s=Mr(i,r);if(Mr(n,r)<s)return}e[n]=_O(e,t,r,n);let o=RO(e);o.length!==0&&(e[n]=TO(o,e[n]))}function TO(e,t){return function(){return t.apply(this,[...e,...arguments])}}function _O(e,t,r,n){return function(o){return function(){let s=t.timestamp(),a=new Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Hi?Hi:this;for(var u=0;u<a.length;u++)a[u]=arguments[u];var g=!1;if(t.serialize&&(Lp(a,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let v=kO(this,n,a,s,t);if(t.reportCaller&&v&&v.length>0&&v[0]&&typeof v[0]=="object")try{let E=vA();E&&(v[0].caller=E)}catch{}o.call(c,...v)}else{if(t.reportCaller)try{let v=vA();v&&a.push(v)}catch{}o.apply(c,a)}if(t.transmit){let v=t.transmit.level||e._level,E=Mr(v,r),y=Mr(n,r);if(y<E)return;OO(this,{ts:s,methodLevel:n,methodValue:y,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Mr(e._level,r)},a,g)}}}(e[Mp][n])}function kO(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?gA(a.shift(),a):void 0}else typeof c=="string"&&(c=gA(a.shift(),a));return c!==void 0&&(u[o.messageKey]=c),[s(u)]}}function Lp(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 OO(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||Lp(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=Dp(u)}function Dp(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function yA(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 PO(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?SA:AA}function gu(){return{}}function Np(e){return e}function _o(){}function SA(){return!1}function AA(){return Date.now()}function NO(){return Math.round(Date.now()/1e3)}function FO(){return new Date(Date.now()).toISOString()}function DO(){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)||{}}}hu.exports.default=gr;hu.exports.pino=gr;function vA(){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 sP={};Ki(sP,{ResultTemplatesHelpers:()=>$h,buildCaseAssistEngine:()=>RA,buildCaseField:()=>GA,buildCaseInput:()=>BA,buildController:()=>tr,buildDocumentSuggestion:()=>qp,buildDocumentSuggestionList:()=>qp,buildInteractiveResult:()=>QA,buildQuickview:()=>KA,getAnalyticsNextApiBaseUrl:()=>rs,getOrganizationEndpoint:()=>ot,loadCaseAssistAnalyticsActions:()=>rP,loadCaseFieldActions:()=>nP,loadCaseInputActions:()=>oP,loadDocumentSuggestionActions:()=>iP,loadGenericAnalyticsActions:()=>tP});module.exports=ab(sP);m();d();f();p();m();d();f();p();var bf=Pt(mf(),1);m();d();f();p();var wt=new Error("Failed to load reducers."),Nn=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 gf(e){return Array.isArray(e)}function hf(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}var ew=new Set(["1",1,"yes",!0]);function Bu(){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=>ew.has(r))}function yf(e){let t={};for(let[r,n]of e)t[r]=n;return t}function Uo(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function ts(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 vf(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function Sf(e){return typeof e!="object"||!e?!1:Object.values(e).every(tw)}function tw(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Af(e){return e===429}var yr=class e{static call(t){return _asyncToGenerator(function*(){let r=rw(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(Af(c.status))throw c;return c});return function a(){return _ref.apply(this,arguments)}}();try{let c=yield(0,bf.backOff)(a,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(u){let g=u&&Af(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 Nn;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=Uo(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 Fn(e,t,r="prod"){return e??ot(t,r)}function Dn(e,t="prod"){return`${ot(e,t)}/rest/search/v2`}function rs(e,t="prod"){return`${ot(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function rw(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:s}=e,a=e.method==="POST"||e.method==="PUT",c=nw(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(a&&{body:c}),signal:s}}function nw(e,t){return t==="application/x-www-form-urlencoded"?Sf(e)?vf(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();function ow(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 $u(r)}var $u=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 tw(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 Mn(e){return e===void 0}function rw(e){return e===null}function ce(e){return Mn(e)||rw(e)}var je=class{constructor(e={}){oe(this,"value");this.value=new Vr(e)}validate(e){let t=this.value.validate(e);return t||(nw(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function nw(e){return Mn(e)||bf(e)}function bf(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||(ow(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 ow(e){return Mn(e)||wf(e)}function wf(e){return typeof e=="number"&&!Number.isNaN(e)}var iw=/^\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(Mn(e))return null;if(!Cf(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&&!(iw.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 Cf(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(Mn(e))return this.config.options.required?"value is required and is currently undefined":null;if(!xf(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 xf(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 bf(e)||Cf(e)||wf(e)||xf(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Ef(e){return Array.isArray(e)}var Qu=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:Mn(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 rs=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();var Ln=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 Hu(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var zu=e=>{let{response:t}=e;return t.body?sw(e):aw(t)},sw=e=>uw(e)?lw(e):cw(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},aw=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function cw(e){return e.body.statusCode!==void 0}function uw(e){return e.body.exception!==void 0}var lw=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();function If(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var Wu=(e,t,r,n)=>{let o=new Ln(`${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 Rf=(e,t)=>{let r=new Ln(`${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},Ku=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield yr.call({...Wu(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Hu(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=If(r),o=yield r.arrayBuffer(),s=new TextDecoder(n).decode(o);return dw(s)?{success:s}:{error:zu({response:r,body:s})}});return function Ku(_x3,_x4){return _ref3.apply(this,arguments)}}();function dw(e){return typeof e=="string"}m();d();f();p();function pw(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function fw(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function ns(e,t){if(t&&e.name==="AbortError")return{error:fw(e)};if(e instanceof Ur)return{error:pw(e)};throw e}m();d();f();p();m();d();f();p();var os=(e,t,r,n,o={})=>{mw(e);let i=`${e.url}/rest/organizations/${e.organizationId}/caseassists/${e.caseAssistId}${n}`,s=gw(o),a=s?`${i}?${s}`:i;return{accessToken:e.accessToken,method:t,contentType:r,url:a,origin:"caseAssistApiFetch"}},is=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r],t),{}),ss=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r].value,t),{}),mw=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.")},gw=e=>Object.keys(e).map(t=>`${t}=${encodeURIComponent(e[t])}`).join("&");var Tf=e=>{let t=e.debug?{debug:"1"}:{};return{...os(e,"POST","application/json","/classify",t),requestParams:hw(e)}},hw=e=>({clientId:e.clientId,locale:e.locale,fields:is(e.fields)});m();d();f();p();var _f=e=>{let t={};return e.debug&&(t.debug="1"),e.numberOfResults&&(t.numberOfResults=e.numberOfResults.toString()),{...os(e,"POST","application/json","/documents/suggest",t),requestParams:yw(e)}},yw=e=>({clientId:e.clientId,locale:e.locale,fields:is(e.fields),context:e.context,analytics:e.analytics});var as=class{constructor(t){oe(this,"options",t)}getCaseClassifications(t){var _this=this;return _asyncToGenerator(function*(){let r=yield yr.call({...Tf(t),..._this.options});if(r instanceof Error)return ns(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({..._f(t),..._this2.options});if(r instanceof Error)return ns(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this3=this;return _asyncToGenerator(function*(){return Ku(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 vw=typeof Symbol=="function"&&Symbol.observable||"@@observable",kf=vw,Yu=()=>Math.random().toString(36).substring(7).split("").join("."),Sw={INIT:`@@redux/INIT${Yu()}`,REPLACE:`@@redux/REPLACE${Yu()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Yu()}`},cs=Sw;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 Xu(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(Xu)(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((w,I)=>{s.set(I,w)}))}function g(){if(c)throw new Error(Xe(3));return o}function v(w){if(typeof w!="function")throw new Error(Xe(4));if(c)throw new Error(Xe(5));let I=!0;u();let T=a++;return s.set(T,w),function(){if(I){if(c)throw new Error(Xe(6));I=!1,u(),s.delete(T),i=null}}}function E(w){if(!Vt(w))throw new Error(Xe(7));if(typeof w.type>"u")throw new Error(Xe(8));if(typeof w.type!="string")throw new Error(Xe(17));if(c)throw new Error(Xe(9));try{c=!0,o=n(o,w)}finally{c=!1}return(i=s).forEach(T=>{T()}),w}function y(w){if(typeof w!="function")throw new Error(Xe(10));n=w,E({type:cs.REPLACE})}function h(){let w=v;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(Xe(11));function T(){let k=I;k.next&&k.next(g())}return T(),{unsubscribe:w(T)}},[kf](){return this}}}return E({type:cs.INIT}),{dispatch:E,subscribe:v,getState:g,replaceReducer:y,[kf]:h}}function Aw(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:cs.INIT})>"u")throw new Error(Xe(12));if(typeof r(void 0,{type:cs.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Xe(13))})}function jn(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{Aw(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 E=n[v],y=r[E],h=a[E],S=y(h,c);if(typeof S>"u"){let w=c&&c.type;throw new Error(Xe(14))}g[E]=S,u=u||S!==h}return u=u||n.length!==Object.keys(a).length,u?g:a}}function Vo(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Of(...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=Vo(...a)(o.dispatch),{...o,dispatch:i}}}function Go(e){return Vt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var sl=Symbol.for("immer-nothing"),Bo=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,Br=ht.getPrototypeOf,$o="constructor",Ko="prototype",el="configurable",ps="enumerable",ls="writable",Qo="value",ct=e=>!!e&&!!e[$e];function it(e){return e?qf(e)||Xo(e)||!!e[Bo]||!!e[$o]?.[Bo]||Zo(e)||Jo(e):!1}var bw=ht[Ko][$o].toString(),Pf=new WeakMap;function qf(e){if(!e||!Un(e))return!1;let t=Br(e);if(t===null||t===ht[Ko])return!0;let r=ht.hasOwnProperty.call(t,$o)&&t[$o];if(r===Object)return!0;if(!Gr(r))return!1;let n=Pf.get(r);return n===void 0&&(n=Function.toString.call(r),Pf.set(r,n)),n===bw}function Uf(e){return ct(e)||Ze(15,e),e[$e].base_}function Yo(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_:Xo(e)?1:Zo(e)?2:Jo(e)?3:0}var qn=(e,t,r=$r(e))=>r===2?e.has(t):ht[Ko].hasOwnProperty.call(e,t),nr=(e,t,r=$r(e))=>r===2?e.get(t):e[t],fs=(e,t,r,n=$r(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function ww(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Xo=Array.isArray,Zo=e=>e instanceof Map,Jo=e=>e instanceof Set,Un=e=>typeof e=="object",Gr=e=>typeof e=="function",Zu=e=>typeof e=="boolean";function Cw(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var xw=e=>Un(e)?e?.[$e]:null,or=e=>e.copy_||e.base_;var al=e=>e.modified_?e.copy_:e.base_;function tl(e,t){if(Zo(e))return new Map(e);if(Jo(e))return new Set(e);if(Xo(e))return Array[Ko].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[ls]===!1&&(a[ls]=!0,a[el]=!0),(a.get||a.set)&&(n[s]={[el]:!0,[ls]:!0,[ps]:a[ps],[Qo]:e[s]})}return ht.create(Br(e),n)}else{let n=Br(e);if(n!==null&&r)return{...e};let o=ht.create(n);return ht.assign(o,e)}}function cl(e,t=!1){return Ss(e)||ct(e)||!it(e)||($r(e)>1&&ht.defineProperties(e,{set:us,add:us,clear:us,delete:us}),ht.freeze(e),t&&Yo(e,(r,n)=>{cl(n,!0)},!1)),e}function Ew(){Ze(2)}var us={[Qo]:Ew};function Ss(e){return e===null||!Un(e)?!0:ht.isFrozen(e)}var ms="MapSet",gs="Patches",Nf="ArrayMethods",hs={};function Qr(e){let t=hs[e];return t||Ze(0,e),t}var Ff=e=>!!hs[e];function Iw(e,t){hs[e]||(hs[e]=t)}var Ho,Vf=()=>Ho,Rw=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Ff(ms)?Qr(ms):void 0,arrayMethodsPlugin_:Ff(Nf)?Qr(Nf):void 0});function Df(e,t){t&&(e.patchPlugin_=Qr(gs),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function rl(e){nl(e),e.drafts_.forEach(Tw),e.drafts_=null}function nl(e){e===Ho&&(Ho=e.parent_)}var Mf=e=>Ho=Rw(Ho,e);function Tw(e){let t=e[$e];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Lf(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[$e].modified_&&(rl(t),Ze(4)),it(e)&&(e=jf(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[$e].base_,e,t)}else e=jf(t,r);return _w(t,e,!0),rl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==sl?e:void 0}function jf(e,t){if(Ss(t))return t;let r=t[$e];if(!r)return ys(t,e.handledSet_,e);if(!As(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);$f(r,e)}return r.copy_}function _w(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&cl(t,r)}function Gf(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var As=(e,t)=>e.scope_===t,kw=[];function Bf(e,t,r,n){let o=or(e),i=e.type_;if(n!==void 0&&nr(o,n,i)===t){fs(o,n,r,i);return}if(!e.draftLocations_){let a=e.draftLocations_=new Map;Yo(o,(c,u)=>{if(ct(u)){let g=a.get(u)||[];g.push(c),a.set(u,g)}})}let s=e.draftLocations_.get(t)??kw;for(let a of s)fs(o,a,r,i)}function Ow(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!As(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let s=al(i);Bf(e,i.draft_??i,s,r),$f(i,o)})}function $f(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)}Gf(e)}}function Pw(e,t,r){let{scope_:n}=e;if(ct(r)){let o=r[$e];As(o,n)&&o.callbacks_.push(function(){ds(e);let s=al(o);Bf(e,r,s,t)})}else it(r)&&e.callbacks_.push(function(){let i=or(e);e.type_===3?i.has(r)&&ys(r,n.handledSet_,n):nr(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&ys(nr(e.copy_,t,e.type_),n.handledSet_,n)})}function ys(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||ct(e)||t.has(e)||!it(e)||Ss(e)||(t.add(e),Yo(e,(n,o)=>{if(ct(o)){let i=o[$e];if(As(i,r)){let s=al(i);fs(e,n,s,e.type_),Gf(i)}}else it(o)&&ys(o,t,r)})),e}function Nw(e,t){let r=Xo(e),n={type_:r?1:0,scope_:t?t.scope_:Vf(),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=vs;r&&(o=[n],i=zo);let{revoke:s,proxy:a}=Proxy.revocable(o,i);return n.draft_=a,n.revoke_=s,[a,n]}var vs={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(!qn(o,t,e.type_))return Dw(e,o,t);let i=o[t];if(e.finalized_||!it(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Cw(t))return i;if(i===Ju(e.base_,t)||Fw(e,t,i)){ds(e);let s=e.type_===1?+t:t,a=il(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=Qf(or(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Ju(or(e),t),i=o?.[$e];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(ww(r,o)&&(r!==void 0||qn(e.base_,t,e.type_)))return!0;ds(e),ol(e)}return e.copy_[t]===r&&(r!==void 0||qn(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Pw(e,t,r)),!0},deleteProperty(e,t){return ds(e),Ju(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),ol(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&&{[ls]:!0,[el]:e.type_!==1||t!=="length",[ps]:n[ps],[Qo]:r[t]}},defineProperty(){Ze(11)},getPrototypeOf(e){return Br(e.base_)},setPrototypeOf(){Ze(12)}},zo={};for(let e in vs){let t=vs[e];zo[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}zo.deleteProperty=function(e,t){return zo.set.call(this,e,t,void 0)};zo.set=function(e,t,r){return vs.set.call(this,e[0],t,r,e[0])};function Ju(e,t){let r=e[$e];return(r?or(r):e)[t]}function Fw(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!it(r)||r[$e]?!1:e.baseRefs_.has(r)}function Dw(e,t,r){let n=Qf(t,r);return n?Qo in n?n[Qo]:n.get?.call(e.draft_):void 0}function Qf(e,t){if(!(t in e))return;let r=Br(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Br(r)}}function ol(e){e.modified_||(e.modified_=!0,e.parent_&&ol(e.parent_))}function ds(e){e.copy_||(e.assigned_=new Map,e.copy_=tl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Mw=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Gr(t)&&!Gr(r)){let i=r;r=t;let s=this;return function(c=i,...u){return s.produce(c,g=>r.call(this,g,...u))}}Gr(r)||Ze(6),n!==void 0&&!Gr(n)&&Ze(7);let o;if(it(t)){let i=Mf(this),s=il(i,t,void 0),a=!0;try{o=r(s),a=!1}finally{a?rl(i):nl(i)}return Df(i,n),Lf(o,i)}else if(!t||!Un(t)){if(o=r(t),o===void 0&&(o=t),o===sl&&(o=void 0),this.autoFreeze_&&cl(o,!0),n){let i=[],s=[];Qr(gs).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:s}),n(i,s)}return o}else Ze(1,t)},this.produceWithPatches=(t,r)=>{if(Gr(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]},Zu(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Zu(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Zu(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){it(e)||Ze(8),ct(e)&&(e=bs(e));let t=Mf(this),r=il(t,e,void 0);return r[$e].isManual_=!0,nl(t),r}finishDraft(e,t){let r=e&&e[$e];(!r||!r.isManual_)&&Ze(9);let{scope_:n}=r;return Df(n,t),Lf(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(gs).applyPatches_;return ct(e)?n(e,t):this.produce(e,o=>n(o,t))}};function il(e,t,r,n){let[o,i]=Zo(t)?Qr(ms).proxyMap_(t,r):Jo(t)?Qr(ms).proxySet_(t,r):Nw(t,r);return(r?.scope_??Vf()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?Ow(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 bs(e){return ct(e)||Ze(10,e),Hf(e)}function Hf(e){if(!it(e)||Ss(e))return e;let t=e[$e],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=tl(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=tl(e,!0);return Yo(r,(o,i)=>{fs(r,o,Hf(i))},n),t&&(t.finalized_=!1),r}function zf(){function t(h,S=[]){if(h.key_!==void 0){let w=h.parent_.copy_??h.parent_.base_,I=xw(nr(w,h.key_)),T=nr(w,h.key_);if(T===void 0||T!==h.draft_&&T!==h.base_&&T!==h.copy_||I!=null&&I.base_!==h.base_)return null;let R=h.parent_.type_===3,k;if(R){let _=h.parent_;k=Array.from(_.drafts_.keys()).indexOf(h.key_)}else k=h.key_;if(!(R&&w.size>k||qn(w,k)))return null;S.push(k)}if(h.parent_)return t(h.parent_,S);S.reverse();try{r(h.copy_,S)}catch{return null}return S}function r(h,S){let w=h;for(let I=0;I<S.length-1;I++){let T=S[I];if(w=nr(w,T),!Un(w)||w===null)throw new Error(`Cannot resolve path at '${S.join("/")}'`)}return w}let n="replace",o="add",i="remove";function s(h,S,w){if(h.scope_.processedForPatches_.has(h))return;h.scope_.processedForPatches_.add(h);let{patches_:I,inversePatches_:T}=w;switch(h.type_){case 0:case 2:return c(h,S,I,T);case 1:return a(h,S,I,T);case 3:return u(h,S,I,T)}}function a(h,S,w,I){let{base_:T,assigned_:R}=h,k=h.copy_;k.length<T.length&&([T,k]=[k,T],[w,I]=[I,w]);let _=h.allIndicesReassigned_===!0;for(let F=0;F<T.length;F++){let V=k[F],j=T[F];if((_||R?.get(F.toString()))&&V!==j){let U=V?.[$e];if(U&&U.modified_)continue;let M=S.concat([F]);w.push({op:n,path:M,value:y(V)}),I.push({op:n,path:M,value:y(j)})}}for(let F=T.length;F<k.length;F++){let V=S.concat([F]);w.push({op:o,path:V,value:y(k[F])})}for(let F=k.length-1;T.length<=F;--F){let V=S.concat([F]);I.push({op:i,path:V})}}function c(h,S,w,I){let{base_:T,copy_:R,type_:k}=h;Yo(h.assigned_,(_,F)=>{let V=nr(T,_,k),j=nr(R,_,k),L=F?qn(T,_)?n:o:i;if(V===j&&L===n)return;let U=S.concat(_);w.push(L===i?{op:L,path:U}:{op:L,path:U,value:y(j)}),I.push(L===o?{op:i,path:U}:L===i?{op:o,path:U,value:y(V)}:{op:n,path:U,value:y(V)})})}function u(h,S,w,I){let{base_:T,copy_:R}=h,k=0;T.forEach(_=>{if(!R.has(_)){let F=S.concat([k]);w.push({op:i,path:F,value:_}),I.unshift({op:o,path:F,value:_})}k++}),k=0,R.forEach(_=>{if(!T.has(_)){let F=S.concat([k]);w.push({op:o,path:F,value:_}),I.unshift({op:i,path:F,value:_})}k++})}function g(h,S,w){let{patches_:I,inversePatches_:T}=w;I.push({op:n,path:[],value:S===sl?void 0:S}),T.push({op:n,path:[],value:h})}function v(h,S){return S.forEach(w=>{let{path:I,op:T}=w,R=h;for(let V=0;V<I.length-1;V++){let j=$r(R),L=I[V];typeof L!="string"&&typeof L!="number"&&(L=""+L),(j===0||j===1)&&(L==="__proto__"||L===$o)&&Ze(19),Gr(R)&&L===Ko&&Ze(19),R=nr(R,L),(R===null||!Un(R))&&Ze(18,I.join("/"))}let k=$r(R),_=E(w.value),F=I[I.length-1];switch(T){case n:switch(k){case 2:return R.set(F,_);case 3:Ze(16);default:return R[F]=_}case o:switch(k){case 1:return F==="-"?R.push(_):R.splice(F,0,_);case 2:return R.set(F,_);case 3:return R.add(_);default:return R[F]=_}case i:switch(k){case 1:return R.splice(F,1);case 2:return R.delete(F);case 3:return R.delete(w.value);default:return delete R[F]}default:Ze(17,T)}}),h}function E(h){if(!it(h))return h;if(Xo(h))return h.map(E);if(Zo(h))return new Map(Array.from(h.entries()).map(([w,I])=>[w,E(I)]));if(Jo(h))return new Set(Array.from(h).map(E));let S=Object.create(Br(h));for(let w in h)S[w]=E(h[w]);return qn(h,Bo)&&(S[Bo]=h[Bo]),S}function y(h){return ct(h)?E(h):h}Iw(gs,{applyPatches_:v,generatePatches_:s,generateReplacementPatches_:g,getPath:t})}var Wo=new Mw,Hr=Wo.produce,ul=Wo.produceWithPatches.bind(Wo);var ll=Wo.applyPatches.bind(Wo);m();d();f();p();function Lw(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function jw(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 Wf=e=>Array.isArray(e)?e:[e];function qw(e){let t=Array.isArray(e[0])?e[0]:e;return jw(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Uw(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var Vw=class{constructor(e){this.value=e}deref(){return this.value}},Gw=()=>typeof WeakRef>"u"?Vw:WeakRef,Yf=Gw(),Bw=0,Kf=1;function ws(){return{s:Bw,v:void 0,o:null,p:null}}function $w(e){return e instanceof Yf?e.deref():e}function ei(e,t={}){let r=ws(),{resultEqualityCheck:n}=t,o,i=0;function s(){let a=r,{length:c}=arguments;for(let v=0,E=c;v<E;v++){let y=arguments[v];if(typeof y=="function"||typeof y=="object"&&y!==null){let h=a.o;h===null&&(a.o=h=new WeakMap);let S=h.get(y);S===void 0?(a=ws(),h.set(y,a)):a=S}else{let h=a.p;h===null&&(a.p=h=new Map);let S=h.get(y);S===void 0?(a=ws(),h.set(y,a)):a=S}}let u=a,g;if(a.s===Kf)g=a.v;else if(g=e.apply(null,arguments),i++,n){let v=$w(o);v!=null&&n(v,g)&&(g=v,i!==0&&i--),o=typeof g=="object"&&g!==null||typeof g=="function"?new Yf(g):g}return u.s=Kf,u.v=g,g}return s.clearCache=()=>{r=ws(),s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function Qw(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()),Lw(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);let g={...r,...c},{memoize:v,memoizeOptions:E=[],argsMemoize:y=ei,argsMemoizeOptions:h=[]}=g,S=Wf(E),w=Wf(h),I=qw(o),T=v(function(){return i++,u.apply(null,arguments)},...S),R=!0,k=y(function(){s++;let F=Uw(I,arguments);return a=T.apply(null,F),a},...w);return Object.assign(k,{resultFunc:u,memoizedResultFunc:T,dependencies:I,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>a,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:y})};return Object.assign(n,{withTypes:()=>n}),n}var Ue=Qw(ei);m();d();f();p();function Xf(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var Zf=Xf(),Jf=Xf;var Hw=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Vo:Vo.apply(null,arguments)},BD=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},zw=e=>e&&typeof e.match=="function";function G(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=>Go(n)&&n.type===e,r}var am=class ti extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,ti.prototype)}static get[Symbol.species](){return ti}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new ti(...t[0].concat(this)):new ti(...t.concat(this))}};function em(e){return it(e)?Hr(e,()=>{}):e}function Cs(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function Ww(e){return typeof e=="boolean"}var Kw=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},s=new am;return r&&(Ww(r)?s.push(Zf):s.push(Jf(r.extraArgument))),s},ri="RTK_autoBatch",Bn=()=>e=>({payload:e,meta:{[ri]:!0}}),tm=e=>t=>{setTimeout(t,e)},Yw=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(i),clearTimeout(s),r())},i=e(o),s=setTimeout(o,t)},Xw=(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?Yw(window.requestAnimationFrame,100):tm(10):e.type==="callback"?e.queueNotification:tm(e.timeout),u=()=>{s=!1,i&&(i=!1,a.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let v=()=>o&&g(),E=n.subscribe(v);return a.add(g),()=>{E(),a.delete(g)}},dispatch(g){try{return o=!g?.meta?.[ri],i=!o,i&&(s||(s=!0,c(u))),n.dispatch(g)}finally{o=!0}}})},Zw=e=>function(r){let{autoBatch:n=!0}=r??{},o=new am(e);return n&&o.push(Xw(typeof n=="object"?n:void 0)),o};function cm(e){let t=Kw(),{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=jn(r);else throw new Error(ut(1));let u;typeof n=="function"?u=n(t):u=t();let g=Vo;o&&(g=Hw({trace:!1,...(typeof o=="object"&&o)}));let v=Of(...u),E=Zw(v),y=typeof a=="function"?a(E):E(),h=g(...y);return Xu(c,s,h)}function um(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 Jw(e){return typeof e=="function"}function Qe(e,t){let[r,n,o]=um(t),i;if(Jw(e))i=()=>em(e());else{let a=em(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 y=v(g,c);return y===void 0?g:y}else{if(it(g))return Hr(g,E=>v(E,c));{let E=v(g,c);if(E===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return E}}return g},a)}return s.getInitialState=i,s}var lm=(e,t)=>zw(e)?e.match(t):e(t);function Gt(...e){return t=>e.some(r=>lm(r,t))}function Gn(...e){return t=>e.every(r=>lm(r,t))}function Rs(e,t){if(!e||!e.meta)return!1;let r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function ni(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Ts(...e){return e.length===0?t=>Rs(t,["pending"]):ni(e)?Gt(...e.map(t=>t.pending)):Ts()(e[0])}function Wr(...e){return e.length===0?t=>Rs(t,["rejected"]):ni(e)?Gt(...e.map(t=>t.rejected)):Wr()(e[0])}function oi(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Gn(Wr(...e),t):ni(e)?Gn(Wr(...e),t):oi()(e[0])}function ir(...e){return e.length===0?t=>Rs(t,["fulfilled"]):ni(e)?Gt(...e.map(t=>t.fulfilled)):ir()(e[0])}function _s(...e){return e.length===0?t=>Rs(t,["pending","fulfilled","rejected"]):ni(e)?Gt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):_s()(e[0])}var eC="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",ii=(e=21)=>{let t="",r=e;for(;r--;)t+=eC[Math.random()*64|0];return t},tC=["name","message","stack","code"],dl=class{constructor(e,t){oe(this,"payload");oe(this,"meta");oe(this,"_type");this.payload=e,this.meta=t}},rm=class{constructor(e,t){oe(this,"payload");oe(this,"meta");oe(this,"_type");this.payload=e,this.meta=t}},rC=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of tC)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},nm="External signal was aborted",Ce=(()=>{function e(t,r,n){let o=G(t+"/fulfilled",(c,u,g,v)=>({payload:c,meta:{...(v||{}),arg:g,requestId:u,requestStatus:"fulfilled"}})),i=G(t+"/pending",(c,u,g)=>({payload:void 0,meta:{...(g||{}),arg:u,requestId:c,requestStatus:"pending"}})),s=G(t+"/rejected",(c,u,g,v,E)=>({payload:v,error:(n&&n.serializeError||rC)(c||"Rejected"),meta:{...(E||{}),arg:g,requestId:u,rejectedWithValue:!!v,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function a(c,{signal:u}={}){return(g,v,E)=>{let y=n?.idGenerator?n.idGenerator(c):ii(),h=new l.AbortController,S,w;function I(R){w=R,h.abort()}u&&(u.aborted?I(nm):u.addEventListener("abort",()=>I(nm),{once:!0}));let T=_asyncToGenerator(function*(){let R;try{let _=n?.condition?.(c,{getState:v,extra:E});if(oC(_)&&(_=yield _),_===!1||h.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let F=new Promise((V,j)=>{S=()=>{j({name:"AbortError",message:w||"Aborted"})},h.signal.addEventListener("abort",S,{once:!0})});g(i(y,c,n?.getPendingMeta?.({requestId:y,arg:c},{getState:v,extra:E}))),R=yield Promise.race([F,Promise.resolve(r(c,{dispatch:g,getState:v,extra:E,requestId:y,signal:h.signal,abort:I,rejectWithValue:(V,j)=>new dl(V,j),fulfillWithValue:(V,j)=>new rm(V,j)})).then(V=>{if(V instanceof dl)throw V;return V instanceof rm?o(V.payload,y,c,V.meta):o(V,y,c)})])}catch(_){R=_ instanceof dl?s(null,y,c,_.payload,_.meta):s(_,y,c)}finally{S&&h.signal.removeEventListener("abort",S)}return n&&!n.dispatchConditionRejection&&s.match(R)&&R.meta.condition||g(R),R})();return Object.assign(T,{abort:I,requestId:y,arg:c,unwrap(){return T.then(nC)}})}}return Object.assign(a,{pending:i,rejected:s,fulfilled:o,settled:Gt(s,o),typePrefix:t})}return e.withTypes=()=>e,e})();function nC(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function oC(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var dm=Symbol.for("rtk-slice-createasyncthunk"),QD={[dm]:Ce};function iC(e,t){return`${e}/${t}`}function sC({creators:e}={}){let t=e?.asyncThunk?.[dm];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,k){let _=typeof R=="string"?R:R.type;if(!_)throw new Error(ut(12));if(_ in c.sliceCaseReducersByType)throw new Error(ut(13));return c.sliceCaseReducersByType[_]=k,u},addMatcher(R,k){return c.sliceMatchers.push({matcher:R,reducer:k}),u},exposeAction(R,k){return c.actionCreators[R]=k,u},exposeCaseReducer(R,k){return c.sliceCaseReducersByName[R]=k,u}};a.forEach(R=>{let k=s[R],_={reducerName:R,type:iC(o,R),createNotation:typeof n.reducers=="function"};lC(k)?pC(_,k,u,t):uC(_,k,u)});function g(){let[R={},k=[],_=void 0]=typeof n.extraReducers=="function"?um(n.extraReducers):[n.extraReducers],F={...R,...c.sliceCaseReducersByType};return Qe(n.initialState,V=>{for(let j in F)V.addCase(j,F[j]);for(let j of c.sliceMatchers)V.addMatcher(j.matcher,j.reducer);for(let j of k)V.addMatcher(j.matcher,j.reducer);_&&V.addDefaultCase(_)})}let v=R=>R,E=new Map,y=new WeakMap,h;function S(R,k){return h||(h=g()),h(R,k)}function w(){return h||(h=g()),h.getInitialState()}function I(R,k=!1){function _(V){let j=V[R];return typeof j>"u"&&k&&(j=Cs(y,_,w)),j}function F(V=v){let j=Cs(E,k,()=>new WeakMap);return Cs(j,V,()=>{let L={};for(let[U,M]of Object.entries(n.selectors??{}))L[U]=aC(M,V,()=>Cs(y,V,w),k);return L})}return{reducerPath:R,getSelectors:F,get selectors(){return F(_)},selectSlice:_}}let T={name:o,reducer:S,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:w,...I(i),injectInto(R,{reducerPath:k,..._}={}){let F=k??i;return R.inject({reducerPath:F,reducer:S},_),{...T,...I(F,!0)}}};return T}}function aC(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=sC();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 uC({type:e,reducerName:t,createNotation:r},n,o){let i,s;if("reducer"in n){if(r&&!dC(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?G(e,s):G(e))}function lC(e){return e._reducerDefinitionType==="asyncThunk"}function dC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function pC({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||xs,pending:a||xs,rejected:c||xs,settled:u||xs})}function xs(){}var fC="task",pm="listener",fm="completed",ml="cancelled",mC=`task-${ml}`,gC=`task-${fm}`,pl=`${pm}-${ml}`,hC=`${pm}-${fm}`,ks=class{constructor(e){oe(this,"code");oe(this,"name","TaskAbortError");oe(this,"message");this.code=e,this.message=`${fC} ${ml} (reason: ${e})`}},gl=(e,t)=>{if(typeof e!="function")throw new TypeError(ut(32))},Es=()=>{},mm=(e,t=Es)=>(e.catch(t),e),gm=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),zr=e=>{if(e.aborted)throw new ks(e.reason)};function hm(e,t){let r=Es;return new Promise((n,o)=>{let i=()=>o(new ks(e.reason));if(e.aborted){i();return}r=gm(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=Es})}var yC=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof ks?"cancelled":"rejected",error:r}}finally{t?.()}});return function yC(_x5,_x6){return _ref5.apply(this,arguments)}}(),Is=e=>t=>mm(hm(e,t).then(r=>(zr(e),r))),ym=e=>{let t=Is(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Vn}=Object,om={},Os="listenerMiddleware",vC=(e,t)=>{let r=n=>gm(e,()=>n.abort(e.reason));return(n,o)=>{gl(n,"taskExecutor");let i=new l.AbortController;r(i);let s=yC(/*#__PURE__*/_asyncToGenerator(function*(){zr(e),zr(i.signal);let a=yield n({pause:Is(i.signal),delay:ym(i.signal),signal:i.signal});return zr(i.signal),a}),()=>i.abort(gC));return o?.autoJoin&&t.push(s.catch(Es)),{result:Is(e)(s),cancel(){i.abort(mC)}}}},SC=(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,E)=>{E.unsubscribe(),c([v,E.getState(),E.getOriginalState()])}});i=()=>{g(),u()}})];o!=null&&a.push(new Promise(c=>setTimeout(c,o,null)));try{let c=yield hm(t,Promise.race(a));return zr(t),c}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>mm(r(n,o))},vm=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=G(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 gl(i,"options.listener"),{predicate:o,type:t,effect:i}},Sm=Vn(e=>{let{type:t,predicate:r,effect:n}=vm(e);return{id:ii(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(ut(22))}}},{withTypes:()=>Sm}),im=(e,t)=>{let{type:r,effect:n,predicate:o}=vm(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},fl=e=>{e.pending.forEach(t=>{t.abort(pl)})},AC=(e,t)=>()=>{for(let r of t.keys())fl(r);e.clear()},sm=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Am=Vn(G(`${Os}/add`),{withTypes:()=>Am}),bC=G(`${Os}/removeAll`),bm=Vn(G(`${Os}/remove`),{withTypes:()=>bm}),wC=(...e)=>{console.error(`${Os}/error`,...e)},wm=(e={})=>{let t=new Map,r=new Map,n=y=>{let h=r.get(y)??0;r.set(y,h+1)},o=y=>{let h=r.get(y)??1;h===1?r.delete(y):r.set(y,h-1)},{extra:i,onError:s=wC}=e;gl(s,"onError");let a=y=>(y.unsubscribe=()=>t.delete(y.id),t.set(y.id,y),h=>{y.unsubscribe(),h?.cancelActive&&fl(y)}),c=y=>{let h=im(t,y)??Sm(y);return a(h)};Vn(c,{withTypes:()=>c});let u=y=>{let h=im(t,y);return h&&(h.unsubscribe(),y.cancelActive&&fl(h)),!!h};Vn(u,{withTypes:()=>u});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(y,h,S,w){let I=new l.AbortController,T=SC(c,I.signal),R=[];try{y.pending.add(I),n(y),yield Promise.resolve(y.effect(h,Vn({},S,{getOriginalState:w,condition:(k,_)=>T(k,_).then(Boolean),take:T,delay:ym(I.signal),pause:Is(I.signal),extra:i,signal:I.signal,fork:vC(I.signal,R),unsubscribe:y.unsubscribe,subscribe:()=>{t.set(y.id,y)},cancelActiveListeners:()=>{y.pending.forEach((k,_,F)=>{k!==I&&(k.abort(pl),F.delete(k))})},cancel:()=>{I.abort(pl),y.pending.delete(I)},throwIfCancelled:()=>{zr(I.signal)}})))}catch(k){k instanceof ks||sm(s,k,{raisedBy:"effect"})}finally{yield Promise.all(R),I.abort(hC),o(y),y.pending.delete(I)}});return function g(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),v=AC(t,r);return{middleware:y=>h=>S=>{if(!Go(S))return h(S);if(Am.match(S))return c(S.payload);if(bC.match(S)){v();return}if(bm.match(S))return u(S.payload);let w=y.getState(),I=()=>{if(w===om)throw new Error(ut(23));return w},T;try{if(T=h(S),t.size>0){let R=y.getState(),k=Array.from(t.values());for(let _ of k){let F=!1;try{F=_.predicate(S,R,w)}catch(V){F=!1,sm(s,V,{raisedBy:"predicate"})}F&&g(_,S,y,I)}}}finally{w=om}return T},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}),nM=new re({required:!1,emptyAllowed:!0}),Cm=new Ft({each:ee,required:!0}),xm=new re({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Em=new re({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),oM=new re({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),CC=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),hl=(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 $u(o);return{payload:e}},W=(e,t)=>{try{return hl(e,t)}catch(r){return{payload:e,error:CC(r)}}};var Ps=(e,t,r,n)=>{let o=`Check the options of ${n}`;return xC(e,t,r,o,"Controller initialization error")},xC=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};var Ns=G("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 Im=()=>({caseAssistId:"",locale:"en-US"});var vr=Qe(Im(),e=>{e.addCase(Ns,(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 Rm={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 Fs=G("searchParameters/restore",e=>W(e,Rm)),Tm=G("searchParameters/restoreTab",e=>W(e,ee));m();d();f();p();var _m=G("debug/enable"),km=G("debug/disable");m();d();f();p();var Ds=()=>!1;var Om=Qe(Ds(),e=>{e.addCase(_m,()=>!0).addCase(km,()=>!1).addCase(Fs,(t,r)=>r.payload.debug??t)});m();d();f();p();var Ms=G("searchHub/set",e=>W(e,new re({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var $n="3.55.2",Pm=["@coveo/atomic","@coveo/quantic"];var yl=()=>He,Nm=()=>ee,Qn=G("configuration/updateBasicConfiguration",e=>W(e,{accessToken:He,environment:new re({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:He})),Ls=G("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})})),EC={enabled:new je({default:!0}),originContext:yl(),originLevel2:yl(),originLevel3:yl(),proxyBaseUrl:new re({required:!1,url:!0}),runtimeEnvironment:new Vr,anonymous:new je({default:!1}),deviceId:He,userDisplayName:He,documentLocation:He,trackingId:Em,analyticsMode:new re({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new xe({options:{required:!1},values:Pm.reduce((e,t)=>(e[t]=xm,e),{})})},js=G("configuration/updateAnalyticsConfiguration",e=>W(e,EC)),qs=G("configuration/analytics/disable"),Us=G("configuration/analytics/enable"),Fm=G("configuration/analytics/originlevel2",e=>W(e,{originLevel2:Nm()})),Dm=G("configuration/analytics/originlevel3",e=>W(e,{originLevel3:Nm()})),Mm=G("knowledge/setAgentId",e=>W(e,new re({required:!0})));m();d();f();p();var IC=G("history/undo"),RC=G("history/redo"),Bt=G("history/snapshot"),FL=Ce("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(IC()),yield t(Vs())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),DL=Ce("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(RC()),yield t(Vs())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),Vs=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 Hn=()=>"default";var Lm=Qe(Hn(),e=>{e.addCase(Ms,(t,r)=>r.payload).addCase(Vs.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Ls,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function jm(){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 TC(e){return typeof e=="string"&&qm.test(e)}var vl=TC;m();d();f();p();var Je=[];for(let e=0;e<256;++e)Je.push((e+256).toString(16).slice(1));function Um(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 Sl(){return crypto.getRandomValues(_C)}m();d();f();p();function kC(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():OC(e,t,r)}function OC(e,t,r){e=e||{};let n=e.random??e.rng?.()??Sl();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 Um(n)}var Al=kC;function PC(_x17){return _PC.apply(this,arguments)}function _PC(){_PC=_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 _PC.apply(this,arguments)}var Hm="2.1.3",bl=128,zm=192,Vm=224,Gm=240,NC=248;function FC(e){return(e&NC)===Gm?4:(e&Gm)===Vm?3:(e&Vm)===zm?2:1}function DC(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&bl)!=bl)break;if(r-=3,(n&zm)!=bl){t-r>=FC(n)*3&&(r=t);break}}return e.substring(0,r)}function MC(e){let{trackingId:t}=e;return{trackingId:t}}function LC(e){return(e.source||[]).concat([`relay@${Hm}`])}function Wm(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,s=MC(t),a=r.getClientId();return Object.freeze({type:e,config:s,ts:Date.now(),source:LC(t),clientId:a,userAgent:i(),referrer:Bm(n()),location:Bm(o())})}function Bm(e){return e!==null?DC(e,1024):null}function jC(e,t,r,n){return{...t,meta:Wm(e,r,n)}}var qC="*";function UC(){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===qC)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 $m({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 VC(e){let t=$m(e);return{get:()=>t,update:r=>{t=$m({...t,...r})}}}var wl=GC();function GC(){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 BC(){return{getItem(e){return wl.getItem(e)||localStorage.getItem(e)},removeItem(e){wl.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),wl.setItem(e,t,31556952e3)}}}var Qm="visitorId";function $C(){let e=document.referrer;return e===""?null:e}function Cl(){let e=BC();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}`}});jm().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:()=>$C(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(Qm);if(t&&vl(t))return t;let r=Al();return e.setItem(Qm,r),r}}}function QC(){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 HC(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function zC(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=HC();return t&&r?{...r,runtime:"custom"}:t&&WC()&&QC()?Cl():n}function WC(){try{return typeof window=="object"}catch{return!1}}function KC(e){return{get:()=>Object.freeze(zC(e))}}function Km(e){let t=VC(e),r=UC(),n=KC(t);return{emit:function(){var _ref11=_asyncToGenerator(function*(o,i){let s=t.get(),a=n.get(),c=jC(o,i,s,a);return PC({config:s,environment:a,event:c,listenerManager:r})});return function emit(_x21,_x22){return _ref11.apply(this,arguments)}}(),getMeta:o=>Wm(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:Hm}}m();d();f();p();function Ym(){return typeof window<"u"&&typeof document<"u"}m();d();f();p();var zn=Ue(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${$n}`));var si=Ue(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>zn(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},s,a)=>{let c=XC(a);return Km({mode:i?"emit":"disabled",url:o??ts(e,t),token:r,trackingId:n??null,source:s,environment:c})}),YC={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref12=_asyncToGenerator(function*(){});return function send(){return _ref12.apply(this,arguments)}}()},XC=e=>{if(!e)return;let t=e();return{...(Ym()?Cl():YC),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 Xm=class extends Error{constructor(t){super(t[0].message);oe(this,"issues");this.name="SchemaError",this.issues=t}};var ar="uninitialized",Il="pending",ci="fulfilled",ui="rejected";function Zm(e){return{status:e,isUninitialized:e===ar,isLoading:e===Il,isSuccess:e===ci,isError:e===ui}}var Jm=Vt;function fg(e,t){if(e===t||!(Jm(e)&&Jm(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]=fg(e[s],t[s]),o&&(o=e[s]===i[s]);return o?e:i}function Rl(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function ZC(e){return new RegExp("(^|:)//").test(e)}function JC(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Ol(e){return e!=null}function eg(e){return[...(e?.values()??[])].filter(Ol)}function ex(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var tx=e=>e.replace(/\/$/,""),rx=e=>e.replace(/^\//,"");function nx(e,t){if(!e)return t;if(!t)return e;if(ZC(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=tx(e),t=rx(t),`${e}${r}${t}`}function $s(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var Tl=()=>new Map,ox=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},ix=(...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},tg=(...e)=>C(...e),sx=e=>e.status>=200&&e.status<=299,ax=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function rg(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 cx=e=>typeof e=="object"&&(Vt(e)||Array.isArray(e)||typeof e.toJSON=="function");function mg({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=tg,paramsSerializer:n,isJsonContentType:o=ax,jsonContentType:i="application/json",jsonReplacer:s,timeout:a,responseHandler:c,validateStatus:u,...g}={}){return typeof C>"u"&&r===tg&&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*(E,y,h){let{getState:S,extra:w,endpoint:I,forced:T,type:R}=y,k,{url:_,headers:F=new x(g.headers),params:V=void 0,responseHandler:j=c??"json",validateStatus:L=u??sx,timeout:U=a,...M}=typeof E=="string"?{url:E}:E,O={...g,signal:U?ix(y.signal,ox(U)):y.signal,...M};F=new x(rg(F)),O.headers=(yield t(F,{getState:S,arg:E,extra:w,endpoint:I,forced:T,type:R,extraOptions:h}))||F;let P=cx(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")||(j==="json"?O.headers.set("accept","application/json"):j==="text"&&O.headers.set("accept","text/plain, text/html, */*")),V){let J=~_.indexOf("?")?"&":"?",se=n?n(V):new URLSearchParams(rg(V));_+=J+se}_=nx(e,_);let N=new Request(_,O);k={request:new Request(_,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:k}}let Y=$.clone();k.response=Y;let K,H="";try{let J;if(yield Promise.all([v($,j).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:k}}return L($,K)?{data:K,meta:k}:{error:{status:$.status,data:K},meta:k}});return function(_x23,_x24,_x25){return _ref13.apply(this,arguments)}}());function v(_x26,_x27){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(E,y){if(typeof y=="function")return y(E);if(y==="content-type"&&(y=o(E.headers)?"json":"text"),y==="json"){let h=yield E.text();return h.length?JSON.parse(h):null}return E.text()});return _v2.apply(this,arguments)}}var Wn=class{constructor(e,t=void 0){oe(this,"value");oe(this,"meta");this.value=e,this.meta=t}};function ux(){return _ux.apply(this,arguments)}function _ux(){_ux=_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 _ux.apply(this,arguments)}function gg(e,t){throw Object.assign(new Wn({error:e,meta:t}),{throwImmediately:!0})}function xl(e){e.aborted&&gg({status:"CUSTOM_ERROR",error:"Aborted"})}var ng={},lx=(e,t)=>(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(r,n,o){let i=[5,(t||ng).maxRetries,(o||ng).maxRetries].filter(g=>g!==void 0),[s]=i.slice(-1),c={maxRetries:s,backoff:ux,retryCondition:(g,v,{attempt:E})=>E<=s,...t,...o},u=0;for(;;){xl(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Wn(g);return g}catch(g){if(u++,g.throwImmediately){if(g instanceof Wn)return g.value;throw g}if(g instanceof Wn){if(!c.retryCondition(g.value.error,r,{attempt:u,baseQueryApi:n,extraOptions:o}))return g.value}else if(u>c.maxRetries)return{error:g};xl(n.signal);try{yield c.backoff(u,c.maxRetries,n.signal)}catch(v){throw xl(n.signal),v}}}});return function(_x28,_x29,_x30){return _ref14.apply(this,arguments)}}()),hg=Object.assign(lx,{fail:gg}),Hs="__rtkq/",dx="online",px="offline";var yg="focused";var Pl=G(`${Hs}${yg}`),vg=G(`${Hs}un${yg}`),Nl=G(`${Hs}${dx}`),Sg=G(`${Hs}${px}`);var pi="query",Ag="mutation",bg="infinitequery";function zs(e){return e.type===pi}function fx(e){return e.type===Ag}function Ws(e){return e.type===bg}function Qs(e){return zs(e)||Ws(e)}function Fl(e,t,r,n,o,i){let s=mx(e)?e(t,r,n,o):e;return s?Rl(s,Ol,a=>i(wg(a))):[]}function mx(e){return typeof e=="function"}function wg(e){return typeof e=="string"?{type:e}:e}function gx(e,t){return e.catch(t)}var Kn=(e,t)=>e.endpointDefinitions[t],li=Symbol("forceQueryFn"),_l=e=>typeof e[li]=="function";function hx({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:s}){let a=_=>s(_)?.runningQueries,c=_=>s(_)?.runningMutations,{unsubscribeQueryResult:u,removeMutationResult:g,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:T,buildInitiateInfiniteQuery:R,buildInitiateMutation:k,getRunningQueryThunk:E,getRunningMutationThunk:y,getRunningQueriesThunk:h,getRunningMutationsThunk:S};function E(_,F){return V=>{let j=Kn(i,_),L=e({queryArgs:F,endpointDefinition:j,endpointName:_});return a(V)?.get(L)}}function y(_,F){return V=>c(V)?.get(F)}function h(){return _=>eg(a(_))}function S(){return _=>eg(c(_))}function w(_){}function I(_,F){let V=(j,{subscribe:L=!0,forceRefetch:U,subscriptionOptions:M,[li]:O,...P}={})=>(N,Q)=>{let $=e({queryArgs:j,endpointDefinition:F,endpointName:_}),Y,K={...P,type:pi,subscribe:L,forceRefetch:U,subscriptionOptions:M,endpointName:_,originalArgs:j,queryCacheKey:$,[li]: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[_].select(j),J=N(Y),se=H(Q());let{requestId:be,abort:Ne}=J,Ie=se.requestId!==be,_e=a(N)?.get($),ke=()=>H(Q()),pe=Object.assign(O?J.then(ke):Ie&&!_e?Promise.resolve(se):Promise.all([_e,J]).then(ke),{arg:j,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(j,{subscribe:!1,forceRefetch:!0,...de})),unsubscribe(){L&&N(u({queryCacheKey:$,requestId:be}))},updateSubscriptionOptions(de){pe.subscriptionOptions=de,N(v({endpointName:_,requestId:be,queryCacheKey:$,options:de}))}});if(!_e&&!Ie&&!O){let de=a(N);de.set($,pe),pe.then(()=>{de.delete($)})}return pe};return V}function T(_,F){return I(_,F)}function R(_,F){return I(_,F)}function k(_){return(F,{track:V=!0,fixedCacheKey:j}={})=>(L,U)=>{let M=n({type:"mutation",endpointName:_,originalArgs:F,track:V,fixedCacheKey:j}),O=L(M);let{requestId:P,abort:N,unwrap:Q}=O,$=gx(O.unwrap().then(J=>({data:J})),J=>({error:J})),Y=()=>{L(g({requestId:P,fixedCacheKey:j}))},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)}),j&&(H.set(j,K),K.then(()=>{H.get(j)===K&&H.delete(j)})),K}}}var Cg=class extends Xm{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 Cg(o.issues,t,r,n);return o.value});return _Xr.apply(this,arguments)}function og(e){return e}var ai=(e={})=>({...e,[ri]:!0});function yx({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=Fl(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 E(M,O,P=0){let N=[...M,O];return P&&N.length>P?N.slice(1):N}let y=(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]=ul(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},h=(M,O,P)=>N=>N(o.endpoints[M].initiate(O,{subscribe:!1,forceRefetch:!0,[li]:()=>({data:P})})),S=(M,O)=>M.query&&M[O]?M[O]:og,w=/*#__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===pi;try{let Ne=og,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},_e=be?M[li]:void 0,ke,pe=/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(he,fe,Ge,ze){if(fe==null&&he.pages.length)return Promise.resolve({data:he});let kt={queryArg:M.originalArgs,pageParam:fe},gt=yield de(kt),Ut=ze?v:E;return{data:{pages:Ut(he.pages,gt.data,Ge),pageParams:Ut(he.pageParams,fe,Ge)},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:Ge,argSchema:ze,rawResponseSchema:kt,responseSchema:gt}=H;if(ze&&!Yr(se,"arg")&&(he=yield Xr(ze,he,"argSchema",{})),_e?fe=_e():H.query?(Ne=S(H,"transformResponse"),fe=yield t(H.query(he),Ie,Ge)):fe=yield H.queryFn(he,Ie,Ge,Ot=>t(Ot,Ie,Ge)),typeof process<"u",fe.error)throw new Wn(fe.error,fe.meta);let{data:Ut}=fe;kt&&!Yr(se,"rawResponse")&&(Ut=yield Xr(kt,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,Ge=M.refetchCachedPages??he.refetchCachedPages??!0,ze,kt={pages:[],pageParams:[]},gt=s.selectQueryEntry(Y(),M.queryCacheKey)?.data,bt=I(M,Y())&&!M.direction||!gt?kt:gt;if("direction"in M&&M.direction&&bt.pages.length){let Ot=M.direction==="backward",zi=(Ot?xg:kl)(he,bt,M.originalArgs);ze=yield pe(bt,zi,fe,Ot)}else{let{initialPageParam:Ot=he.initialPageParam}=M,No=gt?.pageParams??[],zi=No[0]??Ot,YA=No.length;if(ze=yield pe(bt,zi,fe),_e&&(ze={data:ze.data.pages[0]}),Ge)for(let Bp=1;Bp<YA;Bp++){let XA=kl(he,ze.data,M.originalArgs);ze=yield pe(ze.data,XA,fe)}}ke=ze}else ke=yield de(M.originalArgs);return J&&!Yr(se,"meta")&&ke.meta&&(ke.meta=yield Xr(J,ke.meta,"metaSchema",ke.meta)),Q(ke.data,ai({fulfilledTimeStamp:Date.now(),baseQueryMeta:ke.meta}))}catch(Ne){let Ie=Ne;if(Ie instanceof Wn){let _e=S(H,"transformErrorResponse"),{rawErrorResponseSchema:ke,errorResponseSchema:pe}=H,{value:de,meta:he}=Ie;try{ke&&!Yr(se,"rawErrorResponse")&&(de=yield Xr(ke,de,"rawErrorResponseSchema",he)),J&&!Yr(se,"meta")&&(he=yield Xr(J,he,"metaSchema",he));let fe=yield _e(de,he,M.originalArgs);return pe&&!Yr(se,"errorResponse")&&(fe=yield Xr(pe,fe,"errorResponseSchema",he)),N(fe,ai({baseQueryMeta:he}))}catch(fe){Ie=fe}}try{if(Ie instanceof Cg){let _e={endpoint:M.endpointName,arg:M.originalArgs,type:M.type,queryCacheKey:be?M.queryCacheKey:void 0};H.onSchemaFailure?.(Ie,_e),a?.(Ie,_e);let{catchSchemaFailure:ke=c}=H;if(ke)return N(ke(Ie,_e),ai({baseQueryMeta:Ie._bqMeta}))}}catch(_e){Ie=_e}throw typeof process<"u",console.error(Ie),Ie}});return function w(_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 T=()=>Ce(`${e}/executeQuery`,w,{getPendingMeta({arg:O}){let P=r[O.endpointName];return ai({startedTimeStamp:Date.now(),...(Ws(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 _l(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=T(),_=Ce(`${e}/executeMutation`,w,{getPendingMeta(){return ai({startedTimeStamp:Date.now()})}}),F=M=>"force"in M,V=M=>"ifOlderThan"in M,j=(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 U(M,O){return{matchPending:Gn(Ts(M),L(O)),matchFulfilled:Gn(ir(M),L(O)),matchRejected:Gn(Wr(M),L(O))}}return{queryThunk:R,mutationThunk:_,infiniteQueryThunk:k,prefetch:j,updateQueryData:y,upsertQueryData:h,patchQueryData:g,buildMatchThunkActions:U}}function kl(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function xg(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function Eg(e,t,r,n){return Fl(r[e.meta.arg.endpointName][t],ir(e)?e.payload:void 0,oi(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function ig(e){return ct(e)?bs(e):e}function Gs(e,t,r){let n=e[t];n&&r(n)}function di(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function sg(e,t,r){let n=e[di(t)];n&&r(n)}var Bs={};function vx({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:s,hasRehydrationInfo:a},assertTagType:c,config:u}){let g=G(`${e}/resetApiState`);function v(L,U,M,O){var P;L[P=U.queryCacheKey]??(L[P]={status:ar,endpointName:U.endpointName}),Gs(L,U.queryCacheKey,N=>{N.status=Il,N.requestId=M&&N.requestId?N.requestId:O.requestId,U.originalArgs!==void 0&&(N.originalArgs=U.originalArgs),N.startedTimeStamp=O.startedTimeStamp;let Q=o[O.arg.endpointName];Ws(Q)&&"direction"in U&&(N.direction=U.direction)})}function E(L,U,M,O){Gs(L,U.arg.queryCacheKey,P=>{if(P.requestId!==U.requestId&&!O)return;let{merge:N}=o[U.arg.endpointName];if(P.status=ci,N){if(P.data!==void 0){let{fulfilledTimeStamp:Q,arg:$,baseQueryMeta:Y,requestId:K}=U,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[U.arg.endpointName].structuralSharing??!0?fg(ct(P.data)?Uf(P.data):P.data,M):M;delete P.error,P.fulfilledTimeStamp=U.fulfilledTimeStamp})}let y=Kr({name:`${e}/queries`,initialState:Bs,reducers:{removeQueryResult:{reducer(L,{payload:{queryCacheKey:U}}){delete L[U]},prepare:Bn()},cacheEntriesUpserted:{reducer(L,U){for(let M of U.payload){let{queryDescription:O,value:P}=M;v(L,O,!0,{arg:O,requestId:U.meta.requestId,startedTimeStamp:U.meta.timestamp}),E(L,{arg:O,requestId:U.meta.requestId,fulfilledTimeStamp:U.meta.timestamp,baseQueryMeta:{}},P,!0)}},prepare:L=>({payload:L.map(O=>{let{endpointName:P,arg:N,value:Q}=O,$=o[P];return{queryDescription:{type:pi,endpointName:P,originalArgs:O.arg,queryCacheKey:n({queryArgs:N,endpointDefinition:$,endpointName:P})},value:Q}}),meta:{[ri]:!0,requestId:ii(),timestamp:Date.now()}})},queryResultPatched:{reducer(L,{payload:{queryCacheKey:U,patches:M}}){Gs(L,U,O=>{O.data=ll(O.data,M.concat())})},prepare:Bn()}},extraReducers(L){L.addCase(t.pending,(U,{meta:M,meta:{arg:O}})=>{let P=_l(O);v(U,O,P,M)}).addCase(t.fulfilled,(U,{meta:M,payload:O})=>{let P=_l(M.arg);E(U,M,O,P)}).addCase(t.rejected,(U,{meta:{condition:M,arg:O,requestId:P},error:N,payload:Q})=>{Gs(U,O.queryCacheKey,$=>{if(!M){if($.requestId!==P)return;$.status=ui,$.error=Q??N}})}).addMatcher(a,(U,M)=>{let{queries:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===ci||N?.status===ui)&&(U[P]=N)})}}),h=Kr({name:`${e}/mutations`,initialState:Bs,reducers:{removeMutationResult:{reducer(L,{payload:U}){let M=di(U);M in L&&delete L[M]},prepare:Bn()}},extraReducers(L){L.addCase(r.pending,(U,{meta:M,meta:{requestId:O,arg:P,startedTimeStamp:N}})=>{P.track&&(U[di(M)]={requestId:O,status:Il,endpointName:P.endpointName,startedTimeStamp:N})}).addCase(r.fulfilled,(U,{payload:M,meta:O})=>{O.arg.track&&sg(U,O,P=>{P.requestId===O.requestId&&(P.status=ci,P.data=M,P.fulfilledTimeStamp=O.fulfilledTimeStamp)})}).addCase(r.rejected,(U,{payload:M,error:O,meta:P})=>{P.arg.track&&sg(U,P,N=>{N.requestId===P.requestId&&(N.status=ui,N.error=M??O)})}).addMatcher(a,(U,M)=>{let{mutations:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===ci||N?.status===ui)&&P!==N?.requestId&&(U[P]=N)})}}),S={tags:{},keys:{}},w=Kr({name:`${e}/invalidation`,initialState:S,reducers:{updateProvidedBy:{reducer(L,U){var M,O,P;for(let{queryCacheKey:N,providedTags:Q}of U.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:Bn()}},extraReducers(L){L.addCase(y.actions.removeQueryResult,(U,{payload:{queryCacheKey:M}})=>{I(U,M)}).addMatcher(a,(U,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=U.tags)[$]??(P[$]={}))[Q=K||"__internal_without_id"]??(N[Q]=[]);for(let se of H)J.includes(se)||J.push(se),U.keys[se]=O.keys[se]}}).addMatcher(Gt(ir(t),oi(t)),(U,M)=>{T(U,[M])}).addMatcher(y.actions.cacheEntriesUpserted.match,(U,M)=>{let O=M.payload.map(({queryDescription:P,value:N})=>({type:"UNKNOWN",payload:N,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:P}}));T(U,O)})}});function I(L,U){let M=ig(L.keys[U]??[]);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]=ig(Q).filter($=>$!==U))}delete L.keys[U]}function T(L,U){let M=U.map(O=>{let P=Eg(O,"providesTags",o,c),{queryCacheKey:N}=O.meta.arg;return{queryCacheKey:N,providedTags:P}});w.caseReducers.updateProvidedBy(L,w.actions.updateProvidedBy(M))}let R=Kr({name:`${e}/subscriptions`,initialState:Bs,reducers:{updateSubscriptionOptions(L,U){},unsubscribeQueryResult(L,U){},internal_getRTKQSubscriptions(){}}}),k=Kr({name:`${e}/internalSubscriptions`,initialState:Bs,reducers:{subscriptionsUpdated:{reducer(L,U){return ll(L,U.payload)},prepare:Bn()}}}),_=Kr({name:`${e}/config`,initialState:{online:ex(),focused:JC(),middlewareRegistered:!1,...u},reducers:{middlewareRegistered(L,{payload:U}){L.middlewareRegistered=L.middlewareRegistered==="conflict"||i!==U?"conflict":!0}},extraReducers:L=>{L.addCase(Nl,U=>{U.online=!0}).addCase(Sg,U=>{U.online=!1}).addCase(Pl,U=>{U.focused=!0}).addCase(vg,U=>{U.focused=!1}).addMatcher(a,U=>({...U}))}}),F=jn({queries:y.reducer,mutations:h.reducer,provided:w.reducer,subscriptions:k.reducer,config:_.reducer}),V=(L,U)=>F(g.match(U)?void 0:L,U),j={..._.actions,...y.actions,...R.actions,...k.actions,...h.actions,...w.actions,resetApiState:g};return{reducer:V,actions:j}}var El=Symbol.for("RTKQ/skipToken"),Ig={status:ar},ag=Hr(Ig,()=>{}),cg=Hr(Ig,()=>{});function Sx({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=R=>ag,o=R=>cg;return{buildQuerySelector:E,buildInfiniteQuerySelector:y,buildMutationSelector:h,selectInvalidatedBy:S,selectCachedArgsForQuery:w,selectApiState:s,selectQueries:a,selectMutations:u,selectQueryEntry:c,selectConfig:g};function i(R){return{...R,...Zm(R.status)}}function s(R){return R[t]}function a(R){return s(R)?.queries}function c(R,k){return a(R)?.[k]}function u(R){return s(R)?.mutations}function g(R){return s(R)?.config}function v(R,k,_){return F=>{if(F===El)return r(n,_);let V=e({queryArgs:F,endpointDefinition:k,endpointName:R});return r(L=>c(L,V)??ag,_)}}function E(R,k){return v(R,k,i)}function y(R,k){let{infiniteQueryOptions:_}=k;function F(V){let j={...V,...Zm(V.status)},{isLoading:L,isError:U,direction:M}=j,O=M==="forward",P=M==="backward";return{...j,hasNextPage:I(_,j.data,j.originalArgs),hasPreviousPage:T(_,j.data,j.originalArgs),isFetchingNextPage:L&&O,isFetchingPreviousPage:L&&P,isFetchNextPageError:U&&O,isFetchPreviousPageError:U&&P}}return v(R,k,F)}function h(){return R=>{let k;return typeof R=="object"?k=di(R)??El:k=R,r(k===El?o:V=>s(V)?.mutations?.[k]??cg,i)}}function S(R,k){let _=R[t],F=new Set,V=Rl(k,Ol,wg);for(let j of V){let L=_.provided.tags[j.type];if(!L)continue;let U=(j.id!==void 0?L[j.id]:Object.values(L).flat())??[];for(let M of U)F.add(M)}return Array.from(F.values()).flatMap(j=>{let L=_.queries[j];return L?{queryCacheKey:j,endpointName:L.endpointName,originalArgs:L.originalArgs}:[]})}function w(R,k){return Rl(Object.values(a(R)),_=>_?.endpointName===k&&_.status!==ar,_=>_.originalArgs)}function I(R,k,_){return k?kl(R,k,_)!=null:!1}function T(R,k,_){return!k||!R.getPreviousPageParam?!1:xg(R,k,_)!=null}}var ug=WeakMap?new WeakMap:void 0,lg=({endpointName:e,queryArgs:t})=>{let r="",n=ug?.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)&&ug?.set(t,o),r=o}return`${e}(${r})`};function Ax(...e){return function(r){let n=ei(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=lg;if("serializeQueryArgs"in u.endpointDefinition){let v=u.endpointDefinition.serializeQueryArgs;g=E=>{let y=v(E);return typeof y=="string"?y:lg({...E,queryArgs:y})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(u)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(u){u()},apiUid:ii(),extractRehydrationInfo:n,hasRehydrationInfo:ei(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,E]of Object.entries(g))typeof E=="function"?E(Kn(i,v)):Object.assign(Kn(i,v)||{},E);return s}},a=e.map(u=>u.init(s,o,i));function c(u){let g=u.endpoints({query:v=>({...v,type:pi}),mutation:v=>({...v,type:Ag}),infiniteQuery:v=>({...v,type:bg})});for(let[v,E]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]=E;for(let y of a)y.injectEndpoint(v,E)}return s}return s.injectEndpoints({endpoints:r.endpoints})}}function sr(e,...t){return Object.assign(e,...t)}var bx=({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,w)=>{if(a.match(w)){let{queryCacheKey:T,requestId:R,options:k}=w.payload,_=S.get(T);return _?.has(R)&&_.set(R,k),!0}if(c.match(w)){let{queryCacheKey:T,requestId:R}=w.payload,k=S.get(T);return k&&k.delete(R),!0}if(e.internalActions.removeQueryResult.match(w))return S.delete(w.payload.queryCacheKey),!0;if(t.pending.match(w)){let{meta:{arg:T,requestId:R}}=w,k=$s(S,T.queryCacheKey,Tl);return T.subscribe&&k.set(R,T.subscriptionOptions??k.get(R)??{}),!0}let I=!1;if(t.rejected.match(w)){let{meta:{condition:T,arg:R,requestId:k}}=w;if(T&&R.subscribe){let _=$s(S,R.queryCacheKey,Tl);_.set(k,R.subscriptionOptions??_.get(k)??{}),I=!0}}return I},g=()=>r.currentSubscriptions,y={getSubscriptions:g,getSubscriptionCount:S=>g().get(S)?.size??0,isRequestSubscribed:(S,w)=>!!g()?.get(S)?.get(w)};function h(S){return JSON.parse(JSON.stringify(Object.fromEntries([...S].map(([w,I])=>[w,Object.fromEntries(I)]))))}return(S,w)=>{if(i||(i=h(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,y];let I=u(r.currentSubscriptions,S),T=!0;if(I){s||(s=setTimeout(()=>{let _=h(r.currentSubscriptions),[,F]=ul(i,()=>_);w.next(e.internalActions.subscriptionsUpdated(F)),i=_,s=null},500));let R=typeof S.type=="string"&&!!S.type.startsWith(o),k=t.rejected.match(S)&&S.meta.condition&&!!S.meta.arg.subscribe;T=!R&&!k}return[T,!1]}},wx=2147483647/1e3-1,Cx=({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,E=Gt(g.match,r.fulfilled,r.rejected,v.match);function y(R){let k=o.currentSubscriptions.get(R);return k?k.size>0:!1}let h={};function S(R){for(let k of R.values())k?.abort?.()}let w=(R,k)=>{let _=k.getState(),F=s(_);if(E(R)){let V;if(v.match(R))V=R.payload.map(j=>j.queryDescription.queryCacheKey);else{let{queryCacheKey:j}=g.match(R)?R.payload:R.meta.arg;V=[j]}I(V,k,F)}if(t.util.resetApiState.match(R)){for(let[V,j]of Object.entries(h))j&&clearTimeout(j),delete h[V];S(o.runningQueries),S(o.runningMutations)}if(n.hasRehydrationInfo(R)){let{queries:V}=n.extractRehydrationInfo(R);I(Object.keys(V),k,F)}};function I(R,k,_){let F=k.getState();for(let V of R){let j=i(F,V);j?.endpointName&&T(V,j.endpointName,k,_)}}function T(R,k,_,F){let j=Kn(n,k)?.keepUnusedDataFor??F.keepUnusedDataFor;if(j===1/0)return;let L=Math.max(0,Math.min(j,wx));if(!y(R)){let U=h[R];U&&clearTimeout(U),h[R]=setTimeout(()=>{if(!y(R)){let M=i(_.getState(),R);M?.endpointName&&_.dispatch(a(M.endpointName,M.originalArgs))?.abort(),_.dispatch(u({queryCacheKey:R}))}delete h[R]},L*1e3)}}return w},dg=new Error("Promise never resolved before cacheEntryRemoved."),xx=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:s,selectApiState:a}})=>{let c=_s(n),u=_s(o),g=ir(n,o),v={},{removeQueryResult:E,removeMutationResult:y,cacheEntriesUpserted:h}=e.internalActions;function S(_,F,V){let j=v[_];j?.valueResolved&&(j.valueResolved({data:F,meta:V}),delete j.valueResolved)}function w(_){let F=v[_];F&&(delete v[_],F.cacheEntryRemoved())}function I(_){let{arg:F,requestId:V}=_.meta,{endpointName:j,originalArgs:L}=F;return[j,L,V]}let T=(_,F,V)=>{let j=R(_);function L(U,M,O,P){let N=s(V,M),Q=s(F.getState(),M);!N&&Q&&k(U,P,M,F,O)}if(n.pending.match(_)){let[U,M,O]=I(_);L(U,j,O,M)}else if(h.match(_))for(let{queryDescription:U,value:M}of _.payload){let{endpointName:O,originalArgs:P,queryCacheKey:N}=U;L(O,N,_.meta.requestId,P),S(N,M,{})}else if(o.pending.match(_)){if(F.getState()[t].mutations[j]){let[M,O,P]=I(_);k(M,O,j,F,P)}}else if(g(_))S(j,_.payload,_.meta.baseQueryMeta);else if(E.match(_)||y.match(_))w(j);else if(e.util.resetApiState.match(_))for(let U of Object.keys(v))w(U)};function R(_){return c(_)?_.meta.arg.queryCacheKey:u(_)?_.meta.arg.fixedCacheKey??_.meta.requestId:E.match(_)?_.payload.queryCacheKey:y.match(_)?di(_.payload):""}function k(_,F,V,j,L){let U=Kn(r,_),M=U?.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 dg})]);N.catch(()=>{}),v[V]=O;let Q=e.endpoints[_].select(Qs(U)?F:V),$=j.dispatch((H,J,se)=>se),Y={...j,getCacheEntry:()=>Q(j.getState()),requestId:L,extra:$,updateCachedData:Qs(U)?H=>j.dispatch(e.util.updateQueryData(_,F,H)):void 0,cacheDataLoaded:N,cacheEntryRemoved:P},K=M(F,Y);Promise.resolve(K).catch(H=>{if(H!==dg)throw H})}return T},Ex=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},Ix=({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=Gt(ir(n),oi(n)),v=Gt(ir(o,n),Wr(o,n)),E=[],y=0,h=(I,T)=>{(o.pending.match(I)||n.pending.match(I))&&y++,v(I)&&(y=Math.max(0,y-1)),g(I)?w(Eg(I,"invalidatesTags",r,s),T):v(I)?w([],T):i.util.invalidateTags.match(I)&&w(Fl(I.payload,void 0,void 0,void 0,void 0,s),T)};function S(){return y>0}function w(I,T){let R=T.getState(),k=R[e];if(E.push(...I),k.config.invalidationBehavior==="delayed"&&S())return;let _=E;if(E=[],_.length===0)return;let F=i.util.selectInvalidatedBy(R,_);t.batch(()=>{let V=Array.from(F.values());for(let{queryCacheKey:j}of V){let L=k.queries[j],U=$s(c.currentSubscriptions,j,Tl);L&&(U.size===0?T.dispatch(u({queryCacheKey:j})):L.status!==ar&&T.dispatch(a(L)))}})}return h},Rx=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:s}=o,a=new Set,c=null,u=(w,I)=>{(r.internalActions.updateSubscriptionOptions.match(w)||r.internalActions.unsubscribeQueryResult.match(w))&&g(w.payload.queryCacheKey,I),(t.pending.match(w)||t.rejected.match(w)&&w.meta.condition)&&g(w.meta.arg.queryCacheKey,I),(t.fulfilled.match(w)||t.rejected.match(w)&&!w.meta.condition)&&v(w.meta.arg,I),r.util.resetApiState.match(w)&&(h(),c&&(clearTimeout(c),c=null),a.clear())};function g(w,I){a.add(w),c||(c=setTimeout(()=>{for(let T of a)E({queryCacheKey:T},I);a.clear(),c=null},0))}function v({queryCacheKey:w},I){let T=I.getState()[e],R=T.queries[w],k=s.get(w);if(!R||R.status===ar)return;let{lowestPollingInterval:_,skipPollingIfUnfocused:F}=S(k);if(!Number.isFinite(_))return;let V=i.get(w);V?.timeout&&(clearTimeout(V.timeout),V.timeout=void 0);let j=Date.now()+_;i.set(w,{nextPollTimestamp:j,pollingInterval:_,timeout:setTimeout(()=>{(T.config.focused||!F)&&I.dispatch(n(R)),v({queryCacheKey:w},I)},_)})}function E({queryCacheKey:w},I){let R=I.getState()[e].queries[w],k=s.get(w);if(!R||R.status===ar)return;let{lowestPollingInterval:_}=S(k);if(!Number.isFinite(_)){y(w);return}let F=i.get(w),V=Date.now()+_;(!F||V<F.nextPollTimestamp)&&v({queryCacheKey:w},I)}function y(w){let I=i.get(w);I?.timeout&&clearTimeout(I.timeout),i.delete(w)}function h(){for(let w of i.keys())y(w)}function S(w=new Map){let I=!1,T=Number.POSITIVE_INFINITY;for(let R of w.values())R.pollingInterval&&(T=Math.min(R.pollingInterval,T),I=R.skipPollingIfUnfocused||I);return{lowestPollingInterval:T,skipPollingIfUnfocused:I}}return u},Tx=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=Ts(r,n),i=Wr(r,n),s=ir(r,n),a={};return(u,g)=>{if(o(u)){let{requestId:v,arg:{endpointName:E,originalArgs:y}}=u.meta,h=Kn(t,E),S=h?.onQueryStarted;if(S){let w={},I=new Promise((_,F)=>{w.resolve=_,w.reject=F});I.catch(()=>{}),a[v]=w;let T=e.endpoints[E].select(Qs(h)?y:v),R=g.dispatch((_,F,V)=>V),k={...g,getCacheEntry:()=>T(g.getState()),requestId:v,extra:R,updateCachedData:Qs(h)?_=>g.dispatch(e.util.updateQueryData(E,y,_)):void 0,queryFulfilled:I};S(y,k)}}else if(s(u)){let{requestId:v,baseQueryMeta:E}=u.meta;a[v]?.resolve({data:u.payload,meta:E}),delete a[v]}else if(i(u)){let{requestId:v,rejectedWithValue:E,baseQueryMeta:y}=u.meta;a[v]?.reject({error:u.payload??u.error,isUnhandledError:!E,meta:y}),delete a[v]}}},_x=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,s=(c,u)=>{Pl.match(c)&&a(u,"refetchOnFocus"),Nl.match(c)&&a(u,"refetchOnReconnect")};function a(c,u){let g=c.getState()[e],v=g.queries,E=o.currentSubscriptions;t.batch(()=>{for(let y of E.keys()){let h=v[y],S=E.get(y);if(!S||!h)continue;let w=[...S.values()];(w.some(T=>T[u]===!0)||w.every(T=>T[u]===void 0)&&g.config[u])&&(S.size===0?c.dispatch(i({queryCacheKey:y})):h.status!==ar&&c.dispatch(n(h)))}})}return s};function kx(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:s}=o,a={invalidateTags:G(`${t}/invalidateTags`)},c=E=>E.type.startsWith(`${t}/`),u=[Ex,Cx,Ix,Rx,xx,Tx];return{middleware:E=>{let y=!1,h=i(E.dispatch),S={...e,internalState:h,refetchQuery:v,isThisApiSliceAction:c,mwApi:E},w=u.map(R=>R(S)),I=bx(S),T=_x(S);return R=>k=>{if(!Go(k))return R(k);y||(y=!0,E.dispatch(n.internalActions.middlewareRegistered(s)));let _={...E,next:R},F=E.getState(),[V,j]=I(k,_,F),L;if(V?L=R(k):L=j,E.getState()[t]&&(T(k,_,F),c(k)||o.hasRehydrationInfo(k)))for(let U of w)U(k,_,F);return L}},actions:a};function v(E){return e.api.endpoints[E.endpointName].initiate(E.originalArgs,{subscribe:!1,forceRefetch:!0})}}var pg=Symbol(),Ox=({createSelector:e=Ue}={})=>({name:pg,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:s,refetchOnMountOrArgChange:a,refetchOnFocus:c,refetchOnReconnect:u,invalidationBehavior:g,onSchemaFailure:v,catchSchemaFailure:E,skipSchemaValidation:y},h){zf();let S=pe=>(typeof process<"u",pe);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:Nl,onOffline:Sg,onFocus:Pl,onFocusLost:vg},util:{}});let w=Sx({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:T,buildQuerySelector:R,buildInfiniteQuerySelector:k,buildMutationSelector:_}=w;sr(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:T});let{queryThunk:F,infiniteQueryThunk:V,mutationThunk:j,patchQueryData:L,updateQueryData:U,upsertQueryData:M,prefetch:O,buildMatchThunkActions:P}=yx({baseQuery:r,reducerPath:o,context:h,api:t,serializeQueryArgs:i,assertTagType:S,selectors:w,onSchemaFailure:v,catchSchemaFailure:E,skipSchemaValidation:y}),{reducer:N,actions:Q}=vx({context:h,queryThunk:F,infiniteQueryThunk:V,mutationThunk:j,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:U,upsertQueryData:M,prefetch:O,resetApiState:Q.resetApiState,upsertQueryEntries:Q.cacheEntriesUpserted}),sr(t.internalActions,Q);let $=new WeakMap,Y=pe=>$s($,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}=hx({queryThunk:F,mutationThunk:j,infiniteQueryThunk:V,api:t,serializeQueryArgs:i,context:h,getInternalState:Y});sr(t.util,{getRunningMutationThunk:se,getRunningMutationsThunk:be,getRunningQueryThunk:Ie,getRunningQueriesThunk:Ne});let{middleware:_e,actions:ke}=kx({reducerPath:o,context:h,queryThunk:F,mutationThunk:j,infiniteQueryThunk:V,api:t,assertTagType:S,selectors:w,getRunningQueryThunk:Ie,getInternalState:Y});return sr(t.util,ke),sr(t,{reducer:N,middleware:_e}),{name:pg,injectEndpoint(pe,de){var Ge;let fe=(Ge=t.endpoints)[pe]??(Ge[pe]={});zs(de)&&sr(fe,{name:pe,select:R(pe,de),initiate:K(pe,de)},P(F,pe)),fx(de)&&sr(fe,{name:pe,select:_(),initiate:J(pe)},P(j,pe)),Ws(de)&&sr(fe,{name:pe,select:k(pe,de),initiate:H(pe,de)},P(F,pe))}}}}),Rg=Ax(Ox());m();d();f();p();m();d();f();p();var Zr=e=>e.query,Tg=e=>e.query?.enableQuerySyntax;var Hq=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})),Px=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 Ll(){return typeof window<"u"}function Yl(){return typeof navigator<"u"}function Yn(){return typeof document<"u"}function jl(){try{return typeof localStorage<"u"}catch{return!1}}function Nx(){try{return typeof sessionStorage<"u"}catch{return!1}}function Vg(){return Yl()&&navigator.cookieEnabled}var Fx=[ve.click,ve.custom,ve.search,ve.view],Dx=(e,t)=>Fx.indexOf(e)!==-1?Object.assign({language:Yn()?document.documentElement.lang:"unknown",userAgent:Yl()?navigator.userAgent:"unknown"},t):t,mi=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?_g(t,r,i):(s=a.split("."),o=s[s.length-2]+"."+s[s.length-1],_g(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 _g(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function Mx(){return jl()?localStorage:Vg()?new gi:Nx()?sessionStorage:new Zn}var gi=class e{getItem(t){return mi.get(`${e.prefix}${t}`)}removeItem(t){mi.erase(`${e.prefix}${t}`)}setItem(t,r,n){mi.set(`${e.prefix}${t}`,r,n)}};gi.prefix="coveo_";var ql=class{constructor(){this.cookieStorage=new gi}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)}},Zn=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Ks="__coveo.analytics.history",Lx=20,jx=1e3*60,qx=75,Xs=class{constructor(t){this.store=t||Mx()}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(Ks);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(Ks);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Ks,JSON.stringify(t.slice(0,Lx)))}catch{}}clear(){try{this.store.removeItem(Ks)}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,qx)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>jx:!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 Ux=(e,t)=>q(void 0,void 0,void 0,function*(){return e===ve.view?(yield Vx(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),Vx=e=>q(void 0,void 0,void 0,function*(){let t=new Xs,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),Gx=/^(?:[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 Zs(e){return typeof e=="string"&&Gx.test(e)}function kg(e){if(!Zs(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 Gg(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 Bx=new Uint8Array(16);function $x(){return crypto.getRandomValues(Bx)}function Qx(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 Hx="6ba7b810-9dad-11d1-80b4-00c04fd430c8",zx="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Wx(e,t,r,n,o,i){let s=typeof r=="string"?Qx(r):r,a=typeof n=="string"?kg(n):n;if(typeof n=="string"&&(n=kg(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,Gg(c)}function Jr(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():Kx(e,t,r)}function Kx(e,t,r){e=e||{};let n=e.random??e.rng?.()??$x();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 Gg(n)}function Yx(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 Dl(e,t){return e<<t|e>>>32-t}function Xx(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 h=0;h<16;++h)c[h]=s[a][h];for(let h=16;h<80;++h)c[h]=Dl(c[h-3]^c[h-8]^c[h-14]^c[h-16],1);let u=r[0],g=r[1],v=r[2],E=r[3],y=r[4];for(let h=0;h<80;++h){let S=Math.floor(h/20),w=Dl(u,5)+Yx(S,g,v,E)+y+t[S]+c[h]>>>0;y=E,E=v,v=Dl(g,30)>>>0,g=u,u=w}r[0]=r[0]+u>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+v>>>0,r[3]=r[3]+E>>>0,r[4]=r[4]+y>>>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 Js(e,t,r,n){return Wx(80,Xx,e,t)}Js.DNS=Hx;Js.URL=zx;var Bg="2.33.0",Og=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,fi={pageview:"pageview",event:"event"},ea=class{constructor({client:t,uuidGenerator:r=Jr}){this.client=t,this.uuidGenerator=r}},Ul=class extends ea{constructor({client:t,uuidGenerator:r=Jr}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=Og(window.location),this.lastReferrer=Yn()?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:Yn()?document.title:"",encoding:Yn()?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===fi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===fi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===fi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===fi.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 Og(window.location)}},Sr=class e{constructor(t,r){if(!Zs(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 Zs(i)?new e(i,Number.parseInt(o)*1e3):null}};Sr.cvo_cid="cvo_cid";Sr.expirationTime=120;var Vl=class extends ea{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)}};Vl.Id="link";var xt=Object.keys;function Ys(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Ml=128,$g=192,Pg=224,Ng=240;function Zx(e){return(e&248)===Ng?4:(e&Ng)===Pg?3:(e&Pg)===$g?2:1}function Jx(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&Ml)!=Ml)break;if(r-=3,(n&$g)!=Ml){t-r>=Zx(n)*3&&(r=t);break}}return e.substring(0,r)}var Gl={id:"svc_ticket_id",subject:"svc_ticket_subject",description:"svc_ticket_description",category:"svc_ticket_category",productId:"svc_ticket_product_id",custom:"svc_ticket_custom"},eE=xt(Gl).map(e=>Gl[e]),tE=[...eE].join("|"),rE=new RegExp(`^(${tE}$)`),nE={svcAction:"svc_action",svcActionData:"svc_action_data"},oE=e=>xt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=Gl[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),iE=e=>rE.test(e),sE=[iE],Fg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Dg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},st={action:"pa",list:"pal",listSource:"pls"},ta={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},aE=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Bl={id:"quoteId",affiliation:"quoteAffiliation"},$l={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},cE={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),ta),purchase:Object.assign(Object.assign({},st),ta),quickview:st,quote:Object.assign(Object.assign({},st),Bl),review:Object.assign(Object.assign({},st),$l)},uE=xt(Fg).map(e=>Fg[e]),lE=xt(Dg).map(e=>Dg[e]),dE=xt(st).map(e=>st[e]),pE=xt(ta).map(e=>ta[e]),fE=xt($l).map(e=>$l[e]),mE=xt(Bl).map(e=>Bl[e]),gE=[...uE,"custom"].join("|"),hE=[...lE,"custom"].join("|"),Qg="(pr[0-9]+)",Hg="(il[0-9]+pi[0-9]+)",yE=new RegExp(`^${Qg}(${gE})$`),vE=new RegExp(`^(${Hg}(${hE}))|(il[0-9]+nm)$`),SE=new RegExp(`^(${dE.join("|")})$`),AE=new RegExp(`^(${pE.join("|")})$`),bE=new RegExp(`^${Qg}custom$`),wE=new RegExp(`^${Hg}custom$`),CE=new RegExp(`^(${[...aE,...fE,...mE].join("|")})$`),xE=e=>yE.test(e),EE=e=>vE.test(e),IE=e=>SE.test(e),RE=e=>AE.test(e),TE=e=>CE.test(e),_E=[EE,xE,IE,RE,TE],kE=[bE,wE],OE={anonymizeIp:"aip"},PE={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},NE={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},FE=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],DE=Object.assign(Object.assign(Object.assign(Object.assign({},OE),PE),NE),FE.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Ql=Object.assign(Object.assign({},DE),nE),ME=e=>{let t=!!e.action&&cE[e.action]||{};return xt(e).reduce((r,n)=>{let o=t[n]||Ql[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},LE=xt(Ql).map(e=>Ql[e]),jE=e=>LE.indexOf(e)!==-1,qE=e=>e==="custom",UE=e=>[..._E,...sE,jE,qE].some(t=>t(e)),VE=e=>xt(e).reduce((t,r)=>{let n=GE(r);return n?Object.assign(Object.assign({},t),BE(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),GE=e=>{let t;return[...kE].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},BE=(e,t)=>xt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),Hl=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()})}},Mg=b.fetch,ra=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 Mg(u,g)}catch(E){console.error("An error has occurred when sending the event.",E);return}if(v.ok){let E=yield v.json();return E.visitorId&&o.setCurrentVisitorId(E.visitorId),E}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 Mg(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"})}},Wl=class{constructor(t,r){jl()&&Vg()?this.storage=new ql:jl()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Zn),this.client=new ra(t),this.beaconClient=new Hl(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}},Kl=class{constructor(t,r){this.storage=r||new Zn,this.client=new ra(t)}getClientDependingOnEventType(t){return this.client}},na=class{constructor(){this.storage=new Zn,this.client=new zl}getClientDependingOnEventType(t){return this.client}},$E="xx",QE=e=>e?.startsWith($E)||!1,HE=`
27
+ `;return new $u(r)}var $u=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 ow(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 Mn(e){return e===void 0}function iw(e){return e===null}function ce(e){return Mn(e)||iw(e)}var je=class{constructor(e={}){oe(this,"value");this.value=new Vr(e)}validate(e){let t=this.value.validate(e);return t||(sw(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function sw(e){return Mn(e)||wf(e)}function wf(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||(aw(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 aw(e){return Mn(e)||Cf(e)}function Cf(e){return typeof e=="number"&&!Number.isNaN(e)}var cw=/^\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(Mn(e))return null;if(!xf(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&&!(cw.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 xf(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(Mn(e))return this.config.options.required?"value is required and is currently undefined":null;if(!Ef(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 Ef(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 wf(e)||xf(e)||Cf(e)||Ef(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function If(e){return Array.isArray(e)}var Qu=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:Mn(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 ns=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();var Ln=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 Hu(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var zu=e=>{let{response:t}=e;return t.body?uw(e):lw(t)},uw=e=>pw(e)?fw(e):dw(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},lw=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function dw(e){return e.body.statusCode!==void 0}function pw(e){return e.body.exception!==void 0}var fw=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();function Rf(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var Wu=(e,t,r,n)=>{let o=new Ln(`${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 Tf=(e,t)=>{let r=new Ln(`${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},Ku=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield yr.call({...Wu(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Hu(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Rf(r),o=yield r.arrayBuffer(),s=new TextDecoder(n).decode(o);return mw(s)?{success:s}:{error:zu({response:r,body:s})}});return function Ku(_x3,_x4){return _ref3.apply(this,arguments)}}();function mw(e){return typeof e=="string"}m();d();f();p();function gw(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function hw(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function os(e,t){if(t&&e.name==="AbortError")return{error:hw(e)};if(e instanceof Ur)return{error:gw(e)};throw e}m();d();f();p();m();d();f();p();var is=(e,t,r,n,o={})=>{yw(e);let i=`${e.url}/rest/organizations/${e.organizationId}/caseassists/${e.caseAssistId}${n}`,s=vw(o),a=s?`${i}?${s}`:i;return{accessToken:e.accessToken,method:t,contentType:r,url:a,origin:"caseAssistApiFetch"}},ss=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r],t),{}),as=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r].value,t),{}),yw=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.")},vw=e=>Object.keys(e).map(t=>`${t}=${encodeURIComponent(e[t])}`).join("&");var _f=e=>{let t=e.debug?{debug:"1"}:{};return{...is(e,"POST","application/json","/classify",t),requestParams:Sw(e)}},Sw=e=>({clientId:e.clientId,locale:e.locale,fields:ss(e.fields)});m();d();f();p();var kf=e=>{let t={};return e.debug&&(t.debug="1"),e.numberOfResults&&(t.numberOfResults=e.numberOfResults.toString()),{...is(e,"POST","application/json","/documents/suggest",t),requestParams:Aw(e)}},Aw=e=>({clientId:e.clientId,locale:e.locale,fields:ss(e.fields),context:e.context,analytics:e.analytics});var cs=class{constructor(t){oe(this,"options",t)}getCaseClassifications(t){var _this=this;return _asyncToGenerator(function*(){let r=yield yr.call({..._f(t),..._this.options});if(r instanceof Error)return os(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({...kf(t),..._this2.options});if(r instanceof Error)return os(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this3=this;return _asyncToGenerator(function*(){return Ku(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 bw=typeof Symbol=="function"&&Symbol.observable||"@@observable",Of=bw,Yu=()=>Math.random().toString(36).substring(7).split("").join("."),ww={INIT:`@@redux/INIT${Yu()}`,REPLACE:`@@redux/REPLACE${Yu()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Yu()}`},us=ww;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 Xu(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(Xu)(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((w,I)=>{s.set(I,w)}))}function g(){if(c)throw new Error(Xe(3));return o}function v(w){if(typeof w!="function")throw new Error(Xe(4));if(c)throw new Error(Xe(5));let I=!0;u();let T=a++;return s.set(T,w),function(){if(I){if(c)throw new Error(Xe(6));I=!1,u(),s.delete(T),i=null}}}function E(w){if(!Vt(w))throw new Error(Xe(7));if(typeof w.type>"u")throw new Error(Xe(8));if(typeof w.type!="string")throw new Error(Xe(17));if(c)throw new Error(Xe(9));try{c=!0,o=n(o,w)}finally{c=!1}return(i=s).forEach(T=>{T()}),w}function y(w){if(typeof w!="function")throw new Error(Xe(10));n=w,E({type:us.REPLACE})}function h(){let w=v;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(Xe(11));function T(){let k=I;k.next&&k.next(g())}return T(),{unsubscribe:w(T)}},[Of](){return this}}}return E({type:us.INIT}),{dispatch:E,subscribe:v,getState:g,replaceReducer:y,[Of]:h}}function Cw(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:us.INIT})>"u")throw new Error(Xe(12));if(typeof r(void 0,{type:us.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Xe(13))})}function jn(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{Cw(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 E=n[v],y=r[E],h=a[E],S=y(h,c);if(typeof S>"u"){let w=c&&c.type;throw new Error(Xe(14))}g[E]=S,u=u||S!==h}return u=u||n.length!==Object.keys(a).length,u?g:a}}function Vo(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Pf(...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=Vo(...a)(o.dispatch),{...o,dispatch:i}}}function Go(e){return Vt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var sl=Symbol.for("immer-nothing"),Bo=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,Br=ht.getPrototypeOf,$o="constructor",Ko="prototype",el="configurable",fs="enumerable",ds="writable",Qo="value",ct=e=>!!e&&!!e[$e];function it(e){return e?Uf(e)||Xo(e)||!!e[Bo]||!!e[$o]?.[Bo]||Zo(e)||Jo(e):!1}var xw=ht[Ko][$o].toString(),Nf=new WeakMap;function Uf(e){if(!e||!Un(e))return!1;let t=Br(e);if(t===null||t===ht[Ko])return!0;let r=ht.hasOwnProperty.call(t,$o)&&t[$o];if(r===Object)return!0;if(!Gr(r))return!1;let n=Nf.get(r);return n===void 0&&(n=Function.toString.call(r),Nf.set(r,n)),n===xw}function Vf(e){return ct(e)||Ze(15,e),e[$e].base_}function Yo(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_:Xo(e)?1:Zo(e)?2:Jo(e)?3:0}var qn=(e,t,r=$r(e))=>r===2?e.has(t):ht[Ko].hasOwnProperty.call(e,t),nr=(e,t,r=$r(e))=>r===2?e.get(t):e[t],ms=(e,t,r,n=$r(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function Ew(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Xo=Array.isArray,Zo=e=>e instanceof Map,Jo=e=>e instanceof Set,Un=e=>typeof e=="object",Gr=e=>typeof e=="function",Zu=e=>typeof e=="boolean";function Iw(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Rw=e=>Un(e)?e?.[$e]:null,or=e=>e.copy_||e.base_;var al=e=>e.modified_?e.copy_:e.base_;function tl(e,t){if(Zo(e))return new Map(e);if(Jo(e))return new Set(e);if(Xo(e))return Array[Ko].slice.call(e);let r=Uf(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[ds]===!1&&(a[ds]=!0,a[el]=!0),(a.get||a.set)&&(n[s]={[el]:!0,[ds]:!0,[fs]:a[fs],[Qo]:e[s]})}return ht.create(Br(e),n)}else{let n=Br(e);if(n!==null&&r)return{...e};let o=ht.create(n);return ht.assign(o,e)}}function cl(e,t=!1){return As(e)||ct(e)||!it(e)||($r(e)>1&&ht.defineProperties(e,{set:ls,add:ls,clear:ls,delete:ls}),ht.freeze(e),t&&Yo(e,(r,n)=>{cl(n,!0)},!1)),e}function Tw(){Ze(2)}var ls={[Qo]:Tw};function As(e){return e===null||!Un(e)?!0:ht.isFrozen(e)}var gs="MapSet",hs="Patches",Ff="ArrayMethods",ys={};function Qr(e){let t=ys[e];return t||Ze(0,e),t}var Df=e=>!!ys[e];function _w(e,t){ys[e]||(ys[e]=t)}var Ho,Gf=()=>Ho,kw=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Df(gs)?Qr(gs):void 0,arrayMethodsPlugin_:Df(Ff)?Qr(Ff):void 0});function Mf(e,t){t&&(e.patchPlugin_=Qr(hs),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function rl(e){nl(e),e.drafts_.forEach(Ow),e.drafts_=null}function nl(e){e===Ho&&(Ho=e.parent_)}var Lf=e=>Ho=kw(Ho,e);function Ow(e){let t=e[$e];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function jf(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[$e].modified_&&(rl(t),Ze(4)),it(e)&&(e=qf(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[$e].base_,e,t)}else e=qf(t,r);return Pw(t,e,!0),rl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==sl?e:void 0}function qf(e,t){if(As(t))return t;let r=t[$e];if(!r)return vs(t,e.handledSet_,e);if(!bs(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);Qf(r,e)}return r.copy_}function Pw(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&cl(t,r)}function Bf(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var bs=(e,t)=>e.scope_===t,Nw=[];function $f(e,t,r,n){let o=or(e),i=e.type_;if(n!==void 0&&nr(o,n,i)===t){ms(o,n,r,i);return}if(!e.draftLocations_){let a=e.draftLocations_=new Map;Yo(o,(c,u)=>{if(ct(u)){let g=a.get(u)||[];g.push(c),a.set(u,g)}})}let s=e.draftLocations_.get(t)??Nw;for(let a of s)ms(o,a,r,i)}function Fw(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!bs(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let s=al(i);$f(e,i.draft_??i,s,r),Qf(i,o)})}function Qf(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)}Bf(e)}}function Dw(e,t,r){let{scope_:n}=e;if(ct(r)){let o=r[$e];bs(o,n)&&o.callbacks_.push(function(){ps(e);let s=al(o);$f(e,r,s,t)})}else it(r)&&e.callbacks_.push(function(){let i=or(e);e.type_===3?i.has(r)&&vs(r,n.handledSet_,n):nr(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&vs(nr(e.copy_,t,e.type_),n.handledSet_,n)})}function vs(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||ct(e)||t.has(e)||!it(e)||As(e)||(t.add(e),Yo(e,(n,o)=>{if(ct(o)){let i=o[$e];if(bs(i,r)){let s=al(i);ms(e,n,s,e.type_),Bf(i)}}else it(o)&&vs(o,t,r)})),e}function Mw(e,t){let r=Xo(e),n={type_:r?1:0,scope_:t?t.scope_:Gf(),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=Ss;r&&(o=[n],i=zo);let{revoke:s,proxy:a}=Proxy.revocable(o,i);return n.draft_=a,n.revoke_=s,[a,n]}var Ss={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(!qn(o,t,e.type_))return jw(e,o,t);let i=o[t];if(e.finalized_||!it(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Iw(t))return i;if(i===Ju(e.base_,t)||Lw(e,t,i)){ps(e);let s=e.type_===1?+t:t,a=il(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=Hf(or(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Ju(or(e),t),i=o?.[$e];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(Ew(r,o)&&(r!==void 0||qn(e.base_,t,e.type_)))return!0;ps(e),ol(e)}return e.copy_[t]===r&&(r!==void 0||qn(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Dw(e,t,r)),!0},deleteProperty(e,t){return ps(e),Ju(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),ol(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&&{[ds]:!0,[el]:e.type_!==1||t!=="length",[fs]:n[fs],[Qo]:r[t]}},defineProperty(){Ze(11)},getPrototypeOf(e){return Br(e.base_)},setPrototypeOf(){Ze(12)}},zo={};for(let e in Ss){let t=Ss[e];zo[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}zo.deleteProperty=function(e,t){return zo.set.call(this,e,t,void 0)};zo.set=function(e,t,r){return Ss.set.call(this,e[0],t,r,e[0])};function Ju(e,t){let r=e[$e];return(r?or(r):e)[t]}function Lw(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!it(r)||r[$e]?!1:e.baseRefs_.has(r)}function jw(e,t,r){let n=Hf(t,r);return n?Qo in n?n[Qo]:n.get?.call(e.draft_):void 0}function Hf(e,t){if(!(t in e))return;let r=Br(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Br(r)}}function ol(e){e.modified_||(e.modified_=!0,e.parent_&&ol(e.parent_))}function ps(e){e.copy_||(e.assigned_=new Map,e.copy_=tl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var qw=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Gr(t)&&!Gr(r)){let i=r;r=t;let s=this;return function(c=i,...u){return s.produce(c,g=>r.call(this,g,...u))}}Gr(r)||Ze(6),n!==void 0&&!Gr(n)&&Ze(7);let o;if(it(t)){let i=Lf(this),s=il(i,t,void 0),a=!0;try{o=r(s),a=!1}finally{a?rl(i):nl(i)}return Mf(i,n),jf(o,i)}else if(!t||!Un(t)){if(o=r(t),o===void 0&&(o=t),o===sl&&(o=void 0),this.autoFreeze_&&cl(o,!0),n){let i=[],s=[];Qr(hs).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:s}),n(i,s)}return o}else Ze(1,t)},this.produceWithPatches=(t,r)=>{if(Gr(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]},Zu(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Zu(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Zu(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){it(e)||Ze(8),ct(e)&&(e=ws(e));let t=Lf(this),r=il(t,e,void 0);return r[$e].isManual_=!0,nl(t),r}finishDraft(e,t){let r=e&&e[$e];(!r||!r.isManual_)&&Ze(9);let{scope_:n}=r;return Mf(n,t),jf(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(hs).applyPatches_;return ct(e)?n(e,t):this.produce(e,o=>n(o,t))}};function il(e,t,r,n){let[o,i]=Zo(t)?Qr(gs).proxyMap_(t,r):Jo(t)?Qr(gs).proxySet_(t,r):Mw(t,r);return(r?.scope_??Gf()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?Fw(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 ws(e){return ct(e)||Ze(10,e),zf(e)}function zf(e){if(!it(e)||As(e))return e;let t=e[$e],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=tl(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=tl(e,!0);return Yo(r,(o,i)=>{ms(r,o,zf(i))},n),t&&(t.finalized_=!1),r}function Wf(){function t(h,S=[]){if(h.key_!==void 0){let w=h.parent_.copy_??h.parent_.base_,I=Rw(nr(w,h.key_)),T=nr(w,h.key_);if(T===void 0||T!==h.draft_&&T!==h.base_&&T!==h.copy_||I!=null&&I.base_!==h.base_)return null;let R=h.parent_.type_===3,k;if(R){let _=h.parent_;k=Array.from(_.drafts_.keys()).indexOf(h.key_)}else k=h.key_;if(!(R&&w.size>k||qn(w,k)))return null;S.push(k)}if(h.parent_)return t(h.parent_,S);S.reverse();try{r(h.copy_,S)}catch{return null}return S}function r(h,S){let w=h;for(let I=0;I<S.length-1;I++){let T=S[I];if(w=nr(w,T),!Un(w)||w===null)throw new Error(`Cannot resolve path at '${S.join("/")}'`)}return w}let n="replace",o="add",i="remove";function s(h,S,w){if(h.scope_.processedForPatches_.has(h))return;h.scope_.processedForPatches_.add(h);let{patches_:I,inversePatches_:T}=w;switch(h.type_){case 0:case 2:return c(h,S,I,T);case 1:return a(h,S,I,T);case 3:return u(h,S,I,T)}}function a(h,S,w,I){let{base_:T,assigned_:R}=h,k=h.copy_;k.length<T.length&&([T,k]=[k,T],[w,I]=[I,w]);let _=h.allIndicesReassigned_===!0;for(let F=0;F<T.length;F++){let V=k[F],j=T[F];if((_||R?.get(F.toString()))&&V!==j){let U=V?.[$e];if(U&&U.modified_)continue;let M=S.concat([F]);w.push({op:n,path:M,value:y(V)}),I.push({op:n,path:M,value:y(j)})}}for(let F=T.length;F<k.length;F++){let V=S.concat([F]);w.push({op:o,path:V,value:y(k[F])})}for(let F=k.length-1;T.length<=F;--F){let V=S.concat([F]);I.push({op:i,path:V})}}function c(h,S,w,I){let{base_:T,copy_:R,type_:k}=h;Yo(h.assigned_,(_,F)=>{let V=nr(T,_,k),j=nr(R,_,k),L=F?qn(T,_)?n:o:i;if(V===j&&L===n)return;let U=S.concat(_);w.push(L===i?{op:L,path:U}:{op:L,path:U,value:y(j)}),I.push(L===o?{op:i,path:U}:L===i?{op:o,path:U,value:y(V)}:{op:n,path:U,value:y(V)})})}function u(h,S,w,I){let{base_:T,copy_:R}=h,k=0;T.forEach(_=>{if(!R.has(_)){let F=S.concat([k]);w.push({op:i,path:F,value:_}),I.unshift({op:o,path:F,value:_})}k++}),k=0,R.forEach(_=>{if(!T.has(_)){let F=S.concat([k]);w.push({op:o,path:F,value:_}),I.unshift({op:i,path:F,value:_})}k++})}function g(h,S,w){let{patches_:I,inversePatches_:T}=w;I.push({op:n,path:[],value:S===sl?void 0:S}),T.push({op:n,path:[],value:h})}function v(h,S){return S.forEach(w=>{let{path:I,op:T}=w,R=h;for(let V=0;V<I.length-1;V++){let j=$r(R),L=I[V];typeof L!="string"&&typeof L!="number"&&(L=""+L),(j===0||j===1)&&(L==="__proto__"||L===$o)&&Ze(19),Gr(R)&&L===Ko&&Ze(19),R=nr(R,L),(R===null||!Un(R))&&Ze(18,I.join("/"))}let k=$r(R),_=E(w.value),F=I[I.length-1];switch(T){case n:switch(k){case 2:return R.set(F,_);case 3:Ze(16);default:return R[F]=_}case o:switch(k){case 1:return F==="-"?R.push(_):R.splice(F,0,_);case 2:return R.set(F,_);case 3:return R.add(_);default:return R[F]=_}case i:switch(k){case 1:return R.splice(F,1);case 2:return R.delete(F);case 3:return R.delete(w.value);default:return delete R[F]}default:Ze(17,T)}}),h}function E(h){if(!it(h))return h;if(Xo(h))return h.map(E);if(Zo(h))return new Map(Array.from(h.entries()).map(([w,I])=>[w,E(I)]));if(Jo(h))return new Set(Array.from(h).map(E));let S=Object.create(Br(h));for(let w in h)S[w]=E(h[w]);return qn(h,Bo)&&(S[Bo]=h[Bo]),S}function y(h){return ct(h)?E(h):h}_w(hs,{applyPatches_:v,generatePatches_:s,generateReplacementPatches_:g,getPath:t})}var Wo=new qw,Hr=Wo.produce,ul=Wo.produceWithPatches.bind(Wo);var ll=Wo.applyPatches.bind(Wo);m();d();f();p();function Uw(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Vw(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 Kf=e=>Array.isArray(e)?e:[e];function Gw(e){let t=Array.isArray(e[0])?e[0]:e;return Vw(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Bw(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var $w=class{constructor(e){this.value=e}deref(){return this.value}},Qw=()=>typeof WeakRef>"u"?$w:WeakRef,Xf=Qw(),Hw=0,Yf=1;function Cs(){return{s:Hw,v:void 0,o:null,p:null}}function zw(e){return e instanceof Xf?e.deref():e}function ei(e,t={}){let r=Cs(),{resultEqualityCheck:n}=t,o,i=0;function s(){let a=r,{length:c}=arguments;for(let v=0,E=c;v<E;v++){let y=arguments[v];if(typeof y=="function"||typeof y=="object"&&y!==null){let h=a.o;h===null&&(a.o=h=new WeakMap);let S=h.get(y);S===void 0?(a=Cs(),h.set(y,a)):a=S}else{let h=a.p;h===null&&(a.p=h=new Map);let S=h.get(y);S===void 0?(a=Cs(),h.set(y,a)):a=S}}let u=a,g;if(a.s===Yf)g=a.v;else if(g=e.apply(null,arguments),i++,n){let v=zw(o);v!=null&&n(v,g)&&(g=v,i!==0&&i--),o=typeof g=="object"&&g!==null||typeof g=="function"?new Xf(g):g}return u.s=Yf,u.v=g,g}return s.clearCache=()=>{r=Cs(),s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function Ww(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()),Uw(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);let g={...r,...c},{memoize:v,memoizeOptions:E=[],argsMemoize:y=ei,argsMemoizeOptions:h=[]}=g,S=Kf(E),w=Kf(h),I=Gw(o),T=v(function(){return i++,u.apply(null,arguments)},...S),R=!0,k=y(function(){s++;let F=Bw(I,arguments);return a=T.apply(null,F),a},...w);return Object.assign(k,{resultFunc:u,memoizedResultFunc:T,dependencies:I,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>a,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:y})};return Object.assign(n,{withTypes:()=>n}),n}var Ue=Ww(ei);m();d();f();p();function Zf(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var Jf=Zf(),em=Zf;var Kw=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Vo:Vo.apply(null,arguments)},KD=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},Yw=e=>e&&typeof e.match=="function";function G(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=>Go(n)&&n.type===e,r}var cm=class ti extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,ti.prototype)}static get[Symbol.species](){return ti}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new ti(...t[0].concat(this)):new ti(...t.concat(this))}};function tm(e){return it(e)?Hr(e,()=>{}):e}function xs(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function Xw(e){return typeof e=="boolean"}var Zw=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},s=new cm;return r&&(Xw(r)?s.push(Jf):s.push(em(r.extraArgument))),s},ri="RTK_autoBatch",Bn=()=>e=>({payload:e,meta:{[ri]:!0}}),rm=e=>t=>{setTimeout(t,e)},Jw=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(i),clearTimeout(s),r())},i=e(o),s=setTimeout(o,t)},eC=(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?Jw(window.requestAnimationFrame,100):rm(10):e.type==="callback"?e.queueNotification:rm(e.timeout),u=()=>{s=!1,i&&(i=!1,a.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let v=()=>o&&g(),E=n.subscribe(v);return a.add(g),()=>{E(),a.delete(g)}},dispatch(g){try{return o=!g?.meta?.[ri],i=!o,i&&(s||(s=!0,c(u))),n.dispatch(g)}finally{o=!0}}})},tC=e=>function(r){let{autoBatch:n=!0}=r??{},o=new cm(e);return n&&o.push(eC(typeof n=="object"?n:void 0)),o};function um(e){let t=Zw(),{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=jn(r);else throw new Error(ut(1));let u;typeof n=="function"?u=n(t):u=t();let g=Vo;o&&(g=Kw({trace:!1,...(typeof o=="object"&&o)}));let v=Pf(...u),E=tC(v),y=typeof a=="function"?a(E):E(),h=g(...y);return Xu(c,s,h)}function lm(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 rC(e){return typeof e=="function"}function Qe(e,t){let[r,n,o]=lm(t),i;if(rC(e))i=()=>tm(e());else{let a=tm(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 y=v(g,c);return y===void 0?g:y}else{if(it(g))return Hr(g,E=>v(E,c));{let E=v(g,c);if(E===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return E}}return g},a)}return s.getInitialState=i,s}var dm=(e,t)=>Yw(e)?e.match(t):e(t);function Gt(...e){return t=>e.some(r=>dm(r,t))}function Gn(...e){return t=>e.every(r=>dm(r,t))}function Ts(e,t){if(!e||!e.meta)return!1;let r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function ni(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function _s(...e){return e.length===0?t=>Ts(t,["pending"]):ni(e)?Gt(...e.map(t=>t.pending)):_s()(e[0])}function Wr(...e){return e.length===0?t=>Ts(t,["rejected"]):ni(e)?Gt(...e.map(t=>t.rejected)):Wr()(e[0])}function oi(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Gn(Wr(...e),t):ni(e)?Gn(Wr(...e),t):oi()(e[0])}function ir(...e){return e.length===0?t=>Ts(t,["fulfilled"]):ni(e)?Gt(...e.map(t=>t.fulfilled)):ir()(e[0])}function ks(...e){return e.length===0?t=>Ts(t,["pending","fulfilled","rejected"]):ni(e)?Gt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):ks()(e[0])}var nC="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",ii=(e=21)=>{let t="",r=e;for(;r--;)t+=nC[Math.random()*64|0];return t},oC=["name","message","stack","code"],dl=class{constructor(e,t){oe(this,"payload");oe(this,"meta");oe(this,"_type");this.payload=e,this.meta=t}},nm=class{constructor(e,t){oe(this,"payload");oe(this,"meta");oe(this,"_type");this.payload=e,this.meta=t}},iC=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of oC)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},om="External signal was aborted",Ce=(()=>{function e(t,r,n){let o=G(t+"/fulfilled",(c,u,g,v)=>({payload:c,meta:{...(v||{}),arg:g,requestId:u,requestStatus:"fulfilled"}})),i=G(t+"/pending",(c,u,g)=>({payload:void 0,meta:{...(g||{}),arg:u,requestId:c,requestStatus:"pending"}})),s=G(t+"/rejected",(c,u,g,v,E)=>({payload:v,error:(n&&n.serializeError||iC)(c||"Rejected"),meta:{...(E||{}),arg:g,requestId:u,rejectedWithValue:!!v,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function a(c,{signal:u}={}){return(g,v,E)=>{let y=n?.idGenerator?n.idGenerator(c):ii(),h=new l.AbortController,S,w;function I(R){w=R,h.abort()}u&&(u.aborted?I(om):u.addEventListener("abort",()=>I(om),{once:!0}));let T=_asyncToGenerator(function*(){let R;try{let _=n?.condition?.(c,{getState:v,extra:E});if(aC(_)&&(_=yield _),_===!1||h.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let F=new Promise((V,j)=>{S=()=>{j({name:"AbortError",message:w||"Aborted"})},h.signal.addEventListener("abort",S,{once:!0})});g(i(y,c,n?.getPendingMeta?.({requestId:y,arg:c},{getState:v,extra:E}))),R=yield Promise.race([F,Promise.resolve(r(c,{dispatch:g,getState:v,extra:E,requestId:y,signal:h.signal,abort:I,rejectWithValue:(V,j)=>new dl(V,j),fulfillWithValue:(V,j)=>new nm(V,j)})).then(V=>{if(V instanceof dl)throw V;return V instanceof nm?o(V.payload,y,c,V.meta):o(V,y,c)})])}catch(_){R=_ instanceof dl?s(null,y,c,_.payload,_.meta):s(_,y,c)}finally{S&&h.signal.removeEventListener("abort",S)}return n&&!n.dispatchConditionRejection&&s.match(R)&&R.meta.condition||g(R),R})();return Object.assign(T,{abort:I,requestId:y,arg:c,unwrap(){return T.then(sC)}})}}return Object.assign(a,{pending:i,rejected:s,fulfilled:o,settled:Gt(s,o),typePrefix:t})}return e.withTypes=()=>e,e})();function sC(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function aC(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var pm=Symbol.for("rtk-slice-createasyncthunk"),XD={[pm]:Ce};function cC(e,t){return`${e}/${t}`}function uC({creators:e}={}){let t=e?.asyncThunk?.[pm];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(dC()):n.reducers)||{},a=Object.keys(s),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(R,k){let _=typeof R=="string"?R:R.type;if(!_)throw new Error(ut(12));if(_ in c.sliceCaseReducersByType)throw new Error(ut(13));return c.sliceCaseReducersByType[_]=k,u},addMatcher(R,k){return c.sliceMatchers.push({matcher:R,reducer:k}),u},exposeAction(R,k){return c.actionCreators[R]=k,u},exposeCaseReducer(R,k){return c.sliceCaseReducersByName[R]=k,u}};a.forEach(R=>{let k=s[R],_={reducerName:R,type:cC(o,R),createNotation:typeof n.reducers=="function"};fC(k)?gC(_,k,u,t):pC(_,k,u)});function g(){let[R={},k=[],_=void 0]=typeof n.extraReducers=="function"?lm(n.extraReducers):[n.extraReducers],F={...R,...c.sliceCaseReducersByType};return Qe(n.initialState,V=>{for(let j in F)V.addCase(j,F[j]);for(let j of c.sliceMatchers)V.addMatcher(j.matcher,j.reducer);for(let j of k)V.addMatcher(j.matcher,j.reducer);_&&V.addDefaultCase(_)})}let v=R=>R,E=new Map,y=new WeakMap,h;function S(R,k){return h||(h=g()),h(R,k)}function w(){return h||(h=g()),h.getInitialState()}function I(R,k=!1){function _(V){let j=V[R];return typeof j>"u"&&k&&(j=xs(y,_,w)),j}function F(V=v){let j=xs(E,k,()=>new WeakMap);return xs(j,V,()=>{let L={};for(let[U,M]of Object.entries(n.selectors??{}))L[U]=lC(M,V,()=>xs(y,V,w),k);return L})}return{reducerPath:R,getSelectors:F,get selectors(){return F(_)},selectSlice:_}}let T={name:o,reducer:S,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:w,...I(i),injectInto(R,{reducerPath:k,..._}={}){let F=k??i;return R.inject({reducerPath:F,reducer:S},_),{...T,...I(F,!0)}}};return T}}function lC(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=uC();function dC(){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 pC({type:e,reducerName:t,createNotation:r},n,o){let i,s;if("reducer"in n){if(r&&!mC(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?G(e,s):G(e))}function fC(e){return e._reducerDefinitionType==="asyncThunk"}function mC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function gC({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||Es,pending:a||Es,rejected:c||Es,settled:u||Es})}function Es(){}var hC="task",fm="listener",mm="completed",ml="cancelled",yC=`task-${ml}`,vC=`task-${mm}`,pl=`${fm}-${ml}`,SC=`${fm}-${mm}`,Os=class{constructor(e){oe(this,"code");oe(this,"name","TaskAbortError");oe(this,"message");this.code=e,this.message=`${hC} ${ml} (reason: ${e})`}},gl=(e,t)=>{if(typeof e!="function")throw new TypeError(ut(32))},Is=()=>{},gm=(e,t=Is)=>(e.catch(t),e),hm=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),zr=e=>{if(e.aborted)throw new Os(e.reason)};function ym(e,t){let r=Is;return new Promise((n,o)=>{let i=()=>o(new Os(e.reason));if(e.aborted){i();return}r=hm(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=Is})}var AC=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof Os?"cancelled":"rejected",error:r}}finally{t?.()}});return function AC(_x5,_x6){return _ref5.apply(this,arguments)}}(),Rs=e=>t=>gm(ym(e,t).then(r=>(zr(e),r))),vm=e=>{let t=Rs(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Vn}=Object,im={},Ps="listenerMiddleware",bC=(e,t)=>{let r=n=>hm(e,()=>n.abort(e.reason));return(n,o)=>{gl(n,"taskExecutor");let i=new l.AbortController;r(i);let s=AC(/*#__PURE__*/_asyncToGenerator(function*(){zr(e),zr(i.signal);let a=yield n({pause:Rs(i.signal),delay:vm(i.signal),signal:i.signal});return zr(i.signal),a}),()=>i.abort(vC));return o?.autoJoin&&t.push(s.catch(Is)),{result:Rs(e)(s),cancel(){i.abort(yC)}}}},wC=(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,E)=>{E.unsubscribe(),c([v,E.getState(),E.getOriginalState()])}});i=()=>{g(),u()}})];o!=null&&a.push(new Promise(c=>setTimeout(c,o,null)));try{let c=yield ym(t,Promise.race(a));return zr(t),c}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>gm(r(n,o))},Sm=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=G(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 gl(i,"options.listener"),{predicate:o,type:t,effect:i}},Am=Vn(e=>{let{type:t,predicate:r,effect:n}=Sm(e);return{id:ii(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(ut(22))}}},{withTypes:()=>Am}),sm=(e,t)=>{let{type:r,effect:n,predicate:o}=Sm(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},fl=e=>{e.pending.forEach(t=>{t.abort(pl)})},CC=(e,t)=>()=>{for(let r of t.keys())fl(r);e.clear()},am=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},bm=Vn(G(`${Ps}/add`),{withTypes:()=>bm}),xC=G(`${Ps}/removeAll`),wm=Vn(G(`${Ps}/remove`),{withTypes:()=>wm}),EC=(...e)=>{console.error(`${Ps}/error`,...e)},Cm=(e={})=>{let t=new Map,r=new Map,n=y=>{let h=r.get(y)??0;r.set(y,h+1)},o=y=>{let h=r.get(y)??1;h===1?r.delete(y):r.set(y,h-1)},{extra:i,onError:s=EC}=e;gl(s,"onError");let a=y=>(y.unsubscribe=()=>t.delete(y.id),t.set(y.id,y),h=>{y.unsubscribe(),h?.cancelActive&&fl(y)}),c=y=>{let h=sm(t,y)??Am(y);return a(h)};Vn(c,{withTypes:()=>c});let u=y=>{let h=sm(t,y);return h&&(h.unsubscribe(),y.cancelActive&&fl(h)),!!h};Vn(u,{withTypes:()=>u});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(y,h,S,w){let I=new l.AbortController,T=wC(c,I.signal),R=[];try{y.pending.add(I),n(y),yield Promise.resolve(y.effect(h,Vn({},S,{getOriginalState:w,condition:(k,_)=>T(k,_).then(Boolean),take:T,delay:vm(I.signal),pause:Rs(I.signal),extra:i,signal:I.signal,fork:bC(I.signal,R),unsubscribe:y.unsubscribe,subscribe:()=>{t.set(y.id,y)},cancelActiveListeners:()=>{y.pending.forEach((k,_,F)=>{k!==I&&(k.abort(pl),F.delete(k))})},cancel:()=>{I.abort(pl),y.pending.delete(I)},throwIfCancelled:()=>{zr(I.signal)}})))}catch(k){k instanceof Os||am(s,k,{raisedBy:"effect"})}finally{yield Promise.all(R),I.abort(SC),o(y),y.pending.delete(I)}});return function g(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),v=CC(t,r);return{middleware:y=>h=>S=>{if(!Go(S))return h(S);if(bm.match(S))return c(S.payload);if(xC.match(S)){v();return}if(wm.match(S))return u(S.payload);let w=y.getState(),I=()=>{if(w===im)throw new Error(ut(23));return w},T;try{if(T=h(S),t.size>0){let R=y.getState(),k=Array.from(t.values());for(let _ of k){let F=!1;try{F=_.predicate(S,R,w)}catch(V){F=!1,am(s,V,{raisedBy:"predicate"})}F&&g(_,S,y,I)}}}finally{w=im}return T},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}),uM=new re({required:!1,emptyAllowed:!0}),xm=new Ft({each:ee,required:!0}),Em=new re({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Im=new re({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),lM=new re({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),IC=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),hl=(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 $u(o);return{payload:e}},W=(e,t)=>{try{return hl(e,t)}catch(r){return{payload:e,error:IC(r)}}};var Ns=(e,t,r,n)=>{let o=`Check the options of ${n}`;return RC(e,t,r,o,"Controller initialization error")},RC=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};var Fs=G("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 Rm=()=>({caseAssistId:"",locale:"en-US"});var vr=Qe(Rm(),e=>{e.addCase(Fs,(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 Tm={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 Ds=G("searchParameters/restore",e=>W(e,Tm)),_m=G("searchParameters/restoreTab",e=>W(e,ee));m();d();f();p();var km=G("debug/enable"),Om=G("debug/disable");m();d();f();p();var Ms=()=>!1;var Pm=Qe(Ms(),e=>{e.addCase(km,()=>!0).addCase(Om,()=>!1).addCase(Ds,(t,r)=>r.payload.debug??t)});m();d();f();p();var Ls=G("searchHub/set",e=>W(e,new re({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var $n="3.55.2",Nm=["@coveo/atomic","@coveo/quantic"];var yl=()=>He,Fm=()=>ee,Qn=G("configuration/updateBasicConfiguration",e=>W(e,{accessToken:He,environment:new re({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:He})),js=G("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})})),TC={enabled:new je({default:!0}),originContext:yl(),originLevel2:yl(),originLevel3:yl(),proxyBaseUrl:new re({required:!1,url:!0}),runtimeEnvironment:new Vr,anonymous:new je({default:!1}),deviceId:He,userDisplayName:He,documentLocation:He,trackingId:Im,analyticsMode:new re({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new xe({options:{required:!1},values:Nm.reduce((e,t)=>(e[t]=Em,e),{})})},qs=G("configuration/updateAnalyticsConfiguration",e=>W(e,TC)),Us=G("configuration/analytics/disable"),Vs=G("configuration/analytics/enable"),Dm=G("configuration/analytics/originlevel2",e=>W(e,{originLevel2:Fm()})),Mm=G("configuration/analytics/originlevel3",e=>W(e,{originLevel3:Fm()})),Lm=G("knowledge/setAgentId",e=>W(e,new re({required:!0})));m();d();f();p();var _C=G("history/undo"),kC=G("history/redo"),Bt=G("history/snapshot"),UL=Ce("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(_C()),yield t(Gs())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),VL=Ce("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(kC()),yield t(Gs())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),Gs=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 Hn=()=>"default";var jm=Qe(Hn(),e=>{e.addCase(Ls,(t,r)=>r.payload).addCase(Gs.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(js,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function qm(){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 Um=/^(?:[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 OC(e){return typeof e=="string"&&Um.test(e)}var vl=OC;m();d();f();p();var Je=[];for(let e=0;e<256;++e)Je.push((e+256).toString(16).slice(1));function Vm(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 PC=new Uint8Array(16);function Sl(){return crypto.getRandomValues(PC)}m();d();f();p();function NC(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():FC(e,t,r)}function FC(e,t,r){e=e||{};let n=e.random??e.rng?.()??Sl();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 Vm(n)}var Al=NC;function DC(_x17){return _DC.apply(this,arguments)}function _DC(){_DC=_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 _DC.apply(this,arguments)}var zm="2.1.3",bl=128,Wm=192,Gm=224,Bm=240,MC=248;function LC(e){return(e&MC)===Bm?4:(e&Bm)===Gm?3:(e&Gm)===Wm?2:1}function jC(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&bl)!=bl)break;if(r-=3,(n&Wm)!=bl){t-r>=LC(n)*3&&(r=t);break}}return e.substring(0,r)}function qC(e){let{trackingId:t}=e;return{trackingId:t}}function UC(e){return(e.source||[]).concat([`relay@${zm}`])}function Km(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:UC(t),clientId:a,userAgent:i(),referrer:$m(n()),location:$m(o())})}function $m(e){return e!==null?jC(e,1024):null}function VC(e,t,r,n){return{...t,meta:Km(e,r,n)}}var GC="*";function BC(){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===GC)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 Qm({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 $C(e){let t=Qm(e);return{get:()=>t,update:r=>{t=Qm({...t,...r})}}}var wl=QC();function QC(){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 HC(){return{getItem(e){return wl.getItem(e)||localStorage.getItem(e)},removeItem(e){wl.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),wl.setItem(e,t,31556952e3)}}}var Hm="visitorId";function zC(){let e=document.referrer;return e===""?null:e}function Cl(){let e=HC();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}`}});qm().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:()=>zC(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(Hm);if(t&&vl(t))return t;let r=Al();return e.setItem(Hm,r),r}}}function WC(){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 KC(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function YC(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=KC();return t&&r?{...r,runtime:"custom"}:t&&XC()&&WC()?Cl():n}function XC(){try{return typeof window=="object"}catch{return!1}}function ZC(e){return{get:()=>Object.freeze(YC(e))}}function Ym(e){let t=$C(e),r=BC(),n=ZC(t);return{emit:function(){var _ref11=_asyncToGenerator(function*(o,i){let s=t.get(),a=n.get(),c=VC(o,i,s,a);return DC({config:s,environment:a,event:c,listenerManager:r})});return function emit(_x21,_x22){return _ref11.apply(this,arguments)}}(),getMeta:o=>Km(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 Xm(){return typeof window<"u"&&typeof document<"u"}m();d();f();p();var zn=Ue(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${$n}`));var si=Ue(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>zn(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},s,a)=>{let c=ex(a);return Ym({mode:i?"emit":"disabled",url:o??rs(e,t),token:r,trackingId:n??null,source:s,environment:c})}),JC={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref12=_asyncToGenerator(function*(){});return function send(){return _ref12.apply(this,arguments)}}()},ex=e=>{if(!e)return;let t=e();return{...(Xm()?Cl():JC),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 Zm=class extends Error{constructor(t){super(t[0].message);oe(this,"issues");this.name="SchemaError",this.issues=t}};var ar="uninitialized",Il="pending",ci="fulfilled",ui="rejected";function Jm(e){return{status:e,isUninitialized:e===ar,isLoading:e===Il,isSuccess:e===ci,isError:e===ui}}var eg=Vt;function mg(e,t){if(e===t||!(eg(e)&&eg(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]=mg(e[s],t[s]),o&&(o=e[s]===i[s]);return o?e:i}function Rl(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function tx(e){return new RegExp("(^|:)//").test(e)}function rx(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Ol(e){return e!=null}function tg(e){return[...(e?.values()??[])].filter(Ol)}function nx(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var ox=e=>e.replace(/\/$/,""),ix=e=>e.replace(/^\//,"");function sx(e,t){if(!e)return t;if(!t)return e;if(tx(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=ox(e),t=ix(t),`${e}${r}${t}`}function Qs(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var Tl=()=>new Map,ax=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},cx=(...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},rg=(...e)=>C(...e),ux=e=>e.status>=200&&e.status<=299,lx=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function ng(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 dx=e=>typeof e=="object"&&(Vt(e)||Array.isArray(e)||typeof e.toJSON=="function");function gg({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=rg,paramsSerializer:n,isJsonContentType:o=lx,jsonContentType:i="application/json",jsonReplacer:s,timeout:a,responseHandler:c,validateStatus:u,...g}={}){return typeof C>"u"&&r===rg&&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*(E,y,h){let{getState:S,extra:w,endpoint:I,forced:T,type:R}=y,k,{url:_,headers:F=new x(g.headers),params:V=void 0,responseHandler:j=c??"json",validateStatus:L=u??ux,timeout:U=a,...M}=typeof E=="string"?{url:E}:E,O={...g,signal:U?cx(y.signal,ax(U)):y.signal,...M};F=new x(ng(F)),O.headers=(yield t(F,{getState:S,arg:E,extra:w,endpoint:I,forced:T,type:R,extraOptions:h}))||F;let P=dx(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")||(j==="json"?O.headers.set("accept","application/json"):j==="text"&&O.headers.set("accept","text/plain, text/html, */*")),V){let J=~_.indexOf("?")?"&":"?",se=n?n(V):new URLSearchParams(ng(V));_+=J+se}_=sx(e,_);let N=new Request(_,O);k={request:new Request(_,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:k}}let Y=$.clone();k.response=Y;let K,H="";try{let J;if(yield Promise.all([v($,j).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:k}}return L($,K)?{data:K,meta:k}:{error:{status:$.status,data:K},meta:k}});return function(_x23,_x24,_x25){return _ref13.apply(this,arguments)}}());function v(_x26,_x27){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(E,y){if(typeof y=="function")return y(E);if(y==="content-type"&&(y=o(E.headers)?"json":"text"),y==="json"){let h=yield E.text();return h.length?JSON.parse(h):null}return E.text()});return _v2.apply(this,arguments)}}var Wn=class{constructor(e,t=void 0){oe(this,"value");oe(this,"meta");this.value=e,this.meta=t}};function px(){return _px.apply(this,arguments)}function _px(){_px=_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 _px.apply(this,arguments)}function hg(e,t){throw Object.assign(new Wn({error:e,meta:t}),{throwImmediately:!0})}function xl(e){e.aborted&&hg({status:"CUSTOM_ERROR",error:"Aborted"})}var og={},fx=(e,t)=>(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(r,n,o){let i=[5,(t||og).maxRetries,(o||og).maxRetries].filter(g=>g!==void 0),[s]=i.slice(-1),c={maxRetries:s,backoff:px,retryCondition:(g,v,{attempt:E})=>E<=s,...t,...o},u=0;for(;;){xl(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Wn(g);return g}catch(g){if(u++,g.throwImmediately){if(g instanceof Wn)return g.value;throw g}if(g instanceof Wn){if(!c.retryCondition(g.value.error,r,{attempt:u,baseQueryApi:n,extraOptions:o}))return g.value}else if(u>c.maxRetries)return{error:g};xl(n.signal);try{yield c.backoff(u,c.maxRetries,n.signal)}catch(v){throw xl(n.signal),v}}}});return function(_x28,_x29,_x30){return _ref14.apply(this,arguments)}}()),yg=Object.assign(fx,{fail:hg}),zs="__rtkq/",mx="online",gx="offline";var vg="focused";var Pl=G(`${zs}${vg}`),Sg=G(`${zs}un${vg}`),Nl=G(`${zs}${mx}`),Ag=G(`${zs}${gx}`);var pi="query",bg="mutation",wg="infinitequery";function Ws(e){return e.type===pi}function hx(e){return e.type===bg}function Ks(e){return e.type===wg}function Hs(e){return Ws(e)||Ks(e)}function Fl(e,t,r,n,o,i){let s=yx(e)?e(t,r,n,o):e;return s?Rl(s,Ol,a=>i(Cg(a))):[]}function yx(e){return typeof e=="function"}function Cg(e){return typeof e=="string"?{type:e}:e}function vx(e,t){return e.catch(t)}var Kn=(e,t)=>e.endpointDefinitions[t],li=Symbol("forceQueryFn"),_l=e=>typeof e[li]=="function";function Sx({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:s}){let a=_=>s(_)?.runningQueries,c=_=>s(_)?.runningMutations,{unsubscribeQueryResult:u,removeMutationResult:g,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:T,buildInitiateInfiniteQuery:R,buildInitiateMutation:k,getRunningQueryThunk:E,getRunningMutationThunk:y,getRunningQueriesThunk:h,getRunningMutationsThunk:S};function E(_,F){return V=>{let j=Kn(i,_),L=e({queryArgs:F,endpointDefinition:j,endpointName:_});return a(V)?.get(L)}}function y(_,F){return V=>c(V)?.get(F)}function h(){return _=>tg(a(_))}function S(){return _=>tg(c(_))}function w(_){}function I(_,F){let V=(j,{subscribe:L=!0,forceRefetch:U,subscriptionOptions:M,[li]:O,...P}={})=>(N,Q)=>{let $=e({queryArgs:j,endpointDefinition:F,endpointName:_}),Y,K={...P,type:pi,subscribe:L,forceRefetch:U,subscriptionOptions:M,endpointName:_,originalArgs:j,queryCacheKey:$,[li]:O};if(Ws(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[_].select(j),J=N(Y),se=H(Q());let{requestId:be,abort:Ne}=J,Ie=se.requestId!==be,_e=a(N)?.get($),ke=()=>H(Q()),pe=Object.assign(O?J.then(ke):Ie&&!_e?Promise.resolve(se):Promise.all([_e,J]).then(ke),{arg:j,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(j,{subscribe:!1,forceRefetch:!0,...de})),unsubscribe(){L&&N(u({queryCacheKey:$,requestId:be}))},updateSubscriptionOptions(de){pe.subscriptionOptions=de,N(v({endpointName:_,requestId:be,queryCacheKey:$,options:de}))}});if(!_e&&!Ie&&!O){let de=a(N);de.set($,pe),pe.then(()=>{de.delete($)})}return pe};return V}function T(_,F){return I(_,F)}function R(_,F){return I(_,F)}function k(_){return(F,{track:V=!0,fixedCacheKey:j}={})=>(L,U)=>{let M=n({type:"mutation",endpointName:_,originalArgs:F,track:V,fixedCacheKey:j}),O=L(M);let{requestId:P,abort:N,unwrap:Q}=O,$=vx(O.unwrap().then(J=>({data:J})),J=>({error:J})),Y=()=>{L(g({requestId:P,fixedCacheKey:j}))},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)}),j&&(H.set(j,K),K.then(()=>{H.get(j)===K&&H.delete(j)})),K}}}var xg=class extends Zm{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 xg(o.issues,t,r,n);return o.value});return _Xr.apply(this,arguments)}function ig(e){return e}var ai=(e={})=>({...e,[ri]:!0});function Ax({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=Fl(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 E(M,O,P=0){let N=[...M,O];return P&&N.length>P?N.slice(1):N}let y=(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]=ul(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},h=(M,O,P)=>N=>N(o.endpoints[M].initiate(O,{subscribe:!1,forceRefetch:!0,[li]:()=>({data:P})})),S=(M,O)=>M.query&&M[O]?M[O]:ig,w=/*#__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===pi;try{let Ne=ig,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},_e=be?M[li]:void 0,ke,pe=/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(he,fe,Ge,ze){if(fe==null&&he.pages.length)return Promise.resolve({data:he});let kt={queryArg:M.originalArgs,pageParam:fe},gt=yield de(kt),Ut=ze?v:E;return{data:{pages:Ut(he.pages,gt.data,Ge),pageParams:Ut(he.pageParams,fe,Ge)},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:Ge,argSchema:ze,rawResponseSchema:kt,responseSchema:gt}=H;if(ze&&!Yr(se,"arg")&&(he=yield Xr(ze,he,"argSchema",{})),_e?fe=_e():H.query?(Ne=S(H,"transformResponse"),fe=yield t(H.query(he),Ie,Ge)):fe=yield H.queryFn(he,Ie,Ge,Ot=>t(Ot,Ie,Ge)),typeof process<"u",fe.error)throw new Wn(fe.error,fe.meta);let{data:Ut}=fe;kt&&!Yr(se,"rawResponse")&&(Ut=yield Xr(kt,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,Ge=M.refetchCachedPages??he.refetchCachedPages??!0,ze,kt={pages:[],pageParams:[]},gt=s.selectQueryEntry(Y(),M.queryCacheKey)?.data,bt=I(M,Y())&&!M.direction||!gt?kt:gt;if("direction"in M&&M.direction&&bt.pages.length){let Ot=M.direction==="backward",Wi=(Ot?Eg:kl)(he,bt,M.originalArgs);ze=yield pe(bt,Wi,fe,Ot)}else{let{initialPageParam:Ot=he.initialPageParam}=M,No=gt?.pageParams??[],Wi=No[0]??Ot,JA=No.length;if(ze=yield pe(bt,Wi,fe),_e&&(ze={data:ze.data.pages[0]}),Ge)for(let $p=1;$p<JA;$p++){let eb=kl(he,ze.data,M.originalArgs);ze=yield pe(ze.data,eb,fe)}}ke=ze}else ke=yield de(M.originalArgs);return J&&!Yr(se,"meta")&&ke.meta&&(ke.meta=yield Xr(J,ke.meta,"metaSchema",ke.meta)),Q(ke.data,ai({fulfilledTimeStamp:Date.now(),baseQueryMeta:ke.meta}))}catch(Ne){let Ie=Ne;if(Ie instanceof Wn){let _e=S(H,"transformErrorResponse"),{rawErrorResponseSchema:ke,errorResponseSchema:pe}=H,{value:de,meta:he}=Ie;try{ke&&!Yr(se,"rawErrorResponse")&&(de=yield Xr(ke,de,"rawErrorResponseSchema",he)),J&&!Yr(se,"meta")&&(he=yield Xr(J,he,"metaSchema",he));let fe=yield _e(de,he,M.originalArgs);return pe&&!Yr(se,"errorResponse")&&(fe=yield Xr(pe,fe,"errorResponseSchema",he)),N(fe,ai({baseQueryMeta:he}))}catch(fe){Ie=fe}}try{if(Ie instanceof xg){let _e={endpoint:M.endpointName,arg:M.originalArgs,type:M.type,queryCacheKey:be?M.queryCacheKey:void 0};H.onSchemaFailure?.(Ie,_e),a?.(Ie,_e);let{catchSchemaFailure:ke=c}=H;if(ke)return N(ke(Ie,_e),ai({baseQueryMeta:Ie._bqMeta}))}}catch(_e){Ie=_e}throw typeof process<"u",console.error(Ie),Ie}});return function w(_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 T=()=>Ce(`${e}/executeQuery`,w,{getPendingMeta({arg:O}){let P=r[O.endpointName];return ai({startedTimeStamp:Date.now(),...(Ks(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 _l(O)?!0:Q?.status==="pending"?!1:I(O,N)||Ws(H)&&H?.forceRefetch?.({currentArg:Y,previousArg:K,endpointState:Q,state:N})?!0:!($&&!J)},dispatchConditionRejection:!0}),R=T(),k=T(),_=Ce(`${e}/executeMutation`,w,{getPendingMeta(){return ai({startedTimeStamp:Date.now()})}}),F=M=>"force"in M,V=M=>"ifOlderThan"in M,j=(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 U(M,O){return{matchPending:Gn(_s(M),L(O)),matchFulfilled:Gn(ir(M),L(O)),matchRejected:Gn(Wr(M),L(O))}}return{queryThunk:R,mutationThunk:_,infiniteQueryThunk:k,prefetch:j,updateQueryData:y,upsertQueryData:h,patchQueryData:g,buildMatchThunkActions:U}}function kl(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function Eg(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function Ig(e,t,r,n){return Fl(r[e.meta.arg.endpointName][t],ir(e)?e.payload:void 0,oi(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function sg(e){return ct(e)?ws(e):e}function Bs(e,t,r){let n=e[t];n&&r(n)}function di(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function ag(e,t,r){let n=e[di(t)];n&&r(n)}var $s={};function bx({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:s,hasRehydrationInfo:a},assertTagType:c,config:u}){let g=G(`${e}/resetApiState`);function v(L,U,M,O){var P;L[P=U.queryCacheKey]??(L[P]={status:ar,endpointName:U.endpointName}),Bs(L,U.queryCacheKey,N=>{N.status=Il,N.requestId=M&&N.requestId?N.requestId:O.requestId,U.originalArgs!==void 0&&(N.originalArgs=U.originalArgs),N.startedTimeStamp=O.startedTimeStamp;let Q=o[O.arg.endpointName];Ks(Q)&&"direction"in U&&(N.direction=U.direction)})}function E(L,U,M,O){Bs(L,U.arg.queryCacheKey,P=>{if(P.requestId!==U.requestId&&!O)return;let{merge:N}=o[U.arg.endpointName];if(P.status=ci,N){if(P.data!==void 0){let{fulfilledTimeStamp:Q,arg:$,baseQueryMeta:Y,requestId:K}=U,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[U.arg.endpointName].structuralSharing??!0?mg(ct(P.data)?Vf(P.data):P.data,M):M;delete P.error,P.fulfilledTimeStamp=U.fulfilledTimeStamp})}let y=Kr({name:`${e}/queries`,initialState:$s,reducers:{removeQueryResult:{reducer(L,{payload:{queryCacheKey:U}}){delete L[U]},prepare:Bn()},cacheEntriesUpserted:{reducer(L,U){for(let M of U.payload){let{queryDescription:O,value:P}=M;v(L,O,!0,{arg:O,requestId:U.meta.requestId,startedTimeStamp:U.meta.timestamp}),E(L,{arg:O,requestId:U.meta.requestId,fulfilledTimeStamp:U.meta.timestamp,baseQueryMeta:{}},P,!0)}},prepare:L=>({payload:L.map(O=>{let{endpointName:P,arg:N,value:Q}=O,$=o[P];return{queryDescription:{type:pi,endpointName:P,originalArgs:O.arg,queryCacheKey:n({queryArgs:N,endpointDefinition:$,endpointName:P})},value:Q}}),meta:{[ri]:!0,requestId:ii(),timestamp:Date.now()}})},queryResultPatched:{reducer(L,{payload:{queryCacheKey:U,patches:M}}){Bs(L,U,O=>{O.data=ll(O.data,M.concat())})},prepare:Bn()}},extraReducers(L){L.addCase(t.pending,(U,{meta:M,meta:{arg:O}})=>{let P=_l(O);v(U,O,P,M)}).addCase(t.fulfilled,(U,{meta:M,payload:O})=>{let P=_l(M.arg);E(U,M,O,P)}).addCase(t.rejected,(U,{meta:{condition:M,arg:O,requestId:P},error:N,payload:Q})=>{Bs(U,O.queryCacheKey,$=>{if(!M){if($.requestId!==P)return;$.status=ui,$.error=Q??N}})}).addMatcher(a,(U,M)=>{let{queries:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===ci||N?.status===ui)&&(U[P]=N)})}}),h=Kr({name:`${e}/mutations`,initialState:$s,reducers:{removeMutationResult:{reducer(L,{payload:U}){let M=di(U);M in L&&delete L[M]},prepare:Bn()}},extraReducers(L){L.addCase(r.pending,(U,{meta:M,meta:{requestId:O,arg:P,startedTimeStamp:N}})=>{P.track&&(U[di(M)]={requestId:O,status:Il,endpointName:P.endpointName,startedTimeStamp:N})}).addCase(r.fulfilled,(U,{payload:M,meta:O})=>{O.arg.track&&ag(U,O,P=>{P.requestId===O.requestId&&(P.status=ci,P.data=M,P.fulfilledTimeStamp=O.fulfilledTimeStamp)})}).addCase(r.rejected,(U,{payload:M,error:O,meta:P})=>{P.arg.track&&ag(U,P,N=>{N.requestId===P.requestId&&(N.status=ui,N.error=M??O)})}).addMatcher(a,(U,M)=>{let{mutations:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===ci||N?.status===ui)&&P!==N?.requestId&&(U[P]=N)})}}),S={tags:{},keys:{}},w=Kr({name:`${e}/invalidation`,initialState:S,reducers:{updateProvidedBy:{reducer(L,U){var M,O,P;for(let{queryCacheKey:N,providedTags:Q}of U.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:Bn()}},extraReducers(L){L.addCase(y.actions.removeQueryResult,(U,{payload:{queryCacheKey:M}})=>{I(U,M)}).addMatcher(a,(U,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=U.tags)[$]??(P[$]={}))[Q=K||"__internal_without_id"]??(N[Q]=[]);for(let se of H)J.includes(se)||J.push(se),U.keys[se]=O.keys[se]}}).addMatcher(Gt(ir(t),oi(t)),(U,M)=>{T(U,[M])}).addMatcher(y.actions.cacheEntriesUpserted.match,(U,M)=>{let O=M.payload.map(({queryDescription:P,value:N})=>({type:"UNKNOWN",payload:N,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:P}}));T(U,O)})}});function I(L,U){let M=sg(L.keys[U]??[]);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]=sg(Q).filter($=>$!==U))}delete L.keys[U]}function T(L,U){let M=U.map(O=>{let P=Ig(O,"providesTags",o,c),{queryCacheKey:N}=O.meta.arg;return{queryCacheKey:N,providedTags:P}});w.caseReducers.updateProvidedBy(L,w.actions.updateProvidedBy(M))}let R=Kr({name:`${e}/subscriptions`,initialState:$s,reducers:{updateSubscriptionOptions(L,U){},unsubscribeQueryResult(L,U){},internal_getRTKQSubscriptions(){}}}),k=Kr({name:`${e}/internalSubscriptions`,initialState:$s,reducers:{subscriptionsUpdated:{reducer(L,U){return ll(L,U.payload)},prepare:Bn()}}}),_=Kr({name:`${e}/config`,initialState:{online:nx(),focused:rx(),middlewareRegistered:!1,...u},reducers:{middlewareRegistered(L,{payload:U}){L.middlewareRegistered=L.middlewareRegistered==="conflict"||i!==U?"conflict":!0}},extraReducers:L=>{L.addCase(Nl,U=>{U.online=!0}).addCase(Ag,U=>{U.online=!1}).addCase(Pl,U=>{U.focused=!0}).addCase(Sg,U=>{U.focused=!1}).addMatcher(a,U=>({...U}))}}),F=jn({queries:y.reducer,mutations:h.reducer,provided:w.reducer,subscriptions:k.reducer,config:_.reducer}),V=(L,U)=>F(g.match(U)?void 0:L,U),j={..._.actions,...y.actions,...R.actions,...k.actions,...h.actions,...w.actions,resetApiState:g};return{reducer:V,actions:j}}var El=Symbol.for("RTKQ/skipToken"),Rg={status:ar},cg=Hr(Rg,()=>{}),ug=Hr(Rg,()=>{});function wx({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=R=>cg,o=R=>ug;return{buildQuerySelector:E,buildInfiniteQuerySelector:y,buildMutationSelector:h,selectInvalidatedBy:S,selectCachedArgsForQuery:w,selectApiState:s,selectQueries:a,selectMutations:u,selectQueryEntry:c,selectConfig:g};function i(R){return{...R,...Jm(R.status)}}function s(R){return R[t]}function a(R){return s(R)?.queries}function c(R,k){return a(R)?.[k]}function u(R){return s(R)?.mutations}function g(R){return s(R)?.config}function v(R,k,_){return F=>{if(F===El)return r(n,_);let V=e({queryArgs:F,endpointDefinition:k,endpointName:R});return r(L=>c(L,V)??cg,_)}}function E(R,k){return v(R,k,i)}function y(R,k){let{infiniteQueryOptions:_}=k;function F(V){let j={...V,...Jm(V.status)},{isLoading:L,isError:U,direction:M}=j,O=M==="forward",P=M==="backward";return{...j,hasNextPage:I(_,j.data,j.originalArgs),hasPreviousPage:T(_,j.data,j.originalArgs),isFetchingNextPage:L&&O,isFetchingPreviousPage:L&&P,isFetchNextPageError:U&&O,isFetchPreviousPageError:U&&P}}return v(R,k,F)}function h(){return R=>{let k;return typeof R=="object"?k=di(R)??El:k=R,r(k===El?o:V=>s(V)?.mutations?.[k]??ug,i)}}function S(R,k){let _=R[t],F=new Set,V=Rl(k,Ol,Cg);for(let j of V){let L=_.provided.tags[j.type];if(!L)continue;let U=(j.id!==void 0?L[j.id]:Object.values(L).flat())??[];for(let M of U)F.add(M)}return Array.from(F.values()).flatMap(j=>{let L=_.queries[j];return L?{queryCacheKey:j,endpointName:L.endpointName,originalArgs:L.originalArgs}:[]})}function w(R,k){return Rl(Object.values(a(R)),_=>_?.endpointName===k&&_.status!==ar,_=>_.originalArgs)}function I(R,k,_){return k?kl(R,k,_)!=null:!1}function T(R,k,_){return!k||!R.getPreviousPageParam?!1:Eg(R,k,_)!=null}}var lg=WeakMap?new WeakMap:void 0,dg=({endpointName:e,queryArgs:t})=>{let r="",n=lg?.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)&&lg?.set(t,o),r=o}return`${e}(${r})`};function Cx(...e){return function(r){let n=ei(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=dg;if("serializeQueryArgs"in u.endpointDefinition){let v=u.endpointDefinition.serializeQueryArgs;g=E=>{let y=v(E);return typeof y=="string"?y:dg({...E,queryArgs:y})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(u)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(u){u()},apiUid:ii(),extractRehydrationInfo:n,hasRehydrationInfo:ei(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,E]of Object.entries(g))typeof E=="function"?E(Kn(i,v)):Object.assign(Kn(i,v)||{},E);return s}},a=e.map(u=>u.init(s,o,i));function c(u){let g=u.endpoints({query:v=>({...v,type:pi}),mutation:v=>({...v,type:bg}),infiniteQuery:v=>({...v,type:wg})});for(let[v,E]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]=E;for(let y of a)y.injectEndpoint(v,E)}return s}return s.injectEndpoints({endpoints:r.endpoints})}}function sr(e,...t){return Object.assign(e,...t)}var xx=({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,w)=>{if(a.match(w)){let{queryCacheKey:T,requestId:R,options:k}=w.payload,_=S.get(T);return _?.has(R)&&_.set(R,k),!0}if(c.match(w)){let{queryCacheKey:T,requestId:R}=w.payload,k=S.get(T);return k&&k.delete(R),!0}if(e.internalActions.removeQueryResult.match(w))return S.delete(w.payload.queryCacheKey),!0;if(t.pending.match(w)){let{meta:{arg:T,requestId:R}}=w,k=Qs(S,T.queryCacheKey,Tl);return T.subscribe&&k.set(R,T.subscriptionOptions??k.get(R)??{}),!0}let I=!1;if(t.rejected.match(w)){let{meta:{condition:T,arg:R,requestId:k}}=w;if(T&&R.subscribe){let _=Qs(S,R.queryCacheKey,Tl);_.set(k,R.subscriptionOptions??_.get(k)??{}),I=!0}}return I},g=()=>r.currentSubscriptions,y={getSubscriptions:g,getSubscriptionCount:S=>g().get(S)?.size??0,isRequestSubscribed:(S,w)=>!!g()?.get(S)?.get(w)};function h(S){return JSON.parse(JSON.stringify(Object.fromEntries([...S].map(([w,I])=>[w,Object.fromEntries(I)]))))}return(S,w)=>{if(i||(i=h(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,y];let I=u(r.currentSubscriptions,S),T=!0;if(I){s||(s=setTimeout(()=>{let _=h(r.currentSubscriptions),[,F]=ul(i,()=>_);w.next(e.internalActions.subscriptionsUpdated(F)),i=_,s=null},500));let R=typeof S.type=="string"&&!!S.type.startsWith(o),k=t.rejected.match(S)&&S.meta.condition&&!!S.meta.arg.subscribe;T=!R&&!k}return[T,!1]}},Ex=2147483647/1e3-1,Ix=({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,E=Gt(g.match,r.fulfilled,r.rejected,v.match);function y(R){let k=o.currentSubscriptions.get(R);return k?k.size>0:!1}let h={};function S(R){for(let k of R.values())k?.abort?.()}let w=(R,k)=>{let _=k.getState(),F=s(_);if(E(R)){let V;if(v.match(R))V=R.payload.map(j=>j.queryDescription.queryCacheKey);else{let{queryCacheKey:j}=g.match(R)?R.payload:R.meta.arg;V=[j]}I(V,k,F)}if(t.util.resetApiState.match(R)){for(let[V,j]of Object.entries(h))j&&clearTimeout(j),delete h[V];S(o.runningQueries),S(o.runningMutations)}if(n.hasRehydrationInfo(R)){let{queries:V}=n.extractRehydrationInfo(R);I(Object.keys(V),k,F)}};function I(R,k,_){let F=k.getState();for(let V of R){let j=i(F,V);j?.endpointName&&T(V,j.endpointName,k,_)}}function T(R,k,_,F){let j=Kn(n,k)?.keepUnusedDataFor??F.keepUnusedDataFor;if(j===1/0)return;let L=Math.max(0,Math.min(j,Ex));if(!y(R)){let U=h[R];U&&clearTimeout(U),h[R]=setTimeout(()=>{if(!y(R)){let M=i(_.getState(),R);M?.endpointName&&_.dispatch(a(M.endpointName,M.originalArgs))?.abort(),_.dispatch(u({queryCacheKey:R}))}delete h[R]},L*1e3)}}return w},pg=new Error("Promise never resolved before cacheEntryRemoved."),Rx=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:s,selectApiState:a}})=>{let c=ks(n),u=ks(o),g=ir(n,o),v={},{removeQueryResult:E,removeMutationResult:y,cacheEntriesUpserted:h}=e.internalActions;function S(_,F,V){let j=v[_];j?.valueResolved&&(j.valueResolved({data:F,meta:V}),delete j.valueResolved)}function w(_){let F=v[_];F&&(delete v[_],F.cacheEntryRemoved())}function I(_){let{arg:F,requestId:V}=_.meta,{endpointName:j,originalArgs:L}=F;return[j,L,V]}let T=(_,F,V)=>{let j=R(_);function L(U,M,O,P){let N=s(V,M),Q=s(F.getState(),M);!N&&Q&&k(U,P,M,F,O)}if(n.pending.match(_)){let[U,M,O]=I(_);L(U,j,O,M)}else if(h.match(_))for(let{queryDescription:U,value:M}of _.payload){let{endpointName:O,originalArgs:P,queryCacheKey:N}=U;L(O,N,_.meta.requestId,P),S(N,M,{})}else if(o.pending.match(_)){if(F.getState()[t].mutations[j]){let[M,O,P]=I(_);k(M,O,j,F,P)}}else if(g(_))S(j,_.payload,_.meta.baseQueryMeta);else if(E.match(_)||y.match(_))w(j);else if(e.util.resetApiState.match(_))for(let U of Object.keys(v))w(U)};function R(_){return c(_)?_.meta.arg.queryCacheKey:u(_)?_.meta.arg.fixedCacheKey??_.meta.requestId:E.match(_)?_.payload.queryCacheKey:y.match(_)?di(_.payload):""}function k(_,F,V,j,L){let U=Kn(r,_),M=U?.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 pg})]);N.catch(()=>{}),v[V]=O;let Q=e.endpoints[_].select(Hs(U)?F:V),$=j.dispatch((H,J,se)=>se),Y={...j,getCacheEntry:()=>Q(j.getState()),requestId:L,extra:$,updateCachedData:Hs(U)?H=>j.dispatch(e.util.updateQueryData(_,F,H)):void 0,cacheDataLoaded:N,cacheEntryRemoved:P},K=M(F,Y);Promise.resolve(K).catch(H=>{if(H!==pg)throw H})}return T},Tx=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},_x=({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=Gt(ir(n),oi(n)),v=Gt(ir(o,n),Wr(o,n)),E=[],y=0,h=(I,T)=>{(o.pending.match(I)||n.pending.match(I))&&y++,v(I)&&(y=Math.max(0,y-1)),g(I)?w(Ig(I,"invalidatesTags",r,s),T):v(I)?w([],T):i.util.invalidateTags.match(I)&&w(Fl(I.payload,void 0,void 0,void 0,void 0,s),T)};function S(){return y>0}function w(I,T){let R=T.getState(),k=R[e];if(E.push(...I),k.config.invalidationBehavior==="delayed"&&S())return;let _=E;if(E=[],_.length===0)return;let F=i.util.selectInvalidatedBy(R,_);t.batch(()=>{let V=Array.from(F.values());for(let{queryCacheKey:j}of V){let L=k.queries[j],U=Qs(c.currentSubscriptions,j,Tl);L&&(U.size===0?T.dispatch(u({queryCacheKey:j})):L.status!==ar&&T.dispatch(a(L)))}})}return h},kx=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:s}=o,a=new Set,c=null,u=(w,I)=>{(r.internalActions.updateSubscriptionOptions.match(w)||r.internalActions.unsubscribeQueryResult.match(w))&&g(w.payload.queryCacheKey,I),(t.pending.match(w)||t.rejected.match(w)&&w.meta.condition)&&g(w.meta.arg.queryCacheKey,I),(t.fulfilled.match(w)||t.rejected.match(w)&&!w.meta.condition)&&v(w.meta.arg,I),r.util.resetApiState.match(w)&&(h(),c&&(clearTimeout(c),c=null),a.clear())};function g(w,I){a.add(w),c||(c=setTimeout(()=>{for(let T of a)E({queryCacheKey:T},I);a.clear(),c=null},0))}function v({queryCacheKey:w},I){let T=I.getState()[e],R=T.queries[w],k=s.get(w);if(!R||R.status===ar)return;let{lowestPollingInterval:_,skipPollingIfUnfocused:F}=S(k);if(!Number.isFinite(_))return;let V=i.get(w);V?.timeout&&(clearTimeout(V.timeout),V.timeout=void 0);let j=Date.now()+_;i.set(w,{nextPollTimestamp:j,pollingInterval:_,timeout:setTimeout(()=>{(T.config.focused||!F)&&I.dispatch(n(R)),v({queryCacheKey:w},I)},_)})}function E({queryCacheKey:w},I){let R=I.getState()[e].queries[w],k=s.get(w);if(!R||R.status===ar)return;let{lowestPollingInterval:_}=S(k);if(!Number.isFinite(_)){y(w);return}let F=i.get(w),V=Date.now()+_;(!F||V<F.nextPollTimestamp)&&v({queryCacheKey:w},I)}function y(w){let I=i.get(w);I?.timeout&&clearTimeout(I.timeout),i.delete(w)}function h(){for(let w of i.keys())y(w)}function S(w=new Map){let I=!1,T=Number.POSITIVE_INFINITY;for(let R of w.values())R.pollingInterval&&(T=Math.min(R.pollingInterval,T),I=R.skipPollingIfUnfocused||I);return{lowestPollingInterval:T,skipPollingIfUnfocused:I}}return u},Ox=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=_s(r,n),i=Wr(r,n),s=ir(r,n),a={};return(u,g)=>{if(o(u)){let{requestId:v,arg:{endpointName:E,originalArgs:y}}=u.meta,h=Kn(t,E),S=h?.onQueryStarted;if(S){let w={},I=new Promise((_,F)=>{w.resolve=_,w.reject=F});I.catch(()=>{}),a[v]=w;let T=e.endpoints[E].select(Hs(h)?y:v),R=g.dispatch((_,F,V)=>V),k={...g,getCacheEntry:()=>T(g.getState()),requestId:v,extra:R,updateCachedData:Hs(h)?_=>g.dispatch(e.util.updateQueryData(E,y,_)):void 0,queryFulfilled:I};S(y,k)}}else if(s(u)){let{requestId:v,baseQueryMeta:E}=u.meta;a[v]?.resolve({data:u.payload,meta:E}),delete a[v]}else if(i(u)){let{requestId:v,rejectedWithValue:E,baseQueryMeta:y}=u.meta;a[v]?.reject({error:u.payload??u.error,isUnhandledError:!E,meta:y}),delete a[v]}}},Px=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,s=(c,u)=>{Pl.match(c)&&a(u,"refetchOnFocus"),Nl.match(c)&&a(u,"refetchOnReconnect")};function a(c,u){let g=c.getState()[e],v=g.queries,E=o.currentSubscriptions;t.batch(()=>{for(let y of E.keys()){let h=v[y],S=E.get(y);if(!S||!h)continue;let w=[...S.values()];(w.some(T=>T[u]===!0)||w.every(T=>T[u]===void 0)&&g.config[u])&&(S.size===0?c.dispatch(i({queryCacheKey:y})):h.status!==ar&&c.dispatch(n(h)))}})}return s};function Nx(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:s}=o,a={invalidateTags:G(`${t}/invalidateTags`)},c=E=>E.type.startsWith(`${t}/`),u=[Tx,Ix,_x,kx,Rx,Ox];return{middleware:E=>{let y=!1,h=i(E.dispatch),S={...e,internalState:h,refetchQuery:v,isThisApiSliceAction:c,mwApi:E},w=u.map(R=>R(S)),I=xx(S),T=Px(S);return R=>k=>{if(!Go(k))return R(k);y||(y=!0,E.dispatch(n.internalActions.middlewareRegistered(s)));let _={...E,next:R},F=E.getState(),[V,j]=I(k,_,F),L;if(V?L=R(k):L=j,E.getState()[t]&&(T(k,_,F),c(k)||o.hasRehydrationInfo(k)))for(let U of w)U(k,_,F);return L}},actions:a};function v(E){return e.api.endpoints[E.endpointName].initiate(E.originalArgs,{subscribe:!1,forceRefetch:!0})}}var fg=Symbol(),Fx=({createSelector:e=Ue}={})=>({name:fg,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:s,refetchOnMountOrArgChange:a,refetchOnFocus:c,refetchOnReconnect:u,invalidationBehavior:g,onSchemaFailure:v,catchSchemaFailure:E,skipSchemaValidation:y},h){Wf();let S=pe=>(typeof process<"u",pe);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:Nl,onOffline:Ag,onFocus:Pl,onFocusLost:Sg},util:{}});let w=wx({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:T,buildQuerySelector:R,buildInfiniteQuerySelector:k,buildMutationSelector:_}=w;sr(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:T});let{queryThunk:F,infiniteQueryThunk:V,mutationThunk:j,patchQueryData:L,updateQueryData:U,upsertQueryData:M,prefetch:O,buildMatchThunkActions:P}=Ax({baseQuery:r,reducerPath:o,context:h,api:t,serializeQueryArgs:i,assertTagType:S,selectors:w,onSchemaFailure:v,catchSchemaFailure:E,skipSchemaValidation:y}),{reducer:N,actions:Q}=bx({context:h,queryThunk:F,infiniteQueryThunk:V,mutationThunk:j,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:U,upsertQueryData:M,prefetch:O,resetApiState:Q.resetApiState,upsertQueryEntries:Q.cacheEntriesUpserted}),sr(t.internalActions,Q);let $=new WeakMap,Y=pe=>Qs($,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}=Sx({queryThunk:F,mutationThunk:j,infiniteQueryThunk:V,api:t,serializeQueryArgs:i,context:h,getInternalState:Y});sr(t.util,{getRunningMutationThunk:se,getRunningMutationsThunk:be,getRunningQueryThunk:Ie,getRunningQueriesThunk:Ne});let{middleware:_e,actions:ke}=Nx({reducerPath:o,context:h,queryThunk:F,mutationThunk:j,infiniteQueryThunk:V,api:t,assertTagType:S,selectors:w,getRunningQueryThunk:Ie,getInternalState:Y});return sr(t.util,ke),sr(t,{reducer:N,middleware:_e}),{name:fg,injectEndpoint(pe,de){var Ge;let fe=(Ge=t.endpoints)[pe]??(Ge[pe]={});Ws(de)&&sr(fe,{name:pe,select:R(pe,de),initiate:K(pe,de)},P(F,pe)),hx(de)&&sr(fe,{name:pe,select:_(),initiate:J(pe)},P(j,pe)),Ks(de)&&sr(fe,{name:pe,select:k(pe,de),initiate:H(pe,de)},P(F,pe))}}}}),Tg=Cx(Fx());m();d();f();p();m();d();f();p();var Zr=e=>e.query,_g=e=>e.query?.enableQuerySyntax;var Zq=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})),Dx=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 Ll(){return typeof window<"u"}function Yl(){return typeof navigator<"u"}function Yn(){return typeof document<"u"}function jl(){try{return typeof localStorage<"u"}catch{return!1}}function Mx(){try{return typeof sessionStorage<"u"}catch{return!1}}function Gg(){return Yl()&&navigator.cookieEnabled}var Lx=[ve.click,ve.custom,ve.search,ve.view],jx=(e,t)=>Lx.indexOf(e)!==-1?Object.assign({language:Yn()?document.documentElement.lang:"unknown",userAgent:Yl()?navigator.userAgent:"unknown"},t):t,mi=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?kg(t,r,i):(s=a.split("."),o=s[s.length-2]+"."+s[s.length-1],kg(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 kg(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 jl()?localStorage:Gg()?new gi:Mx()?sessionStorage:new Zn}var gi=class e{getItem(t){return mi.get(`${e.prefix}${t}`)}removeItem(t){mi.erase(`${e.prefix}${t}`)}setItem(t,r,n){mi.set(`${e.prefix}${t}`,r,n)}};gi.prefix="coveo_";var ql=class{constructor(){this.cookieStorage=new gi}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)}},Zn=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Ys="__coveo.analytics.history",Ux=20,Vx=1e3*60,Gx=75,Zs=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(Ys);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(Ys);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Ys,JSON.stringify(t.slice(0,Ux)))}catch{}}clear(){try{this.store.removeItem(Ys)}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,Gx)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>Vx:!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 Bx=(e,t)=>q(void 0,void 0,void 0,function*(){return e===ve.view?(yield $x(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),$x=e=>q(void 0,void 0,void 0,function*(){let t=new Zs,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),Qx=/^(?:[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 Js(e){return typeof e=="string"&&Qx.test(e)}function Og(e){if(!Js(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 Bg(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 Hx=new Uint8Array(16);function zx(){return crypto.getRandomValues(Hx)}function Wx(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 Kx="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Yx="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Xx(e,t,r,n,o,i){let s=typeof r=="string"?Wx(r):r,a=typeof n=="string"?Og(n):n;if(typeof n=="string"&&(n=Og(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,Bg(c)}function Jr(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():Zx(e,t,r)}function Zx(e,t,r){e=e||{};let n=e.random??e.rng?.()??zx();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 Bg(n)}function Jx(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 Dl(e,t){return e<<t|e>>>32-t}function eE(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 h=0;h<16;++h)c[h]=s[a][h];for(let h=16;h<80;++h)c[h]=Dl(c[h-3]^c[h-8]^c[h-14]^c[h-16],1);let u=r[0],g=r[1],v=r[2],E=r[3],y=r[4];for(let h=0;h<80;++h){let S=Math.floor(h/20),w=Dl(u,5)+Jx(S,g,v,E)+y+t[S]+c[h]>>>0;y=E,E=v,v=Dl(g,30)>>>0,g=u,u=w}r[0]=r[0]+u>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+v>>>0,r[3]=r[3]+E>>>0,r[4]=r[4]+y>>>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 ea(e,t,r,n){return Xx(80,eE,e,t)}ea.DNS=Kx;ea.URL=Yx;var $g="2.33.0",Pg=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,fi={pageview:"pageview",event:"event"},ta=class{constructor({client:t,uuidGenerator:r=Jr}){this.client=t,this.uuidGenerator=r}},Ul=class extends ta{constructor({client:t,uuidGenerator:r=Jr}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=Pg(window.location),this.lastReferrer=Yn()?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:Yn()?document.title:"",encoding:Yn()?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===fi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===fi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===fi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===fi.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 Pg(window.location)}},Sr=class e{constructor(t,r){if(!Js(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 Js(i)?new e(i,Number.parseInt(o)*1e3):null}};Sr.cvo_cid="cvo_cid";Sr.expirationTime=120;var Vl=class extends ta{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)}};Vl.Id="link";var xt=Object.keys;function Xs(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Ml=128,Qg=192,Ng=224,Fg=240;function tE(e){return(e&248)===Fg?4:(e&Fg)===Ng?3:(e&Ng)===Qg?2:1}function rE(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&Ml)!=Ml)break;if(r-=3,(n&Qg)!=Ml){t-r>=tE(n)*3&&(r=t);break}}return e.substring(0,r)}var Gl={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"},nE=xt(Gl).map(e=>Gl[e]),oE=[...nE].join("|"),iE=new RegExp(`^(${oE}$)`),sE={svcAction:"svc_action",svcActionData:"svc_action_data"},aE=e=>xt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=Gl[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),cE=e=>iE.test(e),uE=[cE],Dg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Mg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},st={action:"pa",list:"pal",listSource:"pls"},ra={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},lE=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Bl={id:"quoteId",affiliation:"quoteAffiliation"},$l={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},dE={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),ra),purchase:Object.assign(Object.assign({},st),ra),quickview:st,quote:Object.assign(Object.assign({},st),Bl),review:Object.assign(Object.assign({},st),$l)},pE=xt(Dg).map(e=>Dg[e]),fE=xt(Mg).map(e=>Mg[e]),mE=xt(st).map(e=>st[e]),gE=xt(ra).map(e=>ra[e]),hE=xt($l).map(e=>$l[e]),yE=xt(Bl).map(e=>Bl[e]),vE=[...pE,"custom"].join("|"),SE=[...fE,"custom"].join("|"),Hg="(pr[0-9]+)",zg="(il[0-9]+pi[0-9]+)",AE=new RegExp(`^${Hg}(${vE})$`),bE=new RegExp(`^(${zg}(${SE}))|(il[0-9]+nm)$`),wE=new RegExp(`^(${mE.join("|")})$`),CE=new RegExp(`^(${gE.join("|")})$`),xE=new RegExp(`^${Hg}custom$`),EE=new RegExp(`^${zg}custom$`),IE=new RegExp(`^(${[...lE,...hE,...yE].join("|")})$`),RE=e=>AE.test(e),TE=e=>bE.test(e),_E=e=>wE.test(e),kE=e=>CE.test(e),OE=e=>IE.test(e),PE=[TE,RE,_E,kE,OE],NE=[xE,EE],FE={anonymizeIp:"aip"},DE={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},ME={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},LE=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],jE=Object.assign(Object.assign(Object.assign(Object.assign({},FE),DE),ME),LE.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Ql=Object.assign(Object.assign({},jE),sE),qE=e=>{let t=!!e.action&&dE[e.action]||{};return xt(e).reduce((r,n)=>{let o=t[n]||Ql[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},UE=xt(Ql).map(e=>Ql[e]),VE=e=>UE.indexOf(e)!==-1,GE=e=>e==="custom",BE=e=>[...PE,...uE,VE,GE].some(t=>t(e)),$E=e=>xt(e).reduce((t,r)=>{let n=QE(r);return n?Object.assign(Object.assign({},t),HE(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),QE=e=>{let t;return[...NE].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},HE=(e,t)=>xt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),Hl=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()})}},Lg=b.fetch,na=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 Lg(u,g)}catch(E){console.error("An error has occurred when sending the event.",E);return}if(v.ok){let E=yield v.json();return E.visitorId&&o.setCurrentVisitorId(E.visitorId),E}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 Lg(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"})}},Wl=class{constructor(t,r){jl()&&Gg()?this.storage=new ql:jl()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Zn),this.client=new na(t),this.beaconClient=new Hl(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}},Kl=class{constructor(t,r){this.storage=r||new Zn,this.client=new na(t)}getClientDependingOnEventType(t){return this.client}},oa=class{constructor(){this.storage=new Zn,this.client=new zl}getClientDependingOnEventType(t){return this.client}},zE="xx",WE=e=>e?.startsWith(zE)||!1,KE=`
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 zE(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var WE=["1",1,"yes",!0];function KE(){let e=[];return Ll()&&e.push(window.doNotTrack),Yl()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>WE.indexOf(t)!==-1)}function oa(e){return e===!0?!1:KE()}var zg="v15",Wg={default:"https://analytics.cloud.coveo.com/rest/ua"};function YE(e=Wg.default,t=zg,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 XE="38824e1f-37f5-42d3-8372-a4b8fa9df946",$t=class{get defaultOptions(){return{endpoint:Wg.default,isCustomEndpoint:!1,token:"",version:zg,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Bg}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=[Ux,Dx].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};oa(this.options.disableBrowserPrivacySignals)?this.runtime=new na: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 Ll()&&Yn()?new Wl(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(zE()&&console.warn(HE),new Kl(t))}get storage(){return this.runtime.storage}determineVisitorId(){return q(this,void 0,void 0,function*(){try{return Ll()&&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(Zs(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(Js(t,Js(r,XE)))}})}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(oa(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||!Yn()||!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[y=>n.length>0?this.parseVariableArgumentsPayload(n,y):y[0],y=>q(this,void 0,void 0,function*(){return Object.assign(Object.assign({},y),{visitorId:o?yield this.getCurrentVisitorId():""})}),y=>q(this,void 0,void 0,function*(){return s?Object.assign(Object.assign({},y),{clientId:yield this.getCurrentVisitorId()}):y}),y=>i?this.ensureAnonymousUserWhenUsingApiKey(y):y,y=>this.beforeSendHooks.reduce((h,S)=>q(this,void 0,void 0,function*(){let w=yield h;return yield S(t,w)}),y)].reduce((y,h)=>q(this,void 0,void 0,function*(){let S=yield y;return yield h(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?ME(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,E)=>q(this,void 0,void 0,function*(){let y=yield v;return yield E(y)}),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 Xs().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(UE(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&&Ys(r)&&(o=this.lowercaseKeys(r));let i=VE(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=cr(t,["custom"]);if(r&&Ys(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 QE(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")&&Ys(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Ys(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"?Jx(t,r):t}get baseUrl(){return YE(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 B;(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"})(B||(B={}));var Lg={[B.triggerNotify]:"queryPipelineTriggers",[B.triggerExecute]:"queryPipelineTriggers",[B.triggerQuery]:"queryPipelineTriggers",[B.triggerRedirect]:"queryPipelineTriggers",[B.queryErrorBack]:"errors",[B.queryErrorClear]:"errors",[B.queryErrorRetry]:"errors",[B.pagerNext]:"getMoreResults",[B.pagerPrevious]:"getMoreResults",[B.pagerNumber]:"getMoreResults",[B.pagerResize]:"getMoreResults",[B.pagerScrolling]:"getMoreResults",[B.facetSearch]:"facet",[B.facetShowLess]:"facet",[B.facetShowMore]:"facet",[B.recommendation]:"recommendation",[B.likeSmartSnippet]:"smartSnippet",[B.dislikeSmartSnippet]:"smartSnippet",[B.expandSmartSnippet]:"smartSnippet",[B.collapseSmartSnippet]:"smartSnippet",[B.openSmartSnippetFeedbackModal]:"smartSnippet",[B.closeSmartSnippetFeedbackModal]:"smartSnippet",[B.sendSmartSnippetReason]:"smartSnippet",[B.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.clearRecentQueries]:"recentQueries",[B.recentResultClick]:"recentlyClickedDocuments",[B.clearRecentResults]:"recentlyClickedDocuments",[B.showLessFoldedResults]:"folding",[B.caseDetach]:"case",[B.likeGeneratedAnswer]:"generatedAnswer",[B.dislikeGeneratedAnswer]:"generatedAnswer",[B.openGeneratedAnswerSource]:"generatedAnswer",[B.generatedAnswerOpenInlineLink]:"generatedAnswer",[B.generatedAnswerFollowupOpenSource]:"generatedAnswer",[B.generatedAnswerStreamEnd]:"generatedAnswer",[B.generatedAnswerSourceHover]:"generatedAnswer",[B.generatedAnswerCopyToClipboard]:"generatedAnswer",[B.generatedAnswerHideAnswers]:"generatedAnswer",[B.generatedAnswerShowAnswers]:"generatedAnswer",[B.generatedAnswerExpand]:"generatedAnswer",[B.generatedAnswerCollapse]:"generatedAnswer",[B.generatedAnswerFeedbackSubmit]:"generatedAnswer",[B.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"},Jn=class{constructor(){this.runtime=new na,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 Bg}};function ZE(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function JE(e){return e.map(t=>t.replace(/;/g,""))}function Kg(e){let r=e.join(";");return r.length<=256?r:Kg(e.slice(1))}var jg=e=>{let t=JE(e),r=ZE(t);return Kg(r)};function qg(e){let t=typeof e.partialQueries=="string"?e.partialQueries:jg(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:jg(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var ia=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||oa(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new Jn:new $t(t)}disable(){this.coveoAnalyticsClient=new Jn}enable(){this.coveoAnalyticsClient=new $t(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(B.interfaceLoad)}logInterfaceLoad(){return q(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(B.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(B.didyoumeanClick)}logDidYouMeanClick(){return q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(B.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(B.searchboxSubmit)}logSearchboxSubmit(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(B.searchboxClear)}logSearchboxClear(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(B.searchboxAsYouType)}logSearchboxAsYouType(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(B.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(B.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(B.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(B.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(B.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(B.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(B.searchFromLink)}logSearchFromLink(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.pagerScrolling)}logPagerScrolling(){return q(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.queryErrorBack);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.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(B.queryErrorRetry);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.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(B.queryErrorClear);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.queryErrorClear)})}})}logQueryErrorClear(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(B.likeSmartSnippet)}logLikeSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(B.dislikeSmartSnippet)}logDislikeSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(B.expandSmartSnippet)}logExpandSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(B.collapseSmartSnippet)}logCollapseSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(B.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(B.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(B.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(B.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(B.recentQueryClick)}logRecentQueryClick(){return q(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(B.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(B.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(B.clearRecentResults)}logClearRecentResults(){return q(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(B.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(B.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(B.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=Lg[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=Lg[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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return q(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(B.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},sa=Object.assign({},fi),Ug=Object.keys(sa).map(e=>sa[e]),Xn=class extends Ul{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])=>Ug.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Ug.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(sa.pageview,{newEventType:ve.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(sa.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 oE(this.ticket)}};Xn.Id="svc";var aa;(function(e){e.click="click",e.flowStart="flowStart"})(aa||(aa={}));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 ca;(function(e){e.quit="Quit",e.solved="Solved"})(ca||(ca={}));var ua=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!oa(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new $t(t):new Jn,this.svc=new Xn({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Jn,this.svc=new Xn({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new $t(this.options),this.svc=new Xn({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:ca.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(Ct.caseSolved,{reason:ca.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",aa.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",aa.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 eI=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 eI(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=$n),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||Hn()}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 eo=e=>new $t(e).getCurrentVisitorId(),hi=(e,t)=>typeof t=="function"?(...r)=>{let n=Uo(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,yi=(e,t)=>(...r)=>{let n=Uo(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var vi=class extends en{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Yg=({logger:e,getState:t,analyticsClientMiddleware:r=(s,a)=>a,preprocessRequest:n,provider:o=new vi(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 ua({enableAnalytics:g,token:a,endpoint:c,runtimeEnvironment:u,disableBrowserPrivacySignals:i,preprocessRequest:hi(e,n),beforeSendHooks:[yi(e,r),(E,y)=>(e.info({...y,type:E,endpoint:c,token:a},"Analytics request"),y)]},o);return g||v.disable(),v};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function la(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function Xg(e){let{activeValue:t,ancestryMap:r}=nI(e);return t?oI(t,r):[]}function nI(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 oI(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var iI=(e,t)=>e.categoryFacetSet[t]?.request;var Xl=(e,t)=>{let r=iI(e,t);return Xg(r?.currentValues??[])};m();d();f();p();function da(){return{}}m();d();f();p();function pa(){return{}}m();d();f();p();function fa(){return{}}m();d();f();p();function ma(){return{}}function Zl(e){return{facetSet:e.facetSet??ma(),categoryFacetSet:e.categoryFacetSet??da(),dateFacetSet:e.dateFacetSet??pa(),numericFacetSet:e.numericFacetSet??fa(),automaticFacetSet:e.automaticFacetSet??la()}}var Jl=e=>{let t=[];return cI(e).forEach((r,n)=>{let o=hI(e,r.facetId),i=mI(r,n+1);if(aI(r)){if(!!!Xl(e,r.facetId).length)return;t.push({...i,...pI(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((s,a)=>{if(s.state==="idle")return;let c=Zg(s,a+1,o),u=sI(r)?Jg(s):lI(s);t.push({...i,...c,...u})})}),uI(e).forEach((r,n)=>{let o=fI(r,n+1);r.values.forEach((i,s)=>{if(i.state==="idle")return;let a=Zg(i,s+1,"specific"),c=Jg(i);t.push({...o,...a,...c})})}),t},sI=e=>e.type==="specific",aI=e=>e.type==="hierarchical",cI=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),uI=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),Zg=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),lI=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),Jg=e=>({displayValue:e.value,value:e.value}),dI=(e,t)=>Xl(e,t).map(n=>n.value).join(";"),pI=(e,t)=>{let n=dI(e,t);return{value:n,valuePosition:1,displayValue:n}},fI=(e,t)=>({title:eh(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),mI=(e,t)=>({title:eh(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),eh=(e,t)=>`${e}_${t}`,gI=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,hI=(e,t)=>{let r=gI(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var ed=e=>e.configuration.search.locale,th=e=>e.configuration.search.timezone,rh=e=>e.configuration.accessToken,nh=e=>e.configuration.organizationId,oh=e=>e.configuration.environment,ga=e=>e.configuration?.knowledge?.agentId,ih=e=>e.configuration.knowledge.debugAgentSession;var Oe=e=>{if(yI(e)||td(e))return e.generatedAnswer?.answerId;if(vI(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},yI=e=>"answer"in e&&"generatedAnswer"in e&&!ce(e.generatedAnswer?.answerConfigurationId),td=e=>{let t=ga(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},vI=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",rd=e=>e.generatedAnswer?.fieldsToIncludeInCitations,Ar=e=>e.followUpAnswers?.conversationId,SI=e=>e.generatedAnswer?.citations,AI=e=>e.followUpAnswers?.followUpAnswers,bI=Ue(AI,e=>e?.flatMap(t=>t.citations)),wI=(e,t)=>t,to=Ue(SI,bI,wI,(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 nd(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Qt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:nd(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:nd(),extendedResults:{},searchAction:void 0}}m();d();f();p();m();d();f();p();m();d();f();p();var sh=(r=>(r.Ascending="ascending",r.Descending="descending",r))(sh||{}),ah=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(ah||{}),od=e=>{if(Ef(e))return e.map(t=>od(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""}},ch=()=>({by:"relevancy"});var yV=new xe({values:{by:new Qu({enum:ah,required:!0}),order:new Qu({enum:sh}),field:new re}});function ha(){return od(ch())}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function CI(){return typeof navigator<"u"}function uh(){try{return typeof localStorage<"u"}catch{return!1}}function lh(){try{return typeof sessionStorage<"u"}catch{return!1}}function dh(){return CI()&&navigator.cookieEnabled}m();d();f();p();var ro=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?ph(t,r,i):(s=a.split("."),o=s[s.length-2]+"."+s[s.length-1],ph(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 ph(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function fh(){return uh()?localStorage:dh()?new ya:lh()?sessionStorage:new id}var ya=class e{getItem(t){return ro.get(`${e.prefix}${t}`)}removeItem(t){ro.erase(`${e.prefix}${t}`)}setItem(t,r,n){ro.set(`${e.prefix}${t}`,r,n)}};ya.prefix="coveo_";var id=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var va="__coveo.analytics.history",xI=20,EI=1e3*60,II=75,Sa=class{constructor(t){this.store=t||fh()}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(va);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this6=this;return _asyncToGenerator(function*(){try{let t=yield _this6.store.getItem(va);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(va,JSON.stringify(t.slice(0,xI)))}catch{}}clear(){try{this.store.removeItem(va)}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,II)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>EI:!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 Sa{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 Si=class Si 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 Jl(Zl(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Si.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||Si.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??ha()}}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(Si,"fallbackPipelineName","default");var br=Si,mh=({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 ia({token:a,endpoint:c,runtimeEnvironment:u,disableBrowserPrivacySignals:i,preprocessRequest:hi(e,n),beforeSendHooks:[yi(e,r),(E,y)=>(e.info({...y,type:E,endpoint:c,token:a},"Analytics request"),y)]},o);return g||v.disable(),v},sd=()=>{let t=yt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};m();d();f();p();function gh(e){let t=hh(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return gf([e,...t,...r],o=>o.uniqueId)}function hh(e){return e.childResults?e.childResults.flatMap(t=>[t,...hh(t)]):[]}m();d();f();p();var no=()=>"";function vh(e,t){return{...new br(t).getBaseMetadata(),actionCause:e,type:e}}function RI(e){return Object.assign(e,{instantlyCallable:!0})}function TI(e,t){let r=i=>{let s=Ce(e,i);return RI(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*(E,{getState:y,extra:h}){return yield v({state:y(),extra:h})});return function(_x45,_x46){return _ref19.apply(this,arguments)}}())}});return function prepare(_x44){return _ref18.apply(this,arguments)}}()}),n}var Sh=(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 OI(i)}return n},_I=e=>e.configuration.analytics.analyticsMode==="legacy",kI=e=>e.configuration.analytics.analyticsMode==="next",OI=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:s})=>(r??(r=a=>new s(a)),TI(e,/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*({getState:a,analyticsClientMiddleware:c,preprocessRequest:u,logger:g,disableBrowserPrivacySignals:v}){let E=[],y={log:function(){var _ref21=_asyncToGenerator(function*({state:T}){for(let R of E)yield R(T)});return function log(_x48){return _ref21.apply(this,arguments)}}()},h=a(),S=i({getState:a,logger:g,analyticsClientMiddleware:c,preprocessRequest:u,disableBrowserPrivacySignals:v,provider:r(a)}),w=yield t(S,a());y.description=w?.description,E.push(/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(T){_I(T)&&(yield PI(w,r,T,g,S.coveoAnalyticsClient))});return function(_x49){return _ref22.apply(this,arguments)}}());let{emit:I}=si(h);return E.push(/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(T){if(kI(T)&&o&&n){let R=n(T);yield UI(I,o,R)}});return function(_x50){return _ref23.apply(this,arguments)}}()),y});return function(_x47){return _ref20.apply(this,arguments)}}()));function PI(_x51,_x52,_x53,_x54,_x55){return _PI.apply(this,arguments)}function _PI(){_PI=_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 _PI.apply(this,arguments)}var NI=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=Sh(e=>mh({...e,provider:e.provider||new br(e.getState)}),e=>e,br),vt=Sh(Yg,NI("caseAssist"),vi);var ad=(e,t)=>{let r=i=>i+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=Ih(e,o),n<0&&(n=qI(e,o)),n<0&&(n=0),FI(e,r(n),t)};var Ah=(e,t)=>({sourceName:wh(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||no()}),bh=(e,t)=>({sourceName:wh(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||no()});function wh(e){let t=e.source;return ce(t)?"unknown":t}var Ch=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function FI(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:LI(e),...(yh(e)?{documentCategory:yh(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:jI(e),queryPipeline:r.pipeline||no()}}function yh(e){return e.raw?.objecttype||void 0}var cd=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||""}),xh={urihash:new re,sourcetype:new re,permanentid:new re},Eh={uniqueId:ee,raw:new xe({values:xh}),title:ee,uri:ee,clickUri:ee,rankingModifier:new re({required:!1,emptyAllowed:!0})};function DI(e){return Object.assign({},...Object.keys(xh).map(t=>({[t]:e[t]})))}function MI(e){return Object.assign({},...Object.keys(Eh).map(t=>({[t]:e[t]})),{raw:DI(e.raw)})}function LI(e){let t=e.raw.author;return ce(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function jI(e){let t=e.raw.source;return ce(t)?"unknown":t}var ud=e=>new Nt(Eh).validate(MI(e));function qI(e,t){for(let[r,n]of t.entries()){let o=gh(n);if(Ih(e,o)!==-1)return r}return-1}function Ih(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function UI(_x57,_x58,_x59){return _UI.apply(this,arguments)}function _UI(){_UI=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _UI.apply(this,arguments)}m();d();f();p();var Aa=e=>{if(e==="yes")return!0;if(e==="no")return!1},VI=()=>Re("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function GI(e,t){return Re({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??Oe(n),i=to(n,e);if(!o||!i)return null;let s=Ar(n);return r.makeGeneratedAnswerCitationClick(Ah(i,n),{generativeQuestionAnsweringId:o,citationId:i.id,documentId:Ch(i),...(s&&{conversationId:s})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=to(r,e);return{answerId:t??Oe(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function BI(e,t,r){return Re({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let i=r??Oe(o),s=to(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=to(n,e);return{answerId:r??Oe(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function $I(e,t){return Re({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function QI(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 HI(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 zI=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:Aa(o),documented:Aa(i),correctTopic:Aa(a),hallucinationFree:Aa(s)},additionalNotes:u,correctAnswerUrl:c}}}),ld=(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})}),oo=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||""})}),WI=()=>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"})}),KI=()=>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"})}),YI=()=>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"})}),XI=()=>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 ZI(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 JI(e,t){return Re({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=to(n,e);if(!o)return null;let i=Ar(n);return i?r.makeGeneratedAnswerFollowupOpenSource({...bh(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:i}):null}})}var ba={logCopyGeneratedAnswer:ZI,logGeneratedAnswerHideAnswers:KI,logGeneratedAnswerShowAnswers:WI,logGeneratedAnswerStreamEnd:ld,logGeneratedAnswerFeedback:zI,logDislikeGeneratedAnswer:HI,logLikeGeneratedAnswer:QI,logGeneratedAnswerOpenInlineLink:$I,logHoverCitation:BI,logOpenGeneratedAnswerSource:GI,logOpenGeneratedAnswerFollowUpSource:JI,logRetryGeneratedAnswer:VI,logGeneratedAnswerExpand:YI,logGeneratedAnswerCollapse:XI};m();d();f();p();m();d();f();p();var Rh=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:zn(e)}});m();d();f();p();var dd=e=>e.context;m();d();f();p();var pd=e=>e.pipeline;m();d();f();p();m();d();f();p();var bi=Pt(wa(),1),Nh=Pt(Th(),1);m();d();f();p();var kh=Pt(wa(),1),Oh=Pt(_h(),1);kh.default.extend(Oh.default);var eR="YYYY/MM/DD@HH:mm:ss";function Ph(e){return e.format(eR)}bi.default.extend(Nh.default);var tR=["past","now","next"],rR=["minute","hour","day","week","month","quarter","year"];function nR(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,bi.default)().subtract(r,n);case"next":return(0,bi.default)().add(r,n);case"now":return(0,bi.default)()}}function Sd(e){return Ph(nR(oR(e)))}function Fh(e){return e.toLocaleLowerCase().split("-")}function Ad(e){let[t,r,n]=Fh(e);if(t==="now")return!0;if(!tR.includes(t)||!rR.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function oR(e){let[t,r,n]=Fh(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function Dh(e){return e.type==="dateRange"}function Mh(e){return`start${e}`}function Lh(e){return`end${e}`}var bd=()=>({dateFacetValueMap:{}});function iR(e,t,r){let n=e.start,o=e.end;return Ad(n)&&(n=Sd(n),r.dateFacetValueMap[t][Mh(n)]=e.start),Ad(o)&&(o=Sd(o),r.dateFacetValueMap[t][Lh(o)]=e.end),{...e,start:n,end:o}}function wd(e,t){if(Dh(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>iR(o,r,t))}}return e}function wr(e){let t=bd();return{request:{...e,facets:e.facets?.map(n=>wd(n,t))},mappings:t}}function sR(e,t,r){return{...e,start:r.dateFacetValueMap[t][Mh(e.start)]||e.start,end:r.dateFacetValueMap[t][Lh(e.end)]||e.end}}function aR(e,t){return e.facetId in t.dateFacetValueMap}function cR(e,t){return aR(e,t)?{...e,values:e.values.map(r=>sR(r,e.facetId,t))}:e}function Ca(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>cR(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 Cd(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 jh(e){return Cr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var xd={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function uR(e){return Cr(e).map(t=>{let r=xd[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function lR(e){return[...uR(e.facetSet??{}),...jh(e.numericFacetSet??{}),...jh(e.dateFacetSet??{}),...Cr(e.categoryFacetSet??{})]}function dR(e){return lR(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function xa(e){return Cd(dR(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 eo(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}),...(sd()&&{pageId:sd()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:zn(e)})}}});return function qh(_x60,_x61){return _ref25.apply(this,arguments)}}();var io=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Dn(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 io(_x62,_x63){return _ref26.apply(this,arguments)}}();m();d();f();p();var Ea=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Dn(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 Uh=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=Id(e),o=pR(e),i=fR(e),s=e.configuration.analytics.analyticsMode==="legacy"?yield io(e,r):Ea(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:Ed(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 Ed(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function pR(e){return Cd(gR(e),e.facetOrder??[])}function fR(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(mR).filter(r=>r.currentValues.length>0):void 0}function mR(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function gR(e){return hR(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function hR(e){return[...yR(e.facetSet??{}),...Vh(e.numericFacetSet??{}),...Vh(e.dateFacetSet??{}),...Cr(e.categoryFacetSet??{})]}function yR(e){return Cr(e).map(t=>{let r=xd[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function Vh(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 Id(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=Uh(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();f();p();m();d();f();p();var Ci=(e,t)=>{let r=e;return ce(r[t])?ce(e.raw[t])?null:e.raw[t]:r[t]},vR=e=>t=>e.every(r=>!ce(Ci(t,r))),SR=e=>t=>e.every(r=>ce(Ci(t,r))),AR=(e,t)=>r=>{let n=Gh(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},bR=(e,t)=>r=>{let n=Gh(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},Gh=(e,t)=>{let r=Ci(t,e);return mf(r)?r:[r]},Bh={getResultProperty:Ci,fieldsMustBeDefined:vR,fieldsMustNotBeDefined:SR,fieldMustMatch:AR,fieldMustNotMatch:bR};var Rd=Ue(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var Td=e=>e.searchHub;m();d();f();p();var Ia=Ue(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),L$=Ue(e=>e,e=>{let t=Ia(e);return t&&e?e[t].expression:""});m();d();f();p();var $h=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var Qh=e=>e.excerptLength?.length;m();d();f();p();var Hh=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var zh=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 Wh=e=>e.sortCriteria;var Kh=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Fn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function Kh(_x67){return _ref28.apply(this,arguments)}}(),Yh=(e,t)=>{let r=Zr(e)?.q,{aq:n,cq:o,dq:i,lq:s}=Jh(e),a=dd(e),c=rn(e.configuration.analytics,t,{actionCause:Rd(e)}),u=Td(e),g=pd(e),v=rd(e)??[],E=Zh(e),y=Ia(e.tabSet)||"default",h=ed(e),S=th(e),w=t.referrer||"",I=Hh(e),T=Wh(e),R=wR(e),k=Qh(e),_=zh(e),F=$h(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(s&&{lq:s}),...(e.query&&{enableQuerySyntax:Tg(e)}),...(a?.contextValues&&{context:a.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(u?.length&&{searchHub:u}),...(g?.length&&{pipeline:g}),...(E.length&&{facets:E}),...(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:Ed(e),firstResult:e.pagination.firstResult}),tab:y,locale:h,timezone:S,...(e.debug!==void 0&&{debug:e.debug}),referrer:w,...R,...(_??{}),...(k&&{excerptLength:k}),...(F&&{dictionaryFieldContext:F}),sortCriteria:T,...(I&&{facetOptions:I}),...c,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Xh=(e,t)=>{let r=Zr(e)?.q,n=Zh(e),o=rn(e.configuration.analytics,t,{actionCause:Rd(e)}),i=ed(e),s=Ia(e.tabSet)||"default",a=t.referrer,{aq:c,cq:u}=Jh(e),g=Td(e),v=pd(e),E=dd(e),y=rd(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:y,...(g?.length&&{searchHub:g}),...(v?.length&&{pipeline:v}),...(E?.contextValues&&{context:E.contextValues}),...(c&&{aq:c}),...(u&&{cq:u}),tab:s,referrer:a,...o,locale:i}},Zh=e=>xa(e)?.map(t=>wd(t,bd())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),wR=e=>({actionsHistory:e.configuration.analytics.enabled?yt.getInstance().getHistory():[]}),Jh=e=>{let t=Rh(e),r=Id(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var Ra=["searching","thinking","answering"];function Ta(e){return e.toLowerCase()}var _a=["search","generic"];m();d();f();p();var ey=["text/plain","text/markdown"];var so=new re({required:!0}),ty=new re,ao=new je({required:!0}),_d={id:so,title:so,uri:so,permanentid:so,clickUri:ty},ka=new re({required:!0,constrainTo:ey}),ry=new re({required:!0,constrainTo:Ra}),ny=e=>({...e,name:Ta(e.name)}),nQ=G("generatedAnswer/setIsVisible",e=>W(e,ao)),Oa=G("generatedAnswer/setAnswerId",e=>W(e,ee)),oQ=G("generatedAnswer/setAnswerGenerationMode",e=>W(e,new re({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),iQ=G("generatedAnswer/setIsEnabled",e=>W(e,ao)),Ei=G("generatedAnswer/updateMessage",e=>W(e,{textDelta:so})),Ii=G("generatedAnswer/updateCitations",e=>W(e,{citations:new Ft({required:!0,each:new xe({values:_d})})})),Ri=G("generatedAnswer/updateError",e=>W(e,{message:ty,code:new Le({min:0})})),Pa=G("generatedAnswer/resetAnswer"),sQ=G("generatedAnswer/like"),aQ=G("generatedAnswer/dislike"),cQ=G("generatedAnswer/feedbackModal/open"),uQ=G("generatedAnswer/expand"),lQ=G("generatedAnswer/collapse"),dQ=G("generatedAnswer/setId",e=>W(e,{id:new re({required:!0})})),pQ=G("generatedAnswer/feedbackModal/close"),fQ=G("generatedAnswer/sendFeedback"),Er=G("generatedAnswer/setIsLoading",e=>W(e,ao)),xi=G("generatedAnswer/setIsStreaming",e=>W(e,ao)),Ti=G("generatedAnswer/setAnswerContentFormat",e=>W(e,ka)),mQ=G("generatedAnswer/updateResponseFormat",e=>W(e,{contentFormat:new Ft({each:ka,default:["text/plain"]})})),gQ=G("knowledge/updateAnswerConfigurationId",e=>W(e,so)),hQ=G("generatedAnswer/registerFieldsToIncludeInCitations",e=>W(e,Cm)),kd=G("generatedAnswer/setIsAnswerGenerated",e=>W(e,ao)),_i=G("generatedAnswer/setCannotAnswer",e=>W(e,ao)),CR=G("generatedAnswer/setAnswerApiQueryParams",e=>W(e,new xe({}))),oy=G("generatedAnswer/startStep",e=>W(ny(e),{name:ry,startedAt:new Le({min:0,required:!0})})),iy=G("generatedAnswer/finishStep",e=>W(ny(e),{name:ry,finishedAt:new Le({min:0,required:!0})})),sy=G("generatedAnswer/startToolCall",e=>W(e,{toolCallName:ee,startedAt:new Le({min:0,required:!0}),toolCallId:ee})),ay=G("generatedAnswer/finishToolCall",e=>W(e,{finishedAt:new Le({min:0,required:!0}),toolCallId:ee})),Na=G("generatedAnswer/toolCallArgs",e=>W(e,{toolCallId:ee,args:new xe({options:{required:!0}}),type:new re({required:!0,constrainTo:_a})})),yQ=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 Kh(r),v=(h,S)=>{switch(h){case"genqa.headerMessageType":{let w=JSON.parse(S);n(Ti(w.contentFormat));break}case"genqa.messageType":n(Ei(JSON.parse(S)));break;case"genqa.citationsType":n(Ii(JSON.parse(S)));break;case"genqa.endOfStreamType":{let w=JSON.parse(S).answerGenerated,{answerId:I,answer:T}=i().generatedAnswer,k=c.length!==0&&!w,_=!T?.trim();n(_i(k)),n(xi(!1)),n(kd(w)),n((s??ba).logGeneratedAnswerStreamEnd(w,I,w?_:void 0)),n(oo());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${h}"`)}};n(Er(!0));let E=h=>h.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,y=o.streamingClient?.streamGeneratedAnswer(g,{write:h=>{E(g)&&(n(Er(!1)),h.payload&&h.payloadType&&v(h.payloadType,h.payload))},abort:h=>{E(g)&&n(Ri(h))},close:()=>{E(g)&&n(xi(!1))},resetAnswer:()=>{E(g)&&n(Pa())}});y?u(y):n(Er(!1))});return function(_x68,_x69){return _ref29.apply(this,arguments)}}()),vQ=Ce("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(Pa());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=Yh(i,n);r(CR(s)),yield r(cy(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 ly(_x72,_x73){return _ly.apply(this,arguments)}function _ly(){_ly=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _ly.apply(this,arguments)}function dy(e){let t,r,n,o=!1;return function(s){t===void 0?(t=s,r=0,n=-1):t=ER(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 py(e,t,r){let n=uy(),o=new TextDecoder;return function(s,a){if(s.length===0)r?.(n),n=uy();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":xR(g,n,t);break}}}}function xR(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function ER(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function uy(){return{data:"",event:"",id:"",retry:void 0}}var Od="text/event-stream",IR=1e3,fy="last-event-id";function my(){return typeof window<"u"}function gy(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:s,openWhenHidden:a,fetch:c,...u}){return new Promise((g,v)=>{let E={...r};E.accept||(E.accept=Od);let y;function h(){y?.abort(),document.hidden||k()}!a&&my()&&document.addEventListener("visibilitychange",h);let S=IR,w;function I(){my()&&document.removeEventListener("visibilitychange",h),clearTimeout(w),y?.abort()}t?.addEventListener("abort",()=>{I(),g()});let T=c??C,R=n??RR;function k(){return _k2.apply(this,arguments)}function _k2(){_k2=_asyncToGenerator(function*(){y=l.AbortController?new l.AbortController:null;try{let _=yield T(e,{...u,headers:E,signal:y?.signal});yield R(_),yield ly(_.body,dy(py(F=>{F?E[fy]=F:delete E[fy]},F=>{S=F},o))),i?.(),I(),g()}catch(_){if(!y?.signal?.aborted)try{let F=s?.(_)??S;clearTimeout(w),w=setTimeout(k,F)}catch(F){I(),v(F)}}});return _k2.apply(this,arguments)}k()})}function RR(e){let t=e.headers.get("content-type");if(!t?.startsWith(Od))throw new Error(`Expected content-type to be ${Od}, Actual: ${t}`)}m();d();f();p();var TR=/*#__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=Fn(n.configuration.search?.apiBaseUrl,s,i);return mg({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,E={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(y=>{E[y]=g[y]}),E.duplex="half",E.body=yield g.text(),C(v,E)});return function fetchFn(_x77){return _ref32.apply(this,arguments)}}()})(c,{...t,signal:null},r)}catch(u){return{error:u}}});return function TR(_x74,_x75,_x76){return _ref31.apply(this,arguments)}}(),hy=Rg({reducerPath:"answer",baseQuery:hg(TR,{maxRetries:3}),endpoints:()=>({})});var _R=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},kR=(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)},OR=(e,t)=>{delete e.error,e.citations=t.citations},PR=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},NR=(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})`)},FR=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&NR(t,o);let i=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":i.contentFormat&&(_R(t,i),r(Ti(i.contentFormat)));break;case"genqa.messageType":typeof i.textDelta=="string"&&(kR(t,i),r(Ei({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(OR(t,i),r(Ii({citations:i.citations})));break;case"genqa.endOfStreamType":{PR(t,i);let s=t.answerId,a=i.answerGenerated??!1,c=a?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(a,s,c)),r(oo());break}}},DR=(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`},Pd=hy.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}=yield s,{organizationId:v,environment:E,accessToken:y}=a,h=Fn(a.search.apiBaseUrl,v,E),S=DR(h,v,c.answerConfigurationId,u?.insightId);yield gy(S,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${y}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:C,onopen:function(){var _ref33=_asyncToGenerator(function*(w){let I=w.headers.get("x-answer-id");I&&o(T=>{T.answerId=I,i(Oa(I))})});return function onopen(_x80){return _ref33.apply(this,arguments)}}(),onmessage:w=>{o(I=>{FR(w,I,i,g??ba)})},onerror:w=>{throw w},onclose:()=>{o(w=>{i(_i(!w.generated))})}})}).apply(this,arguments)}})})}),cy=e=>Pd.endpoints.getAnswer.initiate(e);m();d();f();p();var yy=Qe($n,e=>e);m();d();f();p();function MR(e){let t=e.payload?.analyticsAction;return vy(e)&&!ce(t)}function vy(e){return"type"in e}var Sy=e=>t=>r=>{let n;MR(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return vy(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 gH=G("tab/register",e=>{let t=new xe({values:{id:ee,expression:Dt}});return W(e,t)}),Ay=G("tab/updateActiveTab",e=>W(e,ee));m();d();f();p();var Fa=Pt(wa(),1),Cy=Pt(by(),1),xy=Pt(wy(),1);Fa.default.extend(xy.default);Fa.default.extend(Cy.default);var Ey=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:Fa.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 LR=/(^|; )Coveo-Pendragon=([^;]*)/,jR=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function Iy(){return typeof window>"u"?!1:LR.exec(document.cookie)?.pop()||null}function Ry(){return typeof window>"u"?!1:jR.test(document.cookie)}var Ty=Qe(Ey(),e=>e.addCase(Qn,(t,r)=>{qR(t,r.payload)}).addCase(Ls,(t,r)=>{UR(t,r.payload)}).addCase(js,(t,r)=>{VR(t,r.payload)}).addCase(qs,t=>{t.analytics.enabled=!1}).addCase(Us,t=>{t.analytics.enabled=!0}).addCase(Fm,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(Dm,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(Ay,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Tm,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Fs,(t,r)=>{ce(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Mm,(t,{payload:r})=>{GR(t,r)}));function qR(e,t){ce(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ce(t.organizationId)||(e.organizationId=t.organizationId)}function UR(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 VR(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=Iy();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 GR(e,t){e.knowledge.agentId=t;try{Ry()&&(e.knowledge.debugAgentSession=!0)}catch{}}var St=Ty;m();d();f();p();function BR(e){return e.instantlyCallable}var _y=()=>e=>t=>e(BR(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 ky(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 Ld,$R=new Uint8Array(16);function jd(){if(!Ld){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ld=crypto.getRandomValues.bind(crypto)}return Ld($R)}m();d();f();p();m();d();f();p();var QR=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),qd={randomUUID:QR};function HR(e,t,r){if(qd.randomUUID&&!t&&!e)return qd.randomUUID();e=e||{};let n=e.random??e.rng?.()??jd();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 ky(n)}var Ir=HR;m();d();f();p();m();d();f();p();var A={};Wi(A,{BRAND:()=>vT,DIRTY:()=>nn,EMPTY_PATH:()=>YR,INVALID:()=>ue,NEVER:()=>r_,OK:()=>at,ParseStatus:()=>rt,Schema:()=>ye,ZodAny:()=>_r,ZodArray:()=>fr,ZodBigInt:()=>sn,ZodBoolean:()=>an,ZodBranded:()=>Oi,ZodCatch:()=>vn,ZodDate:()=>cn,ZodDefault:()=>yn,ZodDiscriminatedUnion:()=>La,ZodEffects:()=>Rt,ZodEnum:()=>gn,ZodError:()=>lt,ZodFirstPartyTypeKind:()=>le,ZodFunction:()=>qa,ZodIntersection:()=>pn,ZodIssueCode:()=>z,ZodLazy:()=>fn,ZodLiteral:()=>mn,ZodMap:()=>mo,ZodNaN:()=>ho,ZodNativeEnum:()=>hn,ZodNever:()=>Lt,ZodNull:()=>ln,ZodNullable:()=>Wt,ZodNumber:()=>on,ZodObject:()=>dt,ZodOptional:()=>Et,ZodParsedType:()=>te,ZodPipeline:()=>Pi,ZodPromise:()=>kr,ZodReadonly:()=>Sn,ZodRecord:()=>ja,ZodSchema:()=>ye,ZodSet:()=>go,ZodString:()=>Tr,ZodSymbol:()=>po,ZodTransformer:()=>Rt,ZodTuple:()=>zt,ZodType:()=>ye,ZodUndefined:()=>un,ZodUnion:()=>dn,ZodUnknown:()=>pr,ZodVoid:()=>fo,addIssueToContext:()=>Z,any:()=>RT,array:()=>OT,bigint:()=>wT,boolean:()=>Vy,coerce:()=>t_,custom:()=>jy,date:()=>CT,datetimeRegex:()=>My,defaultErrorMap:()=>lr,discriminatedUnion:()=>DT,effect:()=>zT,enum:()=>$T,function:()=>VT,getErrorMap:()=>co,getParsedType:()=>Ht,instanceof:()=>AT,intersection:()=>MT,isAborted:()=>Da,isAsync:()=>uo,isDirty:()=>Ma,isValid:()=>Rr,late:()=>ST,lazy:()=>GT,literal:()=>BT,makeIssue:()=>ki,map:()=>qT,nan:()=>bT,nativeEnum:()=>QT,never:()=>_T,null:()=>IT,nullable:()=>KT,number:()=>Uy,object:()=>PT,objectUtil:()=>Ud,oboolean:()=>e_,onumber:()=>JT,optional:()=>WT,ostring:()=>ZT,pipeline:()=>XT,preprocess:()=>YT,promise:()=>HT,quotelessJson:()=>zR,record:()=>jT,set:()=>UT,setErrorMap:()=>KR,strictObject:()=>NT,string:()=>qy,symbol:()=>xT,transformer:()=>zT,tuple:()=>LT,undefined:()=>ET,union:()=>FT,unknown:()=>TT,util:()=>Ae,void:()=>kT});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 Ud;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Ud||(Ud={}));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"]),zR=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 WR=(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=WR;var Oy=lr;function KR(e){Oy=e}function co(){return Oy}m();d();f();p();var ki=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}},YR=[];function Z(e,t){let r=co(),n=ki({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}),Da=e=>e.status==="aborted",Ma=e=>e.status==="dirty",Rr=e=>e.status==="valid",uo=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}},Py=(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(uo(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 Py(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 uo(o)?o:Promise.resolve(o);return Py(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 kr.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 Oi({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 Pi.create(this,t)}readonly(){return Sn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},XR=/^c[^\s-]{8,}$/i,ZR=/^[0-9a-z]+$/,JR=/^[0-9A-HJKMNP-TV-Z]{26}$/i,eT=/^[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,tT=/^[a-z0-9_-]{21}$/i,rT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,nT=/^[-+]?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)?)??$/,oT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,iT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Vd,sT=/^(?:(?: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])$/,aT=/^(?:(?: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])$/,cT=/^(([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]))$/,uT=/^(([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])$/,lT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dT=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Fy="((\\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])))",pT=new RegExp(`^${Fy}$`);function Dy(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 fT(e){return new RegExp(`^${Dy(e)}$`)}function My(e){let t=`${Fy}T${Dy(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 mT(e,t){return!!((t==="v4"||!t)&&sT.test(e)||(t==="v6"||!t)&&cT.test(e))}function gT(e,t){if(!rT.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 hT(e,t){return!!((t==="v4"||!t)&&aT.test(e)||(t==="v6"||!t)&&uT.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")oT.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")Vd||(Vd=new RegExp(iT,"u")),Vd.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")eT.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")tT.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")XR.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")ZR.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")JR.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"?My(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"?pT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?fT(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"?nT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"duration",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?mT(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"?gT(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"?hT(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"?lT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"base64",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?dT.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 yT(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"?yT(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 po=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)}};po.create=e=>new po({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 _r=class extends ye{constructor(){super(...arguments),this._any=!0}_parse(t){return at(t.data)}};_r.create=e=>new _r({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 fo=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)}};fo.create=e=>new fo({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 lo(e){if(e instanceof dt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Et.create(lo(n))}return new dt({...e._def,shape:()=>t})}else return e instanceof fr?new fr({...e._def,type:lo(e.element)}):e instanceof Et?Et.create(lo(e.unwrap())):e instanceof Wt?Wt.create(lo(e.unwrap())):e instanceof zt?zt.create(e.items.map(t=>lo(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,E=yield g.value;u.push({key:v,value:E,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 lo(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 Ly(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 Oi||e instanceof Sn?dr(e.unwrap()):e instanceof vn?dr(e._def.innerType):[],La=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 Gd(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=Gd(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=Gd(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(Da(i)||Da(s))return ue;let a=Gd(i.value,s.value);return a.valid?((Ma(i)||Ma(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 ja=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)})}},mo=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}}}};mo.create=(e,t,r)=>new mo({valueType:t,keyType:e,typeName:le.ZodMap,...me(r)});var go=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)}};go.create=(e,t)=>new go({valueType:e,minSize:null,maxSize:null,typeName:le.ZodSet,...me(t)});var qa=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 ki({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,co(),lr].filter(u=>!!u),issueData:{code:z.invalid_arguments,argumentsError:c}})}function o(a,c){return ki({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,co(),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 kr){let a=this;return at(/*#__PURE__*/_asyncToGenerator(function*(...c){let u=new lt([]),g=yield a._def.args.parseAsync(c,i).catch(y=>{throw u.addIssue(n(c,y)),u}),v=yield Reflect.apply(s,this,g);return yield a._def.returns._def.type.parseAsync(v,i).catch(y=>{throw u.addIssue(o(v,y)),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 Ly(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=Ly;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 kr=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})))}};kr.create=(e,t)=>new kr({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 uo(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 ho=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}}};ho.create=e=>new ho({typeName:le.ZodNaN,...me(e)});var vT=Symbol("zod_brand"),Oi=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}},Pi=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 uo(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 Ny(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function jy(e,t={},r){return e?_r.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=Ny(t,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!i){let s=Ny(t,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):_r.create()}var ST={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 AT=(e,t={message:`Input not instance of ${e.name}`})=>jy(r=>r instanceof e,t),qy=Tr.create,Uy=on.create,bT=ho.create,wT=sn.create,Vy=an.create,CT=cn.create,xT=po.create,ET=un.create,IT=ln.create,RT=_r.create,TT=pr.create,_T=Lt.create,kT=fo.create,OT=fr.create,PT=dt.create,NT=dt.strictCreate,FT=dn.create,DT=La.create,MT=pn.create,LT=zt.create,jT=ja.create,qT=mo.create,UT=go.create,VT=qa.create,GT=fn.create,BT=mn.create,$T=gn.create,QT=hn.create,HT=kr.create,zT=Rt.create,WT=Et.create,KT=Wt.create,YT=Rt.createWithPreprocess,XT=Pi.create,ZT=()=>qy().optional(),JT=()=>Uy().optional(),e_=()=>Vy().optional(),t_={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 r_=ue;var n_=A.object({name:A.string(),arguments:A.string()}),o_=A.object({id:A.string(),type:A.literal("function"),function:n_,encryptedValue:A.string().optional()}),Ua=A.object({id:A.string(),role:A.string(),content:A.string().optional(),name:A.string().optional(),encryptedValue:A.string().optional()}),i_=A.object({type:A.literal("text"),text:A.string()}),s_=A.object({type:A.literal("data"),value:A.string(),mimeType:A.string()}),a_=A.object({type:A.literal("url"),value:A.string(),mimeType:A.string().optional()}),Va=A.discriminatedUnion("type",[s_,a_]),c_=A.object({type:A.literal("image"),source:Va,metadata:A.unknown().optional()}),u_=A.object({type:A.literal("audio"),source:Va,metadata:A.unknown().optional()}),l_=A.object({type:A.literal("video"),source:Va,metadata:A.unknown().optional()}),d_=A.object({type:A.literal("document"),source:Va,metadata:A.unknown().optional()});var Gy=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()}),By=(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"]})},H4=Gy.superRefine((e,t)=>{By(e,t)}),p_=A.discriminatedUnion("type",[i_,c_,u_,l_,d_,Gy]),f_=p_.superRefine((e,t)=>{e.type==="binary"&&By(e,t)}),m_=Ua.extend({role:A.literal("developer"),content:A.string()}),g_=Ua.extend({role:A.literal("system"),content:A.string()}),h_=Ua.extend({role:A.literal("assistant"),content:A.string().optional(),toolCalls:A.array(o_).optional()}),y_=Ua.extend({role:A.literal("user"),content:A.union([A.string(),A.array(f_)])}),v_=A.object({id:A.string(),content:A.string(),role:A.literal("tool"),toolCallId:A.string(),error:A.string().optional(),encryptedValue:A.string().optional()}),S_=A.object({id:A.string(),role:A.literal("activity"),activityType:A.string(),content:A.record(A.any())}),A_=A.object({id:A.string(),role:A.literal("reasoning"),content:A.string(),encryptedValue:A.string().optional()}),$y=A.discriminatedUnion("role",[m_,g_,h_,y_,v_,S_,A_]),z4=A.union([A.literal("developer"),A.literal("system"),A.literal("assistant"),A.literal("user"),A.literal("tool"),A.literal("activity"),A.literal("reasoning")]),b_=A.object({description:A.string(),value:A.string()}),Qy=A.object({name:A.string(),description:A.string(),parameters:A.any(),metadata:A.record(A.any()).optional()}),w_=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()}),C_=A.object({interruptId:A.string(),status:A.enum(["resolved","cancelled"]),payload:A.any().optional()}),x_=A.object({threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),state:A.any(),messages:A.array($y),tools:A.array(Qy),context:A.array(b_),forwardedProps:A.any(),resume:A.array(C_).optional()}),E_=A.any(),Fe=class extends Error{constructor(e){super(e)}},Bd=class extends Fe{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},I_=A.object({name:A.string(),description:A.string().optional()}),R_=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()}),T_=A.object({streaming:A.boolean().optional(),websocket:A.boolean().optional(),httpBinary:A.boolean().optional(),pushNotifications:A.boolean().optional(),resumable:A.boolean().optional()}),__=A.object({supported:A.boolean().optional(),items:A.array(Qy).optional(),parallelCalls:A.boolean().optional(),clientProvided:A.boolean().optional()}),k_=A.object({structuredOutput:A.boolean().optional(),supportedMimeTypes:A.array(A.string()).optional()}),O_=A.object({snapshots:A.boolean().optional(),deltas:A.boolean().optional(),memory:A.boolean().optional(),persistentState:A.boolean().optional()}),P_=A.object({supported:A.boolean().optional(),delegation:A.boolean().optional(),handoffs:A.boolean().optional(),subAgents:A.array(I_).optional()}),N_=A.object({supported:A.boolean().optional(),streaming:A.boolean().optional(),encrypted:A.boolean().optional()}),F_=A.object({image:A.boolean().optional(),audio:A.boolean().optional(),video:A.boolean().optional(),pdf:A.boolean().optional(),file:A.boolean().optional()}),D_=A.object({image:A.boolean().optional(),audio:A.boolean().optional()}),M_=A.object({input:F_.optional(),output:D_.optional()}),L_=A.object({codeExecution:A.boolean().optional(),sandboxed:A.boolean().optional(),maxIterations:A.number().optional(),maxExecutionTime:A.number().optional()}),j_=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()}),W4=A.object({identity:R_.optional(),transport:T_.optional(),tools:__.optional(),output:k_.optional(),state:O_.optional(),multiAgent:P_.optional(),reasoning:N_.optional(),multimodal:M_.optional(),execution:L_.optional(),humanInTheLoop:j_.optional(),custom:A.record(A.unknown()).optional()}),Hy=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(),q_=Ee.extend({type:A.literal(D.TEXT_MESSAGE_START),messageId:A.string(),role:Hy.default("assistant"),name:A.string().optional()}),zy=Ee.extend({type:A.literal(D.TEXT_MESSAGE_CONTENT),messageId:A.string(),delta:A.string()}),U_=Ee.extend({type:A.literal(D.TEXT_MESSAGE_END),messageId:A.string()}),V_=Ee.extend({type:A.literal(D.TEXT_MESSAGE_CHUNK),messageId:A.string().optional(),role:Hy.optional(),delta:A.string().optional(),name:A.string().optional()}),G_=Ee.extend({type:A.literal(D.THINKING_TEXT_MESSAGE_START)}),B_=zy.omit({messageId:!0,type:!0}).extend({type:A.literal(D.THINKING_TEXT_MESSAGE_CONTENT)}),$_=Ee.extend({type:A.literal(D.THINKING_TEXT_MESSAGE_END)}),Q_=Ee.extend({type:A.literal(D.TOOL_CALL_START),toolCallId:A.string(),toolCallName:A.string(),parentMessageId:A.string().optional()}),H_=Ee.extend({type:A.literal(D.TOOL_CALL_ARGS),toolCallId:A.string(),delta:A.string()}),z_=Ee.extend({type:A.literal(D.TOOL_CALL_END),toolCallId:A.string()}),W_=Ee.extend({messageId:A.string(),type:A.literal(D.TOOL_CALL_RESULT),toolCallId:A.string(),content:A.string(),role:A.literal("tool").optional()}),K_=Ee.extend({type:A.literal(D.TOOL_CALL_CHUNK),toolCallId:A.string().optional(),toolCallName:A.string().optional(),parentMessageId:A.string().optional(),delta:A.string().optional()}),Y_=Ee.extend({type:A.literal(D.THINKING_START),title:A.string().optional()}),X_=Ee.extend({type:A.literal(D.THINKING_END)}),Z_=Ee.extend({type:A.literal(D.STATE_SNAPSHOT),snapshot:E_}),J_=Ee.extend({type:A.literal(D.STATE_DELTA),delta:A.array(A.any())}),ek=Ee.extend({type:A.literal(D.MESSAGES_SNAPSHOT),messages:A.array($y)}),tk=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)}),rk=Ee.extend({type:A.literal(D.ACTIVITY_DELTA),messageId:A.string(),activityType:A.string(),patch:A.array(A.any())}),nk=Ee.extend({type:A.literal(D.RAW),event:A.any(),source:A.string().optional()}),ok=Ee.extend({type:A.literal(D.CUSTOM),name:A.string(),value:A.any()}),ik=Ee.extend({type:A.literal(D.RUN_STARTED),threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),input:x_.optional()}),sk=A.object({type:A.literal("success")}).strict(),ak=A.object({type:A.literal("interrupt"),interrupts:A.array(w_).min(1)}).strict(),ck=A.discriminatedUnion("type",[sk,ak]),uk=Ee.extend({type:A.literal(D.RUN_FINISHED),threadId:A.string(),runId:A.string(),result:A.any().optional(),outcome:ck.nullable().optional().transform(e=>e??void 0)}),lk=Ee.extend({type:A.literal(D.RUN_ERROR),message:A.string(),code:A.string().optional()}),dk=Ee.extend({type:A.literal(D.STEP_STARTED),stepName:A.string()}),pk=Ee.extend({type:A.literal(D.STEP_FINISHED),stepName:A.string()}),fk=A.union([A.literal("tool-call"),A.literal("message")]),mk=Ee.extend({type:A.literal(D.REASONING_START),messageId:A.string()}),gk=Ee.extend({type:A.literal(D.REASONING_MESSAGE_START),messageId:A.string(),role:A.literal("reasoning")}),hk=Ee.extend({type:A.literal(D.REASONING_MESSAGE_CONTENT),messageId:A.string(),delta:A.string()}),yk=Ee.extend({type:A.literal(D.REASONING_MESSAGE_END),messageId:A.string()}),vk=Ee.extend({type:A.literal(D.REASONING_MESSAGE_CHUNK),messageId:A.string().optional(),delta:A.string().optional()}),Sk=Ee.extend({type:A.literal(D.REASONING_END),messageId:A.string()}),Ak=Ee.extend({type:A.literal(D.REASONING_ENCRYPTED_VALUE),subtype:fk,entityId:A.string(),encryptedValue:A.string()}),Ga=A.discriminatedUnion("type",[q_,zy,U_,V_,Y_,X_,G_,B_,$_,Q_,H_,z_,K_,W_,Z_,J_,ek,tk,rk,nk,ok,ik,uk,lk,dk,pk,mk,gk,hk,yk,vk,Sk,Ak]);m();d();f();p();var $d={};Wi($d,{JsonPatchError:()=>Ve,_areEquals:()=>Di,applyOperation:()=>An,applyPatch:()=>Ka,applyReducer:()=>Ek,deepClone:()=>Ck,getValueByPointer:()=>za,validate:()=>Ky,validator:()=>Wa});m();d();f();p();m();d();f();p();var bk=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)}}(),wk=Object.prototype.hasOwnProperty;function $a(e,t){return wk.call(e,t)}function Qa(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)$a(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 Ha(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 Ni(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Ba(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Ba(e[t]))return!0}else if(typeof e=="object"){for(var n=Qa(e),o=n.length,i=0;i<o;i++)if(Ba(e[n[i]]))return!0}}return!1}function Wy(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 Fi=function(e){bk(t,e);function t(r,n,o,i,s){var a=this.constructor,c=e.call(this,Wy(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=Wy(r,{name:n,index:o,operation:i,tree:s}),c}return t}(Error);var Ve=Fi,Ck=nt,yo={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:Di(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},xk={add:function(e,t,r){return Ha(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:yo.move,copy:yo.copy,test:yo.test,_get:yo._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):Wa(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=Di(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,E=void 0,y=void 0,h=void 0;for(typeof r=="function"?h=r:h=Wa;;){if(y=c[g],y&&y.indexOf("~")!=-1&&(y=Ni(y)),o&&(y=="__proto__"||y=="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&&E===void 0&&(u[y]===void 0?E=c.slice(0,g).join("/"):g==v-1&&(E=t.path),E!==void 0&&h(t,0,e,E)),g++,Array.isArray(u)){if(y==="-")y=u.length;else{if(r&&!Ha(y))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);Ha(y)&&(y=~~y)}if(g>=v){if(r&&t.op==="add"&&y>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=xk[t.op].call(t,u,y,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=yo[t.op].call(t,u,y,e);if(s.test===!1)throw new Ve("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}if(u=u[y],r&&g<v&&(!u||typeof u!="object"))throw new Ve("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function Ka(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 Ek(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 Wa(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(yo[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")&&Ba(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=Ky([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 Ky(e,t,r){try{if(!Array.isArray(e))throw new Ve("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Ka(nt(t),nt(e),r||!0);else{r=r||Wa;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 Di(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(!Di(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],!Di(e[s],t[s]))return!1;return!0}return e!==e&&t!==t}var Wd={};Wi(Wd,{compare:()=>Nk,generate:()=>Qd,observe:()=>Pk,unobserve:()=>Ok});m();d();f();p();var Hd=new WeakMap,Ik=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),Rk=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function Tk(e){return Hd.get(e)}function _k(e,t){return e.observers.get(t)}function kk(e,t){e.observers.delete(t.callback)}function Ok(e,t){t.unobserve()}function Pk(e,t){var r=[],n,o=Tk(e);if(!o)o=new Ik(e),Hd.set(e,o);else{var i=_k(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(){Qd(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(){Qd(n),clearTimeout(n.next),kk(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 Rk(t,n)),n}function Qd(e,t){t===void 0&&(t=!1);var r=Hd.get(e.object);zd(r.value,e.object,e.patches,"",t),e.patches.length&&Ka(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=Qa(t),s=Qa(e),a=!1,c=!1,u=s.length-1;u>=0;u--){var g=s[u],v=e[g];if($a(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var E=t[g];typeof v=="object"&&v!=null&&typeof E=="object"&&E!=null&&Array.isArray(v)===Array.isArray(E)?zd(v,E,r,n+"/"+Kt(g),o):v!==E&&(a=!0,o&&r.push({op:"test",path:n+"/"+Kt(g),value:nt(v)}),r.push({op:"replace",path:n+"/"+Kt(g),value:nt(E)}))}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];!$a(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+Kt(g),value:nt(t[g])})}}}function Nk(e,t,r){r===void 0&&(r=!1);var n=[];return zd(e,t,n,"",r),n}var Ya=Object.assign({},$d,Wd,{JsonPatchError:Fi,deepClone:nt,escapePathComponent:Kt,unescapePathComponent:Ni});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Kd=function(e,t){return Kd=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])},Kd(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");Kd(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Yy(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 Xa(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 vo(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 So(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 Xy(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(y){return function(h){return Promise.resolve(h).then(y,v)}}function a(y,h){n[y]&&(o[y]=function(S){return new Promise(function(w,I){i.push([y,S,w,I])>1||c(y,S)})},h&&(o[y]=h(o[y])))}function c(y,h){try{u(n[y](h))}catch(S){E(i[0][3],S)}}function u(y){y.value instanceof bn?Promise.resolve(y.value.v).then(g,v):E(i[0][2],y)}function g(y){c("next",y)}function v(y){c("throw",y)}function E(y,h){y(h),i.shift(),i.length&&c(i[0][0],i[0][1])}}function Zy(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 Ao(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 Za=Ao(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
31
+ `;function YE(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var XE=["1",1,"yes",!0];function ZE(){let e=[];return Ll()&&e.push(window.doNotTrack),Yl()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>XE.indexOf(t)!==-1)}function ia(e){return e===!0?!1:ZE()}var Wg="v15",Kg={default:"https://analytics.cloud.coveo.com/rest/ua"};function JE(e=Kg.default,t=Wg,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 eI="38824e1f-37f5-42d3-8372-a4b8fa9df946",$t=class{get defaultOptions(){return{endpoint:Kg.default,isCustomEndpoint:!1,token:"",version:Wg,beforeSendHooks:[],afterSendHooks:[]}}get version(){return $g}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=[Bx,jx].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};ia(this.options.disableBrowserPrivacySignals)?this.runtime=new oa: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 Ll()&&Yn()?new Wl(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(YE()&&console.warn(KE),new Kl(t))}get storage(){return this.runtime.storage}determineVisitorId(){return q(this,void 0,void 0,function*(){try{return Ll()&&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(Js(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(ea(t,ea(r,eI)))}})}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(ia(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||!Yn()||!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[y=>n.length>0?this.parseVariableArgumentsPayload(n,y):y[0],y=>q(this,void 0,void 0,function*(){return Object.assign(Object.assign({},y),{visitorId:o?yield this.getCurrentVisitorId():""})}),y=>q(this,void 0,void 0,function*(){return s?Object.assign(Object.assign({},y),{clientId:yield this.getCurrentVisitorId()}):y}),y=>i?this.ensureAnonymousUserWhenUsingApiKey(y):y,y=>this.beforeSendHooks.reduce((h,S)=>q(this,void 0,void 0,function*(){let w=yield h;return yield S(t,w)}),y)].reduce((y,h)=>q(this,void 0,void 0,function*(){let S=yield y;return yield h(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,E)=>q(this,void 0,void 0,function*(){let y=yield v;return yield E(y)}),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 Zs().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(BE(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&&Xs(r)&&(o=this.lowercaseKeys(r));let i=$E(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=cr(t,["custom"]);if(r&&Xs(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 WE(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")&&Xs(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Xs(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"?rE(t,r):t}get baseUrl(){return JE(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 B;(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"})(B||(B={}));var jg={[B.triggerNotify]:"queryPipelineTriggers",[B.triggerExecute]:"queryPipelineTriggers",[B.triggerQuery]:"queryPipelineTriggers",[B.triggerRedirect]:"queryPipelineTriggers",[B.queryErrorBack]:"errors",[B.queryErrorClear]:"errors",[B.queryErrorRetry]:"errors",[B.pagerNext]:"getMoreResults",[B.pagerPrevious]:"getMoreResults",[B.pagerNumber]:"getMoreResults",[B.pagerResize]:"getMoreResults",[B.pagerScrolling]:"getMoreResults",[B.facetSearch]:"facet",[B.facetShowLess]:"facet",[B.facetShowMore]:"facet",[B.recommendation]:"recommendation",[B.likeSmartSnippet]:"smartSnippet",[B.dislikeSmartSnippet]:"smartSnippet",[B.expandSmartSnippet]:"smartSnippet",[B.collapseSmartSnippet]:"smartSnippet",[B.openSmartSnippetFeedbackModal]:"smartSnippet",[B.closeSmartSnippetFeedbackModal]:"smartSnippet",[B.sendSmartSnippetReason]:"smartSnippet",[B.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.clearRecentQueries]:"recentQueries",[B.recentResultClick]:"recentlyClickedDocuments",[B.clearRecentResults]:"recentlyClickedDocuments",[B.showLessFoldedResults]:"folding",[B.caseDetach]:"case",[B.likeGeneratedAnswer]:"generatedAnswer",[B.dislikeGeneratedAnswer]:"generatedAnswer",[B.openGeneratedAnswerSource]:"generatedAnswer",[B.generatedAnswerOpenInlineLink]:"generatedAnswer",[B.generatedAnswerFollowupOpenSource]:"generatedAnswer",[B.generatedAnswerStreamEnd]:"generatedAnswer",[B.generatedAnswerSourceHover]:"generatedAnswer",[B.generatedAnswerCopyToClipboard]:"generatedAnswer",[B.generatedAnswerHideAnswers]:"generatedAnswer",[B.generatedAnswerShowAnswers]:"generatedAnswer",[B.generatedAnswerExpand]:"generatedAnswer",[B.generatedAnswerCollapse]:"generatedAnswer",[B.generatedAnswerFeedbackSubmit]:"generatedAnswer",[B.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"},Jn=class{constructor(){this.runtime=new oa,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 $g}};function tI(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function rI(e){return e.map(t=>t.replace(/;/g,""))}function Yg(e){let r=e.join(";");return r.length<=256?r:Yg(e.slice(1))}var qg=e=>{let t=rI(e),r=tI(t);return Yg(r)};function Ug(e){let t=typeof e.partialQueries=="string"?e.partialQueries:qg(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:qg(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var sa=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||ia(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new Jn:new $t(t)}disable(){this.coveoAnalyticsClient=new Jn}enable(){this.coveoAnalyticsClient=new $t(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(B.interfaceLoad)}logInterfaceLoad(){return q(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(B.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(B.didyoumeanClick)}logDidYouMeanClick(){return q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(B.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(B.searchboxSubmit)}logSearchboxSubmit(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(B.searchboxClear)}logSearchboxClear(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(B.searchboxAsYouType)}logSearchboxAsYouType(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(B.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(B.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(B.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(B.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(B.omniboxAnalytics,Ug(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(B.omniboxFromLink,Ug(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(B.searchFromLink)}logSearchFromLink(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.pagerScrolling)}logPagerScrolling(){return q(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.queryErrorBack);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.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(B.queryErrorRetry);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.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(B.queryErrorClear);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.queryErrorClear)})}})}logQueryErrorClear(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(B.likeSmartSnippet)}logLikeSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(B.dislikeSmartSnippet)}logDislikeSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(B.expandSmartSnippet)}logExpandSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(B.collapseSmartSnippet)}logCollapseSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(B.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(B.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(B.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(B.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(B.recentQueryClick)}logRecentQueryClick(){return q(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(B.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(B.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(B.clearRecentResults)}logClearRecentResults(){return q(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(B.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(B.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(B.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=jg[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=jg[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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return q(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(B.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},aa=Object.assign({},fi),Vg=Object.keys(aa).map(e=>aa[e]),Xn=class extends Ul{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])=>Vg.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Vg.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(aa.pageview,{newEventType:ve.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(aa.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 aE(this.ticket)}};Xn.Id="svc";var ca;(function(e){e.click="click",e.flowStart="flowStart"})(ca||(ca={}));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 ua;(function(e){e.quit="Quit",e.solved="Solved"})(ua||(ua={}));var la=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!ia(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new $t(t):new Jn,this.svc=new Xn({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Jn,this.svc=new Xn({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new $t(this.options),this.svc=new Xn({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:ua.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(Ct.caseSolved,{reason:ua.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",ca.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",ca.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 nI=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 nI(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=$n),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||Hn()}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 eo=e=>new $t(e).getCurrentVisitorId(),hi=(e,t)=>typeof t=="function"?(...r)=>{let n=Uo(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,yi=(e,t)=>(...r)=>{let n=Uo(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var vi=class extends en{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Xg=({logger:e,getState:t,analyticsClientMiddleware:r=(s,a)=>a,preprocessRequest:n,provider:o=new vi(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 la({enableAnalytics:g,token:a,endpoint:c,runtimeEnvironment:u,disableBrowserPrivacySignals:i,preprocessRequest:hi(e,n),beforeSendHooks:[yi(e,r),(E,y)=>(e.info({...y,type:E,endpoint:c,token:a},"Analytics request"),y)]},o);return g||v.disable(),v};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function da(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function Zg(e){let{activeValue:t,ancestryMap:r}=sI(e);return t?aI(t,r):[]}function sI(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 aI(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var cI=(e,t)=>e.categoryFacetSet[t]?.request;var Xl=(e,t)=>{let r=cI(e,t);return Zg(r?.currentValues??[])};m();d();f();p();function pa(){return{}}m();d();f();p();function fa(){return{}}m();d();f();p();function ma(){return{}}m();d();f();p();function ga(){return{}}function Zl(e){return{facetSet:e.facetSet??ga(),categoryFacetSet:e.categoryFacetSet??pa(),dateFacetSet:e.dateFacetSet??fa(),numericFacetSet:e.numericFacetSet??ma(),automaticFacetSet:e.automaticFacetSet??da()}}var Jl=e=>{let t=[];return dI(e).forEach((r,n)=>{let o=SI(e,r.facetId),i=yI(r,n+1);if(lI(r)){if(!!!Xl(e,r.facetId).length)return;t.push({...i,...gI(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((s,a)=>{if(s.state==="idle")return;let c=Jg(s,a+1,o),u=uI(r)?eh(s):fI(s);t.push({...i,...c,...u})})}),pI(e).forEach((r,n)=>{let o=hI(r,n+1);r.values.forEach((i,s)=>{if(i.state==="idle")return;let a=Jg(i,s+1,"specific"),c=eh(i);t.push({...o,...a,...c})})}),t},uI=e=>e.type==="specific",lI=e=>e.type==="hierarchical",dI=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),pI=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),Jg=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),fI=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),eh=e=>({displayValue:e.value,value:e.value}),mI=(e,t)=>Xl(e,t).map(n=>n.value).join(";"),gI=(e,t)=>{let n=mI(e,t);return{value:n,valuePosition:1,displayValue:n}},hI=(e,t)=>({title:th(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),yI=(e,t)=>({title:th(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),th=(e,t)=>`${e}_${t}`,vI=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,SI=(e,t)=>{let r=vI(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var ed=e=>e.configuration.search.locale,rh=e=>e.configuration.search.timezone,nh=e=>e.configuration.accessToken,oh=e=>e.configuration.organizationId,ih=e=>e.configuration.environment,ha=e=>e.configuration?.knowledge?.agentId,sh=e=>e.configuration.knowledge.debugAgentSession;var Oe=e=>{if(AI(e)||td(e))return e.generatedAnswer?.answerId;if(bI(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},AI=e=>"answer"in e&&"generatedAnswer"in e&&!ce(e.generatedAnswer?.answerConfigurationId),td=e=>{let t=ha(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},bI=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",rd=e=>e.generatedAnswer?.fieldsToIncludeInCitations,Ar=e=>e.followUpAnswers?.conversationId,wI=e=>e.generatedAnswer?.citations,CI=e=>e.followUpAnswers?.followUpAnswers,xI=Ue(CI,e=>e?.flatMap(t=>t.citations)),EI=(e,t)=>t,to=Ue(wI,xI,EI,(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 nd(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Qt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:nd(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:nd(),extendedResults:{},searchAction:void 0}}m();d();f();p();m();d();f();p();m();d();f();p();var ah=(r=>(r.Ascending="ascending",r.Descending="descending",r))(ah||{}),ch=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(ch||{}),od=e=>{if(If(e))return e.map(t=>od(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""}},uh=()=>({by:"relevancy"});var CV=new xe({values:{by:new Qu({enum:ch,required:!0}),order:new Qu({enum:ah}),field:new re}});function ya(){return od(uh())}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function II(){return typeof navigator<"u"}function lh(){try{return typeof localStorage<"u"}catch{return!1}}function dh(){try{return typeof sessionStorage<"u"}catch{return!1}}function ph(){return II()&&navigator.cookieEnabled}m();d();f();p();var ro=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?fh(t,r,i):(s=a.split("."),o=s[s.length-2]+"."+s[s.length-1],fh(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 fh(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function mh(){return lh()?localStorage:ph()?new va:dh()?sessionStorage:new id}var va=class e{getItem(t){return ro.get(`${e.prefix}${t}`)}removeItem(t){ro.erase(`${e.prefix}${t}`)}setItem(t,r,n){ro.set(`${e.prefix}${t}`,r,n)}};va.prefix="coveo_";var id=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var Sa="__coveo.analytics.history",RI=20,TI=1e3*60,_I=75,Aa=class{constructor(t){this.store=t||mh()}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(Sa);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this6=this;return _asyncToGenerator(function*(){try{let t=yield _this6.store.getItem(Sa);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(Sa,JSON.stringify(t.slice(0,RI)))}catch{}}clear(){try{this.store.removeItem(Sa)}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,_I)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>TI:!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 Aa{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 Si=class Si 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 Jl(Zl(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Si.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||Si.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??ya()}}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(Si,"fallbackPipelineName","default");var br=Si,gh=({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 sa({token:a,endpoint:c,runtimeEnvironment:u,disableBrowserPrivacySignals:i,preprocessRequest:hi(e,n),beforeSendHooks:[yi(e,r),(E,y)=>(e.info({...y,type:E,endpoint:c,token:a},"Analytics request"),y)]},o);return g||v.disable(),v},sd=()=>{let t=yt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};m();d();f();p();function hh(e){let t=yh(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return hf([e,...t,...r],o=>o.uniqueId)}function yh(e){return e.childResults?e.childResults.flatMap(t=>[t,...yh(t)]):[]}m();d();f();p();var no=()=>"";function Sh(e,t){return{...new br(t).getBaseMetadata(),actionCause:e,type:e}}function kI(e){return Object.assign(e,{instantlyCallable:!0})}function OI(e,t){let r=i=>{let s=Ce(e,i);return kI(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*(E,{getState:y,extra:h}){return yield v({state:y(),extra:h})});return function(_x45,_x46){return _ref19.apply(this,arguments)}}())}});return function prepare(_x44){return _ref18.apply(this,arguments)}}()}),n}var Ah=(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 FI(i)}return n},PI=e=>e.configuration.analytics.analyticsMode==="legacy",NI=e=>e.configuration.analytics.analyticsMode==="next",FI=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:s})=>(r??(r=a=>new s(a)),OI(e,/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*({getState:a,analyticsClientMiddleware:c,preprocessRequest:u,logger:g,disableBrowserPrivacySignals:v}){let E=[],y={log:function(){var _ref21=_asyncToGenerator(function*({state:T}){for(let R of E)yield R(T)});return function log(_x48){return _ref21.apply(this,arguments)}}()},h=a(),S=i({getState:a,logger:g,analyticsClientMiddleware:c,preprocessRequest:u,disableBrowserPrivacySignals:v,provider:r(a)}),w=yield t(S,a());y.description=w?.description,E.push(/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(T){PI(T)&&(yield DI(w,r,T,g,S.coveoAnalyticsClient))});return function(_x49){return _ref22.apply(this,arguments)}}());let{emit:I}=si(h);return E.push(/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(T){if(NI(T)&&o&&n){let R=n(T);yield BI(I,o,R)}});return function(_x50){return _ref23.apply(this,arguments)}}()),y});return function(_x47){return _ref20.apply(this,arguments)}}()));function DI(_x51,_x52,_x53,_x54,_x55){return _DI.apply(this,arguments)}function _DI(){_DI=_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 _DI.apply(this,arguments)}var MI=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=Ah(e=>gh({...e,provider:e.provider||new br(e.getState)}),e=>e,br),vt=Ah(Xg,MI("caseAssist"),vi);var ad=(e,t)=>{let r=i=>i+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=Rh(e,o),n<0&&(n=GI(e,o)),n<0&&(n=0),LI(e,r(n),t)};var bh=(e,t)=>({sourceName:Ch(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||no()}),wh=(e,t)=>({sourceName:Ch(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||no()});function Ch(e){let t=e.source;return ce(t)?"unknown":t}var xh=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function LI(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:UI(e),...(vh(e)?{documentCategory:vh(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:VI(e),queryPipeline:r.pipeline||no()}}function vh(e){return e.raw?.objecttype||void 0}var cd=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||""}),Eh={urihash:new re,sourcetype:new re,permanentid:new re},Ih={uniqueId:ee,raw:new xe({values:Eh}),title:ee,uri:ee,clickUri:ee,rankingModifier:new re({required:!1,emptyAllowed:!0})};function jI(e){return Object.assign({},...Object.keys(Eh).map(t=>({[t]:e[t]})))}function qI(e){return Object.assign({},...Object.keys(Ih).map(t=>({[t]:e[t]})),{raw:jI(e.raw)})}function UI(e){let t=e.raw.author;return ce(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function VI(e){let t=e.raw.source;return ce(t)?"unknown":t}var ud=e=>new Nt(Ih).validate(qI(e));function GI(e,t){for(let[r,n]of t.entries()){let o=hh(n);if(Rh(e,o)!==-1)return r}return-1}function Rh(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function BI(_x57,_x58,_x59){return _BI.apply(this,arguments)}function _BI(){_BI=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _BI.apply(this,arguments)}m();d();f();p();var ba=e=>{if(e==="yes")return!0;if(e==="no")return!1},$I=()=>Re("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function QI(e,t){return Re({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??Oe(n),i=to(n,e);if(!o||!i)return null;let s=Ar(n);return r.makeGeneratedAnswerCitationClick(bh(i,n),{generativeQuestionAnsweringId:o,citationId:i.id,documentId:xh(i),...(s&&{conversationId:s})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=to(r,e);return{answerId:t??Oe(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function HI(e,t,r){return Re({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let i=r??Oe(o),s=to(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=to(n,e);return{answerId:r??Oe(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function zI(e,t){return Re({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function WI(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 KI(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 YI=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:ba(o),documented:ba(i),correctTopic:ba(a),hallucinationFree:ba(s)},additionalNotes:u,correctAnswerUrl:c}}}),ld=(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})}),oo=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||""})}),XI=()=>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"})}),ZI=()=>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"})}),JI=()=>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"})}),eR=()=>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 tR(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 rR(e,t){return Re({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=to(n,e);if(!o)return null;let i=Ar(n);return i?r.makeGeneratedAnswerFollowupOpenSource({...wh(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:i}):null}})}var wa={logCopyGeneratedAnswer:tR,logGeneratedAnswerHideAnswers:ZI,logGeneratedAnswerShowAnswers:XI,logGeneratedAnswerStreamEnd:ld,logGeneratedAnswerFeedback:YI,logDislikeGeneratedAnswer:KI,logLikeGeneratedAnswer:WI,logGeneratedAnswerOpenInlineLink:zI,logHoverCitation:HI,logOpenGeneratedAnswerSource:QI,logOpenGeneratedAnswerFollowUpSource:rR,logRetryGeneratedAnswer:$I,logGeneratedAnswerExpand:JI,logGeneratedAnswerCollapse:eR};m();d();f();p();m();d();f();p();var Th=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:zn(e)}});m();d();f();p();var dd=e=>e.context;m();d();f();p();var pd=e=>e.pipeline;m();d();f();p();m();d();f();p();var bi=Pt(Ca(),1),Fh=Pt(_h(),1);m();d();f();p();var Oh=Pt(Ca(),1),Ph=Pt(kh(),1);Oh.default.extend(Ph.default);var nR="YYYY/MM/DD@HH:mm:ss";function Nh(e){return e.format(nR)}bi.default.extend(Fh.default);var oR=["past","now","next"],iR=["minute","hour","day","week","month","quarter","year"];function sR(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,bi.default)().subtract(r,n);case"next":return(0,bi.default)().add(r,n);case"now":return(0,bi.default)()}}function Sd(e){return Nh(sR(aR(e)))}function Dh(e){return e.toLocaleLowerCase().split("-")}function Ad(e){let[t,r,n]=Dh(e);if(t==="now")return!0;if(!oR.includes(t)||!iR.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function aR(e){let[t,r,n]=Dh(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function Mh(e){return e.type==="dateRange"}function Lh(e){return`start${e}`}function jh(e){return`end${e}`}var bd=()=>({dateFacetValueMap:{}});function cR(e,t,r){let n=e.start,o=e.end;return Ad(n)&&(n=Sd(n),r.dateFacetValueMap[t][Lh(n)]=e.start),Ad(o)&&(o=Sd(o),r.dateFacetValueMap[t][jh(o)]=e.end),{...e,start:n,end:o}}function wd(e,t){if(Mh(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>cR(o,r,t))}}return e}function wr(e){let t=bd();return{request:{...e,facets:e.facets?.map(n=>wd(n,t))},mappings:t}}function uR(e,t,r){return{...e,start:r.dateFacetValueMap[t][Lh(e.start)]||e.start,end:r.dateFacetValueMap[t][jh(e.end)]||e.end}}function lR(e,t){return e.facetId in t.dateFacetValueMap}function dR(e,t){return lR(e,t)?{...e,values:e.values.map(r=>uR(r,e.facetId,t))}:e}function xa(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>dR(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 Cd(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 qh(e){return Cr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var xd={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function pR(e){return Cr(e).map(t=>{let r=xd[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function fR(e){return[...pR(e.facetSet??{}),...qh(e.numericFacetSet??{}),...qh(e.dateFacetSet??{}),...Cr(e.categoryFacetSet??{})]}function mR(e){return fR(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function Ea(e){return Cd(mR(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();m();d();f();p();var Uh=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield eo(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}),...(sd()&&{pageId:sd()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:zn(e)})}}});return function Uh(_x60,_x61){return _ref25.apply(this,arguments)}}();var io=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Dn(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 Uh(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 io(_x62,_x63){return _ref26.apply(this,arguments)}}();m();d();f();p();var Ia=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Dn(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 Vh=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=Id(e),o=gR(e),i=hR(e),s=e.configuration.analytics.analyticsMode==="legacy"?yield io(e,r):Ia(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:Ed(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 Ed(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function gR(e){return Cd(vR(e),e.facetOrder??[])}function hR(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(yR).filter(r=>r.currentValues.length>0):void 0}function yR(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function vR(e){return SR(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function SR(e){return[...AR(e.facetSet??{}),...Gh(e.numericFacetSet??{}),...Gh(e.dateFacetSet??{}),...Cr(e.categoryFacetSet??{})]}function AR(e){return Cr(e).map(t=>{let r=xd[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function Gh(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 Id(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=Vh(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();f();p();m();d();f();p();var Ci=(e,t)=>{let r=e;return ce(r[t])?ce(e.raw[t])?null:e.raw[t]:r[t]},bR=e=>t=>e.every(r=>!ce(Ci(t,r))),wR=e=>t=>e.every(r=>ce(Ci(t,r))),CR=(e,t)=>r=>{let n=Bh(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},xR=(e,t)=>r=>{let n=Bh(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},Bh=(e,t)=>{let r=Ci(t,e);return gf(r)?r:[r]},$h={getResultProperty:Ci,fieldsMustBeDefined:bR,fieldsMustNotBeDefined:wR,fieldMustMatch:CR,fieldMustNotMatch:xR};var Rd=Ue(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var Td=e=>e.searchHub;m();d();f();p();var Ra=Ue(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),B$=Ue(e=>e,e=>{let t=Ra(e);return t&&e?e[t].expression:""});m();d();f();p();var Qh=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var Hh=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 Wh=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 Kh=e=>e.sortCriteria;var Yh=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Fn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function Yh(_x67){return _ref28.apply(this,arguments)}}(),Xh=(e,t)=>{let r=Zr(e)?.q,{aq:n,cq:o,dq:i,lq:s}=ey(e),a=dd(e),c=rn(e.configuration.analytics,t,{actionCause:Rd(e)}),u=Td(e),g=pd(e),v=rd(e)??[],E=Jh(e),y=Ra(e.tabSet)||"default",h=ed(e),S=rh(e),w=t.referrer||"",I=zh(e),T=Kh(e),R=ER(e),k=Hh(e),_=Wh(e),F=Qh(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(s&&{lq:s}),...(e.query&&{enableQuerySyntax:_g(e)}),...(a?.contextValues&&{context:a.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(u?.length&&{searchHub:u}),...(g?.length&&{pipeline:g}),...(E.length&&{facets:E}),...(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:Ed(e),firstResult:e.pagination.firstResult}),tab:y,locale:h,timezone:S,...(e.debug!==void 0&&{debug:e.debug}),referrer:w,...R,...(_??{}),...(k&&{excerptLength:k}),...(F&&{dictionaryFieldContext:F}),sortCriteria:T,...(I&&{facetOptions:I}),...c,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Zh=(e,t)=>{let r=Zr(e)?.q,n=Jh(e),o=rn(e.configuration.analytics,t,{actionCause:Rd(e)}),i=ed(e),s=Ra(e.tabSet)||"default",a=t.referrer,{aq:c,cq:u}=ey(e),g=Td(e),v=pd(e),E=dd(e),y=rd(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:y,...(g?.length&&{searchHub:g}),...(v?.length&&{pipeline:v}),...(E?.contextValues&&{context:E.contextValues}),...(c&&{aq:c}),...(u&&{cq:u}),tab:s,referrer:a,...o,locale:i}},Jh=e=>Ea(e)?.map(t=>wd(t,bd())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),ER=e=>({actionsHistory:e.configuration.analytics.enabled?yt.getInstance().getHistory():[]}),ey=e=>{let t=Th(e),r=Id(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var Ta=["searching","thinking","answering"];function _a(e){return e.toLowerCase()}var ka=["search","generic"];m();d();f();p();var ty=["text/plain","text/markdown"];var so=new re({required:!0}),ry=new re,ao=new je({required:!0}),_d={id:so,title:so,uri:so,permanentid:so,clickUri:ry},Oa=new re({required:!0,constrainTo:ty}),ny=new re({required:!0,constrainTo:Ta}),oy=e=>({...e,name:_a(e.name)}),uQ=G("generatedAnswer/setIsVisible",e=>W(e,ao)),Pa=G("generatedAnswer/setAnswerId",e=>W(e,ee)),lQ=G("generatedAnswer/setAnswerGenerationMode",e=>W(e,new re({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),dQ=G("generatedAnswer/setIsEnabled",e=>W(e,ao)),Ei=G("generatedAnswer/updateMessage",e=>W(e,{textDelta:so})),Ii=G("generatedAnswer/updateCitations",e=>W(e,{citations:new Ft({required:!0,each:new xe({values:_d})})})),Ri=G("generatedAnswer/updateError",e=>W(e,{message:ry,code:new Le({min:0})})),Na=G("generatedAnswer/resetAnswer"),pQ=G("generatedAnswer/like"),fQ=G("generatedAnswer/dislike"),mQ=G("generatedAnswer/feedbackModal/open"),gQ=G("generatedAnswer/expand"),hQ=G("generatedAnswer/collapse"),yQ=G("generatedAnswer/setId",e=>W(e,{id:new re({required:!0})})),vQ=G("generatedAnswer/feedbackModal/close"),SQ=G("generatedAnswer/sendFeedback"),Er=G("generatedAnswer/setIsLoading",e=>W(e,ao)),xi=G("generatedAnswer/setIsStreaming",e=>W(e,ao)),Ti=G("generatedAnswer/setAnswerContentFormat",e=>W(e,Oa)),AQ=G("generatedAnswer/updateResponseFormat",e=>W(e,{contentFormat:new Ft({each:Oa,default:["text/plain"]})})),bQ=G("knowledge/updateAnswerConfigurationId",e=>W(e,so)),wQ=G("generatedAnswer/registerFieldsToIncludeInCitations",e=>W(e,xm)),kd=G("generatedAnswer/setIsAnswerGenerated",e=>W(e,ao)),_i=G("generatedAnswer/setCannotAnswer",e=>W(e,ao)),IR=G("generatedAnswer/setAnswerApiQueryParams",e=>W(e,new xe({}))),iy=G("generatedAnswer/startStep",e=>W(oy(e),{name:ny,startedAt:new Le({min:0,required:!0})})),sy=G("generatedAnswer/finishStep",e=>W(oy(e),{name:ny,finishedAt:new Le({min:0,required:!0})})),ay=G("generatedAnswer/startToolCall",e=>W(e,{toolCallName:ee,startedAt:new Le({min:0,required:!0}),toolCallId:ee})),cy=G("generatedAnswer/finishToolCall",e=>W(e,{finishedAt:new Le({min:0,required:!0}),toolCallId:ee})),Fa=G("generatedAnswer/toolCallArgs",e=>W(e,{toolCallId:ee,args:new xe({options:{required:!0}}),type:new re({required:!0,constrainTo:ka})})),CQ=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 Yh(r),v=(h,S)=>{switch(h){case"genqa.headerMessageType":{let w=JSON.parse(S);n(Ti(w.contentFormat));break}case"genqa.messageType":n(Ei(JSON.parse(S)));break;case"genqa.citationsType":n(Ii(JSON.parse(S)));break;case"genqa.endOfStreamType":{let w=JSON.parse(S).answerGenerated,{answerId:I,answer:T}=i().generatedAnswer,k=c.length!==0&&!w,_=!T?.trim();n(_i(k)),n(xi(!1)),n(kd(w)),n((s??wa).logGeneratedAnswerStreamEnd(w,I,w?_:void 0)),n(oo());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${h}"`)}};n(Er(!0));let E=h=>h.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,y=o.streamingClient?.streamGeneratedAnswer(g,{write:h=>{E(g)&&(n(Er(!1)),h.payload&&h.payloadType&&v(h.payloadType,h.payload))},abort:h=>{E(g)&&n(Ri(h))},close:()=>{E(g)&&n(xi(!1))},resetAnswer:()=>{E(g)&&n(Na())}});y?u(y):n(Er(!1))});return function(_x68,_x69){return _ref29.apply(this,arguments)}}()),xQ=Ce("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(Na());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=Xh(i,n);r(IR(s)),yield r(uy(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 dy(_x72,_x73){return _dy.apply(this,arguments)}function _dy(){_dy=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _dy.apply(this,arguments)}function py(e){let t,r,n,o=!1;return function(s){t===void 0?(t=s,r=0,n=-1):t=TR(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 fy(e,t,r){let n=ly(),o=new TextDecoder;return function(s,a){if(s.length===0)r?.(n),n=ly();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":RR(g,n,t);break}}}}function RR(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function TR(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function ly(){return{data:"",event:"",id:"",retry:void 0}}var Od="text/event-stream",_R=1e3,my="last-event-id";function gy(){return typeof window<"u"}function hy(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:s,openWhenHidden:a,fetch:c,...u}){return new Promise((g,v)=>{let E={...r};E.accept||(E.accept=Od);let y;function h(){y?.abort(),document.hidden||k()}!a&&gy()&&document.addEventListener("visibilitychange",h);let S=_R,w;function I(){gy()&&document.removeEventListener("visibilitychange",h),clearTimeout(w),y?.abort()}t?.addEventListener("abort",()=>{I(),g()});let T=c??C,R=n??kR;function k(){return _k2.apply(this,arguments)}function _k2(){_k2=_asyncToGenerator(function*(){y=l.AbortController?new l.AbortController:null;try{let _=yield T(e,{...u,headers:E,signal:y?.signal});yield R(_),yield dy(_.body,py(fy(F=>{F?E[my]=F:delete E[my]},F=>{S=F},o))),i?.(),I(),g()}catch(_){if(!y?.signal?.aborted)try{let F=s?.(_)??S;clearTimeout(w),w=setTimeout(k,F)}catch(F){I(),v(F)}}});return _k2.apply(this,arguments)}k()})}function kR(e){let t=e.headers.get("content-type");if(!t?.startsWith(Od))throw new Error(`Expected content-type to be ${Od}, Actual: ${t}`)}m();d();f();p();var OR=/*#__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=Fn(n.configuration.search?.apiBaseUrl,s,i);return gg({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,E={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(y=>{E[y]=g[y]}),E.duplex="half",E.body=yield g.text(),C(v,E)});return function fetchFn(_x77){return _ref32.apply(this,arguments)}}()})(c,{...t,signal:null},r)}catch(u){return{error:u}}});return function OR(_x74,_x75,_x76){return _ref31.apply(this,arguments)}}(),yy=Tg({reducerPath:"answer",baseQuery:yg(OR,{maxRetries:3}),endpoints:()=>({})});var PR=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},NR=(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)},FR=(e,t)=>{delete e.error,e.citations=t.citations},DR=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},MR=(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})`)},LR=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&MR(t,o);let i=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":i.contentFormat&&(PR(t,i),r(Ti(i.contentFormat)));break;case"genqa.messageType":typeof i.textDelta=="string"&&(NR(t,i),r(Ei({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(FR(t,i),r(Ii({citations:i.citations})));break;case"genqa.endOfStreamType":{DR(t,i);let s=t.answerId,a=i.answerGenerated??!1,c=a?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(a,s,c)),r(oo());break}}},jR=(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`},Pd=yy.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}=yield s,{organizationId:v,environment:E,accessToken:y}=a,h=Fn(a.search.apiBaseUrl,v,E),S=jR(h,v,c.answerConfigurationId,u?.insightId);yield hy(S,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${y}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:C,onopen:function(){var _ref33=_asyncToGenerator(function*(w){let I=w.headers.get("x-answer-id");I&&o(T=>{T.answerId=I,i(Pa(I))})});return function onopen(_x80){return _ref33.apply(this,arguments)}}(),onmessage:w=>{o(I=>{LR(w,I,i,g??wa)})},onerror:w=>{throw w},onclose:()=>{o(w=>{i(_i(!w.generated))})}})}).apply(this,arguments)}})})}),uy=e=>Pd.endpoints.getAnswer.initiate(e);m();d();f();p();var vy=Qe($n,e=>e);m();d();f();p();function qR(e){let t=e.payload?.analyticsAction;return Sy(e)&&!ce(t)}function Sy(e){return"type"in e}var Ay=e=>t=>r=>{let n;qR(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return Sy(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 bH=G("tab/register",e=>{let t=new xe({values:{id:ee,expression:Dt}});return W(e,t)}),by=G("tab/updateActiveTab",e=>W(e,ee));m();d();f();p();var Da=Pt(Ca(),1),xy=Pt(wy(),1),Ey=Pt(Cy(),1);Da.default.extend(Ey.default);Da.default.extend(xy.default);var Iy=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:Da.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 UR=/(^|; )Coveo-Pendragon=([^;]*)/,VR=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function Ry(){return typeof window>"u"?!1:UR.exec(document.cookie)?.pop()||null}function Ty(){return typeof window>"u"?!1:VR.test(document.cookie)}var _y=Qe(Iy(),e=>e.addCase(Qn,(t,r)=>{GR(t,r.payload)}).addCase(js,(t,r)=>{BR(t,r.payload)}).addCase(qs,(t,r)=>{$R(t,r.payload)}).addCase(Us,t=>{t.analytics.enabled=!1}).addCase(Vs,t=>{t.analytics.enabled=!0}).addCase(Dm,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(Mm,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(by,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(_m,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Ds,(t,r)=>{ce(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Lm,(t,{payload:r})=>{QR(t,r)}));function GR(e,t){ce(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ce(t.organizationId)||(e.organizationId=t.organizationId)}function BR(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 $R(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=Ry();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 QR(e,t){e.knowledge.agentId=t;try{Ty()&&(e.knowledge.debugAgentSession=!0)}catch{}}var St=_y;m();d();f();p();function HR(e){return e.instantlyCallable}var ky=()=>e=>t=>e(HR(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 Oy(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 Ld,zR=new Uint8Array(16);function jd(){if(!Ld){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ld=crypto.getRandomValues.bind(crypto)}return Ld(zR)}m();d();f();p();m();d();f();p();var WR=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),qd={randomUUID:WR};function KR(e,t,r){if(qd.randomUUID&&!t&&!e)return qd.randomUUID();e=e||{};let n=e.random??e.rng?.()??jd();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 Oy(n)}var Ir=KR;m();d();f();p();m();d();f();p();var A={};Ki(A,{BRAND:()=>bT,DIRTY:()=>nn,EMPTY_PATH:()=>JR,INVALID:()=>ue,NEVER:()=>i_,OK:()=>at,ParseStatus:()=>rt,Schema:()=>ye,ZodAny:()=>_r,ZodArray:()=>fr,ZodBigInt:()=>sn,ZodBoolean:()=>an,ZodBranded:()=>Oi,ZodCatch:()=>vn,ZodDate:()=>cn,ZodDefault:()=>yn,ZodDiscriminatedUnion:()=>ja,ZodEffects:()=>Rt,ZodEnum:()=>gn,ZodError:()=>lt,ZodFirstPartyTypeKind:()=>le,ZodFunction:()=>Ua,ZodIntersection:()=>pn,ZodIssueCode:()=>z,ZodLazy:()=>fn,ZodLiteral:()=>mn,ZodMap:()=>mo,ZodNaN:()=>ho,ZodNativeEnum:()=>hn,ZodNever:()=>Lt,ZodNull:()=>ln,ZodNullable:()=>Wt,ZodNumber:()=>on,ZodObject:()=>dt,ZodOptional:()=>Et,ZodParsedType:()=>te,ZodPipeline:()=>Pi,ZodPromise:()=>kr,ZodReadonly:()=>Sn,ZodRecord:()=>qa,ZodSchema:()=>ye,ZodSet:()=>go,ZodString:()=>Tr,ZodSymbol:()=>po,ZodTransformer:()=>Rt,ZodTuple:()=>zt,ZodType:()=>ye,ZodUndefined:()=>un,ZodUnion:()=>dn,ZodUnknown:()=>pr,ZodVoid:()=>fo,addIssueToContext:()=>Z,any:()=>kT,array:()=>FT,bigint:()=>ET,boolean:()=>Gy,coerce:()=>o_,custom:()=>qy,date:()=>IT,datetimeRegex:()=>Ly,defaultErrorMap:()=>lr,discriminatedUnion:()=>jT,effect:()=>YT,enum:()=>zT,function:()=>$T,getErrorMap:()=>co,getParsedType:()=>Ht,instanceof:()=>CT,intersection:()=>qT,isAborted:()=>Ma,isAsync:()=>uo,isDirty:()=>La,isValid:()=>Rr,late:()=>wT,lazy:()=>QT,literal:()=>HT,makeIssue:()=>ki,map:()=>GT,nan:()=>xT,nativeEnum:()=>WT,never:()=>PT,null:()=>_T,nullable:()=>ZT,number:()=>Vy,object:()=>DT,objectUtil:()=>Ud,oboolean:()=>n_,onumber:()=>r_,optional:()=>XT,ostring:()=>t_,pipeline:()=>e_,preprocess:()=>JT,promise:()=>KT,quotelessJson:()=>YR,record:()=>VT,set:()=>BT,setErrorMap:()=>ZR,strictObject:()=>MT,string:()=>Uy,symbol:()=>RT,transformer:()=>YT,tuple:()=>UT,undefined:()=>TT,union:()=>LT,unknown:()=>OT,util:()=>Ae,void:()=>NT});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 Ud;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Ud||(Ud={}));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"]),YR=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 XR=(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=XR;var Py=lr;function ZR(e){Py=e}function co(){return Py}m();d();f();p();var ki=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}},JR=[];function Z(e,t){let r=co(),n=ki({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}),Ma=e=>e.status==="aborted",La=e=>e.status==="dirty",Rr=e=>e.status==="valid",uo=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}},Ny=(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(uo(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 Ny(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 uo(o)?o:Promise.resolve(o);return Ny(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 kr.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 Oi({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 Pi.create(this,t)}readonly(){return Sn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},eT=/^c[^\s-]{8,}$/i,tT=/^[0-9a-z]+$/,rT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,nT=/^[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,oT=/^[a-z0-9_-]{21}$/i,iT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sT=/^[-+]?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)?)??$/,aT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,cT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Vd,uT=/^(?:(?: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])$/,lT=/^(?:(?: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])$/,dT=/^(([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]))$/,pT=/^(([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])$/,fT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mT=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Dy="((\\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])))",gT=new RegExp(`^${Dy}$`);function My(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 hT(e){return new RegExp(`^${My(e)}$`)}function Ly(e){let t=`${Dy}T${My(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 yT(e,t){return!!((t==="v4"||!t)&&uT.test(e)||(t==="v6"||!t)&&dT.test(e))}function vT(e,t){if(!iT.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 ST(e,t){return!!((t==="v4"||!t)&&lT.test(e)||(t==="v6"||!t)&&pT.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")aT.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")Vd||(Vd=new RegExp(cT,"u")),Vd.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")nT.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")oT.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")eT.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")tT.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")rT.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"?Ly(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"?gT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?hT(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"?sT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"duration",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?yT(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"?vT(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"?ST(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"?fT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"base64",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?mT.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 AT(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"?AT(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 po=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)}};po.create=e=>new po({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 _r=class extends ye{constructor(){super(...arguments),this._any=!0}_parse(t){return at(t.data)}};_r.create=e=>new _r({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 fo=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)}};fo.create=e=>new fo({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 lo(e){if(e instanceof dt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Et.create(lo(n))}return new dt({...e._def,shape:()=>t})}else return e instanceof fr?new fr({...e._def,type:lo(e.element)}):e instanceof Et?Et.create(lo(e.unwrap())):e instanceof Wt?Wt.create(lo(e.unwrap())):e instanceof zt?zt.create(e.items.map(t=>lo(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,E=yield g.value;u.push({key:v,value:E,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 lo(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 jy(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 Oi||e instanceof Sn?dr(e.unwrap()):e instanceof vn?dr(e._def.innerType):[],ja=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 Gd(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=Gd(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=Gd(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(Ma(i)||Ma(s))return ue;let a=Gd(i.value,s.value);return a.valid?((La(i)||La(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 qa=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)})}},mo=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}}}};mo.create=(e,t,r)=>new mo({valueType:t,keyType:e,typeName:le.ZodMap,...me(r)});var go=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)}};go.create=(e,t)=>new go({valueType:e,minSize:null,maxSize:null,typeName:le.ZodSet,...me(t)});var Ua=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 ki({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,co(),lr].filter(u=>!!u),issueData:{code:z.invalid_arguments,argumentsError:c}})}function o(a,c){return ki({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,co(),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 kr){let a=this;return at(/*#__PURE__*/_asyncToGenerator(function*(...c){let u=new lt([]),g=yield a._def.args.parseAsync(c,i).catch(y=>{throw u.addIssue(n(c,y)),u}),v=yield Reflect.apply(s,this,g);return yield a._def.returns._def.type.parseAsync(v,i).catch(y=>{throw u.addIssue(o(v,y)),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 jy(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=jy;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 kr=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})))}};kr.create=(e,t)=>new kr({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 uo(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 ho=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}}};ho.create=e=>new ho({typeName:le.ZodNaN,...me(e)});var bT=Symbol("zod_brand"),Oi=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}},Pi=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 uo(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 Fy(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function qy(e,t={},r){return e?_r.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=Fy(t,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!i){let s=Fy(t,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):_r.create()}var wT={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 CT=(e,t={message:`Input not instance of ${e.name}`})=>qy(r=>r instanceof e,t),Uy=Tr.create,Vy=on.create,xT=ho.create,ET=sn.create,Gy=an.create,IT=cn.create,RT=po.create,TT=un.create,_T=ln.create,kT=_r.create,OT=pr.create,PT=Lt.create,NT=fo.create,FT=fr.create,DT=dt.create,MT=dt.strictCreate,LT=dn.create,jT=ja.create,qT=pn.create,UT=zt.create,VT=qa.create,GT=mo.create,BT=go.create,$T=Ua.create,QT=fn.create,HT=mn.create,zT=gn.create,WT=hn.create,KT=kr.create,YT=Rt.create,XT=Et.create,ZT=Wt.create,JT=Rt.createWithPreprocess,e_=Pi.create,t_=()=>Uy().optional(),r_=()=>Vy().optional(),n_=()=>Gy().optional(),o_={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 i_=ue;var s_=A.object({name:A.string(),arguments:A.string()}),a_=A.object({id:A.string(),type:A.literal("function"),function:s_,encryptedValue:A.string().optional()}),Va=A.object({id:A.string(),role:A.string(),content:A.string().optional(),name:A.string().optional(),encryptedValue:A.string().optional()}),c_=A.object({type:A.literal("text"),text:A.string()}),u_=A.object({type:A.literal("data"),value:A.string(),mimeType:A.string()}),l_=A.object({type:A.literal("url"),value:A.string(),mimeType:A.string().optional()}),Ga=A.discriminatedUnion("type",[u_,l_]),d_=A.object({type:A.literal("image"),source:Ga,metadata:A.unknown().optional()}),p_=A.object({type:A.literal("audio"),source:Ga,metadata:A.unknown().optional()}),f_=A.object({type:A.literal("video"),source:Ga,metadata:A.unknown().optional()}),m_=A.object({type:A.literal("document"),source:Ga,metadata:A.unknown().optional()});var By=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()}),$y=(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"]})},Z4=By.superRefine((e,t)=>{$y(e,t)}),g_=A.discriminatedUnion("type",[c_,d_,p_,f_,m_,By]),h_=g_.superRefine((e,t)=>{e.type==="binary"&&$y(e,t)}),y_=Va.extend({role:A.literal("developer"),content:A.string()}),v_=Va.extend({role:A.literal("system"),content:A.string()}),S_=Va.extend({role:A.literal("assistant"),content:A.string().optional(),toolCalls:A.array(a_).optional()}),A_=Va.extend({role:A.literal("user"),content:A.union([A.string(),A.array(h_)])}),b_=A.object({id:A.string(),content:A.string(),role:A.literal("tool"),toolCallId:A.string(),error:A.string().optional(),encryptedValue:A.string().optional()}),w_=A.object({id:A.string(),role:A.literal("activity"),activityType:A.string(),content:A.record(A.any())}),C_=A.object({id:A.string(),role:A.literal("reasoning"),content:A.string(),encryptedValue:A.string().optional()}),Qy=A.discriminatedUnion("role",[y_,v_,S_,A_,b_,w_,C_]),J4=A.union([A.literal("developer"),A.literal("system"),A.literal("assistant"),A.literal("user"),A.literal("tool"),A.literal("activity"),A.literal("reasoning")]),x_=A.object({description:A.string(),value:A.string()}),Hy=A.object({name:A.string(),description:A.string(),parameters:A.any(),metadata:A.record(A.any()).optional()}),E_=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()}),I_=A.object({interruptId:A.string(),status:A.enum(["resolved","cancelled"]),payload:A.any().optional()}),R_=A.object({threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),state:A.any(),messages:A.array(Qy),tools:A.array(Hy),context:A.array(x_),forwardedProps:A.any(),resume:A.array(I_).optional()}),T_=A.any(),Fe=class extends Error{constructor(e){super(e)}},Bd=class extends Fe{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},__=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()}),O_=A.object({streaming:A.boolean().optional(),websocket:A.boolean().optional(),httpBinary:A.boolean().optional(),pushNotifications:A.boolean().optional(),resumable:A.boolean().optional()}),P_=A.object({supported:A.boolean().optional(),items:A.array(Hy).optional(),parallelCalls:A.boolean().optional(),clientProvided:A.boolean().optional()}),N_=A.object({structuredOutput:A.boolean().optional(),supportedMimeTypes:A.array(A.string()).optional()}),F_=A.object({snapshots:A.boolean().optional(),deltas:A.boolean().optional(),memory:A.boolean().optional(),persistentState:A.boolean().optional()}),D_=A.object({supported:A.boolean().optional(),delegation:A.boolean().optional(),handoffs:A.boolean().optional(),subAgents:A.array(__).optional()}),M_=A.object({supported:A.boolean().optional(),streaming:A.boolean().optional(),encrypted:A.boolean().optional()}),L_=A.object({image:A.boolean().optional(),audio:A.boolean().optional(),video:A.boolean().optional(),pdf:A.boolean().optional(),file:A.boolean().optional()}),j_=A.object({image:A.boolean().optional(),audio:A.boolean().optional()}),q_=A.object({input:L_.optional(),output:j_.optional()}),U_=A.object({codeExecution:A.boolean().optional(),sandboxed:A.boolean().optional(),maxIterations:A.number().optional(),maxExecutionTime:A.number().optional()}),V_=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()}),eW=A.object({identity:k_.optional(),transport:O_.optional(),tools:P_.optional(),output:N_.optional(),state:F_.optional(),multiAgent:D_.optional(),reasoning:M_.optional(),multimodal:q_.optional(),execution:U_.optional(),humanInTheLoop:V_.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(),G_=Ee.extend({type:A.literal(D.TEXT_MESSAGE_START),messageId:A.string(),role:zy.default("assistant"),name:A.string().optional()}),Wy=Ee.extend({type:A.literal(D.TEXT_MESSAGE_CONTENT),messageId:A.string(),delta:A.string()}),B_=Ee.extend({type:A.literal(D.TEXT_MESSAGE_END),messageId:A.string()}),$_=Ee.extend({type:A.literal(D.TEXT_MESSAGE_CHUNK),messageId:A.string().optional(),role:zy.optional(),delta:A.string().optional(),name:A.string().optional()}),Q_=Ee.extend({type:A.literal(D.THINKING_TEXT_MESSAGE_START)}),H_=Wy.omit({messageId:!0,type:!0}).extend({type:A.literal(D.THINKING_TEXT_MESSAGE_CONTENT)}),z_=Ee.extend({type:A.literal(D.THINKING_TEXT_MESSAGE_END)}),W_=Ee.extend({type:A.literal(D.TOOL_CALL_START),toolCallId:A.string(),toolCallName:A.string(),parentMessageId:A.string().optional()}),K_=Ee.extend({type:A.literal(D.TOOL_CALL_ARGS),toolCallId:A.string(),delta:A.string()}),Y_=Ee.extend({type:A.literal(D.TOOL_CALL_END),toolCallId:A.string()}),X_=Ee.extend({messageId:A.string(),type:A.literal(D.TOOL_CALL_RESULT),toolCallId:A.string(),content:A.string(),role:A.literal("tool").optional()}),Z_=Ee.extend({type:A.literal(D.TOOL_CALL_CHUNK),toolCallId:A.string().optional(),toolCallName:A.string().optional(),parentMessageId:A.string().optional(),delta:A.string().optional()}),J_=Ee.extend({type:A.literal(D.THINKING_START),title:A.string().optional()}),e0=Ee.extend({type:A.literal(D.THINKING_END)}),t0=Ee.extend({type:A.literal(D.STATE_SNAPSHOT),snapshot:T_}),r0=Ee.extend({type:A.literal(D.STATE_DELTA),delta:A.array(A.any())}),n0=Ee.extend({type:A.literal(D.MESSAGES_SNAPSHOT),messages:A.array(Qy)}),o0=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)}),i0=Ee.extend({type:A.literal(D.ACTIVITY_DELTA),messageId:A.string(),activityType:A.string(),patch:A.array(A.any())}),s0=Ee.extend({type:A.literal(D.RAW),event:A.any(),source:A.string().optional()}),a0=Ee.extend({type:A.literal(D.CUSTOM),name:A.string(),value:A.any()}),c0=Ee.extend({type:A.literal(D.RUN_STARTED),threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),input:R_.optional()}),u0=A.object({type:A.literal("success")}).strict(),l0=A.object({type:A.literal("interrupt"),interrupts:A.array(E_).min(1)}).strict(),d0=A.discriminatedUnion("type",[u0,l0]),p0=Ee.extend({type:A.literal(D.RUN_FINISHED),threadId:A.string(),runId:A.string(),result:A.any().optional(),outcome:d0.nullable().optional().transform(e=>e??void 0)}),f0=Ee.extend({type:A.literal(D.RUN_ERROR),message:A.string(),code:A.string().optional()}),m0=Ee.extend({type:A.literal(D.STEP_STARTED),stepName:A.string()}),g0=Ee.extend({type:A.literal(D.STEP_FINISHED),stepName:A.string()}),h0=A.union([A.literal("tool-call"),A.literal("message")]),y0=Ee.extend({type:A.literal(D.REASONING_START),messageId:A.string()}),v0=Ee.extend({type:A.literal(D.REASONING_MESSAGE_START),messageId:A.string(),role:A.literal("reasoning")}),S0=Ee.extend({type:A.literal(D.REASONING_MESSAGE_CONTENT),messageId:A.string(),delta:A.string()}),A0=Ee.extend({type:A.literal(D.REASONING_MESSAGE_END),messageId:A.string()}),b0=Ee.extend({type:A.literal(D.REASONING_MESSAGE_CHUNK),messageId:A.string().optional(),delta:A.string().optional()}),w0=Ee.extend({type:A.literal(D.REASONING_END),messageId:A.string()}),C0=Ee.extend({type:A.literal(D.REASONING_ENCRYPTED_VALUE),subtype:h0,entityId:A.string(),encryptedValue:A.string()}),Ba=A.discriminatedUnion("type",[G_,Wy,B_,$_,J_,e0,Q_,H_,z_,W_,K_,Y_,Z_,X_,t0,r0,n0,o0,i0,s0,a0,c0,p0,f0,m0,g0,y0,v0,S0,A0,b0,w0,C0]);m();d();f();p();var $d={};Ki($d,{JsonPatchError:()=>Ve,_areEquals:()=>Di,applyOperation:()=>An,applyPatch:()=>Ya,applyReducer:()=>T0,deepClone:()=>I0,getValueByPointer:()=>Wa,validate:()=>Yy,validator:()=>Ka});m();d();f();p();m();d();f();p();var x0=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)}}(),E0=Object.prototype.hasOwnProperty;function Qa(e,t){return E0.call(e,t)}function Ha(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)Qa(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 za(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 Ni(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function $a(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if($a(e[t]))return!0}else if(typeof e=="object"){for(var n=Ha(e),o=n.length,i=0;i<o;i++)if($a(e[n[i]]))return!0}}return!1}function Ky(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 Fi=function(e){x0(t,e);function t(r,n,o,i,s){var a=this.constructor,c=e.call(this,Ky(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=Ky(r,{name:n,index:o,operation:i,tree:s}),c}return t}(Error);var Ve=Fi,I0=nt,yo={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=Wa(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=Wa(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:Di(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},R0={add:function(e,t,r){return za(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:yo.move,copy:yo.copy,test:yo.test,_get:yo._get};function Wa(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):Ka(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=Wa(e,t.from),t.op==="move"&&(s.removed=e),s;if(t.op==="test"){if(s.test=Di(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,E=void 0,y=void 0,h=void 0;for(typeof r=="function"?h=r:h=Ka;;){if(y=c[g],y&&y.indexOf("~")!=-1&&(y=Ni(y)),o&&(y=="__proto__"||y=="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&&E===void 0&&(u[y]===void 0?E=c.slice(0,g).join("/"):g==v-1&&(E=t.path),E!==void 0&&h(t,0,e,E)),g++,Array.isArray(u)){if(y==="-")y=u.length;else{if(r&&!za(y))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);za(y)&&(y=~~y)}if(g>=v){if(r&&t.op==="add"&&y>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=R0[t.op].call(t,u,y,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=yo[t.op].call(t,u,y,e);if(s.test===!1)throw new Ve("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}if(u=u[y],r&&g<v&&(!u||typeof u!="object"))throw new Ve("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function Ya(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 T0(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 Ka(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(yo[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")&&$a(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=Yy([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 Yy(e,t,r){try{if(!Array.isArray(e))throw new Ve("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Ya(nt(t),nt(e),r||!0);else{r=r||Ka;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 Di(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(!Di(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],!Di(e[s],t[s]))return!1;return!0}return e!==e&&t!==t}var Wd={};Ki(Wd,{compare:()=>M0,generate:()=>Qd,observe:()=>D0,unobserve:()=>F0});m();d();f();p();var Hd=new WeakMap,_0=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),k0=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function O0(e){return Hd.get(e)}function P0(e,t){return e.observers.get(t)}function N0(e,t){e.observers.delete(t.callback)}function F0(e,t){t.unobserve()}function D0(e,t){var r=[],n,o=O0(e);if(!o)o=new _0(e),Hd.set(e,o);else{var i=P0(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(){Qd(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(){Qd(n),clearTimeout(n.next),N0(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 k0(t,n)),n}function Qd(e,t){t===void 0&&(t=!1);var r=Hd.get(e.object);zd(r.value,e.object,e.patches,"",t),e.patches.length&&Ya(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=Ha(t),s=Ha(e),a=!1,c=!1,u=s.length-1;u>=0;u--){var g=s[u],v=e[g];if(Qa(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var E=t[g];typeof v=="object"&&v!=null&&typeof E=="object"&&E!=null&&Array.isArray(v)===Array.isArray(E)?zd(v,E,r,n+"/"+Kt(g),o):v!==E&&(a=!0,o&&r.push({op:"test",path:n+"/"+Kt(g),value:nt(v)}),r.push({op:"replace",path:n+"/"+Kt(g),value:nt(E)}))}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];!Qa(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+Kt(g),value:nt(t[g])})}}}function M0(e,t,r){r===void 0&&(r=!1);var n=[];return zd(e,t,n,"",r),n}var Xa=Object.assign({},$d,Wd,{JsonPatchError:Fi,deepClone:nt,escapePathComponent:Kt,unescapePathComponent:Ni});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Kd=function(e,t){return Kd=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])},Kd(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");Kd(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Xy(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 Za(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 vo(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 So(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 Zy(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(y){return function(h){return Promise.resolve(h).then(y,v)}}function a(y,h){n[y]&&(o[y]=function(S){return new Promise(function(w,I){i.push([y,S,w,I])>1||c(y,S)})},h&&(o[y]=h(o[y])))}function c(y,h){try{u(n[y](h))}catch(S){E(i[0][3],S)}}function u(y){y.value instanceof bn?Promise.resolve(y.value.v).then(g,v):E(i[0][2],y)}function g(y){c("next",y)}function v(y){c("throw",y)}function E(y,h){y(h),i.shift(),i.length&&c(i[0][0],i[0][1])}}function Jy(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 Ao(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 Ja=Ao(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 Mi(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var bo=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 Za?S.errors:[S]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var E=mr(v),y=E.next();!y.done;y=E.next()){var h=y.value;try{Jy(h)}catch(S){i=i??[],S instanceof Za?i=So(So([],vo(i)),vo(S.errors)):i.push(S)}}}catch(S){n={error:S}}finally{try{y&&!y.done&&(o=E.return)&&o.call(E)}finally{if(n)throw n.error}}}if(i)throw new Za(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Jy(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)&&Mi(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Mi(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Yd=bo.EMPTY;function Ja(e){return e instanceof bo||e&&"closed"in e&&Se(e.remove)&&Se(e.add)&&Se(e.unsubscribe)}function Jy(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 wo={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=wo.delegate;return o?.setTimeout?o.setTimeout.apply(o,So([e,t],vo(r))):setTimeout.apply(void 0,So([e,t],vo(r)))},clearTimeout:function(e){var t=wo.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function ec(e){wo.setTimeout(function(){var t=jt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function Li(){}m();d();f();p();var ev=function(){return Xd("C",void 0,void 0)}();function tv(e){return Xd("E",void 0,e)}function rv(e){return Xd("N",e,void 0)}function Xd(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var wn=null;function Co(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 nv(e){jt.useDeprecatedSynchronousErrorHandling&&wn&&(wn.errorThrown=!0,wn.error=e)}var ji=function(e){Yt(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Ja(r)&&r.add(n)):n.destination=Lk,n}return t.create=function(r,n,o){return new rc(r,n,o)},t.prototype.next=function(r){this.isStopped?Jd(rv(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Jd(tv(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Jd(ev,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}(bo);var Fk=Function.prototype.bind;function Zd(e,t){return Fk.call(e,t)}var Dk=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){tc(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){tc(n)}else tc(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){tc(r)}},e}(),rc=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&&Zd(r.next,a),error:r.error&&Zd(r.error,a),complete:r.complete&&Zd(r.complete,a)}):s=r}return i.destination=new Dk(s),i}return t}(ji);function tc(e){jt.useDeprecatedSynchronousErrorHandling?nv(e):ec(e)}function Mk(e){throw e}function Jd(e,t){var r=jt.onStoppedNotification;r&&wo.setTimeout(function(){return r(e,t)})}var Lk={closed:!0,next:Li,error:Mk,complete:Li};m();d();f();p();var xo=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function Eo(e){return e}function nc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ep(e)}function ep(e){return e.length===0?Eo: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=qk(t)?t:new rc(t,r,n);return Co(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=ov(r),new r(function(o,i){var s=new rc({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[xo]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return ep(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=ov(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 ov(e){var t;return(t=e??jt.Promise)!==null&&t!==void 0?t:Promise}function jk(e){return e&&Se(e.next)&&Se(e.error)&&Se(e.complete)}function qk(e){return e&&e instanceof ji||jk(e)&&Ja(e)}m();d();f();p();function Uk(e){return Se(e?.lift)}function Be(e){return function(t){if(Uk(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 Vk(e,t,r,n,o)}var Vk=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}(ji);m();d();f();p();m();d();f();p();var iv=Ao(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 sv(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new iv},t.prototype.next=function(r){var n=this;Co(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;Co(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;Co(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?Yd:(this.currentObservers=null,a.push(r),new bo(function(){n.currentObservers=null,Mi(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 sv(r,n)},t}(De);var sv=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:Yd},t}(Xt);m();d();f();p();m();d();f();p();var tp={now:function(){return(tp.delegate||Date).now()},delegate:void 0};var oc=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=tp);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 ic=new De(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function av(e){return e&&Se(e.schedule)}function Gk(e){return e[e.length-1]}function cv(e){return av(Gk(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 sc=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function ac(e){return Se(e?.then)}m();d();f();p();function cc(e){return Se(e[xo])}m();d();f();p();function uc(e){return Symbol.asyncIterator&&Se(e?.[Symbol.asyncIterator])}m();d();f();p();function lc(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 Bk(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var dc=Bk();function pc(e){return Se(e?.[dc])}m();d();f();p();function fc(e){return Xy(this,arguments,function(){var r,n,o,i;return Xa(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 mc(e){return Se(e?.getReader)}function Ke(e){if(e instanceof De)return e;if(e!=null){if(cc(e))return $k(e);if(sc(e))return Qk(e);if(ac(e))return Hk(e);if(uc(e))return uv(e);if(pc(e))return zk(e);if(mc(e))return Wk(e)}throw lc(e)}function $k(e){return new De(function(t){var r=e[xo]();if(Se(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Qk(e){return new De(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function Hk(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,ec)})}function zk(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 uv(e){return new De(function(t){Kk(e,t).catch(function(r){return t.error(r)})})}function Wk(e){return uv(fc(e))}function Kk(e,t){var r,n,o,i;return Yy(this,void 0,void 0,function(){var s,a;return Xa(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=Zy(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 gc(e,t){return t===void 0&&(t=0),Be(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 hc(e,t){return t===void 0&&(t=0),Be(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function lv(e,t){return Ke(e).pipe(hc(t),gc(t))}m();d();f();p();function dv(e,t){return Ke(e).pipe(hc(t),gc(t))}m();d();f();p();function pv(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 fv(e,t){return new De(function(r){var n;return Tt(r,t,function(){n=e[dc](),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 yc(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 mv(e,t){return yc(fc(e),t)}function gv(e,t){if(e!=null){if(cc(e))return lv(e,t);if(sc(e))return pv(e,t);if(ac(e))return dv(e,t);if(uc(e))return yc(e,t);if(pc(e))return fv(e,t);if(mc(e))return mv(e,t)}throw lc(e)}function Cn(e,t){return t?gv(e,t):Ke(e)}function qe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=cv(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 hv=Ao(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function vc(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 hv)}})})}m();d();f();p();function xn(e,t){return Be(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 yv(e,t,r,n,o,i,s,a){var c=[],u=0,g=0,v=!1,E=function(){v&&!c.length&&!u&&t.complete()},y=function(S){return u<n?h(S):c.push(S)},h=function(S){i&&t.next(S),u++;var w=!1;Ke(r(S,g++)).subscribe(We(t,function(I){o?.(I),i?y(I):t.next(I)},function(){w=!0},void 0,function(){if(w)try{u--;for(var I=function(){var T=c.shift();s?Tt(t,s,function(){return h(T)}):h(T)};c.length&&u<n;)I();E()}catch(T){t.error(T)}}))};return e.subscribe(We(t,y,function(){v=!0,E()})),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),Be(function(n,o){return yv(n,o,e,r)}))}function rp(e){return e===void 0&&(e=1/0),pt(Eo,e)}m();d();f();p();function Sc(e){return new De(function(t){Ke(e()).subscribe(t)})}m();d();f();p();function qi(e){return Be(function(t,r){var n=null,o=!1,i;n=t.subscribe(We(r,void 0,void 0,function(s){i=Ke(e(s,qi(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 Ac(e,t){return Se(t)?pt(e,t,1):pt(e,1)}m();d();f();p();function np(e){return Be(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 Be(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function op(e,t){return Be(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 bc(e){return Be(function(t,r){Ke(e).subscribe(We(r,function(){return r.complete()},Li)),!r.closed&&t.subscribe(r)})}m();d();f();p();function ip(e,t,r){var n=Se(e)||t||r?{next:e,error:t,complete:r}:e;return n?Be(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)}))}):Eo}m();d();f();p();m();d();f();p();function vv(e){return` \r
36
- `.indexOf(e)>=0}function wc(e){for(var t=["topLevel"],r=0,n,o,i,s=function(T){return t.push(T)},a=function(T){return t[t.length-1]=T},c=function(T){n==null&&(n=r,o=t.length,i=T)},u=function(T){T===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},E=function(T){if("0"<=T&&T<="9"){s("number");return}switch(T){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}},y=e.length;r<y;r++){var h=e[r];switch(t[t.length-1]){case"topLevel":E(h);break;case"string":switch(h){case"\"":g();break;case"\\":c("stringEscape"),s("stringEscaped");break}break;case"stringEscaped":h==="u"?s("stringUnicode"):(u("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(u("stringEscape"),g());break;case"number":h==="."?a("numberNeedsDigit"):h==="e"||h==="E"?a("numberNeedsExponent"):(h<"0"||h>"9")&&(v(),g());break;case"numberNeedsDigit":a("number");break;case"numberNeedsExponent":a(h==="+"||h==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(h<"a"||h>"z")&&(v(),g());break;case"arrayNeedsValue":h==="]"?g():vv(h)||(u("collectionItem"),a("arrayNeedsComma"),E(h));break;case"arrayNeedsComma":h==="]"?g():h===","&&(c("collectionItem"),a("arrayNeedsValue"));break;case"objectNeedsKey":h==="}"?g():h==="\""&&(c("collectionItem"),a("objectNeedsColon"),s("string"));break;case"objectNeedsColon":h===":"&&a("objectNeedsValue");break;case"objectNeedsValue":vv(h)||(u("collectionItem"),a("objectNeedsComma"),E(h));break;case"objectNeedsComma":h==="}"?g():h===","&&(c("collectionItem"),a("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var S=[n!=null?e.slice(0,n):e],w=function(T){return S.push(T.slice(e.length-e.lastIndexOf(T[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":w("true");break;case"false":w("false");break;case"null":w("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 Av(){let e=0,t=0;for(let n=0;n<28;n+=7){let o=this.buf[this.pos++];if(e|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}let r=this.buf[this.pos++];if(e|=(r&15)<<28,t=(r&112)>>4,(r&128)==0)return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let o=this.buf[this.pos++];if(t|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function xc(e,t,r){for(let i=0;i<28;i=i+7){let s=e>>>i,a=!(!(s>>>7)&&t==0),c=(a?s|128:s)&255;if(r.push(c),!a)return}let n=e>>>28&15|(t&7)<<4,o=t>>3!=0;if(r.push((o?n|128:n)&255),!!o){for(let i=3;i<31;i=i+7){let s=t>>>i,a=!!(s>>>7),c=(a?s|128:s)&255;if(r.push(c),!a)return}r.push(t>>>31&1)}}var Cc=4294967296;function sp(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>=Cc&&(o=o+(n/Cc|0),n=n%Cc)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?wv(n,o):cp(n,o)}function bv(e,t){let r=cp(e,t),n=r.hi&2147483648;n&&(r=wv(r.lo,r.hi));let o=ap(r.lo,r.hi);return n?"-"+o:o}function ap(e,t){if({lo:e,hi:t}=Yk(e,t),t<=2097151)return String(Cc*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()+Sv(s)+Sv(i)}function Yk(e,t){return{lo:e>>>0,hi:t>>>0}}function cp(e,t){return{lo:e|0,hi:t|0}}function wv(e,t){return t=~t,e?e=~e+1:t+=1,cp(e,t)}var Sv=e=>{let t=String(e);return"0000000".slice(t.length)+t};function up(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let r=0;r<9;r++)t.push(e&127|128),e=e>>7;t.push(1)}}function Cv(){let e=this.buf[this.pos++],t=e&127;if((e&128)==0)return this.assertBounds(),t;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=Xk();function Xk(){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()),xv(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),Ev(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),xv(r),sp(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),Ev(r),sp(r)},dec(r,n){return bv(r,n)},uDec(r,n){return ap(r,n)}}}function xv(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function Ev(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var lp=Symbol.for("@bufbuild/protobuf/text-encoding");function dp(){if(b[lp]==null){let e=new b.TextEncoder,t=new b.TextDecoder,r;b[lp]={encodeUtf8(n){return e.encode(n)},decodeUtf8(n,o){return o?(r===void 0&&(r=new b.TextDecoder("utf-8",{fatal:!0})),r.decode(n)):t.decode(n)},checkUtf8(n){try{return encodeURIComponent(n),!0}catch{return!1}}}}return b[lp]}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 Zk=34028234663852886e22,Jk=-34028234663852886e22,e0=4294967295,t0=2147483647,r0=-2147483648,ge=class{constructor(t=dp().encodeUtf8){this.encodeUtf8=t,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let t=0;for(let o=0;o<this.chunks.length;o++)t+=this.chunks[o].length;let r=new Uint8Array(t),n=0;for(let o=0;o<this.chunks.length;o++)r.set(this.chunks[o],n),n+=this.chunks[o].length;return this.chunks=[],r}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let t=this.finish(),r=this.stack.pop();if(!r)throw new Error("invalid state, fork stack empty");return this.chunks=r.chunks,this.buf=r.buf,this.uint32(t.byteLength),this.raw(t)}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(Iv(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return pp(t),up(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let r=this.encodeUtf8(t);return this.uint32(r.byteLength),this.raw(r)}float(t){n0(t);let r=new Uint8Array(4);return new DataView(r.buffer).setFloat32(0,t,!0),this.raw(r)}double(t){let r=new Uint8Array(8);return new DataView(r.buffer).setFloat64(0,t,!0),this.raw(r)}fixed32(t){Iv(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){pp(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return pp(t),t=(t<<1^t>>31)>>>0,up(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=qt.enc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}fixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=qt.uEnc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}int64(t){let r=qt.enc(t);return xc(r.lo,r.hi,this.buf),this}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 xc(o,i,this.buf),this}uint64(t){let r=qt.uEnc(t);return xc(r.lo,r.hi,this.buf),this}},X=class{constructor(t,r=dp().decodeUtf8){this.decodeUtf8=r,this.varint64=Av,this.uint32=Cv,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 qt.dec(...this.varint64())}uint64(){return qt.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,qt.dec(t,r)}bool(){let[t,r]=this.varint64();return t!==0||r!==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){return this.decodeUtf8(this.bytes(),t)}};function pp(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>t0||e<r0)throw new Error("invalid int32: "+e)}function Iv(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>e0||e<0)throw new Error("invalid uint32: "+e)}function n0(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>Zk||e<Jk))throw new Error("invalid float32: "+e)}var o0=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function fp(){return{fields:{}}}var Ui={encode(e,t=new ge){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&hp.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=fp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let s=hp.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 Ui.fromPartial(e??{})},fromPartial(e){let t=fp();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=fp();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 Rv(){return{key:"",value:void 0}}var hp={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=Rv();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 hp.fromPartial(e??{})},fromPartial(e){let t=Rv();return t.key=e.key??"",t.value=e.value??void 0,t}};function mp(){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&&Ui.encode(Ui.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Vi.encode(Vi.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=mp();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=Ui.unwrap(Ui.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=Vi.unwrap(Vi.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=mp();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=mp();if(e===null)t.nullValue=o0.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 gp(){return{values:[]}}var Vi={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=gp();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 Vi.fromPartial(e??{})},fromPartial(e){let t=gp();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=gp();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&b.Array.isArray(e.values)?e.values:e}},i0=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 Tv(){return{op:0,path:"",from:void 0,value:void 0}}var Ic={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=Tv();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 Ic.fromPartial(e??{})},fromPartial(e){let t=Tv();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function _v(){return{id:"",type:"",function:void 0}}var Rc={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&&Tc.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=_v();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=Tc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Rc.fromPartial(e??{})},fromPartial(e){let t=_v();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?Tc.fromPartial(e.function):void 0,t}};function kv(){return{name:"",arguments:""}}var Tc={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=kv();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 Tc.fromPartial(e??{})},fromPartial(e){let t=kv();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function Ov(){return{value:"",mimeType:""}}var _c={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=Ov();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 _c.fromPartial(e??{})},fromPartial(e){let t=Ov();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function Pv(){return{value:"",mimeType:void 0}}var kc={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=Pv();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 kc.fromPartial(e??{})},fromPartial(e){let t=Pv();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function Nv(){return{data:void 0,url:void 0}}var At={encode(e,t=new ge){return e.data!==void 0&&_c.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&kc.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=Nv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=_c.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=kc.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=Nv();return t.data=e.data!==void 0&&e.data!==null?_c.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?kc.fromPartial(e.url):void 0,t}};function Fv(){return{text:""}}var Oc={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=Fv();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 Oc.fromPartial(e??{})},fromPartial(e){let t=Fv();return t.text=e.text??"",t}};function Dv(){return{source:void 0,metadata:void 0}}var Pc={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=Dv();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 Pc.fromPartial(e??{})},fromPartial(e){let t=Dv();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Mv(){return{source:void 0,metadata:void 0}}var Nc={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=Mv();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 Nc.fromPartial(e??{})},fromPartial(e){let t=Mv();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Lv(){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=Lv();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=Lv();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function jv(){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=jv();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=jv();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 Mc={encode(e,t=new ge){return e.text!==void 0&&Oc.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Pc.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Nc.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Fc.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Dc.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=Oc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=Pc.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=Nc.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=Fc.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=Dc.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=qv();return t.text=e.text!==void 0&&e.text!==null?Oc.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Pc.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Nc.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Fc.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Dc.fromPartial(e.document):void 0,t}};function Uv(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var Lc={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)Rc.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)Mc.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=Uv();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(Rc.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(Mc.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=Uv();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=>Rc.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>Mc.fromPartial(r))||[],t}};function Vv(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0}}var jc={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=Vv();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 jc.fromPartial(e??{})},fromPartial(e){let t=Vv();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}},s0=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 Gv(){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=Gv();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=a0(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=Gv();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function Bv(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}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),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=Bv();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 qc.fromPartial(e??{})},fromPartial(e){let t=Bv();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 $v(){return{baseEvent:void 0,messageId:"",delta:""}}var Uc={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=$v();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 Uc.fromPartial(e??{})},fromPartial(e){let t=$v();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 Qv(){return{baseEvent:void 0,messageId:""}}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),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.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 Vc.fromPartial(e??{})},fromPartial(e){let t=Qv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function Hv(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var Gc={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=Hv();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 Gc.fromPartial(e??{})},fromPartial(e){let t=Hv();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 zv(){return{baseEvent:void 0,toolCallId:"",delta:""}}var Bc={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=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.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=zv();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 Wv(){return{baseEvent:void 0,toolCallId:""}}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),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.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 $c.fromPartial(e??{})},fromPartial(e){let t=Wv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function Kv(){return{baseEvent:void 0,snapshot:void 0}}var Qc={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=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.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 Qc.fromPartial(e??{})},fromPartial(e){let t=Kv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function Yv(){return{baseEvent:void 0,delta:[]}}var Hc={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)Ic.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=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.delta.push(Ic.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Hc.fromPartial(e??{})},fromPartial(e){let t=Yv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>Ic.fromPartial(r))||[],t}};function Xv(){return{baseEvent:void 0,messages:[]}}var zc={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Lc.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=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.messages.push(Lc.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=Xv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Lc.fromPartial(r))||[],t}};function Zv(){return{baseEvent:void 0,event:void 0,source:void 0}}var Wc={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=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.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 Wc.fromPartial(e??{})},fromPartial(e){let t=Zv();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 Jv(){return{baseEvent:void 0,name:"",value:void 0}}var Kc={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=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.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 Kc.fromPartial(e??{})},fromPartial(e){let t=Jv();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 eS(){return{baseEvent:void 0,threadId:"",runId:""}}var Yc={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=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.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 Yc.fromPartial(e??{})},fromPartial(e){let t=eS();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 tS(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[]}}var Xc={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)jc.encode(r,t.uint32(50).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=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.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(jc.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=tS();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=>jc.fromPartial(r))||[],t}};function rS(){return{baseEvent:void 0,code:void 0,message:""}}var Zc={encode(e,t=new ge){return 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),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.code=r.string();continue;case 3:if(i!==26)break;o.message=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.code=e.code??void 0,t.message=e.message??"",t}};function nS(){return{baseEvent:void 0,stepName:""}}var Jc={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=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.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Jc.fromPartial(e??{})},fromPartial(e){let t=nS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function oS(){return{baseEvent:void 0,stepName:""}}var eu={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=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.stepName=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=oS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function iS(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var tu={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=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.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 tu.fromPartial(e??{})},fromPartial(e){let t=iS();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 sS(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var ru={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=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.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 ru.fromPartial(e??{})},fromPartial(e){let t=sS();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 aS(){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 cS={encode(e,t=new ge){return e.textMessageStart!==void 0&&qc.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Uc.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Vc.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Gc.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Bc.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&$c.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Qc.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Hc.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&zc.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Wc.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Kc.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Yc.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Xc.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Zc.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Jc.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&eu.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&tu.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&ru.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=aS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=qc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=Uc.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=Vc.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=Gc.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=Bc.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=$c.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=Qc.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Hc.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=zc.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Wc.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Kc.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Yc.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Xc.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=Zc.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Jc.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=eu.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=tu.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=ru.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return cS.fromPartial(e??{})},fromPartial(e){let t=aS();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?qc.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Uc.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Vc.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Gc.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Bc.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?$c.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Qc.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Hc.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?zc.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Wc.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Kc.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Yc.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Xc.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Zc.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Jc.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?eu.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?tu.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?ru.fromPartial(e.toolCallChunk):void 0,t}};function a0(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 Ec=e=>{if(!(!e||typeof e!="object")){if(e.data)return{type:"data",value:e.data.value,mimeType:e.data.mimeType};if(e.url)return{type:"url",value:e.url.value,mimeType:e.url.mimeType}}},c0=e=>{if(!(!e||typeof e!="object")){if(e.text)return{type:"text",text:e.text.text};if(e.image)return{type:"image",source:Ec(e.image.source),metadata:e.image.metadata};if(e.audio)return{type:"audio",source:Ec(e.audio.source),metadata:e.audio.metadata};if(e.video)return{type:"video",source:Ec(e.video.source),metadata:e.video.metadata};if(e.document)return{type:"document",source:Ec(e.document.source),metadata:e.document.metadata}}};function uS(e){let t=cS.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=s0[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=>c0(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.STATE_DELTA)for(let n of r.delta)n.op=i0[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]}),Ga.parse(r)}var yp="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var l0=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,vp=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(l0);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},lS=e=>e==="*"||e==="x"||e==="X",dS=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},d0=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],p0=(e,t)=>{if(lS(e)||lS(t))return 0;let[r,n]=d0(dS(e),dS(t));return r>n?1:r<n?-1:0},Sp=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=p0(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Gi=(e,t)=>{let r=vp(e),n=vp(t),o=r.pop(),i=n.pop(),s=Sp(r,n);return s!==0?s:o&&i?Sp(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 Bi(){return Ir()}function wp(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&wp(t);return e}var pS=512*1024;function fS(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&&!fS(t,r,pS),c=a?we(t):t,u=a?we(r):r,g=!1,v=!1,E;for(let y of e)try{a&&(wp(c),wp(u));let h=yield n(y,c,u);if(h===void 0)continue;let S=!1;if(h.messages!==void 0&&h.messages!==c&&(c=we(h.messages),g=!0,S=!0),h.state!==void 0&&h.state!==u&&(u=we(h.state),v=!0,S=!0),a&&S&&fS(c,u,pS)&&(a=!1),E=h.stopPropagation,E===!0)break}catch(h){if(s&&h instanceof TypeError){if(i)throw h;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",h)}else i||console.error("Subscriber error:",h);continue}return{...(g?{messages:Object.isFrozen(c)?we(c):c}:{}),...(v?{state:Object.isFrozen(u)?we(u):u}:{}),...(E===void 0?{}:{stopPropagation:E})}});return _Te.apply(this,arguments)}function nu(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 $i(e){if(e instanceof Cp)return e;if(e===!0)return new Cp(nu(!0))}var Cp=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 Ap(e){return e.enabled?new Cp(e):void 0}function f0(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 SS=(e,t,r,n,o)=>{let i=$i(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):ic};return t.pipe(Ac(/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(v){let E=yield Te(n,s,a,(y,h,S)=>y.onEvent?.({event:v,agent:r,input:e,messages:h,state:S}));if(u(E),E.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}),E.stopPropagation===!0)return g();switch(v.type){case D.TEXT_MESSAGE_START:{let y=yield Te(n,s,a,(h,S,w)=>h.onTextMessageStartEvent?.({event:v,messages:S,state:w,agent:r,input:e}));if(u(y),y.stopPropagation!==!0){let{messageId:h,role:S="assistant",name:w}=v;if(!s.find(I=>I.id===h)){let I={id:h,role:S,content:"",...(w!==void 0&&{name:w})};s.push(I),u({messages:s})}}return g()}case D.TEXT_MESSAGE_CONTENT:{let{messageId:y,delta:h}=v,S=s.find(I=>I.id===y);if(!S)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${y}'`),g();let w=yield Te(n,s,a,(I,T,R)=>I.onTextMessageContentEvent?.({event:v,messages:T,state:R,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}));return u(w),w.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${h}`,u({messages:s})),g()}case D.TEXT_MESSAGE_END:{let{messageId:y}=v,h=s.find(S=>S.id===y);return h?(u(yield Te(n,s,a,(S,w,I)=>S.onTextMessageEndEvent?.({event:v,messages:w,state:I,agent:r,input:e,textMessageBuffer:typeof h.content=="string"?h.content:""}))),yield Promise.all(n.map(S=>{S.onNewMessage?.({message:h,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${y}'`),g())}case D.TOOL_CALL_START:{let y=yield Te(n,s,a,(h,S,w)=>h.onToolCallStartEvent?.({event:v,messages:S,state:w,agent:r,input:e}));if(u(y),y.stopPropagation!==!0){let{toolCallId:h,toolCallName:S,parentMessageId:w}=v,I=f0(s,w,h);I.toolCalls??(I.toolCalls=[]),I.toolCalls.push({id:h,type:"function",function:{name:S,arguments:""}}),u({messages:s})}return g()}case D.TOOL_CALL_ARGS:{let{toolCallId:y,delta:h}=v,S=s.find(T=>T.toolCalls?.some(R=>R.id===y));if(!S)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${y}'`),g();let w=S.toolCalls?.find(T=>T.id===y);if(!w)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y}'`),g();let I=yield Te(n,s,a,(T,R,k)=>{let _=w.function.arguments,F=w.function.name,V={};try{V=wc(_)}catch{}return T.onToolCallArgsEvent?.({event:v,messages:R,state:k,agent:r,input:e,toolCallBuffer:_,toolCallName:F,partialToolCallArgs:V})});return u(I),I.stopPropagation!==!0&&(w.function.arguments+=h,u({messages:s})),g()}case D.TOOL_CALL_END:{let{toolCallId:y}=v,h=s.find(w=>w.toolCalls?.some(I=>I.id===y));if(!h)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${y}'`),g();let S=h.toolCalls?.find(w=>w.id===y);return S?(u(yield Te(n,s,a,(w,I,T)=>{let R=S.function.arguments,k=S.function.name,_={};try{_=JSON.parse(R)}catch{}return w.onToolCallEndEvent?.({event:v,messages:I,state:T,agent:r,input:e,toolCallName:k,toolCallArgs:_})})),yield Promise.all(n.map(w=>{w.onNewToolCall?.({toolCall:S,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${y}'`),g())}case D.TOOL_CALL_RESULT:{let y=yield Te(n,s,a,(h,S,w)=>h.onToolCallResultEvent?.({event:v,messages:S,state:w,agent:r,input:e}));if(u(y),y.stopPropagation!==!0){let{messageId:h,toolCallId:S,content:w,role:I}=v,T={id:h,toolCallId:S,role:I||"tool",content:w},R=s.findIndex(k=>k.role==="assistant"&&k.toolCalls?.some(_=>_.id===S));if(R===-1)s.push(T);else{let k=R+1;for(;k<s.length&&s[k].role==="tool";)k++;s.splice(k,0,T)}yield Promise.all(n.map(k=>{k.onNewMessage?.({message:T,messages:s,state:a,agent:r,input:e})})),u({messages:s})}return g()}case D.STATE_SNAPSHOT:{let y=yield Te(n,s,a,(h,S,w)=>h.onStateSnapshotEvent?.({event:v,messages:S,state:w,agent:r,input:e}));if(u(y),y.stopPropagation!==!0){let{snapshot:h}=v;a=h,u({state:a})}return g()}case D.STATE_DELTA:{let y=yield Te(n,s,a,(h,S,w)=>h.onStateDeltaEvent?.({event:v,messages:S,state:w,agent:r,input:e}));if(u(y),y.stopPropagation!==!0){let{delta:h}=v;try{a=Ya.applyPatch(a,h,!0,!1).newDocument,u({state:a})}catch(S){let w=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 Mi(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var bo=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 Ja?S.errors:[S]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var E=mr(v),y=E.next();!y.done;y=E.next()){var h=y.value;try{ev(h)}catch(S){i=i??[],S instanceof Ja?i=So(So([],vo(i)),vo(S.errors)):i.push(S)}}}catch(S){n={error:S}}finally{try{y&&!y.done&&(o=E.return)&&o.call(E)}finally{if(n)throw n.error}}}if(i)throw new Ja(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)ev(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)&&Mi(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Mi(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Yd=bo.EMPTY;function ec(e){return e instanceof bo||e&&"closed"in e&&Se(e.remove)&&Se(e.add)&&Se(e.unsubscribe)}function ev(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 wo={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=wo.delegate;return o?.setTimeout?o.setTimeout.apply(o,So([e,t],vo(r))):setTimeout.apply(void 0,So([e,t],vo(r)))},clearTimeout:function(e){var t=wo.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function tc(e){wo.setTimeout(function(){var t=jt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function Li(){}m();d();f();p();var tv=function(){return Xd("C",void 0,void 0)}();function rv(e){return Xd("E",void 0,e)}function nv(e){return Xd("N",e,void 0)}function Xd(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var wn=null;function Co(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 ov(e){jt.useDeprecatedSynchronousErrorHandling&&wn&&(wn.errorThrown=!0,wn.error=e)}var ji=function(e){Yt(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,ec(r)&&r.add(n)):n.destination=U0,n}return t.create=function(r,n,o){return new nc(r,n,o)},t.prototype.next=function(r){this.isStopped?Jd(nv(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Jd(rv(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Jd(tv,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}(bo);var L0=Function.prototype.bind;function Zd(e,t){return L0.call(e,t)}var j0=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){rc(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){rc(n)}else rc(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){rc(r)}},e}(),nc=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&&Zd(r.next,a),error:r.error&&Zd(r.error,a),complete:r.complete&&Zd(r.complete,a)}):s=r}return i.destination=new j0(s),i}return t}(ji);function rc(e){jt.useDeprecatedSynchronousErrorHandling?ov(e):tc(e)}function q0(e){throw e}function Jd(e,t){var r=jt.onStoppedNotification;r&&wo.setTimeout(function(){return r(e,t)})}var U0={closed:!0,next:Li,error:q0,complete:Li};m();d();f();p();var xo=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function Eo(e){return e}function oc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ep(e)}function ep(e){return e.length===0?Eo: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=G0(t)?t:new nc(t,r,n);return Co(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=iv(r),new r(function(o,i){var s=new nc({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[xo]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return ep(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=iv(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 iv(e){var t;return(t=e??jt.Promise)!==null&&t!==void 0?t:Promise}function V0(e){return e&&Se(e.next)&&Se(e.error)&&Se(e.complete)}function G0(e){return e&&e instanceof ji||V0(e)&&ec(e)}m();d();f();p();function B0(e){return Se(e?.lift)}function Be(e){return function(t){if(B0(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 $0(e,t,r,n,o)}var $0=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}(ji);m();d();f();p();m();d();f();p();var sv=Ao(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 av(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new sv},t.prototype.next=function(r){var n=this;Co(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;Co(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;Co(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?Yd:(this.currentObservers=null,a.push(r),new bo(function(){n.currentObservers=null,Mi(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 av(r,n)},t}(De);var av=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:Yd},t}(Xt);m();d();f();p();m();d();f();p();var tp={now:function(){return(tp.delegate||Date).now()},delegate:void 0};var ic=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=tp);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 sc=new De(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function cv(e){return e&&Se(e.schedule)}function Q0(e){return e[e.length-1]}function uv(e){return cv(Q0(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 ac=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function cc(e){return Se(e?.then)}m();d();f();p();function uc(e){return Se(e[xo])}m();d();f();p();function lc(e){return Symbol.asyncIterator&&Se(e?.[Symbol.asyncIterator])}m();d();f();p();function dc(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 H0(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var pc=H0();function fc(e){return Se(e?.[pc])}m();d();f();p();function mc(e){return Zy(this,arguments,function(){var r,n,o,i;return Za(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 gc(e){return Se(e?.getReader)}function Ke(e){if(e instanceof De)return e;if(e!=null){if(uc(e))return z0(e);if(ac(e))return W0(e);if(cc(e))return K0(e);if(lc(e))return lv(e);if(fc(e))return Y0(e);if(gc(e))return X0(e)}throw dc(e)}function z0(e){return new De(function(t){var r=e[xo]();if(Se(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function W0(e){return new De(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function K0(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,tc)})}function Y0(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 lv(e){return new De(function(t){Z0(e,t).catch(function(r){return t.error(r)})})}function X0(e){return lv(mc(e))}function Z0(e,t){var r,n,o,i;return Xy(this,void 0,void 0,function(){var s,a;return Za(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=Jy(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 hc(e,t){return t===void 0&&(t=0),Be(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 yc(e,t){return t===void 0&&(t=0),Be(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function dv(e,t){return Ke(e).pipe(yc(t),hc(t))}m();d();f();p();function pv(e,t){return Ke(e).pipe(yc(t),hc(t))}m();d();f();p();function fv(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 mv(e,t){return new De(function(r){var n;return Tt(r,t,function(){n=e[pc](),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 vc(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 gv(e,t){return vc(mc(e),t)}function hv(e,t){if(e!=null){if(uc(e))return dv(e,t);if(ac(e))return fv(e,t);if(cc(e))return pv(e,t);if(lc(e))return vc(e,t);if(fc(e))return mv(e,t);if(gc(e))return gv(e,t)}throw dc(e)}function Cn(e,t){return t?hv(e,t):Ke(e)}function qe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=uv(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 yv=Ao(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Sc(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 yv)}})})}m();d();f();p();function xn(e,t){return Be(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 vv(e,t,r,n,o,i,s,a){var c=[],u=0,g=0,v=!1,E=function(){v&&!c.length&&!u&&t.complete()},y=function(S){return u<n?h(S):c.push(S)},h=function(S){i&&t.next(S),u++;var w=!1;Ke(r(S,g++)).subscribe(We(t,function(I){o?.(I),i?y(I):t.next(I)},function(){w=!0},void 0,function(){if(w)try{u--;for(var I=function(){var T=c.shift();s?Tt(t,s,function(){return h(T)}):h(T)};c.length&&u<n;)I();E()}catch(T){t.error(T)}}))};return e.subscribe(We(t,y,function(){v=!0,E()})),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),Be(function(n,o){return vv(n,o,e,r)}))}function rp(e){return e===void 0&&(e=1/0),pt(Eo,e)}m();d();f();p();function Ac(e){return new De(function(t){Ke(e()).subscribe(t)})}m();d();f();p();function qi(e){return Be(function(t,r){var n=null,o=!1,i;n=t.subscribe(We(r,void 0,void 0,function(s){i=Ke(e(s,qi(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 bc(e,t){return Se(t)?pt(e,t,1):pt(e,1)}m();d();f();p();function np(e){return Be(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 Be(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function op(e,t){return Be(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 wc(e){return Be(function(t,r){Ke(e).subscribe(We(r,function(){return r.complete()},Li)),!r.closed&&t.subscribe(r)})}m();d();f();p();function ip(e,t,r){var n=Se(e)||t||r?{next:e,error:t,complete:r}:e;return n?Be(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)}))}):Eo}m();d();f();p();m();d();f();p();function Sv(e){return` \r
36
+ `.indexOf(e)>=0}function Cc(e){for(var t=["topLevel"],r=0,n,o,i,s=function(T){return t.push(T)},a=function(T){return t[t.length-1]=T},c=function(T){n==null&&(n=r,o=t.length,i=T)},u=function(T){T===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},E=function(T){if("0"<=T&&T<="9"){s("number");return}switch(T){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}},y=e.length;r<y;r++){var h=e[r];switch(t[t.length-1]){case"topLevel":E(h);break;case"string":switch(h){case"\"":g();break;case"\\":c("stringEscape"),s("stringEscaped");break}break;case"stringEscaped":h==="u"?s("stringUnicode"):(u("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(u("stringEscape"),g());break;case"number":h==="."?a("numberNeedsDigit"):h==="e"||h==="E"?a("numberNeedsExponent"):(h<"0"||h>"9")&&(v(),g());break;case"numberNeedsDigit":a("number");break;case"numberNeedsExponent":a(h==="+"||h==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(h<"a"||h>"z")&&(v(),g());break;case"arrayNeedsValue":h==="]"?g():Sv(h)||(u("collectionItem"),a("arrayNeedsComma"),E(h));break;case"arrayNeedsComma":h==="]"?g():h===","&&(c("collectionItem"),a("arrayNeedsValue"));break;case"objectNeedsKey":h==="}"?g():h==="\""&&(c("collectionItem"),a("objectNeedsColon"),s("string"));break;case"objectNeedsColon":h===":"&&a("objectNeedsValue");break;case"objectNeedsValue":Sv(h)||(u("collectionItem"),a("objectNeedsComma"),E(h));break;case"objectNeedsComma":h==="}"?g():h===","&&(c("collectionItem"),a("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var S=[n!=null?e.slice(0,n):e],w=function(T){return S.push(T.slice(e.length-e.lastIndexOf(T[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":w("true");break;case"false":w("false");break;case"null":w("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 bv(){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 xc=4294967296;function sp(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>=xc&&(o=o+(n/xc|0),n=n%xc)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?Cv(n,o):cp(n,o)}function wv(e,t){let r=cp(e,t),n=r.hi&2147483648;n&&(r=Cv(r.lo,r.hi));let o=ap(r.lo,r.hi);return n?"-"+o:o}function ap(e,t){if({lo:e,hi:t}=J0(e,t),t<=2097151)return String(xc*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()+Av(s)+Av(i)}function J0(e,t){return{lo:e>>>0,hi:t>>>0}}function cp(e,t){return{lo:e|0,hi:t|0}}function Cv(e,t){return t=~t,e?e=~e+1:t+=1,cp(e,t)}var Av=e=>{let t=String(e);return"0000000".slice(t.length)+t};function xv(){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=ek();function ek(){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()),Ev(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),Iv(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),Ev(r),sp(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),Iv(r),sp(r)},dec(r,n){return wv(r,n)},uDec(r,n){return ap(r,n)}}}function Ev(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function Iv(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var up=Symbol.for("@bufbuild/protobuf/text-encoding");function tk(e){var t;b[up]=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:dp(e.encodeUtf8.bind(e))})}function lp(){let e=b;if(!e[up]){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)),tk(o)}return e[up]}function dp(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 rk=34028234663852886e22,nk=-34028234663852886e22,ok=4294967295,ik=2147483647,sk=-2147483648,ge=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?dp(t):lp().encodeUtf8Into,this.buffer=Tv,this.viewCache=ck,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||ak;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(Ui),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-Ui,n=pp(r);return n>Ui&&(this.ensureCapacity(n-Ui),this.buffer.copyWithin(t+n,t+Ui,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(Rv(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(fp(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<=_v){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=pp(r),o=this.buffer,i=this.pos,{written:s}=this.encodeUtf8Into(t,o.subarray(i+n)),a=pp(s);return a!=n&&o.copyWithin(i+a,i+n,i+n+s),this.uint32(s),this.pos+=s,this}float(t){return uk(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 Rv(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return fp(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return fp(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}},ak=128,Ui=1,Tv=new Uint8Array(0),ck=new DataView(Tv.buffer),_v=32;function pp(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var X=class{constructor(t,r=lp().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=bv,this.uint32=xv,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<=_v){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 fp(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>ik||e<sk)throw new Error("invalid int32: "+e)}function Rv(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>ok||e<0)throw new Error("invalid uint32: "+e)}function uk(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>rk||e<nk))throw new Error("invalid float32: "+e)}var lk=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function mp(){return{fields:{}}}var Vi={encode(e,t=new ge){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&yp.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=mp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let s=yp.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 Vi.fromPartial(e??{})},fromPartial(e){let t=mp();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=mp();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 kv(){return{key:"",value:void 0}}var yp={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=kv();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 yp.fromPartial(e??{})},fromPartial(e){let t=kv();return t.key=e.key??"",t.value=e.value??void 0,t}};function gp(){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&&Vi.encode(Vi.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Gi.encode(Gi.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=gp();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=Vi.unwrap(Vi.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=Gi.unwrap(Gi.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=gp();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=gp();if(e===null)t.nullValue=lk.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 hp(){return{values:[]}}var Gi={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=hp();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 Gi.fromPartial(e??{})},fromPartial(e){let t=hp();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=hp();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&b.Array.isArray(e.values)?e.values:e}},dk=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 Ov(){return{op:0,path:"",from:void 0,value:void 0}}var Ic={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=Ov();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 Ic.fromPartial(e??{})},fromPartial(e){let t=Ov();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function Pv(){return{id:"",type:"",function:void 0}}var Rc={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&&Tc.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=Pv();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=Tc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Rc.fromPartial(e??{})},fromPartial(e){let t=Pv();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?Tc.fromPartial(e.function):void 0,t}};function Nv(){return{name:"",arguments:""}}var Tc={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=Nv();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 Tc.fromPartial(e??{})},fromPartial(e){let t=Nv();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function Fv(){return{value:"",mimeType:""}}var _c={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=Fv();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 _c.fromPartial(e??{})},fromPartial(e){let t=Fv();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function Dv(){return{value:"",mimeType:void 0}}var kc={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=Dv();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 kc.fromPartial(e??{})},fromPartial(e){let t=Dv();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function Mv(){return{data:void 0,url:void 0}}var At={encode(e,t=new ge){return e.data!==void 0&&_c.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&kc.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=Mv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=_c.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=kc.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=Mv();return t.data=e.data!==void 0&&e.data!==null?_c.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?kc.fromPartial(e.url):void 0,t}};function Lv(){return{text:""}}var Oc={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=Lv();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 Oc.fromPartial(e??{})},fromPartial(e){let t=Lv();return t.text=e.text??"",t}};function jv(){return{source:void 0,metadata:void 0}}var Pc={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=jv();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 Pc.fromPartial(e??{})},fromPartial(e){let t=jv();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 Nc={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 Nc.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 Uv(){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=Uv();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=Uv();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Vv(){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=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 Dc.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 Gv(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var Mc={encode(e,t=new ge){return e.text!==void 0&&Oc.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Pc.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Nc.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Fc.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Dc.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=Gv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=Oc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=Pc.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=Nc.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=Fc.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=Dc.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.text=e.text!==void 0&&e.text!==null?Oc.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Pc.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Nc.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Fc.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Dc.fromPartial(e.document):void 0,t}};function Bv(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var Lc={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)Rc.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)Mc.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=Bv();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(Rc.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(Mc.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=Bv();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=>Rc.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>Mc.fromPartial(r))||[],t}};function $v(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0}}var jc={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=$v();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 jc.fromPartial(e??{})},fromPartial(e){let t=$v();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}},pk=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 Qv(){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=Qv();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=fk(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=Qv();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function Hv(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}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),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=Hv();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 qc.fromPartial(e??{})},fromPartial(e){let t=Hv();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 zv(){return{baseEvent:void 0,messageId:"",delta:""}}var Uc={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=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.delta=r.string();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.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function Wv(){return{baseEvent:void 0,messageId:""}}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),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.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 Vc.fromPartial(e??{})},fromPartial(e){let t=Wv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function Kv(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var Gc={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=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.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 Gc.fromPartial(e??{})},fromPartial(e){let t=Kv();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 Yv(){return{baseEvent:void 0,toolCallId:"",delta:""}}var Bc={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=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.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 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.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function Xv(){return{baseEvent:void 0,toolCallId:""}}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),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.toolCallId=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=Xv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function Zv(){return{baseEvent:void 0,snapshot:void 0}}var Qc={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=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.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 Qc.fromPartial(e??{})},fromPartial(e){let t=Zv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function Jv(){return{baseEvent:void 0,delta:[]}}var Hc={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)Ic.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=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.delta.push(Ic.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Hc.fromPartial(e??{})},fromPartial(e){let t=Jv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>Ic.fromPartial(r))||[],t}};function eS(){return{baseEvent:void 0,messages:[]}}var zc={encode(e,t=new ge){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Lc.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=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.messages.push(Lc.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=eS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Lc.fromPartial(r))||[],t}};function tS(){return{baseEvent:void 0,event:void 0,source:void 0}}var Wc={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=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.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 Wc.fromPartial(e??{})},fromPartial(e){let t=tS();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 rS(){return{baseEvent:void 0,name:"",value:void 0}}var Kc={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=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.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 Kc.fromPartial(e??{})},fromPartial(e){let t=rS();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 nS(){return{baseEvent:void 0,threadId:"",runId:""}}var Yc={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=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.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 Yc.fromPartial(e??{})},fromPartial(e){let t=nS();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 oS(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[]}}var Xc={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)jc.encode(r,t.uint32(50).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=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.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(jc.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=oS();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=>jc.fromPartial(r))||[],t}};function iS(){return{baseEvent:void 0,code:void 0,message:""}}var Zc={encode(e,t=new ge){return 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),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.code=r.string();continue;case 3:if(i!==26)break;o.message=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=iS();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}};function sS(){return{baseEvent:void 0,stepName:""}}var Jc={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=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.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Jc.fromPartial(e??{})},fromPartial(e){let t=sS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function aS(){return{baseEvent:void 0,stepName:""}}var eu={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=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.stepName=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=aS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function cS(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var tu={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=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.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 tu.fromPartial(e??{})},fromPartial(e){let t=cS();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 uS(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var ru={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=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.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 ru.fromPartial(e??{})},fromPartial(e){let t=uS();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 lS(){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 dS={encode(e,t=new ge){return e.textMessageStart!==void 0&&qc.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Uc.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Vc.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Gc.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Bc.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&$c.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Qc.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Hc.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&zc.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Wc.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Kc.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Yc.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Xc.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Zc.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Jc.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&eu.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&tu.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&ru.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=lS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=qc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=Uc.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=Vc.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=Gc.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=Bc.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=$c.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=Qc.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Hc.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=zc.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Wc.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Kc.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Yc.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Xc.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=Zc.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Jc.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=eu.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=tu.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=ru.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return dS.fromPartial(e??{})},fromPartial(e){let t=lS();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?qc.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Uc.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Vc.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Gc.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Bc.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?$c.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Qc.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Hc.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?zc.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Wc.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Kc.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Yc.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Xc.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Zc.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Jc.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?eu.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?tu.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?ru.fromPartial(e.toolCallChunk):void 0,t}};function fk(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 Ec=e=>{if(!(!e||typeof e!="object")){if(e.data)return{type:"data",value:e.data.value,mimeType:e.data.mimeType};if(e.url)return{type:"url",value:e.url.value,mimeType:e.url.mimeType}}},mk=e=>{if(!(!e||typeof e!="object")){if(e.text)return{type:"text",text:e.text.text};if(e.image)return{type:"image",source:Ec(e.image.source),metadata:e.image.metadata};if(e.audio)return{type:"audio",source:Ec(e.audio.source),metadata:e.audio.metadata};if(e.video)return{type:"video",source:Ec(e.video.source),metadata:e.video.metadata};if(e.document)return{type:"document",source:Ec(e.document.source),metadata:e.document.metadata}}};function pS(e){let t=dS.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=pk[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=>mk(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.STATE_DELTA)for(let n of r.delta)n.op=dk[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]}),Ba.parse(r)}var vp="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var hk=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Sp=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(hk);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},fS=e=>e==="*"||e==="x"||e==="X",mS=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},yk=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],vk=(e,t)=>{if(fS(e)||fS(t))return 0;let[r,n]=yk(mS(e),mS(t));return r>n?1:r<n?-1:0},Ap=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=vk(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Bi=(e,t)=>{let r=Sp(e),n=Sp(t),o=r.pop(),i=n.pop(),s=Ap(r,n);return s!==0?s:o&&i?Ap(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 $i(){return Ir()}function Cp(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&Cp(t);return e}var gS=512*1024;function hS(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&&!hS(t,r,gS),c=a?we(t):t,u=a?we(r):r,g=!1,v=!1,E;for(let y of e)try{a&&(Cp(c),Cp(u));let h=yield n(y,c,u);if(h===void 0)continue;let S=!1;if(h.messages!==void 0&&h.messages!==c&&(c=we(h.messages),g=!0,S=!0),h.state!==void 0&&h.state!==u&&(u=we(h.state),v=!0,S=!0),a&&S&&hS(c,u,gS)&&(a=!1),E=h.stopPropagation,E===!0)break}catch(h){if(s&&h instanceof TypeError){if(i)throw h;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",h)}else i||console.error("Subscriber error:",h);continue}return{...(g?{messages:Object.isFrozen(c)?we(c):c}:{}),...(v?{state:Object.isFrozen(u)?we(u):u}:{}),...(E===void 0?{}:{stopPropagation:E})}});return _Te.apply(this,arguments)}function nu(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 Qi(e){if(e instanceof xp)return e;if(e===!0)return new xp(nu(!0))}var xp=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 bp(e){return e.enabled?new xp(e):void 0}function Sk(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 wS=(e,t,r,n,o)=>{let i=Qi(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):sc};return t.pipe(bc(/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(v){let E=yield Te(n,s,a,(y,h,S)=>y.onEvent?.({event:v,agent:r,input:e,messages:h,state:S}));if(u(E),E.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}),E.stopPropagation===!0)return g();switch(v.type){case D.TEXT_MESSAGE_START:{let y=yield Te(n,s,a,(h,S,w)=>h.onTextMessageStartEvent?.({event:v,messages:S,state:w,agent:r,input:e}));if(u(y),y.stopPropagation!==!0){let{messageId:h,role:S="assistant",name:w}=v;if(!s.find(I=>I.id===h)){let I={id:h,role:S,content:"",...(w!==void 0&&{name:w})};s.push(I),u({messages:s})}}return g()}case D.TEXT_MESSAGE_CONTENT:{let{messageId:y,delta:h}=v,S=s.find(I=>I.id===y);if(!S)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${y}'`),g();let w=yield Te(n,s,a,(I,T,R)=>I.onTextMessageContentEvent?.({event:v,messages:T,state:R,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}));return u(w),w.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${h}`,u({messages:s})),g()}case D.TEXT_MESSAGE_END:{let{messageId:y}=v,h=s.find(S=>S.id===y);return h?(u(yield Te(n,s,a,(S,w,I)=>S.onTextMessageEndEvent?.({event:v,messages:w,state:I,agent:r,input:e,textMessageBuffer:typeof h.content=="string"?h.content:""}))),yield Promise.all(n.map(S=>{S.onNewMessage?.({message:h,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${y}'`),g())}case D.TOOL_CALL_START:{let y=yield Te(n,s,a,(h,S,w)=>h.onToolCallStartEvent?.({event:v,messages:S,state:w,agent:r,input:e}));if(u(y),y.stopPropagation!==!0){let{toolCallId:h,toolCallName:S,parentMessageId:w}=v,I=Sk(s,w,h);I.toolCalls??(I.toolCalls=[]),I.toolCalls.push({id:h,type:"function",function:{name:S,arguments:""}}),u({messages:s})}return g()}case D.TOOL_CALL_ARGS:{let{toolCallId:y,delta:h}=v,S=s.find(T=>T.toolCalls?.some(R=>R.id===y));if(!S)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${y}'`),g();let w=S.toolCalls?.find(T=>T.id===y);if(!w)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y}'`),g();let I=yield Te(n,s,a,(T,R,k)=>{let _=w.function.arguments,F=w.function.name,V={};try{V=Cc(_)}catch{}return T.onToolCallArgsEvent?.({event:v,messages:R,state:k,agent:r,input:e,toolCallBuffer:_,toolCallName:F,partialToolCallArgs:V})});return u(I),I.stopPropagation!==!0&&(w.function.arguments+=h,u({messages:s})),g()}case D.TOOL_CALL_END:{let{toolCallId:y}=v,h=s.find(w=>w.toolCalls?.some(I=>I.id===y));if(!h)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${y}'`),g();let S=h.toolCalls?.find(w=>w.id===y);return S?(u(yield Te(n,s,a,(w,I,T)=>{let R=S.function.arguments,k=S.function.name,_={};try{_=JSON.parse(R)}catch{}return w.onToolCallEndEvent?.({event:v,messages:I,state:T,agent:r,input:e,toolCallName:k,toolCallArgs:_})})),yield Promise.all(n.map(w=>{w.onNewToolCall?.({toolCall:S,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${y}'`),g())}case D.TOOL_CALL_RESULT:{let y=yield Te(n,s,a,(h,S,w)=>h.onToolCallResultEvent?.({event:v,messages:S,state:w,agent:r,input:e}));if(u(y),y.stopPropagation!==!0){let{messageId:h,toolCallId:S,content:w,role:I}=v,T={id:h,toolCallId:S,role:I||"tool",content:w},R=s.findIndex(k=>k.role==="assistant"&&k.toolCalls?.some(_=>_.id===S));if(R===-1)s.push(T);else{let k=R+1;for(;k<s.length&&s[k].role==="tool";)k++;s.splice(k,0,T)}yield Promise.all(n.map(k=>{k.onNewMessage?.({message:T,messages:s,state:a,agent:r,input:e})})),u({messages:s})}return g()}case D.STATE_SNAPSHOT:{let y=yield Te(n,s,a,(h,S,w)=>h.onStateSnapshotEvent?.({event:v,messages:S,state:w,agent:r,input:e}));if(u(y),y.stopPropagation!==!0){let{snapshot:h}=v;a=h,u({state:a})}return g()}case D.STATE_DELTA:{let y=yield Te(n,s,a,(h,S,w)=>h.onStateDeltaEvent?.({event:v,messages:S,state:w,agent:r,input:e}));if(u(y),y.stopPropagation!==!0){let{delta:h}=v;try{a=Xa.applyPatch(a,h,!0,!1).newDocument,u({state:a})}catch(S){let w=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(h,null,2)}
39
- Error: ${w}`)}}return g()}case D.MESSAGES_SNAPSHOT:{let y=yield Te(n,s,a,(h,S,w)=>h.onMessagesSnapshotEvent?.({event:v,messages:S,state:w,agent:r,input:e}));if(u(y),y.stopPropagation!==!0){let{messages:h}=v,S=new Map(h.map(R=>[R.id,R])),w=h.some(R=>R.role==="reasoning"),I=R=>R.role==="activity"||R.role==="reasoning"&&!w;s=s.filter(R=>I(R)||S.has(R.id)).map(R=>I(R)?R:S.get(R.id));let T=new Set(s.map(R=>R.id));for(let R of h)T.has(R.id)||s.push(R);u({messages:s})}return g()}case D.ACTIVITY_SNAPSHOT:{let y=v,h=s.findIndex(R=>R.id===y.messageId),S=h>=0?s[h]:void 0,w=S?.role==="activity"?S:void 0,I=y.replace??!0,T=yield Te(n,s,a,(R,k,_)=>R.onActivitySnapshotEvent?.({event:y,messages:k,state:_,agent:r,input:e,activityMessage:w,existingMessage:S}));if(u(T),T.stopPropagation!==!0){let R={id:y.messageId,role:"activity",activityType:y.activityType,content:we(y.content)},k;h===-1?(s.push(R),k=R):w?I&&(s[h]={...w,activityType:y.activityType,content:we(y.content)}):I&&(s[h]=R,k=R),u({messages:s}),k&&(yield Promise.all(n.map(_=>_.onNewMessage?.({message:k,messages:s,state:a,agent:r,input:e}))))}return g()}case D.ACTIVITY_DELTA:{let y=v,h=s.findIndex(T=>T.id===y.messageId);if(h===-1)return g();let S=s[h];if(S.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${y.messageId}' is not an activity message`),g();let w=S,I=yield Te(n,s,a,(T,R,k)=>T.onActivityDeltaEvent?.({event:y,messages:R,state:k,agent:r,input:e,activityMessage:w}));if(u(I),I.stopPropagation!==!0)try{let T=we(w.content??{}),R=Ya.applyPatch(T,y.patch??[],!0,!1).newDocument;s[h]={...w,content:we(R),activityType:y.activityType},u({messages:s})}catch(T){let R=T instanceof Error?T.message:String(T);console.warn(`Failed to apply activity patch for '${y.messageId}': ${R}`)}return g()}case D.RAW:return u(yield Te(n,s,a,(y,h,S)=>y.onRawEvent?.({event:v,messages:h,state:S,agent:r,input:e}))),g();case D.CUSTOM:return u(yield Te(n,s,a,(y,h,S)=>y.onCustomEvent?.({event:v,messages:h,state:S,agent:r,input:e}))),g();case D.RUN_STARTED:{let y=yield Te(n,s,a,(h,S,w)=>h.onRunStartedEvent?.({event:v,messages:S,state:w,agent:r,input:e}));if(u(y),y.stopPropagation!==!0){let h=v;if(h.input?.messages){for(let S of h.input.messages)s.find(w=>w.id===S.id)||s.push(S);u({messages:s})}}return g()}case D.RUN_FINISHED:{let y=v,h=y.outcome?.type==="interrupt"?{event:y,outcome:"interrupt",interrupts:y.outcome.interrupts}:{event:y,outcome:"success",result:y.result},S=yield Te(n,s,a,(w,I,T)=>w.onRunFinishedEvent?.({...h,messages:I,state:T,agent:r,input:e}));return u(S),S.stopPropagation!==!0&&(r.pendingInterrupts=h.outcome==="interrupt"?[...h.interrupts]:[]),g()}case D.RUN_ERROR:return u(yield Te(n,s,a,(y,h,S)=>y.onRunErrorEvent?.({event:v,messages:h,state:S,agent:r,input:e}))),g();case D.STEP_STARTED:return u(yield Te(n,s,a,(y,h,S)=>y.onStepStartedEvent?.({event:v,messages:h,state:S,agent:r,input:e}))),g();case D.STEP_FINISHED:return u(yield Te(n,s,a,(y,h,S)=>y.onStepFinishedEvent?.({event:v,messages:h,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,(y,h,S)=>y.onReasoningStartEvent?.({event:v,messages:h,state:S,agent:r,input:e}))),g();case D.REASONING_MESSAGE_START:{let y=yield Te(n,s,a,(h,S,w)=>h.onReasoningMessageStartEvent?.({event:v,messages:S,state:w,agent:r,input:e}));if(u(y),y.stopPropagation!==!0){let{messageId:h}=v;if(!s.find(S=>S.id===h)){let S={id:h,role:"reasoning",content:""};s.push(S),u({messages:s})}}return g()}case D.REASONING_MESSAGE_CONTENT:{let{messageId:y,delta:h}=v,S=s.find(I=>I.id===y);if(!S)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${y}'`),g();let w=yield Te(n,s,a,(I,T,R)=>I.onReasoningMessageContentEvent?.({event:v,messages:T,state:R,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}));return u(w),w.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${h}`,u({messages:s})),g()}case D.REASONING_MESSAGE_END:{let{messageId:y}=v,h=s.find(S=>S.id===y);return h?(u(yield Te(n,s,a,(S,w,I)=>S.onReasoningMessageEndEvent?.({event:v,messages:w,state:I,agent:r,input:e,reasoningMessageBuffer:typeof h.content=="string"?h.content:""}))),yield Promise.all(n.map(S=>{S.onNewMessage?.({message:h,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${y}'`),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,(y,h,S)=>y.onReasoningEndEvent?.({event:v,messages:h,state:S,agent:r,input:e}))),g();case D.REASONING_ENCRYPTED_VALUE:{let{subtype:y,entityId:h,encryptedValue:S}=v,w=yield Te(n,s,a,(I,T,R)=>I.onReasoningEncryptedValueEvent?.({event:v,messages:T,state:R,agent:r,input:e}));if(u(w),w.stopPropagation!==!0){let I=!1;if(y==="tool-call"){for(let T of s)if(T.role==="assistant"&&T.toolCalls){let R=T.toolCalls.find(k=>k.id===h);if(R){R.encryptedValue=S,I=!0;break}}}else{let T=s.find(R=>R.id===h);T?.role!=="activity"&&T&&(T.encryptedValue=S,I=!0)}I&&(c.messages=s)}return g()}}return v.type,g()});return function(_x87){return _ref40.apply(this,arguments)}}()),rp(),n.length>0?np({}):v=>v)},bp=e=>t=>{let r=$i(e),n=new Map,o=new Map,i=!1,s=!1,a=!1,c=new Map,u=!1,g=!1,v=!1,E=()=>{n.clear(),o.clear(),c.clear(),u=!1,g=!1,i=!1,s=!1,v=!0};return t.pipe(pt(y=>{let h=y.type;if(r?.event("VERIFY","Event:",y,{type:y.type}),s)return Me(()=>new Fe(`Cannot send event type '${h}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(i&&h!==D.RUN_ERROR&&h!==D.RUN_STARTED)return Me(()=>new Fe(`Cannot send event type '${h}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(a){if(h===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&&E()}}else if(a=!0,h!==D.RUN_STARTED&&h!==D.RUN_ERROR)return Me(()=>new Fe("First event must be 'RUN_STARTED'"));switch(h){case D.TEXT_MESSAGE_START:{let S=y.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(y))}case D.TEXT_MESSAGE_CONTENT:{let S=y.messageId;return n.has(S)?qe(y):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=y.messageId;return n.has(S)?(n.delete(S),qe(y)):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=y.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(y))}case D.TOOL_CALL_ARGS:{let S=y.toolCallId;return o.has(S)?qe(y):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=y.toolCallId;return o.has(S)?(o.delete(S),qe(y)):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=y.stepName;return c.has(S)?Me(()=>new Fe(`Step "${S}" is already active for 'STEP_STARTED'`)):(c.set(S,!0),qe(y))}case D.STEP_FINISHED:{let S=y.stepName;return c.has(S)?(c.delete(S),qe(y)):Me(()=>new Fe(`Cannot send 'STEP_FINISHED' for step "${S}" that was not started`))}case D.RUN_STARTED:return v=!0,qe(y);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(y);case D.RUN_ERROR:return s=!0,qe(y);case D.CUSTOM:return qe(y);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(y)):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(y):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(y)):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(y));case D.THINKING_END:return u?(u=!1,qe(y)):Me(()=>new Fe("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return qe(y)}}))},In=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),m0=e=>Sc(()=>Cn(e())).pipe(op(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:In.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:In.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"))})),g0=(e,t)=>{let r=$i(t),n=new Xt,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:a=>{if(a.type!==In.HEADERS&&a.type===In.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: ${w}`)}}return g()}case D.MESSAGES_SNAPSHOT:{let y=yield Te(n,s,a,(h,S,w)=>h.onMessagesSnapshotEvent?.({event:v,messages:S,state:w,agent:r,input:e}));if(u(y),y.stopPropagation!==!0){let{messages:h}=v,S=new Map(h.map(R=>[R.id,R])),w=h.some(R=>R.role==="reasoning"),I=R=>R.role==="activity"||R.role==="reasoning"&&!w;s=s.filter(R=>I(R)||S.has(R.id)).map(R=>I(R)?R:S.get(R.id));let T=new Set(s.map(R=>R.id));for(let R of h)T.has(R.id)||s.push(R);u({messages:s})}return g()}case D.ACTIVITY_SNAPSHOT:{let y=v,h=s.findIndex(R=>R.id===y.messageId),S=h>=0?s[h]:void 0,w=S?.role==="activity"?S:void 0,I=y.replace??!0,T=yield Te(n,s,a,(R,k,_)=>R.onActivitySnapshotEvent?.({event:y,messages:k,state:_,agent:r,input:e,activityMessage:w,existingMessage:S}));if(u(T),T.stopPropagation!==!0){let R={id:y.messageId,role:"activity",activityType:y.activityType,content:we(y.content)},k;h===-1?(s.push(R),k=R):w?I&&(s[h]={...w,activityType:y.activityType,content:we(y.content)}):I&&(s[h]=R,k=R),u({messages:s}),k&&(yield Promise.all(n.map(_=>_.onNewMessage?.({message:k,messages:s,state:a,agent:r,input:e}))))}return g()}case D.ACTIVITY_DELTA:{let y=v,h=s.findIndex(T=>T.id===y.messageId);if(h===-1)return g();let S=s[h];if(S.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${y.messageId}' is not an activity message`),g();let w=S,I=yield Te(n,s,a,(T,R,k)=>T.onActivityDeltaEvent?.({event:y,messages:R,state:k,agent:r,input:e,activityMessage:w}));if(u(I),I.stopPropagation!==!0)try{let T=we(w.content??{}),R=Xa.applyPatch(T,y.patch??[],!0,!1).newDocument;s[h]={...w,content:we(R),activityType:y.activityType},u({messages:s})}catch(T){let R=T instanceof Error?T.message:String(T);console.warn(`Failed to apply activity patch for '${y.messageId}': ${R}`)}return g()}case D.RAW:return u(yield Te(n,s,a,(y,h,S)=>y.onRawEvent?.({event:v,messages:h,state:S,agent:r,input:e}))),g();case D.CUSTOM:return u(yield Te(n,s,a,(y,h,S)=>y.onCustomEvent?.({event:v,messages:h,state:S,agent:r,input:e}))),g();case D.RUN_STARTED:{let y=yield Te(n,s,a,(h,S,w)=>h.onRunStartedEvent?.({event:v,messages:S,state:w,agent:r,input:e}));if(u(y),y.stopPropagation!==!0){let h=v;if(h.input?.messages){for(let S of h.input.messages)s.find(w=>w.id===S.id)||s.push(S);u({messages:s})}}return g()}case D.RUN_FINISHED:{let y=v,h=y.outcome?.type==="interrupt"?{event:y,outcome:"interrupt",interrupts:y.outcome.interrupts}:{event:y,outcome:"success",result:y.result},S=yield Te(n,s,a,(w,I,T)=>w.onRunFinishedEvent?.({...h,messages:I,state:T,agent:r,input:e}));return u(S),S.stopPropagation!==!0&&(r.pendingInterrupts=h.outcome==="interrupt"?[...h.interrupts]:[]),g()}case D.RUN_ERROR:return u(yield Te(n,s,a,(y,h,S)=>y.onRunErrorEvent?.({event:v,messages:h,state:S,agent:r,input:e}))),g();case D.STEP_STARTED:return u(yield Te(n,s,a,(y,h,S)=>y.onStepStartedEvent?.({event:v,messages:h,state:S,agent:r,input:e}))),g();case D.STEP_FINISHED:return u(yield Te(n,s,a,(y,h,S)=>y.onStepFinishedEvent?.({event:v,messages:h,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,(y,h,S)=>y.onReasoningStartEvent?.({event:v,messages:h,state:S,agent:r,input:e}))),g();case D.REASONING_MESSAGE_START:{let y=yield Te(n,s,a,(h,S,w)=>h.onReasoningMessageStartEvent?.({event:v,messages:S,state:w,agent:r,input:e}));if(u(y),y.stopPropagation!==!0){let{messageId:h}=v;if(!s.find(S=>S.id===h)){let S={id:h,role:"reasoning",content:""};s.push(S),u({messages:s})}}return g()}case D.REASONING_MESSAGE_CONTENT:{let{messageId:y,delta:h}=v,S=s.find(I=>I.id===y);if(!S)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${y}'`),g();let w=yield Te(n,s,a,(I,T,R)=>I.onReasoningMessageContentEvent?.({event:v,messages:T,state:R,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}));return u(w),w.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${h}`,u({messages:s})),g()}case D.REASONING_MESSAGE_END:{let{messageId:y}=v,h=s.find(S=>S.id===y);return h?(u(yield Te(n,s,a,(S,w,I)=>S.onReasoningMessageEndEvent?.({event:v,messages:w,state:I,agent:r,input:e,reasoningMessageBuffer:typeof h.content=="string"?h.content:""}))),yield Promise.all(n.map(S=>{S.onNewMessage?.({message:h,messages:s,state:a,agent:r,input:e})})),g()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${y}'`),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,(y,h,S)=>y.onReasoningEndEvent?.({event:v,messages:h,state:S,agent:r,input:e}))),g();case D.REASONING_ENCRYPTED_VALUE:{let{subtype:y,entityId:h,encryptedValue:S}=v,w=yield Te(n,s,a,(I,T,R)=>I.onReasoningEncryptedValueEvent?.({event:v,messages:T,state:R,agent:r,input:e}));if(u(w),w.stopPropagation!==!0){let I=!1;if(y==="tool-call"){for(let T of s)if(T.role==="assistant"&&T.toolCalls){let R=T.toolCalls.find(k=>k.id===h);if(R){R.encryptedValue=S,I=!0;break}}}else{let T=s.find(R=>R.id===h);T?.role!=="activity"&&T&&(T.encryptedValue=S,I=!0)}I&&(c.messages=s)}return g()}}return v.type,g()});return function(_x87){return _ref40.apply(this,arguments)}}()),rp(),n.length>0?np({}):v=>v)},wp=e=>t=>{let r=Qi(e),n=new Map,o=new Map,i=!1,s=!1,a=!1,c=new Map,u=!1,g=!1,v=!1,E=()=>{n.clear(),o.clear(),c.clear(),u=!1,g=!1,i=!1,s=!1,v=!0};return t.pipe(pt(y=>{let h=y.type;if(r?.event("VERIFY","Event:",y,{type:y.type}),s)return Me(()=>new Fe(`Cannot send event type '${h}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(i&&h!==D.RUN_ERROR&&h!==D.RUN_STARTED)return Me(()=>new Fe(`Cannot send event type '${h}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(a){if(h===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&&E()}}else if(a=!0,h!==D.RUN_STARTED&&h!==D.RUN_ERROR)return Me(()=>new Fe("First event must be 'RUN_STARTED'"));switch(h){case D.TEXT_MESSAGE_START:{let S=y.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(y))}case D.TEXT_MESSAGE_CONTENT:{let S=y.messageId;return n.has(S)?qe(y):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=y.messageId;return n.has(S)?(n.delete(S),qe(y)):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=y.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(y))}case D.TOOL_CALL_ARGS:{let S=y.toolCallId;return o.has(S)?qe(y):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=y.toolCallId;return o.has(S)?(o.delete(S),qe(y)):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=y.stepName;return c.has(S)?Me(()=>new Fe(`Step "${S}" is already active for 'STEP_STARTED'`)):(c.set(S,!0),qe(y))}case D.STEP_FINISHED:{let S=y.stepName;return c.has(S)?(c.delete(S),qe(y)):Me(()=>new Fe(`Cannot send 'STEP_FINISHED' for step "${S}" that was not started`))}case D.RUN_STARTED:return v=!0,qe(y);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(y);case D.RUN_ERROR:return s=!0,qe(y);case D.CUSTOM:return qe(y);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(y)):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(y):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(y)):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(y));case D.THINKING_END:return u?(u=!1,qe(y)):Me(()=>new Fe("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return qe(y)}}))},In=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),Ak=e=>Ac(()=>Cn(e())).pipe(op(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:In.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:In.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"))})),bk=(e,t)=>{let r=Qi(t),n=new Xt,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:a=>{if(a.type!==In.HEADERS&&a.type===In.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()},h0=e=>{let t=new Xt,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==In.HEADERS&&o.type===In.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=uS(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()},y0=(e,t)=>{let r=$i(t),n=new Xt,o=new oc,i=!1;return e.subscribe({next:s=>{if(o.next(s),s.type===In.HEADERS&&!i){i=!0;let a=s.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:a,parser:a===yp?"protobuf":"sse"}),a===yp?h0(o).subscribe({next:c=>n.next(c),error:c=>n.error(c),complete:()=>n.complete()}):g0(o,r).subscribe({next:c=>{try{let u=Ga.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"]),v0=A.enum(["LangGraphInterruptEvent","PredictState","Exit"]),S0=A.object({type:A.literal(Pe.enum.TextMessageStart),messageId:A.string(),parentMessageId:A.string().optional(),role:A.string().optional()}),A0=A.object({type:A.literal(Pe.enum.TextMessageContent),messageId:A.string(),content:A.string()}),b0=A.object({type:A.literal(Pe.enum.TextMessageEnd),messageId:A.string()}),w0=A.object({type:A.literal(Pe.enum.ActionExecutionStart),actionExecutionId:A.string(),actionName:A.string(),parentMessageId:A.string().optional()}),C0=A.object({type:A.literal(Pe.enum.ActionExecutionArgs),actionExecutionId:A.string(),args:A.string()}),x0=A.object({type:A.literal(Pe.enum.ActionExecutionEnd),actionExecutionId:A.string()}),E0=A.object({type:A.literal(Pe.enum.ActionExecutionResult),actionName:A.string(),actionExecutionId:A.string(),result:A.string()}),I0=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()}),R0=A.object({type:A.literal(Pe.enum.MetaEvent),name:v0,value:A.any()}),T0=A.object({type:A.literal(Pe.enum.RunError),message:A.string(),code:A.string().optional()});A.discriminatedUnion("type",[S0,A0,b0,w0,C0,x0,E0,I0,R0,T0]),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 _0=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
- `)},k0=(e,t,r)=>n=>{let o={},i=!0,s=!0,a="",c=null,u=null,g=[],v={},E=y=>{typeof y=="object"&&y&&("messages"in y&&delete y.messages,o=y)};return n.pipe(pt(y=>{switch(y.type){case D.TEXT_MESSAGE_START:{let h=y;return[{type:Pe.enum.TextMessageStart,messageId:h.messageId,role:h.role}]}case D.TEXT_MESSAGE_CONTENT:{let h=y;return[{type:Pe.enum.TextMessageContent,messageId:h.messageId,content:h.delta}]}case D.TEXT_MESSAGE_END:{let h=y;return[{type:Pe.enum.TextMessageEnd,messageId:h.messageId}]}case D.TOOL_CALL_START:{let h=y;return g.push({id:h.toolCallId,type:"function",function:{name:h.toolCallName,arguments:""}}),s=!0,v[h.toolCallId]=h.toolCallName,[{type:Pe.enum.ActionExecutionStart,actionExecutionId:h.toolCallId,actionName:h.toolCallName,parentMessageId:h.parentMessageId}]}case D.TOOL_CALL_ARGS:{let h=y,S=g.find(I=>I.id===h.toolCallId);if(!S)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h.toolCallId}'`),[];S.function.arguments+=h.delta;let w=!1;if(u){let I=u.find(T=>T.tool==S.function.name);if(I)try{let T=JSON.parse(wc(S.function.arguments));I.tool_argument&&I.tool_argument in T?(E({...o,[I.state_key]:T[I.tool_argument]}),w=!0):I.tool_argument||(E({...o,[I.state_key]:T}),w=!0)}catch{}}return[{type:Pe.enum.ActionExecutionArgs,actionExecutionId:h.toolCallId,args:h.delta},...(w?[{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 h=y;return[{type:Pe.enum.ActionExecutionEnd,actionExecutionId:h.toolCallId}]}case D.TOOL_CALL_RESULT:{let h=y;return[{type:Pe.enum.ActionExecutionResult,actionExecutionId:h.toolCallId,result:h.content,actionName:v[h.toolCallId]||"unknown"}]}case D.RAW:return[];case D.CUSTOM:{let h=y;switch(h.name){case"Exit":i=!1;break;case"PredictState":u=h.value;break}return[{type:Pe.enum.MetaEvent,name:h.name,value:h.value}]}case D.STATE_SNAPSHOT:return E(y.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 h=y,S=Ya.applyPatch(o,h.delta,!0,!1);return S?(E(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=y.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:O0(c)}:{})}),active:!1}];case D.RUN_ERROR:{let h=y;return[{type:Pe.enum.RunError,message:h.message,code:h.code}]}case D.STEP_STARTED:return a=y.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 O0(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=_0(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 ou=e=>t=>{let r=$i(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 E=v,y=[];if((s!=="text"||E.messageId!==void 0&&E.messageId!==n?.messageId)&&y.push(...g()),s!=="text"){if(E.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");n={messageId:E.messageId,name:E.name},s="text";let T={type:D.TEXT_MESSAGE_START,messageId:E.messageId,role:E.role||"assistant",...(E.name!==void 0&&{name:E.name})};y.push(T),r?.event("TRANSFORM","TEXT_MESSAGE_START",T,{messageId:E.messageId})}if(E.delta!==void 0){let T={type:D.TEXT_MESSAGE_CONTENT,messageId:n.messageId,delta:E.delta};y.push(T),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",T,{messageId:n.messageId})}return y;case D.TOOL_CALL_CHUNK:let h=v,S=[];if((s!=="tool"||h.toolCallId!==void 0&&h.toolCallId!==o?.toolCallId)&&S.push(...g()),s!=="tool"){if(h.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(h.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");o={toolCallId:h.toolCallId,toolCallName:h.toolCallName,parentMessageId:h.parentMessageId},s="tool";let T={type:D.TOOL_CALL_START,toolCallId:h.toolCallId,toolCallName:h.toolCallName,parentMessageId:h.parentMessageId};S.push(T),r?.event("TRANSFORM","TOOL_CALL_START",T,{toolCallId:h.toolCallId,toolCallName:h.toolCallName})}if(h.delta!==void 0){let T={type:D.TOOL_CALL_ARGS,toolCallId:o.toolCallId,delta:h.delta};S.push(T),r?.event("TRANSFORM","TOOL_CALL_ARGS",T,{toolCallId:o.toolCallId})}return S;case D.REASONING_MESSAGE_CHUNK:let w=v,I=[];if((s!=="reasoning"||w.messageId&&w.messageId!==i?.messageId)&&I.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 T={type:D.REASONING_MESSAGE_START,messageId:w.messageId};I.push(T),r?.event("TRANSFORM","REASONING_MESSAGE_START",T,{messageId:w.messageId})}if(w.delta!==void 0){let T={type:D.REASONING_MESSAGE_CONTENT,messageId:i.messageId,delta:w.delta};I.push(T),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",T,{messageId:i.messageId})}return I}return v.type,[]}),En(()=>{g()}))};function P0(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var iu=class{runNext(e,t){return t.run(e).pipe(ou(!1))}runNextWithState(e,t){let r=we(e.messages||[]),n=we(e.state||{}),o=new oc;return SS(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(Ac(/*#__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)}}()))}},N0=class extends iu{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function F0(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 D0=class extends iu{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(F0)};return this.runNext(o,t)}},mS="THINKING_START",gS="THINKING_END",hS="THINKING_TEXT_MESSAGE_START",yS="THINKING_TEXT_MESSAGE_CONTENT",vS="THINKING_TEXT_MESSAGE_END",M0=class extends iu{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 mS:{this.currentReasoningId=Bi();let{title:t,...r}=e;return this.warnAboutTransformation(mS,D.REASONING_START),{...r,type:D.REASONING_START,messageId:this.currentReasoningId}}case hS:return this.currentMessageId=Bi(),this.warnAboutTransformation(hS,D.REASONING_MESSAGE_START),{...e,type:D.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case yS:{let{delta:t,...r}=e;return this.warnAboutTransformation(yS,D.REASONING_MESSAGE_CONTENT),{...r,type:D.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Bi(),delta:t}}case vS:{let t=this.currentMessageId??Bi();return this.warnAboutTransformation(vS,D.REASONING_MESSAGE_END),{...e,type:D.REASONING_MESSAGE_END,messageId:t}}case gS:{let t=this.currentReasoningId??Bi();return this.warnAboutTransformation(gS,D.REASONING_END),{...e,type:D.REASONING_END,messageId:t}}default:return e}}};function L0(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function j0(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function q0(e){let t=L0(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 U0(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>j0(n)?q0(n):n);return{...e,content:r}}var V0=class extends iu{run(e,t){let r={...e,messages:e.messages.map(U0)};return this.runNext(r,t)}},G0="0.0.57",B0=class{get maxVersion(){return G0}get debug(){return this._debug}set debug(e){this._debug=nu(e),this._debugLogger=Ap(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?Ap(nu(!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=nu(i),this._debugLogger=Ap(this._debug),Gi(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new D0),Gi(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new M0),Gi(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new V0)}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 N0(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 vc(nc(()=>_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),ou(_this1.debugLogger),bp(_this1.debugLogger),c=>c.pipe(bc(_this1.activeRunDetach$)),c=>_this1.apply(r,c,i),c=>_this1.processApplyEvents(r,c,i),qi(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 Bd}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 vc(nc(()=>Sc(()=>_this10.connect(r)),ou(_this10.debugLogger),bp(_this10.debugLogger),c=>c.pipe(bc(_this10.activeRunDetach$)),c=>_this10.apply(r,c,i),c=>_this10.processApplyEvents(r,c,i),qi(c=>(_this10.isRunning=!1,c instanceof Bd?ic:_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 SS(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(ip(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(P0(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(ou(this.debugLogger),bp(this.debugLogger),k0(this.threadId,t.runId,this.agentId),r=>r.pipe(xn(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}},AS=class extends B0{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 y0(m0(()=>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 bS=(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 xp=class extends AS{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}}},wS=(e,t,r)=>new xp({url:`${bS(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var $0=new re({required:!0}),CS=new re({required:!0,constrainTo:Ra}),xS=e=>({...e,name:Ta(e.name)}),ES=G("followUpAnswers/setIsEnabled",e=>W(e,new je({required:!0}))),IS=G("followUpAnswers/setFollowUpAnswersConversationId",e=>W(e,ee)),RS=G("followUpAnswers/setFollowUpAnswersConversationToken",e=>W(e,ee)),TS=G("followUpAnswers/clearFollowUpAnswersConversationToken"),oee=G("followUpAnswers/createFollowUpAnswer",e=>W(e,{question:ee})),iee=G("followUpAnswers/setActiveFollowUpAnswerId",e=>W(e,ee)),see=G("followUpAnswers/setFollowUpAnswerContentFormat",e=>W(e,{contentFormat:ka,answerId:ee})),aee=G("followUpAnswers/setFollowUpIsLoading",e=>W(e,{isLoading:new je({required:!0}),answerId:ee})),cee=G("followUpAnswers/setFollowUpIsStreaming",e=>W(e,{isStreaming:new je({required:!0}),answerId:ee})),uee=G("followUpAnswers/followUpMessageChunkReceived",e=>W(e,{textDelta:$0,answerId:ee})),lee=G("followUpAnswers/followUpCitationsReceived",e=>W(e,{citations:new Ft({required:!0,each:new xe({values:_d})}),answerId:ee})),dee=G("followUpAnswers/followUpCompleted",e=>W(e,{answerId:ee,cannotAnswer:new je({required:!1})})),pee=G("followUpAnswers/followUpFailed",e=>W(e,{message:new re,code:new Le({min:0}),answerId:ee})),fee=G("followUpAnswers/activeFollowUpStartFailed",e=>W(e,{message:new re})),mee=G("followUpAnswers/likeFollowUp",e=>W(e,{answerId:ee})),gee=G("followUpAnswers/dislikeFollowUp",e=>W(e,{answerId:ee})),hee=G("followUpAnswers/submitFollowUpFeedback",e=>W(e,{answerId:ee})),_S=G("followUpAnswers/resetFollowUpAnswers"),yee=G("followUpAnswers/stepStarted",e=>W(xS(e),{answerId:ee,name:CS,startedAt:new Le({min:0,required:!0})})),vee=G("followUpAnswers/stepFinished",e=>W(xS(e),{answerId:ee,name:CS,finishedAt:new Le({min:0,required:!0})})),See=G("followUpAnswers/startToolCall",e=>W(e,{answerId:ee,toolCallName:ee,startedAt:new Le({min:0,required:!0}),toolCallId:ee})),Aee=G("followUpAnswers/finishToolCall",e=>W(e,{answerId:ee,finishedAt:new Le({min:0,required:!0}),toolCallId:ee})),bee=G("followUpAnswers/toolCallArgs",e=>W(e,{answerId:ee,toolCallId:ee,args:new xe({options:{required:!0}}),type:new re({required:!0,constrainTo:_a})}));m();d();f();p();var Q0={"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 kS(e){return e?Q0[e]??1004:1004}var OS=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Oa(n.runId)),e(Er(!1)),e(xi(!0)),e(IS(n.threadId)),e(TS())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(oy({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(iy({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(sy({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(ay({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(Na({toolCallId:i,args:a,type:"search"})):e(Na({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(Na({toolCallId:i,args:{raw:s},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(Ei({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(Ti(s.contentFormat)),typeof s?.followUpEnabled=="boolean"&&e(ES(s.followUpEnabled)),s?.conversationToken&&e(RS(s.conversationToken));return}case"citations":{e(Ii({citations:s.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=kS(n.code);e(Ri({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(kd(i)),e(_i(!i)),e(xi(!1)),e(ld(i,t,s)),e(oo())}}};var PS=()=>{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=ga(n),a=nh(n),c=oh(n),u=rh(n),g=ih(n),v=wS(s,a,c);e=v;let E=OS(o),y=Xh(n,i());try{o(Er(!0)),yield v.runAgent({forwardedProps:{params:y,accessToken:u,recordDebugSession:g}},E)}catch(h){o(Er(!1)),o(Ri({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",h)}});return function run(_x89,_x90,_x91){return _ref47.apply(this,arguments)}}(),abortRun:t}};m();d();f();p();m();d();f();p();var NS=G("breadcrumb/deselectAll"),FS=G("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var DS=G("facet/updateFacetAutoSelection",e=>W(e,{allow:new je({required:!0})}));m();d();f();p();m();d();f();p();var su=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 MS=()=>Re("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new su(e)),LS=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var Ep={id:ee},H0={...Ep,q:Dt},kte=G("instantResults/register",e=>W(e,Ep)),au=G("instantResults/updateQuery",e=>W(e,H0)),Ote=G("instantResults/clearExpired",e=>W(e,Ep));m();d();f();p();var cu=new Le({required:!0,min:0}),Ute=G("pagination/registerNumberOfResults",e=>W(e,cu)),Vte=G("pagination/updateNumberOfResults",e=>W(e,cu)),Gte=G("pagination/registerPage",e=>W(e,cu)),jS=G("pagination/updatePage",e=>W(e,cu)),Bte=G("pagination/nextPage"),$te=G("pagination/previousPage");m();d();f();p();var Io=G("query/updateQuery",e=>W(e,{q:new re,enableQuerySyntax:new je}));m();d();f();p();m();d();f();p();m();d();f();p();var Ro=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var Ip=()=>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||Ro().aq,cq:r.advancedSearchQueries?.cq||Ro().cq,dq:r.advancedSearchQueries?.dq||Ro().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();m();d();f();p();var uu=e=>e.success!==void 0,ft=e=>e.error!==void 0;m();d();f();p();var Vre=G("didYouMean/enable"),Gre=G("didYouMean/disable"),Bre=G("didYouMean/automaticCorrections/disable"),$re=G("didYouMean/automaticCorrections/enable"),lu=G("didYouMean/correction",e=>W(e,ee)),Qre=G("didYouMean/automaticCorrections/mode",e=>W(e,new re({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var Rp=()=>Re("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var qS=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function US(){return{contextValues:{}}}m();d();f();p();function VS(){return{contextValues:{}}}m();d();f();p();function GS(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function BS(){return[]}m();d();f();p();function $S(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function QS(){return{}}m();d();f();p();function HS(){return{}}m();d();f();p();function zS(){return{}}function Zt(e){return{context:e.context||US(),dictionaryFieldContext:e.dictionaryFieldContext||VS(),facetSet:e.facetSet||ma(),numericFacetSet:e.numericFacetSet||fa(),dateFacetSet:e.dateFacetSet||pa(),categoryFacetSet:e.categoryFacetSet||da(),automaticFacetSet:e.automaticFacetSet??la(),pagination:e.pagination||$S(),query:e.query||Mt(),tabSet:e.tabSet||zS(),advancedSearchQueries:e.advancedSearchQueries||Ro(),staticFilterSet:e.staticFilterSet||HS(),querySet:e.querySet||QS(),sortCriteria:e.sortCriteria||ha(),pipeline:e.pipeline||no(),searchHub:e.searchHub||Hn(),facetOptions:e.facetOptions||GS(),facetOrder:e.facetOrder??BS(),debug:e.debug??Ds()}}m();d();f();p();var yoe=new xe({values:{undoneQuery:Dt},options:{required:!0}}),WS=()=>Re("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var du=G("trigger/query/ignore",e=>W(e,new re({emptyAllowed:!0,required:!0}))),pu=G("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=K0(e),n=xa(e),o=z0(e),i=yield io(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 z0(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(W0).filter(r=>r.currentValues.length>0):void 0}function W0(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function K0(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=Y0(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function Y0(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(Io({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=Ca(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 E=u?yield _this20.processLegacyDidYouMeanAutoCorrection(t):_this20.processModernDidYouMeanAutoCorrection(t);return _this20.dispatch(Bt(Zt(_this20.getState()))),E})()}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(Bt(Zt(_this21.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Rp()})})()}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:Rp()}}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(du("")),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(Bt(Zt(_this22.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:WS()})})()}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(Bt(Zt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return uu(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(lu(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.dispatch(pu({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 yie=Ce("search/executeSearch",/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t){let r=t.getState();return yield fu(r,t,e)});return function(_x96,_x97){return _ref49.apply(this,arguments)}}()),vie=Ce("search/fetchPage",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();return yield _p(r,t,e)});return function(_x98,_x99){return _ref50.apply(this,arguments)}}()),Sie=Ce("search/fetchMoreResults",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();return yield kp(t,r)});return function(_x100,_x101){return _ref51.apply(this,arguments)}}()),Aie=Ce("search/fetchFacetValues",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield eO(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 Tp(e,t)});return function(_x104,_x105){return _ref53.apply(this,arguments)}}()),X0=/*#__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 X0(_x106,_x107){return _ref54.apply(this,arguments)}}(),Z0=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield io(e);return wr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function Z0(_x108,_x109,_x110){return _ref55.apply(this,arguments)}}(),J0=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){let r=yield Nr(e,t);return r.request.numberOfResults=0,r});return function J0(_x111,_x112){return _ref56.apply(this,arguments)}}(),KS=e=>{e.configuration.analytics.enabled&&yt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Tp(_x113,_x114){return _Tp.apply(this,arguments)}function _Tp(){_Tp=_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:MS()},u=>{t.dispatch(au({q:u,id:e.id}))}),s=yield Z0(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 _Tp.apply(this,arguments)}function _p(_x115,_x116,_x117){return _p2.apply(this,arguments)}function _p2(){_p2=_asyncToGenerator(function*(e,t,r){KS(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 _p2.apply(this,arguments)}function kp(_x118,_x119){return _kp.apply(this,arguments)}function _kp(){_kp=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield Ip().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),s=new Fr({...e,analyticsAction:Ip()}),a=yield X0(t,i),c=yield s.fetchFromAPI(a,{origin:"mainSearch"});return yield s.process(c)});return _kp.apply(this,arguments)}function eO(_x120,_x121,_x122){return _eO.apply(this,arguments)}function _eO(){_eO=_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 J0(r,s),u=yield a.fetchFromAPI(c,{origin:"facetValues"});return yield a.process(u)});return _eO.apply(this,arguments)}function fu(_x123,_x124,_x125){return _fu.apply(this,arguments)}function _fu(){_fu=_asyncToGenerator(function*(e,t,r){KS(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 _fu.apply(this,arguments)}m();d();f();p();var Dr=class{constructor(t,r=n=>{this.dispatch(Io({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=Ca(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 E=u?yield _this27.processLegacyDidYouMeanAutoCorrection(t):_this27.processModernDidYouMeanAutoCorrection(t);return _this27.dispatch(Bt(Zt(_this27.getState()))),E})()}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(Bt(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(du("")),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(Bt(Zt(_this29.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Bt(Zt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return uu(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this30=this;return _asyncToGenerator(function*(){_this30.onUpdateQueryForCorrection(t);let r=_this30.getState(),{actionCause:n}=qS(),o=yield _this30.fetchFromAPI(yield xr(r,_this30.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this30.dispatch(lu(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.dispatch(pu({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(NS()),r(FS())),r(DS({allow:!0})),r(Io({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(jS(1))}),cse=G("search/updateSearchAction"),mu=Ce("search/executeSearch",/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return fu(r,t,e.legacy);ZS(r);let n=e.next?JS(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)}}()),YS=Ce("search/fetchPage",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t){let r=t.getState();if(ZS(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return _p(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)}}()),XS=Ce("search/fetchMoreResults",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return kp(t,r);let n=vh("browseResults",t.getState),o=new Dr({...t,analyticsAction:n}),i=yield tO(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)}}()),use=Ce("search/fetchFacetValues",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return fu(r,t,e.legacy);let n=new Dr({...t,analyticsAction:{}}),o=yield nO(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)}}()),lse=Ce("search/fetchInstantResults",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Tp(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=JS(LS()),s=yield rO(r,t.extra.navigatorContext,n,o,i),a=new Dr({...t,analyticsAction:i},g=>{t.dispatch(au({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)}}()),tO=/*#__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 tO(_x138,_x139,_x140){return _ref62.apply(this,arguments)}}(),rO=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t,r,n,o){let i=Ea(e,t,o);return wr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function rO(_x141,_x142,_x143,_x144,_x145){return _ref63.apply(this,arguments)}}(),nO=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t,r){let n=yield xr(e,t,r);return n.request.numberOfResults=0,n});return function nO(_x146,_x147,_x148){return _ref64.apply(this,arguments)}}(),ZS=e=>{e.configuration.analytics.enabled&&yt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},JS=e=>({actionCause:e.actionCause,type:e.actionCause});var eA=e=>{let t=wm({extra:e}),r=PS();return t.startListening({actionCreator:mu.pending,effect:function(){var _ref65=_asyncToGenerator(function*(n,o){let i=o.getState();if(!td(i)||(r.abortRun(),o.dispatch(Pa()),o.dispatch(_S()),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 tA=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)},rA=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var Op=(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 nA(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=hf(Object.entries(t).filter(([s])=>!(s in r)).map(([s,a])=>[s,()=>a]));return o(jn({...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 To=G("app/setError");m();d();f();p();function oO(e){if(!e||!iO(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 oA(e,t=60){if(!e)return!1;let r=oO(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function iO(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function sA(e,t){let r=0,n=null,o=es(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(c,u=!1){let g=!n;g&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(E){if(!u)throw E;return null}})().finally(()=>{n=null}));let v=yield n;return g&&v&&c.dispatch(Qn({accessToken:v})),v});return function i(_x151){return _ref66.apply(this,arguments)}}(),s=/*#__PURE__*/function(){var _ref68=_asyncToGenerator(function*(c){let u=c.getState(),g=aO(u);if(!(!g||!oA(g))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(c))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(v){e.warn(v,"Access token renewal failed. A retry will occur if necessary.")}}});return function s(_x152){return _ref68.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(c,u,g){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),iA(c,u.error),u;!n&&(r++,o());try{yield i(c,!0)}catch(E){e.debug(E,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}c.dispatch(g)});return function a(_x153,_x154,_x155){return _ref69.apply(this,arguments)}}();return c=>u=>(/*#__PURE__*/function(){var _ref70=_asyncToGenerator(function*(g){let v=typeof g=="function",E=typeof t=="function";if(!v)return u(g);E&&(yield s(c));let y=yield u(g);return sO(y)?E?yield a(c,y,g):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),iA(c,y.error),y):y});return function(_x156){return _ref70.apply(this,arguments)}}())}function sO(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Nn().name}function iA(e,t){e.dispatch(To({status:401,statusCode:401,message:t.message,type:t.name}))}function aO(e){return e.configuration.accessToken}m();d();f();p();function aA({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return cm({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(rA(n.logger))})}function cO(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&&Bu()&&!c?(t.info("Analytics disabled since doNotTrack is active."),{...s,enabled:!1}):(a&&Bu()&&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 cA(e,t){let r={...e.reducers,configuration:St,version:yy},n=uO({...e,reducers:r},t,St),{accessToken:o,environment:i,organizationId:s}=e.configuration;n.dispatch(Qn({accessToken:o,environment:i,organizationId:s}));let a=cO(e.configuration,n.logger);return a&&n.dispatch(js(a)),n}function uO(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=nA({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let s=t.logger,a={...t,get relay(){return si(u.state,o)},get navigatorContext(){return Op(this.relay,o)}},c=lO(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(Us())},disableAnalytics(){c.dispatch(qs())},get state(){return c.getState()},get relay(){return si(this.state,o)},get navigatorContext(){return Op(this.relay,o)},logger:s,store:c};return u}function lO(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",s=dO(e,t.logger,()=>t.navigatorContext);return aA({preloadedState:n,reducer:r.combinedReducer,middlewares:s,thunkExtraArguments:t,name:i})}function dO(e,t,r){let{renewAccessToken:n}=e.configuration,o=sA(t,n),i=eA({getNavigatorContext:r});return[_y,o,tA(t),Sy].concat(Pd.middleware,i.middleware,e.middlewares||[])}var pO=`[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()},wk=e=>{let t=new Xt,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==In.HEADERS&&o.type===In.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=pS(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()},Ck=(e,t)=>{let r=Qi(t),n=new Xt,o=new ic,i=!1;return e.subscribe({next:s=>{if(o.next(s),s.type===In.HEADERS&&!i){i=!0;let a=s.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:a,parser:a===vp?"protobuf":"sse"}),a===vp?wk(o).subscribe({next:c=>n.next(c),error:c=>n.error(c),complete:()=>n.complete()}):bk(o,r).subscribe({next:c=>{try{let u=Ba.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"]),xk=A.enum(["LangGraphInterruptEvent","PredictState","Exit"]),Ek=A.object({type:A.literal(Pe.enum.TextMessageStart),messageId:A.string(),parentMessageId:A.string().optional(),role:A.string().optional()}),Ik=A.object({type:A.literal(Pe.enum.TextMessageContent),messageId:A.string(),content:A.string()}),Rk=A.object({type:A.literal(Pe.enum.TextMessageEnd),messageId:A.string()}),Tk=A.object({type:A.literal(Pe.enum.ActionExecutionStart),actionExecutionId:A.string(),actionName:A.string(),parentMessageId:A.string().optional()}),_k=A.object({type:A.literal(Pe.enum.ActionExecutionArgs),actionExecutionId:A.string(),args:A.string()}),kk=A.object({type:A.literal(Pe.enum.ActionExecutionEnd),actionExecutionId:A.string()}),Ok=A.object({type:A.literal(Pe.enum.ActionExecutionResult),actionName:A.string(),actionExecutionId:A.string(),result:A.string()}),Pk=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()}),Nk=A.object({type:A.literal(Pe.enum.MetaEvent),name:xk,value:A.any()}),Fk=A.object({type:A.literal(Pe.enum.RunError),message:A.string(),code:A.string().optional()});A.discriminatedUnion("type",[Ek,Ik,Rk,Tk,_k,kk,Ok,Pk,Nk,Fk]),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 Dk=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
+ `)},Mk=(e,t,r)=>n=>{let o={},i=!0,s=!0,a="",c=null,u=null,g=[],v={},E=y=>{typeof y=="object"&&y&&("messages"in y&&delete y.messages,o=y)};return n.pipe(pt(y=>{switch(y.type){case D.TEXT_MESSAGE_START:{let h=y;return[{type:Pe.enum.TextMessageStart,messageId:h.messageId,role:h.role}]}case D.TEXT_MESSAGE_CONTENT:{let h=y;return[{type:Pe.enum.TextMessageContent,messageId:h.messageId,content:h.delta}]}case D.TEXT_MESSAGE_END:{let h=y;return[{type:Pe.enum.TextMessageEnd,messageId:h.messageId}]}case D.TOOL_CALL_START:{let h=y;return g.push({id:h.toolCallId,type:"function",function:{name:h.toolCallName,arguments:""}}),s=!0,v[h.toolCallId]=h.toolCallName,[{type:Pe.enum.ActionExecutionStart,actionExecutionId:h.toolCallId,actionName:h.toolCallName,parentMessageId:h.parentMessageId}]}case D.TOOL_CALL_ARGS:{let h=y,S=g.find(I=>I.id===h.toolCallId);if(!S)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h.toolCallId}'`),[];S.function.arguments+=h.delta;let w=!1;if(u){let I=u.find(T=>T.tool==S.function.name);if(I)try{let T=JSON.parse(Cc(S.function.arguments));I.tool_argument&&I.tool_argument in T?(E({...o,[I.state_key]:T[I.tool_argument]}),w=!0):I.tool_argument||(E({...o,[I.state_key]:T}),w=!0)}catch{}}return[{type:Pe.enum.ActionExecutionArgs,actionExecutionId:h.toolCallId,args:h.delta},...(w?[{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 h=y;return[{type:Pe.enum.ActionExecutionEnd,actionExecutionId:h.toolCallId}]}case D.TOOL_CALL_RESULT:{let h=y;return[{type:Pe.enum.ActionExecutionResult,actionExecutionId:h.toolCallId,result:h.content,actionName:v[h.toolCallId]||"unknown"}]}case D.RAW:return[];case D.CUSTOM:{let h=y;switch(h.name){case"Exit":i=!1;break;case"PredictState":u=h.value;break}return[{type:Pe.enum.MetaEvent,name:h.name,value:h.value}]}case D.STATE_SNAPSHOT:return E(y.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 h=y,S=Xa.applyPatch(o,h.delta,!0,!1);return S?(E(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=y.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:Lk(c)}:{})}),active:!1}];case D.RUN_ERROR:{let h=y;return[{type:Pe.enum.RunError,message:h.message,code:h.code}]}case D.STEP_STARTED:return a=y.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 Lk(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=Dk(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 ou=e=>t=>{let r=Qi(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 E=v,y=[];if((s!=="text"||E.messageId!==void 0&&E.messageId!==n?.messageId)&&y.push(...g()),s!=="text"){if(E.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");n={messageId:E.messageId,name:E.name},s="text";let T={type:D.TEXT_MESSAGE_START,messageId:E.messageId,role:E.role||"assistant",...(E.name!==void 0&&{name:E.name})};y.push(T),r?.event("TRANSFORM","TEXT_MESSAGE_START",T,{messageId:E.messageId})}if(E.delta!==void 0){let T={type:D.TEXT_MESSAGE_CONTENT,messageId:n.messageId,delta:E.delta};y.push(T),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",T,{messageId:n.messageId})}return y;case D.TOOL_CALL_CHUNK:let h=v,S=[];if((s!=="tool"||h.toolCallId!==void 0&&h.toolCallId!==o?.toolCallId)&&S.push(...g()),s!=="tool"){if(h.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(h.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");o={toolCallId:h.toolCallId,toolCallName:h.toolCallName,parentMessageId:h.parentMessageId},s="tool";let T={type:D.TOOL_CALL_START,toolCallId:h.toolCallId,toolCallName:h.toolCallName,parentMessageId:h.parentMessageId};S.push(T),r?.event("TRANSFORM","TOOL_CALL_START",T,{toolCallId:h.toolCallId,toolCallName:h.toolCallName})}if(h.delta!==void 0){let T={type:D.TOOL_CALL_ARGS,toolCallId:o.toolCallId,delta:h.delta};S.push(T),r?.event("TRANSFORM","TOOL_CALL_ARGS",T,{toolCallId:o.toolCallId})}return S;case D.REASONING_MESSAGE_CHUNK:let w=v,I=[];if((s!=="reasoning"||w.messageId&&w.messageId!==i?.messageId)&&I.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 T={type:D.REASONING_MESSAGE_START,messageId:w.messageId};I.push(T),r?.event("TRANSFORM","REASONING_MESSAGE_START",T,{messageId:w.messageId})}if(w.delta!==void 0){let T={type:D.REASONING_MESSAGE_CONTENT,messageId:i.messageId,delta:w.delta};I.push(T),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",T,{messageId:i.messageId})}return I}return v.type,[]}),En(()=>{g()}))};function jk(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var iu=class{runNext(e,t){return t.run(e).pipe(ou(!1))}runNextWithState(e,t){let r=we(e.messages||[]),n=we(e.state||{}),o=new ic;return wS(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(bc(/*#__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)}}()))}},qk=class extends iu{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function Uk(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 Vk=class extends iu{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(Uk)};return this.runNext(o,t)}},yS="THINKING_START",vS="THINKING_END",SS="THINKING_TEXT_MESSAGE_START",AS="THINKING_TEXT_MESSAGE_CONTENT",bS="THINKING_TEXT_MESSAGE_END",Gk=class extends iu{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 yS:{this.currentReasoningId=$i();let{title:t,...r}=e;return this.warnAboutTransformation(yS,D.REASONING_START),{...r,type:D.REASONING_START,messageId:this.currentReasoningId}}case SS:return this.currentMessageId=$i(),this.warnAboutTransformation(SS,D.REASONING_MESSAGE_START),{...e,type:D.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case AS:{let{delta:t,...r}=e;return this.warnAboutTransformation(AS,D.REASONING_MESSAGE_CONTENT),{...r,type:D.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??$i(),delta:t}}case bS:{let t=this.currentMessageId??$i();return this.warnAboutTransformation(bS,D.REASONING_MESSAGE_END),{...e,type:D.REASONING_MESSAGE_END,messageId:t}}case vS:{let t=this.currentReasoningId??$i();return this.warnAboutTransformation(vS,D.REASONING_END),{...e,type:D.REASONING_END,messageId:t}}default:return e}}};function Bk(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 Qk(e){let t=Bk(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 Hk(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>$k(n)?Qk(n):n);return{...e,content:r}}var zk=class extends iu{run(e,t){let r={...e,messages:e.messages.map(Hk)};return this.runNext(r,t)}},Wk="0.0.57",Kk=class{get maxVersion(){return Wk}get debug(){return this._debug}set debug(e){this._debug=nu(e),this._debugLogger=bp(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?bp(nu(!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=nu(i),this._debugLogger=bp(this._debug),Bi(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new Vk),Bi(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new Gk),Bi(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new zk)}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 qk(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 Sc(oc(()=>_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),ou(_this1.debugLogger),wp(_this1.debugLogger),c=>c.pipe(wc(_this1.activeRunDetach$)),c=>_this1.apply(r,c,i),c=>_this1.processApplyEvents(r,c,i),qi(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 Bd}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 Sc(oc(()=>Ac(()=>_this10.connect(r)),ou(_this10.debugLogger),wp(_this10.debugLogger),c=>c.pipe(wc(_this10.activeRunDetach$)),c=>_this10.apply(r,c,i),c=>_this10.processApplyEvents(r,c,i),qi(c=>(_this10.isRunning=!1,c instanceof Bd?sc:_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 wS(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(ip(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(jk(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(ou(this.debugLogger),wp(this.debugLogger),Mk(this.threadId,t.runId,this.agentId),r=>r.pipe(xn(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}},CS=class extends Kk{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 Ck(Ak(()=>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 xS=(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 Ep=class extends CS{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}}},ES=(e,t,r)=>new Ep({url:`${xS(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var Yk=new re({required:!0}),IS=new re({required:!0,constrainTo:Ta}),RS=e=>({...e,name:_a(e.name)}),TS=G("followUpAnswers/setIsEnabled",e=>W(e,new je({required:!0}))),_S=G("followUpAnswers/setFollowUpAnswersConversationId",e=>W(e,ee)),kS=G("followUpAnswers/setFollowUpAnswersConversationToken",e=>W(e,ee)),OS=G("followUpAnswers/clearFollowUpAnswersConversationToken"),lee=G("followUpAnswers/createFollowUpAnswer",e=>W(e,{question:ee})),dee=G("followUpAnswers/setActiveFollowUpAnswerId",e=>W(e,ee)),pee=G("followUpAnswers/setFollowUpAnswerContentFormat",e=>W(e,{contentFormat:Oa,answerId:ee})),fee=G("followUpAnswers/setFollowUpIsLoading",e=>W(e,{isLoading:new je({required:!0}),answerId:ee})),mee=G("followUpAnswers/setFollowUpIsStreaming",e=>W(e,{isStreaming:new je({required:!0}),answerId:ee})),gee=G("followUpAnswers/followUpMessageChunkReceived",e=>W(e,{textDelta:Yk,answerId:ee})),hee=G("followUpAnswers/followUpCitationsReceived",e=>W(e,{citations:new Ft({required:!0,each:new xe({values:_d})}),answerId:ee})),yee=G("followUpAnswers/followUpCompleted",e=>W(e,{answerId:ee,cannotAnswer:new je({required:!1})})),vee=G("followUpAnswers/followUpFailed",e=>W(e,{message:new re,code:new Le({min:0}),answerId:ee})),See=G("followUpAnswers/activeFollowUpStartFailed",e=>W(e,{message:new re})),Aee=G("followUpAnswers/likeFollowUp",e=>W(e,{answerId:ee})),bee=G("followUpAnswers/dislikeFollowUp",e=>W(e,{answerId:ee})),wee=G("followUpAnswers/submitFollowUpFeedback",e=>W(e,{answerId:ee})),PS=G("followUpAnswers/resetFollowUpAnswers"),Cee=G("followUpAnswers/stepStarted",e=>W(RS(e),{answerId:ee,name:IS,startedAt:new Le({min:0,required:!0})})),xee=G("followUpAnswers/stepFinished",e=>W(RS(e),{answerId:ee,name:IS,finishedAt:new Le({min:0,required:!0})})),Eee=G("followUpAnswers/startToolCall",e=>W(e,{answerId:ee,toolCallName:ee,startedAt:new Le({min:0,required:!0}),toolCallId:ee})),Iee=G("followUpAnswers/finishToolCall",e=>W(e,{answerId:ee,finishedAt:new Le({min:0,required:!0}),toolCallId:ee})),Ree=G("followUpAnswers/toolCallArgs",e=>W(e,{answerId:ee,toolCallId:ee,args:new xe({options:{required:!0}}),type:new re({required:!0,constrainTo:ka})}));m();d();f();p();var Xk={"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 NS(e){return e?Xk[e]??1004:1004}var FS=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Pa(n.runId)),e(Er(!1)),e(xi(!0)),e(_S(n.threadId)),e(OS())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(iy({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(sy({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(ay({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(cy({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(Fa({toolCallId:i,args:a,type:"search"})):e(Fa({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(Fa({toolCallId:i,args:{raw:s},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(Ei({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(Ti(s.contentFormat)),typeof s?.followUpEnabled=="boolean"&&e(TS(s.followUpEnabled)),s?.conversationToken&&e(kS(s.conversationToken));return}case"citations":{e(Ii({citations:s.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=NS(n.code);e(Ri({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(kd(i)),e(_i(!i)),e(xi(!1)),e(ld(i,t,s)),e(oo())}}};var DS=()=>{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=ha(n),a=oh(n),c=ih(n),u=nh(n),g=sh(n),v=ES(s,a,c);e=v;let E=FS(o),y=Zh(n,i());try{o(Er(!0)),yield v.runAgent({forwardedProps:{params:y,accessToken:u,recordDebugSession:g}},E)}catch(h){o(Er(!1)),o(Ri({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",h)}});return function run(_x89,_x90,_x91){return _ref47.apply(this,arguments)}}(),abortRun:t}};m();d();f();p();m();d();f();p();var MS=G("breadcrumb/deselectAll"),LS=G("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var jS=G("facet/updateFacetAutoSelection",e=>W(e,{allow:new je({required:!0})}));m();d();f();p();m();d();f();p();var su=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 qS=()=>Re("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new su(e)),US=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var Ip={id:ee},Zk={...Ip,q:Dt},Mte=G("instantResults/register",e=>W(e,Ip)),au=G("instantResults/updateQuery",e=>W(e,Zk)),Lte=G("instantResults/clearExpired",e=>W(e,Ip));m();d();f();p();var cu=new Le({required:!0,min:0}),Hte=G("pagination/registerNumberOfResults",e=>W(e,cu)),zte=G("pagination/updateNumberOfResults",e=>W(e,cu)),Wte=G("pagination/registerPage",e=>W(e,cu)),VS=G("pagination/updatePage",e=>W(e,cu)),Kte=G("pagination/nextPage"),Yte=G("pagination/previousPage");m();d();f();p();var Io=G("query/updateQuery",e=>W(e,{q:new re,enableQuerySyntax:new je}));m();d();f();p();m();d();f();p();m();d();f();p();var Ro=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var Rp=()=>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||Ro().aq,cq:r.advancedSearchQueries?.cq||Ro().cq,dq:r.advancedSearchQueries?.dq||Ro().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();m();d();f();p();var uu=e=>e.success!==void 0,ft=e=>e.error!==void 0;m();d();f();p();var zre=G("didYouMean/enable"),Wre=G("didYouMean/disable"),Kre=G("didYouMean/automaticCorrections/disable"),Yre=G("didYouMean/automaticCorrections/enable"),lu=G("didYouMean/correction",e=>W(e,ee)),Xre=G("didYouMean/automaticCorrections/mode",e=>W(e,new re({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var Tp=()=>Re("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var GS=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function BS(){return{contextValues:{}}}m();d();f();p();function $S(){return{contextValues:{}}}m();d();f();p();function QS(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function HS(){return[]}m();d();f();p();function zS(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function WS(){return{}}m();d();f();p();function KS(){return{}}m();d();f();p();function YS(){return{}}function Zt(e){return{context:e.context||BS(),dictionaryFieldContext:e.dictionaryFieldContext||$S(),facetSet:e.facetSet||ga(),numericFacetSet:e.numericFacetSet||ma(),dateFacetSet:e.dateFacetSet||fa(),categoryFacetSet:e.categoryFacetSet||pa(),automaticFacetSet:e.automaticFacetSet??da(),pagination:e.pagination||zS(),query:e.query||Mt(),tabSet:e.tabSet||YS(),advancedSearchQueries:e.advancedSearchQueries||Ro(),staticFilterSet:e.staticFilterSet||KS(),querySet:e.querySet||WS(),sortCriteria:e.sortCriteria||ya(),pipeline:e.pipeline||no(),searchHub:e.searchHub||Hn(),facetOptions:e.facetOptions||QS(),facetOrder:e.facetOrder??HS(),debug:e.debug??Ms()}}m();d();f();p();var Coe=new xe({values:{undoneQuery:Dt},options:{required:!0}}),XS=()=>Re("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var du=G("trigger/query/ignore",e=>W(e,new re({emptyAllowed:!0,required:!0}))),pu=G("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=tO(e),n=Ea(e),o=Jk(e),i=yield io(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 Jk(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(eO).filter(r=>r.currentValues.length>0):void 0}function eO(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function tO(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=rO(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function rO(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(Io({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=xa(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 E=u?yield _this20.processLegacyDidYouMeanAutoCorrection(t):_this20.processModernDidYouMeanAutoCorrection(t);return _this20.dispatch(Bt(Zt(_this20.getState()))),E})()}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(Bt(Zt(_this21.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Tp()})})()}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:Tp()}}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(du("")),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(Bt(Zt(_this22.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:XS()})})()}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(Bt(Zt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return uu(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(lu(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.dispatch(pu({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 Cie=Ce("search/executeSearch",/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t){let r=t.getState();return yield fu(r,t,e)});return function(_x96,_x97){return _ref49.apply(this,arguments)}}()),xie=Ce("search/fetchPage",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();return yield kp(r,t,e)});return function(_x98,_x99){return _ref50.apply(this,arguments)}}()),Eie=Ce("search/fetchMoreResults",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Op(t,r)});return function(_x100,_x101){return _ref51.apply(this,arguments)}}()),Iie=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)}}()),Rie=Ce("search/fetchInstantResults",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){return _p(e,t)});return function(_x104,_x105){return _ref53.apply(this,arguments)}}()),nO=/*#__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 nO(_x106,_x107){return _ref54.apply(this,arguments)}}(),oO=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield io(e);return wr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function oO(_x108,_x109,_x110){return _ref55.apply(this,arguments)}}(),iO=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){let r=yield Nr(e,t);return r.request.numberOfResults=0,r});return function iO(_x111,_x112){return _ref56.apply(this,arguments)}}(),ZS=e=>{e.configuration.analytics.enabled&&yt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function _p(_x113,_x114){return _p2.apply(this,arguments)}function _p2(){_p2=_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:qS()},u=>{t.dispatch(au({q:u,id:e.id}))}),s=yield oO(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 _p2.apply(this,arguments)}function kp(_x115,_x116,_x117){return _kp.apply(this,arguments)}function _kp(){_kp=_asyncToGenerator(function*(e,t,r){ZS(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 _kp.apply(this,arguments)}function Op(_x118,_x119){return _Op.apply(this,arguments)}function _Op(){_Op=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield Rp().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),s=new Fr({...e,analyticsAction:Rp()}),a=yield nO(t,i),c=yield s.fetchFromAPI(a,{origin:"mainSearch"});return yield s.process(c)});return _Op.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 iO(r,s),u=yield a.fetchFromAPI(c,{origin:"facetValues"});return yield a.process(u)});return _sO.apply(this,arguments)}function fu(_x123,_x124,_x125){return _fu.apply(this,arguments)}function _fu(){_fu=_asyncToGenerator(function*(e,t,r){ZS(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 _fu.apply(this,arguments)}m();d();f();p();var Dr=class{constructor(t,r=n=>{this.dispatch(Io({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=xa(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 E=u?yield _this27.processLegacyDidYouMeanAutoCorrection(t):_this27.processModernDidYouMeanAutoCorrection(t);return _this27.dispatch(Bt(Zt(_this27.getState()))),E})()}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(Bt(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(du("")),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(Bt(Zt(_this29.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Bt(Zt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return uu(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this30=this;return _asyncToGenerator(function*(){_this30.onUpdateQueryForCorrection(t);let r=_this30.getState(),{actionCause:n}=GS(),o=yield _this30.fetchFromAPI(yield xr(r,_this30.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this30.dispatch(lu(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.dispatch(pu({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 fse=Ce("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;W(e,{q:new re,enableQuerySyntax:new je,clearFilters:new je}),e.clearFilters&&(r(MS()),r(LS())),r(jS({allow:!0})),r(Io({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(VS(1))}),mse=G("search/updateSearchAction"),mu=Ce("search/executeSearch",/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return fu(r,t,e.legacy);tA(r);let n=e.next?rA(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)}}()),JS=Ce("search/fetchPage",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t){let r=t.getState();if(tA(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return kp(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)}}()),eA=Ce("search/fetchMoreResults",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Op(t,r);let n=Sh("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)}}()),gse=Ce("search/fetchFacetValues",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return fu(r,t,e.legacy);let n=new Dr({...t,analyticsAction:{}}),o=yield uO(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)}}()),hse=Ce("search/fetchInstantResults",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return _p(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=rA(US()),s=yield cO(r,t.extra.navigatorContext,n,o,i),a=new Dr({...t,analyticsAction:i},g=>{t.dispatch(au({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)}}(),cO=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t,r,n,o){let i=Ia(e,t,o);return wr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function cO(_x141,_x142,_x143,_x144,_x145){return _ref63.apply(this,arguments)}}(),uO=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t,r){let n=yield xr(e,t,r);return n.request.numberOfResults=0,n});return function uO(_x146,_x147,_x148){return _ref64.apply(this,arguments)}}(),tA=e=>{e.configuration.analytics.enabled&&yt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},rA=e=>({actionCause:e.actionCause,type:e.actionCause});var nA=e=>{let t=Cm({extra:e}),r=DS();return t.startListening({actionCreator:mu.pending,effect:function(){var _ref65=_asyncToGenerator(function*(n,o){let i=o.getState();if(!td(i)||(r.abortRun(),o.dispatch(Na()),o.dispatch(PS()),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 oA=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)},iA=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var Pp=(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 sA(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=yf(Object.entries(t).filter(([s])=>!(s in r)).map(([s,a])=>[s,()=>a]));return o(jn({...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 To=G("app/setError");m();d();f();p();function lO(e){if(!e||!dO(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 aA(e,t=60){if(!e)return!1;let r=lO(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function dO(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function uA(e,t){let r=0,n=null,o=ts(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(c,u=!1){let g=!n;g&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(E){if(!u)throw E;return null}})().finally(()=>{n=null}));let v=yield n;return g&&v&&c.dispatch(Qn({accessToken:v})),v});return function i(_x151){return _ref66.apply(this,arguments)}}(),s=/*#__PURE__*/function(){var _ref68=_asyncToGenerator(function*(c){let u=c.getState(),g=fO(u);if(!(!g||!aA(g))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(c))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(v){e.warn(v,"Access token renewal failed. A retry will occur if necessary.")}}});return function s(_x152){return _ref68.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(c,u,g){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),cA(c,u.error),u;!n&&(r++,o());try{yield i(c,!0)}catch(E){e.debug(E,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}c.dispatch(g)});return function a(_x153,_x154,_x155){return _ref69.apply(this,arguments)}}();return c=>u=>(/*#__PURE__*/function(){var _ref70=_asyncToGenerator(function*(g){let v=typeof g=="function",E=typeof t=="function";if(!v)return u(g);E&&(yield s(c));let y=yield u(g);return pO(y)?E?yield a(c,y,g):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),cA(c,y.error),y):y});return function(_x156){return _ref70.apply(this,arguments)}}())}function pO(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Nn().name}function cA(e,t){e.dispatch(To({status:401,statusCode:401,message:t.message,type:t.name}))}function fO(e){return e.configuration.accessToken}m();d();f();p();function lA({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return um({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(iA(n.logger))})}function mO(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&&Bu()&&!c?(t.info("Analytics disabled since doNotTrack is active."),{...s,enabled:!1}):(a&&Bu()&&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 dA(e,t){let r={...e.reducers,configuration:St,version:vy},n=gO({...e,reducers:r},t,St),{accessToken:o,environment:i,organizationId:s}=e.configuration;n.dispatch(Qn({accessToken:o,environment:i,organizationId:s}));let a=mO(e.configuration,n.logger);return a&&n.dispatch(qs(a)),n}function gO(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=sA({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let s=t.logger,a={...t,get relay(){return si(u.state,o)},get navigatorContext(){return Pp(this.relay,o)}},c=hO(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(Vs())},disableAnalytics(){c.dispatch(Us())},get state(){return c.getState()},get relay(){return si(this.state,o)},get navigatorContext(){return Pp(this.relay,o)},logger:s,store:c};return u}function hO(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",s=yO(e,t.logger,()=>t.navigatorContext);return lA({preloadedState:n,reducer:r.combinedReducer,middlewares:s,thunkExtraArguments:t,name:i})}function yO(e,t,r){let{renewAccessToken:n}=e.configuration,o=uA(t,n),i=nA({getNavigatorContext:r});return[ky,o,oA(t),Ay].concat(Pd.middleware,i.middleware,e.middlewares||[])}var vO=`[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 uA(e){e==="next"&&console.warn(pO)}m();d();f();p();var SA=Pt(vA(),1);function AA(e){return(0,SA.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function bA(e,t){let r=kO(e),n=hl,o=OO(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function kO(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function OO(e){return e.preprocessRequest||rs}m();d();f();p();m();d();f();p();var wA={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 CA=new Nt({...wA,caseAssistId:ee,locale:He});var PO={debug:Om,caseAssistConfiguration:vr,searchHub:Lm};function xA(e){let t=AA(e.loggerOptions);NO(e.configuration,t);let r=FO(e.configuration,t),n={...bA(e.configuration,t),apiClient:r},o={...e,reducers:PO},i=cA(o,n);uA(i.state.configuration.analytics.analyticsMode);let{caseAssistId:s,locale:a,searchHub:c,proxyBaseUrl:u}=e.configuration;return i.dispatch(Ns({caseAssistId:s,locale:a,proxyBaseUrl:u})),ce(c)||i.dispatch(Ms(c)),{...i,get state(){return i.state}}}function NO(e,t){try{CA.validate(e)}catch(r){throw t.error(r,"Case Assist engine configuration error"),r}}function FO(e,t){return new as({logger:t,preprocessRequest:e.preprocessRequest||rs})}m();d();f();p();m();d();f();p();m();d();f();p();var EA=(i=>(i.id="id",i.subject="subject",i.description="description",i.category="category",i.productId="productId",i))(EA||{}),IA=e=>!Object.values(EA).includes(e),mt=e=>{let t=r=>DO(e,r)??LO(e,r);return{id:t("id"),subject:t("subject"),description:t("description"),category:t("category"),productId:t("productId"),custom:{...MO(e),...jO(e)}}},DO=(e,t)=>e?.caseInput?.[t]?.value,MO=e=>Object.keys(e?.caseInput??[]).reduce((t,r)=>{if(IA(r)){let n=e?.caseInput?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),LO=(e,t)=>e?.caseField?.fields[t]?.value,jO=e=>Object.keys(e?.caseField?.fields??[]).reduce((t,r)=>{if(IA(r)){let n=e?.caseField?.fields?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),Lp=(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 RA=()=>vt({prefix:"analytics/caseAssist/case/start",__legacy__getBuilder:(e,t)=>e.logEnterInterface({ticket:mt(t)}),analyticsType:"CaseAssist.Start",analyticsPayloadBuilder:()=>({})}),TA=e=>vt("analytics/caseAssist/case/nextStage",(t,r)=>t.logMoveToNextCaseStep({ticket:mt(r),stage:e?.stageName})),_A=()=>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}}}}),kA=()=>vt({prefix:"analytics/caseAssist/case/solve",__legacy__getBuilder:(e,t)=>e.logCaseSolved({ticket:mt(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"solved"})}),OA=()=>vt({prefix:"analytics/caseAssist/case/abandon",__legacy__getBuilder:(e,t)=>e.logCaseCancelled({ticket:mt(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"quit"})}),ko=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}}}),PA=e=>vt({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:Lp(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}}}),yu=e=>vt({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:Lp(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}}}),NA=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}}}}),vu=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}}}}),FA=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}}}}),DA=(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 Oo=G("caseAssist/caseField/register",e=>W(e,{fieldName:ee,fieldValue:Dt})),Po=G("caseAssist/caseField/update",e=>W(e,{fieldName:ee,fieldValue:Dt})),Jt=Ce("caseAssist/classifications/fetch",/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=yield n.getCaseClassifications(yield qO(o));return ft(i)?r(i.error):{response:i.success}});return function(_x157,_x158){return _ref71.apply(this,arguments)}}()),qO=/*#__PURE__*/function(){var _ref72=_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 eo(e.configuration.analytics)}),fields:e.caseInput,context:e.caseField?ss(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function qO(_x159){return _ref72.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var MA=()=>({status:{loading:!1,error:null,lastResponseId:""},fields:{}});var Lr=Qe(MA(),e=>{e.addCase(Oo,(t,r)=>{let{fieldName:n,fieldValue:o}=r.payload;t.fields[n]={value:o,suggestions:[]}}).addCase(Po,(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(To,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();m();d();f();p();var Tn=G("caseAssist/caseInput/update",e=>W(e,{fieldName:ee,fieldValue:Dt}));m();d();f();p();var LA=()=>({});var jr=Qe(LA(),e=>{e.addCase(Tn,(t,r)=>{t[r.payload.fieldName]={value:r.payload.fieldValue}})});m();d();f();p();var _t=Ce("caseAssist/documentSuggestions/fetch",/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),s=yield n.getDocumentSuggestions(yield UO(i,o));return ft(s)?r(s.error):{response:s.success}});return function(_x160,_x161){return _ref73.apply(this,arguments)}}()),UO=/*#__PURE__*/function(){var _ref74=_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 eo(e.configuration.analytics)}),...(e.configuration.analytics.enabled&&rn(e.configuration.analytics,t,{actionCause:"documentSuggestion"})),fields:e.caseInput,context:e.caseField?ss(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function UO(_x162,_x163){return _ref74.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var jA=()=>({status:{loading:!1,error:null,lastResponseId:""},documents:[]});var er=Qe(jA(),e=>{e.addCase(_t.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase(_t.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(_t.pending,t=>{t.status.loading=!0}).addCase(To,(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 VO=new Nt({field:ee});function qA(e,t={}){if(!GO(e))throw wt;let r=tr(e),{dispatch:n}=e,o=Ps(e,VO,t.options,"buildCaseField"),i=()=>e.state;return i().caseField?.fields?.[o.field]||n(Oo({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?PA(g):yu(g)),n(Po({fieldName:o.field,fieldValue:a})),!u&&n(ko(o.field)),c?.caseClassifications&&n(Jt()),c?.documentSuggestions&&n(_t())}}}function GO(e){return e.addReducers({configuration:St,caseAssistConfiguration:vr,caseInput:jr,caseField:Lr,documentSuggestion:er}),!0}m();d();f();p();function BO(e,t){let r=new Nt({field:ee});Ps(e,r,t,"buildCaseInput")}function UA(e,t){if(!$O(e))throw wt;let r=tr(e),{dispatch:n}=e,o=()=>e.state;BO(e,t.options);let i=t.options.field;return o().caseInput?.[i]||n(Tn({fieldName:i,fieldValue:""})),{...r,update(a,c){n(Tn({fieldName:i,fieldValue:a})),n(ko(i)),c?.caseClassifications&&n(Jt()),c?.documentSuggestions&&n(_t())},get state(){return o().caseInput[i]}}}function $O(e){return e.addReducers({configuration:St,caseAssistConfiguration:vr,caseInput:jr,caseField:Lr,documentSuggestion:er}),!0}m();d();f();p();m();d();f();p();function VA(e,t,r){if(!QO(e))throw wt;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:es(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function QO(e){return e.addReducers({configuration:St}),!0}function GA(e,t){let r=!1;return VA(e,t,()=>{r||(r=!0,e.dispatch(FA(t.options.result.uniqueId)))})}m();d();f();p();function jp(e){if(!HO(e))throw wt;let t=tr(e),{dispatch:r}=e,n=()=>e.state;return{...t,fetch(){r(_t())},get state(){let o=n().documentSuggestion;return{loading:o.status.loading,error:o.status.error,documents:o.documents}}}}function HO(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 Su(_x164,_x165){return _Su.apply(this,arguments)}function _Su(){_Su=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:o}=e.configuration,i=e.query?.q||"";return{url:r.apiBaseUrl??Dn(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 _Su.apply(this,arguments)}var Hi=Ce("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),i=yield Su(o,e),s=yield t.apiClient.html(i);return ft(s)?n(s.error):{content:s.success,uniqueId:e.uniqueId}});return function(_x166,_x167){return _ref75.apply(this,arguments)}}()),Au=G("resultPreview/next"),bu=G("resultPreview/previous"),wu=G("resultPreview/prepare",e=>W(e,{results:new Ft({required:!0})})),BA=2048,Cu=Ce("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=Rf(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>BA&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${BA} characters.`),{contentURL:o}});return function(_x168,_x169){return _ref76.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 Up=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=qp();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},Vp=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),$A=Qe(qp(),e=>{e.addCase(Hi.pending,t=>{t.isLoading=!0}).addCase(Hi.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(mu.fulfilled,(t,r)=>{Up(t),t.resultsWithPreview=Vp(r.payload.response.results)}).addCase(XS.fulfilled,(t,r)=>{Up(t),t.resultsWithPreview=t.resultsWithPreview.concat(Vp(r.payload.response.results))}).addCase(YS.fulfilled,Up).addCase(wu,(t,r)=>{t.resultsWithPreview=Vp(r.payload.results)}).addCase(Au,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(bu,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(Cu.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});function QA(e,t,r,n,o){if(!zO(e))throw wt;let{dispatch:i}=e,s=()=>e.state,a=tr(e),{result:c,maximumPreviewSize:u}=t.options,g=()=>{let{resultsWithPreview:E,position:y}=s().resultPreview;return E[y]},v=E=>{i(Cu({uniqueId:E,requestedOutputSize:u,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||i(Hi({uniqueId:E,requestedOutputSize:u})),o&&o()};return{...a,fetchResultContent(){v(c.uniqueId)},next(){i(Au()),v(g())},previous(){i(bu()),v(g())},get state(){let E=s(),y=c.hasHtmlVersion,h=E.resultPreview,S=c.uniqueId===h.uniqueId?h.content:"",w=h.isLoading,I=h.contentURL,T=g();return{content:S,resultHasPreview:y,isLoading:w,contentURL:I,currentResultUniqueId:T}}}}function zO(e){return e.addReducers({configuration:St,resultPreview:$A}),!0}function HA(e,t){if(!WO(e))throw wt;let{dispatch:r}=e,n=()=>e.state,o=()=>n().documentSuggestion.documents,a=QA(e,t,Su,"/html",()=>{e.dispatch(vu(t.options.result.uniqueId))});return r(wu({results:o()})),{...a,get state(){return{...a.state,currentDocument:o().findIndex(c=>c.uniqueId===a.state.currentResultUniqueId)+1,totalDocuments:o().length}}}}function WO(e){return e.addReducers({documentSuggestion:er}),!0}m();d();f();p();m();d();f();p();var Gp=e=>W(e,{evt:ee,type:He}),zA=e=>Re("analytics/generic/search",t=>{Gp(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),WA=e=>Re("analytics/generic/click",(t,r)=>(ud(e.result),Gp(e),t.makeClickEvent(e.evt,ad(e.result,r),cd(e.result),e.meta))),KA=e=>Re("analytics/generic/custom",t=>(Gp(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));function KO(e){return e.addReducers({}),{logSearchEvent:zA,logClickEvent:WA,logCustomEvent:KA}}m();d();f();p();function YO(e){return e.addReducers({}),{logCaseStart:RA,logCaseNextStage:TA,logCreateCase:_A,logSolveCase:kA,logAbandonCase:OA,logUpdateCaseField:ko,logClassificationClick:yu,logDocumentSuggestionClick:NA,logDocumentSuggestionRating:DA,logQuickviewDocumentSuggestionClick:vu}}m();d();f();p();function XO(e){return e.addReducers({caseField:Lr}),{registerCaseField:Oo,updateCaseField:Po,fetchCaseClassifications:Jt}}m();d();f();p();function ZO(e){return e.addReducers({caseInput:jr}),{updateCaseInput:Tn}}m();d();f();p();function JO(e){return e.addReducers({documentSuggestion:er}),{fetchDocumentSuggestions:_t}}/**
45
+ For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function pA(e){e==="next"&&console.warn(vO)}m();d();f();p();var wA=Pt(bA(),1);function CA(e){return(0,wA.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function xA(e,t){let r=MO(e),n=hl,o=LO(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function MO(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function LO(e){return e.preprocessRequest||ns}m();d();f();p();m();d();f();p();var EA={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 IA=new Nt({...EA,caseAssistId:ee,locale:He});var jO={debug:Pm,caseAssistConfiguration:vr,searchHub:jm};function RA(e){let t=CA(e.loggerOptions);qO(e.configuration,t);let r=UO(e.configuration,t),n={...xA(e.configuration,t),apiClient:r},o={...e,reducers:jO},i=dA(o,n);pA(i.state.configuration.analytics.analyticsMode);let{caseAssistId:s,locale:a,searchHub:c,proxyBaseUrl:u}=e.configuration;return i.dispatch(Fs({caseAssistId:s,locale:a,proxyBaseUrl:u})),ce(c)||i.dispatch(Ls(c)),{...i,get state(){return i.state}}}function qO(e,t){try{IA.validate(e)}catch(r){throw t.error(r,"Case Assist engine configuration error"),r}}function UO(e,t){return new cs({logger:t,preprocessRequest:e.preprocessRequest||ns})}m();d();f();p();m();d();f();p();m();d();f();p();var TA=(i=>(i.id="id",i.subject="subject",i.description="description",i.category="category",i.productId="productId",i))(TA||{}),_A=e=>!Object.values(TA).includes(e),mt=e=>{let t=r=>VO(e,r)??BO(e,r);return{id:t("id"),subject:t("subject"),description:t("description"),category:t("category"),productId:t("productId"),custom:{...GO(e),...$O(e)}}},VO=(e,t)=>e?.caseInput?.[t]?.value,GO=e=>Object.keys(e?.caseInput??[]).reduce((t,r)=>{if(_A(r)){let n=e?.caseInput?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),BO=(e,t)=>e?.caseField?.fields[t]?.value,$O=e=>Object.keys(e?.caseField?.fields??[]).reduce((t,r)=>{if(_A(r)){let n=e?.caseField?.fields?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),jp=(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 kA=()=>vt({prefix:"analytics/caseAssist/case/start",__legacy__getBuilder:(e,t)=>e.logEnterInterface({ticket:mt(t)}),analyticsType:"CaseAssist.Start",analyticsPayloadBuilder:()=>({})}),OA=e=>vt("analytics/caseAssist/case/nextStage",(t,r)=>t.logMoveToNextCaseStep({ticket:mt(r),stage:e?.stageName})),PA=()=>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}}}}),NA=()=>vt({prefix:"analytics/caseAssist/case/solve",__legacy__getBuilder:(e,t)=>e.logCaseSolved({ticket:mt(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"solved"})}),FA=()=>vt({prefix:"analytics/caseAssist/case/abandon",__legacy__getBuilder:(e,t)=>e.logCaseCancelled({ticket:mt(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"quit"})}),ko=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}}}),DA=e=>vt({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:jp(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}}}),yu=e=>vt({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:jp(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}}}),MA=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}}}}),vu=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}}}}),LA=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}}}}),jA=(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 Oo=G("caseAssist/caseField/register",e=>W(e,{fieldName:ee,fieldValue:Dt})),Po=G("caseAssist/caseField/update",e=>W(e,{fieldName:ee,fieldValue:Dt})),Jt=Ce("caseAssist/classifications/fetch",/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=yield n.getCaseClassifications(yield QO(o));return ft(i)?r(i.error):{response:i.success}});return function(_x157,_x158){return _ref71.apply(this,arguments)}}()),QO=/*#__PURE__*/function(){var _ref72=_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 eo(e.configuration.analytics)}),fields:e.caseInput,context:e.caseField?as(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function QO(_x159){return _ref72.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var qA=()=>({status:{loading:!1,error:null,lastResponseId:""},fields:{}});var Lr=Qe(qA(),e=>{e.addCase(Oo,(t,r)=>{let{fieldName:n,fieldValue:o}=r.payload;t.fields[n]={value:o,suggestions:[]}}).addCase(Po,(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(To,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();m();d();f();p();var Tn=G("caseAssist/caseInput/update",e=>W(e,{fieldName:ee,fieldValue:Dt}));m();d();f();p();var UA=()=>({});var jr=Qe(UA(),e=>{e.addCase(Tn,(t,r)=>{t[r.payload.fieldName]={value:r.payload.fieldValue}})});m();d();f();p();var _t=Ce("caseAssist/documentSuggestions/fetch",/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),s=yield n.getDocumentSuggestions(yield HO(i,o));return ft(s)?r(s.error):{response:s.success}});return function(_x160,_x161){return _ref73.apply(this,arguments)}}()),HO=/*#__PURE__*/function(){var _ref74=_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 eo(e.configuration.analytics)}),...(e.configuration.analytics.enabled&&rn(e.configuration.analytics,t,{actionCause:"documentSuggestion"})),fields:e.caseInput,context:e.caseField?as(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function HO(_x162,_x163){return _ref74.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var VA=()=>({status:{loading:!1,error:null,lastResponseId:""},documents:[]});var er=Qe(VA(),e=>{e.addCase(_t.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase(_t.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(_t.pending,t=>{t.status.loading=!0}).addCase(To,(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 zO=new Nt({field:ee});function GA(e,t={}){if(!WO(e))throw wt;let r=tr(e),{dispatch:n}=e,o=Ns(e,zO,t.options,"buildCaseField"),i=()=>e.state;return i().caseField?.fields?.[o.field]||n(Oo({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?DA(g):yu(g)),n(Po({fieldName:o.field,fieldValue:a})),!u&&n(ko(o.field)),c?.caseClassifications&&n(Jt()),c?.documentSuggestions&&n(_t())}}}function WO(e){return e.addReducers({configuration:St,caseAssistConfiguration:vr,caseInput:jr,caseField:Lr,documentSuggestion:er}),!0}m();d();f();p();function KO(e,t){let r=new Nt({field:ee});Ns(e,r,t,"buildCaseInput")}function BA(e,t){if(!YO(e))throw wt;let r=tr(e),{dispatch:n}=e,o=()=>e.state;KO(e,t.options);let i=t.options.field;return o().caseInput?.[i]||n(Tn({fieldName:i,fieldValue:""})),{...r,update(a,c){n(Tn({fieldName:i,fieldValue:a})),n(ko(i)),c?.caseClassifications&&n(Jt()),c?.documentSuggestions&&n(_t())},get state(){return o().caseInput[i]}}}function YO(e){return e.addReducers({configuration:St,caseAssistConfiguration:vr,caseInput:jr,caseField:Lr,documentSuggestion:er}),!0}m();d();f();p();m();d();f();p();function $A(e,t,r){if(!XO(e))throw wt;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:ts(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function XO(e){return e.addReducers({configuration:St}),!0}function QA(e,t){let r=!1;return $A(e,t,()=>{r||(r=!0,e.dispatch(LA(t.options.result.uniqueId)))})}m();d();f();p();function qp(e){if(!ZO(e))throw wt;let t=tr(e),{dispatch:r}=e,n=()=>e.state;return{...t,fetch(){r(_t())},get state(){let o=n().documentSuggestion;return{loading:o.status.loading,error:o.status.error,documents:o.documents}}}}function ZO(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 Su(_x164,_x165){return _Su.apply(this,arguments)}function _Su(){_Su=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:o}=e.configuration,i=e.query?.q||"";return{url:r.apiBaseUrl??Dn(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 _Su.apply(this,arguments)}var zi=Ce("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),i=yield Su(o,e),s=yield t.apiClient.html(i);return ft(s)?n(s.error):{content:s.success,uniqueId:e.uniqueId}});return function(_x166,_x167){return _ref75.apply(this,arguments)}}()),Au=G("resultPreview/next"),bu=G("resultPreview/previous"),wu=G("resultPreview/prepare",e=>W(e,{results:new Ft({required:!0})})),HA=2048,Cu=Ce("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=Tf(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>HA&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${HA} characters.`),{contentURL:o}});return function(_x168,_x169){return _ref76.apply(this,arguments)}}());m();d();f();p();m();d();f();p();m();d();f();p();function Up(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var Vp=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=Up();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},Gp=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),zA=Qe(Up(),e=>{e.addCase(zi.pending,t=>{t.isLoading=!0}).addCase(zi.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(mu.fulfilled,(t,r)=>{Vp(t),t.resultsWithPreview=Gp(r.payload.response.results)}).addCase(eA.fulfilled,(t,r)=>{Vp(t),t.resultsWithPreview=t.resultsWithPreview.concat(Gp(r.payload.response.results))}).addCase(JS.fulfilled,Vp).addCase(wu,(t,r)=>{t.resultsWithPreview=Gp(r.payload.results)}).addCase(Au,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(bu,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(Cu.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});function WA(e,t,r,n,o){if(!JO(e))throw wt;let{dispatch:i}=e,s=()=>e.state,a=tr(e),{result:c,maximumPreviewSize:u}=t.options,g=()=>{let{resultsWithPreview:E,position:y}=s().resultPreview;return E[y]},v=E=>{i(Cu({uniqueId:E,requestedOutputSize:u,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||i(zi({uniqueId:E,requestedOutputSize:u})),o&&o()};return{...a,fetchResultContent(){v(c.uniqueId)},next(){i(Au()),v(g())},previous(){i(bu()),v(g())},get state(){let E=s(),y=c.hasHtmlVersion,h=E.resultPreview,S=c.uniqueId===h.uniqueId?h.content:"",w=h.isLoading,I=h.contentURL,T=g();return{content:S,resultHasPreview:y,isLoading:w,contentURL:I,currentResultUniqueId:T}}}}function JO(e){return e.addReducers({configuration:St,resultPreview:zA}),!0}function KA(e,t){if(!eP(e))throw wt;let{dispatch:r}=e,n=()=>e.state,o=()=>n().documentSuggestion.documents,a=WA(e,t,Su,"/html",()=>{e.dispatch(vu(t.options.result.uniqueId))});return r(wu({results:o()})),{...a,get state(){return{...a.state,currentDocument:o().findIndex(c=>c.uniqueId===a.state.currentResultUniqueId)+1,totalDocuments:o().length}}}}function eP(e){return e.addReducers({documentSuggestion:er}),!0}m();d();f();p();m();d();f();p();var Bp=e=>W(e,{evt:ee,type:He}),YA=e=>Re("analytics/generic/search",t=>{Bp(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),XA=e=>Re("analytics/generic/click",(t,r)=>(ud(e.result),Bp(e),t.makeClickEvent(e.evt,ad(e.result,r),cd(e.result),e.meta))),ZA=e=>Re("analytics/generic/custom",t=>(Bp(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));function tP(e){return e.addReducers({}),{logSearchEvent:YA,logClickEvent:XA,logCustomEvent:ZA}}m();d();f();p();function rP(e){return e.addReducers({}),{logCaseStart:kA,logCaseNextStage:OA,logCreateCase:PA,logSolveCase:NA,logAbandonCase:FA,logUpdateCaseField:ko,logClassificationClick:yu,logDocumentSuggestionClick:MA,logDocumentSuggestionRating:jA,logQuickviewDocumentSuggestionClick:vu}}m();d();f();p();function nP(e){return e.addReducers({caseField:Lr}),{registerCaseField:Oo,updateCaseField:Po,fetchCaseClassifications:Jt}}m();d();f();p();function oP(e){return e.addReducers({caseInput:jr}),{updateCaseInput:Tn}}m();d();f();p();function iP(e){return e.addReducers({documentSuggestion:er}),{fetchDocumentSuggestions:_t}}/**
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.0';
78
+ window.coveoQuanticVersion = '3.44.1';