@coveo/quantic 3.36.7 → 3.36.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +14 -14
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/api-client-utils.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/common/request.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/common/result.d.ts +12 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/product-enrichment/product-enrichment-request.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/recommendations/recommendations-request.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/search/plan/plan-request.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/search/query-suggest/query-suggest-request.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/agents/answer-agent/head-answer-strategy.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-slice.d.ts +0 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/stream-answer-api.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/service/case-assist/get-case-classifications/get-case-classifications-request.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/service/case-assist/get-document-suggestions/get-document-suggestions-request.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/service/insight/get-interface/get-interface-config-request.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/service/insight/query/query-request.d.ts +4 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/service/insight/user-actions/user-actions-request.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/generated-answer/headless-core-interactive-citation.d.ts +5 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/follow-up-answers/follow-up-answers-actions.d.ts +0 -12
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-actions.d.ts +1 -19
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-request.d.ts +13 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-selectors.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/legacy/search-request.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-request.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/product-list/headless-product-list.ssr.d.ts +14 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce-next.index.d.ts +2 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce.index.d.ts +1 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/product-list/headless-product-list.ssr.d.ts +14 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/triggers/headless-query-trigger.ssr.d.ts +3 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/factories/recommendation-static-state-factory.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/factories/static-state-factory.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-controller.d.ts +2 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-product-listing-controller.d.ts +2 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-search-controller.d.ts +2 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/utils/facet-utils.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/headless.js +19 -19
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +18 -18
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +13 -13
- package/package.json +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/answer-generation-api-state.d.ts +0 -29
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/answer-generation-api.d.ts +0 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/endpoints/answer/answer-endpoint.d.ts +0 -30
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/endpoints/answer/url-builders/endpoint-url-builder.d.ts +0 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/endpoints/follow-up/follow-up-endpoint.d.ts +0 -24
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/endpoints/follow-up/url-builders/endpoint-url-builder.d.ts +0 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/streaming/answer-draft-reducer/answer-draft-reducer.d.ts +0 -26
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/streaming/answer-streaming-runner.d.ts +0 -26
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/streaming/server-state-event-handler/server-state-event-handler.d.ts +0 -21
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/streaming/strategies/streaming-strategy-creators.d.ts +0 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/streaming/types.d.ts +0 -41
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/follow-up-answers/follow-up-answer-request.d.ts +0 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/follow-up-answers/follow-up-answer-strategy.d.ts +0 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/head-answer-strategy.d.ts +0 -3
|
@@ -14,34 +14,34 @@ 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
|
|
18
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,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,o=c},f:function(){try{s||r.return==null||r.return()}finally{if(a)throw o}}}}function Fc(){return Fc=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=WS(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},Fc.apply(null,arguments)}function In(e){return In=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},In(e)}function HS(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&&Dc(e,t)}function tp(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tp=function(){return!!e})()}function zS(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 $S(e)}function Dc(e,t){return Dc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Dc(e,t)}function WS(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=In(e))!==null;);return e}function KS(e,t,r,n){var i=Fc(In(1&n?e.prototype:e),t,r);return 2&n&&typeof i=="function"?function(o){return i.apply(r,o)}:i}function YS(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 XS(e){var t=YS(e,"string");return typeof t=="symbol"?t:t+""}function JS(e,t){if(e){if(typeof e=="string")return Xd(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)?Xd(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function ZS(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 eA(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 ep=function(){function e(){Mc(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return jc(e,[{key:"addEventListener",value:function(r,n,i){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:i})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var i=this.listeners[r],o=0,s=i.length;o<s;o++)if(i[o].callback===n){i.splice(o,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var i=this.listeners[r.type],o=i.slice(),s=function(){var h=o[a];try{h.callback.call(n,r)}catch(v){Promise.resolve().then(function(){throw v})}h.options&&h.options.once&&n.removeEventListener(r.type,h.callback)},a=0,c=o.length;a<c;a++)s();return!r.defaultPrevented}}}])}(),qc=function(e){function t(){var r;return Mc(this,t),r=QS(this,t),r.listeners||ep.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 HS(t,e),jc(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)),KS(t,"dispatchEvent",this,3)([n])}},{key:"throwIfAborted",value:function(){var n=this.aborted,i=this.reason,o=i===void 0?"Aborted":i;if(n)throw o}}],[{key:"timeout",value:function(n){var i=new Fo;return setTimeout(function(){return i.abort(new DOMException("This signal is timeout in ".concat(n,"ms"),"TimeoutError"))},n),i.signal}},{key:"any",value:function(n){var i=new Fo;function o(){i.abort(this.reason),s()}function s(){var h=Zd(n),v;try{for(h.s();!(v=h.n()).done;){var S=v.value;S.removeEventListener("abort",o)}}catch(g){h.e(g)}finally{h.f()}}var a=Zd(n),c;try{for(a.s();!(c=a.n()).done;){var u=c.value;if(u.aborted){i.abort(u.reason);break}else u.addEventListener("abort",o)}}catch(h){a.e(h)}finally{a.f()}return i.signal}}])}(ep),Fo=function(){function e(){Mc(this,e),Object.defineProperty(this,"signal",{value:new qc,writable:!0,configurable:!0})}return jc(e,[{key:"abort",value:function(r){var n=eA(r),i=ZS(n);this.signal.reason=n,this.signal.dispatchEvent(i)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Fo.prototype[Symbol.toStringTag]="AbortController",qc.prototype[Symbol.toStringTag]="AbortSignal");function tA(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 rA(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,i=n===void 0?r.Request:n,o=t.AbortController,s=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,a=s===void 0?!1:s;if(!tA({fetch:r,Request:i,AbortController:o,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a}))return{fetch:r,Request:c};var c=i;(c&&!c.prototype.hasOwnProperty("signal")||a)&&(c=function(S,g){var y;g&&g.signal&&(y=g.signal,delete g.signal);var C=new i(S,g);return y&&Object.defineProperty(C,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),C},c.prototype=i.prototype);var u=r,h=function(S,g){var y=c&&c.prototype.isPrototypeOf(S)?S.signal:g?g.signal:void 0;if(y){var C;try{C=new DOMException("Aborted","AbortError")}catch{C=new Error("Aborted"),C.name="AbortError"}if(y.aborted)return Promise.reject(C);var E=new Promise(function(x,R){y.addEventListener("abort",function(){return R(C)},{once:!0})});return g&&g.signal&&delete g.signal,Promise.race([E,u(S,g)])}return u(S,g)};return{fetch:h,Request:c}}Di.AbortController=Fo;Di.AbortSignal=qc;Di.abortableFetch=rA});var rp,l,w,f=Fi(()=>{"use strict";rp=Ct(Lc(),1),l=Ct(Lc(),1),{fetch:w}=(0,rp.abortableFetch)({fetch})});function Mi(e){if(pA.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Uc(e){return e.replace(fA,"")}function ji(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||!mA(r))return!1}return!0}function mA(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function ip(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 nA,up,iA,lp,oA,sA,aA,cA,uA,lA,dA,pA,np,fA,Rn,Vc,op,sp,ap,cp,b,pp=Fi(()=>{"use strict";m();d();f();p();nA=Object.create,up=Object.defineProperty,iA=Object.getOwnPropertyDescriptor,lp=Object.getOwnPropertyNames,oA=Object.getPrototypeOf,sA=Object.prototype.hasOwnProperty,aA=(e,t)=>function(){return t||(0,e[lp(e)[0]])((t={exports:{}}).exports,t),t.exports},cA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of lp(t))!sA.call(e,i)&&i!==r&&up(e,i,{get:()=>t[i],enumerable:!(n=iA(t,i))||n.enumerable});return e},uA=(e,t,r)=>(r=e!=null?nA(oA(e)):{},cA(t||!e||!e.__esModule?up(r,"default",{value:e,enumerable:!0}):r,e)),lA=aA({"node_modules/set-cookie-parser/lib/set-cookie.js"(e,t){"use strict";var r={decodeValues:!0,map:!1,silent:!1};function n(c){return typeof c=="string"&&!!c.trim()}function i(c,u){var h=c.split(";").filter(n),v=h.shift(),S=o(v),g=S.name,y=S.value;u=u?Object.assign({},r,u):r;try{y=u.decodeValues?decodeURIComponent(y):y}catch(E){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+y+"'. Set options.decodeValues to false to disable this feature.",E)}var C={name:g,value:y};return h.forEach(function(E){var x=E.split("="),R=x.shift().trimLeft().toLowerCase(),T=x.join("=");R==="expires"?C.expires=new Date(T):R==="max-age"?C.maxAge=parseInt(T,10):R==="secure"?C.secure=!0:R==="httponly"?C.httpOnly=!0:R==="samesite"?C.sameSite=T:C[R]=T}),C}function o(c){var u="",h="",v=c.split("=");return v.length>1?(u=v.shift(),h=v.join("=")):h=c,{name:u,value:h}}function s(c,u){if(u=u?Object.assign({},r,u):r,!c)return u.map?{}:[];if(c.headers)if(typeof c.headers.getSetCookie=="function")c=c.headers.getSetCookie();else if(c.headers["set-cookie"])c=c.headers["set-cookie"];else{var h=c.headers[Object.keys(c.headers).find(function(S){return S.toLowerCase()==="set-cookie"})];!h&&c.headers.cookie&&!u.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."),c=h}if(Array.isArray(c)||(c=[c]),u=u?Object.assign({},r,u):r,u.map){var v={};return c.filter(n).reduce(function(S,g){var y=i(g,u);return S[y.name]=y,S},v)}else return c.filter(n).map(function(S){return i(S,u)})}function a(c){if(Array.isArray(c))return c;if(typeof c!="string")return[];var u=[],h=0,v,S,g,y,C;function E(){for(;h<c.length&&/\s/.test(c.charAt(h));)h+=1;return h<c.length}function x(){return S=c.charAt(h),S!=="="&&S!==";"&&S!==","}for(;h<c.length;){for(v=h,C=!1;E();)if(S=c.charAt(h),S===","){for(g=h,h+=1,E(),y=h;h<c.length&&x();)h+=1;h<c.length&&c.charAt(h)==="="?(C=!0,h=y,u.push(c.substring(v,g)),v=h):h=g+1}else h+=1;(!C||h>=c.length)&&u.push(c.substring(v,c.length))}return u}t.exports=s,t.exports.parse=s,t.exports.parseString=i,t.exports.splitCookiesString=a}}),dA=uA(lA()),pA=/[^a-z0-9\-#$%&'*+.^_`|~]/i;np=[`
|
|
19
|
-
`,"\r","\t"," "],fA=new RegExp(`(^[${np.join("")}]|$[${np.join("")}])`,"g");Rn=Symbol("normalizedHeaders"),Vc=Symbol("rawHeaderNames"),op=", ",b=class dp{constructor(t){this[sp]={},this[ap]=new Map,this[cp]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor.name)||t instanceof dp||typeof A.Headers<"u"&&t instanceof A.Headers?t.forEach((n,i)=>{this.append(i,n)},this):Array.isArray(t)?t.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(op):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(op):n)})}[(sp=Rn,ap=Vc,cp=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[Rn]).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(!ji(t))throw new TypeError(`Invalid header name "${t}"`);return this[Rn].hasOwnProperty(Mi(t))}get(t){if(!ji(t))throw TypeError(`Invalid header name "${t}"`);return this[Rn][Mi(t)]??null}set(t,r){if(!ji(t)||!ip(r))return;let n=Mi(t),i=Uc(r);this[Rn][n]=Uc(i),this[Vc].set(n,t)}append(t,r){if(!ji(t)||!ip(r))return;let n=Mi(t),i=Uc(r),o=this.has(n)?`${this.get(n)}, ${i}`:i;this.set(t,o)}delete(t){if(!ji(t)||!this.has(t))return;let r=Mi(t);delete this[Rn][r],this[Vc].delete(r)}forEach(t,r){for(let[n,i]of this.entries())t.call(r,i,n,this)}getSetCookie(){let t=this.get("set-cookie");return t===null?[]:t===""?[""]:(0,dA.splitCookiesString)(t)}}});var m=Fi(()=>{"use strict";pp()});var fp=Qe(qi=>{"use strict";m();d();f();p();var Do=qi&&qi.__assign||function(){return Do=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Do.apply(this,arguments)};Object.defineProperty(qi,"__esModule",{value:!0});var gA={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function hA(e){var t=Do(Do({},gA),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}qi.getSanitizedOptions=hA});var mp=Qe(Gc=>{"use strict";m();d();f();p();Object.defineProperty(Gc,"__esModule",{value:!0});function yA(e){var t=Math.random()*e;return Math.round(t)}Gc.fullJitter=yA});var gp=Qe(Bc=>{"use strict";m();d();f();p();Object.defineProperty(Bc,"__esModule",{value:!0});function vA(e){return e}Bc.noJitter=vA});var hp=Qe($c=>{"use strict";m();d();f();p();Object.defineProperty($c,"__esModule",{value:!0});var SA=mp(),AA=gp();function wA(e){switch(e.jitter){case"full":return SA.fullJitter;case"none":default:return AA.noJitter}}$c.JitterFactory=wA});var Hc=Qe(Qc=>{"use strict";m();d();f();p();Object.defineProperty(Qc,"__esModule",{value:!0});var bA=hp(),CA=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=bA.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,i=t*Math.pow(r,n);return Math.min(i,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();Qc.Delay=CA});var yp=Qe(Wt=>{"use strict";m();d();f();p();var xA=Wt&&Wt.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),EA=Wt&&Wt.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{u(n.next(h))}catch(v){s(v)}}function c(h){try{u(n.throw(h))}catch(v){s(v)}}function u(h){h.done?o(h.value):i(h.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},IA=Wt&&Wt.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,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(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(Wt,"__esModule",{value:!0});var RA=Hc(),TA=function(e){xA(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return EA(this,void 0,void 0,function(){return IA(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}(RA.Delay);Wt.SkipFirstDelay=TA});var vp=Qe(Li=>{"use strict";m();d();f();p();var _A=Li&&Li.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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(Li,"__esModule",{value:!0});var kA=Hc(),OA=function(e){_A(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(kA.Delay);Li.AlwaysDelay=OA});var Sp=Qe(zc=>{"use strict";m();d();f();p();Object.defineProperty(zc,"__esModule",{value:!0});var PA=yp(),NA=vp();function FA(e,t){var r=DA(e);return r.setAttemptNumber(t),r}zc.DelayFactory=FA;function DA(e){return e.delayFirstAttempt?new NA.AlwaysDelay(e):new PA.SkipFirstDelay(e)}});var Ap=Qe(Or=>{"use strict";m();d();f();p();var Wc=Or&&Or.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{u(n.next(h))}catch(v){s(v)}}function c(h){try{u(n.throw(h))}catch(v){s(v)}}function u(h){h.done?o(h.value):i(h.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},Kc=Or&&Or.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,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(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(Or,"__esModule",{value:!0});var MA=fp(),jA=Sp();function qA(e,t){return t===void 0&&(t={}),Wc(this,void 0,void 0,function(){var r,n;return Kc(this,function(i){switch(i.label){case 0:return r=MA.getSanitizedOptions(t),n=new LA(e,r),[4,n.execute()];case 1:return[2,i.sent()]}})})}Or.backOff=qA;var LA=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return Wc(this,void 0,void 0,function(){var t,r;return Kc(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 Wc(this,void 0,void 0,function(){var t;return Kc(this,function(r){switch(r.label){case 0:return t=jA.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var Js=Qe((Cl,xl)=>{"use strict";m();d();f();p();(function(e,t){typeof Cl=="object"&&typeof xl<"u"?xl.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs=t()})(Cl,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",i="second",o="minute",s="hour",a="day",c="week",u="month",h="quarter",v="year",S="date",g="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|Y{1,4}|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,E={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(B){var V=["th","st","nd","rd"],U=B%100;return"["+B+(V[(U-20)%10]||V[U]||V[0])+"]"}},x=function(B,V,U){var $=String(B);return!$||$.length>=V?B:""+Array(V+1-$.length).join(U)+B},R={s:x,z:function(B){var V=-B.utcOffset(),U=Math.abs(V),$=Math.floor(U/60),G=U%60;return(V<=0?"+":"-")+x($,2,"0")+":"+x(G,2,"0")},m:function B(V,U){if(V.date()<U.date())return-B(U,V);var $=12*(U.year()-V.year())+(U.month()-V.month()),G=V.clone().add($,u),W=U-G<0,K=V.clone().add($+(W?-1:1),u);return+(-($+(U-G)/(W?G-K:K-G))||0)},a:function(B){return B<0?Math.ceil(B)||0:Math.floor(B)},p:function(B){return{M:u,y:v,w:c,d:a,D:S,h:s,m:o,s:i,ms:n,Q:h}[B]||String(B||"").toLowerCase().replace(/s$/,"")},u:function(B){return B===void 0}},T="en",_={};_[T]=E;var M="$isDayjsObject",P=function(B){return B instanceof L||!(!B||!B[M])},k=function B(V,U,$){var G;if(!V)return T;if(typeof V=="string"){var W=V.toLowerCase();_[W]&&(G=W),U&&(_[W]=U,G=W);var K=V.split("-");if(!G&&K.length>1)return B(K[0])}else{var ee=V.name;_[ee]=V,G=ee}return!$&&G&&(T=G),G||!$&&T},O=function(B,V){if(P(B))return B.clone();var U=typeof V=="object"?V:{};return U.date=B,U.args=arguments,new L(U)},F=R;F.l=k,F.i=P,F.w=function(B,V){return O(B,{locale:V.$L,utc:V.$u,x:V.$x,$offset:V.$offset})};var L=function(){function B(U){this.$L=k(U.locale,null,!0),this.parse(U),this.$x=this.$x||U.x||{},this[M]=!0}var V=B.prototype;return V.parse=function(U){this.$d=function($){var G=$.date,W=$.utc;if(G===null)return new Date(NaN);if(F.u(G))return new Date;if(G instanceof Date)return new Date(G);if(typeof G=="string"&&!/Z$/i.test(G)){var K=G.match(y);if(K){var ee=K[2]-1||0,ue=(K[7]||"0").substring(0,3);return W?new Date(Date.UTC(K[1],ee,K[3]||1,K[4]||0,K[5]||0,K[6]||0,ue)):new Date(K[1],ee,K[3]||1,K[4]||0,K[5]||0,K[6]||0,ue)}}return new Date(G)}(U),this.init()},V.init=function(){var U=this.$d;this.$y=U.getFullYear(),this.$M=U.getMonth(),this.$D=U.getDate(),this.$W=U.getDay(),this.$H=U.getHours(),this.$m=U.getMinutes(),this.$s=U.getSeconds(),this.$ms=U.getMilliseconds()},V.$utils=function(){return F},V.isValid=function(){return this.$d.toString()!==g},V.isSame=function(U,$){var G=O(U);return this.startOf($)<=G&&G<=this.endOf($)},V.isAfter=function(U,$){return O(U)<this.startOf($)},V.isBefore=function(U,$){return this.endOf($)<O(U)},V.$g=function(U,$,G){return F.u(U)?this[$]:this.set(G,U)},V.unix=function(){return Math.floor(this.valueOf()/1e3)},V.valueOf=function(){return this.$d.getTime()},V.startOf=function(U,$){var G=this,W=!!F.u($)||$,K=F.p(U),ee=function(Ae,Oe){var qe=F.w(G.$u?Date.UTC(G.$y,Oe,Ae):new Date(G.$y,Oe,Ae),G);return W?qe:qe.endOf(a)},ue=function(Ae,Oe){return F.w(G.toDate()[Ae].apply(G.toDate("s"),(W?[0,0,0,0]:[23,59,59,999]).slice(Oe)),G)},he=this.$W,ce=this.$M,le=this.$D,ae="set"+(this.$u?"UTC":"");switch(K){case v:return W?ee(1,0):ee(31,11);case u:return W?ee(1,ce):ee(0,ce+1);case c:var pe=this.$locale().weekStart||0,Fe=(he<pe?he+7:he)-pe;return ee(W?le-Fe:le+(6-Fe),ce);case a:case S:return ue(ae+"Hours",0);case s:return ue(ae+"Minutes",1);case o:return ue(ae+"Seconds",2);case i:return ue(ae+"Milliseconds",3);default:return this.clone()}},V.endOf=function(U){return this.startOf(U,!1)},V.$set=function(U,$){var G,W=F.p(U),K="set"+(this.$u?"UTC":""),ee=(G={},G[a]=K+"Date",G[S]=K+"Date",G[u]=K+"Month",G[v]=K+"FullYear",G[s]=K+"Hours",G[o]=K+"Minutes",G[i]=K+"Seconds",G[n]=K+"Milliseconds",G)[W],ue=W===a?this.$D+($-this.$W):$;if(W===u||W===v){var he=this.clone().set(S,1);he.$d[ee](ue),he.init(),this.$d=he.set(S,Math.min(this.$D,he.daysInMonth())).$d}else ee&&this.$d[ee](ue);return this.init(),this},V.set=function(U,$){return this.clone().$set(U,$)},V.get=function(U){return this[F.p(U)]()},V.add=function(U,$){var G,W=this;U=Number(U);var K=F.p($),ee=function(ce){var le=O(W);return F.w(le.date(le.date()+Math.round(ce*U)),W)};if(K===u)return this.set(u,this.$M+U);if(K===v)return this.set(v,this.$y+U);if(K===a)return ee(1);if(K===c)return ee(7);var ue=(G={},G[o]=t,G[s]=r,G[i]=e,G)[K]||1,he=this.$d.getTime()+U*ue;return F.w(he,this)},V.subtract=function(U,$){return this.add(-1*U,$)},V.format=function(U){var $=this,G=this.$locale();if(!this.isValid())return G.invalidDate||g;var W=U||"YYYY-MM-DDTHH:mm:ssZ",K=F.z(this),ee=this.$H,ue=this.$m,he=this.$M,ce=G.weekdays,le=G.months,ae=G.meridiem,pe=function(Oe,qe,nt,mt){return Oe&&(Oe[qe]||Oe($,W))||nt[qe].slice(0,mt)},Fe=function(Oe){return F.s(ee%12||12,Oe,"0")},Ae=ae||function(Oe,qe,nt){var mt=Oe<12?"AM":"PM";return nt?mt.toLowerCase():mt};return W.replace(C,function(Oe,qe){return qe||function(nt){switch(nt){case"YY":return String($.$y).slice(-2);case"YYYY":return F.s($.$y,4,"0");case"M":return he+1;case"MM":return F.s(he+1,2,"0");case"MMM":return pe(G.monthsShort,he,le,3);case"MMMM":return pe(le,he);case"D":return $.$D;case"DD":return F.s($.$D,2,"0");case"d":return String($.$W);case"dd":return pe(G.weekdaysMin,$.$W,ce,2);case"ddd":return pe(G.weekdaysShort,$.$W,ce,3);case"dddd":return ce[$.$W];case"H":return String(ee);case"HH":return F.s(ee,2,"0");case"h":return Fe(1);case"hh":return Fe(2);case"a":return Ae(ee,ue,!0);case"A":return Ae(ee,ue,!1);case"m":return String(ue);case"mm":return F.s(ue,2,"0");case"s":return String($.$s);case"ss":return F.s($.$s,2,"0");case"SSS":return F.s($.$ms,3,"0");case"Z":return K}return null}(Oe)||K.replace(":","")})},V.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},V.diff=function(U,$,G){var W,K=this,ee=F.p($),ue=O(U),he=(ue.utcOffset()-this.utcOffset())*t,ce=this-ue,le=function(){return F.m(K,ue)};switch(ee){case v:W=le()/12;break;case u:W=le();break;case h:W=le()/3;break;case c:W=(ce-he)/6048e5;break;case a:W=(ce-he)/864e5;break;case s:W=ce/r;break;case o:W=ce/t;break;case i:W=ce/e;break;default:W=ce}return G?W:F.a(W)},V.daysInMonth=function(){return this.endOf(u).$D},V.$locale=function(){return _[this.$L]},V.locale=function(U,$){if(!U)return this.$L;var G=this.clone(),W=k(U,$,!0);return W&&(G.$L=W),G},V.clone=function(){return F.w(this.$d,this)},V.toDate=function(){return new Date(this.valueOf())},V.toJSON=function(){return this.isValid()?this.toISOString():null},V.toISOString=function(){return this.$d.toISOString()},V.toString=function(){return this.$d.toUTCString()},B}(),Q=L.prototype;return O.prototype=Q,[["$ms",n],["$s",i],["$m",o],["$H",s],["$W",a],["$M",u],["$y",v],["$D",S]].forEach(function(B){Q[B[1]]=function(V){return this.$g(V,B[0],B[1])}}),O.extend=function(B,V){return B.$i||(B(V,L,O),B.$i=!0),O},O.locale=k,O.isDayjs=P,O.unix=function(B){return O(1e3*B)},O.en=_[T],O.Ls=_,O.p={},O})});var Hg=Qe((El,Il)=>{"use strict";m();d();f();p();(function(e,t){typeof El=="object"&&typeof Il<"u"?Il.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_quarterOfYear=t()})(El,function(){"use strict";var e="month",t="quarter";return function(r,n){var i=n.prototype;i.quarter=function(a){return this.$utils().u(a)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(a-1))};var o=i.add;i.add=function(a,c){return a=Number(a),this.$utils().p(c)===t?this.add(3*a,e):o.bind(this)(a,c)};var s=i.startOf;i.startOf=function(a,c){var u=this.$utils(),h=!!u.u(c)||c;if(u.p(a)===t){var v=this.quarter()-1;return h?this.month(3*v).startOf(e).startOf("day"):this.month(3*v+2).endOf(e).endOf("day")}return s.bind(this)(a,c)}}})});var zg=Qe((Rl,Tl)=>{"use strict";m();d();f();p();(function(e,t){typeof Rl=="object"&&typeof Tl<"u"?Tl.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_customParseFormat=t()})(Rl,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/,i=/\d\d?/,o=/\d*[^-_:/,()\s\d]+/,s={},a=function(y){return(y=+y)+(y>68?1900:2e3)},c=function(y){return function(C){this[y]=+C}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(C){if(!C||C==="Z")return 0;var E=C.match(/([+-]|\d\d)/g),x=60*E[1]+(+E[2]||0);return x===0?0:E[0]==="+"?-x:x}(y)}],h=function(y){var C=s[y];return C&&(C.indexOf?C:C.s.concat(C.f))},v=function(y,C){var E,x=s.meridiem;if(x){for(var R=1;R<=24;R+=1)if(y.indexOf(x(R,0,C))>-1){E=R>12;break}}else E=y===(C?"pm":"PM");return E},S={A:[o,function(y){this.afternoon=v(y,!1)}],a:[o,function(y){this.afternoon=v(y,!0)}],Q:[r,function(y){this.month=3*(y-1)+1}],S:[r,function(y){this.milliseconds=100*+y}],SS:[n,function(y){this.milliseconds=10*+y}],SSS:[/\d{3}/,function(y){this.milliseconds=+y}],s:[i,c("seconds")],ss:[i,c("seconds")],m:[i,c("minutes")],mm:[i,c("minutes")],H:[i,c("hours")],h:[i,c("hours")],HH:[i,c("hours")],hh:[i,c("hours")],D:[i,c("day")],DD:[n,c("day")],Do:[o,function(y){var C=s.ordinal,E=y.match(/\d+/);if(this.day=E[0],C)for(var x=1;x<=31;x+=1)C(x).replace(/\[|\]/g,"")===y&&(this.day=x)}],w:[i,c("week")],ww:[n,c("week")],M:[i,c("month")],MM:[n,c("month")],MMM:[o,function(y){var C=h("months"),E=(h("monthsShort")||C.map(function(x){return x.slice(0,3)})).indexOf(y)+1;if(E<1)throw new Error;this.month=E%12||E}],MMMM:[o,function(y){var C=h("months").indexOf(y)+1;if(C<1)throw new Error;this.month=C%12||C}],Y:[/[+-]?\d+/,c("year")],YY:[n,function(y){this.year=a(y)}],YYYY:[/\d{4}/,c("year")],Z:u,ZZ:u};function g(y){var C,E;C=y,E=s&&s.formats;for(var x=(y=C.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(O,F,L){var Q=L&&L.toUpperCase();return F||E[L]||e[L]||E[Q].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(B,V,U){return V||U.slice(1)})})).match(t),R=x.length,T=0;T<R;T+=1){var _=x[T],M=S[_],P=M&&M[0],k=M&&M[1];x[T]=k?{regex:P,parser:k}:_.replace(/^\[|\]$/g,"")}return function(O){for(var F={},L=0,Q=0;L<R;L+=1){var B=x[L];if(typeof B=="string")Q+=B.length;else{var V=B.regex,U=B.parser,$=O.slice(Q),G=V.exec($)[0];U.call(F,G),O=O.replace(G,"")}}return function(W){var K=W.afternoon;if(K!==void 0){var ee=W.hours;K?ee<12&&(W.hours+=12):ee===12&&(W.hours=0),delete W.afternoon}}(F),F}}return function(y,C,E){E.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(a=y.parseTwoDigitYear);var x=C.prototype,R=x.parse;x.parse=function(T){var _=T.date,M=T.utc,P=T.args;this.$u=M;var k=P[1];if(typeof k=="string"){var O=P[2]===!0,F=P[3]===!0,L=O||F,Q=P[2];F&&(Q=P[2]),s=this.$locale(),!O&&Q&&(s=E.Ls[Q]),this.$d=function($,G,W,K){try{if(["x","X"].indexOf(G)>-1)return new Date((G==="X"?1e3:1)*$);var ee=g(G)($),ue=ee.year,he=ee.month,ce=ee.day,le=ee.hours,ae=ee.minutes,pe=ee.seconds,Fe=ee.milliseconds,Ae=ee.zone,Oe=ee.week,qe=new Date,nt=ce||(ue||he?1:qe.getDate()),mt=ue||qe.getFullYear(),ar=0;ue&&!he||(ar=he>0?he-1:qe.getMonth());var xn,En=le||0,Pi=ae||0,Pc=pe||0,Nc=Fe||0;return Ae?new Date(Date.UTC(mt,ar,nt,En,Pi,Pc,Nc+60*Ae.offset*1e3)):W?new Date(Date.UTC(mt,ar,nt,En,Pi,Pc,Nc)):(xn=new Date(mt,ar,nt,En,Pi,Pc,Nc),Oe&&(xn=K(xn).week(Oe).toDate()),xn)}catch{return new Date("")}}(_,k,M,E),this.init(),Q&&Q!==!0&&(this.$L=this.locale(Q).$L),L&&_!=this.format(k)&&(this.$d=new Date("")),s={}}else if(k instanceof Array)for(var B=k.length,V=1;V<=B;V+=1){P[1]=k[V-1];var U=E.apply(this,P);if(U.isValid()){this.$d=U.$d,this.$L=U.$L,this.init();break}V===B&&(this.$d=new Date(""))}else R.call(this,T)}}})});var Ih=Qe((Vl,Gl)=>{"use strict";m();d();f();p();(function(e,t){typeof Vl=="object"&&typeof Gl<"u"?Gl.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_timezone=t()})(Vl,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,i){var o,s=function(h,v,S){S===void 0&&(S={});var g=new Date(h),y=function(C,E){E===void 0&&(E={});var x=E.timeZoneName||"short",R=C+"|"+x,T=t[R];return T||(T=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:C,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:x}),t[R]=T),T}(v,S);return y.formatToParts(g)},a=function(h,v){for(var S=s(h,v),g=[],y=0;y<S.length;y+=1){var C=S[y],E=C.type,x=C.value,R=e[E];R>=0&&(g[R]=parseInt(x,10))}var T=g[3],_=T===24?0:T,M=g[0]+"-"+g[1]+"-"+g[2]+" "+_+":"+g[4]+":"+g[5]+":000",P=+h;return(i.utc(M).valueOf()-(P-=P%1e3))/6e4},c=n.prototype;c.tz=function(h,v){h===void 0&&(h=o);var S,g=this.utcOffset(),y=this.toDate(),C=y.toLocaleString("en-US",{timeZone:h}),E=Math.round((y-new Date(C))/1e3/60),x=15*-Math.round(y.getTimezoneOffset()/15)-E;if(!Number(x))S=this.utcOffset(0,v);else if(S=i(C,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(x,!0),v){var R=S.utcOffset();S=S.add(g-R,"minute")}return S.$x.$timezone=h,S},c.offsetName=function(h){var v=this.$x.$timezone||i.tz.guess(),S=s(this.valueOf(),v,{timeZoneName:h}).find(function(g){return g.type.toLowerCase()==="timezonename"});return S&&S.value};var u=c.startOf;c.startOf=function(h,v){if(!this.$x||!this.$x.$timezone)return u.call(this,h,v);var S=i(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return u.call(S,h,v).tz(this.$x.$timezone,!0)},i.tz=function(h,v,S){var g=S&&v,y=S||v||o,C=a(+i(),y);if(typeof h!="string")return i(h).tz(y);var E=function(_,M,P){var k=_-60*M*1e3,O=a(k,P);if(M===O)return[k,M];var F=a(k-=60*(O-M)*1e3,P);return O===F?[k,O]:[_-60*Math.min(O,F)*1e3,Math.max(O,F)]}(i.utc(h,g).valueOf(),C,y),x=E[0],R=E[1],T=i(x).utcOffset(R);return T.$x.$timezone=y,T},i.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},i.tz.setDefault=function(h){o=h}}})});var Rh=Qe((Bl,$l)=>{"use strict";m();d();f();p();(function(e,t){typeof Bl=="object"&&typeof $l<"u"?$l.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_utc=t()})(Bl,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,i,o){var s=i.prototype;o.utc=function(g){var y={date:g,utc:!0,args:arguments};return new i(y)},s.utc=function(g){var y=o(this.toDate(),{locale:this.$L,utc:!0});return g?y.add(this.utcOffset(),e):y},s.local=function(){return o(this.toDate(),{locale:this.$L,utc:!1})};var a=s.parse;s.parse=function(g){g.utc&&(this.$u=!0),this.$utils().u(g.$offset)||(this.$offset=g.$offset),a.call(this,g)};var c=s.init;s.init=function(){if(this.$u){var g=this.$d;this.$y=g.getUTCFullYear(),this.$M=g.getUTCMonth(),this.$D=g.getUTCDate(),this.$W=g.getUTCDay(),this.$H=g.getUTCHours(),this.$m=g.getUTCMinutes(),this.$s=g.getUTCSeconds(),this.$ms=g.getUTCMilliseconds()}else c.call(this)};var u=s.utcOffset;s.utcOffset=function(g,y){var C=this.$utils().u;if(C(g))return this.$u?0:C(this.$offset)?u.call(this):this.$offset;if(typeof g=="string"&&(g=function(T){T===void 0&&(T="");var _=T.match(t);if(!_)return null;var M=(""+_[0]).match(r)||["-",0,0],P=M[0],k=60*+M[1]+ +M[2];return k===0?0:P==="+"?k:-k}(g),g===null))return this;var E=Math.abs(g)<=16?60*g:g,x=this;if(y)return x.$offset=E,x.$u=g===0,x;if(g!==0){var R=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(x=this.local().add(E+R,e)).$offset=E,x.$x.$localOffset=R}else x=this.utc();return x};var h=s.format;s.format=function(g){var y=g||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,y)},s.valueOf=function(){var g=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*g},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(g){return g==="s"&&this.$offset?o(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var S=s.diff;s.diff=function(g,y,C){if(g&&this.$u===g.$u)return S.call(this,g,y,C);var E=this.local(),x=o(g).local();return S.call(E,x,y,C)}}})});var Kv=Qe((Jse,Wv)=>{"use strict";m();d();f();p();function sk(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}Wv.exports=ak;function ak(e,t,r){var n=r&&r.stringify||sk,i=1;if(typeof e=="object"&&e!==null){var o=t.length+i;if(o===1)return e;var s=new Array(o);s[0]=n(e);for(var a=1;a<o;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="",h=1-i,v=-1,S=e&&e.length||0,g=0;g<S;){if(e.charCodeAt(g)===37&&g+1<S){switch(v=v>-1?v:0,e.charCodeAt(g+1)){case 100:case 102:if(h>=c||t[h]==null)break;v<g&&(u+=e.slice(v,g)),u+=Number(t[h]),v=g+2,g++;break;case 105:if(h>=c||t[h]==null)break;v<g&&(u+=e.slice(v,g)),u+=Math.floor(Number(t[h])),v=g+2,g++;break;case 79:case 111:case 106:if(h>=c||t[h]===void 0)break;v<g&&(u+=e.slice(v,g));var y=typeof t[h];if(y==="string"){u+="'"+t[h]+"'",v=g+2,g++;break}if(y==="function"){u+=t[h].name||"<anonymous>",v=g+2,g++;break}u+=n(t[h]),v=g+2,g++;break;case 115:if(h>=c)break;v<g&&(u+=e.slice(v,g)),u+=String(t[h]),v=g+2,g++;break;case 37:v<g&&(u+=e.slice(v,g)),u+="%",v=g+2,g++,h--;break}++h}++g}return v===-1?e:(v<S&&(u+=e.slice(v)),u)}});var tS=Qe((nae,xc)=>{"use strict";m();d();f();p();var Yv=Kv();xc.exports=or;var ko=bk().console||{},ck={mapHttpRequest:Cc,mapHttpResponse:Cc,wrapRequestSerializer:Ld,wrapResponseSerializer:Ld,wrapErrorSerializer:Ld,req:Cc,res:Cc,err:Jv,errWithCause:Jv};function Tr(e,t){return e==="silent"?1/0:t.levels.values[e]}var Gd=Symbol("pino.logFuncs"),Ud=Symbol("pino.hierarchy"),uk={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function Xv(e,t){let r={logger:t,parent:e[Ud]};t[Ud]=r}function lk(e,t,r){let n={};t.forEach(i=>{n[i]=r[i]?r[i]:ko[i]||ko[uk[i]||"log"]||Ti}),e[Gd]=n}function dk(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function or(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||ko;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},i=dk(e.browser.serialize,n),o=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(o=!1);let s=Object.keys(e.customLevels||{}),a=["error","fatal","warn","info","debug","trace"].concat(s);typeof r=="function"&&a.forEach(function(C){r[C]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let c=e.level||"info",u=Object.create(r);u.log||(u.log=Ti),lk(u,a,r),Xv({},u),Object.defineProperty(u,"levelVal",{get:v}),Object.defineProperty(u,"level",{get:S,set:g});let h={transmit:t,serialize:i,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:a,timestamp:Sk(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Ti};u.levels=pk(e),u.level=c,u.isLevelEnabled=function(C){return this.levels.values[C]?this.levels.values[C]>=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=Ti,u.serializers=n,u._serialize=i,u._stdErrSerialize=o,u.child=function(...C){return y.call(this,h,...C)},t&&(u._logEvent=Vd());function v(){return Tr(this.level,this)}function S(){return this._level}function g(C){if(C!=="silent"&&!this.levels.values[C])throw Error("unknown level "+C);this._level=C,bn(this,h,u,"error"),bn(this,h,u,"fatal"),bn(this,h,u,"warn"),bn(this,h,u,"info"),bn(this,h,u,"debug"),bn(this,h,u,"trace"),s.forEach(E=>{bn(this,h,u,E)})}function y(C,E,x){if(!E)throw new Error("missing bindings for child Pino");x=x||{},i&&E.serializers&&(x.serializers=E.serializers);let R=x.serializers;if(i&&R){var T=Object.assign({},n,R),_=e.browser.serialize===!0?Object.keys(T):i;delete E.serializers,Bd([E],_,T,this._stdErrSerialize)}function M(k){this._childLevel=(k._childLevel|0)+1,this.bindings=E,T&&(this.serializers=T,this._serialize=_),t&&(this._logEvent=Vd([].concat(k._logEvent.bindings,E)))}M.prototype=this;let P=new M(this);return Xv(this,P),P.child=function(...k){return y.call(this,C,...k)},P.level=x.level||this.level,C.onChild(P),P}return u}function pk(e){let t=e.customLevels||{},r=Object.assign({},or.levels.values,t),n=Object.assign({},or.levels.labels,fk(t));return{values:r,labels:n}}function fk(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}or.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"}};or.stdSerializers=ck;or.stdTimeFunctions=Object.assign({},{nullTime:Zv,epochTime:eS,unixTime:Ak,isoTime:wk});function mk(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[Ud];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function bn(e,t,r,n){if(Object.defineProperty(e,n,{value:Tr(e.level,r)>Tr(n,r)?Ti:r[Gd][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===Ti){if(!t.transmit)return;let o=t.transmit.level||e.level,s=Tr(o,r);if(Tr(n,r)<s)return}e[n]=hk(e,t,r,n);let i=mk(e);i.length!==0&&(e[n]=gk(i,e[n]))}function gk(e,t){return function(){return t.apply(this,[...e,...arguments])}}function hk(e,t,r,n){return function(i){return function(){let s=t.timestamp(),a=new Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===ko?ko:this;for(var u=0;u<a.length;u++)a[u]=arguments[u];var h=!1;if(t.serialize&&(Bd(a,this._serialize,this.serializers,this._stdErrSerialize),h=!0),t.asObject||t.formatters?i.call(c,...yk(this,n,a,s,t)):i.apply(c,a),t.transmit){let v=t.transmit.level||e._level,S=Tr(v,r),g=Tr(n,r);if(g<S)return;vk(this,{ts:s,methodLevel:n,methodValue:g,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Tr(e._level,r)},a,h)}}}(e[Gd][n])}function yk(e,t,r,n,i){let{level:o,log:s=v=>v}=i.formatters||{},a=r.slice(),c=a[0],u={},h=(e._childLevel|0)+1;if(h<1&&(h=1),n&&(u.time=n),o){let v=o(t,e.levels.values[t]);Object.assign(u,v)}else u.level=e.levels.values[t];if(i.asObjectBindingsOnly){if(c!==null&&typeof c=="object")for(;h--&&typeof a[0]=="object";)Object.assign(u,a.shift());return[s(u),...a]}else{if(c!==null&&typeof c=="object"){for(;h--&&typeof a[0]=="object";)Object.assign(u,a.shift());c=a.length?Yv(a.shift(),a):void 0}else typeof c=="string"&&(c=Yv(a.shift(),a));return c!==void 0&&(u[i.messageKey]=c),[s(u)]}}function Bd(e,t,r,n){for(let i in e)if(n&&e[i]instanceof Error)e[i]=or.stdSerializers.err(e[i]);else if(typeof e[i]=="object"&&!Array.isArray(e[i])&&t)for(let o in e[i])t.indexOf(o)>-1&&o in r&&(e[i][o]=r[o](e[i][o]))}function vk(e,t,r,n=!1){let i=t.send,o=t.ts,s=t.methodLevel,a=t.methodValue,c=t.val,u=e._logEvent.bindings;n||Bd(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=o,e._logEvent.messages=r.filter(function(h){return u.indexOf(h)===-1}),e._logEvent.level.label=s,e._logEvent.level.value=a,i(s,e._logEvent,c),e._logEvent=Vd(u)}function Vd(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function Jv(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 Sk(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?Zv:eS}function Cc(){return{}}function Ld(e){return e}function Ti(){}function Zv(){return!1}function eS(){return Date.now()}function Ak(){return Math.round(Date.now()/1e3)}function wk(){return new Date(Date.now()).toISOString()}function bk(){function e(t){return typeof t<"u"&&t}try{return typeof A<"u"?A:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),A)}catch{return e(self)||e(window)||e(this)||{}}}xc.exports.default=or;xc.exports.pino=or});var zk={};Po(zk,{ResultTemplatesHelpers:()=>ah,buildCaseAssistEngine:()=>aS,buildCaseField:()=>bS,buildCaseInput:()=>CS,buildController:()=>zt,buildDocumentSuggestion:()=>Qd,buildDocumentSuggestionList:()=>Qd,buildInteractiveResult:()=>ES,buildQuickview:()=>_S,getAnalyticsNextApiBaseUrl:()=>jo,getOrganizationEndpoint:()=>Te,loadCaseAssistAnalyticsActions:()=>Bk,loadCaseFieldActions:()=>$k,loadCaseInputActions:()=>Qk,loadDocumentSuggestionActions:()=>Hk,loadGenericAnalyticsActions:()=>Gk});module.exports=LS(zk);m();d();f();p();m();d();f();p();var Tp=Ct(Ap(),1);m();d();f();p();var gt=new Error("Failed to load reducers."),Tn=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."}},Pr=class extends Error{constructor(r,n){super();be(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 wp(e){return Array.isArray(e)}function bp(e,t){return[...e.reduce((r,n)=>{let i=t(n);return r.has(i)||r.set(i,n),r},new Map).values()]}var UA=new Set(["1",1,"yes",!0]);function Cp(){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=>UA.has(r))}function xp(e){let t={};for(let[r,n]of e)t[r]=n;return t}function Ui(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Mo(e,t,r={}){let n;return(...i)=>{let o=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,i)},t),o)return e.apply(void 0,i)}}m();d();f();p();function Ep(e){let t=[];for(let r in e){let n=encodeURIComponent(r),i=encodeURIComponent(e[r]);t.push(`${n}=${i}`)}return t.join("&")}function Ip(e){return typeof e!="object"||!e?!1:Object.values(e).every(VA)}function VA(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Rp(e){return e===429}var cr=class e{static call(t){return _asyncToGenerator(function*(){let r=GA(t),{logger:n}=t,i=yield e.preprocessRequest(r,t);n.info(i,"Platform request");let{url:o,...s}=i,a=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let c=yield w(o,s);if(Rp(c.status))throw c;return c});return function a(){return _ref.apply(this,arguments)}}();try{let c=yield(0,Tp.backOff)(a,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(u){let h=u&&Rp(u.status);return h&&(n.info("Platform retrying request"),yield new Promise(v=>setTimeout(v,1e3))),h});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(c.status){case 419:case 401:throw n.info("Platform renewing token"),new Tn;case 404:throw new Pr(o,c.status);default:return n.info({response:c,requestInfo:i},"Platform response"),c}}catch(c){return c.message==="Failed to fetch"?new Pr(o):c}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:i,logger:o,requestMetadata:s}=r,{signal:a,...c}=t,u=Ui(c);try{let h=yield i(t,n,s);return{...t,...h}}catch(h){o.error(h,"Platform request preprocessing failed. Returning default request options.")}return u})()}};function Te(e,t="prod",r="platform"){let n=t==="prod"?"":t,i=r==="platform"?"":`.${r}`;return`https://${e}${i}.org${n}.coveo.com`}function _n(e,t="prod"){return`${Te(e,t)}/rest/search/v2`}function jo(e,t="prod"){return`${Te(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function GA(e){let{url:t,method:r,requestParams:n,contentType:i,accessToken:o,signal:s}=e,a=e.method==="POST"||e.method==="PUT",c=BA(n,i);return{url:t,method:r,headers:{"Content-Type":i,Authorization:`Bearer ${o}`,...e.headers},...(a&&{body:c}),signal:s}}function BA(e,t){return t==="application/x-www-form-urlencoded"?Ip(e)?Ep(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();function $A(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 sS=Object.create;var xi=Object.defineProperty;var aS=Object.getOwnPropertyDescriptor;var cS=Object.getOwnPropertyNames;var uS=Object.getPrototypeOf,lS=Object.prototype.hasOwnProperty;var dS=(e,t,r)=>t in e?xi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ei=(e,t)=>()=>(e&&(t=e(e=0)),t);var Qe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Io=(e,t)=>{for(var r in t)xi(e,r,{get:t[r],enumerable:!0})},qd=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of cS(t))!lS.call(e,i)&&i!==r&&xi(e,i,{get:()=>t[i],enumerable:!(n=aS(t,i))||n.enumerable});return e};var Ct=(e,t,r)=>(r=e!=null?sS(uS(e)):{},qd(t||!e||!e.__esModule?xi(r,"default",{value:e,enumerable:!0}):r,e)),pS=e=>qd(xi({},"__esModule",{value:!0}),e);var we=(e,t,r)=>dS(e,typeof t!="symbol"?t+"":t,r);var A,d=Ei(()=>{"use strict";A=typeof globalThis<"u"?globalThis:window});function To(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?To=function(t){return typeof t}:To=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},To(e)}function gS(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=hS.bind(this))}function hS(e,t){var r=this.event&&this.event.type,n=r==="unload"||r==="beforeunload",i="XMLHttpRequest"in this?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");i.open("POST",e,!n),i.withCredentials=!0,i.setRequestHeader("Accept","*/*"),fS(t)?(i.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),i.responseType="text"):mS(t)&&t.type&&i.setRequestHeader("Content-Type",t.type);try{i.send(t)}catch{return!1}return!0}var fS,mS,p=Ei(()=>{"use strict";fS=function(t){return typeof t=="string"},mS=function(t){return t instanceof Blob};gS.call((typeof window>"u"?"undefined":To(window))==="object"?window:{})});var Ic=Qe(Ri=>{"use strict";m();d();f();p();Object.defineProperty(Ri,"__esModule",{value:!0});function Ld(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 yS(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function vS(e,t,r){return t=Sn(t),AS(e,Gd()?Reflect.construct(t,r||[],Sn(e).constructor):t.apply(e,r))}function xc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ud(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,xS(n.key),n)}}function Ec(e,t,r){return t&&Ud(e.prototype,t),r&&Ud(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Vd(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ES(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:i}}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 o,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,o=c},f:function(){try{s||r.return==null||r.return()}finally{if(a)throw o}}}}function wc(){return wc=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=bS(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},wc.apply(null,arguments)}function Sn(e){return Sn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Sn(e)}function SS(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&&Cc(e,t)}function Gd(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Gd=function(){return!!e})()}function AS(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 yS(e)}function Cc(e,t){return Cc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Cc(e,t)}function bS(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Sn(e))!==null;);return e}function wS(e,t,r,n){var i=wc(Sn(1&n?e.prototype:e),t,r);return 2&n&&typeof i=="function"?function(o){return i.apply(r,o)}:i}function CS(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 xS(e){var t=CS(e,"string");return typeof t=="symbol"?t:t+""}function ES(e,t){if(e){if(typeof e=="string")return Ld(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)?Ld(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function RS(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 IS(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 Bd=function(){function e(){xc(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Ec(e,[{key:"addEventListener",value:function(r,n,i){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:i})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var i=this.listeners[r],o=0,s=i.length;o<s;o++)if(i[o].callback===n){i.splice(o,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var i=this.listeners[r.type],o=i.slice(),s=function(){var h=o[a];try{h.callback.call(n,r)}catch(v){Promise.resolve().then(function(){throw v})}h.options&&h.options.once&&n.removeEventListener(r.type,h.callback)},a=0,c=o.length;a<c;a++)s();return!r.defaultPrevented}}}])}(),Rc=function(e){function t(){var r;return xc(this,t),r=vS(this,t),r.listeners||Bd.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 SS(t,e),Ec(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)),wS(t,"dispatchEvent",this,3)([n])}},{key:"throwIfAborted",value:function(){var n=this.aborted,i=this.reason,o=i===void 0?"Aborted":i;if(n)throw o}}],[{key:"timeout",value:function(n){var i=new _o;return setTimeout(function(){return i.abort(new DOMException("This signal is timeout in ".concat(n,"ms"),"TimeoutError"))},n),i.signal}},{key:"any",value:function(n){var i=new _o;function o(){i.abort(this.reason),s()}function s(){var h=Vd(n),v;try{for(h.s();!(v=h.n()).done;){var S=v.value;S.removeEventListener("abort",o)}}catch(g){h.e(g)}finally{h.f()}}var a=Vd(n),c;try{for(a.s();!(c=a.n()).done;){var u=c.value;if(u.aborted){i.abort(u.reason);break}else u.addEventListener("abort",o)}}catch(h){a.e(h)}finally{a.f()}return i.signal}}])}(Bd),_o=function(){function e(){xc(this,e),Object.defineProperty(this,"signal",{value:new Rc,writable:!0,configurable:!0})}return Ec(e,[{key:"abort",value:function(r){var n=IS(r),i=RS(n);this.signal.reason=n,this.signal.dispatchEvent(i)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(_o.prototype[Symbol.toStringTag]="AbortController",Rc.prototype[Symbol.toStringTag]="AbortSignal");function TS(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 _S(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,i=n===void 0?r.Request:n,o=t.AbortController,s=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,a=s===void 0?!1:s;if(!TS({fetch:r,Request:i,AbortController:o,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a}))return{fetch:r,Request:c};var c=i;(c&&!c.prototype.hasOwnProperty("signal")||a)&&(c=function(S,g){var y;g&&g.signal&&(y=g.signal,delete g.signal);var C=new i(S,g);return y&&Object.defineProperty(C,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),C},c.prototype=i.prototype);var u=r,h=function(S,g){var y=c&&c.prototype.isPrototypeOf(S)?S.signal:g?g.signal:void 0;if(y){var C;try{C=new DOMException("Aborted","AbortError")}catch{C=new Error("Aborted"),C.name="AbortError"}if(y.aborted)return Promise.reject(C);var E=new Promise(function(x,I){y.addEventListener("abort",function(){return I(C)},{once:!0})});return g&&g.signal&&delete g.signal,Promise.race([E,u(S,g)])}return u(S,g)};return{fetch:h,Request:c}}Ri.AbortController=_o;Ri.AbortSignal=Rc;Ri.abortableFetch=_S});var $d,l,b,f=Ei(()=>{"use strict";$d=Ct(Ic(),1),l=Ct(Ic(),1),{fetch:b}=(0,$d.abortableFetch)({fetch})});function Ii(e){if(LS.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Tc(e){return e.replace(US,"")}function Ti(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||!VS(r))return!1}return!0}function VS(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function Hd(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 kS,Xd,OS,Jd,PS,NS,FS,DS,MS,jS,qS,LS,Qd,US,An,_c,zd,Wd,Kd,Yd,w,ep=Ei(()=>{"use strict";m();d();f();p();kS=Object.create,Xd=Object.defineProperty,OS=Object.getOwnPropertyDescriptor,Jd=Object.getOwnPropertyNames,PS=Object.getPrototypeOf,NS=Object.prototype.hasOwnProperty,FS=(e,t)=>function(){return t||(0,e[Jd(e)[0]])((t={exports:{}}).exports,t),t.exports},DS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Jd(t))!NS.call(e,i)&&i!==r&&Xd(e,i,{get:()=>t[i],enumerable:!(n=OS(t,i))||n.enumerable});return e},MS=(e,t,r)=>(r=e!=null?kS(PS(e)):{},DS(t||!e||!e.__esModule?Xd(r,"default",{value:e,enumerable:!0}):r,e)),jS=FS({"node_modules/set-cookie-parser/lib/set-cookie.js"(e,t){"use strict";var r={decodeValues:!0,map:!1,silent:!1};function n(c){return typeof c=="string"&&!!c.trim()}function i(c,u){var h=c.split(";").filter(n),v=h.shift(),S=o(v),g=S.name,y=S.value;u=u?Object.assign({},r,u):r;try{y=u.decodeValues?decodeURIComponent(y):y}catch(E){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+y+"'. Set options.decodeValues to false to disable this feature.",E)}var C={name:g,value:y};return h.forEach(function(E){var x=E.split("="),I=x.shift().trimLeft().toLowerCase(),T=x.join("=");I==="expires"?C.expires=new Date(T):I==="max-age"?C.maxAge=parseInt(T,10):I==="secure"?C.secure=!0:I==="httponly"?C.httpOnly=!0:I==="samesite"?C.sameSite=T:C[I]=T}),C}function o(c){var u="",h="",v=c.split("=");return v.length>1?(u=v.shift(),h=v.join("=")):h=c,{name:u,value:h}}function s(c,u){if(u=u?Object.assign({},r,u):r,!c)return u.map?{}:[];if(c.headers)if(typeof c.headers.getSetCookie=="function")c=c.headers.getSetCookie();else if(c.headers["set-cookie"])c=c.headers["set-cookie"];else{var h=c.headers[Object.keys(c.headers).find(function(S){return S.toLowerCase()==="set-cookie"})];!h&&c.headers.cookie&&!u.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."),c=h}if(Array.isArray(c)||(c=[c]),u=u?Object.assign({},r,u):r,u.map){var v={};return c.filter(n).reduce(function(S,g){var y=i(g,u);return S[y.name]=y,S},v)}else return c.filter(n).map(function(S){return i(S,u)})}function a(c){if(Array.isArray(c))return c;if(typeof c!="string")return[];var u=[],h=0,v,S,g,y,C;function E(){for(;h<c.length&&/\s/.test(c.charAt(h));)h+=1;return h<c.length}function x(){return S=c.charAt(h),S!=="="&&S!==";"&&S!==","}for(;h<c.length;){for(v=h,C=!1;E();)if(S=c.charAt(h),S===","){for(g=h,h+=1,E(),y=h;h<c.length&&x();)h+=1;h<c.length&&c.charAt(h)==="="?(C=!0,h=y,u.push(c.substring(v,g)),v=h):h=g+1}else h+=1;(!C||h>=c.length)&&u.push(c.substring(v,c.length))}return u}t.exports=s,t.exports.parse=s,t.exports.parseString=i,t.exports.splitCookiesString=a}}),qS=MS(jS()),LS=/[^a-z0-9\-#$%&'*+.^_`|~]/i;Qd=[`
|
|
19
|
+
`,"\r","\t"," "],US=new RegExp(`(^[${Qd.join("")}]|$[${Qd.join("")}])`,"g");An=Symbol("normalizedHeaders"),_c=Symbol("rawHeaderNames"),zd=", ",w=class Zd{constructor(t){this[Wd]={},this[Kd]=new Map,this[Yd]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor.name)||t instanceof Zd||typeof A.Headers<"u"&&t instanceof A.Headers?t.forEach((n,i)=>{this.append(i,n)},this):Array.isArray(t)?t.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(zd):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(zd):n)})}[(Wd=An,Kd=_c,Yd=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[An]).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(!Ti(t))throw new TypeError(`Invalid header name "${t}"`);return this[An].hasOwnProperty(Ii(t))}get(t){if(!Ti(t))throw TypeError(`Invalid header name "${t}"`);return this[An][Ii(t)]??null}set(t,r){if(!Ti(t)||!Hd(r))return;let n=Ii(t),i=Tc(r);this[An][n]=Tc(i),this[_c].set(n,t)}append(t,r){if(!Ti(t)||!Hd(r))return;let n=Ii(t),i=Tc(r),o=this.has(n)?`${this.get(n)}, ${i}`:i;this.set(t,o)}delete(t){if(!Ti(t)||!this.has(t))return;let r=Ii(t);delete this[An][r],this[_c].delete(r)}forEach(t,r){for(let[n,i]of this.entries())t.call(r,i,n,this)}getSetCookie(){let t=this.get("set-cookie");return t===null?[]:t===""?[""]:(0,qS.splitCookiesString)(t)}}});var m=Ei(()=>{"use strict";ep()});var tp=Qe(_i=>{"use strict";m();d();f();p();var ko=_i&&_i.__assign||function(){return ko=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},ko.apply(this,arguments)};Object.defineProperty(_i,"__esModule",{value:!0});var BS={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function GS(e){var t=ko(ko({},BS),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}_i.getSanitizedOptions=GS});var rp=Qe(kc=>{"use strict";m();d();f();p();Object.defineProperty(kc,"__esModule",{value:!0});function $S(e){var t=Math.random()*e;return Math.round(t)}kc.fullJitter=$S});var np=Qe(Oc=>{"use strict";m();d();f();p();Object.defineProperty(Oc,"__esModule",{value:!0});function QS(e){return e}Oc.noJitter=QS});var ip=Qe(Pc=>{"use strict";m();d();f();p();Object.defineProperty(Pc,"__esModule",{value:!0});var HS=rp(),zS=np();function WS(e){switch(e.jitter){case"full":return HS.fullJitter;case"none":default:return zS.noJitter}}Pc.JitterFactory=WS});var Fc=Qe(Nc=>{"use strict";m();d();f();p();Object.defineProperty(Nc,"__esModule",{value:!0});var KS=ip(),YS=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=KS.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,i=t*Math.pow(r,n);return Math.min(i,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();Nc.Delay=YS});var op=Qe(zt=>{"use strict";m();d();f();p();var XS=zt&&zt.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),JS=zt&&zt.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{u(n.next(h))}catch(v){s(v)}}function c(h){try{u(n.throw(h))}catch(v){s(v)}}function u(h){h.done?o(h.value):i(h.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},ZS=zt&&zt.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,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(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(zt,"__esModule",{value:!0});var eA=Fc(),tA=function(e){XS(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return JS(this,void 0,void 0,function(){return ZS(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}(eA.Delay);zt.SkipFirstDelay=tA});var sp=Qe(ki=>{"use strict";m();d();f();p();var rA=ki&&ki.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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(ki,"__esModule",{value:!0});var nA=Fc(),iA=function(e){rA(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(nA.Delay);ki.AlwaysDelay=iA});var ap=Qe(Dc=>{"use strict";m();d();f();p();Object.defineProperty(Dc,"__esModule",{value:!0});var oA=op(),sA=sp();function aA(e,t){var r=cA(e);return r.setAttemptNumber(t),r}Dc.DelayFactory=aA;function cA(e){return e.delayFirstAttempt?new sA.AlwaysDelay(e):new oA.SkipFirstDelay(e)}});var cp=Qe(_r=>{"use strict";m();d();f();p();var Mc=_r&&_r.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{u(n.next(h))}catch(v){s(v)}}function c(h){try{u(n.throw(h))}catch(v){s(v)}}function u(h){h.done?o(h.value):i(h.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},jc=_r&&_r.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,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(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(_r,"__esModule",{value:!0});var uA=tp(),lA=ap();function dA(e,t){return t===void 0&&(t={}),Mc(this,void 0,void 0,function(){var r,n;return jc(this,function(i){switch(i.label){case 0:return r=uA.getSanitizedOptions(t),n=new pA(e,r),[4,n.execute()];case 1:return[2,i.sent()]}})})}_r.backOff=dA;var pA=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return Mc(this,void 0,void 0,function(){var t,r;return jc(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 Mc(this,void 0,void 0,function(){var t;return jc(this,function(r){switch(r.label){case 0:return t=lA.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var qs=Qe((cl,ul)=>{"use strict";m();d();f();p();(function(e,t){typeof cl=="object"&&typeof ul<"u"?ul.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs=t()})(cl,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",i="second",o="minute",s="hour",a="day",c="week",u="month",h="quarter",v="year",S="date",g="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|Y{1,4}|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,E={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(G){var V=["th","st","nd","rd"],U=G%100;return"["+G+(V[(U-20)%10]||V[U]||V[0])+"]"}},x=function(G,V,U){var $=String(G);return!$||$.length>=V?G:""+Array(V+1-$.length).join(U)+G},I={s:x,z:function(G){var V=-G.utcOffset(),U=Math.abs(V),$=Math.floor(U/60),B=U%60;return(V<=0?"+":"-")+x($,2,"0")+":"+x(B,2,"0")},m:function G(V,U){if(V.date()<U.date())return-G(U,V);var $=12*(U.year()-V.year())+(U.month()-V.month()),B=V.clone().add($,u),W=U-B<0,K=V.clone().add($+(W?-1:1),u);return+(-($+(U-B)/(W?B-K:K-B))||0)},a:function(G){return G<0?Math.ceil(G)||0:Math.floor(G)},p:function(G){return{M:u,y:v,w:c,d:a,D:S,h:s,m:o,s:i,ms:n,Q:h}[G]||String(G||"").toLowerCase().replace(/s$/,"")},u:function(G){return G===void 0}},T="en",_={};_[T]=E;var M="$isDayjsObject",P=function(G){return G instanceof L||!(!G||!G[M])},k=function G(V,U,$){var B;if(!V)return T;if(typeof V=="string"){var W=V.toLowerCase();_[W]&&(B=W),U&&(_[W]=U,B=W);var K=V.split("-");if(!B&&K.length>1)return G(K[0])}else{var ee=V.name;_[ee]=V,B=ee}return!$&&B&&(T=B),B||!$&&T},O=function(G,V){if(P(G))return G.clone();var U=typeof V=="object"?V:{};return U.date=G,U.args=arguments,new L(U)},F=I;F.l=k,F.i=P,F.w=function(G,V){return O(G,{locale:V.$L,utc:V.$u,x:V.$x,$offset:V.$offset})};var L=function(){function G(U){this.$L=k(U.locale,null,!0),this.parse(U),this.$x=this.$x||U.x||{},this[M]=!0}var V=G.prototype;return V.parse=function(U){this.$d=function($){var B=$.date,W=$.utc;if(B===null)return new Date(NaN);if(F.u(B))return new Date;if(B instanceof Date)return new Date(B);if(typeof B=="string"&&!/Z$/i.test(B)){var K=B.match(y);if(K){var ee=K[2]-1||0,ue=(K[7]||"0").substring(0,3);return W?new Date(Date.UTC(K[1],ee,K[3]||1,K[4]||0,K[5]||0,K[6]||0,ue)):new Date(K[1],ee,K[3]||1,K[4]||0,K[5]||0,K[6]||0,ue)}}return new Date(B)}(U),this.init()},V.init=function(){var U=this.$d;this.$y=U.getFullYear(),this.$M=U.getMonth(),this.$D=U.getDate(),this.$W=U.getDay(),this.$H=U.getHours(),this.$m=U.getMinutes(),this.$s=U.getSeconds(),this.$ms=U.getMilliseconds()},V.$utils=function(){return F},V.isValid=function(){return this.$d.toString()!==g},V.isSame=function(U,$){var B=O(U);return this.startOf($)<=B&&B<=this.endOf($)},V.isAfter=function(U,$){return O(U)<this.startOf($)},V.isBefore=function(U,$){return this.endOf($)<O(U)},V.$g=function(U,$,B){return F.u(U)?this[$]:this.set(B,U)},V.unix=function(){return Math.floor(this.valueOf()/1e3)},V.valueOf=function(){return this.$d.getTime()},V.startOf=function(U,$){var B=this,W=!!F.u($)||$,K=F.p(U),ee=function(Ae,ke){var je=F.w(B.$u?Date.UTC(B.$y,ke,Ae):new Date(B.$y,ke,Ae),B);return W?je:je.endOf(a)},ue=function(Ae,ke){return F.w(B.toDate()[Ae].apply(B.toDate("s"),(W?[0,0,0,0]:[23,59,59,999]).slice(ke)),B)},he=this.$W,ce=this.$M,le=this.$D,ae="set"+(this.$u?"UTC":"");switch(K){case v:return W?ee(1,0):ee(31,11);case u:return W?ee(1,ce):ee(0,ce+1);case c:var pe=this.$locale().weekStart||0,Ne=(he<pe?he+7:he)-pe;return ee(W?le-Ne:le+(6-Ne),ce);case a:case S:return ue(ae+"Hours",0);case s:return ue(ae+"Minutes",1);case o:return ue(ae+"Seconds",2);case i:return ue(ae+"Milliseconds",3);default:return this.clone()}},V.endOf=function(U){return this.startOf(U,!1)},V.$set=function(U,$){var B,W=F.p(U),K="set"+(this.$u?"UTC":""),ee=(B={},B[a]=K+"Date",B[S]=K+"Date",B[u]=K+"Month",B[v]=K+"FullYear",B[s]=K+"Hours",B[o]=K+"Minutes",B[i]=K+"Seconds",B[n]=K+"Milliseconds",B)[W],ue=W===a?this.$D+($-this.$W):$;if(W===u||W===v){var he=this.clone().set(S,1);he.$d[ee](ue),he.init(),this.$d=he.set(S,Math.min(this.$D,he.daysInMonth())).$d}else ee&&this.$d[ee](ue);return this.init(),this},V.set=function(U,$){return this.clone().$set(U,$)},V.get=function(U){return this[F.p(U)]()},V.add=function(U,$){var B,W=this;U=Number(U);var K=F.p($),ee=function(ce){var le=O(W);return F.w(le.date(le.date()+Math.round(ce*U)),W)};if(K===u)return this.set(u,this.$M+U);if(K===v)return this.set(v,this.$y+U);if(K===a)return ee(1);if(K===c)return ee(7);var ue=(B={},B[o]=t,B[s]=r,B[i]=e,B)[K]||1,he=this.$d.getTime()+U*ue;return F.w(he,this)},V.subtract=function(U,$){return this.add(-1*U,$)},V.format=function(U){var $=this,B=this.$locale();if(!this.isValid())return B.invalidDate||g;var W=U||"YYYY-MM-DDTHH:mm:ssZ",K=F.z(this),ee=this.$H,ue=this.$m,he=this.$M,ce=B.weekdays,le=B.months,ae=B.meridiem,pe=function(ke,je,nt,mt){return ke&&(ke[je]||ke($,W))||nt[je].slice(0,mt)},Ne=function(ke){return F.s(ee%12||12,ke,"0")},Ae=ae||function(ke,je,nt){var mt=ke<12?"AM":"PM";return nt?mt.toLowerCase():mt};return W.replace(C,function(ke,je){return je||function(nt){switch(nt){case"YY":return String($.$y).slice(-2);case"YYYY":return F.s($.$y,4,"0");case"M":return he+1;case"MM":return F.s(he+1,2,"0");case"MMM":return pe(B.monthsShort,he,le,3);case"MMMM":return pe(le,he);case"D":return $.$D;case"DD":return F.s($.$D,2,"0");case"d":return String($.$W);case"dd":return pe(B.weekdaysMin,$.$W,ce,2);case"ddd":return pe(B.weekdaysShort,$.$W,ce,3);case"dddd":return ce[$.$W];case"H":return String(ee);case"HH":return F.s(ee,2,"0");case"h":return Ne(1);case"hh":return Ne(2);case"a":return Ae(ee,ue,!0);case"A":return Ae(ee,ue,!1);case"m":return String(ue);case"mm":return F.s(ue,2,"0");case"s":return String($.$s);case"ss":return F.s($.$s,2,"0");case"SSS":return F.s($.$ms,3,"0");case"Z":return K}return null}(ke)||K.replace(":","")})},V.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},V.diff=function(U,$,B){var W,K=this,ee=F.p($),ue=O(U),he=(ue.utcOffset()-this.utcOffset())*t,ce=this-ue,le=function(){return F.m(K,ue)};switch(ee){case v:W=le()/12;break;case u:W=le();break;case h:W=le()/3;break;case c:W=(ce-he)/6048e5;break;case a:W=(ce-he)/864e5;break;case s:W=ce/r;break;case o:W=ce/t;break;case i:W=ce/e;break;default:W=ce}return B?W:F.a(W)},V.daysInMonth=function(){return this.endOf(u).$D},V.$locale=function(){return _[this.$L]},V.locale=function(U,$){if(!U)return this.$L;var B=this.clone(),W=k(U,$,!0);return W&&(B.$L=W),B},V.clone=function(){return F.w(this.$d,this)},V.toDate=function(){return new Date(this.valueOf())},V.toJSON=function(){return this.isValid()?this.toISOString():null},V.toISOString=function(){return this.$d.toISOString()},V.toString=function(){return this.$d.toUTCString()},G}(),Q=L.prototype;return O.prototype=Q,[["$ms",n],["$s",i],["$m",o],["$H",s],["$W",a],["$M",u],["$y",v],["$D",S]].forEach(function(G){Q[G[1]]=function(V){return this.$g(V,G[0],G[1])}}),O.extend=function(G,V){return G.$i||(G(V,L,O),G.$i=!0),O},O.locale=k,O.isDayjs=P,O.unix=function(G){return O(1e3*G)},O.en=_[T],O.Ls=_,O.p={},O})});var cg=Qe((ll,dl)=>{"use strict";m();d();f();p();(function(e,t){typeof ll=="object"&&typeof dl<"u"?dl.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_quarterOfYear=t()})(ll,function(){"use strict";var e="month",t="quarter";return function(r,n){var i=n.prototype;i.quarter=function(a){return this.$utils().u(a)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(a-1))};var o=i.add;i.add=function(a,c){return a=Number(a),this.$utils().p(c)===t?this.add(3*a,e):o.bind(this)(a,c)};var s=i.startOf;i.startOf=function(a,c){var u=this.$utils(),h=!!u.u(c)||c;if(u.p(a)===t){var v=this.quarter()-1;return h?this.month(3*v).startOf(e).startOf("day"):this.month(3*v+2).endOf(e).endOf("day")}return s.bind(this)(a,c)}}})});var ug=Qe((pl,fl)=>{"use strict";m();d();f();p();(function(e,t){typeof pl=="object"&&typeof fl<"u"?fl.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_customParseFormat=t()})(pl,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/,i=/\d\d?/,o=/\d*[^-_:/,()\s\d]+/,s={},a=function(y){return(y=+y)+(y>68?1900:2e3)},c=function(y){return function(C){this[y]=+C}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(C){if(!C||C==="Z")return 0;var E=C.match(/([+-]|\d\d)/g),x=60*E[1]+(+E[2]||0);return x===0?0:E[0]==="+"?-x:x}(y)}],h=function(y){var C=s[y];return C&&(C.indexOf?C:C.s.concat(C.f))},v=function(y,C){var E,x=s.meridiem;if(x){for(var I=1;I<=24;I+=1)if(y.indexOf(x(I,0,C))>-1){E=I>12;break}}else E=y===(C?"pm":"PM");return E},S={A:[o,function(y){this.afternoon=v(y,!1)}],a:[o,function(y){this.afternoon=v(y,!0)}],Q:[r,function(y){this.month=3*(y-1)+1}],S:[r,function(y){this.milliseconds=100*+y}],SS:[n,function(y){this.milliseconds=10*+y}],SSS:[/\d{3}/,function(y){this.milliseconds=+y}],s:[i,c("seconds")],ss:[i,c("seconds")],m:[i,c("minutes")],mm:[i,c("minutes")],H:[i,c("hours")],h:[i,c("hours")],HH:[i,c("hours")],hh:[i,c("hours")],D:[i,c("day")],DD:[n,c("day")],Do:[o,function(y){var C=s.ordinal,E=y.match(/\d+/);if(this.day=E[0],C)for(var x=1;x<=31;x+=1)C(x).replace(/\[|\]/g,"")===y&&(this.day=x)}],w:[i,c("week")],ww:[n,c("week")],M:[i,c("month")],MM:[n,c("month")],MMM:[o,function(y){var C=h("months"),E=(h("monthsShort")||C.map(function(x){return x.slice(0,3)})).indexOf(y)+1;if(E<1)throw new Error;this.month=E%12||E}],MMMM:[o,function(y){var C=h("months").indexOf(y)+1;if(C<1)throw new Error;this.month=C%12||C}],Y:[/[+-]?\d+/,c("year")],YY:[n,function(y){this.year=a(y)}],YYYY:[/\d{4}/,c("year")],Z:u,ZZ:u};function g(y){var C,E;C=y,E=s&&s.formats;for(var x=(y=C.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(O,F,L){var Q=L&&L.toUpperCase();return F||E[L]||e[L]||E[Q].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(G,V,U){return V||U.slice(1)})})).match(t),I=x.length,T=0;T<I;T+=1){var _=x[T],M=S[_],P=M&&M[0],k=M&&M[1];x[T]=k?{regex:P,parser:k}:_.replace(/^\[|\]$/g,"")}return function(O){for(var F={},L=0,Q=0;L<I;L+=1){var G=x[L];if(typeof G=="string")Q+=G.length;else{var V=G.regex,U=G.parser,$=O.slice(Q),B=V.exec($)[0];U.call(F,B),O=O.replace(B,"")}}return function(W){var K=W.afternoon;if(K!==void 0){var ee=W.hours;K?ee<12&&(W.hours+=12):ee===12&&(W.hours=0),delete W.afternoon}}(F),F}}return function(y,C,E){E.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(a=y.parseTwoDigitYear);var x=C.prototype,I=x.parse;x.parse=function(T){var _=T.date,M=T.utc,P=T.args;this.$u=M;var k=P[1];if(typeof k=="string"){var O=P[2]===!0,F=P[3]===!0,L=O||F,Q=P[2];F&&(Q=P[2]),s=this.$locale(),!O&&Q&&(s=E.Ls[Q]),this.$d=function($,B,W,K){try{if(["x","X"].indexOf(B)>-1)return new Date((B==="X"?1e3:1)*$);var ee=g(B)($),ue=ee.year,he=ee.month,ce=ee.day,le=ee.hours,ae=ee.minutes,pe=ee.seconds,Ne=ee.milliseconds,Ae=ee.zone,ke=ee.week,je=new Date,nt=ce||(ue||he?1:je.getDate()),mt=ue||je.getFullYear(),sr=0;ue&&!he||(sr=he>0?he-1:je.getMonth());var yn,vn=le||0,Ci=ae||0,Ac=pe||0,bc=Ne||0;return Ae?new Date(Date.UTC(mt,sr,nt,vn,Ci,Ac,bc+60*Ae.offset*1e3)):W?new Date(Date.UTC(mt,sr,nt,vn,Ci,Ac,bc)):(yn=new Date(mt,sr,nt,vn,Ci,Ac,bc),ke&&(yn=K(yn).week(ke).toDate()),yn)}catch{return new Date("")}}(_,k,M,E),this.init(),Q&&Q!==!0&&(this.$L=this.locale(Q).$L),L&&_!=this.format(k)&&(this.$d=new Date("")),s={}}else if(k instanceof Array)for(var G=k.length,V=1;V<=G;V+=1){P[1]=k[V-1];var U=E.apply(this,P);if(U.isValid()){this.$d=U.$d,this.$L=U.$L,this.init();break}V===G&&(this.$d=new Date(""))}else I.call(this,T)}}})});var Yg=Qe((_l,kl)=>{"use strict";m();d();f();p();(function(e,t){typeof _l=="object"&&typeof kl<"u"?kl.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_timezone=t()})(_l,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,i){var o,s=function(h,v,S){S===void 0&&(S={});var g=new Date(h),y=function(C,E){E===void 0&&(E={});var x=E.timeZoneName||"short",I=C+"|"+x,T=t[I];return T||(T=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:C,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:x}),t[I]=T),T}(v,S);return y.formatToParts(g)},a=function(h,v){for(var S=s(h,v),g=[],y=0;y<S.length;y+=1){var C=S[y],E=C.type,x=C.value,I=e[E];I>=0&&(g[I]=parseInt(x,10))}var T=g[3],_=T===24?0:T,M=g[0]+"-"+g[1]+"-"+g[2]+" "+_+":"+g[4]+":"+g[5]+":000",P=+h;return(i.utc(M).valueOf()-(P-=P%1e3))/6e4},c=n.prototype;c.tz=function(h,v){h===void 0&&(h=o);var S,g=this.utcOffset(),y=this.toDate(),C=y.toLocaleString("en-US",{timeZone:h}),E=Math.round((y-new Date(C))/1e3/60),x=15*-Math.round(y.getTimezoneOffset()/15)-E;if(!Number(x))S=this.utcOffset(0,v);else if(S=i(C,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(x,!0),v){var I=S.utcOffset();S=S.add(g-I,"minute")}return S.$x.$timezone=h,S},c.offsetName=function(h){var v=this.$x.$timezone||i.tz.guess(),S=s(this.valueOf(),v,{timeZoneName:h}).find(function(g){return g.type.toLowerCase()==="timezonename"});return S&&S.value};var u=c.startOf;c.startOf=function(h,v){if(!this.$x||!this.$x.$timezone)return u.call(this,h,v);var S=i(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return u.call(S,h,v).tz(this.$x.$timezone,!0)},i.tz=function(h,v,S){var g=S&&v,y=S||v||o,C=a(+i(),y);if(typeof h!="string")return i(h).tz(y);var E=function(_,M,P){var k=_-60*M*1e3,O=a(k,P);if(M===O)return[k,M];var F=a(k-=60*(O-M)*1e3,P);return O===F?[k,O]:[_-60*Math.min(O,F)*1e3,Math.max(O,F)]}(i.utc(h,g).valueOf(),C,y),x=E[0],I=E[1],T=i(x).utcOffset(I);return T.$x.$timezone=y,T},i.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},i.tz.setDefault=function(h){o=h}}})});var Xg=Qe((Ol,Pl)=>{"use strict";m();d();f();p();(function(e,t){typeof Ol=="object"&&typeof Pl<"u"?Pl.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_utc=t()})(Ol,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,i,o){var s=i.prototype;o.utc=function(g){var y={date:g,utc:!0,args:arguments};return new i(y)},s.utc=function(g){var y=o(this.toDate(),{locale:this.$L,utc:!0});return g?y.add(this.utcOffset(),e):y},s.local=function(){return o(this.toDate(),{locale:this.$L,utc:!1})};var a=s.parse;s.parse=function(g){g.utc&&(this.$u=!0),this.$utils().u(g.$offset)||(this.$offset=g.$offset),a.call(this,g)};var c=s.init;s.init=function(){if(this.$u){var g=this.$d;this.$y=g.getUTCFullYear(),this.$M=g.getUTCMonth(),this.$D=g.getUTCDate(),this.$W=g.getUTCDay(),this.$H=g.getUTCHours(),this.$m=g.getUTCMinutes(),this.$s=g.getUTCSeconds(),this.$ms=g.getUTCMilliseconds()}else c.call(this)};var u=s.utcOffset;s.utcOffset=function(g,y){var C=this.$utils().u;if(C(g))return this.$u?0:C(this.$offset)?u.call(this):this.$offset;if(typeof g=="string"&&(g=function(T){T===void 0&&(T="");var _=T.match(t);if(!_)return null;var M=(""+_[0]).match(r)||["-",0,0],P=M[0],k=60*+M[1]+ +M[2];return k===0?0:P==="+"?k:-k}(g),g===null))return this;var E=Math.abs(g)<=16?60*g:g,x=this;if(y)return x.$offset=E,x.$u=g===0,x;if(g!==0){var I=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(x=this.local().add(E+I,e)).$offset=E,x.$x.$localOffset=I}else x=this.utc();return x};var h=s.format;s.format=function(g){var y=g||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,y)},s.valueOf=function(){var g=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*g},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(g){return g==="s"&&this.$offset?o(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var S=s.diff;s.diff=function(g,y,C){if(g&&this.$u===g.$u)return S.call(this,g,y,C);var E=this.local(),x=o(g).local();return S.call(E,x,y,C)}}})});var wv=Qe(($ie,bv)=>{"use strict";m();d();f();p();function O_(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}bv.exports=P_;function P_(e,t,r){var n=r&&r.stringify||O_,i=1;if(typeof e=="object"&&e!==null){var o=t.length+i;if(o===1)return e;var s=new Array(o);s[0]=n(e);for(var a=1;a<o;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="",h=1-i,v=-1,S=e&&e.length||0,g=0;g<S;){if(e.charCodeAt(g)===37&&g+1<S){switch(v=v>-1?v:0,e.charCodeAt(g+1)){case 100:case 102:if(h>=c||t[h]==null)break;v<g&&(u+=e.slice(v,g)),u+=Number(t[h]),v=g+2,g++;break;case 105:if(h>=c||t[h]==null)break;v<g&&(u+=e.slice(v,g)),u+=Math.floor(Number(t[h])),v=g+2,g++;break;case 79:case 111:case 106:if(h>=c||t[h]===void 0)break;v<g&&(u+=e.slice(v,g));var y=typeof t[h];if(y==="string"){u+="'"+t[h]+"'",v=g+2,g++;break}if(y==="function"){u+=t[h].name||"<anonymous>",v=g+2,g++;break}u+=n(t[h]),v=g+2,g++;break;case 115:if(h>=c)break;v<g&&(u+=e.slice(v,g)),u+=String(t[h]),v=g+2,g++;break;case 37:v<g&&(u+=e.slice(v,g)),u+="%",v=g+2,g++,h--;break}++h}++g}return v===-1?e:(v<S&&(u+=e.slice(v)),u)}});var Tv=Qe((Kie,pc)=>{"use strict";m();d();f();p();var Cv=wv();pc.exports=ir;var Eo=z_().console||{},N_={mapHttpRequest:dc,mapHttpResponse:dc,wrapRequestSerializer:Id,wrapResponseSerializer:Id,wrapErrorSerializer:Id,req:dc,res:dc,err:Ev,errWithCause:Ev};function Rr(e,t){return e==="silent"?1/0:t.levels.values[e]}var kd=Symbol("pino.logFuncs"),Td=Symbol("pino.hierarchy"),F_={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function xv(e,t){let r={logger:t,parent:e[Td]};t[Td]=r}function D_(e,t,r){let n={};t.forEach(i=>{n[i]=r[i]?r[i]:Eo[i]||Eo[F_[i]||"log"]||Si}),e[kd]=n}function M_(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function ir(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||Eo;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},i=M_(e.browser.serialize,n),o=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(o=!1);let s=Object.keys(e.customLevels||{}),a=["error","fatal","warn","info","debug","trace"].concat(s);typeof r=="function"&&a.forEach(function(C){r[C]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let c=e.level||"info",u=Object.create(r);u.log||(u.log=Si),D_(u,a,r),xv({},u),Object.defineProperty(u,"levelVal",{get:v}),Object.defineProperty(u,"level",{get:S,set:g});let h={transmit:t,serialize:i,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:a,timestamp:$_(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Si};u.levels=j_(e),u.level=c,u.isLevelEnabled=function(C){return this.levels.values[C]?this.levels.values[C]>=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=Si,u.serializers=n,u._serialize=i,u._stdErrSerialize=o,u.child=function(...C){return y.call(this,h,...C)},t&&(u._logEvent=_d());function v(){return Rr(this.level,this)}function S(){return this._level}function g(C){if(C!=="silent"&&!this.levels.values[C])throw Error("unknown level "+C);this._level=C,gn(this,h,u,"error"),gn(this,h,u,"fatal"),gn(this,h,u,"warn"),gn(this,h,u,"info"),gn(this,h,u,"debug"),gn(this,h,u,"trace"),s.forEach(E=>{gn(this,h,u,E)})}function y(C,E,x){if(!E)throw new Error("missing bindings for child Pino");x=x||{},i&&E.serializers&&(x.serializers=E.serializers);let I=x.serializers;if(i&&I){var T=Object.assign({},n,I),_=e.browser.serialize===!0?Object.keys(T):i;delete E.serializers,Od([E],_,T,this._stdErrSerialize)}function M(k){this._childLevel=(k._childLevel|0)+1,this.bindings=E,T&&(this.serializers=T,this._serialize=_),t&&(this._logEvent=_d([].concat(k._logEvent.bindings,E)))}M.prototype=this;let P=new M(this);return xv(this,P),P.child=function(...k){return y.call(this,C,...k)},P.level=x.level||this.level,C.onChild(P),P}return u}function j_(e){let t=e.customLevels||{},r=Object.assign({},ir.levels.values,t),n=Object.assign({},ir.levels.labels,q_(t));return{values:r,labels:n}}function q_(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}ir.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"}};ir.stdSerializers=N_;ir.stdTimeFunctions=Object.assign({},{nullTime:Rv,epochTime:Iv,unixTime:Q_,isoTime:H_});function L_(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[Td];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function gn(e,t,r,n){if(Object.defineProperty(e,n,{value:Rr(e.level,r)>Rr(n,r)?Si:r[kd][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===Si){if(!t.transmit)return;let o=t.transmit.level||e.level,s=Rr(o,r);if(Rr(n,r)<s)return}e[n]=V_(e,t,r,n);let i=L_(e);i.length!==0&&(e[n]=U_(i,e[n]))}function U_(e,t){return function(){return t.apply(this,[...e,...arguments])}}function V_(e,t,r,n){return function(i){return function(){let s=t.timestamp(),a=new Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Eo?Eo:this;for(var u=0;u<a.length;u++)a[u]=arguments[u];var h=!1;if(t.serialize&&(Od(a,this._serialize,this.serializers,this._stdErrSerialize),h=!0),t.asObject||t.formatters?i.call(c,...B_(this,n,a,s,t)):i.apply(c,a),t.transmit){let v=t.transmit.level||e._level,S=Rr(v,r),g=Rr(n,r);if(g<S)return;G_(this,{ts:s,methodLevel:n,methodValue:g,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Rr(e._level,r)},a,h)}}}(e[kd][n])}function B_(e,t,r,n,i){let{level:o,log:s=v=>v}=i.formatters||{},a=r.slice(),c=a[0],u={},h=(e._childLevel|0)+1;if(h<1&&(h=1),n&&(u.time=n),o){let v=o(t,e.levels.values[t]);Object.assign(u,v)}else u.level=e.levels.values[t];if(i.asObjectBindingsOnly){if(c!==null&&typeof c=="object")for(;h--&&typeof a[0]=="object";)Object.assign(u,a.shift());return[s(u),...a]}else{if(c!==null&&typeof c=="object"){for(;h--&&typeof a[0]=="object";)Object.assign(u,a.shift());c=a.length?Cv(a.shift(),a):void 0}else typeof c=="string"&&(c=Cv(a.shift(),a));return c!==void 0&&(u[i.messageKey]=c),[s(u)]}}function Od(e,t,r,n){for(let i in e)if(n&&e[i]instanceof Error)e[i]=ir.stdSerializers.err(e[i]);else if(typeof e[i]=="object"&&!Array.isArray(e[i])&&t)for(let o in e[i])t.indexOf(o)>-1&&o in r&&(e[i][o]=r[o](e[i][o]))}function G_(e,t,r,n=!1){let i=t.send,o=t.ts,s=t.methodLevel,a=t.methodValue,c=t.val,u=e._logEvent.bindings;n||Od(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=o,e._logEvent.messages=r.filter(function(h){return u.indexOf(h)===-1}),e._logEvent.level.label=s,e._logEvent.level.value=a,i(s,e._logEvent,c),e._logEvent=_d(u)}function _d(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function Ev(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 $_(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?Rv:Iv}function dc(){return{}}function Id(e){return e}function Si(){}function Rv(){return!1}function Iv(){return Date.now()}function Q_(){return Math.round(Date.now()/1e3)}function H_(){return new Date(Date.now()).toISOString()}function z_(){function e(t){return typeof t<"u"&&t}try{return typeof A<"u"?A:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),A)}catch{return e(self)||e(window)||e(this)||{}}}pc.exports.default=ir;pc.exports.pino=ir});var vk={};Io(vk,{ResultTemplatesHelpers:()=>Cg,buildCaseAssistEngine:()=>Fv,buildCaseField:()=>Kv,buildCaseInput:()=>Yv,buildController:()=>Ht,buildDocumentSuggestion:()=>Nd,buildDocumentSuggestionList:()=>Nd,buildInteractiveResult:()=>Jv,buildQuickview:()=>rS,getAnalyticsNextApiBaseUrl:()=>Po,getOrganizationEndpoint:()=>qe,loadCaseAssistAnalyticsActions:()=>mk,loadCaseFieldActions:()=>gk,loadCaseInputActions:()=>hk,loadDocumentSuggestionActions:()=>yk,loadGenericAnalyticsActions:()=>fk});module.exports=pS(vk);m();d();f();p();m();d();f();p();var hp=Ct(cp(),1);m();d();f();p();var gt=new Error("Failed to load reducers."),bn=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."}},kr=class extends Error{constructor(r,n){super();we(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 up(e){return Array.isArray(e)}function lp(e,t){return[...e.reduce((r,n)=>{let i=t(n);return r.has(i)||r.set(i,n),r},new Map).values()]}var fA=new Set(["1",1,"yes",!0]);function dp(){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=>fA.has(r))}function pp(e){let t={};for(let[r,n]of e)t[r]=n;return t}function Oi(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Oo(e,t,r={}){let n;return(...i)=>{let o=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,i)},t),o)return e.apply(void 0,i)}}m();d();f();p();function fp(e){let t=[];for(let r in e){let n=encodeURIComponent(r),i=encodeURIComponent(e[r]);t.push(`${n}=${i}`)}return t.join("&")}function mp(e){return typeof e!="object"||!e?!1:Object.values(e).every(mA)}function mA(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function gp(e){return e===429}var ar=class e{static call(t){return _asyncToGenerator(function*(){let r=gA(t),{logger:n}=t,i=yield e.preprocessRequest(r,t);n.info(i,"Platform request");let{url:o,...s}=i,a=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let c=yield b(o,s);if(gp(c.status))throw c;return c});return function a(){return _ref.apply(this,arguments)}}();try{let c=yield(0,hp.backOff)(a,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(u){let h=u&&gp(u.status);return h&&(n.info("Platform retrying request"),yield new Promise(v=>setTimeout(v,1e3))),h});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(c.status){case 419:case 401:throw n.info("Platform renewing token"),new bn;case 404:throw new kr(o,c.status);default:return n.info({response:c,requestInfo:i},"Platform response"),c}}catch(c){return c.message==="Failed to fetch"?new kr(o):c}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:i,logger:o,requestMetadata:s}=r,{signal:a,...c}=t,u=Oi(c);try{let h=yield i(t,n,s);return{...t,...h}}catch(h){o.error(h,"Platform request preprocessing failed. Returning default request options.")}return u})()}};function qe(e,t="prod",r="platform"){let n=t==="prod"?"":t,i=r==="platform"?"":`.${r}`;return`https://${e}${i}.org${n}.coveo.com`}function wn(e,t="prod"){return`${qe(e,t)}/rest/search/v2`}function Po(e,t="prod"){return`${qe(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function gA(e){let{url:t,method:r,requestParams:n,contentType:i,accessToken:o,signal:s}=e,a=e.method==="POST"||e.method==="PUT",c=hA(n,i);return{url:t,method:r,headers:{"Content-Type":i,Authorization:`Bearer ${o}`,...e.headers},...(a&&{body:c}),signal:s}}function hA(e,t){return t==="application/x-www-form-urlencoded"?mp(e)?fp(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();function yA(e,t){let r=`
|
|
20
20
|
The following properties are invalid:
|
|
21
21
|
|
|
22
22
|
${e.join(`
|
|
23
23
|
`)}
|
|
24
24
|
|
|
25
25
|
${t}
|
|
26
|
-
`;return new Yc(r)}var Yc=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},xt=class{constructor(e){this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let i in this.definition){let o=this.definition[i].validate(r[i]);o&&n.push(`${i}: ${o}`)}if(n.length)throw $A(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}},Nr=class{constructor(e={}){this.baseConfig=e}validate(e){return this.baseConfig.required&&ie(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 kn(e){return e===void 0}function QA(e){return e===null}function ie(e){return kn(e)||QA(e)}var De=class{constructor(e={}){be(this,"value");this.value=new Nr(e)}validate(e){let t=this.value.validate(e);return t||(HA(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function HA(e){return kn(e)||_p(e)}function _p(e){return typeof e=="boolean"}var Le=class{constructor(e={}){be(this,"value");this.config=e,this.value=new Nr(e)}validate(e){let t=this.value.validate(e);return t||(zA(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 zA(e){return kn(e)||kp(e)}function kp(e){return typeof e=="number"&&!Number.isNaN(e)}var WA=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,J=class{constructor(e={}){be(this,"value");be(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Nr(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:i,ISODate:o}=this.config,s=this.value.validate(e);if(s)return s;if(kn(e))return null;if(!Op(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}`:i&&!i.includes(e)?`value should be one of: ${i.join(", ")}.`:o&&!(WA.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 Op(e){return Object.prototype.toString.call(e)==="[object String]"}var xe=class{constructor(e={}){be(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(kn(e))return this.config.options.required?"value is required and is currently undefined":null;if(!Pp(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ie(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let i=e[r],o=n.validate(i);o!==null&&(t+=` ${o}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function Pp(e){return e!==void 0&&typeof e=="object"}var Et=class{constructor(e={}){be(this,"value");this.config=e,this.value=new Nr(this.config)}validate(e){if(!ie(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ie(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&&ie(n)&&(r=`value is null or undefined: ${e.join(",")}`);let i=this.validatePrimitiveValue(n,this.config.each);i!==null&&(r+=` ${i}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return _p(e)||Op(e)||kp(e)||Pp(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Np(e){return Array.isArray(e)}var Xc=class{constructor(e){be(this,"value");this.config=e,this.value=new Nr(e)}validate(e){let t=this.value.validate(e);return t!==null?t:kn(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 qo=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();var On=class{constructor(t){be(this,"_basePath");be(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 Jc(e){let{url:t,accessToken:r,organizationId:n,authentication:i,...o}=e;return o}var Zc=e=>{let{response:t}=e;return t.body?KA(e):YA(t)},KA=e=>JA(e)?ZA(e):XA(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},YA=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function XA(e){return e.body.statusCode!==void 0}function JA(e){return e.body.exception!==void 0}var ZA=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();function Fp(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var eu=(e,t,r,n)=>{let i=new On(`${e.url}${n}`);return i.addParam("organizationId",e.organizationId),e.authentication&&i.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:i.href,origin:"searchApiFetch"}};var Dp=(e,t)=>{let r=new On(`${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},tu=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield cr.call({...eu(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Jc(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Fp(r),i=yield r.arrayBuffer(),s=new TextDecoder(n).decode(i);return ew(s)?{success:s}:{error:Zc({response:r,body:s})}});return function tu(_x3,_x4){return _ref3.apply(this,arguments)}}();function ew(e){return typeof e=="string"}m();d();f();p();function tw(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function rw(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Lo(e,t){if(t&&e.name==="AbortError")return{error:rw(e)};if(e instanceof Pr)return{error:tw(e)};throw e}m();d();f();p();m();d();f();p();var Uo=(e,t,r,n,i={})=>{nw(e);let o=`${e.url}/rest/organizations/${e.organizationId}/caseassists/${e.caseAssistId}${n}`,s=iw(i),a=s?`${o}?${s}`:o;return{accessToken:e.accessToken,method:t,contentType:r,url:a,origin:"caseAssistApiFetch"}},Vo=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r],t),{}),Go=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r].value,t),{}),nw=e=>{if(!e.url)throw new Error("The 'url' attribute must contain a valid platform URL.");if(!e.organizationId)throw new Error("The 'organizationId' attribute must contain a valid organization ID.");if(!e.accessToken)throw new Error("The 'accessToken' attribute must contain a valid platform access token.");if(!e.caseAssistId)throw new Error("The 'caseAssistId' attribute must contain a valid Case Assist configuration ID.")},iw=e=>Object.keys(e).map(t=>`${t}=${encodeURIComponent(e[t])}`).join("&");var Mp=e=>{let t=e.debug?{debug:"1"}:{};return{...Uo(e,"POST","application/json","/classify",t),requestParams:ow(e)}},ow=e=>({clientId:e.clientId,locale:e.locale,fields:Vo(e.fields)});m();d();f();p();var jp=e=>{let t={};return e.debug&&(t.debug="1"),e.numberOfResults&&(t.numberOfResults=e.numberOfResults.toString()),{...Uo(e,"POST","application/json","/documents/suggest",t),requestParams:sw(e)}},sw=e=>({clientId:e.clientId,locale:e.locale,fields:Vo(e.fields),context:e.context,analytics:e.analytics});var Bo=class{constructor(t){this.options=t}getCaseClassifications(t){var _this=this;return _asyncToGenerator(function*(){let r=yield cr.call({...Mp(t),..._this.options});if(r instanceof Error)return Lo(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}getDocumentSuggestions(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield cr.call({...jp(t),..._this2.options});if(r instanceof Error)return Lo(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this3=this;return _asyncToGenerator(function*(){return tu(t,_this3.options)})()}};m();d();f();p();m();d();f();p();m();d();f();p();function He(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 aw=typeof Symbol=="function"&&Symbol.observable||"@@observable",qp=aw,ru=()=>Math.random().toString(36).substring(7).split("").join("."),cw={INIT:`@@redux/INIT${ru()}`,REPLACE:`@@redux/REPLACE${ru()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ru()}`},$o=cw;function Pt(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 nu(e,t,r){if(typeof e!="function")throw new Error(He(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(He(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(He(1));return r(nu)(e,t)}let n=e,i=t,o=new Map,s=o,a=0,c=!1;function u(){s===o&&(s=new Map,o.forEach((E,x)=>{s.set(x,E)}))}function h(){if(c)throw new Error(He(3));return i}function v(E){if(typeof E!="function")throw new Error(He(4));if(c)throw new Error(He(5));let x=!0;u();let R=a++;return s.set(R,E),function(){if(x){if(c)throw new Error(He(6));x=!1,u(),s.delete(R),o=null}}}function S(E){if(!Pt(E))throw new Error(He(7));if(typeof E.type>"u")throw new Error(He(8));if(typeof E.type!="string")throw new Error(He(17));if(c)throw new Error(He(9));try{c=!0,i=n(i,E)}finally{c=!1}return(o=s).forEach(R=>{R()}),E}function g(E){if(typeof E!="function")throw new Error(He(10));n=E,S({type:$o.REPLACE})}function y(){let E=v;return{subscribe(x){if(typeof x!="object"||x===null)throw new Error(He(11));function R(){let _=x;_.next&&_.next(h())}return R(),{unsubscribe:E(R)}},[qp](){return this}}}return S({type:$o.INIT}),{dispatch:S,subscribe:v,getState:h,replaceReducer:g,[qp]:y}}function uw(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:$o.INIT})>"u")throw new Error(He(12));if(typeof r(void 0,{type:$o.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(He(13))})}function Pn(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),i,o;try{uw(r)}catch(s){o=s}return function(a={},c){if(o)throw o;let u=!1,h={};for(let v=0;v<n.length;v++){let S=n[v],g=r[S],y=a[S],C=g(y,c);if(typeof C>"u"){let E=c&&c.type;throw new Error(He(14))}h[S]=C,u=u||C!==y}return u=u||n.length!==Object.keys(a).length,u?h:a}}function Nn(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Lp(...e){return t=>(r,n)=>{let i=t(r,n),o=()=>{throw new Error(He(15))},s={getState:i.getState,dispatch:(c,...u)=>o(c,...u)},a=e.map(c=>c(s));return o=Nn(...a)(i.dispatch),{...i,dispatch:o}}}function Fn(e){return Pt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var fu=Symbol.for("immer-nothing"),Vi=Symbol.for("immer-draftable"),it=Symbol.for("immer-state");function ze(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Dn=Object.getPrototypeOf;function dt(e){return!!e&&!!e[it]}function ot(e){return e?Qp(e)||Array.isArray(e)||!!e[Vi]||!!e.constructor?.[Vi]||Mn(e)||zi(e):!1}var lw=Object.prototype.constructor.toString(),Up=new WeakMap;function Qp(e){if(!e||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=Up.get(r);return n===void 0&&(n=Function.toString.call(r),Up.set(r,n)),n===lw}function mu(e){return dt(e)||ze(15,e),e[it].base_}function Gi(e,t,r=!0){Dr(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function Dr(e){let t=e[it];return t?t.type_:Array.isArray(e)?1:Mn(e)?2:zi(e)?3:0}function Bi(e,t){return Dr(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function iu(e,t){return Dr(e)===2?e.get(t):e[t]}function Hp(e,t,r){let n=Dr(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function dw(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Mn(e){return e instanceof Map}function zi(e){return e instanceof Set}function Fr(e){return e.copy_||e.base_}function au(e,t){if(Mn(e))return new Map(e);if(zi(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=Qp(e);if(t===!0||t==="class_only"&&!r){let n=Object.getOwnPropertyDescriptors(e);delete n[it];let i=Reflect.ownKeys(n);for(let o=0;o<i.length;o++){let s=i[o],a=n[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(n[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(Dn(e),n)}else{let n=Dn(e);if(n!==null&&r)return{...e};let i=Object.create(n);return Object.assign(i,e)}}function Wo(e,t=!1){return Ko(e)||dt(e)||!ot(e)||(Dr(e)>1&&Object.defineProperties(e,{set:Qo,add:Qo,clear:Qo,delete:Qo}),Object.freeze(e),t&&Object.values(e).forEach(r=>Wo(r,!0))),e}function pw(){ze(2)}var Qo={value:pw};function Ko(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var cu={};function Mr(e){let t=cu[e];return t||ze(0,e),t}function fw(e,t){cu[e]||(cu[e]=t)}var $i;function zp(){return $i}function mw(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Vp(e,t){t&&(Mr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function uu(e){lu(e),e.drafts_.forEach(gw),e.drafts_=null}function lu(e){e===$i&&($i=e.parent_)}function Gp(e){return $i=mw($i,e)}function gw(e){let t=e[it];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Bp(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return e!==void 0&&e!==r?(r[it].modified_&&(uu(t),ze(4)),ot(e)&&(e=Ho(t,e),t.parent_||zo(t,e)),t.patches_&&Mr("Patches").generateReplacementPatches_(r[it].base_,e,t.patches_,t.inversePatches_)):e=Ho(t,r,[]),uu(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==fu?e:void 0}function Ho(e,t,r){if(Ko(t))return t;let n=e.immer_.shouldUseStrictIteration(),i=t[it];if(!i)return Gi(t,(o,s)=>$p(e,i,t,o,s,r),n),t;if(i.scope_!==e)return t;if(!i.modified_)return zo(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;let o=i.copy_,s=o,a=!1;i.type_===3&&(s=new Set(o),o.clear(),a=!0),Gi(s,(c,u)=>$p(e,i,o,c,u,r,a),n),zo(e,o,!1),r&&e.patches_&&Mr("Patches").generatePatches_(i,r,e.patches_,e.inversePatches_)}return i.copy_}function $p(e,t,r,n,i,o,s){if(i==null||typeof i!="object"&&!s)return;let a=Ko(i);if(!(a&&!s)){if(dt(i)){let c=o&&t&&t.type_!==3&&!Bi(t.assigned_,n)?o.concat(n):void 0,u=Ho(e,i,c);if(Hp(r,n,u),dt(u))e.canAutoFreeze_=!1;else return}else s&&r.add(i);if(ot(i)&&!a){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===i&&a)return;Ho(e,i),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(Mn(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&zo(e,i)}}}function zo(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Wo(t,r)}function hw(e,t){let r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:zp(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=n,o=gu;r&&(i=[n],o=Qi);let{revoke:s,proxy:a}=Proxy.revocable(i,o);return n.draft_=a,n.revoke_=s,a}var gu={get(e,t){if(t===it)return e;let r=Fr(e);if(!Bi(r,t))return yw(e,r,t);let n=r[t];return e.finalized_||!ot(n)?n:n===ou(e.base_,t)?(su(e),e.copy_[t]=pu(n,e)):n},has(e,t){return t in Fr(e)},ownKeys(e){return Reflect.ownKeys(Fr(e))},set(e,t,r){let n=Wp(Fr(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let i=ou(Fr(e),t),o=i?.[it];if(o&&o.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(dw(r,i)&&(r!==void 0||Bi(e.base_,t)))return!0;su(e),du(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return ou(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,su(e),du(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=Fr(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){ze(11)},getPrototypeOf(e){return Dn(e.base_)},setPrototypeOf(){ze(12)}},Qi={};Gi(gu,(e,t)=>{Qi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Qi.deleteProperty=function(e,t){return Qi.set.call(this,e,t,void 0)};Qi.set=function(e,t,r){return gu.set.call(this,e[0],t,r,e[0])};function ou(e,t){let r=e[it];return(r?Fr(r):e)[t]}function yw(e,t,r){let n=Wp(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}function Wp(e,t){if(!(t in e))return;let r=Dn(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Dn(r)}}function du(e){e.modified_||(e.modified_=!0,e.parent_&&du(e.parent_))}function su(e){e.copy_||(e.copy_=au(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var vw=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){let o=r;r=t;let s=this;return function(c=o,...u){return s.produce(c,h=>r.call(this,h,...u))}}typeof r!="function"&&ze(6),n!==void 0&&typeof n!="function"&&ze(7);let i;if(ot(t)){let o=Gp(this),s=pu(t,void 0),a=!0;try{i=r(s),a=!1}finally{a?uu(o):lu(o)}return Vp(o,n),Bp(i,o)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===fu&&(i=void 0),this.autoFreeze_&&Wo(i,!0),n){let o=[],s=[];Mr("Patches").generateReplacementPatches_(t,i,o,s),n(o,s)}return i}else ze(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let n,i;return[this.produce(t,r,(s,a)=>{n=s,i=a}),n,i]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ot(e)||ze(8),dt(e)&&(e=Kp(e));let t=Gp(this),r=pu(e,void 0);return r[it].isManual_=!0,lu(t),r}finishDraft(e,t){let r=e&&e[it];(!r||!r.isManual_)&&ze(9);let{scope_:n}=r;return Vp(n,t),Bp(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 i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));let n=Mr("Patches").applyPatches_;return dt(e)?n(e,t):this.produce(e,i=>n(i,t))}};function pu(e,t){let r=Mn(e)?Mr("MapSet").proxyMap_(e,t):zi(e)?Mr("MapSet").proxySet_(e,t):hw(e,t);return(t?t.scope_:zp()).drafts_.push(r),r}function Kp(e){return dt(e)||ze(10,e),Yp(e)}function Yp(e){if(!ot(e)||Ko(e))return e;let t=e[it],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=au(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=au(e,!0);return Gi(r,(i,o)=>{Hp(r,i,Yp(o))},n),t&&(t.finalized_=!1),r}function Xp(){let t="replace",r="add",n="remove";function i(S,g,y,C){switch(S.type_){case 0:case 2:return s(S,g,y,C);case 1:return o(S,g,y,C);case 3:return a(S,g,y,C)}}function o(S,g,y,C){let{base_:E,assigned_:x}=S,R=S.copy_;R.length<E.length&&([E,R]=[R,E],[y,C]=[C,y]);for(let T=0;T<E.length;T++)if(x[T]&&R[T]!==E[T]){let _=g.concat([T]);y.push({op:t,path:_,value:v(R[T])}),C.push({op:t,path:_,value:v(E[T])})}for(let T=E.length;T<R.length;T++){let _=g.concat([T]);y.push({op:r,path:_,value:v(R[T])})}for(let T=R.length-1;E.length<=T;--T){let _=g.concat([T]);C.push({op:n,path:_})}}function s(S,g,y,C){let{base_:E,copy_:x}=S;Gi(S.assigned_,(R,T)=>{let _=iu(E,R),M=iu(x,R),P=T?Bi(E,R)?t:r:n;if(_===M&&P===t)return;let k=g.concat(R);y.push(P===n?{op:P,path:k}:{op:P,path:k,value:M}),C.push(P===r?{op:n,path:k}:P===n?{op:r,path:k,value:v(_)}:{op:t,path:k,value:v(_)})})}function a(S,g,y,C){let{base_:E,copy_:x}=S,R=0;E.forEach(T=>{if(!x.has(T)){let _=g.concat([R]);y.push({op:n,path:_,value:T}),C.unshift({op:r,path:_,value:T})}R++}),R=0,x.forEach(T=>{if(!E.has(T)){let _=g.concat([R]);y.push({op:r,path:_,value:T}),C.unshift({op:n,path:_,value:T})}R++})}function c(S,g,y,C){y.push({op:t,path:[],value:g===fu?void 0:g}),C.push({op:t,path:[],value:S})}function u(S,g){return g.forEach(y=>{let{path:C,op:E}=y,x=S;for(let M=0;M<C.length-1;M++){let P=Dr(x),k=C[M];typeof k!="string"&&typeof k!="number"&&(k=""+k),(P===0||P===1)&&(k==="__proto__"||k==="constructor")&&ze(19),typeof x=="function"&&k==="prototype"&&ze(19),x=iu(x,k),typeof x!="object"&&ze(18,C.join("/"))}let R=Dr(x),T=h(y.value),_=C[C.length-1];switch(E){case t:switch(R){case 2:return x.set(_,T);case 3:ze(16);default:return x[_]=T}case r:switch(R){case 1:return _==="-"?x.push(T):x.splice(_,0,T);case 2:return x.set(_,T);case 3:return x.add(T);default:return x[_]=T}case n:switch(R){case 1:return x.splice(_,1);case 2:return x.delete(_);case 3:return x.delete(y.value);default:return delete x[_]}default:ze(17,E)}}),S}function h(S){if(!ot(S))return S;if(Array.isArray(S))return S.map(h);if(Mn(S))return new Map(Array.from(S.entries()).map(([y,C])=>[y,h(C)]));if(zi(S))return new Set(Array.from(S).map(h));let g=Object.create(Dn(S));for(let y in S)g[y]=h(S[y]);return Bi(S,Vi)&&(g[Vi]=S[Vi]),g}function v(S){return dt(S)?h(S):S}fw("Patches",{applyPatches_:u,generatePatches_:i,generateReplacementPatches_:c})}var Hi=new vw,Kt=Hi.produce,Yo=Hi.produceWithPatches.bind(Hi);var hu=Hi.applyPatches.bind(Hi);m();d();f();p();function Sw(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Aw(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function ww(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 Jp=e=>Array.isArray(e)?e:[e];function bw(e){let t=Array.isArray(e[0])?e[0]:e;return ww(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Cw(e,t){let r=[],{length:n}=e;for(let i=0;i<n;i++)r.push(e[i].apply(null,t));return r}var fN=Symbol();var mN=Object.getPrototypeOf({});var xw=class{constructor(e){this.value=e}deref(){return this.value}},Ew=typeof WeakRef<"u"?WeakRef:xw,Iw=0,Zp=1;function Xo(){return{s:Iw,v:void 0,o:null,p:null}}function jn(e,t={}){let r=Xo(),{resultEqualityCheck:n}=t,i,o=0;function s(){let a=r,{length:c}=arguments;for(let v=0,S=c;v<S;v++){let g=arguments[v];if(typeof g=="function"||typeof g=="object"&&g!==null){let y=a.o;y===null&&(a.o=y=new WeakMap);let C=y.get(g);C===void 0?(a=Xo(),y.set(g,a)):a=C}else{let y=a.p;y===null&&(a.p=y=new Map);let C=y.get(g);C===void 0?(a=Xo(),y.set(g,a)):a=C}}let u=a,h;if(a.s===Zp)h=a.v;else if(h=e.apply(null,arguments),o++,n){let v=i?.deref?.()??i;v!=null&&n(v,h)&&(h=v,o!==0&&o--),i=typeof h=="object"&&h!==null||typeof h=="function"?new Ew(h):h}return u.s=Zp,u.v=h,h}return s.clearCache=()=>{r=Xo(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function ef(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let o=0,s=0,a,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),Sw(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);let h={...r,...c},{memoize:v,memoizeOptions:S=[],argsMemoize:g=jn,argsMemoizeOptions:y=[],devModeChecks:C={}}=h,E=Jp(S),x=Jp(y),R=bw(i),T=v(function(){return o++,u.apply(null,arguments)},...E),_=!0,M=g(function(){s++;let k=Cw(R,arguments);return a=T.apply(null,k),a},...x);return Object.assign(M,{resultFunc:u,memoizedResultFunc:T,dependencies:R,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>a,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:v,argsMemoize:g})};return Object.assign(n,{withTypes:()=>n}),n}var Me=ef(jn),Rw=Object.assign((e,t=Me)=>{Aw(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let r=Object.keys(e),n=r.map(o=>e[o]);return t(n,(...o)=>o.reduce((s,a,c)=>(s[r[c]]=a,s),{}))},{withTypes:()=>Rw});m();d();f();p();function tf(e){return({dispatch:r,getState:n})=>i=>o=>typeof o=="function"?o(r,n,e):i(o)}var rf=tf(),nf=tf;var Tw=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Nn:Nn.apply(null,arguments)},PN=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},_w=e=>e&&typeof e.match=="function";function q(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(rt(0));return{type:e,payload:i.payload,...("meta"in i&&{meta:i.meta}),...("error"in i&&{error:i.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Fn(n)&&n.type===e,r}var pf=class Wi extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Wi.prototype)}static get[Symbol.species](){return Wi}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Wi(...t[0].concat(this)):new Wi(...t.concat(this))}};function of(e){return ot(e)?Kt(e,()=>{}):e}function sf(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function kw(e){return typeof e=="boolean"}var Ow=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:o=!0}=t??{},s=new pf;return r&&(kw(r)?s.push(rf):s.push(nf(r.extraArgument))),s},Ki="RTK_autoBatch",Un=()=>e=>({payload:e,meta:{[Ki]:!0}}),af=e=>t=>{setTimeout(t,e)},Pw=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),i=!0,o=!1,s=!1,a=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:af(10):e.type==="callback"?e.queueNotification:af(e.timeout),u=()=>{s=!1,o&&(o=!1,a.forEach(h=>h()))};return Object.assign({},n,{subscribe(h){let v=()=>i&&h(),S=n.subscribe(v);return a.add(h),()=>{S(),a.delete(h)}},dispatch(h){try{return i=!h?.meta?.[Ki],o=!i,o&&(s||(s=!0,c(u))),n.dispatch(h)}finally{i=!0}}})},Nw=e=>function(r){let{autoBatch:n=!0}=r??{},i=new pf(e);return n&&i.push(Pw(typeof n=="object"?n:void 0)),i};function ff(e){let t=Ow(),{reducer:r=void 0,middleware:n,devTools:i=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},a;if(typeof r=="function")a=r;else if(Pt(r))a=Pn(r);else throw new Error(rt(1));let c;typeof n=="function"?c=n(t):c=t();let u=Nn;i&&(u=Tw({trace:!1,...(typeof i=="object"&&i)}));let h=Lp(...c),v=Nw(h),S=typeof s=="function"?s(v):v(),g=u(...S);return nu(a,o,g)}function mf(e){let t={},r=[],n,i={addCase(o,s){let a=typeof o=="string"?o:o.type;if(!a)throw new Error(rt(28));if(a in t)throw new Error(rt(29));return t[a]=s,i},addMatcher(o,s){return r.push({matcher:o,reducer:s}),i},addDefaultCase(o){return n=o,i}};return e(i),[t,r,n]}function Fw(e){return typeof e=="function"}function Ve(e,t){let[r,n,i]=mf(t),o;if(Fw(e))o=()=>of(e());else{let a=of(e);o=()=>a}function s(a=o(),c){let u=[r[c.type],...n.filter(({matcher:h})=>h(c)).map(({reducer:h})=>h)];return u.filter(h=>!!h).length===0&&(u=[i]),u.reduce((h,v)=>{if(v)if(dt(h)){let g=v(h,c);return g===void 0?h:g}else{if(ot(h))return Kt(h,S=>v(S,c));{let S=v(h,c);if(S===void 0){if(h===null)return h;throw Error("A case reducer on a non-draftable value must not return undefined")}return S}}return h},a)}return s.getInitialState=o,s}var gf=(e,t)=>_w(e)?e.match(t):e(t);function Nt(...e){return t=>e.some(r=>gf(r,t))}function Ln(...e){return t=>e.every(r=>gf(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 Yi(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function rs(...e){return e.length===0?t=>ts(t,["pending"]):Yi(e)?Nt(...e.map(t=>t.pending)):rs()(e[0])}function Lr(...e){return e.length===0?t=>ts(t,["rejected"]):Yi(e)?Nt(...e.map(t=>t.rejected)):Lr()(e[0])}function Xi(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Ln(Lr(...e),t):Yi(e)?Ln(Lr(...e),t):Xi()(e[0])}function Yt(...e){return e.length===0?t=>ts(t,["fulfilled"]):Yi(e)?Nt(...e.map(t=>t.fulfilled)):Yt()(e[0])}function ns(...e){return e.length===0?t=>ts(t,["pending","fulfilled","rejected"]):Yi(e)?Nt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):ns()(e[0])}var Dw="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Ji=(e=21)=>{let t="",r=e;for(;r--;)t+=Dw[Math.random()*64|0];return t},Mw=["name","message","stack","code"],yu=class{constructor(e,t){be(this,"_type");this.payload=e,this.meta=t}},cf=class{constructor(e,t){be(this,"_type");this.payload=e,this.meta=t}},jw=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of Mw)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},ve=(()=>{function e(t,r,n){let i=q(t+"/fulfilled",(c,u,h,v)=>({payload:c,meta:{...(v||{}),arg:h,requestId:u,requestStatus:"fulfilled"}})),o=q(t+"/pending",(c,u,h)=>({payload:void 0,meta:{...(h||{}),arg:u,requestId:c,requestStatus:"pending"}})),s=q(t+"/rejected",(c,u,h,v,S)=>({payload:v,error:(n&&n.serializeError||jw)(c||"Rejected"),meta:{...(S||{}),arg:h,requestId:u,rejectedWithValue:!!v,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function a(c){return(u,h,v)=>{let S=n?.idGenerator?n.idGenerator(c):Ji(),g=new l.AbortController,y,C;function E(R){C=R,g.abort()}let x=_asyncToGenerator(function*(){let R;try{let _=n?.condition?.(c,{getState:h,extra:v});if(Lw(_)&&(_=yield _),_===!1||g.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let M=new Promise((P,k)=>{y=()=>{k({name:"AbortError",message:C||"Aborted"})},g.signal.addEventListener("abort",y)});u(o(S,c,n?.getPendingMeta?.({requestId:S,arg:c},{getState:h,extra:v}))),R=yield Promise.race([M,Promise.resolve(r(c,{dispatch:u,getState:h,extra:v,requestId:S,signal:g.signal,abort:E,rejectWithValue:(P,k)=>new yu(P,k),fulfillWithValue:(P,k)=>new cf(P,k)})).then(P=>{if(P instanceof yu)throw P;return P instanceof cf?i(P.payload,S,c,P.meta):i(P,S,c)})])}catch(_){R=_ instanceof yu?s(null,S,c,_.payload,_.meta):s(_,S,c)}finally{y&&g.signal.removeEventListener("abort",y)}return n&&!n.dispatchConditionRejection&&s.match(R)&&R.meta.condition||u(R),R})();return Object.assign(x,{abort:E,requestId:S,arg:c,unwrap(){return x.then(qw)}})}}return Object.assign(a,{pending:o,rejected:s,fulfilled:i,settled:Nt(s,i),typePrefix:t})}return e.withTypes=()=>e,e})();function qw(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Lw(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var hf=Symbol.for("rtk-slice-createasyncthunk"),jN={[hf]:ve};function Uw(e,t){return`${e}/${t}`}function Vw({creators:e}={}){let t=e?.asyncThunk?.[hf];return function(n){let{name:i,reducerPath:o=i}=n;if(!i)throw new Error(rt(11));typeof process<"u";let s=(typeof n.reducers=="function"?n.reducers(Bw()):n.reducers)||{},a=Object.keys(s),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(R,T){let _=typeof R=="string"?R:R.type;if(!_)throw new Error(rt(12));if(_ in c.sliceCaseReducersByType)throw new Error(rt(13));return c.sliceCaseReducersByType[_]=T,u},addMatcher(R,T){return c.sliceMatchers.push({matcher:R,reducer:T}),u},exposeAction(R,T){return c.actionCreators[R]=T,u},exposeCaseReducer(R,T){return c.sliceCaseReducersByName[R]=T,u}};a.forEach(R=>{let T=s[R],_={reducerName:R,type:Uw(i,R),createNotation:typeof n.reducers=="function"};Qw(T)?zw(_,T,u,t):$w(_,T,u)});function h(){let[R={},T=[],_=void 0]=typeof n.extraReducers=="function"?mf(n.extraReducers):[n.extraReducers],M={...R,...c.sliceCaseReducersByType};return Ve(n.initialState,P=>{for(let k in M)P.addCase(k,M[k]);for(let k of c.sliceMatchers)P.addMatcher(k.matcher,k.reducer);for(let k of T)P.addMatcher(k.matcher,k.reducer);_&&P.addDefaultCase(_)})}let v=R=>R,S=new Map,g;function y(R,T){return g||(g=h()),g(R,T)}function C(){return g||(g=h()),g.getInitialState()}function E(R,T=!1){function _(P){let k=P[R];return typeof k>"u"&&T&&(k=C()),k}function M(P=v){let k=sf(S,T,()=>new WeakMap);return sf(k,P,()=>{let O={};for(let[F,L]of Object.entries(n.selectors??{}))O[F]=Gw(L,P,C,T);return O})}return{reducerPath:R,getSelectors:M,get selectors(){return M(_)},selectSlice:_}}let x={name:i,reducer:y,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:C,...E(o),injectInto(R,{reducerPath:T,..._}={}){let M=T??o;return R.inject({reducerPath:M,reducer:y},_),{...x,...E(M,!0)}}};return x}}function Gw(e,t,r,n){function i(o,...s){let a=t(o);return typeof a>"u"&&n&&(a=r()),e(a,...s)}return i.unwrapped=e,i}var Ur=Vw();function Bw(){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 $w({type:e,reducerName:t,createNotation:r},n,i){let o,s;if("reducer"in n){if(r&&!Hw(n))throw new Error(rt(17));o=n.reducer,s=n.prepare}else o=n;i.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,s?q(e,s):q(e))}function Qw(e){return e._reducerDefinitionType==="asyncThunk"}function Hw(e){return e._reducerDefinitionType==="reducerWithPrepare"}function zw({type:e,reducerName:t},r,n,i){if(!i)throw new Error(rt(18));let{payloadCreator:o,fulfilled:s,pending:a,rejected:c,settled:u,options:h}=r,v=i(e,o,h);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||Jo,pending:a||Jo,rejected:c||Jo,settled:u||Jo})}function Jo(){}var Ww="task",yf="listener",vf="completed",Au="cancelled",Kw=`task-${Au}`,Yw=`task-${vf}`,vu=`${yf}-${Au}`,Xw=`${yf}-${vf}`,is=class{constructor(e){be(this,"name","TaskAbortError");be(this,"message");this.code=e,this.message=`${Ww} ${Au} (reason: ${e})`}},wu=(e,t)=>{if(typeof e!="function")throw new TypeError(rt(32))},Zo=()=>{},Sf=(e,t=Zo)=>(e.catch(t),e),Af=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),jr=(e,t)=>{let r=e.signal;r.aborted||("reason"in r||Object.defineProperty(r,"reason",{enumerable:!0,value:t,configurable:!0,writable:!0}),e.abort(t))},qr=e=>{if(e.aborted){let{reason:t}=e;throw new is(t)}};function wf(e,t){let r=Zo;return new Promise((n,i)=>{let o=()=>i(new is(e.reason));if(e.aborted){o();return}r=Af(e,o),t.finally(()=>r()).then(n,i)}).finally(()=>{r=Zo})}var Jw=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof is?"cancelled":"rejected",error:r}}finally{t?.()}});return function Jw(_x5,_x6){return _ref5.apply(this,arguments)}}(),es=e=>t=>Sf(wf(e,t).then(r=>(qr(e),r))),bf=e=>{let t=es(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:qn}=Object,uf={},os="listenerMiddleware",Zw=(e,t)=>{let r=n=>Af(e,()=>jr(n,e.reason));return(n,i)=>{wu(n,"taskExecutor");let o=new l.AbortController;r(o);let s=Jw(/*#__PURE__*/_asyncToGenerator(function*(){qr(e),qr(o.signal);let a=yield n({pause:es(o.signal),delay:bf(o.signal),signal:o.signal});return qr(o.signal),a}),()=>jr(o,Yw));return i?.autoJoin&&t.push(s.catch(Zo)),{result:es(e)(s),cancel(){jr(o,Kw)}}}},eb=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,i){qr(t);let o=()=>{},a=[new Promise((c,u)=>{let h=e({predicate:n,effect:(v,S)=>{S.unsubscribe(),c([v,S.getState(),S.getOriginalState()])}});o=()=>{h(),u()}})];i!=null&&a.push(new Promise(c=>setTimeout(c,i,null)));try{let c=yield wf(t,Promise.race(a));return qr(t),c}finally{o()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,i)=>Sf(r(n,i))},Cf=e=>{let{type:t,actionCreator:r,matcher:n,predicate:i,effect:o}=e;if(t)i=q(t).match;else if(r)t=r.type,i=r.match;else if(n)i=n;else if(!i)throw new Error(rt(21));return wu(o,"options.listener"),{predicate:i,type:t,effect:o}},xf=qn(e=>{let{type:t,predicate:r,effect:n}=Cf(e);return{id:Ji(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(rt(22))}}},{withTypes:()=>xf}),lf=(e,t)=>{let{type:r,effect:n,predicate:i}=Cf(t);return Array.from(e.values()).find(o=>(typeof r=="string"?o.type===r:o.predicate===i)&&o.effect===n)},Su=e=>{e.pending.forEach(t=>{jr(t,vu)})},tb=e=>()=>{e.forEach(Su),e.clear()},df=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Ef=qn(q(`${os}/add`),{withTypes:()=>Ef}),rb=q(`${os}/removeAll`),If=qn(q(`${os}/remove`),{withTypes:()=>If}),nb=(...e)=>{console.error(`${os}/error`,...e)},Rf=(e={})=>{let t=new Map,{extra:r,onError:n=nb}=e;wu(n,"onError");let i=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),v=>{h.unsubscribe(),v?.cancelActive&&Su(h)}),o=h=>{let v=lf(t,h)??xf(h);return i(v)};qn(o,{withTypes:()=>o});let s=h=>{let v=lf(t,h);return v&&(v.unsubscribe(),h.cancelActive&&Su(v)),!!v};qn(s,{withTypes:()=>s});let a=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,v,S,g){let y=new l.AbortController,C=eb(o,y.signal),E=[];try{h.pending.add(y),yield Promise.resolve(h.effect(v,qn({},S,{getOriginalState:g,condition:(x,R)=>C(x,R).then(Boolean),take:C,delay:bf(y.signal),pause:es(y.signal),extra:r,signal:y.signal,fork:Zw(y.signal,E),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((x,R,T)=>{x!==y&&(jr(x,vu),T.delete(x))})},cancel:()=>{jr(y,vu),h.pending.delete(y)},throwIfCancelled:()=>{qr(y.signal)}})))}catch(x){x instanceof is||df(n,x,{raisedBy:"effect"})}finally{yield Promise.all(E),jr(y,Xw),h.pending.delete(y)}});return function a(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),c=tb(t);return{middleware:h=>v=>S=>{if(!Fn(S))return v(S);if(Ef.match(S))return o(S.payload);if(rb.match(S)){c();return}if(If.match(S))return s(S.payload);let g=h.getState(),y=()=>{if(g===uf)throw new Error(rt(23));return g},C;try{if(C=v(S),t.size>0){let E=h.getState(),x=Array.from(t.values());for(let R of x){let T=!1;try{T=R.predicate(S,E,g)}catch(_){T=!1,df(n,_,{raisedBy:"predicate"})}T&&a(R,S,h,y)}}}finally{g=uf}return C},startListening:o,stopListening:s,clearListeners:c}};var LN=Symbol.for("rtk-state-proxy-original");function rt(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 te=new J({required:!0,emptyAllowed:!1}),Ge=new J({required:!1,emptyAllowed:!1}),It=new J({required:!0,emptyAllowed:!0}),XN=new J({required:!1,emptyAllowed:!0}),Tf=new Et({each:te,required:!0}),_f=new J({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),kf=new J({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),JN=new J({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),ib=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),bu=(e,t)=>{if("required"in t)return{payload:new xt({value:t}).validate({value:e}).value};let i=new xe({options:{required:!0},values:t}).validate(e);if(i)throw new Yc(i);return{payload:e}},z=(e,t)=>{try{return bu(e,t)}catch(r){return{payload:e,error:ib(r)}}};var ss=(e,t,r,n)=>{let i=`Check the options of ${n}`;return ob(e,t,r,i,"Controller initialization error")},ob=(e,t,r,n,i)=>{try{return t.validate(r,n)}catch(o){throw e.logger.error(o,i),o}};var as=q("caseAssistConfiguration/set",e=>z(e,{caseAssistId:te,locale:Ge,proxyBaseUrl:new J({required:!1,url:!0})}));m();d();f();p();m();d();f();p();var Of=()=>({caseAssistId:"",locale:"en-US"});var ur=Ve(Of(),e=>{e.addCase(as,(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 Pf={q:new J,enableQuerySyntax:new De,aq:new J,cq:new J,firstResult:new Le({min:0}),numberOfResults:new Le({min:0}),sortCriteria:new J,f:new xe,fExcluded:new xe,cf:new xe,nf:new xe,mnf:new xe,df:new xe,debug:new De,sf:new xe,tab:new J,af:new xe};var cs=q("searchParameters/restore",e=>z(e,Pf)),Nf=q("searchParameters/restoreTab",e=>z(e,te));m();d();f();p();var Ff=q("debug/enable"),Df=q("debug/disable");m();d();f();p();var us=()=>!1;var Mf=Ve(us(),e=>{e.addCase(Ff,()=>!0).addCase(Df,()=>!1).addCase(cs,(t,r)=>r.payload.debug??t)});m();d();f();p();var ls=q("searchHub/set",e=>z(e,new J({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var Vn="3.46.1",jf=["@coveo/atomic","@coveo/quantic"];var Cu=()=>Ge,qf=()=>te,Gn=q("configuration/updateBasicConfiguration",e=>z(e,{accessToken:Ge,environment:new J({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:Ge})),ds=q("configuration/updateSearchConfiguration",e=>z(e,{proxyBaseUrl:new J({required:!1,url:!0}),pipeline:new J({required:!1,emptyAllowed:!0}),searchHub:Ge,timezone:Ge,locale:Ge,authenticationProviders:new Et({required:!1,each:te})})),sb={enabled:new De({default:!0}),originContext:Cu(),originLevel2:Cu(),originLevel3:Cu(),proxyBaseUrl:new J({required:!1,url:!0}),runtimeEnvironment:new Nr,anonymous:new De({default:!1}),deviceId:Ge,userDisplayName:Ge,documentLocation:Ge,trackingId:kf,analyticsMode:new J({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new xe({options:{required:!1},values:jf.reduce((e,t)=>(e[t]=_f,e),{})})},ps=q("configuration/updateAnalyticsConfiguration",e=>z(e,sb)),fs=q("configuration/analytics/disable"),ms=q("configuration/analytics/enable"),Lf=q("configuration/analytics/originlevel2",e=>z(e,{originLevel2:qf()})),Uf=q("configuration/analytics/originlevel3",e=>z(e,{originLevel3:qf()})),Vf=q("knowledge/setAgentId",e=>z(e,new J({required:!0})));m();d();f();p();var ab=q("history/undo"),cb=q("history/redo"),Ft=q("history/snapshot"),TD=ve("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(ab()),yield t(gs())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),_D=ve("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(cb()),yield t(gs())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),gs=ve("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 Bn=()=>"default";var Gf=Ve(Bn(),e=>{e.addCase(ls,(t,r)=>r.payload).addCase(gs.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(ds,(t,r)=>r.payload.searchHub||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 Bf=/^(?:[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 ub(e){return typeof e=="string"&&Bf.test(e)}var xu=ub;m();d();f();p();var We=[];for(let e=0;e<256;++e)We.push((e+256).toString(16).slice(1));function $f(e,t=0){return(We[e[t+0]]+We[e[t+1]]+We[e[t+2]]+We[e[t+3]]+"-"+We[e[t+4]]+We[e[t+5]]+"-"+We[e[t+6]]+We[e[t+7]]+"-"+We[e[t+8]]+We[e[t+9]]+"-"+We[e[t+10]]+We[e[t+11]]+We[e[t+12]]+We[e[t+13]]+We[e[t+14]]+We[e[t+15]]).toLowerCase()}m();d();f();p();var Eu,lb=new Uint8Array(16);function Iu(){if(!Eu){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Eu=crypto.getRandomValues.bind(crypto)}return Eu(lb)}m();d();f();p();m();d();f();p();var db=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ru={randomUUID:db};function pb(e,t,r){e=e||{};let n=e.random??e.rng?.()??Iu();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 i=0;i<16;++i)t[r+i]=n[i];return t}return $f(n)}function fb(e,t,r){return Ru.randomUUID&&!t&&!e?Ru.randomUUID():pb(e,t,r)}var Tu=fb;m();d();f();p();function Qf(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}function mb({config:e,environment:t,event:r,listenerManager:n}){let{url:i,token:o,mode:s}=e;s!=="disabled"&&(n.call(r),t.send(i,o,r))}var Hf="visitorId";function gb(e){return{getClientId:()=>{let t=e.get(),r=t.storage,n=r.getItem(Hf),i=n&&xu(n)?n:t.generateUUID();return r.setItem(Hf,i),i}}}var Xf="1.2.15",_u=128,Jf=192,zf=224,Wf=240,hb=248;function yb(e){return(e&hb)===Wf?4:(e&Wf)===zf?3:(e&zf)===Jf?2:1}function vb(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&_u)!=_u)break;if(r-=3,(n&Jf)!=_u){t-r>=yb(n)*3&&(r=t);break}}return e.substring(0,r)}function Sb(e){let{trackingId:t}=e;return{trackingId:t}}function Ab(e){return(e.source||[]).concat([`relay@${Xf}`])}function Zf(e,t,r,n){let{getReferrer:i,getLocation:o,getUserAgent:s}=r,a=Sb(t),c=n.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:Ab(t),clientId:c,userAgent:s(),referrer:Kf(i()),location:Kf(o())})}function Kf(e){return e!==null?vb(e,1024):null}function wb(e,t,r,n,i){return{...t,meta:Zf(e,r,n,i)}}var bb="*";function Cb(){let e=[];function t({type:c,callback:u}){return e.findIndex(h=>h.type===c&&h.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 i(c){e.forEach(u=>{if(r(u,c.meta.type))try{u.callback(c)}catch(h){console.error(h)}})}function o(c){if(c===bb)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}):o(c)}return{add:n,call:i,remove:a}}function Yf({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 xb(e){let t=Yf(e);return{get:()=>t,update:r=>{t=Yf({...t,...r})}}}var ku=Eb();function Eb(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,i=document.cookie.split(";");for(let o of i){let s=o.replace(/^\s+/,"");if(s.lastIndexOf(n,0)===0)return s.substring(n.length,s.length)}return null},setItem(r,n,i){let o=t(window.location.hostname),s=`;expires=${new Date(new Date().getTime()+i).toUTCString()}`,a=o?`;domain=${o}`:"";document.cookie=`${e}${r}=${n}${s}${a};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function Ib(){return{getItem(e){return ku.getItem(e)||localStorage.getItem(e)},removeItem(e){ku.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),ku.setItem(e,t,31556952e3)}}}function Rb(){let e=document.referrer;return e===""?null:e}function Ou(){return{runtime:"browser",send:(e,t,r)=>{let n=navigator.sendBeacon(`${e}?access_token=${t}`,new Blob([JSON.stringify([r])],{type:"application/json"}));if(Qf().sendMessage({kind:"EVENT_PROTOCOL",event:r,url:e,token:t}),!n)throw new Error("Failed to send the event(s) because the payload size exceeded the maximum allowed size (32 KB). Please contact support if the problem persists.")},getReferrer:()=>Rb(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,generateUUID:()=>Tu(),storage:Ib()}}function Tb(){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 _b(){return{getItem(){return null},removeItem(){},setItem(){}}}function kb(){return{runtime:"null",send:()=>{},getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,generateUUID:()=>"",storage:_b()}}function Ob(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=kb();return t&&r?{storage:n.storage,...r,runtime:"custom"}:t&&Pb()&&Tb()?Ou():n}function Pb(){try{return typeof window=="object"}catch{return!1}}function Nb(e){return{get:()=>Object.freeze(Ob(e))}}function em(e){let t=xb(e),r=Cb(),n=Nb(t),i=gb(n);return{emit:(o,s)=>{let a=t.get(),c=n.get(),u=wb(o,s,a,c,i);return mb({config:a,environment:c,event:u,listenerManager:r})},getMeta:o=>Zf(o,t.get(),n.get(),i),on:(o,s)=>r.add({type:o,callback:s}),off:(o,s)=>r.remove(o,s),updateConfig:o=>t.update(o),version:Xf}}m();d();f();p();function tm(){return typeof window<"u"&&typeof document<"u"}m();d();f();p();var $n=Me(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Vn}`));var Zi=Me(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>$n(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:i,enabled:o},s,a)=>{let c=Db(a);return em({mode:o?"emit":"disabled",url:i??jo(e,t),token:r,trackingId:n??null,source:s,environment:c})}),Fb={generateUUID:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:()=>{},storage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{}}},Db=e=>{if(!e)return;let t=e();return{...(tm()?Ou():Fb),generateUUID:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();m();d();f();p();function rm(e){return{status:e,isUninitialized:e==="uninitialized",isLoading:e==="pending",isSuccess:e==="fulfilled",isError:e==="rejected"}}var nm=Pt;function gm(e,t){if(e===t||!(nm(e)&&nm(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),i=r.length===n.length,o=Array.isArray(t)?[]:{};for(let s of r)o[s]=gm(e[s],t[s]),i&&(i=e[s]===o[s]);return i?e:o}function Qn(e){let t=0;for(let r in e)t++;return t}var im=e=>[].concat(...e);function Mb(e){return new RegExp("(^|:)//").test(e)}function jb(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function vs(e){return e!=null}function qb(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var Lb=e=>e.replace(/\/$/,""),Ub=e=>e.replace(/^\//,"");function Vb(e,t){if(!e)return t;if(!t)return e;if(Mb(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=Lb(e),t=Ub(t),`${e}${r}${t}`}function Gb(e,t,r){return e.has(t)?e.get(t):e.set(t,r).get(t)}var om=(...e)=>w(...e),Bb=e=>e.status>=200&&e.status<=299,$b=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function sm(e){if(!Pt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}function hm({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=om,paramsSerializer:n,isJsonContentType:i=$b,jsonContentType:o="application/json",jsonReplacer:s,timeout:a,responseHandler:c,validateStatus:u,...h}={}){return typeof w>"u"&&r===om&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(S,g,y){let{getState:C,extra:E,endpoint:x,forced:R,type:T}=g,_,{url:M,headers:P=new b(h.headers),params:k=void 0,responseHandler:O=c??"json",validateStatus:F=u??Bb,timeout:L=a,...Q}=typeof S=="string"?{url:S}:S,B,V=g.signal;L&&(B=new l.AbortController,g.signal.addEventListener("abort",B.abort),V=B.signal);let U={...h,signal:V,...Q};P=new b(sm(P)),U.headers=(yield t(P,{getState:C,arg:S,extra:E,endpoint:x,forced:R,type:T,extraOptions:y}))||P;let $=ae=>typeof ae=="object"&&(Pt(ae)||Array.isArray(ae)||typeof ae.toJSON=="function");if(!U.headers.has("content-type")&&$(U.body)&&U.headers.set("content-type",o),$(U.body)&&i(U.headers)&&(U.body=JSON.stringify(U.body,s)),k){let ae=~M.indexOf("?")?"&":"?",pe=n?n(k):new URLSearchParams(sm(k));M+=ae+pe}M=Vb(e,M);let G=new Request(M,U);_={request:new Request(M,U)};let K,ee=!1,ue=B&&setTimeout(()=>{ee=!0,B.abort()},L);try{K=yield r(G)}catch(ae){return{error:{status:ee?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ae)},meta:_}}finally{ue&&clearTimeout(ue),B?.signal.removeEventListener("abort",B.abort)}let he=K.clone();_.response=he;let ce,le="";try{let ae;if(yield Promise.all([v(K,O).then(pe=>ce=pe,pe=>ae=pe),he.text().then(pe=>le=pe,()=>{})]),ae)throw ae}catch(ae){return{error:{status:"PARSING_ERROR",originalStatus:K.status,data:le,error:String(ae)},meta:_}}return F(K,ce)?{data:ce,meta:_}:{error:{status:K.status,data:ce},meta:_}});return function(_x17,_x18,_x19){return _ref10.apply(this,arguments)}}());function v(_x20,_x21){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(S,g){if(typeof g=="function")return g(S);if(g==="content-type"&&(g=i(S.headers)?"json":"text"),g==="json"){let y=yield S.text();return y.length?JSON.parse(y):null}return S.text()});return _v2.apply(this,arguments)}}var Hn=class{constructor(e,t=void 0){this.value=e,this.meta=t}};function Qb(){return _Qb.apply(this,arguments)}function _Qb(){_Qb=_asyncToGenerator(function*(e=0,t=5){let r=Math.min(e,t),n=~~((Math.random()+.4)*(300<<r));yield new Promise(i=>setTimeout(o=>i(o),n))});return _Qb.apply(this,arguments)}function Hb(e,t){throw Object.assign(new Hn({error:e,meta:t}),{throwImmediately:!0})}var am={},zb=(e,t)=>(/*#__PURE__*/function(){var _ref11=_asyncToGenerator(function*(r,n,i){let o=[5,(t||am).maxRetries,(i||am).maxRetries].filter(h=>h!==void 0),[s]=o.slice(-1),c={maxRetries:s,backoff:Qb,retryCondition:(h,v,{attempt:S})=>S<=s,...t,...i},u=0;for(;;)try{let h=yield e(r,n,i);if(h.error)throw new Hn(h);return h}catch(h){if(u++,h.throwImmediately){if(h instanceof Hn)return h.value;throw h}if(h instanceof Hn&&!c.retryCondition(h.value.error,r,{attempt:u,baseQueryApi:n,extraOptions:i}))return h.value;yield c.backoff(u,c.maxRetries)}});return function(_x22,_x23,_x24){return _ref11.apply(this,arguments)}}()),Ss=Object.assign(zb,{fail:Hb}),Mu=q("__rtkq/focused"),ym=q("__rtkq/unfocused"),ju=q("__rtkq/online"),vm=q("__rtkq/offline");function qu(e){return e.type==="query"}function Wb(e){return e.type==="mutation"}function Lu(e){return e.type==="infinitequery"}function Uu(e,t,r,n,i,o){return Kb(e)?e(t,r,n,i).filter(vs).map(Nu).map(o):Array.isArray(e)?e.map(Nu).map(o):[]}function Kb(e){return typeof e=="function"}function Nu(e){return typeof e=="string"?{type:e}:e}function Yb(e,t){return e.catch(t)}var to=Symbol("forceQueryFn"),Fu=e=>typeof e[to]=="function";function Xb({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:i,context:o}){let s=new Map,a=new Map,{unsubscribeQueryResult:c,removeMutationResult:u,updateSubscriptionOptions:h}=i.internalActions;return{buildInitiateQuery:x,buildInitiateInfiniteQuery:R,buildInitiateMutation:T,getRunningQueryThunk:v,getRunningMutationThunk:S,getRunningQueriesThunk:g,getRunningMutationsThunk:y};function v(_,M){return P=>{let k=o.endpointDefinitions[_],O=e({queryArgs:M,endpointDefinition:k,endpointName:_});return s.get(P)?.[O]}}function S(_,M){return P=>a.get(P)?.[M]}function g(){return _=>Object.values(s.get(_)||{}).filter(vs)}function y(){return _=>Object.values(a.get(_)||{}).filter(vs)}function C(_){}function E(_,M){let P=(k,{subscribe:O=!0,forceRefetch:F,subscriptionOptions:L,[to]:Q,...B}={})=>(V,U)=>{let $=e({queryArgs:k,endpointDefinition:M,endpointName:_}),G,W={...B,type:"query",subscribe:O,forceRefetch:F,subscriptionOptions:L,endpointName:_,originalArgs:k,queryCacheKey:$,[to]:Q};if(qu(M))G=t(W);else{let{direction:Ae,initialPageParam:Oe}=B;G=r({...W,direction:Ae,initialPageParam:Oe})}let K=i.endpoints[_].select(k),ee=V(G),ue=K(U());let{requestId:he,abort:ce}=ee,le=ue.requestId!==he,ae=s.get(V)?.[$],pe=()=>K(U()),Fe=Object.assign(Q?ee.then(pe):le&&!ae?Promise.resolve(ue):Promise.all([ae,ee]).then(pe),{arg:k,requestId:he,subscriptionOptions:L,queryCacheKey:$,abort:ce,unwrap(){return _asyncToGenerator(function*(){let Ae=yield Fe;if(Ae.isError)throw Ae.error;return Ae.data})()},refetch:()=>V(P(k,{subscribe:!1,forceRefetch:!0})),unsubscribe(){O&&V(c({queryCacheKey:$,requestId:he}))},updateSubscriptionOptions(Ae){Fe.subscriptionOptions=Ae,V(h({endpointName:_,requestId:he,queryCacheKey:$,options:Ae}))}});if(!ae&&!le&&!Q){let Ae=Gb(s,V,{});Ae[$]=Fe,Fe.then(()=>{delete Ae[$],Qn(Ae)||s.delete(V)})}return Fe};return P}function x(_,M){return E(_,M)}function R(_,M){return E(_,M)}function T(_){return(M,{track:P=!0,fixedCacheKey:k}={})=>(O,F)=>{let L=n({type:"mutation",endpointName:_,originalArgs:M,track:P,fixedCacheKey:k}),Q=O(L);let{requestId:B,abort:V,unwrap:U}=Q,$=Yb(Q.unwrap().then(ee=>({data:ee})),ee=>({error:ee})),G=()=>{O(u({requestId:B,fixedCacheKey:k}))},W=Object.assign($,{arg:Q.arg,requestId:B,abort:V,unwrap:U,reset:G}),K=a.get(O)||{};return a.set(O,K),K[B]=W,W.then(()=>{delete K[B],Qn(K)||a.delete(O)}),k&&(K[k]=W,W.then(()=>{K[k]===W&&(delete K[k],Qn(K)||a.delete(O))})),W}}}function Jb(e){return e}var hs=(e={})=>({...e,[Ki]:!0});function Zb({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:i,assertTagType:o,selectors:s}){let a=(O,F,L,Q)=>(B,V)=>{let U=r[O],$=n({queryArgs:F,endpointDefinition:U,endpointName:O});if(B(i.internalActions.queryResultPatched({queryCacheKey:$,patches:L})),!Q)return;let G=i.endpoints[O].select(F)(V()),W=Uu(U.providesTags,G.data,void 0,F,{},o);B(i.internalActions.updateProvidedBy({queryCacheKey:$,providedTags:W}))};function c(O,F,L=0){let Q=[F,...O];return L&&Q.length>L?Q.slice(0,-1):Q}function u(O,F,L=0){let Q=[...O,F];return L&&Q.length>L?Q.slice(1):Q}let h=(O,F,L,Q=!0)=>(B,V)=>{let $=i.endpoints[O].select(F)(V()),G={patches:[],inversePatches:[],undo:()=>B(i.util.patchQueryData(O,F,G.inversePatches,Q))};if($.status==="uninitialized")return G;let W;if("data"in $)if(ot($.data)){let[K,ee,ue]=Yo($.data,L);G.patches.push(...ee),G.inversePatches.push(...ue),W=K}else W=L($.data),G.patches.push({op:"replace",path:[],value:W}),G.inversePatches.push({op:"replace",path:[],value:$.data});return G.patches.length===0||B(i.util.patchQueryData(O,F,G.patches,Q)),G},v=(O,F,L)=>Q=>Q(i.endpoints[O].initiate(F,{subscribe:!1,forceRefetch:!0,[to]:()=>({data:L})})),S=(O,F)=>O.query&&O[F]?O[F]:Jb,g=/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(O,{signal:F,abort:L,rejectWithValue:Q,fulfillWithValue:B,dispatch:V,getState:U,extra:$}){let G=r[O.endpointName];try{let W=S(G,"transformResponse"),K={signal:F,abort:L,dispatch:V,getState:U,extra:$,endpoint:O.endpointName,type:O.type,forced:O.type==="query"?y(O,U()):void 0,queryCacheKey:O.type==="query"?O.queryCacheKey:void 0},ee=O.type==="query"?O[to]:void 0,ue,he=/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*(le,ae,pe,Fe){if(ae==null&&le.pages.length)return Promise.resolve({data:le});let Ae={queryArg:O.originalArgs,pageParam:ae},Oe=yield ce(Ae),qe=Fe?c:u;return{data:{pages:qe(le.pages,Oe.data,pe),pageParams:qe(le.pageParams,ae,pe)}}});return function he(_x27,_x28,_x29,_x30){return _ref13.apply(this,arguments)}}();function ce(_x31){return _ce.apply(this,arguments)}function _ce(){_ce=_asyncToGenerator(function*(le){let ae,{extraOptions:pe}=G;if(ee?ae=ee():G.query?ae=yield t(G.query(le),K,pe):ae=yield G.queryFn(le,K,pe,Ae=>t(Ae,K,pe)),typeof process<"u",ae.error)throw new Hn(ae.error,ae.meta);let Fe=yield W(ae.data,ae.meta,le);return{...ae,data:Fe}});return _ce.apply(this,arguments)}if(O.type==="query"&&"infiniteQueryOptions"in G){let{infiniteQueryOptions:le}=G,{maxPages:ae=1/0}=le,pe,Fe={pages:[],pageParams:[]},Ae=s.selectQueryEntry(U(),O.queryCacheKey)?.data,qe=y(O,U())&&!O.direction||!Ae?Fe:Ae;if("direction"in O&&O.direction&&qe.pages.length){let nt=O.direction==="backward",ar=(nt?Sm:Du)(le,qe);pe=yield he(qe,ar,ae,nt)}else{let{initialPageParam:nt=le.initialPageParam}=O,mt=Ae?.pageParams??[],ar=mt[0]??nt,xn=mt.length;pe=yield he(qe,ar,ae),ee&&(pe={data:pe.data.pages[0]});for(let En=1;En<xn;En++){let Pi=Du(le,pe.data);pe=yield he(pe.data,Pi,ae)}}ue=pe}else ue=yield ce(O.originalArgs);return B(ue.data,hs({fulfilledTimeStamp:Date.now(),baseQueryMeta:ue.meta}))}catch(W){let K=W;if(K instanceof Hn){let ee=S(G,"transformErrorResponse");try{return Q(yield ee(K.value,K.meta,O.originalArgs),hs({baseQueryMeta:K.meta}))}catch(ue){K=ue}}throw typeof process<"u",console.error(K),K}});return function g(_x25,_x26){return _ref12.apply(this,arguments)}}();function y(O,F){let L=s.selectQueryEntry(F,O.queryCacheKey),Q=s.selectConfig(F).refetchOnMountOrArgChange,B=L?.fulfilledTimeStamp,V=O.forceRefetch??(O.subscribe&&Q);return V?V===!0||(Number(new Date)-Number(B))/1e3>=V:!1}let C=()=>ve(`${e}/executeQuery`,g,{getPendingMeta({arg:F}){let L=r[F.endpointName];return hs({startedTimeStamp:Date.now(),...(Lu(L)?{direction:F.direction}:{})})},condition(F,{getState:L}){let Q=L(),B=s.selectQueryEntry(Q,F.queryCacheKey),V=B?.fulfilledTimeStamp,U=F.originalArgs,$=B?.originalArgs,G=r[F.endpointName],W=F.direction;return Fu(F)?!0:B?.status==="pending"?!1:y(F,Q)||qu(G)&&G?.forceRefetch?.({currentArg:U,previousArg:$,endpointState:B,state:Q})?!0:!(V&&!W)},dispatchConditionRejection:!0}),E=C(),x=C(),R=ve(`${e}/executeMutation`,g,{getPendingMeta(){return hs({startedTimeStamp:Date.now()})}}),T=O=>"force"in O,_=O=>"ifOlderThan"in O,M=(O,F,L)=>(Q,B)=>{let V=T(L)&&L.force,U=_(L)&&L.ifOlderThan,$=(W=!0)=>{let K={forceRefetch:W,isPrefetch:!0};return i.endpoints[O].initiate(F,K)},G=i.endpoints[O].select(F)(B());if(V)Q($());else if(U){let W=G?.fulfilledTimeStamp;if(!W){Q($());return}(Number(new Date)-Number(new Date(W)))/1e3>=U&&Q($())}else Q($(!1))};function P(O){return F=>F?.meta?.arg?.endpointName===O}function k(O,F){return{matchPending:Ln(rs(O),P(F)),matchFulfilled:Ln(Yt(O),P(F)),matchRejected:Ln(Lr(O),P(F))}}return{queryThunk:E,mutationThunk:R,infiniteQueryThunk:x,prefetch:M,updateQueryData:h,upsertQueryData:v,patchQueryData:a,buildMatchThunkActions:k}}function Du(e,{pages:t,pageParams:r}){let n=t.length-1;return e.getNextPageParam(t[n],t,r[n],r)}function Sm(e,{pages:t,pageParams:r}){return e.getPreviousPageParam?.(t[0],t,r[0],r)}function Am(e,t,r,n){return Uu(r[e.meta.arg.endpointName][t],Yt(e)?e.payload:void 0,Xi(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function ys(e,t,r){let n=e[t];n&&r(n)}function ro(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function cm(e,t,r){let n=e[ro(t)];n&&r(n)}var eo={};function eC({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:i,apiUid:o,extractRehydrationInfo:s,hasRehydrationInfo:a},assertTagType:c,config:u}){let h=q(`${e}/resetApiState`);function v(P,k,O,F){var L;P[L=k.queryCacheKey]??(P[L]={status:"uninitialized",endpointName:k.endpointName}),ys(P,k.queryCacheKey,Q=>{Q.status="pending",Q.requestId=O&&Q.requestId?Q.requestId:F.requestId,k.originalArgs!==void 0&&(Q.originalArgs=k.originalArgs),Q.startedTimeStamp=F.startedTimeStamp;let B=i[F.arg.endpointName];Lu(B)&&"direction"in k&&(Q.direction=k.direction)})}function S(P,k,O,F){ys(P,k.arg.queryCacheKey,L=>{if(L.requestId!==k.requestId&&!F)return;let{merge:Q}=i[k.arg.endpointName];if(L.status="fulfilled",Q){if(L.data!==void 0){let{fulfilledTimeStamp:B,arg:V,baseQueryMeta:U,requestId:$}=k,G=Kt(L.data,W=>Q(W,O,{arg:V.originalArgs,baseQueryMeta:U,fulfilledTimeStamp:B,requestId:$}));L.data=G}else L.data=O;}else L.data=i[k.arg.endpointName].structuralSharing??!0?gm(dt(L.data)?mu(L.data):L.data,O):O;delete L.error,L.fulfilledTimeStamp=k.fulfilledTimeStamp})}let g=Ur({name:`${e}/queries`,initialState:eo,reducers:{removeQueryResult:{reducer(P,{payload:{queryCacheKey:k}}){delete P[k]},prepare:Un()},cacheEntriesUpserted:{reducer(P,k){for(let O of k.payload){let{queryDescription:F,value:L}=O;v(P,F,!0,{arg:F,requestId:k.meta.requestId,startedTimeStamp:k.meta.timestamp}),S(P,{arg:F,requestId:k.meta.requestId,fulfilledTimeStamp:k.meta.timestamp,baseQueryMeta:{}},L,!0)}},prepare:P=>({payload:P.map(F=>{let{endpointName:L,arg:Q,value:B}=F,V=i[L];return{queryDescription:{type:"query",endpointName:L,originalArgs:F.arg,queryCacheKey:n({queryArgs:Q,endpointDefinition:V,endpointName:L})},value:B}}),meta:{[Ki]:!0,requestId:Ji(),timestamp:Date.now()}})},queryResultPatched:{reducer(P,{payload:{queryCacheKey:k,patches:O}}){ys(P,k,F=>{F.data=hu(F.data,O.concat())})},prepare:Un()}},extraReducers(P){P.addCase(t.pending,(k,{meta:O,meta:{arg:F}})=>{let L=Fu(F);v(k,F,L,O)}).addCase(t.fulfilled,(k,{meta:O,payload:F})=>{let L=Fu(O.arg);S(k,O,F,L)}).addCase(t.rejected,(k,{meta:{condition:O,arg:F,requestId:L},error:Q,payload:B})=>{ys(k,F.queryCacheKey,V=>{if(!O){if(V.requestId!==L)return;V.status="rejected",V.error=B??Q}})}).addMatcher(a,(k,O)=>{let{queries:F}=s(O);for(let[L,Q]of Object.entries(F))(Q?.status==="fulfilled"||Q?.status==="rejected")&&(k[L]=Q)})}}),y=Ur({name:`${e}/mutations`,initialState:eo,reducers:{removeMutationResult:{reducer(P,{payload:k}){let O=ro(k);O in P&&delete P[O]},prepare:Un()}},extraReducers(P){P.addCase(r.pending,(k,{meta:O,meta:{requestId:F,arg:L,startedTimeStamp:Q}})=>{L.track&&(k[ro(O)]={requestId:F,status:"pending",endpointName:L.endpointName,startedTimeStamp:Q})}).addCase(r.fulfilled,(k,{payload:O,meta:F})=>{F.arg.track&&cm(k,F,L=>{L.requestId===F.requestId&&(L.status="fulfilled",L.data=O,L.fulfilledTimeStamp=F.fulfilledTimeStamp)})}).addCase(r.rejected,(k,{payload:O,error:F,meta:L})=>{L.arg.track&&cm(k,L,Q=>{Q.requestId===L.requestId&&(Q.status="rejected",Q.error=O??F)})}).addMatcher(a,(k,O)=>{let{mutations:F}=s(O);for(let[L,Q]of Object.entries(F))(Q?.status==="fulfilled"||Q?.status==="rejected")&&L!==Q?.requestId&&(k[L]=Q)})}}),C=Ur({name:`${e}/invalidation`,initialState:eo,reducers:{updateProvidedBy:{reducer(P,k){var L,Q;let{queryCacheKey:O,providedTags:F}=k.payload;for(let B of Object.values(P))for(let V of Object.values(B)){let U=V.indexOf(O);U!==-1&&V.splice(U,1)}for(let{type:B,id:V}of F){let U=(L=P[B]??(P[B]={}))[Q=V||"__internal_without_id"]??(L[Q]=[]);U.includes(O)||U.push(O)}},prepare:Un()}},extraReducers(P){P.addCase(g.actions.removeQueryResult,(k,{payload:{queryCacheKey:O}})=>{for(let F of Object.values(k))for(let L of Object.values(F)){let Q=L.indexOf(O);Q!==-1&&L.splice(Q,1)}}).addMatcher(a,(k,O)=>{var L,Q;let{provided:F}=s(O);for(let[B,V]of Object.entries(F))for(let[U,$]of Object.entries(V)){let G=(L=k[B]??(k[B]={}))[Q=U||"__internal_without_id"]??(L[Q]=[]);for(let W of $)G.includes(W)||G.push(W)}}).addMatcher(Nt(Yt(t),Xi(t)),(k,O)=>{let F=Am(O,"providesTags",i,c),{queryCacheKey:L}=O.meta.arg;C.caseReducers.updateProvidedBy(k,C.actions.updateProvidedBy({queryCacheKey:L,providedTags:F}))})}}),E=Ur({name:`${e}/subscriptions`,initialState:eo,reducers:{updateSubscriptionOptions(P,k){},unsubscribeQueryResult(P,k){},internal_getRTKQSubscriptions(){}}}),x=Ur({name:`${e}/internalSubscriptions`,initialState:eo,reducers:{subscriptionsUpdated:{reducer(P,k){return hu(P,k.payload)},prepare:Un()}}}),R=Ur({name:`${e}/config`,initialState:{online:qb(),focused:jb(),middlewareRegistered:!1,...u},reducers:{middlewareRegistered(P,{payload:k}){P.middlewareRegistered=P.middlewareRegistered==="conflict"||o!==k?"conflict":!0}},extraReducers:P=>{P.addCase(ju,k=>{k.online=!0}).addCase(vm,k=>{k.online=!1}).addCase(Mu,k=>{k.focused=!0}).addCase(ym,k=>{k.focused=!1}).addMatcher(a,k=>({...k}))}}),T=Pn({queries:g.reducer,mutations:y.reducer,provided:C.reducer,subscriptions:x.reducer,config:R.reducer}),_=(P,k)=>T(h.match(k)?void 0:P,k),M={...R.actions,...g.actions,...E.actions,...x.actions,...y.actions,...C.actions,resetApiState:h};return{reducer:_,actions:M}}var Pu=Symbol.for("RTKQ/skipToken"),wm={status:"uninitialized"},um=Kt(wm,()=>{}),lm=Kt(wm,()=>{});function tC({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=T=>um,i=T=>lm;return{buildQuerySelector:S,buildInfiniteQuerySelector:g,buildMutationSelector:y,selectInvalidatedBy:C,selectCachedArgsForQuery:E,selectApiState:s,selectQueries:a,selectMutations:u,selectQueryEntry:c,selectConfig:h};function o(T){return{...T,...rm(T.status)}}function s(T){return T[t]}function a(T){return s(T)?.queries}function c(T,_){return a(T)?.[_]}function u(T){return s(T)?.mutations}function h(T){return s(T)?.config}function v(T,_,M){return P=>{if(P===Pu)return r(n,M);let k=e({queryArgs:P,endpointDefinition:_,endpointName:T});return r(F=>c(F,k)??um,M)}}function S(T,_){return v(T,_,o)}function g(T,_){let{infiniteQueryOptions:M}=_;function P(k){let O={...k,...rm(k.status)},{isLoading:F,isError:L,direction:Q}=O,B=Q==="forward",V=Q==="backward";return{...O,hasNextPage:x(M,O.data),hasPreviousPage:R(M,O.data),isFetchingNextPage:F&&B,isFetchingPreviousPage:F&&V,isFetchNextPageError:L&&B,isFetchPreviousPageError:L&&V}}return v(T,_,P)}function y(){return T=>{let _;return typeof T=="object"?_=ro(T)??Pu:_=T,r(_===Pu?i:k=>s(k)?.mutations?.[_]??lm,o)}}function C(T,_){let M=T[t],P=new Set;for(let k of _.filter(vs).map(Nu)){let O=M.provided[k.type];if(!O)continue;let F=(k.id!==void 0?O[k.id]:im(Object.values(O)))??[];for(let L of F)P.add(L)}return im(Array.from(P.values()).map(k=>{let O=M.queries[k];return O?[{queryCacheKey:k,endpointName:O.endpointName,originalArgs:O.originalArgs}]:[]}))}function E(T,_){return Object.values(a(T)).filter(M=>M?.endpointName===_&&M.status!=="uninitialized").map(M=>M.originalArgs)}function x(T,_){return _?Du(T,_)!=null:!1}function R(T,_){return!_||!T.getPreviousPageParam?!1:Sm(T,_)!=null}}var dm=WeakMap?new WeakMap:void 0,pm=({endpointName:e,queryArgs:t})=>{let r="",n=dm?.get(t);if(typeof n=="string")r=n;else{let i=JSON.stringify(t,(o,s)=>(s=typeof s=="bigint"?{$bigint:s.toString()}:s,s=Pt(s)?Object.keys(s).sort().reduce((a,c)=>(a[c]=s[c],a),{}):s,s));Pt(t)&&dm?.set(t,i),r=i}return`${e}(${r})`};function rC(...e){return function(r){let n=jn(u=>r.extractRehydrationInfo?.(u,{reducerPath:r.reducerPath??"api"})),i={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(u){let h=pm;if("serializeQueryArgs"in u.endpointDefinition){let v=u.endpointDefinition.serializeQueryArgs;h=S=>{let g=v(S);return typeof g=="string"?g:pm({...S,queryArgs:g})}}else r.serializeQueryArgs&&(h=r.serializeQueryArgs);return h(u)},tagTypes:[...(r.tagTypes||[])]},o={endpointDefinitions:{},batch(u){u()},apiUid:Ji(),extractRehydrationInfo:n,hasRehydrationInfo:jn(u=>n(u)!=null)},s={injectEndpoints:c,enhanceEndpoints({addTagTypes:u,endpoints:h}){if(u)for(let v of u)i.tagTypes.includes(v)||i.tagTypes.push(v);if(h)for(let[v,S]of Object.entries(h))typeof S=="function"?S(o.endpointDefinitions[v]):Object.assign(o.endpointDefinitions[v]||{},S);return s}},a=e.map(u=>u.init(s,i,o));function c(u){let h=u.endpoints({query:v=>({...v,type:"query"}),mutation:v=>({...v,type:"mutation"}),infiniteQuery:v=>({...v,type:"infinitequery"})});for(let[v,S]of Object.entries(h)){if(u.overrideExisting!==!0&&v in o.endpointDefinitions){if(u.overrideExisting==="throw")throw new Error(rt(39));typeof process<"u";continue}typeof process<"u",o.endpointDefinitions[v]=S;for(let g of a)g.injectEndpoint(v,S)}return s}return s.injectEndpoints({endpoints:r.endpoints})}}function Xt(e,...t){return Object.assign(e,...t)}var nC=({api:e,queryThunk:t,internalState:r})=>{let n=`${e.reducerPath}/subscriptions`,i=null,o=null,{updateSubscriptionOptions:s,unsubscribeQueryResult:a}=e.internalActions,c=(g,y)=>{var E,x;if(s.match(y)){let{queryCacheKey:R,requestId:T,options:_}=y.payload;return g?.[R]?.[T]&&(g[R][T]=_),!0}if(a.match(y)){let{queryCacheKey:R,requestId:T}=y.payload;return g[R]&&delete g[R][T],!0}if(e.internalActions.removeQueryResult.match(y))return delete g[y.payload.queryCacheKey],!0;if(t.pending.match(y)){let{meta:{arg:R,requestId:T}}=y,_=g[E=R.queryCacheKey]??(g[E]={});return _[`${T}_running`]={},R.subscribe&&(_[T]=R.subscriptionOptions??_[T]??{}),!0}let C=!1;if(t.fulfilled.match(y)||t.rejected.match(y)){let R=g[y.meta.arg.queryCacheKey]||{},T=`${y.meta.requestId}_running`;C||(C=!!R[T]),delete R[T]}if(t.rejected.match(y)){let{meta:{condition:R,arg:T,requestId:_}}=y;if(R&&T.subscribe){let M=g[x=T.queryCacheKey]??(g[x]={});M[_]=T.subscriptionOptions??M[_]??{},C=!0}}return C},u=()=>r.currentSubscriptions,S={getSubscriptions:u,getSubscriptionCount:g=>{let C=u()[g]??{};return Qn(C)},isRequestSubscribed:(g,y)=>!!u()?.[g]?.[y]};return(g,y)=>{if(i||(i=JSON.parse(JSON.stringify(r.currentSubscriptions))),e.util.resetApiState.match(g))return i=r.currentSubscriptions={},o=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(g))return[!1,S];let C=c(r.currentSubscriptions,g),E=!0;if(C){o||(o=setTimeout(()=>{let T=JSON.parse(JSON.stringify(r.currentSubscriptions)),[,_]=Yo(i,()=>T);y.next(e.internalActions.subscriptionsUpdated(_)),i=T,o=null},500));let x=typeof g.type=="string"&&!!g.type.startsWith(n),R=t.rejected.match(g)&&g.meta.condition&&!!g.meta.arg.subscribe;E=!x&&!R}return[E,!1]}};function iC(e){for(let t in e)return!1;return!0}var oC=2147483647/1e3-1,sC=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:i,selectors:{selectQueryEntry:o,selectConfig:s}})=>{let{removeQueryResult:a,unsubscribeQueryResult:c,cacheEntriesUpserted:u}=t.internalActions,h=Nt(c.match,r.fulfilled,r.rejected,u.match);function v(E){let x=i.currentSubscriptions[E];return!!x&&!iC(x)}let S={},g=(E,x,R)=>{let T=x.getState(),_=s(T);if(h(E)){let M;if(u.match(E))M=E.payload.map(P=>P.queryDescription.queryCacheKey);else{let{queryCacheKey:P}=c.match(E)?E.payload:E.meta.arg;M=[P]}y(M,x,_)}if(t.util.resetApiState.match(E))for(let[M,P]of Object.entries(S))P&&clearTimeout(P),delete S[M];if(n.hasRehydrationInfo(E)){let{queries:M}=n.extractRehydrationInfo(E);y(Object.keys(M),x,_)}};function y(E,x,R){let T=x.getState();for(let _ of E){let M=o(T,_);C(_,M?.endpointName,x,R)}}function C(E,x,R,T){let M=n.endpointDefinitions[x]?.keepUnusedDataFor??T.keepUnusedDataFor;if(M===1/0)return;let P=Math.max(0,Math.min(M,oC));if(!v(E)){let k=S[E];k&&clearTimeout(k),S[E]=setTimeout(()=>{v(E)||R.dispatch(a({queryCacheKey:E})),delete S[E]},P*1e3)}}return g},fm=new Error("Promise never resolved before cacheEntryRemoved."),aC=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:i,internalState:o,selectors:{selectQueryEntry:s,selectApiState:a}})=>{let c=ns(n),u=ns(i),h=Yt(n,i),v={};function S(x,R,T){let _=v[x];_?.valueResolved&&(_.valueResolved({data:R,meta:T}),delete _.valueResolved)}function g(x){let R=v[x];R&&(delete v[x],R.cacheEntryRemoved())}let y=(x,R,T)=>{let _=C(x);function M(P,k,O,F){let L=s(T,k),Q=s(R.getState(),k);!L&&Q&&E(P,F,k,R,O)}if(n.pending.match(x))M(x.meta.arg.endpointName,_,x.meta.requestId,x.meta.arg.originalArgs);else if(e.internalActions.cacheEntriesUpserted.match(x))for(let{queryDescription:P,value:k}of x.payload){let{endpointName:O,originalArgs:F,queryCacheKey:L}=P;M(O,L,x.meta.requestId,F),S(L,k,{})}else if(i.pending.match(x))R.getState()[t].mutations[_]&&E(x.meta.arg.endpointName,x.meta.arg.originalArgs,_,R,x.meta.requestId);else if(h(x))S(_,x.payload,x.meta.baseQueryMeta);else if(e.internalActions.removeQueryResult.match(x)||e.internalActions.removeMutationResult.match(x))g(_);else if(e.util.resetApiState.match(x))for(let P of Object.keys(v))g(P)};function C(x){return c(x)?x.meta.arg.queryCacheKey:u(x)?x.meta.arg.fixedCacheKey??x.meta.requestId:e.internalActions.removeQueryResult.match(x)?x.payload.queryCacheKey:e.internalActions.removeMutationResult.match(x)?ro(x.payload):""}function E(x,R,T,_,M){let P=r.endpointDefinitions[x],k=P?.onCacheEntryAdded;if(!k)return;let O={},F=new Promise($=>{O.cacheEntryRemoved=$}),L=Promise.race([new Promise($=>{O.valueResolved=$}),F.then(()=>{throw fm})]);L.catch(()=>{}),v[T]=O;let Q=e.endpoints[x].select(P.type==="query"?R:T),B=_.dispatch(($,G,W)=>W),V={..._,getCacheEntry:()=>Q(_.getState()),requestId:M,extra:B,updateCachedData:P.type==="query"?$=>_.dispatch(e.util.updateQueryData(x,R,$)):void 0,cacheDataLoaded:L,cacheEntryRemoved:F},U=k(R,V);Promise.resolve(U).catch($=>{if($!==fm)throw $})}return y},cC=({api:e,context:{apiUid:t},reducerPath:r})=>(n,i)=>{e.util.resetApiState.match(n)&&i.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},uC=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:i,api:o,assertTagType:s,refetchQuery:a,internalState:c})=>{let{removeQueryResult:u}=o.internalActions,h=Nt(Yt(n),Xi(n)),v=Nt(Yt(n,i),Lr(n,i)),S=[],g=(E,x)=>{h(E)?C(Am(E,"invalidatesTags",r,s),x):v(E)?C([],x):o.util.invalidateTags.match(E)&&C(Uu(E.payload,void 0,void 0,void 0,void 0,s),x)};function y(E){let{queries:x,mutations:R}=E;for(let T of[x,R])for(let _ in T)if(T[_]?.status==="pending")return!0;return!1}function C(E,x){let R=x.getState(),T=R[e];if(S.push(...E),T.config.invalidationBehavior==="delayed"&&y(T))return;let _=S;if(S=[],_.length===0)return;let M=o.util.selectInvalidatedBy(R,_);t.batch(()=>{let P=Array.from(M.values());for(let{queryCacheKey:k}of P){let O=T.queries[k],F=c.currentSubscriptions[k]??{};O&&(Qn(F)===0?x.dispatch(u({queryCacheKey:k})):O.status!=="uninitialized"&&x.dispatch(a(O)))}})}return g},lC=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:i})=>{let o={},s=(g,y)=>{(r.internalActions.updateSubscriptionOptions.match(g)||r.internalActions.unsubscribeQueryResult.match(g))&&u(g.payload,y),(t.pending.match(g)||t.rejected.match(g)&&g.meta.condition)&&u(g.meta.arg,y),(t.fulfilled.match(g)||t.rejected.match(g)&&!g.meta.condition)&&c(g.meta.arg,y),r.util.resetApiState.match(g)&&v()};function a(g,y){let E=y.getState()[e].queries[g],x=i.currentSubscriptions[g];if(!(!E||E.status==="uninitialized"))return x}function c({queryCacheKey:g},y){let C=y.getState()[e],E=C.queries[g],x=i.currentSubscriptions[g];if(!E||E.status==="uninitialized")return;let{lowestPollingInterval:R,skipPollingIfUnfocused:T}=S(x);if(!Number.isFinite(R))return;let _=o[g];_?.timeout&&(clearTimeout(_.timeout),_.timeout=void 0);let M=Date.now()+R;o[g]={nextPollTimestamp:M,pollingInterval:R,timeout:setTimeout(()=>{(C.config.focused||!T)&&y.dispatch(n(E)),c({queryCacheKey:g},y)},R)}}function u({queryCacheKey:g},y){let E=y.getState()[e].queries[g],x=i.currentSubscriptions[g];if(!E||E.status==="uninitialized")return;let{lowestPollingInterval:R}=S(x);if(!Number.isFinite(R)){h(g);return}let T=o[g],_=Date.now()+R;(!T||_<T.nextPollTimestamp)&&c({queryCacheKey:g},y)}function h(g){let y=o[g];y?.timeout&&clearTimeout(y.timeout),delete o[g]}function v(){for(let g of Object.keys(o))h(g)}function S(g={}){let y=!1,C=Number.POSITIVE_INFINITY;for(let E in g)g[E].pollingInterval&&(C=Math.min(g[E].pollingInterval,C),y=g[E].skipPollingIfUnfocused||y);return{lowestPollingInterval:C,skipPollingIfUnfocused:y}}return s},dC=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let i=rs(r,n),o=Lr(r,n),s=Yt(r,n),a={};return(u,h)=>{if(i(u)){let{requestId:v,arg:{endpointName:S,originalArgs:g}}=u.meta,y=t.endpointDefinitions[S],C=y?.onQueryStarted;if(C){let E={},x=new Promise((M,P)=>{E.resolve=M,E.reject=P});x.catch(()=>{}),a[v]=E;let R=e.endpoints[S].select(y.type==="query"?g:v),T=h.dispatch((M,P,k)=>k),_={...h,getCacheEntry:()=>R(h.getState()),requestId:v,extra:T,updateCachedData:y.type==="query"?M=>h.dispatch(e.util.updateQueryData(S,g,M)):void 0,queryFulfilled:x};C(g,_)}}else if(s(u)){let{requestId:v,baseQueryMeta:S}=u.meta;a[v]?.resolve({data:u.payload,meta:S}),delete a[v]}else if(o(u)){let{requestId:v,rejectedWithValue:S,baseQueryMeta:g}=u.meta;a[v]?.reject({error:u.payload??u.error,isUnhandledError:!S,meta:g}),delete a[v]}}},pC=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:i})=>{let{removeQueryResult:o}=r.internalActions,s=(c,u)=>{Mu.match(c)&&a(u,"refetchOnFocus"),ju.match(c)&&a(u,"refetchOnReconnect")};function a(c,u){let h=c.getState()[e],v=h.queries,S=i.currentSubscriptions;t.batch(()=>{for(let g of Object.keys(S)){let y=v[g],C=S[g];if(!C||!y)continue;(Object.values(C).some(x=>x[u]===!0)||Object.values(C).every(x=>x[u]===void 0)&&h.config[u])&&(Qn(C)===0?c.dispatch(o({queryCacheKey:g})):y.status!=="uninitialized"&&c.dispatch(n(y)))}})}return s};function fC(e){let{reducerPath:t,queryThunk:r,api:n,context:i}=e,{apiUid:o}=i,s={invalidateTags:q(`${t}/invalidateTags`)},a=v=>v.type.startsWith(`${t}/`),c=[cC,sC,uC,lC,aC,dC];return{middleware:v=>{let S=!1,y={...e,internalState:{currentSubscriptions:{}},refetchQuery:h,isThisApiSliceAction:a},C=c.map(R=>R(y)),E=nC(y),x=pC(y);return R=>T=>{if(!Fn(T))return R(T);S||(S=!0,v.dispatch(n.internalActions.middlewareRegistered(o)));let _={...v,next:R},M=v.getState(),[P,k]=E(T,_,M),O;if(P?O=R(T):O=k,v.getState()[t]&&(x(T,_,M),a(T)||i.hasRehydrationInfo(T)))for(let F of C)F(T,_,M);return O}},actions:s};function h(v){return e.api.endpoints[v.endpointName].initiate(v.originalArgs,{subscribe:!1,forceRefetch:!0})}}var mm=Symbol(),mC=({createSelector:e=Me}={})=>({name:mm,init(t,{baseQuery:r,tagTypes:n,reducerPath:i,serializeQueryArgs:o,keepUnusedDataFor:s,refetchOnMountOrArgChange:a,refetchOnFocus:c,refetchOnReconnect:u,invalidationBehavior:h},v){Xp();let S=ce=>(typeof process<"u",ce);Object.assign(t,{reducerPath:i,endpoints:{},internalActions:{onOnline:ju,onOffline:vm,onFocus:Mu,onFocusLost:ym},util:{}});let g=tC({serializeQueryArgs:o,reducerPath:i,createSelector:e}),{selectInvalidatedBy:y,selectCachedArgsForQuery:C,buildQuerySelector:E,buildInfiniteQuerySelector:x,buildMutationSelector:R}=g;Xt(t.util,{selectInvalidatedBy:y,selectCachedArgsForQuery:C});let{queryThunk:T,infiniteQueryThunk:_,mutationThunk:M,patchQueryData:P,updateQueryData:k,upsertQueryData:O,prefetch:F,buildMatchThunkActions:L}=Zb({baseQuery:r,reducerPath:i,context:v,api:t,serializeQueryArgs:o,assertTagType:S,selectors:g}),{reducer:Q,actions:B}=eC({context:v,queryThunk:T,infiniteQueryThunk:_,mutationThunk:M,serializeQueryArgs:o,reducerPath:i,assertTagType:S,config:{refetchOnFocus:c,refetchOnReconnect:u,refetchOnMountOrArgChange:a,keepUnusedDataFor:s,reducerPath:i,invalidationBehavior:h}});Xt(t.util,{patchQueryData:P,updateQueryData:k,upsertQueryData:O,prefetch:F,resetApiState:B.resetApiState,upsertQueryEntries:B.cacheEntriesUpserted}),Xt(t.internalActions,B);let{middleware:V,actions:U}=fC({reducerPath:i,context:v,queryThunk:T,mutationThunk:M,infiniteQueryThunk:_,api:t,assertTagType:S,selectors:g});Xt(t.util,U),Xt(t,{reducer:Q,middleware:V});let{buildInitiateQuery:$,buildInitiateInfiniteQuery:G,buildInitiateMutation:W,getRunningMutationThunk:K,getRunningMutationsThunk:ee,getRunningQueriesThunk:ue,getRunningQueryThunk:he}=Xb({queryThunk:T,mutationThunk:M,infiniteQueryThunk:_,api:t,serializeQueryArgs:o,context:v});return Xt(t.util,{getRunningMutationThunk:K,getRunningMutationsThunk:ee,getRunningQueryThunk:he,getRunningQueriesThunk:ue}),{name:mm,injectEndpoint(ce,le){var Fe;let pe=(Fe=t.endpoints)[ce]??(Fe[ce]={});qu(le)&&Xt(pe,{name:ce,select:E(ce,le),initiate:$(ce,le)},L(T,ce)),Wb(le)&&Xt(pe,{name:ce,select:R(),initiate:W(ce)},L(M,ce)),Lu(le)&&Xt(pe,{name:ce,select:x(ce,le),initiate:G(ce,le)},L(T,ce))}}}}),As=rC(mC());m();d();f();p();var Vu=/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:i,environment:o,organizationId:s}=n.configuration,a=n.generatedAnswer.answerConfigurationId,c={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${i}`}};try{let u=Te(s,o);return{data:hm({baseUrl:`${u}/rest/organizations/${s}/answer/v1/configs/${a}`,fetchFn:function(){var _ref15=_asyncToGenerator(function*(v){if(v instanceof String)throw new Error("The provided 'request' must be a Request object.");let S=v.url,g={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(y=>{g[y]=v[y]}),g.duplex="half",g.body=yield v.text(),w(S,g)});return function fetchFn(_x35){return _ref15.apply(this,arguments)}}()})(c,{...t,signal:null},r)}}catch(u){return{error:u}}});return function Vu(_x32,_x33,_x34){return _ref14.apply(this,arguments)}}(),bm=As({reducerPath:"answer",baseQuery:Ss(Vu,{maxRetries:3}),endpoints:()=>({})});var zn=As({reducerPath:"answerGenerationApi",refetchOnMountOrArgChange:!0,baseQuery:Ss(Vu,{maxRetries:3}),endpoints:()=>({})});m();d();f();p();m();d();f();p();m();d();f();p();var Vr=e=>e.query,Cm=e=>e.query?.enableQuerySyntax;var eq=Me(e=>Vr(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,r,n,i)=>({q:e,requestId:t,cannotAnswer:r,analyticsMode:n,actionCause:i})),gC=Me(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();m();d();f();p();var ws=()=>({contentFormat:void 0,answer:void 0,citations:void 0,error:void 0,generated:!1,isStreaming:!1,isLoading:!0});m();d();f();p();m();d();f();p();m();d();f();p();function Em(_x36,_x37){return _Em.apply(this,arguments)}function _Em(){_Em=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _Em.apply(this,arguments)}function Im(e){let t,r,n,i=!1;return function(s){t===void 0?(t=s,r=0,n=-1):t=yC(t,s);let a=t.length,c=0;for(;r<a;){i&&(t[r]===10&&(c=++r),i=!1);let u=-1;for(;r<a&&u===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-c);break;case 13:i=!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 Rm(e,t,r){let n=xm(),i=new TextDecoder;return function(s,a){if(s.length===0)r?.(n),n=xm();else if(a>0){let c=i.decode(s.subarray(0,a)),u=a+(s[a+1]===32?2:1),h=i.decode(s.subarray(u));switch(c){case"data":n.data=n.data?`${n.data}
|
|
27
|
-
${h}`:h;break;case"event":n.event=h;break;case"id":e(n.id=h);break;case"retry":hC(h,n,t);break}}}}function hC(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function yC(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function xm(){return{data:"",event:"",id:"",retry:void 0}}var Gu="text/event-stream",vC=1e3,Tm="last-event-id";function _m(){return typeof window<"u"}function bs(e,{signal:t,headers:r,onopen:n,onmessage:i,onclose:o,onerror:s,openWhenHidden:a,fetch:c,...u}){return new Promise((h,v)=>{let S={...r};S.accept||(S.accept=Gu);let g;function y(){g?.abort(),document.hidden||_()}!a&&_m()&&document.addEventListener("visibilitychange",y);let C=vC,E;function x(){_m()&&document.removeEventListener("visibilitychange",y),clearTimeout(E),g?.abort()}t?.addEventListener("abort",()=>{x(),h()});let R=c??w,T=n??SC;function _(){return _2.apply(this,arguments)}function _2(){_2=_asyncToGenerator(function*(){g=l.AbortController?new l.AbortController:null;try{let M=yield R(e,{...u,headers:S,signal:g?.signal});yield T(M),yield Em(M.body,Im(Rm(P=>{P?S[Tm]=P:delete S[Tm]},P=>{C=P},i))),o?.(),x(),h()}catch(M){if(!g?.signal?.aborted)try{let P=s?.(M)??C;clearTimeout(E),E=setTimeout(_,P)}catch(P){x(),v(P)}}});return _2.apply(this,arguments)}_()})}function SC(e){let t=e.headers.get("content-type");if(!t?.startsWith(Gu))throw new Error(`Expected content-type to be ${Gu}, Actual: ${t}`)}m();d();f();p();m();d();f();p();var km=(e,t)=>{t&&(e.answerId=t)},Om=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},Pm=(e,t)=>{e.answer===void 0?e.answer=t.textDelta:typeof t.textDelta=="string"&&(e.answer=e.answer.concat(t.textDelta))},Nm=(e,t)=>{e.citations=t.citations},Fm=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},Dm=(e,t)=>{let r=t.errorMessage||"Unknown error occurred";e.error={message:r,code:t.code??500},e.isStreaming=!1,e.isLoading=!1,console.error(`Generated answer error: ${r} (code: ${t.code})`)};var Cs={handleOpen:(e,t)=>{let r=e.headers.get("x-answer-id");r&&t(n=>{km(n,r)})},handleMessage:{"agentInteraction.answerHeader":(e,t)=>{t(r=>{Om(r,{contentFormat:"text/markdown"})})},"generativeengines.messageType":(e,t)=>{e?.payload?.textDelta&&t(r=>{Pm(r,e.payload)})},"agentInteraction.citations":(e,t)=>{e?.payload?.citations!==void 0&&t(r=>{Nm(r,e.payload)})},"generativeengines.endOfStreamType":(e,t)=>{t(r=>{Fm(r,e.payload)})},error:(e,t)=>{e.finishReason==="ERROR"&&t(r=>{Dm(r,e)})}}};var xs=(e,t,r,n)=>{let{dispatch:i,updateCachedData:o,getState:s}=r,{configuration:{accessToken:a}}=s();return bs(e,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${a}`,Accept:"text/event-stream","Content-Type":"application/json","Accept-Encoding":"*"},fetch:w,onopen:function(){var _ref16=_asyncToGenerator(function*(c){Cs.handleOpen(c,o),n.handleOpen(c,i)});return function onopen(_x38){return _ref16.apply(this,arguments)}}(),onclose:()=>{n.handleClose?.(i)},onerror:c=>{n.handleError(c)},onmessage:c=>{let u=AC(c.data);if(!u)return;Cs.handleMessage.error?.(u,o),n.handleMessage.error?.(u,i);let h=u.payloadType;Cs.handleMessage[h]?.(u,o),n.handleMessage[h]?.(u,i)}})};function AC(e){if(!e?.length)return null;try{return JSON.parse(e)}catch(t){return console.warn("Failed to parse message",{payload:e,error:t}),null}}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Mm=e=>{let{configuration:t}=e,{organizationId:r,environment:n,knowledge:{agentId:i}}=t,o=Te(r,n),s=i?.trim();if(!o||!r||!s)throw new Error("Missing required parameters for follow up endpoint");let a=`/api/preview/organizations/${r}/agents`;return`${o}${a}/${s}/follow-up`};var wC=zn.injectEndpoints({overrideExisting:!0,endpoints:e=>({generateFollowUpAnswer:e.query({queryFn:()=>({data:ws()}),onQueryStarted(_x39,_x40){return _asyncToGenerator(function*(t,{getState:r,updateCachedData:n,dispatch:i}){let{strategyKey:o,...s}=t,a=Mm(r());yield xs(a,s,{getState:r,updateCachedData:n,dispatch:i},Es[o]?.())}).apply(this,arguments)}})})}),jm=e=>wC.endpoints.generateFollowUpAnswer.initiate(e);m();d();f();p();var Bu=e=>e.configuration.search.locale,qm=e=>e.configuration.search.timezone,Lm=e=>e.configuration.accessToken,Um=e=>e.configuration.organizationId,Vm=e=>e.configuration.environment,lr=e=>e.configuration?.knowledge?.agentId;m();d();f();p();var Wn=["searching","thinking","answering"];m();d();f();p();var Gm=(e,t)=>({conversationId:t.followUpAnswers?.conversationId??"",q:e});var bC=new J({required:!0}),Is=q("followUpAnswers/setIsEnabled",e=>z(e,new De({required:!0}))),Rs=q("followUpAnswers/setFollowUpAnswersConversationId",e=>z(e,te)),CC=q("followUpAnswers/createFollowUpAnswer",e=>z(e,{question:te})),Bm=q("followUpAnswers/setActiveFollowUpAnswerId",e=>z(e,te)),$m=q("followUpAnswers/setFollowUpAnswerContentFormat",e=>z(e,{contentFormat:Ts,answerId:te})),Qm=q("followUpAnswers/setFollowUpIsLoading",e=>z(e,{isLoading:new De({required:!0}),answerId:te})),EL=q("followUpAnswers/setFollowUpIsStreaming",e=>z(e,{isStreaming:new De({required:!0}),answerId:te})),Hm=q("followUpAnswers/followUpMessageChunkReceived",e=>z(e,{textDelta:bC,answerId:te})),zm=q("followUpAnswers/followUpCitationsReceived",e=>z(e,{citations:new Et({required:!0,each:new xe({values:$u})}),answerId:te})),Wm=q("followUpAnswers/followUpCompleted",e=>z(e,{answerId:te,cannotAnswer:new De({required:!1})})),Km=q("followUpAnswers/followUpFailed",e=>z(e,{message:new J,code:new Le({min:0}),answerId:te})),IL=q("followUpAnswers/activeFollowUpStartFailed",e=>z(e,{message:new J})),RL=q("followUpAnswers/likeFollowUp",e=>z(e,{answerId:te})),TL=q("followUpAnswers/dislikeFollowUp",e=>z(e,{answerId:te})),_L=q("followUpAnswers/submitFollowUpFeedback",e=>z(e,{answerId:te})),Ym=q("followUpAnswers/resetFollowUpAnswers"),kL=q("followUpAnswers/stepStarted",e=>z(e,{answerId:te,name:new J({required:!0,constrainTo:Wn}),startedAt:new Le({min:0,required:!0})})),OL=q("followUpAnswers/stepFinished",e=>z(e,{answerId:te,name:new J({required:!0,constrainTo:Wn}),finishedAt:new Le({min:0,required:!0})})),PL=ve("generatedAnswerWithFollowUps/generateFollowUpAnswer",/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{logger:n}}){let i=t(),o=lr(i)?.trim(),s=Gm(e,i);if(!o){n.warn("Missing agentId in engine configuration. The generateFollowUpAnswer action requires an agent ID.");return}if(!s.conversationId){n.warn("Missing conversationId when generating a follow-up answer. The generateFollowUpAnswer action requires an existing conversation.");return}r(CC({question:e})),yield r(jm({strategyKey:"follow-up-answer",...s}))});return function(_x41,_x42){return _ref17.apply(this,arguments)}}());var Xm=()=>{let e=null;return{handleOpen:(t,r)=>{e=t.headers.get("x-answer-id"),e&&(r(Bm(e)),r(Qm({answerId:e,isLoading:!0})),r($m({contentFormat:"text/markdown",answerId:e})))},handleError:t=>{throw t},handleMessage:{"generativeengines.messageType":(t,r)=>{t?.payload?.textDelta&&r(Hm({textDelta:t.payload.textDelta,answerId:e}))},"agentInteraction.citations":(t,r)=>{t?.payload?.citations!==void 0&&r(zm({citations:t.payload.citations,answerId:e}))},"generativeengines.endOfStreamType":(t,r)=>{let n=t?.payload?.answerGenerated??!1;r(Wm({cannotAnswer:!n,answerId:e}))},error:(t,r)=>{t.finishReason==="ERROR"&&r(Km({answerId:e,message:t.errorMessage,code:t.code}))}}}};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function Jt(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 i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function D(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{u(n.next(h))}catch(v){s(v)}}function c(h){try{u(n.throw(h))}catch(v){s(v)}}function u(h){h.done?o(h.value):i(h.value).then(a,c)}u((n=n.apply(e,t||[])).next())})}var me;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(me||(me={}));function zu(){return typeof window<"u"}function sl(){return typeof navigator<"u"}function Kn(){return typeof document<"u"}function Wu(){try{return typeof localStorage<"u"}catch{return!1}}function xC(){try{return typeof sessionStorage<"u"}catch{return!1}}function dg(){return sl()&&navigator.cookieEnabled}var EC=[me.click,me.custom,me.search,me.view],IC=(e,t)=>EC.indexOf(e)!==-1?Object.assign({language:Kn()?document.documentElement.lang:"unknown",userAgent:sl()?navigator.userAgent:"unknown"},t):t,io=class e{static set(t,r,n){var i,o,s,a;n&&(o=new Date,o.setTime(o.getTime()+n)),a=window.location.hostname,a.indexOf(".")===-1?Jm(t,r,o):(s=a.split("."),i=s[s.length-2]+"."+s[s.length-1],Jm(t,r,o,i))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){var o=n[i];if(o=o.replace(/^\s+/,""),o.lastIndexOf(r,0)===0)return o.substring(r.length,o.length)}return null}static erase(t){e.set(t,"",-1)}};function Jm(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function RC(){return Wu()?localStorage:dg()?new oo:xC()?sessionStorage:new Xn}var oo=class e{getItem(t){return io.get(`${e.prefix}${t}`)}removeItem(t){io.erase(`${e.prefix}${t}`)}setItem(t,r,n){io.set(`${e.prefix}${t}`,r,n)}};oo.prefix="coveo_";var Ku=class{constructor(){this.cookieStorage=new oo}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)}},Xn=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},_s="__coveo.analytics.history",TC=20,_C=1e3*60,kC=75,Ps=class{constructor(t){this.store=t||RC()}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 D(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 D(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(_s);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return D(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(_s);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(_s,JSON.stringify(t.slice(0,TC)))}catch{}}clear(){try{this.store.removeItem(_s)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,i)=>(i.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,kC)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>_C:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:i,value:o}=r;return{name:n,time:i,value:o}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:i}=t;return r&&typeof i=="string"&&r.toLowerCase()==="query"&&i.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var OC=(e,t)=>D(void 0,void 0,void 0,function*(){return e===me.view?(yield PC(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),PC=e=>D(void 0,void 0,void 0,function*(){let t=new Ps,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),ks,NC=new Uint8Array(16);function FC(){if(!ks&&(ks=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ks))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ks(NC)}var DC=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Ns(e){return typeof e=="string"&&DC.test(e)}var Ke=[];for(let e=0;e<256;++e)Ke.push((e+256).toString(16).slice(1));function pg(e,t=0){return Ke[e[t+0]]+Ke[e[t+1]]+Ke[e[t+2]]+Ke[e[t+3]]+"-"+Ke[e[t+4]]+Ke[e[t+5]]+"-"+Ke[e[t+6]]+Ke[e[t+7]]+"-"+Ke[e[t+8]]+Ke[e[t+9]]+"-"+Ke[e[t+10]]+Ke[e[t+11]]+Ke[e[t+12]]+Ke[e[t+13]]+Ke[e[t+14]]+Ke[e[t+15]]}function MC(e){if(!Ns(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}function jC(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var qC="6ba7b810-9dad-11d1-80b4-00c04fd430c8",LC="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function UC(e,t,r){function n(i,o,s,a){var c;if(typeof i=="string"&&(i=jC(i)),typeof o=="string"&&(o=MC(o)),((c=o)===null||c===void 0?void 0:c.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+i.length);if(u.set(o),u.set(i,o.length),u=r(u),u[6]=u[6]&15|t,u[8]=u[8]&63|128,s){a=a||0;for(let h=0;h<16;++h)s[a+h]=u[h];return s}return pg(u)}try{n.name=e}catch{}return n.DNS=qC,n.URL=LC,n}var VC=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Zm={randomUUID:VC};function Gr(e,t,r){if(Zm.randomUUID&&!t&&!e)return Zm.randomUUID();e=e||{};let n=e.random||(e.rng||FC)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return pg(n)}function GC(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 Qu(e,t){return e<<t|e>>>32-t}function BC(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let s=unescape(encodeURIComponent(e));e=[];for(let a=0;a<s.length;++a)e.push(s.charCodeAt(a))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,i=Math.ceil(n/16),o=new Array(i);for(let s=0;s<i;++s){let a=new Uint32Array(16);for(let c=0;c<16;++c)a[c]=e[s*64+c*4]<<24|e[s*64+c*4+1]<<16|e[s*64+c*4+2]<<8|e[s*64+c*4+3];o[s]=a}o[i-1][14]=(e.length-1)*8/Math.pow(2,32),o[i-1][14]=Math.floor(o[i-1][14]),o[i-1][15]=(e.length-1)*8&4294967295;for(let s=0;s<i;++s){let a=new Uint32Array(80);for(let g=0;g<16;++g)a[g]=o[s][g];for(let g=16;g<80;++g)a[g]=Qu(a[g-3]^a[g-8]^a[g-14]^a[g-16],1);let c=r[0],u=r[1],h=r[2],v=r[3],S=r[4];for(let g=0;g<80;++g){let y=Math.floor(g/20),C=Qu(c,5)+GC(y,u,h,v)+S+t[y]+a[g]>>>0;S=v,v=h,h=Qu(u,30)>>>0,u=c,c=C}r[0]=r[0]+c>>>0,r[1]=r[1]+u>>>0,r[2]=r[2]+h>>>0,r[3]=r[3]+v>>>0,r[4]=r[4]+S>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var $C=UC("v5",80,BC),eg=$C,fg="2.30.52",tg=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,no={pageview:"pageview",event:"event"},Fs=class{constructor({client:t,uuidGenerator:r=Gr}){this.client=t,this.uuidGenerator=r}},Yu=class extends Fs{constructor({client:t,uuidGenerator:r=Gr}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=tg(window.location),this.lastReferrer=Kn()?document.referrer:"",this.addHooks()}getApi(t){switch(t){case"setAction":return this.setAction;default:return 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:Kn()?document.title:"",encoding:Kn()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},i={language:navigator.language,userAgent:navigator.userAgent},o={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},o),n),i),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:i,location:o}=this.getNextValues(t,r);this.lastReferrer=i,this.pageViewId=n,this.currentLocation=o,t===no.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===no.pageview?this.nextPageViewId:this.pageViewId,referrer:t===no.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===no.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=i=>i.replace(/^\/?(.*)$/,"/$1");return`${(i=>i.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return tg(window.location)}},dr=class e{constructor(t,r){if(!Ns(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(i=>new RegExp(i.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,i]=r;if(n.length!==32||isNaN(parseInt(i)))return null;let o=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return Ns(o)?new e(o,Number.parseInt(i)*1e3):null}};dr.cvo_cid="cvo_cid";dr.expirationTime=120;var Xu=class extends Fs{constructor({client:t,uuidGenerator:r=Gr}){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 D(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(dr.cvo_cid,new dr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Xu.Id="link";var yt=Object.keys;function Os(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Hu=128,mg=192,rg=224,ng=240;function QC(e){return(e&248)===ng?4:(e&ng)===rg?3:(e&rg)===mg?2:1}function HC(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&Hu)!=Hu)break;if(r-=3,(n&mg)!=Hu){t-r>=QC(n)*3&&(r=t);break}}return e.substring(0,r)}var Ju={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"},zC=yt(Ju).map(e=>Ju[e]),WC=[...zC].join("|"),KC=new RegExp(`^(${WC}$)`),YC={svcAction:"svc_action",svcActionData:"svc_action_data"},XC=e=>yt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=Ju[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),JC=e=>KC.test(e),ZC=[JC],ig={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},og={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},Ze={action:"pa",list:"pal",listSource:"pls"},Ds={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},ex=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Zu={id:"quoteId",affiliation:"quoteAffiliation"},el={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},tx={add:Ze,bookmark_add:Ze,bookmark_remove:Ze,click:Ze,checkout:Ze,checkout_option:Ze,detail:Ze,impression:Ze,remove:Ze,refund:Object.assign(Object.assign({},Ze),Ds),purchase:Object.assign(Object.assign({},Ze),Ds),quickview:Ze,quote:Object.assign(Object.assign({},Ze),Zu),review:Object.assign(Object.assign({},Ze),el)},rx=yt(ig).map(e=>ig[e]),nx=yt(og).map(e=>og[e]),ix=yt(Ze).map(e=>Ze[e]),ox=yt(Ds).map(e=>Ds[e]),sx=yt(el).map(e=>el[e]),ax=yt(Zu).map(e=>Zu[e]),cx=[...rx,"custom"].join("|"),ux=[...nx,"custom"].join("|"),gg="(pr[0-9]+)",hg="(il[0-9]+pi[0-9]+)",lx=new RegExp(`^${gg}(${cx})$`),dx=new RegExp(`^(${hg}(${ux}))|(il[0-9]+nm)$`),px=new RegExp(`^(${ix.join("|")})$`),fx=new RegExp(`^(${ox.join("|")})$`),mx=new RegExp(`^${gg}custom$`),gx=new RegExp(`^${hg}custom$`),hx=new RegExp(`^(${[...ex,...sx,...ax].join("|")})$`),yx=e=>lx.test(e),vx=e=>dx.test(e),Sx=e=>px.test(e),Ax=e=>fx.test(e),wx=e=>hx.test(e),bx=[vx,yx,Sx,Ax,wx],Cx=[mx,gx],xx={anonymizeIp:"aip"},Ex={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},Ix={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},Rx=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],Tx=Object.assign(Object.assign(Object.assign(Object.assign({},xx),Ex),Ix),Rx.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),tl=Object.assign(Object.assign({},Tx),YC),_x=e=>{let t=!!e.action&&tx[e.action]||{};return yt(e).reduce((r,n)=>{let i=t[n]||tl[n]||n;return Object.assign(Object.assign({},r),{[i]:e[n]})},{})},kx=yt(tl).map(e=>tl[e]),Ox=e=>kx.indexOf(e)!==-1,Px=e=>e==="custom",Nx=e=>[...bx,...ZC,Ox,Px].some(t=>t(e)),Fx=e=>yt(e).reduce((t,r)=>{let n=Dx(r);return n?Object.assign(Object.assign({},t),Mx(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),Dx=e=>{let t;return[...Cx].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},Mx=(e,t)=>yt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),rl=class{constructor(t){this.opts=t}sendEvent(t,r){return D(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:i}=this.opts,o=yield this.getQueryParamsForEventType(t),{url:s,payload:a}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${o}`,r,i),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 D(this,void 0,void 0,function*(){let i=t,o=r;if(n){let s=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:a,body:c}=s;i=a||t;try{o=JSON.parse(c)}catch(u){console.error("Unable to process the request body as a JSON string",u)}}return{payload:o,url:i}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return D(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,i=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",i?`visitorId=${i}`:"","discardVisitInfo=true"].filter(o=>!!o).join("&")})}isEventTypeLegacy(t){return[me.click,me.custom,me.search,me.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let i=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(i=`access_token=${encodeURIComponent(n)}&${i}`),i}},nl=class{sendEvent(t,r){return D(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return D(this,void 0,void 0,function*(){return Promise.resolve()})}},sg=A.fetch,Ms=class{constructor(t){this.opts=t}sendEvent(t,r){return D(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:i,preprocessRequest:o}=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),o?yield o(a,"analyticsFetch"):{}),{url:u}=c,h=Jt(c,["url"]),v;try{v=yield sg(u,h)}catch(S){console.error("An error has occured when sending the event.",S);return}if(v.ok){let S=yield v.json();return S.visitorId&&i.setCurrentVisitorId(S.visitorId),S}else{try{v.json()}catch{}throw console.error(`An error has occured 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 D(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield sg(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[me.click,me.custom,me.search,me.view].indexOf(t)!==-1}getVisitorIdParam(){return D(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"})}},il=class{constructor(t,r){Wu()&&dg()?this.storage=new Ku:Wu()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Xn),this.client=new Ms(t),this.beaconClient=new rl(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:i,payload:o}of n)this.beaconClient.sendEvent(i,o)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},ol=class{constructor(t,r){this.storage=r||new Xn,this.client=new Ms(t)}getClientDependingOnEventType(t){return this.client}},js=class{constructor(){this.storage=new Xn,this.client=new nl}getClientDependingOnEventType(t){return this.client}},jx="xx",qx=e=>e?.startsWith(jx)||!1,Lx=`
|
|
26
|
+
`;return new qc(r)}var qc=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},xt=class{constructor(e){this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let i in this.definition){let o=this.definition[i].validate(r[i]);o&&n.push(`${i}: ${o}`)}if(n.length)throw yA(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}},Or=class{constructor(e={}){this.baseConfig=e}validate(e){return this.baseConfig.required&&ie(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 Cn(e){return e===void 0}function vA(e){return e===null}function ie(e){return Cn(e)||vA(e)}var Fe=class{constructor(e={}){we(this,"value");this.value=new Or(e)}validate(e){let t=this.value.validate(e);return t||(SA(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function SA(e){return Cn(e)||yp(e)}function yp(e){return typeof e=="boolean"}var Le=class{constructor(e={}){we(this,"value");this.config=e,this.value=new Or(e)}validate(e){let t=this.value.validate(e);return t||(AA(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 AA(e){return Cn(e)||vp(e)}function vp(e){return typeof e=="number"&&!Number.isNaN(e)}var bA=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,J=class{constructor(e={}){we(this,"value");we(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Or(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:i,ISODate:o}=this.config,s=this.value.validate(e);if(s)return s;if(Cn(e))return null;if(!Sp(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}`:i&&!i.includes(e)?`value should be one of: ${i.join(", ")}.`:o&&!(bA.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 Sp(e){return Object.prototype.toString.call(e)==="[object String]"}var xe=class{constructor(e={}){we(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Cn(e))return this.config.options.required?"value is required and is currently undefined":null;if(!Ap(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ie(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let i=e[r],o=n.validate(i);o!==null&&(t+=` ${o}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function Ap(e){return e!==void 0&&typeof e=="object"}var Et=class{constructor(e={}){we(this,"value");this.config=e,this.value=new Or(this.config)}validate(e){if(!ie(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ie(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&&ie(n)&&(r=`value is null or undefined: ${e.join(",")}`);let i=this.validatePrimitiveValue(n,this.config.each);i!==null&&(r+=` ${i}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return yp(e)||Sp(e)||vp(e)||Ap(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function bp(e){return Array.isArray(e)}var Lc=class{constructor(e){we(this,"value");this.config=e,this.value=new Or(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Cn(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 No=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();var xn=class{constructor(t){we(this,"_basePath");we(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 Uc(e){let{url:t,accessToken:r,organizationId:n,authentication:i,...o}=e;return o}var Vc=e=>{let{response:t}=e;return t.body?wA(e):CA(t)},wA=e=>EA(e)?RA(e):xA(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},CA=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function xA(e){return e.body.statusCode!==void 0}function EA(e){return e.body.exception!==void 0}var RA=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();function wp(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var Bc=(e,t,r,n)=>{let i=new xn(`${e.url}${n}`);return i.addParam("organizationId",e.organizationId),e.authentication&&i.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:i.href,origin:"searchApiFetch"}};var Cp=(e,t)=>{let r=new xn(`${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},Gc=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield ar.call({...Bc(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Uc(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=wp(r),i=yield r.arrayBuffer(),s=new TextDecoder(n).decode(i);return IA(s)?{success:s}:{error:Vc({response:r,body:s})}});return function Gc(_x3,_x4){return _ref3.apply(this,arguments)}}();function IA(e){return typeof e=="string"}m();d();f();p();function TA(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function _A(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Fo(e,t){if(t&&e.name==="AbortError")return{error:_A(e)};if(e instanceof kr)return{error:TA(e)};throw e}m();d();f();p();m();d();f();p();var Do=(e,t,r,n,i={})=>{kA(e);let o=`${e.url}/rest/organizations/${e.organizationId}/caseassists/${e.caseAssistId}${n}`,s=OA(i),a=s?`${o}?${s}`:o;return{accessToken:e.accessToken,method:t,contentType:r,url:a,origin:"caseAssistApiFetch"}},Mo=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r],t),{}),jo=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r].value,t),{}),kA=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.")},OA=e=>Object.keys(e).map(t=>`${t}=${encodeURIComponent(e[t])}`).join("&");var xp=e=>{let t=e.debug?{debug:"1"}:{};return{...Do(e,"POST","application/json","/classify",t),requestParams:PA(e)}},PA=e=>({clientId:e.clientId,locale:e.locale,fields:Mo(e.fields)});m();d();f();p();var Ep=e=>{let t={};return e.debug&&(t.debug="1"),e.numberOfResults&&(t.numberOfResults=e.numberOfResults.toString()),{...Do(e,"POST","application/json","/documents/suggest",t),requestParams:NA(e)}},NA=e=>({clientId:e.clientId,locale:e.locale,fields:Mo(e.fields),context:e.context,analytics:e.analytics});var qo=class{constructor(t){this.options=t}getCaseClassifications(t){var _this=this;return _asyncToGenerator(function*(){let r=yield ar.call({...xp(t),..._this.options});if(r instanceof Error)return Fo(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}getDocumentSuggestions(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield ar.call({...Ep(t),..._this2.options});if(r instanceof Error)return Fo(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this3=this;return _asyncToGenerator(function*(){return Gc(t,_this3.options)})()}};m();d();f();p();m();d();f();p();m();d();f();p();function He(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 FA=typeof Symbol=="function"&&Symbol.observable||"@@observable",Rp=FA,$c=()=>Math.random().toString(36).substring(7).split("").join("."),DA={INIT:`@@redux/INIT${$c()}`,REPLACE:`@@redux/REPLACE${$c()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${$c()}`},Lo=DA;function Ot(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 Qc(e,t,r){if(typeof e!="function")throw new Error(He(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(He(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(He(1));return r(Qc)(e,t)}let n=e,i=t,o=new Map,s=o,a=0,c=!1;function u(){s===o&&(s=new Map,o.forEach((E,x)=>{s.set(x,E)}))}function h(){if(c)throw new Error(He(3));return i}function v(E){if(typeof E!="function")throw new Error(He(4));if(c)throw new Error(He(5));let x=!0;u();let I=a++;return s.set(I,E),function(){if(x){if(c)throw new Error(He(6));x=!1,u(),s.delete(I),o=null}}}function S(E){if(!Ot(E))throw new Error(He(7));if(typeof E.type>"u")throw new Error(He(8));if(typeof E.type!="string")throw new Error(He(17));if(c)throw new Error(He(9));try{c=!0,i=n(i,E)}finally{c=!1}return(o=s).forEach(I=>{I()}),E}function g(E){if(typeof E!="function")throw new Error(He(10));n=E,S({type:Lo.REPLACE})}function y(){let E=v;return{subscribe(x){if(typeof x!="object"||x===null)throw new Error(He(11));function I(){let _=x;_.next&&_.next(h())}return I(),{unsubscribe:E(I)}},[Rp](){return this}}}return S({type:Lo.INIT}),{dispatch:S,subscribe:v,getState:h,replaceReducer:g,[Rp]:y}}function MA(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Lo.INIT})>"u")throw new Error(He(12));if(typeof r(void 0,{type:Lo.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(He(13))})}function En(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),i,o;try{MA(r)}catch(s){o=s}return function(a={},c){if(o)throw o;let u=!1,h={};for(let v=0;v<n.length;v++){let S=n[v],g=r[S],y=a[S],C=g(y,c);if(typeof C>"u"){let E=c&&c.type;throw new Error(He(14))}h[S]=C,u=u||C!==y}return u=u||n.length!==Object.keys(a).length,u?h:a}}function Rn(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Ip(...e){return t=>(r,n)=>{let i=t(r,n),o=()=>{throw new Error(He(15))},s={getState:i.getState,dispatch:(c,...u)=>o(c,...u)},a=e.map(c=>c(s));return o=Rn(...a)(i.dispatch),{...i,dispatch:o}}}function In(e){return Ot(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var tu=Symbol.for("immer-nothing"),Pi=Symbol.for("immer-draftable"),it=Symbol.for("immer-state");function ze(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Tn=Object.getPrototypeOf;function dt(e){return!!e&&!!e[it]}function ot(e){return e?Np(e)||Array.isArray(e)||!!e[Pi]||!!e.constructor?.[Pi]||_n(e)||qi(e):!1}var jA=Object.prototype.constructor.toString(),Tp=new WeakMap;function Np(e){if(!e||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=Tp.get(r);return n===void 0&&(n=Function.toString.call(r),Tp.set(r,n)),n===jA}function ru(e){return dt(e)||ze(15,e),e[it].base_}function Ni(e,t,r=!0){Nr(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function Nr(e){let t=e[it];return t?t.type_:Array.isArray(e)?1:_n(e)?2:qi(e)?3:0}function Fi(e,t){return Nr(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Hc(e,t){return Nr(e)===2?e.get(t):e[t]}function Fp(e,t,r){let n=Nr(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function qA(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function _n(e){return e instanceof Map}function qi(e){return e instanceof Set}function Pr(e){return e.copy_||e.base_}function Kc(e,t){if(_n(e))return new Map(e);if(qi(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=Np(e);if(t===!0||t==="class_only"&&!r){let n=Object.getOwnPropertyDescriptors(e);delete n[it];let i=Reflect.ownKeys(n);for(let o=0;o<i.length;o++){let s=i[o],a=n[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(n[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(Tn(e),n)}else{let n=Tn(e);if(n!==null&&r)return{...e};let i=Object.create(n);return Object.assign(i,e)}}function Go(e,t=!1){return $o(e)||dt(e)||!ot(e)||(Nr(e)>1&&Object.defineProperties(e,{set:Uo,add:Uo,clear:Uo,delete:Uo}),Object.freeze(e),t&&Object.values(e).forEach(r=>Go(r,!0))),e}function LA(){ze(2)}var Uo={value:LA};function $o(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var Yc={};function Fr(e){let t=Yc[e];return t||ze(0,e),t}function UA(e,t){Yc[e]||(Yc[e]=t)}var Di;function Dp(){return Di}function VA(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function _p(e,t){t&&(Fr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Xc(e){Jc(e),e.drafts_.forEach(BA),e.drafts_=null}function Jc(e){e===Di&&(Di=e.parent_)}function kp(e){return Di=VA(Di,e)}function BA(e){let t=e[it];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Op(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return e!==void 0&&e!==r?(r[it].modified_&&(Xc(t),ze(4)),ot(e)&&(e=Vo(t,e),t.parent_||Bo(t,e)),t.patches_&&Fr("Patches").generateReplacementPatches_(r[it].base_,e,t.patches_,t.inversePatches_)):e=Vo(t,r,[]),Xc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==tu?e:void 0}function Vo(e,t,r){if($o(t))return t;let n=e.immer_.shouldUseStrictIteration(),i=t[it];if(!i)return Ni(t,(o,s)=>Pp(e,i,t,o,s,r),n),t;if(i.scope_!==e)return t;if(!i.modified_)return Bo(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;let o=i.copy_,s=o,a=!1;i.type_===3&&(s=new Set(o),o.clear(),a=!0),Ni(s,(c,u)=>Pp(e,i,o,c,u,r,a),n),Bo(e,o,!1),r&&e.patches_&&Fr("Patches").generatePatches_(i,r,e.patches_,e.inversePatches_)}return i.copy_}function Pp(e,t,r,n,i,o,s){if(i==null||typeof i!="object"&&!s)return;let a=$o(i);if(!(a&&!s)){if(dt(i)){let c=o&&t&&t.type_!==3&&!Fi(t.assigned_,n)?o.concat(n):void 0,u=Vo(e,i,c);if(Fp(r,n,u),dt(u))e.canAutoFreeze_=!1;else return}else s&&r.add(i);if(ot(i)&&!a){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===i&&a)return;Vo(e,i),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(_n(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&Bo(e,i)}}}function Bo(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Go(t,r)}function GA(e,t){let r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:Dp(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=n,o=nu;r&&(i=[n],o=Mi);let{revoke:s,proxy:a}=Proxy.revocable(i,o);return n.draft_=a,n.revoke_=s,a}var nu={get(e,t){if(t===it)return e;let r=Pr(e);if(!Fi(r,t))return $A(e,r,t);let n=r[t];return e.finalized_||!ot(n)?n:n===zc(e.base_,t)?(Wc(e),e.copy_[t]=eu(n,e)):n},has(e,t){return t in Pr(e)},ownKeys(e){return Reflect.ownKeys(Pr(e))},set(e,t,r){let n=Mp(Pr(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let i=zc(Pr(e),t),o=i?.[it];if(o&&o.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(qA(r,i)&&(r!==void 0||Fi(e.base_,t)))return!0;Wc(e),Zc(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return zc(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Wc(e),Zc(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=Pr(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){ze(11)},getPrototypeOf(e){return Tn(e.base_)},setPrototypeOf(){ze(12)}},Mi={};Ni(nu,(e,t)=>{Mi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Mi.deleteProperty=function(e,t){return Mi.set.call(this,e,t,void 0)};Mi.set=function(e,t,r){return nu.set.call(this,e[0],t,r,e[0])};function zc(e,t){let r=e[it];return(r?Pr(r):e)[t]}function $A(e,t,r){let n=Mp(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}function Mp(e,t){if(!(t in e))return;let r=Tn(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Tn(r)}}function Zc(e){e.modified_||(e.modified_=!0,e.parent_&&Zc(e.parent_))}function Wc(e){e.copy_||(e.copy_=Kc(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var QA=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){let o=r;r=t;let s=this;return function(c=o,...u){return s.produce(c,h=>r.call(this,h,...u))}}typeof r!="function"&&ze(6),n!==void 0&&typeof n!="function"&&ze(7);let i;if(ot(t)){let o=kp(this),s=eu(t,void 0),a=!0;try{i=r(s),a=!1}finally{a?Xc(o):Jc(o)}return _p(o,n),Op(i,o)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===tu&&(i=void 0),this.autoFreeze_&&Go(i,!0),n){let o=[],s=[];Fr("Patches").generateReplacementPatches_(t,i,o,s),n(o,s)}return i}else ze(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let n,i;return[this.produce(t,r,(s,a)=>{n=s,i=a}),n,i]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ot(e)||ze(8),dt(e)&&(e=jp(e));let t=kp(this),r=eu(e,void 0);return r[it].isManual_=!0,Jc(t),r}finishDraft(e,t){let r=e&&e[it];(!r||!r.isManual_)&&ze(9);let{scope_:n}=r;return _p(n,t),Op(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 i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));let n=Fr("Patches").applyPatches_;return dt(e)?n(e,t):this.produce(e,i=>n(i,t))}};function eu(e,t){let r=_n(e)?Fr("MapSet").proxyMap_(e,t):qi(e)?Fr("MapSet").proxySet_(e,t):GA(e,t);return(t?t.scope_:Dp()).drafts_.push(r),r}function jp(e){return dt(e)||ze(10,e),qp(e)}function qp(e){if(!ot(e)||$o(e))return e;let t=e[it],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Kc(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Kc(e,!0);return Ni(r,(i,o)=>{Fp(r,i,qp(o))},n),t&&(t.finalized_=!1),r}function Lp(){let t="replace",r="add",n="remove";function i(S,g,y,C){switch(S.type_){case 0:case 2:return s(S,g,y,C);case 1:return o(S,g,y,C);case 3:return a(S,g,y,C)}}function o(S,g,y,C){let{base_:E,assigned_:x}=S,I=S.copy_;I.length<E.length&&([E,I]=[I,E],[y,C]=[C,y]);for(let T=0;T<E.length;T++)if(x[T]&&I[T]!==E[T]){let _=g.concat([T]);y.push({op:t,path:_,value:v(I[T])}),C.push({op:t,path:_,value:v(E[T])})}for(let T=E.length;T<I.length;T++){let _=g.concat([T]);y.push({op:r,path:_,value:v(I[T])})}for(let T=I.length-1;E.length<=T;--T){let _=g.concat([T]);C.push({op:n,path:_})}}function s(S,g,y,C){let{base_:E,copy_:x}=S;Ni(S.assigned_,(I,T)=>{let _=Hc(E,I),M=Hc(x,I),P=T?Fi(E,I)?t:r:n;if(_===M&&P===t)return;let k=g.concat(I);y.push(P===n?{op:P,path:k}:{op:P,path:k,value:M}),C.push(P===r?{op:n,path:k}:P===n?{op:r,path:k,value:v(_)}:{op:t,path:k,value:v(_)})})}function a(S,g,y,C){let{base_:E,copy_:x}=S,I=0;E.forEach(T=>{if(!x.has(T)){let _=g.concat([I]);y.push({op:n,path:_,value:T}),C.unshift({op:r,path:_,value:T})}I++}),I=0,x.forEach(T=>{if(!E.has(T)){let _=g.concat([I]);y.push({op:r,path:_,value:T}),C.unshift({op:n,path:_,value:T})}I++})}function c(S,g,y,C){y.push({op:t,path:[],value:g===tu?void 0:g}),C.push({op:t,path:[],value:S})}function u(S,g){return g.forEach(y=>{let{path:C,op:E}=y,x=S;for(let M=0;M<C.length-1;M++){let P=Nr(x),k=C[M];typeof k!="string"&&typeof k!="number"&&(k=""+k),(P===0||P===1)&&(k==="__proto__"||k==="constructor")&&ze(19),typeof x=="function"&&k==="prototype"&&ze(19),x=Hc(x,k),typeof x!="object"&&ze(18,C.join("/"))}let I=Nr(x),T=h(y.value),_=C[C.length-1];switch(E){case t:switch(I){case 2:return x.set(_,T);case 3:ze(16);default:return x[_]=T}case r:switch(I){case 1:return _==="-"?x.push(T):x.splice(_,0,T);case 2:return x.set(_,T);case 3:return x.add(T);default:return x[_]=T}case n:switch(I){case 1:return x.splice(_,1);case 2:return x.delete(_);case 3:return x.delete(y.value);default:return delete x[_]}default:ze(17,E)}}),S}function h(S){if(!ot(S))return S;if(Array.isArray(S))return S.map(h);if(_n(S))return new Map(Array.from(S.entries()).map(([y,C])=>[y,h(C)]));if(qi(S))return new Set(Array.from(S).map(h));let g=Object.create(Tn(S));for(let y in S)g[y]=h(S[y]);return Fi(S,Pi)&&(g[Pi]=S[Pi]),g}function v(S){return dt(S)?h(S):S}UA("Patches",{applyPatches_:u,generatePatches_:i,generateReplacementPatches_:c})}var ji=new QA,Wt=ji.produce,Qo=ji.produceWithPatches.bind(ji);var iu=ji.applyPatches.bind(ji);m();d();f();p();function HA(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function zA(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function WA(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 Up=e=>Array.isArray(e)?e:[e];function KA(e){let t=Array.isArray(e[0])?e[0]:e;return WA(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function YA(e,t){let r=[],{length:n}=e;for(let i=0;i<n;i++)r.push(e[i].apply(null,t));return r}var qP=Symbol();var LP=Object.getPrototypeOf({});var XA=class{constructor(e){this.value=e}deref(){return this.value}},JA=typeof WeakRef<"u"?WeakRef:XA,ZA=0,Vp=1;function Ho(){return{s:ZA,v:void 0,o:null,p:null}}function kn(e,t={}){let r=Ho(),{resultEqualityCheck:n}=t,i,o=0;function s(){let a=r,{length:c}=arguments;for(let v=0,S=c;v<S;v++){let g=arguments[v];if(typeof g=="function"||typeof g=="object"&&g!==null){let y=a.o;y===null&&(a.o=y=new WeakMap);let C=y.get(g);C===void 0?(a=Ho(),y.set(g,a)):a=C}else{let y=a.p;y===null&&(a.p=y=new Map);let C=y.get(g);C===void 0?(a=Ho(),y.set(g,a)):a=C}}let u=a,h;if(a.s===Vp)h=a.v;else if(h=e.apply(null,arguments),o++,n){let v=i?.deref?.()??i;v!=null&&n(v,h)&&(h=v,o!==0&&o--),i=typeof h=="object"&&h!==null||typeof h=="function"?new JA(h):h}return u.s=Vp,u.v=h,h}return s.clearCache=()=>{r=Ho(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function Bp(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let o=0,s=0,a,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),HA(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);let h={...r,...c},{memoize:v,memoizeOptions:S=[],argsMemoize:g=kn,argsMemoizeOptions:y=[],devModeChecks:C={}}=h,E=Up(S),x=Up(y),I=KA(i),T=v(function(){return o++,u.apply(null,arguments)},...E),_=!0,M=g(function(){s++;let k=YA(I,arguments);return a=T.apply(null,k),a},...x);return Object.assign(M,{resultFunc:u,memoizedResultFunc:T,dependencies:I,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>a,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:v,argsMemoize:g})};return Object.assign(n,{withTypes:()=>n}),n}var De=Bp(kn),eb=Object.assign((e,t=De)=>{zA(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let r=Object.keys(e),n=r.map(o=>e[o]);return t(n,(...o)=>o.reduce((s,a,c)=>(s[r[c]]=a,s),{}))},{withTypes:()=>eb});m();d();f();p();function Gp(e){return({dispatch:r,getState:n})=>i=>o=>typeof o=="function"?o(r,n,e):i(o)}var $p=Gp(),Qp=Gp;var tb=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Rn:Rn.apply(null,arguments)},nN=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},rb=e=>e&&typeof e.match=="function";function q(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(rt(0));return{type:e,payload:i.payload,...("meta"in i&&{meta:i.meta}),...("error"in i&&{error:i.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>In(n)&&n.type===e,r}var Zp=class Li extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Li.prototype)}static get[Symbol.species](){return Li}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Li(...t[0].concat(this)):new Li(...t.concat(this))}};function Hp(e){return ot(e)?Wt(e,()=>{}):e}function zp(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function nb(e){return typeof e=="boolean"}var ib=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:o=!0}=t??{},s=new Zp;return r&&(nb(r)?s.push($p):s.push(Qp(r.extraArgument))),s},Ui="RTK_autoBatch",Nn=()=>e=>({payload:e,meta:{[Ui]:!0}}),Wp=e=>t=>{setTimeout(t,e)},ob=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),i=!0,o=!1,s=!1,a=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Wp(10):e.type==="callback"?e.queueNotification:Wp(e.timeout),u=()=>{s=!1,o&&(o=!1,a.forEach(h=>h()))};return Object.assign({},n,{subscribe(h){let v=()=>i&&h(),S=n.subscribe(v);return a.add(h),()=>{S(),a.delete(h)}},dispatch(h){try{return i=!h?.meta?.[Ui],o=!i,o&&(s||(s=!0,c(u))),n.dispatch(h)}finally{i=!0}}})},sb=e=>function(r){let{autoBatch:n=!0}=r??{},i=new Zp(e);return n&&i.push(ob(typeof n=="object"?n:void 0)),i};function ef(e){let t=ib(),{reducer:r=void 0,middleware:n,devTools:i=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},a;if(typeof r=="function")a=r;else if(Ot(r))a=En(r);else throw new Error(rt(1));let c;typeof n=="function"?c=n(t):c=t();let u=Rn;i&&(u=tb({trace:!1,...(typeof i=="object"&&i)}));let h=Ip(...c),v=sb(h),S=typeof s=="function"?s(v):v(),g=u(...S);return Qc(a,o,g)}function tf(e){let t={},r=[],n,i={addCase(o,s){let a=typeof o=="string"?o:o.type;if(!a)throw new Error(rt(28));if(a in t)throw new Error(rt(29));return t[a]=s,i},addMatcher(o,s){return r.push({matcher:o,reducer:s}),i},addDefaultCase(o){return n=o,i}};return e(i),[t,r,n]}function ab(e){return typeof e=="function"}function Ve(e,t){let[r,n,i]=tf(t),o;if(ab(e))o=()=>Hp(e());else{let a=Hp(e);o=()=>a}function s(a=o(),c){let u=[r[c.type],...n.filter(({matcher:h})=>h(c)).map(({reducer:h})=>h)];return u.filter(h=>!!h).length===0&&(u=[i]),u.reduce((h,v)=>{if(v)if(dt(h)){let g=v(h,c);return g===void 0?h:g}else{if(ot(h))return Wt(h,S=>v(S,c));{let S=v(h,c);if(S===void 0){if(h===null)return h;throw Error("A case reducer on a non-draftable value must not return undefined")}return S}}return h},a)}return s.getInitialState=o,s}var rf=(e,t)=>rb(e)?e.match(t):e(t);function Pt(...e){return t=>e.some(r=>rf(r,t))}function Pn(...e){return t=>e.every(r=>rf(r,t))}function Yo(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 Vi(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Xo(...e){return e.length===0?t=>Yo(t,["pending"]):Vi(e)?Pt(...e.map(t=>t.pending)):Xo()(e[0])}function jr(...e){return e.length===0?t=>Yo(t,["rejected"]):Vi(e)?Pt(...e.map(t=>t.rejected)):jr()(e[0])}function Bi(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Pn(jr(...e),t):Vi(e)?Pn(jr(...e),t):Bi()(e[0])}function Kt(...e){return e.length===0?t=>Yo(t,["fulfilled"]):Vi(e)?Pt(...e.map(t=>t.fulfilled)):Kt()(e[0])}function Jo(...e){return e.length===0?t=>Yo(t,["pending","fulfilled","rejected"]):Vi(e)?Pt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Jo()(e[0])}var cb="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Gi=(e=21)=>{let t="",r=e;for(;r--;)t+=cb[Math.random()*64|0];return t},ub=["name","message","stack","code"],ou=class{constructor(e,t){we(this,"_type");this.payload=e,this.meta=t}},Kp=class{constructor(e,t){we(this,"_type");this.payload=e,this.meta=t}},lb=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of ub)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},ve=(()=>{function e(t,r,n){let i=q(t+"/fulfilled",(c,u,h,v)=>({payload:c,meta:{...(v||{}),arg:h,requestId:u,requestStatus:"fulfilled"}})),o=q(t+"/pending",(c,u,h)=>({payload:void 0,meta:{...(h||{}),arg:u,requestId:c,requestStatus:"pending"}})),s=q(t+"/rejected",(c,u,h,v,S)=>({payload:v,error:(n&&n.serializeError||lb)(c||"Rejected"),meta:{...(S||{}),arg:h,requestId:u,rejectedWithValue:!!v,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function a(c){return(u,h,v)=>{let S=n?.idGenerator?n.idGenerator(c):Gi(),g=new l.AbortController,y,C;function E(I){C=I,g.abort()}let x=_asyncToGenerator(function*(){let I;try{let _=n?.condition?.(c,{getState:h,extra:v});if(pb(_)&&(_=yield _),_===!1||g.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let M=new Promise((P,k)=>{y=()=>{k({name:"AbortError",message:C||"Aborted"})},g.signal.addEventListener("abort",y)});u(o(S,c,n?.getPendingMeta?.({requestId:S,arg:c},{getState:h,extra:v}))),I=yield Promise.race([M,Promise.resolve(r(c,{dispatch:u,getState:h,extra:v,requestId:S,signal:g.signal,abort:E,rejectWithValue:(P,k)=>new ou(P,k),fulfillWithValue:(P,k)=>new Kp(P,k)})).then(P=>{if(P instanceof ou)throw P;return P instanceof Kp?i(P.payload,S,c,P.meta):i(P,S,c)})])}catch(_){I=_ instanceof ou?s(null,S,c,_.payload,_.meta):s(_,S,c)}finally{y&&g.signal.removeEventListener("abort",y)}return n&&!n.dispatchConditionRejection&&s.match(I)&&I.meta.condition||u(I),I})();return Object.assign(x,{abort:E,requestId:S,arg:c,unwrap(){return x.then(db)}})}}return Object.assign(a,{pending:o,rejected:s,fulfilled:i,settled:Pt(s,i),typePrefix:t})}return e.withTypes=()=>e,e})();function db(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function pb(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var nf=Symbol.for("rtk-slice-createasyncthunk"),cN={[nf]:ve};function fb(e,t){return`${e}/${t}`}function mb({creators:e}={}){let t=e?.asyncThunk?.[nf];return function(n){let{name:i,reducerPath:o=i}=n;if(!i)throw new Error(rt(11));typeof process<"u";let s=(typeof n.reducers=="function"?n.reducers(hb()):n.reducers)||{},a=Object.keys(s),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(I,T){let _=typeof I=="string"?I:I.type;if(!_)throw new Error(rt(12));if(_ in c.sliceCaseReducersByType)throw new Error(rt(13));return c.sliceCaseReducersByType[_]=T,u},addMatcher(I,T){return c.sliceMatchers.push({matcher:I,reducer:T}),u},exposeAction(I,T){return c.actionCreators[I]=T,u},exposeCaseReducer(I,T){return c.sliceCaseReducersByName[I]=T,u}};a.forEach(I=>{let T=s[I],_={reducerName:I,type:fb(i,I),createNotation:typeof n.reducers=="function"};vb(T)?Ab(_,T,u,t):yb(_,T,u)});function h(){let[I={},T=[],_=void 0]=typeof n.extraReducers=="function"?tf(n.extraReducers):[n.extraReducers],M={...I,...c.sliceCaseReducersByType};return Ve(n.initialState,P=>{for(let k in M)P.addCase(k,M[k]);for(let k of c.sliceMatchers)P.addMatcher(k.matcher,k.reducer);for(let k of T)P.addMatcher(k.matcher,k.reducer);_&&P.addDefaultCase(_)})}let v=I=>I,S=new Map,g;function y(I,T){return g||(g=h()),g(I,T)}function C(){return g||(g=h()),g.getInitialState()}function E(I,T=!1){function _(P){let k=P[I];return typeof k>"u"&&T&&(k=C()),k}function M(P=v){let k=zp(S,T,()=>new WeakMap);return zp(k,P,()=>{let O={};for(let[F,L]of Object.entries(n.selectors??{}))O[F]=gb(L,P,C,T);return O})}return{reducerPath:I,getSelectors:M,get selectors(){return M(_)},selectSlice:_}}let x={name:i,reducer:y,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:C,...E(o),injectInto(I,{reducerPath:T,..._}={}){let M=T??o;return I.inject({reducerPath:M,reducer:y},_),{...x,...E(M,!0)}}};return x}}function gb(e,t,r,n){function i(o,...s){let a=t(o);return typeof a>"u"&&n&&(a=r()),e(a,...s)}return i.unwrapped=e,i}var qr=mb();function hb(){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 yb({type:e,reducerName:t,createNotation:r},n,i){let o,s;if("reducer"in n){if(r&&!Sb(n))throw new Error(rt(17));o=n.reducer,s=n.prepare}else o=n;i.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,s?q(e,s):q(e))}function vb(e){return e._reducerDefinitionType==="asyncThunk"}function Sb(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Ab({type:e,reducerName:t},r,n,i){if(!i)throw new Error(rt(18));let{payloadCreator:o,fulfilled:s,pending:a,rejected:c,settled:u,options:h}=r,v=i(e,o,h);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||zo,pending:a||zo,rejected:c||zo,settled:u||zo})}function zo(){}var bb="task",of="listener",sf="completed",cu="cancelled",wb=`task-${cu}`,Cb=`task-${sf}`,su=`${of}-${cu}`,xb=`${of}-${sf}`,Zo=class{constructor(e){we(this,"name","TaskAbortError");we(this,"message");this.code=e,this.message=`${bb} ${cu} (reason: ${e})`}},uu=(e,t)=>{if(typeof e!="function")throw new TypeError(rt(32))},Wo=()=>{},af=(e,t=Wo)=>(e.catch(t),e),cf=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Dr=(e,t)=>{let r=e.signal;r.aborted||("reason"in r||Object.defineProperty(r,"reason",{enumerable:!0,value:t,configurable:!0,writable:!0}),e.abort(t))},Mr=e=>{if(e.aborted){let{reason:t}=e;throw new Zo(t)}};function uf(e,t){let r=Wo;return new Promise((n,i)=>{let o=()=>i(new Zo(e.reason));if(e.aborted){o();return}r=cf(e,o),t.finally(()=>r()).then(n,i)}).finally(()=>{r=Wo})}var Eb=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof Zo?"cancelled":"rejected",error:r}}finally{t?.()}});return function Eb(_x5,_x6){return _ref5.apply(this,arguments)}}(),Ko=e=>t=>af(uf(e,t).then(r=>(Mr(e),r))),lf=e=>{let t=Ko(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:On}=Object,Yp={},es="listenerMiddleware",Rb=(e,t)=>{let r=n=>cf(e,()=>Dr(n,e.reason));return(n,i)=>{uu(n,"taskExecutor");let o=new l.AbortController;r(o);let s=Eb(/*#__PURE__*/_asyncToGenerator(function*(){Mr(e),Mr(o.signal);let a=yield n({pause:Ko(o.signal),delay:lf(o.signal),signal:o.signal});return Mr(o.signal),a}),()=>Dr(o,Cb));return i?.autoJoin&&t.push(s.catch(Wo)),{result:Ko(e)(s),cancel(){Dr(o,wb)}}}},Ib=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,i){Mr(t);let o=()=>{},a=[new Promise((c,u)=>{let h=e({predicate:n,effect:(v,S)=>{S.unsubscribe(),c([v,S.getState(),S.getOriginalState()])}});o=()=>{h(),u()}})];i!=null&&a.push(new Promise(c=>setTimeout(c,i,null)));try{let c=yield uf(t,Promise.race(a));return Mr(t),c}finally{o()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,i)=>af(r(n,i))},df=e=>{let{type:t,actionCreator:r,matcher:n,predicate:i,effect:o}=e;if(t)i=q(t).match;else if(r)t=r.type,i=r.match;else if(n)i=n;else if(!i)throw new Error(rt(21));return uu(o,"options.listener"),{predicate:i,type:t,effect:o}},pf=On(e=>{let{type:t,predicate:r,effect:n}=df(e);return{id:Gi(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(rt(22))}}},{withTypes:()=>pf}),Xp=(e,t)=>{let{type:r,effect:n,predicate:i}=df(t);return Array.from(e.values()).find(o=>(typeof r=="string"?o.type===r:o.predicate===i)&&o.effect===n)},au=e=>{e.pending.forEach(t=>{Dr(t,su)})},Tb=e=>()=>{e.forEach(au),e.clear()},Jp=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},ff=On(q(`${es}/add`),{withTypes:()=>ff}),_b=q(`${es}/removeAll`),mf=On(q(`${es}/remove`),{withTypes:()=>mf}),kb=(...e)=>{console.error(`${es}/error`,...e)},gf=(e={})=>{let t=new Map,{extra:r,onError:n=kb}=e;uu(n,"onError");let i=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),v=>{h.unsubscribe(),v?.cancelActive&&au(h)}),o=h=>{let v=Xp(t,h)??pf(h);return i(v)};On(o,{withTypes:()=>o});let s=h=>{let v=Xp(t,h);return v&&(v.unsubscribe(),h.cancelActive&&au(v)),!!v};On(s,{withTypes:()=>s});let a=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,v,S,g){let y=new l.AbortController,C=Ib(o,y.signal),E=[];try{h.pending.add(y),yield Promise.resolve(h.effect(v,On({},S,{getOriginalState:g,condition:(x,I)=>C(x,I).then(Boolean),take:C,delay:lf(y.signal),pause:Ko(y.signal),extra:r,signal:y.signal,fork:Rb(y.signal,E),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((x,I,T)=>{x!==y&&(Dr(x,su),T.delete(x))})},cancel:()=>{Dr(y,su),h.pending.delete(y)},throwIfCancelled:()=>{Mr(y.signal)}})))}catch(x){x instanceof Zo||Jp(n,x,{raisedBy:"effect"})}finally{yield Promise.all(E),Dr(y,xb),h.pending.delete(y)}});return function a(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),c=Tb(t);return{middleware:h=>v=>S=>{if(!In(S))return v(S);if(ff.match(S))return o(S.payload);if(_b.match(S)){c();return}if(mf.match(S))return s(S.payload);let g=h.getState(),y=()=>{if(g===Yp)throw new Error(rt(23));return g},C;try{if(C=v(S),t.size>0){let E=h.getState(),x=Array.from(t.values());for(let I of x){let T=!1;try{T=I.predicate(S,E,g)}catch(_){T=!1,Jp(n,_,{raisedBy:"predicate"})}T&&a(I,S,h,y)}}}finally{g=Yp}return C},startListening:o,stopListening:s,clearListeners:c}};var lN=Symbol.for("rtk-state-proxy-original");function rt(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 te=new J({required:!0,emptyAllowed:!1}),Be=new J({required:!1,emptyAllowed:!1}),Rt=new J({required:!0,emptyAllowed:!0}),wN=new J({required:!1,emptyAllowed:!0}),hf=new Et({each:te,required:!0}),yf=new J({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),vf=new J({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),CN=new J({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Ob=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),lu=(e,t)=>{if("required"in t)return{payload:new xt({value:t}).validate({value:e}).value};let i=new xe({options:{required:!0},values:t}).validate(e);if(i)throw new qc(i);return{payload:e}},z=(e,t)=>{try{return lu(e,t)}catch(r){return{payload:e,error:Ob(r)}}};var ts=(e,t,r,n)=>{let i=`Check the options of ${n}`;return Pb(e,t,r,i,"Controller initialization error")},Pb=(e,t,r,n,i)=>{try{return t.validate(r,n)}catch(o){throw e.logger.error(o,i),o}};var rs=q("caseAssistConfiguration/set",e=>z(e,{caseAssistId:te,locale:Be,proxyBaseUrl:new J({required:!1,url:!0})}));m();d();f();p();m();d();f();p();var Sf=()=>({caseAssistId:"",locale:"en-US"});var cr=Ve(Sf(),e=>{e.addCase(rs,(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 Af={q:new J,enableQuerySyntax:new Fe,aq:new J,cq:new J,firstResult:new Le({min:0}),numberOfResults:new Le({min:0}),sortCriteria:new J,f:new xe,fExcluded:new xe,cf:new xe,nf:new xe,mnf:new xe,df:new xe,debug:new Fe,sf:new xe,tab:new J,af:new xe};var ns=q("searchParameters/restore",e=>z(e,Af)),bf=q("searchParameters/restoreTab",e=>z(e,te));m();d();f();p();var wf=q("debug/enable"),Cf=q("debug/disable");m();d();f();p();var is=()=>!1;var xf=Ve(is(),e=>{e.addCase(wf,()=>!0).addCase(Cf,()=>!1).addCase(ns,(t,r)=>r.payload.debug??t)});m();d();f();p();var os=q("searchHub/set",e=>z(e,new J({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var Fn="3.47.0",Ef=["@coveo/atomic","@coveo/quantic"];var du=()=>Be,Rf=()=>te,Dn=q("configuration/updateBasicConfiguration",e=>z(e,{accessToken:Be,environment:new J({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:Be})),ss=q("configuration/updateSearchConfiguration",e=>z(e,{proxyBaseUrl:new J({required:!1,url:!0}),pipeline:new J({required:!1,emptyAllowed:!0}),searchHub:Be,timezone:Be,locale:Be,authenticationProviders:new Et({required:!1,each:te})})),Nb={enabled:new Fe({default:!0}),originContext:du(),originLevel2:du(),originLevel3:du(),proxyBaseUrl:new J({required:!1,url:!0}),runtimeEnvironment:new Or,anonymous:new Fe({default:!1}),deviceId:Be,userDisplayName:Be,documentLocation:Be,trackingId:vf,analyticsMode:new J({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new xe({options:{required:!1},values:Ef.reduce((e,t)=>(e[t]=yf,e),{})})},as=q("configuration/updateAnalyticsConfiguration",e=>z(e,Nb)),cs=q("configuration/analytics/disable"),us=q("configuration/analytics/enable"),If=q("configuration/analytics/originlevel2",e=>z(e,{originLevel2:Rf()})),Tf=q("configuration/analytics/originlevel3",e=>z(e,{originLevel3:Rf()})),_f=q("knowledge/setAgentId",e=>z(e,new J({required:!0})));m();d();f();p();var Fb=q("history/undo"),Db=q("history/redo"),Nt=q("history/snapshot"),ZF=ve("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(Fb()),yield t(ls())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),eD=ve("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(Db()),yield t(ls())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),ls=ve("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 Mn=()=>"default";var kf=Ve(Mn(),e=>{e.addCase(os,(t,r)=>r.payload).addCase(ls.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(ss,(t,r)=>r.payload.searchHub||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 Of=/^(?:[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 Mb(e){return typeof e=="string"&&Of.test(e)}var pu=Mb;m();d();f();p();var We=[];for(let e=0;e<256;++e)We.push((e+256).toString(16).slice(1));function Pf(e,t=0){return(We[e[t+0]]+We[e[t+1]]+We[e[t+2]]+We[e[t+3]]+"-"+We[e[t+4]]+We[e[t+5]]+"-"+We[e[t+6]]+We[e[t+7]]+"-"+We[e[t+8]]+We[e[t+9]]+"-"+We[e[t+10]]+We[e[t+11]]+We[e[t+12]]+We[e[t+13]]+We[e[t+14]]+We[e[t+15]]).toLowerCase()}m();d();f();p();var fu,jb=new Uint8Array(16);function mu(){if(!fu){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");fu=crypto.getRandomValues.bind(crypto)}return fu(jb)}m();d();f();p();m();d();f();p();var qb=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),gu={randomUUID:qb};function Lb(e,t,r){e=e||{};let n=e.random??e.rng?.()??mu();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 i=0;i<16;++i)t[r+i]=n[i];return t}return Pf(n)}function Ub(e,t,r){return gu.randomUUID&&!t&&!e?gu.randomUUID():Lb(e,t,r)}var hu=Ub;m();d();f();p();function Nf(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}function Vb({config:e,environment:t,event:r,listenerManager:n}){let{url:i,token:o,mode:s}=e;s!=="disabled"&&(n.call(r),t.send(i,o,r))}var Ff="visitorId";function Bb(e){return{getClientId:()=>{let t=e.get(),r=t.storage,n=r.getItem(Ff),i=n&&pu(n)?n:t.generateUUID();return r.setItem(Ff,i),i}}}var Lf="1.2.15",yu=128,Uf=192,Df=224,Mf=240,Gb=248;function $b(e){return(e&Gb)===Mf?4:(e&Mf)===Df?3:(e&Df)===Uf?2:1}function Qb(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&yu)!=yu)break;if(r-=3,(n&Uf)!=yu){t-r>=$b(n)*3&&(r=t);break}}return e.substring(0,r)}function Hb(e){let{trackingId:t}=e;return{trackingId:t}}function zb(e){return(e.source||[]).concat([`relay@${Lf}`])}function Vf(e,t,r,n){let{getReferrer:i,getLocation:o,getUserAgent:s}=r,a=Hb(t),c=n.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:zb(t),clientId:c,userAgent:s(),referrer:jf(i()),location:jf(o())})}function jf(e){return e!==null?Qb(e,1024):null}function Wb(e,t,r,n,i){return{...t,meta:Vf(e,r,n,i)}}var Kb="*";function Yb(){let e=[];function t({type:c,callback:u}){return e.findIndex(h=>h.type===c&&h.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 i(c){e.forEach(u=>{if(r(u,c.meta.type))try{u.callback(c)}catch(h){console.error(h)}})}function o(c){if(c===Kb)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}):o(c)}return{add:n,call:i,remove:a}}function qf({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 Xb(e){let t=qf(e);return{get:()=>t,update:r=>{t=qf({...t,...r})}}}var vu=Jb();function Jb(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,i=document.cookie.split(";");for(let o of i){let s=o.replace(/^\s+/,"");if(s.lastIndexOf(n,0)===0)return s.substring(n.length,s.length)}return null},setItem(r,n,i){let o=t(window.location.hostname),s=`;expires=${new Date(new Date().getTime()+i).toUTCString()}`,a=o?`;domain=${o}`:"";document.cookie=`${e}${r}=${n}${s}${a};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function Zb(){return{getItem(e){return vu.getItem(e)||localStorage.getItem(e)},removeItem(e){vu.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),vu.setItem(e,t,31556952e3)}}}function ew(){let e=document.referrer;return e===""?null:e}function Su(){return{runtime:"browser",send:(e,t,r)=>{let n=navigator.sendBeacon(`${e}?access_token=${t}`,new Blob([JSON.stringify([r])],{type:"application/json"}));if(Nf().sendMessage({kind:"EVENT_PROTOCOL",event:r,url:e,token:t}),!n)throw new Error("Failed to send the event(s) because the payload size exceeded the maximum allowed size (32 KB). Please contact support if the problem persists.")},getReferrer:()=>ew(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,generateUUID:()=>hu(),storage:Zb()}}function tw(){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 rw(){return{getItem(){return null},removeItem(){},setItem(){}}}function nw(){return{runtime:"null",send:()=>{},getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,generateUUID:()=>"",storage:rw()}}function iw(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=nw();return t&&r?{storage:n.storage,...r,runtime:"custom"}:t&&ow()&&tw()?Su():n}function ow(){try{return typeof window=="object"}catch{return!1}}function sw(e){return{get:()=>Object.freeze(iw(e))}}function Bf(e){let t=Xb(e),r=Yb(),n=sw(t),i=Bb(n);return{emit:(o,s)=>{let a=t.get(),c=n.get(),u=Wb(o,s,a,c,i);return Vb({config:a,environment:c,event:u,listenerManager:r})},getMeta:o=>Vf(o,t.get(),n.get(),i),on:(o,s)=>r.add({type:o,callback:s}),off:(o,s)=>r.remove(o,s),updateConfig:o=>t.update(o),version:Lf}}m();d();f();p();function Gf(){return typeof window<"u"&&typeof document<"u"}m();d();f();p();var jn=De(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Fn}`));var $i=De(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>jn(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:i,enabled:o},s,a)=>{let c=cw(a);return Bf({mode:o?"emit":"disabled",url:i??Po(e,t),token:r,trackingId:n??null,source:s,environment:c})}),aw={generateUUID:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:()=>{},storage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{}}},cw=e=>{if(!e)return;let t=e();return{...(Gf()?Su():aw),generateUUID:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();m();d();f();p();function $f(e){return{status:e,isUninitialized:e==="uninitialized",isLoading:e==="pending",isSuccess:e==="fulfilled",isError:e==="rejected"}}var Qf=Ot;function nm(e,t){if(e===t||!(Qf(e)&&Qf(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),i=r.length===n.length,o=Array.isArray(t)?[]:{};for(let s of r)o[s]=nm(e[s],t[s]),i&&(i=e[s]===o[s]);return i?e:o}function qn(e){let t=0;for(let r in e)t++;return t}var Hf=e=>[].concat(...e);function uw(e){return new RegExp("(^|:)//").test(e)}function lw(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function fs(e){return e!=null}function dw(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var pw=e=>e.replace(/\/$/,""),fw=e=>e.replace(/^\//,"");function mw(e,t){if(!e)return t;if(!t)return e;if(uw(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=pw(e),t=fw(t),`${e}${r}${t}`}function gw(e,t,r){return e.has(t)?e.get(t):e.set(t,r).get(t)}var zf=(...e)=>b(...e),hw=e=>e.status>=200&&e.status<=299,yw=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Wf(e){if(!Ot(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}function im({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=zf,paramsSerializer:n,isJsonContentType:i=yw,jsonContentType:o="application/json",jsonReplacer:s,timeout:a,responseHandler:c,validateStatus:u,...h}={}){return typeof b>"u"&&r===zf&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(S,g,y){let{getState:C,extra:E,endpoint:x,forced:I,type:T}=g,_,{url:M,headers:P=new w(h.headers),params:k=void 0,responseHandler:O=c??"json",validateStatus:F=u??hw,timeout:L=a,...Q}=typeof S=="string"?{url:S}:S,G,V=g.signal;L&&(G=new l.AbortController,g.signal.addEventListener("abort",G.abort),V=G.signal);let U={...h,signal:V,...Q};P=new w(Wf(P)),U.headers=(yield t(P,{getState:C,arg:S,extra:E,endpoint:x,forced:I,type:T,extraOptions:y}))||P;let $=ae=>typeof ae=="object"&&(Ot(ae)||Array.isArray(ae)||typeof ae.toJSON=="function");if(!U.headers.has("content-type")&&$(U.body)&&U.headers.set("content-type",o),$(U.body)&&i(U.headers)&&(U.body=JSON.stringify(U.body,s)),k){let ae=~M.indexOf("?")?"&":"?",pe=n?n(k):new URLSearchParams(Wf(k));M+=ae+pe}M=mw(e,M);let B=new Request(M,U);_={request:new Request(M,U)};let K,ee=!1,ue=G&&setTimeout(()=>{ee=!0,G.abort()},L);try{K=yield r(B)}catch(ae){return{error:{status:ee?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ae)},meta:_}}finally{ue&&clearTimeout(ue),G?.signal.removeEventListener("abort",G.abort)}let he=K.clone();_.response=he;let ce,le="";try{let ae;if(yield Promise.all([v(K,O).then(pe=>ce=pe,pe=>ae=pe),he.text().then(pe=>le=pe,()=>{})]),ae)throw ae}catch(ae){return{error:{status:"PARSING_ERROR",originalStatus:K.status,data:le,error:String(ae)},meta:_}}return F(K,ce)?{data:ce,meta:_}:{error:{status:K.status,data:ce},meta:_}});return function(_x17,_x18,_x19){return _ref10.apply(this,arguments)}}());function v(_x20,_x21){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(S,g){if(typeof g=="function")return g(S);if(g==="content-type"&&(g=i(S.headers)?"json":"text"),g==="json"){let y=yield S.text();return y.length?JSON.parse(y):null}return S.text()});return _v2.apply(this,arguments)}}var Ln=class{constructor(e,t=void 0){this.value=e,this.meta=t}};function vw(){return _vw.apply(this,arguments)}function _vw(){_vw=_asyncToGenerator(function*(e=0,t=5){let r=Math.min(e,t),n=~~((Math.random()+.4)*(300<<r));yield new Promise(i=>setTimeout(o=>i(o),n))});return _vw.apply(this,arguments)}function Sw(e,t){throw Object.assign(new Ln({error:e,meta:t}),{throwImmediately:!0})}var Kf={},Aw=(e,t)=>(/*#__PURE__*/function(){var _ref11=_asyncToGenerator(function*(r,n,i){let o=[5,(t||Kf).maxRetries,(i||Kf).maxRetries].filter(h=>h!==void 0),[s]=o.slice(-1),c={maxRetries:s,backoff:vw,retryCondition:(h,v,{attempt:S})=>S<=s,...t,...i},u=0;for(;;)try{let h=yield e(r,n,i);if(h.error)throw new Ln(h);return h}catch(h){if(u++,h.throwImmediately){if(h instanceof Ln)return h.value;throw h}if(h instanceof Ln&&!c.retryCondition(h.value.error,r,{attempt:u,baseQueryApi:n,extraOptions:i}))return h.value;yield c.backoff(u,c.maxRetries)}});return function(_x22,_x23,_x24){return _ref11.apply(this,arguments)}}()),om=Object.assign(Aw,{fail:Sw}),xu=q("__rtkq/focused"),sm=q("__rtkq/unfocused"),Eu=q("__rtkq/online"),am=q("__rtkq/offline");function Ru(e){return e.type==="query"}function bw(e){return e.type==="mutation"}function Iu(e){return e.type==="infinitequery"}function Tu(e,t,r,n,i,o){return ww(e)?e(t,r,n,i).filter(fs).map(bu).map(o):Array.isArray(e)?e.map(bu).map(o):[]}function ww(e){return typeof e=="function"}function bu(e){return typeof e=="string"?{type:e}:e}function Cw(e,t){return e.catch(t)}var Hi=Symbol("forceQueryFn"),wu=e=>typeof e[Hi]=="function";function xw({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:i,context:o}){let s=new Map,a=new Map,{unsubscribeQueryResult:c,removeMutationResult:u,updateSubscriptionOptions:h}=i.internalActions;return{buildInitiateQuery:x,buildInitiateInfiniteQuery:I,buildInitiateMutation:T,getRunningQueryThunk:v,getRunningMutationThunk:S,getRunningQueriesThunk:g,getRunningMutationsThunk:y};function v(_,M){return P=>{let k=o.endpointDefinitions[_],O=e({queryArgs:M,endpointDefinition:k,endpointName:_});return s.get(P)?.[O]}}function S(_,M){return P=>a.get(P)?.[M]}function g(){return _=>Object.values(s.get(_)||{}).filter(fs)}function y(){return _=>Object.values(a.get(_)||{}).filter(fs)}function C(_){}function E(_,M){let P=(k,{subscribe:O=!0,forceRefetch:F,subscriptionOptions:L,[Hi]:Q,...G}={})=>(V,U)=>{let $=e({queryArgs:k,endpointDefinition:M,endpointName:_}),B,W={...G,type:"query",subscribe:O,forceRefetch:F,subscriptionOptions:L,endpointName:_,originalArgs:k,queryCacheKey:$,[Hi]:Q};if(Ru(M))B=t(W);else{let{direction:Ae,initialPageParam:ke}=G;B=r({...W,direction:Ae,initialPageParam:ke})}let K=i.endpoints[_].select(k),ee=V(B),ue=K(U());let{requestId:he,abort:ce}=ee,le=ue.requestId!==he,ae=s.get(V)?.[$],pe=()=>K(U()),Ne=Object.assign(Q?ee.then(pe):le&&!ae?Promise.resolve(ue):Promise.all([ae,ee]).then(pe),{arg:k,requestId:he,subscriptionOptions:L,queryCacheKey:$,abort:ce,unwrap(){return _asyncToGenerator(function*(){let Ae=yield Ne;if(Ae.isError)throw Ae.error;return Ae.data})()},refetch:()=>V(P(k,{subscribe:!1,forceRefetch:!0})),unsubscribe(){O&&V(c({queryCacheKey:$,requestId:he}))},updateSubscriptionOptions(Ae){Ne.subscriptionOptions=Ae,V(h({endpointName:_,requestId:he,queryCacheKey:$,options:Ae}))}});if(!ae&&!le&&!Q){let Ae=gw(s,V,{});Ae[$]=Ne,Ne.then(()=>{delete Ae[$],qn(Ae)||s.delete(V)})}return Ne};return P}function x(_,M){return E(_,M)}function I(_,M){return E(_,M)}function T(_){return(M,{track:P=!0,fixedCacheKey:k}={})=>(O,F)=>{let L=n({type:"mutation",endpointName:_,originalArgs:M,track:P,fixedCacheKey:k}),Q=O(L);let{requestId:G,abort:V,unwrap:U}=Q,$=Cw(Q.unwrap().then(ee=>({data:ee})),ee=>({error:ee})),B=()=>{O(u({requestId:G,fixedCacheKey:k}))},W=Object.assign($,{arg:Q.arg,requestId:G,abort:V,unwrap:U,reset:B}),K=a.get(O)||{};return a.set(O,K),K[G]=W,W.then(()=>{delete K[G],qn(K)||a.delete(O)}),k&&(K[k]=W,W.then(()=>{K[k]===W&&(delete K[k],qn(K)||a.delete(O))})),W}}}function Ew(e){return e}var ds=(e={})=>({...e,[Ui]:!0});function Rw({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:i,assertTagType:o,selectors:s}){let a=(O,F,L,Q)=>(G,V)=>{let U=r[O],$=n({queryArgs:F,endpointDefinition:U,endpointName:O});if(G(i.internalActions.queryResultPatched({queryCacheKey:$,patches:L})),!Q)return;let B=i.endpoints[O].select(F)(V()),W=Tu(U.providesTags,B.data,void 0,F,{},o);G(i.internalActions.updateProvidedBy({queryCacheKey:$,providedTags:W}))};function c(O,F,L=0){let Q=[F,...O];return L&&Q.length>L?Q.slice(0,-1):Q}function u(O,F,L=0){let Q=[...O,F];return L&&Q.length>L?Q.slice(1):Q}let h=(O,F,L,Q=!0)=>(G,V)=>{let $=i.endpoints[O].select(F)(V()),B={patches:[],inversePatches:[],undo:()=>G(i.util.patchQueryData(O,F,B.inversePatches,Q))};if($.status==="uninitialized")return B;let W;if("data"in $)if(ot($.data)){let[K,ee,ue]=Qo($.data,L);B.patches.push(...ee),B.inversePatches.push(...ue),W=K}else W=L($.data),B.patches.push({op:"replace",path:[],value:W}),B.inversePatches.push({op:"replace",path:[],value:$.data});return B.patches.length===0||G(i.util.patchQueryData(O,F,B.patches,Q)),B},v=(O,F,L)=>Q=>Q(i.endpoints[O].initiate(F,{subscribe:!1,forceRefetch:!0,[Hi]:()=>({data:L})})),S=(O,F)=>O.query&&O[F]?O[F]:Ew,g=/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(O,{signal:F,abort:L,rejectWithValue:Q,fulfillWithValue:G,dispatch:V,getState:U,extra:$}){let B=r[O.endpointName];try{let W=S(B,"transformResponse"),K={signal:F,abort:L,dispatch:V,getState:U,extra:$,endpoint:O.endpointName,type:O.type,forced:O.type==="query"?y(O,U()):void 0,queryCacheKey:O.type==="query"?O.queryCacheKey:void 0},ee=O.type==="query"?O[Hi]:void 0,ue,he=/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*(le,ae,pe,Ne){if(ae==null&&le.pages.length)return Promise.resolve({data:le});let Ae={queryArg:O.originalArgs,pageParam:ae},ke=yield ce(Ae),je=Ne?c:u;return{data:{pages:je(le.pages,ke.data,pe),pageParams:je(le.pageParams,ae,pe)}}});return function he(_x27,_x28,_x29,_x30){return _ref13.apply(this,arguments)}}();function ce(_x31){return _ce.apply(this,arguments)}function _ce(){_ce=_asyncToGenerator(function*(le){let ae,{extraOptions:pe}=B;if(ee?ae=ee():B.query?ae=yield t(B.query(le),K,pe):ae=yield B.queryFn(le,K,pe,Ae=>t(Ae,K,pe)),typeof process<"u",ae.error)throw new Ln(ae.error,ae.meta);let Ne=yield W(ae.data,ae.meta,le);return{...ae,data:Ne}});return _ce.apply(this,arguments)}if(O.type==="query"&&"infiniteQueryOptions"in B){let{infiniteQueryOptions:le}=B,{maxPages:ae=1/0}=le,pe,Ne={pages:[],pageParams:[]},Ae=s.selectQueryEntry(U(),O.queryCacheKey)?.data,je=y(O,U())&&!O.direction||!Ae?Ne:Ae;if("direction"in O&&O.direction&&je.pages.length){let nt=O.direction==="backward",sr=(nt?cm:Cu)(le,je);pe=yield he(je,sr,ae,nt)}else{let{initialPageParam:nt=le.initialPageParam}=O,mt=Ae?.pageParams??[],sr=mt[0]??nt,yn=mt.length;pe=yield he(je,sr,ae),ee&&(pe={data:pe.data.pages[0]});for(let vn=1;vn<yn;vn++){let Ci=Cu(le,pe.data);pe=yield he(pe.data,Ci,ae)}}ue=pe}else ue=yield ce(O.originalArgs);return G(ue.data,ds({fulfilledTimeStamp:Date.now(),baseQueryMeta:ue.meta}))}catch(W){let K=W;if(K instanceof Ln){let ee=S(B,"transformErrorResponse");try{return Q(yield ee(K.value,K.meta,O.originalArgs),ds({baseQueryMeta:K.meta}))}catch(ue){K=ue}}throw typeof process<"u",console.error(K),K}});return function g(_x25,_x26){return _ref12.apply(this,arguments)}}();function y(O,F){let L=s.selectQueryEntry(F,O.queryCacheKey),Q=s.selectConfig(F).refetchOnMountOrArgChange,G=L?.fulfilledTimeStamp,V=O.forceRefetch??(O.subscribe&&Q);return V?V===!0||(Number(new Date)-Number(G))/1e3>=V:!1}let C=()=>ve(`${e}/executeQuery`,g,{getPendingMeta({arg:F}){let L=r[F.endpointName];return ds({startedTimeStamp:Date.now(),...(Iu(L)?{direction:F.direction}:{})})},condition(F,{getState:L}){let Q=L(),G=s.selectQueryEntry(Q,F.queryCacheKey),V=G?.fulfilledTimeStamp,U=F.originalArgs,$=G?.originalArgs,B=r[F.endpointName],W=F.direction;return wu(F)?!0:G?.status==="pending"?!1:y(F,Q)||Ru(B)&&B?.forceRefetch?.({currentArg:U,previousArg:$,endpointState:G,state:Q})?!0:!(V&&!W)},dispatchConditionRejection:!0}),E=C(),x=C(),I=ve(`${e}/executeMutation`,g,{getPendingMeta(){return ds({startedTimeStamp:Date.now()})}}),T=O=>"force"in O,_=O=>"ifOlderThan"in O,M=(O,F,L)=>(Q,G)=>{let V=T(L)&&L.force,U=_(L)&&L.ifOlderThan,$=(W=!0)=>{let K={forceRefetch:W,isPrefetch:!0};return i.endpoints[O].initiate(F,K)},B=i.endpoints[O].select(F)(G());if(V)Q($());else if(U){let W=B?.fulfilledTimeStamp;if(!W){Q($());return}(Number(new Date)-Number(new Date(W)))/1e3>=U&&Q($())}else Q($(!1))};function P(O){return F=>F?.meta?.arg?.endpointName===O}function k(O,F){return{matchPending:Pn(Xo(O),P(F)),matchFulfilled:Pn(Kt(O),P(F)),matchRejected:Pn(jr(O),P(F))}}return{queryThunk:E,mutationThunk:I,infiniteQueryThunk:x,prefetch:M,updateQueryData:h,upsertQueryData:v,patchQueryData:a,buildMatchThunkActions:k}}function Cu(e,{pages:t,pageParams:r}){let n=t.length-1;return e.getNextPageParam(t[n],t,r[n],r)}function cm(e,{pages:t,pageParams:r}){return e.getPreviousPageParam?.(t[0],t,r[0],r)}function um(e,t,r,n){return Tu(r[e.meta.arg.endpointName][t],Kt(e)?e.payload:void 0,Bi(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function ps(e,t,r){let n=e[t];n&&r(n)}function zi(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function Yf(e,t,r){let n=e[zi(t)];n&&r(n)}var Qi={};function Iw({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:i,apiUid:o,extractRehydrationInfo:s,hasRehydrationInfo:a},assertTagType:c,config:u}){let h=q(`${e}/resetApiState`);function v(P,k,O,F){var L;P[L=k.queryCacheKey]??(P[L]={status:"uninitialized",endpointName:k.endpointName}),ps(P,k.queryCacheKey,Q=>{Q.status="pending",Q.requestId=O&&Q.requestId?Q.requestId:F.requestId,k.originalArgs!==void 0&&(Q.originalArgs=k.originalArgs),Q.startedTimeStamp=F.startedTimeStamp;let G=i[F.arg.endpointName];Iu(G)&&"direction"in k&&(Q.direction=k.direction)})}function S(P,k,O,F){ps(P,k.arg.queryCacheKey,L=>{if(L.requestId!==k.requestId&&!F)return;let{merge:Q}=i[k.arg.endpointName];if(L.status="fulfilled",Q){if(L.data!==void 0){let{fulfilledTimeStamp:G,arg:V,baseQueryMeta:U,requestId:$}=k,B=Wt(L.data,W=>Q(W,O,{arg:V.originalArgs,baseQueryMeta:U,fulfilledTimeStamp:G,requestId:$}));L.data=B}else L.data=O;}else L.data=i[k.arg.endpointName].structuralSharing??!0?nm(dt(L.data)?ru(L.data):L.data,O):O;delete L.error,L.fulfilledTimeStamp=k.fulfilledTimeStamp})}let g=qr({name:`${e}/queries`,initialState:Qi,reducers:{removeQueryResult:{reducer(P,{payload:{queryCacheKey:k}}){delete P[k]},prepare:Nn()},cacheEntriesUpserted:{reducer(P,k){for(let O of k.payload){let{queryDescription:F,value:L}=O;v(P,F,!0,{arg:F,requestId:k.meta.requestId,startedTimeStamp:k.meta.timestamp}),S(P,{arg:F,requestId:k.meta.requestId,fulfilledTimeStamp:k.meta.timestamp,baseQueryMeta:{}},L,!0)}},prepare:P=>({payload:P.map(F=>{let{endpointName:L,arg:Q,value:G}=F,V=i[L];return{queryDescription:{type:"query",endpointName:L,originalArgs:F.arg,queryCacheKey:n({queryArgs:Q,endpointDefinition:V,endpointName:L})},value:G}}),meta:{[Ui]:!0,requestId:Gi(),timestamp:Date.now()}})},queryResultPatched:{reducer(P,{payload:{queryCacheKey:k,patches:O}}){ps(P,k,F=>{F.data=iu(F.data,O.concat())})},prepare:Nn()}},extraReducers(P){P.addCase(t.pending,(k,{meta:O,meta:{arg:F}})=>{let L=wu(F);v(k,F,L,O)}).addCase(t.fulfilled,(k,{meta:O,payload:F})=>{let L=wu(O.arg);S(k,O,F,L)}).addCase(t.rejected,(k,{meta:{condition:O,arg:F,requestId:L},error:Q,payload:G})=>{ps(k,F.queryCacheKey,V=>{if(!O){if(V.requestId!==L)return;V.status="rejected",V.error=G??Q}})}).addMatcher(a,(k,O)=>{let{queries:F}=s(O);for(let[L,Q]of Object.entries(F))(Q?.status==="fulfilled"||Q?.status==="rejected")&&(k[L]=Q)})}}),y=qr({name:`${e}/mutations`,initialState:Qi,reducers:{removeMutationResult:{reducer(P,{payload:k}){let O=zi(k);O in P&&delete P[O]},prepare:Nn()}},extraReducers(P){P.addCase(r.pending,(k,{meta:O,meta:{requestId:F,arg:L,startedTimeStamp:Q}})=>{L.track&&(k[zi(O)]={requestId:F,status:"pending",endpointName:L.endpointName,startedTimeStamp:Q})}).addCase(r.fulfilled,(k,{payload:O,meta:F})=>{F.arg.track&&Yf(k,F,L=>{L.requestId===F.requestId&&(L.status="fulfilled",L.data=O,L.fulfilledTimeStamp=F.fulfilledTimeStamp)})}).addCase(r.rejected,(k,{payload:O,error:F,meta:L})=>{L.arg.track&&Yf(k,L,Q=>{Q.requestId===L.requestId&&(Q.status="rejected",Q.error=O??F)})}).addMatcher(a,(k,O)=>{let{mutations:F}=s(O);for(let[L,Q]of Object.entries(F))(Q?.status==="fulfilled"||Q?.status==="rejected")&&L!==Q?.requestId&&(k[L]=Q)})}}),C=qr({name:`${e}/invalidation`,initialState:Qi,reducers:{updateProvidedBy:{reducer(P,k){var L,Q;let{queryCacheKey:O,providedTags:F}=k.payload;for(let G of Object.values(P))for(let V of Object.values(G)){let U=V.indexOf(O);U!==-1&&V.splice(U,1)}for(let{type:G,id:V}of F){let U=(L=P[G]??(P[G]={}))[Q=V||"__internal_without_id"]??(L[Q]=[]);U.includes(O)||U.push(O)}},prepare:Nn()}},extraReducers(P){P.addCase(g.actions.removeQueryResult,(k,{payload:{queryCacheKey:O}})=>{for(let F of Object.values(k))for(let L of Object.values(F)){let Q=L.indexOf(O);Q!==-1&&L.splice(Q,1)}}).addMatcher(a,(k,O)=>{var L,Q;let{provided:F}=s(O);for(let[G,V]of Object.entries(F))for(let[U,$]of Object.entries(V)){let B=(L=k[G]??(k[G]={}))[Q=U||"__internal_without_id"]??(L[Q]=[]);for(let W of $)B.includes(W)||B.push(W)}}).addMatcher(Pt(Kt(t),Bi(t)),(k,O)=>{let F=um(O,"providesTags",i,c),{queryCacheKey:L}=O.meta.arg;C.caseReducers.updateProvidedBy(k,C.actions.updateProvidedBy({queryCacheKey:L,providedTags:F}))})}}),E=qr({name:`${e}/subscriptions`,initialState:Qi,reducers:{updateSubscriptionOptions(P,k){},unsubscribeQueryResult(P,k){},internal_getRTKQSubscriptions(){}}}),x=qr({name:`${e}/internalSubscriptions`,initialState:Qi,reducers:{subscriptionsUpdated:{reducer(P,k){return iu(P,k.payload)},prepare:Nn()}}}),I=qr({name:`${e}/config`,initialState:{online:dw(),focused:lw(),middlewareRegistered:!1,...u},reducers:{middlewareRegistered(P,{payload:k}){P.middlewareRegistered=P.middlewareRegistered==="conflict"||o!==k?"conflict":!0}},extraReducers:P=>{P.addCase(Eu,k=>{k.online=!0}).addCase(am,k=>{k.online=!1}).addCase(xu,k=>{k.focused=!0}).addCase(sm,k=>{k.focused=!1}).addMatcher(a,k=>({...k}))}}),T=En({queries:g.reducer,mutations:y.reducer,provided:C.reducer,subscriptions:x.reducer,config:I.reducer}),_=(P,k)=>T(h.match(k)?void 0:P,k),M={...I.actions,...g.actions,...E.actions,...x.actions,...y.actions,...C.actions,resetApiState:h};return{reducer:_,actions:M}}var Au=Symbol.for("RTKQ/skipToken"),lm={status:"uninitialized"},Xf=Wt(lm,()=>{}),Jf=Wt(lm,()=>{});function Tw({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=T=>Xf,i=T=>Jf;return{buildQuerySelector:S,buildInfiniteQuerySelector:g,buildMutationSelector:y,selectInvalidatedBy:C,selectCachedArgsForQuery:E,selectApiState:s,selectQueries:a,selectMutations:u,selectQueryEntry:c,selectConfig:h};function o(T){return{...T,...$f(T.status)}}function s(T){return T[t]}function a(T){return s(T)?.queries}function c(T,_){return a(T)?.[_]}function u(T){return s(T)?.mutations}function h(T){return s(T)?.config}function v(T,_,M){return P=>{if(P===Au)return r(n,M);let k=e({queryArgs:P,endpointDefinition:_,endpointName:T});return r(F=>c(F,k)??Xf,M)}}function S(T,_){return v(T,_,o)}function g(T,_){let{infiniteQueryOptions:M}=_;function P(k){let O={...k,...$f(k.status)},{isLoading:F,isError:L,direction:Q}=O,G=Q==="forward",V=Q==="backward";return{...O,hasNextPage:x(M,O.data),hasPreviousPage:I(M,O.data),isFetchingNextPage:F&&G,isFetchingPreviousPage:F&&V,isFetchNextPageError:L&&G,isFetchPreviousPageError:L&&V}}return v(T,_,P)}function y(){return T=>{let _;return typeof T=="object"?_=zi(T)??Au:_=T,r(_===Au?i:k=>s(k)?.mutations?.[_]??Jf,o)}}function C(T,_){let M=T[t],P=new Set;for(let k of _.filter(fs).map(bu)){let O=M.provided[k.type];if(!O)continue;let F=(k.id!==void 0?O[k.id]:Hf(Object.values(O)))??[];for(let L of F)P.add(L)}return Hf(Array.from(P.values()).map(k=>{let O=M.queries[k];return O?[{queryCacheKey:k,endpointName:O.endpointName,originalArgs:O.originalArgs}]:[]}))}function E(T,_){return Object.values(a(T)).filter(M=>M?.endpointName===_&&M.status!=="uninitialized").map(M=>M.originalArgs)}function x(T,_){return _?Cu(T,_)!=null:!1}function I(T,_){return!_||!T.getPreviousPageParam?!1:cm(T,_)!=null}}var Zf=WeakMap?new WeakMap:void 0,em=({endpointName:e,queryArgs:t})=>{let r="",n=Zf?.get(t);if(typeof n=="string")r=n;else{let i=JSON.stringify(t,(o,s)=>(s=typeof s=="bigint"?{$bigint:s.toString()}:s,s=Ot(s)?Object.keys(s).sort().reduce((a,c)=>(a[c]=s[c],a),{}):s,s));Ot(t)&&Zf?.set(t,i),r=i}return`${e}(${r})`};function _w(...e){return function(r){let n=kn(u=>r.extractRehydrationInfo?.(u,{reducerPath:r.reducerPath??"api"})),i={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(u){let h=em;if("serializeQueryArgs"in u.endpointDefinition){let v=u.endpointDefinition.serializeQueryArgs;h=S=>{let g=v(S);return typeof g=="string"?g:em({...S,queryArgs:g})}}else r.serializeQueryArgs&&(h=r.serializeQueryArgs);return h(u)},tagTypes:[...(r.tagTypes||[])]},o={endpointDefinitions:{},batch(u){u()},apiUid:Gi(),extractRehydrationInfo:n,hasRehydrationInfo:kn(u=>n(u)!=null)},s={injectEndpoints:c,enhanceEndpoints({addTagTypes:u,endpoints:h}){if(u)for(let v of u)i.tagTypes.includes(v)||i.tagTypes.push(v);if(h)for(let[v,S]of Object.entries(h))typeof S=="function"?S(o.endpointDefinitions[v]):Object.assign(o.endpointDefinitions[v]||{},S);return s}},a=e.map(u=>u.init(s,i,o));function c(u){let h=u.endpoints({query:v=>({...v,type:"query"}),mutation:v=>({...v,type:"mutation"}),infiniteQuery:v=>({...v,type:"infinitequery"})});for(let[v,S]of Object.entries(h)){if(u.overrideExisting!==!0&&v in o.endpointDefinitions){if(u.overrideExisting==="throw")throw new Error(rt(39));typeof process<"u";continue}typeof process<"u",o.endpointDefinitions[v]=S;for(let g of a)g.injectEndpoint(v,S)}return s}return s.injectEndpoints({endpoints:r.endpoints})}}function Yt(e,...t){return Object.assign(e,...t)}var kw=({api:e,queryThunk:t,internalState:r})=>{let n=`${e.reducerPath}/subscriptions`,i=null,o=null,{updateSubscriptionOptions:s,unsubscribeQueryResult:a}=e.internalActions,c=(g,y)=>{var E,x;if(s.match(y)){let{queryCacheKey:I,requestId:T,options:_}=y.payload;return g?.[I]?.[T]&&(g[I][T]=_),!0}if(a.match(y)){let{queryCacheKey:I,requestId:T}=y.payload;return g[I]&&delete g[I][T],!0}if(e.internalActions.removeQueryResult.match(y))return delete g[y.payload.queryCacheKey],!0;if(t.pending.match(y)){let{meta:{arg:I,requestId:T}}=y,_=g[E=I.queryCacheKey]??(g[E]={});return _[`${T}_running`]={},I.subscribe&&(_[T]=I.subscriptionOptions??_[T]??{}),!0}let C=!1;if(t.fulfilled.match(y)||t.rejected.match(y)){let I=g[y.meta.arg.queryCacheKey]||{},T=`${y.meta.requestId}_running`;C||(C=!!I[T]),delete I[T]}if(t.rejected.match(y)){let{meta:{condition:I,arg:T,requestId:_}}=y;if(I&&T.subscribe){let M=g[x=T.queryCacheKey]??(g[x]={});M[_]=T.subscriptionOptions??M[_]??{},C=!0}}return C},u=()=>r.currentSubscriptions,S={getSubscriptions:u,getSubscriptionCount:g=>{let C=u()[g]??{};return qn(C)},isRequestSubscribed:(g,y)=>!!u()?.[g]?.[y]};return(g,y)=>{if(i||(i=JSON.parse(JSON.stringify(r.currentSubscriptions))),e.util.resetApiState.match(g))return i=r.currentSubscriptions={},o=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(g))return[!1,S];let C=c(r.currentSubscriptions,g),E=!0;if(C){o||(o=setTimeout(()=>{let T=JSON.parse(JSON.stringify(r.currentSubscriptions)),[,_]=Qo(i,()=>T);y.next(e.internalActions.subscriptionsUpdated(_)),i=T,o=null},500));let x=typeof g.type=="string"&&!!g.type.startsWith(n),I=t.rejected.match(g)&&g.meta.condition&&!!g.meta.arg.subscribe;E=!x&&!I}return[E,!1]}};function Ow(e){for(let t in e)return!1;return!0}var Pw=2147483647/1e3-1,Nw=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:i,selectors:{selectQueryEntry:o,selectConfig:s}})=>{let{removeQueryResult:a,unsubscribeQueryResult:c,cacheEntriesUpserted:u}=t.internalActions,h=Pt(c.match,r.fulfilled,r.rejected,u.match);function v(E){let x=i.currentSubscriptions[E];return!!x&&!Ow(x)}let S={},g=(E,x,I)=>{let T=x.getState(),_=s(T);if(h(E)){let M;if(u.match(E))M=E.payload.map(P=>P.queryDescription.queryCacheKey);else{let{queryCacheKey:P}=c.match(E)?E.payload:E.meta.arg;M=[P]}y(M,x,_)}if(t.util.resetApiState.match(E))for(let[M,P]of Object.entries(S))P&&clearTimeout(P),delete S[M];if(n.hasRehydrationInfo(E)){let{queries:M}=n.extractRehydrationInfo(E);y(Object.keys(M),x,_)}};function y(E,x,I){let T=x.getState();for(let _ of E){let M=o(T,_);C(_,M?.endpointName,x,I)}}function C(E,x,I,T){let M=n.endpointDefinitions[x]?.keepUnusedDataFor??T.keepUnusedDataFor;if(M===1/0)return;let P=Math.max(0,Math.min(M,Pw));if(!v(E)){let k=S[E];k&&clearTimeout(k),S[E]=setTimeout(()=>{v(E)||I.dispatch(a({queryCacheKey:E})),delete S[E]},P*1e3)}}return g},tm=new Error("Promise never resolved before cacheEntryRemoved."),Fw=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:i,internalState:o,selectors:{selectQueryEntry:s,selectApiState:a}})=>{let c=Jo(n),u=Jo(i),h=Kt(n,i),v={};function S(x,I,T){let _=v[x];_?.valueResolved&&(_.valueResolved({data:I,meta:T}),delete _.valueResolved)}function g(x){let I=v[x];I&&(delete v[x],I.cacheEntryRemoved())}let y=(x,I,T)=>{let _=C(x);function M(P,k,O,F){let L=s(T,k),Q=s(I.getState(),k);!L&&Q&&E(P,F,k,I,O)}if(n.pending.match(x))M(x.meta.arg.endpointName,_,x.meta.requestId,x.meta.arg.originalArgs);else if(e.internalActions.cacheEntriesUpserted.match(x))for(let{queryDescription:P,value:k}of x.payload){let{endpointName:O,originalArgs:F,queryCacheKey:L}=P;M(O,L,x.meta.requestId,F),S(L,k,{})}else if(i.pending.match(x))I.getState()[t].mutations[_]&&E(x.meta.arg.endpointName,x.meta.arg.originalArgs,_,I,x.meta.requestId);else if(h(x))S(_,x.payload,x.meta.baseQueryMeta);else if(e.internalActions.removeQueryResult.match(x)||e.internalActions.removeMutationResult.match(x))g(_);else if(e.util.resetApiState.match(x))for(let P of Object.keys(v))g(P)};function C(x){return c(x)?x.meta.arg.queryCacheKey:u(x)?x.meta.arg.fixedCacheKey??x.meta.requestId:e.internalActions.removeQueryResult.match(x)?x.payload.queryCacheKey:e.internalActions.removeMutationResult.match(x)?zi(x.payload):""}function E(x,I,T,_,M){let P=r.endpointDefinitions[x],k=P?.onCacheEntryAdded;if(!k)return;let O={},F=new Promise($=>{O.cacheEntryRemoved=$}),L=Promise.race([new Promise($=>{O.valueResolved=$}),F.then(()=>{throw tm})]);L.catch(()=>{}),v[T]=O;let Q=e.endpoints[x].select(P.type==="query"?I:T),G=_.dispatch(($,B,W)=>W),V={..._,getCacheEntry:()=>Q(_.getState()),requestId:M,extra:G,updateCachedData:P.type==="query"?$=>_.dispatch(e.util.updateQueryData(x,I,$)):void 0,cacheDataLoaded:L,cacheEntryRemoved:F},U=k(I,V);Promise.resolve(U).catch($=>{if($!==tm)throw $})}return y},Dw=({api:e,context:{apiUid:t},reducerPath:r})=>(n,i)=>{e.util.resetApiState.match(n)&&i.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},Mw=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:i,api:o,assertTagType:s,refetchQuery:a,internalState:c})=>{let{removeQueryResult:u}=o.internalActions,h=Pt(Kt(n),Bi(n)),v=Pt(Kt(n,i),jr(n,i)),S=[],g=(E,x)=>{h(E)?C(um(E,"invalidatesTags",r,s),x):v(E)?C([],x):o.util.invalidateTags.match(E)&&C(Tu(E.payload,void 0,void 0,void 0,void 0,s),x)};function y(E){let{queries:x,mutations:I}=E;for(let T of[x,I])for(let _ in T)if(T[_]?.status==="pending")return!0;return!1}function C(E,x){let I=x.getState(),T=I[e];if(S.push(...E),T.config.invalidationBehavior==="delayed"&&y(T))return;let _=S;if(S=[],_.length===0)return;let M=o.util.selectInvalidatedBy(I,_);t.batch(()=>{let P=Array.from(M.values());for(let{queryCacheKey:k}of P){let O=T.queries[k],F=c.currentSubscriptions[k]??{};O&&(qn(F)===0?x.dispatch(u({queryCacheKey:k})):O.status!=="uninitialized"&&x.dispatch(a(O)))}})}return g},jw=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:i})=>{let o={},s=(g,y)=>{(r.internalActions.updateSubscriptionOptions.match(g)||r.internalActions.unsubscribeQueryResult.match(g))&&u(g.payload,y),(t.pending.match(g)||t.rejected.match(g)&&g.meta.condition)&&u(g.meta.arg,y),(t.fulfilled.match(g)||t.rejected.match(g)&&!g.meta.condition)&&c(g.meta.arg,y),r.util.resetApiState.match(g)&&v()};function a(g,y){let E=y.getState()[e].queries[g],x=i.currentSubscriptions[g];if(!(!E||E.status==="uninitialized"))return x}function c({queryCacheKey:g},y){let C=y.getState()[e],E=C.queries[g],x=i.currentSubscriptions[g];if(!E||E.status==="uninitialized")return;let{lowestPollingInterval:I,skipPollingIfUnfocused:T}=S(x);if(!Number.isFinite(I))return;let _=o[g];_?.timeout&&(clearTimeout(_.timeout),_.timeout=void 0);let M=Date.now()+I;o[g]={nextPollTimestamp:M,pollingInterval:I,timeout:setTimeout(()=>{(C.config.focused||!T)&&y.dispatch(n(E)),c({queryCacheKey:g},y)},I)}}function u({queryCacheKey:g},y){let E=y.getState()[e].queries[g],x=i.currentSubscriptions[g];if(!E||E.status==="uninitialized")return;let{lowestPollingInterval:I}=S(x);if(!Number.isFinite(I)){h(g);return}let T=o[g],_=Date.now()+I;(!T||_<T.nextPollTimestamp)&&c({queryCacheKey:g},y)}function h(g){let y=o[g];y?.timeout&&clearTimeout(y.timeout),delete o[g]}function v(){for(let g of Object.keys(o))h(g)}function S(g={}){let y=!1,C=Number.POSITIVE_INFINITY;for(let E in g)g[E].pollingInterval&&(C=Math.min(g[E].pollingInterval,C),y=g[E].skipPollingIfUnfocused||y);return{lowestPollingInterval:C,skipPollingIfUnfocused:y}}return s},qw=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let i=Xo(r,n),o=jr(r,n),s=Kt(r,n),a={};return(u,h)=>{if(i(u)){let{requestId:v,arg:{endpointName:S,originalArgs:g}}=u.meta,y=t.endpointDefinitions[S],C=y?.onQueryStarted;if(C){let E={},x=new Promise((M,P)=>{E.resolve=M,E.reject=P});x.catch(()=>{}),a[v]=E;let I=e.endpoints[S].select(y.type==="query"?g:v),T=h.dispatch((M,P,k)=>k),_={...h,getCacheEntry:()=>I(h.getState()),requestId:v,extra:T,updateCachedData:y.type==="query"?M=>h.dispatch(e.util.updateQueryData(S,g,M)):void 0,queryFulfilled:x};C(g,_)}}else if(s(u)){let{requestId:v,baseQueryMeta:S}=u.meta;a[v]?.resolve({data:u.payload,meta:S}),delete a[v]}else if(o(u)){let{requestId:v,rejectedWithValue:S,baseQueryMeta:g}=u.meta;a[v]?.reject({error:u.payload??u.error,isUnhandledError:!S,meta:g}),delete a[v]}}},Lw=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:i})=>{let{removeQueryResult:o}=r.internalActions,s=(c,u)=>{xu.match(c)&&a(u,"refetchOnFocus"),Eu.match(c)&&a(u,"refetchOnReconnect")};function a(c,u){let h=c.getState()[e],v=h.queries,S=i.currentSubscriptions;t.batch(()=>{for(let g of Object.keys(S)){let y=v[g],C=S[g];if(!C||!y)continue;(Object.values(C).some(x=>x[u]===!0)||Object.values(C).every(x=>x[u]===void 0)&&h.config[u])&&(qn(C)===0?c.dispatch(o({queryCacheKey:g})):y.status!=="uninitialized"&&c.dispatch(n(y)))}})}return s};function Uw(e){let{reducerPath:t,queryThunk:r,api:n,context:i}=e,{apiUid:o}=i,s={invalidateTags:q(`${t}/invalidateTags`)},a=v=>v.type.startsWith(`${t}/`),c=[Dw,Nw,Mw,jw,Fw,qw];return{middleware:v=>{let S=!1,y={...e,internalState:{currentSubscriptions:{}},refetchQuery:h,isThisApiSliceAction:a},C=c.map(I=>I(y)),E=kw(y),x=Lw(y);return I=>T=>{if(!In(T))return I(T);S||(S=!0,v.dispatch(n.internalActions.middlewareRegistered(o)));let _={...v,next:I},M=v.getState(),[P,k]=E(T,_,M),O;if(P?O=I(T):O=k,v.getState()[t]&&(x(T,_,M),a(T)||i.hasRehydrationInfo(T)))for(let F of C)F(T,_,M);return O}},actions:s};function h(v){return e.api.endpoints[v.endpointName].initiate(v.originalArgs,{subscribe:!1,forceRefetch:!0})}}var rm=Symbol(),Vw=({createSelector:e=De}={})=>({name:rm,init(t,{baseQuery:r,tagTypes:n,reducerPath:i,serializeQueryArgs:o,keepUnusedDataFor:s,refetchOnMountOrArgChange:a,refetchOnFocus:c,refetchOnReconnect:u,invalidationBehavior:h},v){Lp();let S=ce=>(typeof process<"u",ce);Object.assign(t,{reducerPath:i,endpoints:{},internalActions:{onOnline:Eu,onOffline:am,onFocus:xu,onFocusLost:sm},util:{}});let g=Tw({serializeQueryArgs:o,reducerPath:i,createSelector:e}),{selectInvalidatedBy:y,selectCachedArgsForQuery:C,buildQuerySelector:E,buildInfiniteQuerySelector:x,buildMutationSelector:I}=g;Yt(t.util,{selectInvalidatedBy:y,selectCachedArgsForQuery:C});let{queryThunk:T,infiniteQueryThunk:_,mutationThunk:M,patchQueryData:P,updateQueryData:k,upsertQueryData:O,prefetch:F,buildMatchThunkActions:L}=Rw({baseQuery:r,reducerPath:i,context:v,api:t,serializeQueryArgs:o,assertTagType:S,selectors:g}),{reducer:Q,actions:G}=Iw({context:v,queryThunk:T,infiniteQueryThunk:_,mutationThunk:M,serializeQueryArgs:o,reducerPath:i,assertTagType:S,config:{refetchOnFocus:c,refetchOnReconnect:u,refetchOnMountOrArgChange:a,keepUnusedDataFor:s,reducerPath:i,invalidationBehavior:h}});Yt(t.util,{patchQueryData:P,updateQueryData:k,upsertQueryData:O,prefetch:F,resetApiState:G.resetApiState,upsertQueryEntries:G.cacheEntriesUpserted}),Yt(t.internalActions,G);let{middleware:V,actions:U}=Uw({reducerPath:i,context:v,queryThunk:T,mutationThunk:M,infiniteQueryThunk:_,api:t,assertTagType:S,selectors:g});Yt(t.util,U),Yt(t,{reducer:Q,middleware:V});let{buildInitiateQuery:$,buildInitiateInfiniteQuery:B,buildInitiateMutation:W,getRunningMutationThunk:K,getRunningMutationsThunk:ee,getRunningQueriesThunk:ue,getRunningQueryThunk:he}=xw({queryThunk:T,mutationThunk:M,infiniteQueryThunk:_,api:t,serializeQueryArgs:o,context:v});return Yt(t.util,{getRunningMutationThunk:K,getRunningMutationsThunk:ee,getRunningQueryThunk:he,getRunningQueriesThunk:ue}),{name:rm,injectEndpoint(ce,le){var Ne;let pe=(Ne=t.endpoints)[ce]??(Ne[ce]={});Ru(le)&&Yt(pe,{name:ce,select:E(ce,le),initiate:$(ce,le)},L(T,ce)),bw(le)&&Yt(pe,{name:ce,select:I(),initiate:W(ce)},L(M,ce)),Iu(le)&&Yt(pe,{name:ce,select:x(ce,le),initiate:B(ce,le)},L(T,ce))}}}}),dm=_w(Vw());m();d();f();p();m();d();f();p();var Lr=e=>e.query,pm=e=>e.query?.enableQuerySyntax;var dj=De(e=>Lr(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,r,n,i)=>({q:e,requestId:t,cannotAnswer:r,analyticsMode:n,actionCause:i})),Bw=De(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 Xt(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 i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function D(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{u(n.next(h))}catch(v){s(v)}}function c(h){try{u(n.throw(h))}catch(v){s(v)}}function u(h){h.done?o(h.value):i(h.value).then(a,c)}u((n=n.apply(e,t||[])).next())})}var me;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(me||(me={}));function Ou(){return typeof window<"u"}function $u(){return typeof navigator<"u"}function Un(){return typeof document<"u"}function Pu(){try{return typeof localStorage<"u"}catch{return!1}}function Gw(){try{return typeof sessionStorage<"u"}catch{return!1}}function Rm(){return $u()&&navigator.cookieEnabled}var $w=[me.click,me.custom,me.search,me.view],Qw=(e,t)=>$w.indexOf(e)!==-1?Object.assign({language:Un()?document.documentElement.lang:"unknown",userAgent:$u()?navigator.userAgent:"unknown"},t):t,Ki=class e{static set(t,r,n){var i,o,s,a;n&&(o=new Date,o.setTime(o.getTime()+n)),a=window.location.hostname,a.indexOf(".")===-1?fm(t,r,o):(s=a.split("."),i=s[s.length-2]+"."+s[s.length-1],fm(t,r,o,i))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){var o=n[i];if(o=o.replace(/^\s+/,""),o.lastIndexOf(r,0)===0)return o.substring(r.length,o.length)}return null}static erase(t){e.set(t,"",-1)}};function fm(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function Hw(){return Pu()?localStorage:Rm()?new Yi:Gw()?sessionStorage:new Bn}var Yi=class e{getItem(t){return Ki.get(`${e.prefix}${t}`)}removeItem(t){Ki.erase(`${e.prefix}${t}`)}setItem(t,r,n){Ki.set(`${e.prefix}${t}`,r,n)}};Yi.prefix="coveo_";var Nu=class{constructor(){this.cookieStorage=new Yi}getItem(t){return localStorage.getItem(t)||this.cookieStorage.getItem(t)}removeItem(t){this.cookieStorage.removeItem(t),localStorage.removeItem(t)}setItem(t,r){localStorage.setItem(t,r),this.cookieStorage.setItem(t,r,31556926e3)}},Bn=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},ms="__coveo.analytics.history",zw=20,Ww=1e3*60,Kw=75,ys=class{constructor(t){this.store=t||Hw()}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 D(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 D(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(ms);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return D(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(ms);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(ms,JSON.stringify(t.slice(0,zw)))}catch{}}clear(){try{this.store.removeItem(ms)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,i)=>(i.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,Kw)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>Ww:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:i,value:o}=r;return{name:n,time:i,value:o}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:i}=t;return r&&typeof i=="string"&&r.toLowerCase()==="query"&&i.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var Yw=(e,t)=>D(void 0,void 0,void 0,function*(){return e===me.view?(yield Xw(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),Xw=e=>D(void 0,void 0,void 0,function*(){let t=new ys,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),gs,Jw=new Uint8Array(16);function Zw(){if(!gs&&(gs=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!gs))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return gs(Jw)}var eC=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function vs(e){return typeof e=="string"&&eC.test(e)}var Ke=[];for(let e=0;e<256;++e)Ke.push((e+256).toString(16).slice(1));function Im(e,t=0){return Ke[e[t+0]]+Ke[e[t+1]]+Ke[e[t+2]]+Ke[e[t+3]]+"-"+Ke[e[t+4]]+Ke[e[t+5]]+"-"+Ke[e[t+6]]+Ke[e[t+7]]+"-"+Ke[e[t+8]]+Ke[e[t+9]]+"-"+Ke[e[t+10]]+Ke[e[t+11]]+Ke[e[t+12]]+Ke[e[t+13]]+Ke[e[t+14]]+Ke[e[t+15]]}function tC(e){if(!vs(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}function rC(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var nC="6ba7b810-9dad-11d1-80b4-00c04fd430c8",iC="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function oC(e,t,r){function n(i,o,s,a){var c;if(typeof i=="string"&&(i=rC(i)),typeof o=="string"&&(o=tC(o)),((c=o)===null||c===void 0?void 0:c.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+i.length);if(u.set(o),u.set(i,o.length),u=r(u),u[6]=u[6]&15|t,u[8]=u[8]&63|128,s){a=a||0;for(let h=0;h<16;++h)s[a+h]=u[h];return s}return Im(u)}try{n.name=e}catch{}return n.DNS=nC,n.URL=iC,n}var sC=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),mm={randomUUID:sC};function Ur(e,t,r){if(mm.randomUUID&&!t&&!e)return mm.randomUUID();e=e||{};let n=e.random||(e.rng||Zw)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return Im(n)}function aC(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 _u(e,t){return e<<t|e>>>32-t}function cC(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let s=unescape(encodeURIComponent(e));e=[];for(let a=0;a<s.length;++a)e.push(s.charCodeAt(a))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,i=Math.ceil(n/16),o=new Array(i);for(let s=0;s<i;++s){let a=new Uint32Array(16);for(let c=0;c<16;++c)a[c]=e[s*64+c*4]<<24|e[s*64+c*4+1]<<16|e[s*64+c*4+2]<<8|e[s*64+c*4+3];o[s]=a}o[i-1][14]=(e.length-1)*8/Math.pow(2,32),o[i-1][14]=Math.floor(o[i-1][14]),o[i-1][15]=(e.length-1)*8&4294967295;for(let s=0;s<i;++s){let a=new Uint32Array(80);for(let g=0;g<16;++g)a[g]=o[s][g];for(let g=16;g<80;++g)a[g]=_u(a[g-3]^a[g-8]^a[g-14]^a[g-16],1);let c=r[0],u=r[1],h=r[2],v=r[3],S=r[4];for(let g=0;g<80;++g){let y=Math.floor(g/20),C=_u(c,5)+aC(y,u,h,v)+S+t[y]+a[g]>>>0;S=v,v=h,h=_u(u,30)>>>0,u=c,c=C}r[0]=r[0]+c>>>0,r[1]=r[1]+u>>>0,r[2]=r[2]+h>>>0,r[3]=r[3]+v>>>0,r[4]=r[4]+S>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var uC=oC("v5",80,cC),gm=uC,Tm="2.30.52",hm=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Wi={pageview:"pageview",event:"event"},Ss=class{constructor({client:t,uuidGenerator:r=Ur}){this.client=t,this.uuidGenerator=r}},Fu=class extends Ss{constructor({client:t,uuidGenerator:r=Ur}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=hm(window.location),this.lastReferrer=Un()?document.referrer:"",this.addHooks()}getApi(t){switch(t){case"setAction":return this.setAction;default:return 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:Un()?document.title:"",encoding:Un()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},i={language:navigator.language,userAgent:navigator.userAgent},o={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},o),n),i),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:i,location:o}=this.getNextValues(t,r);this.lastReferrer=i,this.pageViewId=n,this.currentLocation=o,t===Wi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===Wi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Wi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Wi.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=i=>i.replace(/^\/?(.*)$/,"/$1");return`${(i=>i.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return hm(window.location)}},ur=class e{constructor(t,r){if(!vs(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(i=>new RegExp(i.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,i]=r;if(n.length!==32||isNaN(parseInt(i)))return null;let o=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return vs(o)?new e(o,Number.parseInt(i)*1e3):null}};ur.cvo_cid="cvo_cid";ur.expirationTime=120;var Du=class extends Ss{constructor({client:t,uuidGenerator:r=Ur}){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 D(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(ur.cvo_cid,new ur(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Du.Id="link";var yt=Object.keys;function hs(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var ku=128,_m=192,ym=224,vm=240;function lC(e){return(e&248)===vm?4:(e&vm)===ym?3:(e&ym)===_m?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&ku)!=ku)break;if(r-=3,(n&_m)!=ku){t-r>=lC(n)*3&&(r=t);break}}return e.substring(0,r)}var Mu={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"},pC=yt(Mu).map(e=>Mu[e]),fC=[...pC].join("|"),mC=new RegExp(`^(${fC}$)`),gC={svcAction:"svc_action",svcActionData:"svc_action_data"},hC=e=>yt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=Mu[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),yC=e=>mC.test(e),vC=[yC],Sm={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Am={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},Ze={action:"pa",list:"pal",listSource:"pls"},As={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},SC=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],ju={id:"quoteId",affiliation:"quoteAffiliation"},qu={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},AC={add:Ze,bookmark_add:Ze,bookmark_remove:Ze,click:Ze,checkout:Ze,checkout_option:Ze,detail:Ze,impression:Ze,remove:Ze,refund:Object.assign(Object.assign({},Ze),As),purchase:Object.assign(Object.assign({},Ze),As),quickview:Ze,quote:Object.assign(Object.assign({},Ze),ju),review:Object.assign(Object.assign({},Ze),qu)},bC=yt(Sm).map(e=>Sm[e]),wC=yt(Am).map(e=>Am[e]),CC=yt(Ze).map(e=>Ze[e]),xC=yt(As).map(e=>As[e]),EC=yt(qu).map(e=>qu[e]),RC=yt(ju).map(e=>ju[e]),IC=[...bC,"custom"].join("|"),TC=[...wC,"custom"].join("|"),km="(pr[0-9]+)",Om="(il[0-9]+pi[0-9]+)",_C=new RegExp(`^${km}(${IC})$`),kC=new RegExp(`^(${Om}(${TC}))|(il[0-9]+nm)$`),OC=new RegExp(`^(${CC.join("|")})$`),PC=new RegExp(`^(${xC.join("|")})$`),NC=new RegExp(`^${km}custom$`),FC=new RegExp(`^${Om}custom$`),DC=new RegExp(`^(${[...SC,...EC,...RC].join("|")})$`),MC=e=>_C.test(e),jC=e=>kC.test(e),qC=e=>OC.test(e),LC=e=>PC.test(e),UC=e=>DC.test(e),VC=[jC,MC,qC,LC,UC],BC=[NC,FC],GC={anonymizeIp:"aip"},$C={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},QC={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},HC=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],zC=Object.assign(Object.assign(Object.assign(Object.assign({},GC),$C),QC),HC.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Lu=Object.assign(Object.assign({},zC),gC),WC=e=>{let t=!!e.action&&AC[e.action]||{};return yt(e).reduce((r,n)=>{let i=t[n]||Lu[n]||n;return Object.assign(Object.assign({},r),{[i]:e[n]})},{})},KC=yt(Lu).map(e=>Lu[e]),YC=e=>KC.indexOf(e)!==-1,XC=e=>e==="custom",JC=e=>[...VC,...vC,YC,XC].some(t=>t(e)),ZC=e=>yt(e).reduce((t,r)=>{let n=ex(r);return n?Object.assign(Object.assign({},t),tx(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),ex=e=>{let t;return[...BC].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},tx=(e,t)=>yt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),Uu=class{constructor(t){this.opts=t}sendEvent(t,r){return D(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:i}=this.opts,o=yield this.getQueryParamsForEventType(t),{url:s,payload:a}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${o}`,r,i),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 D(this,void 0,void 0,function*(){let i=t,o=r;if(n){let s=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:a,body:c}=s;i=a||t;try{o=JSON.parse(c)}catch(u){console.error("Unable to process the request body as a JSON string",u)}}return{payload:o,url:i}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return D(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,i=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",i?`visitorId=${i}`:"","discardVisitInfo=true"].filter(o=>!!o).join("&")})}isEventTypeLegacy(t){return[me.click,me.custom,me.search,me.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let i=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(i=`access_token=${encodeURIComponent(n)}&${i}`),i}},Vu=class{sendEvent(t,r){return D(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return D(this,void 0,void 0,function*(){return Promise.resolve()})}},bm=A.fetch,bs=class{constructor(t){this.opts=t}sendEvent(t,r){return D(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:i,preprocessRequest:o}=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),o?yield o(a,"analyticsFetch"):{}),{url:u}=c,h=Xt(c,["url"]),v;try{v=yield bm(u,h)}catch(S){console.error("An error has occured when sending the event.",S);return}if(v.ok){let S=yield v.json();return S.visitorId&&i.setCurrentVisitorId(S.visitorId),S}else{try{v.json()}catch{}throw console.error(`An error has occured 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 D(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield bm(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[me.click,me.custom,me.search,me.view].indexOf(t)!==-1}getVisitorIdParam(){return D(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"})}},Bu=class{constructor(t,r){Pu()&&Rm()?this.storage=new Nu:Pu()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Bn),this.client=new bs(t),this.beaconClient=new Uu(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:i,payload:o}of n)this.beaconClient.sendEvent(i,o)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},Gu=class{constructor(t,r){this.storage=r||new Bn,this.client=new bs(t)}getClientDependingOnEventType(t){return this.client}},ws=class{constructor(){this.storage=new Bn,this.client=new Vu}getClientDependingOnEventType(t){return this.client}},rx="xx",nx=e=>e?.startsWith(rx)||!1,ix=`
|
|
28
27
|
We've detected you're using React Native but have not provided the corresponding runtime,
|
|
29
28
|
for an optimal experience please use the "coveo.analytics/react-native" subpackage.
|
|
30
29
|
Follow the Readme on how to set it up: https://github.com/coveo/coveo.analytics.js#using-react-native
|
|
31
|
-
`;function Ux(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var Vx=["1",1,"yes",!0];function qs(){let e=[];return zu()&&e.push(window.doNotTrack),sl()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>Vx.indexOf(t)!==-1)}var yg="v15",vg={default:"https://analytics.cloud.coveo.com/rest/ua",production:"https://analytics.cloud.coveo.com/rest/ua",hipaa:"https://analyticshipaa.cloud.coveo.com/rest/ua"};function Gx(e=vg.default,t=yg,r=!1){if(e=e.replace(/\/$/,""),r)return`${e}/${t}`;let n=e.endsWith("/rest")||e.endsWith("/rest/ua");return`${e}${n?"":"/rest"}/${t}`}var Bx="38824e1f-37f5-42d3-8372-a4b8fa9df946",Dt=class{get defaultOptions(){return{endpoint:vg.default,isCustomEndpoint:!1,token:"",version:yg,beforeSendHooks:[],afterSendHooks:[]}}get version(){return fg}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=[OC,IC].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};qs()?this.runtime=new js:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(me.view,{newEventType:me.view,addClientIdParameter:!0}),this.addEventTypeMapping(me.click,{newEventType:me.click,addClientIdParameter:!0}),this.addEventTypeMapping(me.custom,{newEventType:me.custom,addClientIdParameter:!0}),this.addEventTypeMapping(me.search,{newEventType:me.search,addClientIdParameter:!0})}initRuntime(t){return zu()&&Kn()?new il(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(Ux()&&console.warn(Lx),new ol(t))}get storage(){return this.runtime.storage}determineVisitorId(){return D(this,void 0,void 0,function*(){try{return zu()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Gr()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Gr()}})}getCurrentVisitorId(){return D(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return D(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return D(this,void 0,void 0,function*(){if(Ns(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(eg(t,eg(r,Bx)))}})}getParameters(t,...r){return D(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return D(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(Gr()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(qs())return null;try{let r=new URL(t).searchParams.get(dr.cvo_cid);if(r==null)return null;let n=dr.fromString(r);return!n||!Kn()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return D(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:i=!1,usesMeasurementProtocol:o=!1,addClientIdParameter:s=!1}=this.eventTypeMapping[t]||{};return yield[g=>n.length>0?this.parseVariableArgumentsPayload(n,g):g[0],g=>D(this,void 0,void 0,function*(){return Object.assign(Object.assign({},g),{visitorId:i?yield this.getCurrentVisitorId():""})}),g=>D(this,void 0,void 0,function*(){return s?Object.assign(Object.assign({},g),{clientId:yield this.getCurrentVisitorId()}):g}),g=>o?this.ensureAnonymousUserWhenUsingApiKey(g):g,g=>this.beforeSendHooks.reduce((y,C)=>D(this,void 0,void 0,function*(){let E=yield y;return yield C(t,E)}),g)].reduce((g,y)=>D(this,void 0,void 0,function*(){let C=yield g;return yield y(C)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return D(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?_x(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,S)=>D(this,void 0,void 0,function*(){let g=yield v;return yield S(g)}),Promise.resolve(r))})}makeEvent(t,...r){return D(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},i=yield this.resolveParameters(t,...r),o=yield this.resolvePayloadForParameters(t,i);return{eventType:n,payload:o,log:s=>D(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},o),s)}),yield Promise.all(this.afterSendHooks.map(a=>a(t,Object.assign(Object.assign({},i),s)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return D(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return D(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 Ps().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return D(this,void 0,void 0,function*(){return this.makeEvent(me.search,t)})}sendSearchEvent(t){return D(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Jt(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return D(this,void 0,void 0,function*(){return this.makeEvent(me.click,t)})}sendClickEvent(t){return D(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Jt(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return D(this,void 0,void 0,function*(){return this.makeEvent(me.custom,t)})}sendCustomEvent(t){return D(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=Jt(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return D(this,void 0,void 0,function*(){return this.makeEvent(me.view,t)})}sendViewEvent(t){return D(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return D(this,void 0,void 0,function*(){let r=yield(yield w(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return D(this,void 0,void 0,function*(){return yield(yield w(`${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 i=0,o=r.length;i<o;i++){let s=r[i];if(typeof s=="string")n[t[i]]=s;else if(typeof s=="object")return Object.assign(Object.assign({},n),s)}return n}isKeyAllowedEmpty(t,r){return({[me.search]:["queryText"]}[t]||[]).indexOf(r)!==-1}removeEmptyPayloadValues(t,r){let n=i=>typeof i<"u"&&i!==null&&i!=="";return Object.keys(t).filter(i=>this.isKeyAllowedEmpty(r,i)||n(t[i])).reduce((i,o)=>Object.assign(Object.assign({},i),{[o]:t[o]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(Nx(n))return!0;console.log(n,"is not processed by coveoua")}).reduce((n,i)=>Object.assign(Object.assign({},n),{[i]:t[i]}),{})}processCustomParameters(t){let{custom:r}=t,n=Jt(t,["custom"]),i={};r&&Os(r)&&(i=this.lowercaseKeys(r));let o=Fx(n);return Object.assign(Object.assign({},i),o)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=Jt(t,["custom"]);if(r&&Os(r)){let i=this.lowercaseKeys(r);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},i),t.customData)})}else return t}lowercaseKeys(t){let r=Object.keys(t),n={};return r.forEach(i=>{n[i.toLowerCase()]=t[i]}),n}validateParams(t,r){let{anonymizeIp:n}=t,i=Jt(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(i.anonymizeIp=1),(r==me.view||r==me.click||r==me.search||r==me.custom)&&(i.originLevel3=this.limit(i.originLevel3,1024)),r==me.view&&(i.location=this.limit(i.location,1024)),(r=="pageview"||r=="event")&&(i.referrer=this.limit(i.referrer,2048),i.location=this.limit(i.location,2048),i.page=this.limit(i.page,2048)),i}ensureAnonymousUserWhenUsingApiKey(t){let{userId:r}=t,n=Jt(t,["userId"]);return qx(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=Jt(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Os(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Os(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"?HC(t,r):t}get baseUrl(){return Gx(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},Zt;(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"})(Zt||(Zt={}));var j;(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.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.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})(j||(j={}));var ag={[j.triggerNotify]:"queryPipelineTriggers",[j.triggerExecute]:"queryPipelineTriggers",[j.triggerQuery]:"queryPipelineTriggers",[j.triggerRedirect]:"queryPipelineTriggers",[j.queryErrorBack]:"errors",[j.queryErrorClear]:"errors",[j.queryErrorRetry]:"errors",[j.pagerNext]:"getMoreResults",[j.pagerPrevious]:"getMoreResults",[j.pagerNumber]:"getMoreResults",[j.pagerResize]:"getMoreResults",[j.pagerScrolling]:"getMoreResults",[j.facetSearch]:"facet",[j.facetShowLess]:"facet",[j.facetShowMore]:"facet",[j.recommendation]:"recommendation",[j.likeSmartSnippet]:"smartSnippet",[j.dislikeSmartSnippet]:"smartSnippet",[j.expandSmartSnippet]:"smartSnippet",[j.collapseSmartSnippet]:"smartSnippet",[j.openSmartSnippetFeedbackModal]:"smartSnippet",[j.closeSmartSnippetFeedbackModal]:"smartSnippet",[j.sendSmartSnippetReason]:"smartSnippet",[j.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[j.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[j.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[j.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[j.clearRecentQueries]:"recentQueries",[j.recentResultClick]:"recentlyClickedDocuments",[j.clearRecentResults]:"recentlyClickedDocuments",[j.showLessFoldedResults]:"folding",[j.caseDetach]:"case",[j.likeGeneratedAnswer]:"generatedAnswer",[j.dislikeGeneratedAnswer]:"generatedAnswer",[j.openGeneratedAnswerSource]:"generatedAnswer",[j.generatedAnswerStreamEnd]:"generatedAnswer",[j.generatedAnswerSourceHover]:"generatedAnswer",[j.generatedAnswerCopyToClipboard]:"generatedAnswer",[j.generatedAnswerHideAnswers]:"generatedAnswer",[j.generatedAnswerShowAnswers]:"generatedAnswer",[j.generatedAnswerExpand]:"generatedAnswer",[j.generatedAnswerCollapse]:"generatedAnswer",[j.generatedAnswerFeedbackSubmit]:"generatedAnswer",[j.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[Zt.expandToFullUI]:"interface",[Zt.openUserActions]:"User Actions",[Zt.showPrecedingSessions]:"User Actions",[Zt.showFollowingSessions]:"User Actions",[Zt.clickViewedDocument]:"User Actions",[Zt.clickPageView]:"User Actions",[Zt.createArticle]:"createArticle"},Jn=class{constructor(){this.runtime=new js,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(me.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(me.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(me.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(me.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return fg}};function $x(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function Qx(e){return e.map(t=>t.replace(/;/g,""))}function Sg(e){let r=e.join(";");return r.length<=256?r:Sg(e.slice(1))}var cg=e=>{let t=Qx(e),r=$x(t);return Sg(r)};function ug(e){let t=typeof e.partialQueries=="string"?e.partialQueries:cg(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:cg(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Ls=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||qs();this.coveoAnalyticsClient=n?new Jn:new Dt(t)}disable(){this.coveoAnalyticsClient=new Jn}enable(){this.coveoAnalyticsClient=new Dt(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(j.interfaceLoad)}logInterfaceLoad(){return D(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(j.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return D(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(j.recommendation)}logRecommendation(){return D(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent(j.recommendationOpen,t,r)}logRecommendationOpen(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(j.staticFilterClearAll,t)}logStaticFilterClearAll(t){return D(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent(j.staticFilterSelect,t)}logStaticFilterSelect(t){return D(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent(j.staticFilterDeselect,t)}logStaticFilterDeselect(t){return D(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(j.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return D(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent(j.interfaceChange,t)}logInterfaceChange(t){return D(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(j.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return D(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(j.didyoumeanClick)}logDidYouMeanClick(){return D(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(j.resultsSort,t)}logResultsSort(t){return D(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(j.searchboxSubmit)}logSearchboxSubmit(){return D(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(j.searchboxClear)}logSearchboxClear(){return D(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(j.searchboxAsYouType)}logSearchboxAsYouType(){return D(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(j.breadcrumbFacet,t)}logBreadcrumbFacet(t){return D(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(j.breadcrumbResetAll)}logBreadcrumbResetAll(){return D(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent(j.documentQuickview,t,r)}logDocumentQuickview(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent(j.documentOpen,t,r)}logDocumentOpen(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(j.omniboxAnalytics,ug(t))}logOmniboxAnalytics(t){return D(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(j.omniboxFromLink,ug(t))}logOmniboxFromLink(t){return D(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(j.searchFromLink)}logSearchFromLink(){return D(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(j.triggerNotify,t)}logTriggerNotify(t){return D(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(j.triggerExecute,t)}logTriggerExecute(t){return D(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(j.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return D(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(j.undoTriggerQuery,t)}logUndoTriggerQuery(t){return D(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(j.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return D(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(j.pagerResize,t)}logPagerResize(t){return D(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(j.pagerNumber,t)}logPagerNumber(t){return D(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(j.pagerNext,t)}logPagerNext(t){return D(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(j.pagerPrevious,t)}logPagerPrevious(t){return D(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(j.pagerScrolling)}logPagerScrolling(){return D(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(j.facetClearAll,t)}logFacetClearAll(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(j.facetSearch,t)}logFacetSearch(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(j.facetSelect,t)}logFacetSelect(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(j.facetDeselect,t)}logFacetDeselect(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(j.facetExclude,t)}logFacetExclude(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(j.facetUnexclude,t)}logFacetUnexclude(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(j.facetSelectAll,t)}logFacetSelectAll(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(j.facetUpdateSort,t)}logFacetUpdateSort(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(j.facetShowMore,t)}logFacetShowMore(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(j.facetShowLess,t)}logFacetShowLess(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(j.queryError,t)}logQueryError(t){return D(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return D(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(j.queryErrorBack);return{description:t.description,log:()=>D(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(j.queryErrorBack)})}})}logQueryErrorBack(){return D(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return D(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(j.queryErrorRetry);return{description:t.description,log:()=>D(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(j.queryErrorRetry)})}})}logQueryErrorRetry(){return D(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return D(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(j.queryErrorClear);return{description:t.description,log:()=>D(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(j.queryErrorClear)})}})}logQueryErrorClear(){return D(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(j.likeSmartSnippet)}logLikeSmartSnippet(){return D(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(j.dislikeSmartSnippet)}logDislikeSmartSnippet(){return D(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(j.expandSmartSnippet)}logExpandSmartSnippet(){return D(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(j.collapseSmartSnippet)}logCollapseSmartSnippet(){return D(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(j.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return D(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(j.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return D(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent(j.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(j.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return D(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent(j.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return D(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent(j.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return D(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent(j.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return D(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent(j.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent(j.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(j.copyToClipboard,t,r)}logCopyToClipboard(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent(j.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent(j.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(j.recentQueryClick)}logRecentQueryClick(){return D(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(j.clearRecentQueries)}logClearRecentQueries(){return D(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent(j.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(j.clearRecentResults)}logClearRecentResults(){return D(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(j.noResultsBack)}logNoResultsBack(){return D(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent(j.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(j.showLessFoldedResults)}logShowLessFoldedResults(){return D(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 D(this,arguments,void 0,function*(n,i,o=ag[n]){this.coveoAnalyticsClient.getParameters;let s=Object.assign(Object.assign({},this.provider.getBaseMetadata()),i),a=Object.assign(Object.assign({},yield this.getBaseEventRequest(s)),{eventType:o,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 D(this,arguments,void 0,function*(n,i,o=ag[n]){return(yield this.makeCustomEvent(n,i,o)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return D(this,void 0,void 0,function*(){let i=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),o=Object.assign(Object.assign({},yield this.getBaseEventRequest(i)),{eventType:r,eventValue:t}),s=yield this.coveoAnalyticsClient.makeCustomEvent(o);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({lastSearchQueryUid:a})}})}logCustomEventWithType(t,r,n){return D(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return D(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),i=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(i,t),log:({searchUID:o})=>i.log({searchQueryUid:o})}})}makeClickEvent(t,r,n,i){return D(this,void 0,void 0,function*(){let o=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),i))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),s=yield this.coveoAnalyticsClient.makeClickEvent(o);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({searchQueryUid:a})}})}logClickEvent(t,r,n,i){return D(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,i)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return D(this,void 0,void 0,function*(){var n,i;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(i=(n=this.provider).getGeneratedAnswerMetadata)===null||i===void 0?void 0:i.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return D(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 Dt?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(j.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return D(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(j.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return D(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(j.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return D(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(j.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(j.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(j.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(j.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(j.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(j.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(j.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(j.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(j.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(j.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return D(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(j.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return D(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(j.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Us=Object.assign({},no),lg=Object.keys(Us).map(e=>Us[e]),Yn=class extends Yu{constructor({client:t,uuidGenerator:r=Gr}){super({client:t,uuidGenerator:r}),this.ticket={}}getApi(t){let r=super.getApi(t);if(r!==null)return r;switch(t){case"setTicket":return this.setTicket;default:return null}}addHooks(){this.addHooksForEvent(),this.addHooksForPageView(),this.addHooksForSVCEvents()}setTicket(t){this.ticket=t}clearPluginData(){this.ticket={}}addHooksForSVCEvents(){this.client.registerBeforeSendEventHook((t,...[r])=>lg.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(lg.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Us.pageview,{newEventType:me.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Us.event,{newEventType:me.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,r){var n;let i=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}:{}),o=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},o),i),r)}getTicketPayload(){return XC(this.ticket)}};Yn.Id="svc";var Vs;(function(e){e.click="click",e.flowStart="flowStart"})(Vs||(Vs={}));var ht;(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"})(ht||(ht={}));var Gs;(function(e){e.quit="Quit",e.solved="Solved"})(Gs||(Gs={}));var Bs=class{constructor(t,r){var n;this.options=t,this.provider=r;let i=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!qs();this.coveoAnalyticsClient=i?new Dt(t):new Jn,this.svc=new Yn({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Jn,this.svc=new Yn({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Dt(this.options),this.svc=new Yn({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(ht.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(ht.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(ht.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(ht.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(ht.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(ht.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(ht.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(ht.caseCancelled,{reason:Gs.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(ht.caseSolved,{reason:Gs.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(ht.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Vs.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Vs.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return D(this,void 0,void 0,function*(){var r,n;let i=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:i,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 Dt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,i,o;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:(i=this.provider)===null||i===void 0?void 0:i.getOriginLevel2(),originLevel3:(o=this.provider)===null||o===void 0?void 0:o.getOriginLevel3()}}logClickEvent(t,r,n,i){return D(this,void 0,void 0,function*(){var o,s;let a=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),i))),{searchQueryUid:(s=(o=this.provider)===null||o===void 0?void 0:o.getSearchUID())!==null&&s!==void 0?s:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(a)})}};m();d();f();p();var Hx=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},Br=class{constructor(t){this.getState=t;be(this,"state");this.state=t()}getLanguage(){return Hx(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},i={};for(let[o,s]of Object.entries(n)){let a=`context_${o}`;i[a]=s}return r.analytics.analyticsMode==="legacy"&&(i.coveoHeadlessVersion=Vn),i}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||Bn()}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 Zn=e=>new Dt(e).getCurrentVisitorId(),so=(e,t)=>typeof t=="function"?(...r)=>{let n=Ui(r[0]);try{return t.apply(t,r)}catch(i){return e.error(i,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,ao=(e,t)=>(...r)=>{let n=Ui(r[1]);try{return t.apply(t,r)}catch(i){return e.error(i,"Error in analytics hook. Returning original request."),n}};var co=class extends Br{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Ag=({logger:e,getState:t,analyticsClientMiddleware:r=(o,s)=>s,preprocessRequest:n,provider:i=new co(t)})=>{let o=t(),s=o.configuration.accessToken,a=o.configuration.analytics.apiBaseUrl??Te(o.configuration.organizationId,o.configuration.environment,"analytics"),c=o.configuration.analytics.runtimeEnvironment,u=o.configuration.analytics.enabled,h=new Bs({enableAnalytics:u,token:s,endpoint:a,runtimeEnvironment:c,preprocessRequest:so(e,n),beforeSendHooks:[ao(e,r),(v,S)=>(e.info({...S,type:v,endpoint:a,token:s},"Analytics request"),S)]},i);return u||h.disable(),h};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function $s(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function wg(e){let{activeValue:t,ancestryMap:r}=Kx(e);return t?Yx(t,r):[]}function Kx(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 i of n.children)r.set(i,n);t.unshift(...n.children)}return{}}function Yx(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var Xx=(e,t)=>e.categoryFacetSet[t]?.request;var al=(e,t)=>{let r=Xx(e,t);return wg(r?.currentValues??[])};m();d();f();p();function Qs(){return{}}m();d();f();p();function Hs(){return{}}m();d();f();p();function zs(){return{}}m();d();f();p();function Ws(){return{}}function cl(e){return{facetSet:e.facetSet??Ws(),categoryFacetSet:e.categoryFacetSet??Qs(),dateFacetSet:e.dateFacetSet??Hs(),numericFacetSet:e.numericFacetSet??zs(),automaticFacetSet:e.automaticFacetSet??$s()}}var ul=e=>{let t=[];return eE(e).forEach((r,n)=>{let i=cE(e,r.facetId),o=sE(r,n+1);if(Zx(r)){if(!!!al(e,r.facetId).length)return;t.push({...o,...iE(e,r.facetId),facetType:i,state:"selected"});return}r.currentValues.forEach((s,a)=>{if(s.state==="idle")return;let c=bg(s,a+1,i),u=Jx(r)?Cg(s):rE(s);t.push({...o,...c,...u})})}),tE(e).forEach((r,n)=>{let i=oE(r,n+1);r.values.forEach((o,s)=>{if(o.state==="idle")return;let a=bg(o,s+1,"specific"),c=Cg(o);t.push({...i,...a,...c})})}),t},Jx=e=>e.type==="specific",Zx=e=>e.type==="hierarchical",eE=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),tE=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),bg=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),rE=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),Cg=e=>({displayValue:e.value,value:e.value}),nE=(e,t)=>al(e,t).map(n=>n.value).join(";"),iE=(e,t)=>{let n=nE(e,t);return{value:n,valuePosition:1,displayValue:n}},oE=(e,t)=>({title:xg(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),sE=(e,t)=>({title:xg(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),xg=(e,t)=>`${e}_${t}`,aE=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,cE=(e,t)=>{let r=aE(e,t);return r?r.type:"specific"};m();d();f();p();var $r=e=>{if(uE(e)||ll(e))return e.generatedAnswer?.answerId;if(lE(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},uE=e=>"answer"in e&&"generatedAnswer"in e&&!ie(e.generatedAnswer?.answerConfigurationId),ll=e=>{let t=lr(e);return"answerGenerationApi"in e&&"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},lE=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",dl=e=>e.generatedAnswer?.fieldsToIncludeInCitations,dE=Me(e=>e.generatedAnswer?.citations,(e,t)=>t,(e,t)=>e?.find(r=>r.id===t));m();d();f();p();var Rt=()=>({q:"",enableQuerySyntax:!1});m();d();f();p();function pl(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Mt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:pl(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:pl(),extendedResults:{},searchAction:void 0}}m();d();f();p();m();d();f();p();m();d();f();p();var Eg=(r=>(r.Ascending="ascending",r.Descending="descending",r))(Eg||{}),Ig=(o=>(o.Relevancy="relevancy",o.QRE="qre",o.Date="date",o.Field="field",o.NoSort="nosort",o))(Ig||{}),fl=e=>{if(Np(e))return e.map(t=>fl(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""}},Rg=()=>({by:"relevancy"});var iV=new xe({values:{by:new Xc({enum:Ig,required:!0}),order:new Xc({enum:Eg}),field:new J}});function Ks(){return fl(Rg())}m();d();f();p();m();d();f();p();m();d();f();p();var ei=class e{static set(t,r,n){let i,o,s;n&&(o=new Date,o.setTime(o.getTime()+n));let a=window.location.hostname,c=/^(\d{1,3}\.){3}\d{1,3}$/,u=/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/;c.test(a)||u.test(a)||a.indexOf(".")===-1?ml(t,r,o):(s=a.split("."),i=s[s.length-2]+"."+s[s.length-1],ml(t,r,o,i))}static get(t){let r=t+"=",n=document.cookie.split(";");for(let i=0;i<n.length;i++){let o=n[i];if(o=o.replace(/^\s+/,""),o.lastIndexOf(r,0)===0)return o.substring(r.length,o.length)}return null}static erase(t){e.set(t,"",-1)}};function ml(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}m();d();f();p();function pE(){return typeof navigator<"u"}function Tg(){try{return typeof localStorage<"u"}catch{return!1}}function _g(){try{return typeof sessionStorage<"u"}catch{return!1}}function kg(){return!!(pE()&&navigator.cookieEnabled)}var Og=null;function Pg(){return Og||(Tg()?localStorage:kg()?new gl:_g()?sessionStorage:new hl)}var ti=class ti{getItem(t){return ei.get(`${ti.prefix}${t}`)}removeItem(t){ei.erase(`${ti.prefix}${t}`)}setItem(t,r,n){ei.set(`${ti.prefix}${t}`,r,n)}};be(ti,"prefix","coveo_");var gl=ti;var hl=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var Ys="__coveo.analytics.history",fE=20,mE=1e3*60,gE=75,Qr=class Qr{constructor(t){be(this,"store");this.store=t||Pg()}static getInstance(t){return Qr.instance||(Qr.instance=new Qr(t)),Qr.instance}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(Ys);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this6=this;return _asyncToGenerator(function*(){try{let t=yield _this6.store.getItem(Ys);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(Ys,JSON.stringify(t.slice(0,fE)))}catch{}}clear(){try{this.store.removeItem(Ys)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,i)=>(i.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,gE)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value===t.value?(t.internalTime||0)-(r.internalTime||0)>mE:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:i,value:o}=r;return{name:n,time:i,value:o}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:i}=t;return r&&typeof i=="string"&&r.toLowerCase()==="query"&&i.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};be(Qr,"instance",null);var yl=Qr,jt=yl;var uo=class uo extends Br{constructor(){super(...arguments);be(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 ul(cl(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||uo.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||Mt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||uo.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),i=$r(r);return i&&(n.generativeQuestionAnsweringId=i),n}getFacetMetadata(r,n){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetValue:n,facetTitle:`${o}_${r}`}}getFacetClearAllMetadata(r){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetTitle:`${i}_${r}`}}getFacetUpdateSortMetadata(r,n){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,criteria:n,facetTitle:`${o}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${o}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??Ks()}}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 o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:o,categoryFacetPath:n,categoryFacetTitle:`${o}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let i=this.state.querySuggest?.[r],o=i.completions.map(u=>u.expression),s=i.partialQueries.length-1,a=i.partialQueries[s]||"",c=i.responseId;return{...this.getBaseMetadata(),suggestionRanking:o.indexOf(n),partialQuery:a,partialQueries:i.partialQueries.length>0?i.partialQueries:"",suggestions:o.length>0?o:"",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||Rt().q}get responseTime(){return this.state.search?.duration||Mt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Mt().response.totalCountFiltered}};be(uo,"fallbackPipelineName","default");var pr=uo,Ng=({logger:e,getState:t,analyticsClientMiddleware:r=(o,s)=>s,preprocessRequest:n,provider:i})=>{let o=t(),s=o.configuration.accessToken,a=o.configuration.analytics.apiBaseUrl??Te(o.configuration.organizationId,o.configuration.environment,"analytics"),c=o.configuration.analytics.runtimeEnvironment,u=o.configuration.analytics.enabled,h=new Ls({token:s,endpoint:a,runtimeEnvironment:c,preprocessRequest:so(e,n),beforeSendHooks:[ao(e,r),(v,S)=>(e.info({...S,type:v,endpoint:a,token:s},"Analytics request"),S)]},i);return u||h.disable(),h},vl=()=>{let t=jt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};m();d();f();p();function Fg(e){let t=Dg(e),r=[e,...t].filter(i=>i.parentResult).map(i=>i.parentResult);return bp([e,...t,...r],i=>i.uniqueId)}function Dg(e){return e.childResults?e.childResults.flatMap(t=>[t,...Dg(t)]):[]}m();d();f();p();var Xs=()=>"";function Mg(e,t){return{...new pr(t).getBaseMetadata(),actionCause:e,type:e}}function hE(e){return Object.assign(e,{instantlyCallable:!0})}function yE(e,t){let r=o=>hE(ve(e,o)),n=r(/*#__PURE__*/function(){var _ref18=_asyncToGenerator(function*(o,{getState:s,extra:a}){let{analyticsClientMiddleware:c,preprocessRequest:u,logger:h}=a;return yield(yield t({getState:s,analyticsClientMiddleware:c,preprocessRequest:u,logger:h})).log({state:s(),extra:a})});return function(_x43,_x44){return _ref18.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref19=_asyncToGenerator(function*({getState:o,analyticsClientMiddleware:s,preprocessRequest:a,logger:c}){let{description:u,log:h}=yield t({getState:o,analyticsClientMiddleware:s,preprocessRequest:a,logger:c});return{description:u,action:r(/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(v,{getState:S,extra:g}){return yield h({state:S(),extra:g})});return function(_x46,_x47){return _ref20.apply(this,arguments)}}())}});return function prepare(_x45){return _ref19.apply(this,arguments)}}()}),n}var jg=(e,t,r)=>{function n(...i){let o=i.length===1?{...i[0],__legacy__getBuilder:t(i[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:r}:{prefix:i[0],__legacy__getBuilder:t(i[1]),__legacy__provider:i[2],analyticsConfigurator:e,providerClass:r};return AE(o)}return n},vE=e=>e.configuration.analytics.analyticsMode==="legacy",SE=e=>e.configuration.analytics.analyticsMode==="next",AE=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:i,analyticsConfigurator:o,providerClass:s})=>(r??(r=a=>new s(a)),yE(e,/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*({getState:a,analyticsClientMiddleware:c,preprocessRequest:u,logger:h}){let v=[],S={log:function(){var _ref22=_asyncToGenerator(function*({state:x}){for(let R of v)yield R(x)});return function log(_x49){return _ref22.apply(this,arguments)}}()},g=a(),y=o({getState:a,logger:h,analyticsClientMiddleware:c,preprocessRequest:u,provider:r(a)}),C=yield t(y,a());S.description=C?.description,v.push(/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(x){vE(x)&&(yield wE(C,r,x,h,y.coveoAnalyticsClient))});return function(_x50){return _ref23.apply(this,arguments)}}());let{emit:E}=Zi(g);return v.push(/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(x){if(SE(x)&&i&&n){let R=n(x);yield _E(E,i,R)}});return function(_x51){return _ref24.apply(this,arguments)}}()),S});return function(_x48){return _ref21.apply(this,arguments)}}()));function wE(_x52,_x53,_x54,_x55,_x56){return _wE.apply(this,arguments)}function _wE(){_wE=_asyncToGenerator(function*(e,t,r,n,i){t(()=>r);let o=yield e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:i,response:o},"Analytics response")});return _wE.apply(this,arguments)}var bE=e=>r=>(n,i)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref25=_asyncToGenerator(function*(o){r(n,i)});return function log(_x57){return _ref25.apply(this,arguments)}}()}),et=jg(e=>Ng({...e,provider:e.provider||new pr(e.getState)}),e=>e,pr),pt=jg(Ag,bE("caseAssist"),co);var Sl=(e,t)=>{let r=o=>o+(t.pagination?.firstResult??0),n=-1,i=t.search?.results;return n=Ug(e,i),n<0&&(n=TE(e,i)),n<0&&(n=0),CE(e,r(n),t)};function CE(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:IE(e),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:RE(e),queryPipeline:r.pipeline||Xs()}}var Al=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||""}),qg={urihash:new J,sourcetype:new J,permanentid:new J},Lg={uniqueId:te,raw:new xe({values:qg}),title:te,uri:te,clickUri:te,rankingModifier:new J({required:!1,emptyAllowed:!0})};function xE(e){return Object.assign({},...Object.keys(qg).map(t=>({[t]:e[t]})))}function EE(e){return Object.assign({},...Object.keys(Lg).map(t=>({[t]:e[t]})),{raw:xE(e.raw)})}function IE(e){let t=e.raw.author;return ie(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function RE(e){let t=e.raw.source;return ie(t)?"unknown":t}var wl=e=>new xt(Lg).validate(EE(e));function TE(e,t){for(let[r,n]of t.entries()){let i=Fg(n);if(Ug(e,i)!==-1)return r}return-1}function Ug(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function _E(_x58,_x59,_x60){return _E2.apply(this,arguments)}function _E2(){_E2=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _E2.apply(this,arguments)}m();d();f();p();var ri=e=>et({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(t,r)=>{let n=$r(r),i=e?!r.generatedAnswer?.answer||!r.generatedAnswer?.answer.length:void 0;return n?t.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:n,answerGenerated:e,answerTextIsEmpty:i}):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:t=>({answerId:$r(t)??"",answerGenerated:e??!1})}),ni=()=>et({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:e=>({answerId:$r(e)??"",responseId:e.search?.searchResponseId||e.search?.response.searchUid||""})});var Vg=()=>({handleOpen:(e,t)=>{let r=e.headers.get("x-answer-id");r&&t(ii(r))},handleError:e=>{throw e},handleMessage:{"agentInteraction.answerHeader":(e,t)=>{e?.payload?.conversationId&&t(Rs(e.payload.conversationId)),e.payload.followUpEnabled&&t(Is(e.payload.followUpEnabled)),t(Kr("text/markdown")),t(fr(!0)),t(Tt(!1))},"generativeengines.messageType":(e,t)=>{e?.payload?.textDelta&&t(Hr({textDelta:e.payload.textDelta}))},"agentInteraction.citations":(e,t)=>{e?.payload?.citations!==void 0&&t(zr({citations:e.payload.citations}))},"generativeengines.endOfStreamType":(e,t)=>{let r=e?.payload?.answerGenerated??!1;t(po(r)),t(Yr(!r)),t(fr(!1)),t(Tt(!1)),t(ri(r)),t(ni())},error:(e,t)=>{e.finishReason==="ERROR"&&t(Wr(e))}}});var Es={"head-answer":Vg,"follow-up-answer":Xm};m();d();f();p();var Gg=e=>{let{configuration:t}=e,{organizationId:r,environment:n,knowledge:{agentId:i}}=t,o=Te(r,n),s=i?.trim();if(!o||!r||!s)throw new Error("Missing required parameters for answer endpoint");let a=`/api/preview/organizations/${r}/agents`;return`${o}${a}/${s}/answer`};var kE=zn.injectEndpoints({overrideExisting:!0,endpoints:e=>({generateAnswer:e.query({queryFn:()=>({data:ws()}),onQueryStarted(_x61,_x62){return _asyncToGenerator(function*(t,{getState:r,updateCachedData:n,dispatch:i}){let{strategyKey:o,...s}=t,a=Gg(r());yield xs(a,s,{getState:r,updateCachedData:n,dispatch:i},Es[o]?.())}).apply(this,arguments)}})})}),Bg=e=>kE.endpoints.generateAnswer.initiate(e);m();d();f();p();m();d();f();p();var $g=Me(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:i}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(i&&{lq:i})}});m();d();f();p();var Xr=(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:$n(e)}});m();d();f();p();var Qg=e=>e.context;m();d();f();p();var bl=e=>e.pipeline;m();d();f();p();m();d();f();p();var fo=Ct(Js(),1),Xg=Ct(Hg(),1);m();d();f();p();var Wg=Ct(Js(),1),Kg=Ct(zg(),1);Wg.default.extend(Kg.default);var OE="YYYY/MM/DD@HH:mm:ss";function Yg(e){return e.format(OE)}fo.default.extend(Xg.default);var PE=["past","now","next"],NE=["minute","hour","day","week","month","quarter","year"];function FE(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,fo.default)().subtract(r,n);case"next":return(0,fo.default)().add(r,n);case"now":return(0,fo.default)()}}function _l(e){return Yg(FE(DE(e)))}function Jg(e){return e.toLocaleLowerCase().split("-")}function kl(e){let[t,r,n]=Jg(e);if(t==="now")return!0;if(!PE.includes(t)||!NE.includes(n))return!1;let i=parseInt(r);return!(Number.isNaN(i)||i<=0)}function DE(e){let[t,r,n]=Jg(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r):void 0,unit:n||void 0}}m();d();f();p();function Zg(e){return e.type==="dateRange"}function eh(e){return`start${e}`}function th(e){return`end${e}`}var Ol=()=>({dateFacetValueMap:{}});function ME(e,t,r){let n=e.start,i=e.end;return kl(n)&&(n=_l(n),r.dateFacetValueMap[t][eh(n)]=e.start),kl(i)&&(i=_l(i),r.dateFacetValueMap[t][th(i)]=e.end),{...e,start:n,end:i}}function Pl(e,t){if(Zg(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(i=>ME(i,r,t))}}return e}function mr(e){let t=Ol();return{request:{...e,facets:e.facets?.map(n=>Pl(n,t))},mappings:t}}function jE(e,t,r){return{...e,start:r.dateFacetValueMap[t][eh(e.start)]||e.start,end:r.dateFacetValueMap[t][th(e.end)]||e.end}}function qE(e,t){return e.facetId in t.dateFacetValueMap}function LE(e,t){return qE(e,t)?{...e,values:e.values.map(r=>jE(r,e.facetId,t))}:e}function Zs(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>LE(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function gr(e){return Object.values(e).map(t=>t.request)}function Nl(e,t){let r={};e.forEach(o=>{r[o.facetId]=o});let n=[];t.forEach(o=>{o in r&&(n.push(r[o]),delete r[o])});let i=Object.values(r);return[...n,...i]}function rh(e){return gr(e).map(t=>{let n=t.currentValues.some(({state:i})=>i!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Fl={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function UE(e){return gr(e).map(t=>{let r=Fl[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function VE(e){return[...UE(e.facetSet??{}),...rh(e.numericFacetSet??{}),...rh(e.dateFacetSet??{}),...gr(e.categoryFacetSet??{})]}function GE(e){return VE(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function ea(e){return Nl(GE(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();m();d();f();p();var nh=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield Zn(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}),...(vl()&&{pageId:vl()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:$n(e)})}}});return function nh(_x63,_x64){return _ref26.apply(this,arguments)}}();var oi=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??_n(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:jt.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 nh(e.configuration.analytics,t))),...(e.excerptLength&&!ie(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function oi(_x65,_x66){return _ref27.apply(this,arguments)}}();m();d();f();p();var ta=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??_n(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&&Xr(e.configuration.analytics,t,r)),...(e.excerptLength&&!ie(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});m();d();f();p();var ih=Me(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(o=>o.state==="selected"&&!!o.expression.trim()),i=n.map(o=>o.expression).join(" OR ");return n.length>1?`(${i})`:i}));var hr=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t,r){let n=Ml(e),i=BE(e),o=$E(e),s=e.configuration.analytics.analyticsMode==="legacy"?yield oi(e,r):ta(e,t,r);return mr({...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}),...(i.length&&{facets:i}),...(e.pagination&&{numberOfResults:Dl(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:o}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function hr(_x67,_x68,_x69){return _ref28.apply(this,arguments)}}();function Dl(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function BE(e){return Nl(HE(e),e.facetOrder??[])}function $E(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(QE).filter(r=>r.currentValues.length>0):void 0}function QE(e){let{field:t,label:r,values:n}=e,i=n.filter(o=>o.state==="selected");return{field:t,label:r,currentValues:i}}function HE(e){return zE(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function zE(e){return[...WE(e.facetSet??{}),...oh(e.numericFacetSet??{}),...oh(e.dateFacetSet??{}),...gr(e.categoryFacetSet??{})]}function WE(e){return gr(e).map(t=>{let r=Fl[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function oh(e){return gr(e).map(t=>{let r=t.currentValues,n=r.some(({state:o})=>o!=="idle"),i=r.some(o=>o.previousState);return t.generateAutomaticRanges&&!n&&!i?{...t,currentValues:[]}:t})}function Ml(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(o=>o.isActive)?.expression.trim()||"",i=ih(e);return[t,n,...i].filter(o=>!!o).join(" AND ")}m();d();f();p();m();d();f();p();var go=(e,t)=>{let r=e;return ie(r[t])?ie(e.raw[t])?null:e.raw[t]:r[t]},KE=e=>t=>e.every(r=>!ie(go(t,r))),YE=e=>t=>e.every(r=>ie(go(t,r))),XE=(e,t)=>r=>{let n=sh(e,r);return t.some(i=>n.some(o=>`${o}`.toLowerCase()===i.toLowerCase()))},JE=(e,t)=>r=>{let n=sh(e,r);return t.every(i=>n.every(o=>`${o}`.toLowerCase()!==i.toLowerCase()))},sh=(e,t)=>{let r=go(t,e);return wp(r)?r:[r]},ah={getResultProperty:go,fieldsMustBeDefined:KE,fieldsMustNotBeDefined:YE,fieldMustMatch:XE,fieldMustNotMatch:JE};var jl=Me(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var ql=e=>e.searchHub;m();d();f();p();var Ll=Me(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),J$=Me(e=>e,e=>{let t=Ll(e);return t&&e?e[t].expression:""});m();d();f();p();var ch=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var uh=e=>e.excerptLength?.length;m();d();f();p();var lh=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var dh=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 ph=e=>e.sortCriteria;var fh=/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Te(e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function fh(_x70){return _ref29.apply(this,arguments)}}(),mh=(e,t)=>{let r=Vr(e)?.q,{aq:n,cq:i,dq:o,lq:s}=eI(e),a=Qg(e),c=Xr(e.configuration.analytics,t,{actionCause:jl(e)}),u=ql(e),h=bl(e),v=dl(e)??[],S=gh(e),g=Ll(e.tabSet)||"default",y=Bu(e),C=qm(e),E=t.referrer||"",x=lh(e),R=ph(e),T=ZE(e),_=uh(e),M=dh(e),P=ch(e);return{q:r,...(n&&{aq:n}),...(i&&{cq:i}),...(o&&{dq:o}),...(s&&{lq:s}),...(e.query&&{enableQuerySyntax:Cm(e)}),...(a?.contextValues&&{context:a.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(u?.length&&{searchHub:u}),...(h?.length&&{pipeline:h}),...(S.length&&{facets:S}),...(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:Dl(e),firstResult:e.pagination.firstResult}),tab:g,locale:y,timezone:C,...(e.debug!==void 0&&{debug:e.debug}),referrer:E,...T,...(M??{}),...(_&&{excerptLength:_}),...(P&&{dictionaryFieldContext:P}),sortCriteria:R,...(x&&{facetOptions:x}),...c,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},ra=(e,t)=>{let r=Vr(e)?.q,n=gh(e),i=Xr(e.configuration.analytics,t,{actionCause:jl(e)}),o=Bu(e),s=ql(e),a=bl(e),c=dl(e)??[];return{q:r||"",...(n.length&&{facets:n}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:c}},...(s?.length&&{searchHub:s}),...(a?.length&&{pipeline:a}),...i,locale:o}},gh=e=>ea(e)?.map(t=>Pl(t,Ol())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),ZE=e=>({actionsHistory:e.configuration.analytics.enabled?jt.getInstance().getHistory():[]}),eI=e=>{let t=$g(e),r=Ml(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var hh=["text/plain","text/markdown"];var si=new J({required:!0}),yh=new J,ai=new De({required:!0}),$u={id:si,title:si,uri:si,permanentid:si,clickUri:yh},Ts=new J({required:!0,constrainTo:hh}),gH=q("generatedAnswer/setIsVisible",e=>z(e,ai)),ii=q("generatedAnswer/setAnswerId",e=>z(e,te)),hH=q("generatedAnswer/setAnswerGenerationMode",e=>z(e,new J({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),yH=q("generatedAnswer/setIsEnabled",e=>z(e,ai)),Hr=q("generatedAnswer/updateMessage",e=>z(e,{textDelta:si})),zr=q("generatedAnswer/updateCitations",e=>z(e,{citations:new Et({required:!0,each:new xe({values:$u})})})),Wr=q("generatedAnswer/updateError",e=>z(e,{message:yh,code:new Le({min:0})})),ho=q("generatedAnswer/resetAnswer"),vH=q("generatedAnswer/like"),SH=q("generatedAnswer/dislike"),AH=q("generatedAnswer/feedbackModal/open"),wH=q("generatedAnswer/expand"),bH=q("generatedAnswer/collapse"),CH=q("generatedAnswer/setId",e=>z(e,{id:new J({required:!0})})),xH=q("generatedAnswer/feedbackModal/close"),EH=q("generatedAnswer/sendFeedback"),Tt=q("generatedAnswer/setIsLoading",e=>z(e,ai)),fr=q("generatedAnswer/setIsStreaming",e=>z(e,ai)),Kr=q("generatedAnswer/setAnswerContentFormat",e=>z(e,Ts)),IH=q("generatedAnswer/updateResponseFormat",e=>z(e,{contentFormat:new Et({each:Ts,default:["text/plain"]})})),RH=q("knowledge/updateAnswerConfigurationId",e=>z(e,si)),TH=q("generatedAnswer/registerFieldsToIncludeInCitations",e=>z(e,Tf)),po=q("generatedAnswer/setIsAnswerGenerated",e=>z(e,ai)),Yr=q("generatedAnswer/setCannotAnswer",e=>z(e,ai)),vh=q("generatedAnswer/setAnswerApiQueryParams",e=>z(e,new xe({}))),Sh=q("generatedAnswer/startStep",e=>z(e,{name:new J({required:!0,constrainTo:Wn}),startedAt:new Le({min:0,required:!0})})),Ah=q("generatedAnswer/finishStep",e=>z(e,{name:new J({required:!0,constrainTo:Wn}),finishedAt:new Le({min:0,required:!0})})),_H=ve("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:i,getState:o}=t,{search:s}=o(),{queryExecuted:a}=s,{setAbortControllerRef:c}=e,u=yield fh(r),h=(g,y)=>{switch(g){case"genqa.headerMessageType":{let C=JSON.parse(y);n(Kr(C.contentFormat));break}case"genqa.messageType":n(Hr(JSON.parse(y)));break;case"genqa.citationsType":n(zr(JSON.parse(y)));break;case"genqa.endOfStreamType":{let C=JSON.parse(y).answerGenerated,E=a.length!==0&&!C;n(Yr(E)),n(fr(!1)),n(po(C)),n(ri(C)),n(ni());break}default:r.debug&&i.logger.warn(`Unknown payloadType: "${g}"`)}};n(Tt(!0));let v=g=>g.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,S=i.streamingClient?.streamGeneratedAnswer(u,{write:g=>{v(u)&&(n(Tt(!1)),g.payload&&g.payloadType&&h(g.payloadType,g.payload))},abort:g=>{v(u)&&n(Wr(g))},close:()=>{v(u)&&n(fr(!1))},resetAnswer:()=>{v(u)&&n(ho())}});S?c(S):n(Tt(!1))});return function(_x71,_x72){return _ref30.apply(this,arguments)}}()),kH=ve("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:i}}){r(ho());let o=t();if(o.generatedAnswer.answerConfigurationId){let s=mh(o,n);r(vh(s)),yield r(wh(s))}else i.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.")});return function(_x73,_x74){return _ref31.apply(this,arguments)}}()),OH=ve("generatedAnswerWithFollowUps/generateHeadAnswer",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:i}}){let o=t();if(!lr(o)){i.warn("Missing agentId in engine configuration. The generateHeadAnswer action requires an agent ID.");return}r(ho());let a=ra(o,n),c={...a,strategyKey:"head-answer"};r(vh(a)),yield r(Bg(c))});return function(_x75,_x76){return _ref32.apply(this,arguments)}}());var tI=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},rI=(e,t)=>{e.answer===void 0?e.answer=t.textDelta:typeof t.textDelta=="string"&&(e.answer=e.answer.concat(t.textDelta))},nI=(e,t)=>{e.citations=t.citations},iI=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},oI=(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})`)},sI=(e,t,r)=>{let n=JSON.parse(e.data);n.finishReason==="ERROR"&&n.errorMessage&&oI(t,n);let i=n.payload.length?JSON.parse(n.payload):{};switch(n.payloadType){case"genqa.headerMessageType":i.contentFormat&&(tI(t,i),r(Kr(i.contentFormat)));break;case"genqa.messageType":i.textDelta&&(rI(t,i),r(Hr({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(nI(t,i),r(zr({citations:i.citations})));break;case"genqa.endOfStreamType":iI(t,i),r(ri(i.answerGenerated??!1)),r(ni());break}},aI=(e,t,r,n)=>{if(!e||!t||!r)throw new Error("Missing required parameters for answer endpoint");let i=`/rest/organizations/${t}`,o=n?`insight/v1/configs/${n}/answer`:"answer/v1/configs";return`${e}${i}/${o}/${r}/generate`},Ul=bm.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,...i}=r;return`${t}(${JSON.stringify(i)})`},onCacheEntryAdded(_x77,_x78){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:i,dispatch:o}){yield n;let{configuration:s,generatedAnswer:a,insightConfiguration:c}=r(),{organizationId:u,environment:h,accessToken:v}=s,S=Te(u,h),g=aI(S,u,a.answerConfigurationId,c?.insightId);yield bs(g,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${v}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:w,onopen:function(){var _ref33=_asyncToGenerator(function*(y){let C=y.headers.get("x-answer-id");C&&i(E=>{E.answerId=C,o(ii(C))})});return function onopen(_x79){return _ref33.apply(this,arguments)}}(),onmessage:y=>{i(C=>{sI(y,C,o)})},onerror:y=>{throw y},onclose:()=>{i(y=>{o(Yr(!y.generated))})}})}).apply(this,arguments)}})})}),wh=e=>Ul.endpoints.getAnswer.initiate(e);m();d();f();p();var bh=Ve(Vn,e=>e);m();d();f();p();function cI(e){let t=e.payload?.analyticsAction;return Ch(e)&&!ie(t)}function Ch(e){return"type"in e}var xh=e=>t=>r=>{let n;cI(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let i=t(r);return Ch(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),i};m();d();f();p();m();d();f();p();m();d();f();p();var l3=q("tab/register",e=>{let t=new xe({values:{id:te,expression:It}});return z(e,t)}),Eh=q("tab/updateActiveTab",e=>z(e,te));m();d();f();p();var na=Ct(Js(),1),Th=Ct(Ih(),1),_h=Ct(Rh(),1);na.default.extend(_h.default);na.default.extend(Th.default);var kh=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:na.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 uI=/(^|; )Coveo-Pendragon=([^;]*)/;function Ql(){return typeof window>"u"?!1:uI.exec(document.cookie)?.pop()||null}var Oh=Ve(kh(),e=>e.addCase(Gn,(t,r)=>{lI(t,r.payload)}).addCase(ds,(t,r)=>{dI(t,r.payload)}).addCase(ps,(t,r)=>{pI(t,r.payload)}).addCase(fs,t=>{t.analytics.enabled=!1}).addCase(ms,t=>{t.analytics.enabled=!0}).addCase(Lf,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(Uf,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(Eh,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Nf,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(cs,(t,r)=>{ie(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Vf,(t,{payload:r})=>{t.knowledge.agentId=r}));function lI(e,t){ie(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ie(t.organizationId)||(e.organizationId=t.organizationId)}function dI(e,t){ie(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),ie(t.locale)||(e.search.locale=t.locale),ie(t.timezone)||(e.search.timezone=t.timezone),ie(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function pI(e,t){ie(t.enabled)||(e.analytics.enabled=t.enabled),ie(t.originContext)||(e.analytics.originContext=t.originContext),ie(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),ie(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),ie(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),ie(t.trackingId)||(e.analytics.trackingId=t.trackingId),ie(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),ie(t.source)||(e.analytics.source=t.source);try{let r=Ql();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}ie(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),ie(t.anonymous)||(e.analytics.anonymous=t.anonymous),ie(t.deviceId)||(e.analytics.deviceId=t.deviceId),ie(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),ie(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}var ft=Oh;m();d();f();p();function fI(e){return e.instantlyCallable}var Ph=()=>e=>t=>e(fI(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 Ye=[];for(let e=0;e<256;++e)Ye.push((e+256).toString(16).slice(1));function Nh(e,t=0){return(Ye[e[t+0]]+Ye[e[t+1]]+Ye[e[t+2]]+Ye[e[t+3]]+"-"+Ye[e[t+4]]+Ye[e[t+5]]+"-"+Ye[e[t+6]]+Ye[e[t+7]]+"-"+Ye[e[t+8]]+Ye[e[t+9]]+"-"+Ye[e[t+10]]+Ye[e[t+11]]+Ye[e[t+12]]+Ye[e[t+13]]+Ye[e[t+14]]+Ye[e[t+15]]).toLowerCase()}m();d();f();p();var Hl,mI=new Uint8Array(16);function zl(){if(!Hl){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Hl=crypto.getRandomValues.bind(crypto)}return Hl(mI)}m();d();f();p();m();d();f();p();var gI=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Wl={randomUUID:gI};function hI(e,t,r){if(Wl.randomUUID&&!t&&!e)return Wl.randomUUID();e=e||{};let n=e.random??e.rng?.()??zl();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 i=0;i<16;++i)t[r+i]=n[i];return t}return Nh(n)}var yr=hI;m();d();f();p();m();d();f();p();var I={};Po(I,{BRAND:()=>GI,DIRTY:()=>Jr,EMPTY_PATH:()=>AI,INVALID:()=>oe,NEVER:()=>IR,OK:()=>tt,ParseStatus:()=>Xe,Schema:()=>fe,ZodAny:()=>Ar,ZodArray:()=>nr,ZodBigInt:()=>en,ZodBoolean:()=>tn,ZodBranded:()=>vo,ZodCatch:()=>fn,ZodDate:()=>rn,ZodDefault:()=>pn,ZodDiscriminatedUnion:()=>sa,ZodEffects:()=>At,ZodEnum:()=>ln,ZodError:()=>st,ZodFirstPartyTypeKind:()=>se,ZodFunction:()=>ca,ZodIntersection:()=>an,ZodIssueCode:()=>H,ZodLazy:()=>cn,ZodLiteral:()=>un,ZodMap:()=>fi,ZodNaN:()=>gi,ZodNativeEnum:()=>dn,ZodNever:()=>_t,ZodNull:()=>on,ZodNullable:()=>Ut,ZodNumber:()=>Zr,ZodObject:()=>at,ZodOptional:()=>vt,ZodParsedType:()=>X,ZodPipeline:()=>So,ZodPromise:()=>wr,ZodReadonly:()=>mn,ZodRecord:()=>aa,ZodSchema:()=>fe,ZodSet:()=>mi,ZodString:()=>Sr,ZodSymbol:()=>di,ZodTransformer:()=>At,ZodTuple:()=>Lt,ZodType:()=>fe,ZodUndefined:()=>nn,ZodUnion:()=>sn,ZodUnknown:()=>rr,ZodVoid:()=>pi,addIssueToContext:()=>Y,any:()=>XI,array:()=>tR,bigint:()=>HI,boolean:()=>$h,coerce:()=>ER,custom:()=>Vh,date:()=>zI,datetimeRegex:()=>Lh,defaultErrorMap:()=>er,discriminatedUnion:()=>oR,effect:()=>yR,enum:()=>mR,function:()=>dR,getErrorMap:()=>ci,getParsedType:()=>qt,instanceof:()=>$I,intersection:()=>sR,isAborted:()=>ia,isAsync:()=>ui,isDirty:()=>oa,isValid:()=>vr,late:()=>BI,lazy:()=>pR,literal:()=>fR,makeIssue:()=>yo,map:()=>uR,nan:()=>QI,nativeEnum:()=>gR,never:()=>ZI,null:()=>YI,nullable:()=>SR,number:()=>Bh,object:()=>rR,objectUtil:()=>Kl,oboolean:()=>xR,onumber:()=>CR,optional:()=>vR,ostring:()=>bR,pipeline:()=>wR,preprocess:()=>AR,promise:()=>hR,quotelessJson:()=>yI,record:()=>cR,set:()=>lR,setErrorMap:()=>SI,strictObject:()=>nR,string:()=>Gh,symbol:()=>WI,transformer:()=>yR,tuple:()=>aR,undefined:()=>KI,union:()=>iR,unknown:()=>JI,util:()=>ye,void:()=>eR});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var ye;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},e.getValidEnumValues=i=>{let o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},e.find=(i,o)=>{for(let s of i)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(ye||(ye={}));var Kl;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Kl||(Kl={}));var X=ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),qt=e=>{switch(typeof e){case"undefined":return X.undefined;case"string":return X.string;case"number":return Number.isNaN(e)?X.nan:X.number;case"boolean":return X.boolean;case"function":return X.function;case"bigint":return X.bigint;case"symbol":return X.symbol;case"object":return Array.isArray(e)?X.array:e===null?X.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?X.promise:typeof Map<"u"&&e instanceof Map?X.map:typeof Set<"u"&&e instanceof Set?X.set:typeof Date<"u"&&e instanceof Date?X.date:X.object;default:return X.unknown}};var H=ye.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"]),yI=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),st=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(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(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 i(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,ye.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};st.create=e=>new st(e);var vI=(e,t)=>{let r;switch(e.code){case H.invalid_type:e.received===X.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case H.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ye.jsonStringifyReplacer)}`;break;case H.unrecognized_keys:r=`Unrecognized key(s) in object: ${ye.joinValues(e.keys,", ")}`;break;case H.invalid_union:r="Invalid input";break;case H.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ye.joinValues(e.options)}`;break;case H.invalid_enum_value:r=`Invalid enum value. Expected ${ye.joinValues(e.options)}, received '${e.received}'`;break;case H.invalid_arguments:r="Invalid function arguments";break;case H.invalid_return_type:r="Invalid function return type";break;case H.invalid_date:r="Invalid date";break;case H.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}"`:ye.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case H.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 H.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 H.custom:r="Invalid input";break;case H.invalid_intersection_types:r="Intersection results could not be merged";break;case H.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case H.not_finite:r="Number must be finite";break;default:r=t.defaultError,ye.assertNever(e)}return{message:r}},er=vI;var Fh=er;function SI(e){Fh=e}function ci(){return Fh}m();d();f();p();var yo=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...(i.path||[])],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...i,path:o,message:a}},AI=[];function Y(e,t){let r=ci(),n=yo({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===er?void 0:er].filter(i=>!!i)});e.common.issues.push(n)}var Xe=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 i of r){if(i.status==="aborted")return oe;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let i of r){let o=yield i.key,s=yield i.value;n.push({key:o,value:s})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return oe;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:t.value,value:n}}},oe=Object.freeze({status:"aborted"}),Jr=e=>({status:"dirty",value:e}),tt=e=>({status:"valid",value:e}),ia=e=>e.status==="aborted",oa=e=>e.status==="dirty",vr=e=>e.status==="valid",ui=e=>typeof Promise<"u"&&e instanceof Promise;m();d();f();p();m();d();f();p();var Z;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Z||(Z={}));var St=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}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}},Dh=(e,t)=>{if(vr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new st(e.common.issues);return this._error=r,this._error}}};function de(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=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:i}:{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:i}}var fe=class{get description(){return this._def.description}_getType(t){return qt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:qt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Xe,ctx:{common:t.parent.common,data:t.data,parsedType:qt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(ui(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:qt(t)},i=this._parseSync({data:t,path:n.path,parent:n});return Dh(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:qt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return vr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>vr(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _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:qt(t)},i=_this8._parse({data:t,path:n.path,parent:n}),o=yield ui(i)?i:Promise.resolve(i);return Dh(n,o)})()}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=t(i),a=()=>o.addIssue({code:H.custom,...n(i)});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,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new At({schema:this,typeName:se.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 vt.create(this,this._def)}nullable(){return Ut.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return nr.create(this)}promise(){return wr.create(this,this._def)}or(t){return sn.create([this,t],this._def)}and(t){return an.create(this,t,this._def)}transform(t){return new At({...de(this._def),schema:this,typeName:se.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new pn({...de(this._def),innerType:this,defaultValue:r,typeName:se.ZodDefault})}brand(){return new vo({typeName:se.ZodBranded,type:this,...de(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new fn({...de(this._def),innerType:this,catchValue:r,typeName:se.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return So.create(this,t)}readonly(){return mn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},wI=/^c[^\s-]{8,}$/i,bI=/^[0-9a-z]+$/,CI=/^[0-9A-HJKMNP-TV-Z]{26}$/i,xI=/^[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,EI=/^[a-z0-9_-]{21}$/i,II=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,RI=/^[-+]?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)?)??$/,TI=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_I="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Yl,kI=/^(?:(?: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])$/,OI=/^(?:(?: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])$/,PI=/^(([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]))$/,NI=/^(([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])$/,FI=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,DI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,jh="((\\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])))",MI=new RegExp(`^${jh}$`);function qh(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 jI(e){return new RegExp(`^${qh(e)}$`)}function Lh(e){let t=`${jh}T${qh(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 qI(e,t){return!!((t==="v4"||!t)&&kI.test(e)||(t==="v6"||!t)&&PI.test(e))}function LI(e,t){if(!II.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,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function UI(e,t){return!!((t==="v4"||!t)&&OI.test(e)||(t==="v6"||!t)&&NI.test(e))}var Sr=class e extends fe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==X.string){let o=this._getOrReturnCtx(t);return Y(o,{code:H.invalid_type,expected:X.string,received:o.parsedType}),oe}let n=new Xe,i;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),Y(i,{code:H.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),Y(i,{code:H.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=t.data.length>o.value,a=t.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(t,i),s?Y(i,{code:H.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&Y(i,{code:H.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")TI.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"email",code:H.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")Yl||(Yl=new RegExp(_I,"u")),Yl.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"emoji",code:H.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")xI.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"uuid",code:H.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")EI.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"nanoid",code:H.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")wI.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"cuid",code:H.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")bI.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"cuid2",code:H.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")CI.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"ulid",code:H.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Y(i,{validation:"url",code:H.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"regex",code:H.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),Y(i,{code:H.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),Y(i,{code:H.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),Y(i,{code:H.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?Lh(o).test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{code:H.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?MI.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{code:H.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?jI(o).test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{code:H.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?RI.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"duration",code:H.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?qI(t.data,o.version)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"ip",code:H.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?LI(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"jwt",code:H.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?UI(t.data,o.version)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"cidr",code:H.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?FI.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"base64",code:H.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?DI.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"base64url",code:H.invalid_string,message:o.message}),n.dirty()):ye.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:H.invalid_string,...Z.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Z.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Z.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Z.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Z.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Z.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Z.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Z.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Z.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Z.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Z.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Z.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Z.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Z.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,...Z.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,...Z.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Z.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Z.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...Z.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Z.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Z.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Z.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Z.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Z.errToObj(r)})}nonempty(t){return this.min(1,Z.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}};Sr.create=e=>new Sr({checks:[],typeName:se.ZodString,coerce:e?.coerce??!1,...de(e)});function VI(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return o%s/10**i}var Zr=class e extends fe{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)!==X.number){let o=this._getOrReturnCtx(t);return Y(o,{code:H.invalid_type,expected:X.number,received:o.parsedType}),oe}let n,i=new Xe;for(let o of this._def.checks)o.kind==="int"?ye.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),Y(n,{code:H.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),Y(n,{code:H.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),Y(n,{code:H.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?VI(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),Y(n,{code:H.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),Y(n,{code:H.not_finite,message:o.message}),i.dirty()):ye.assertNever(o);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Z.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Z.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Z.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Z.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Z.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Z.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Z.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Z.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Z.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Z.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Z.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Z.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Z.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Z.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"&&ye.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)}};Zr.create=e=>new Zr({checks:[],typeName:se.ZodNumber,coerce:e?.coerce||!1,...de(e)});var en=class e extends fe{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)!==X.bigint)return this._getInvalidInput(t);let n,i=new Xe;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),Y(n,{code:H.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),Y(n,{code:H.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),Y(n,{code:H.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):ye.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Y(r,{code:H.invalid_type,expected:X.bigint,received:r.parsedType}),oe}gte(t,r){return this.setLimit("min",t,!0,Z.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Z.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Z.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Z.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Z.toString(i)}]})}_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:Z.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Z.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Z.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Z.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Z.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}};en.create=e=>new en({checks:[],typeName:se.ZodBigInt,coerce:e?.coerce??!1,...de(e)});var tn=class extends fe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==X.boolean){let n=this._getOrReturnCtx(t);return Y(n,{code:H.invalid_type,expected:X.boolean,received:n.parsedType}),oe}return tt(t.data)}};tn.create=e=>new tn({typeName:se.ZodBoolean,coerce:e?.coerce||!1,...de(e)});var rn=class e extends fe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==X.date){let o=this._getOrReturnCtx(t);return Y(o,{code:H.invalid_type,expected:X.date,received:o.parsedType}),oe}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return Y(o,{code:H.invalid_date}),oe}let n=new Xe,i;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),Y(i,{code:H.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),Y(i,{code:H.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ye.assertNever(o);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:Z.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Z.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}};rn.create=e=>new rn({checks:[],coerce:e?.coerce||!1,typeName:se.ZodDate,...de(e)});var di=class extends fe{_parse(t){if(this._getType(t)!==X.symbol){let n=this._getOrReturnCtx(t);return Y(n,{code:H.invalid_type,expected:X.symbol,received:n.parsedType}),oe}return tt(t.data)}};di.create=e=>new di({typeName:se.ZodSymbol,...de(e)});var nn=class extends fe{_parse(t){if(this._getType(t)!==X.undefined){let n=this._getOrReturnCtx(t);return Y(n,{code:H.invalid_type,expected:X.undefined,received:n.parsedType}),oe}return tt(t.data)}};nn.create=e=>new nn({typeName:se.ZodUndefined,...de(e)});var on=class extends fe{_parse(t){if(this._getType(t)!==X.null){let n=this._getOrReturnCtx(t);return Y(n,{code:H.invalid_type,expected:X.null,received:n.parsedType}),oe}return tt(t.data)}};on.create=e=>new on({typeName:se.ZodNull,...de(e)});var Ar=class extends fe{constructor(){super(...arguments),this._any=!0}_parse(t){return tt(t.data)}};Ar.create=e=>new Ar({typeName:se.ZodAny,...de(e)});var rr=class extends fe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return tt(t.data)}};rr.create=e=>new rr({typeName:se.ZodUnknown,...de(e)});var _t=class extends fe{_parse(t){let r=this._getOrReturnCtx(t);return Y(r,{code:H.invalid_type,expected:X.never,received:r.parsedType}),oe}};_t.create=e=>new _t({typeName:se.ZodNever,...de(e)});var pi=class extends fe{_parse(t){if(this._getType(t)!==X.undefined){let n=this._getOrReturnCtx(t);return Y(n,{code:H.invalid_type,expected:X.void,received:n.parsedType}),oe}return tt(t.data)}};pi.create=e=>new pi({typeName:se.ZodVoid,...de(e)});var nr=class e extends fe{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==X.array)return Y(r,{code:H.invalid_type,expected:X.array,received:r.parsedType}),oe;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(Y(r,{code:s?H.too_big:H.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Y(r,{code:H.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Y(r,{code:H.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new St(r,s,r.path,a)))).then(s=>Xe.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new St(r,s,r.path,a)));return Xe.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:Z.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:Z.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:Z.toString(r)}})}nonempty(t){return this.min(1,t)}};nr.create=(e,t)=>new nr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:se.ZodArray,...de(t)});function li(e){if(e instanceof at){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=vt.create(li(n))}return new at({...e._def,shape:()=>t})}else return e instanceof nr?new nr({...e._def,type:li(e.element)}):e instanceof vt?vt.create(li(e.unwrap())):e instanceof Ut?Ut.create(li(e.unwrap())):e instanceof Lt?Lt.create(e.items.map(t=>li(t))):e}var at=class e extends fe{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=ye.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==X.object){let u=this._getOrReturnCtx(t);return Y(u,{code:H.invalid_type,expected:X.object,received:u.parsedType}),oe}let{status:n,ctx:i}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof _t&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let h=o[u],v=i.data[u];c.push({key:{status:"valid",value:u},value:h._parse(new St(i,v,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof _t){let u=this._def.unknownKeys;if(u==="passthrough")for(let h of a)c.push({key:{status:"valid",value:h},value:{status:"valid",value:i.data[h]}});else if(u==="strict")a.length>0&&(Y(i,{code:H.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 h of a){let v=i.data[h];c.push({key:{status:"valid",value:h},value:u._parse(new St(i,v,i.path,h)),alwaysSet:h in i.data})}}return i.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let u=[];for(let h of c){let v=yield h.key,S=yield h.value;u.push({key:v,value:S,alwaysSet:h.alwaysSet})}return u})).then(u=>Xe.mergeObjectSync(n,u)):Xe.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return Z.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Z.errToObj(t).message??i}:{message:i}}}:{})})}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:se.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 ye.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 ye.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return li(this)}partial(t){let r={};for(let n of ye.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of ye.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof vt;)o=o._def.innerType;r[n]=o}return new e({...this._def,shape:()=>r})}keyof(){return Uh(ye.objectKeys(this.shape))}};at.create=(e,t)=>new at({shape:()=>e,unknownKeys:"strip",catchall:_t.create(),typeName:se.ZodObject,...de(t)});at.strictCreate=(e,t)=>new at({shape:()=>e,unknownKeys:"strict",catchall:_t.create(),typeName:se.ZodObject,...de(t)});at.lazycreate=(e,t)=>new at({shape:e,unknownKeys:"strip",catchall:_t.create(),typeName:se.ZodObject,...de(t)});var sn=class extends fe{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new st(a.ctx.common.issues));return Y(r,{code:H.invalid_union,unionErrors:s}),oe}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(o){let s={...r,common:{...r.common,issues:[]},parent:null};return{result:yield o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}});return function(_x80){return _ref35.apply(this,arguments)}}())).then(i);{let o,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},h=c._parseSync({data:r.data,path:r.path,parent:u});if(h.status==="valid")return h;h.status==="dirty"&&!o&&(o={result:h,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new st(c));return Y(r,{code:H.invalid_union,unionErrors:a}),oe}}get options(){return this._def.options}};sn.create=(e,t)=>new sn({options:e,typeName:se.ZodUnion,...de(t)});var tr=e=>e instanceof cn?tr(e.schema):e instanceof At?tr(e.innerType()):e instanceof un?[e.value]:e instanceof ln?e.options:e instanceof dn?ye.objectValues(e.enum):e instanceof pn?tr(e._def.innerType):e instanceof nn?[void 0]:e instanceof on?[null]:e instanceof vt?[void 0,...tr(e.unwrap())]:e instanceof Ut?[null,...tr(e.unwrap())]:e instanceof vo||e instanceof mn?tr(e.unwrap()):e instanceof fn?tr(e._def.innerType):[],sa=class e extends fe{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==X.object)return Y(r,{code:H.invalid_type,expected:X.object,received:r.parsedType}),oe;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(Y(r,{code:H.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),oe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let o of r){let s=tr(o.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(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,o)}}return new e({typeName:se.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...de(n)})}};function Xl(e,t){let r=qt(e),n=qt(t);if(e===t)return{valid:!0,data:e};if(r===X.object&&n===X.object){let i=ye.objectKeys(t),o=ye.objectKeys(e).filter(a=>i.indexOf(a)!==-1),s={...e,...t};for(let a of o){let c=Xl(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===X.array&&n===X.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],c=Xl(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===X.date&&n===X.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var an=class extends fe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(o,s)=>{if(ia(o)||ia(s))return oe;let a=Xl(o.value,s.value);return a.valid?((oa(o)||oa(s))&&r.dirty(),{status:r.value,value:a.data}):(Y(n,{code:H.invalid_intersection_types}),oe)};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(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};an.create=(e,t,r)=>new an({left:e,right:t,typeName:se.ZodIntersection,...de(r)});var Lt=class e extends fe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==X.array)return Y(n,{code:H.invalid_type,expected:X.array,received:n.parsedType}),oe;if(n.data.length<this._def.items.length)return Y(n,{code:H.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),oe;!this._def.rest&&n.data.length>this._def.items.length&&(Y(n,{code:H.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new St(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>Xe.mergeArray(r,s)):Xe.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Lt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Lt({items:e,typeName:se.ZodTuple,rest:null,...de(t)})};var aa=class e extends fe{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!==X.object)return Y(n,{code:H.invalid_type,expected:X.object,received:n.parsedType}),oe;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new St(n,a,n.path,a)),value:s._parse(new St(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Xe.mergeObjectAsync(r,i):Xe.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof fe?new e({keyType:t,valueType:r,typeName:se.ZodRecord,...de(n)}):new e({keyType:Sr.create(),valueType:t,typeName:se.ZodRecord,...de(r)})}},fi=class extends fe{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!==X.map)return Y(n,{code:H.invalid_type,expected:X.map,received:n.parsedType}),oe;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new St(n,a,n.path,[u,"key"])),value:o._parse(new St(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,h=yield c.value;if(u.status==="aborted"||h.status==="aborted")return oe;(u.status==="dirty"||h.status==="dirty")&&r.dirty(),a.set(u.value,h.value)}return{status:r.value,value:a}}))}else{let a=new Map;for(let c of s){let u=c.key,h=c.value;if(u.status==="aborted"||h.status==="aborted")return oe;(u.status==="dirty"||h.status==="dirty")&&r.dirty(),a.set(u.value,h.value)}return{status:r.value,value:a}}}};fi.create=(e,t,r)=>new fi({valueType:t,keyType:e,typeName:se.ZodMap,...de(r)});var mi=class e extends fe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==X.set)return Y(n,{code:H.invalid_type,expected:X.set,received:n.parsedType}),oe;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Y(n,{code:H.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Y(n,{code:H.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let h of c){if(h.status==="aborted")return oe;h.status==="dirty"&&r.dirty(),u.add(h.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new St(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:Z.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:Z.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};mi.create=(e,t)=>new mi({valueType:e,minSize:null,maxSize:null,typeName:se.ZodSet,...de(t)});var ca=class e extends fe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==X.function)return Y(r,{code:H.invalid_type,expected:X.function,received:r.parsedType}),oe;function n(a,c){return yo({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ci(),er].filter(u=>!!u),issueData:{code:H.invalid_arguments,argumentsError:c}})}function i(a,c){return yo({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ci(),er].filter(u=>!!u),issueData:{code:H.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof wr){let a=this;return tt(/*#__PURE__*/_asyncToGenerator(function*(...c){let u=new st([]),h=yield a._def.args.parseAsync(c,o).catch(g=>{throw u.addIssue(n(c,g)),u}),v=yield Reflect.apply(s,this,h);return yield a._def.returns._def.type.parseAsync(v,o).catch(g=>{throw u.addIssue(i(v,g)),u})}))}else{let a=this;return tt(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new st([n(c,u.error)]);let h=Reflect.apply(s,this,u.data),v=a._def.returns.safeParse(h,o);if(!v.success)throw new st([i(h,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Lt.create(t).rest(rr.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||Lt.create([]).rest(rr.create()),returns:r||rr.create(),typeName:se.ZodFunction,...de(n)})}},cn=class extends fe{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})}};cn.create=(e,t)=>new cn({getter:e,typeName:se.ZodLazy,...de(t)});var un=class extends fe{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Y(r,{received:r.data,code:H.invalid_literal,expected:this._def.value}),oe}return{status:"valid",value:t.data}}get value(){return this._def.value}};un.create=(e,t)=>new un({value:e,typeName:se.ZodLiteral,...de(t)});function Uh(e,t){return new ln({values:e,typeName:se.ZodEnum,...de(t)})}var ln=class e extends fe{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return Y(r,{expected:ye.joinValues(n),received:r.parsedType,code:H.invalid_type}),oe}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 Y(r,{received:r.data,code:H.invalid_enum_value,options:n}),oe}return tt(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})}};ln.create=Uh;var dn=class extends fe{_parse(t){let r=ye.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==X.string&&n.parsedType!==X.number){let i=ye.objectValues(r);return Y(n,{expected:ye.joinValues(i),received:n.parsedType,code:H.invalid_type}),oe}if(this._cache||(this._cache=new Set(ye.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=ye.objectValues(r);return Y(n,{received:n.data,code:H.invalid_enum_value,options:i}),oe}return tt(t.data)}get enum(){return this._def.values}};dn.create=(e,t)=>new dn({values:e,typeName:se.ZodNativeEnum,...de(t)});var wr=class extends fe{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==X.promise&&r.common.async===!1)return Y(r,{code:H.invalid_type,expected:X.promise,received:r.parsedType}),oe;let n=r.parsedType===X.promise?r.data:Promise.resolve(r.data);return tt(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};wr.create=(e,t)=>new wr({type:e,typeName:se.ZodPromise,...de(t)});var At=class extends fe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===se.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this9=this;let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:s=>{Y(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(a){if(r.value==="aborted")return oe;let c=yield _this9._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?oe:c.status==="dirty"?Jr(c.value):r.value==="dirty"?Jr(c.value):c});return function(_x81){return _ref38.apply(this,arguments)}}());{if(r.value==="aborted")return oe;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?oe:a.status==="dirty"?Jr(a.value):r.value==="dirty"?Jr(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);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"?oe:(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"?oe:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!vr(s))return oe;let a=i.transform(s.value,o);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=>vr(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):oe);ye.assertNever(i)}};At.create=(e,t,r)=>new At({schema:e,typeName:se.ZodEffects,effect:t,...de(r)});At.createWithPreprocess=(e,t,r)=>new At({schema:t,effect:{type:"preprocess",transform:e},typeName:se.ZodEffects,...de(r)});var vt=class extends fe{_parse(t){return this._getType(t)===X.undefined?tt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};vt.create=(e,t)=>new vt({innerType:e,typeName:se.ZodOptional,...de(t)});var Ut=class extends fe{_parse(t){return this._getType(t)===X.null?tt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ut.create=(e,t)=>new Ut({innerType:e,typeName:se.ZodNullable,...de(t)});var pn=class extends fe{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===X.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};pn.create=(e,t)=>new pn({innerType:e,typeName:se.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...de(t)});var fn=class extends fe{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ui(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};fn.create=(e,t)=>new fn({innerType:e,typeName:se.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...de(t)});var gi=class extends fe{_parse(t){if(this._getType(t)!==X.nan){let n=this._getOrReturnCtx(t);return Y(n,{code:H.invalid_type,expected:X.nan,received:n.parsedType}),oe}return{status:"valid",value:t.data}}};gi.create=e=>new gi({typeName:se.ZodNaN,...de(e)});var GI=Symbol("zod_brand"),vo=class extends fe{_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}},So=class e extends fe{_parse(t){var _this0=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let o=yield _this0._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?oe:o.status==="dirty"?(r.dirty(),Jr(o.value)):_this0._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?oe:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:se.ZodPipeline})}},mn=class extends fe{_parse(t){let r=this._def.innerType._parse(t),n=i=>(vr(i)&&(i.value=Object.freeze(i.value)),i);return ui(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};mn.create=(e,t)=>new mn({innerType:e,typeName:se.ZodReadonly,...de(t)});function Mh(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Vh(e,t={},r){return e?Ar.create().superRefine((n,i)=>{let o=e(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=Mh(t,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=Mh(t,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):Ar.create()}var BI={object:at.lazycreate},se;(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"})(se||(se={}));var $I=(e,t={message:`Input not instance of ${e.name}`})=>Vh(r=>r instanceof e,t),Gh=Sr.create,Bh=Zr.create,QI=gi.create,HI=en.create,$h=tn.create,zI=rn.create,WI=di.create,KI=nn.create,YI=on.create,XI=Ar.create,JI=rr.create,ZI=_t.create,eR=pi.create,tR=nr.create,rR=at.create,nR=at.strictCreate,iR=sn.create,oR=sa.create,sR=an.create,aR=Lt.create,cR=aa.create,uR=fi.create,lR=mi.create,dR=ca.create,pR=cn.create,fR=un.create,mR=ln.create,gR=dn.create,hR=wr.create,yR=At.create,vR=vt.create,SR=Ut.create,AR=At.createWithPreprocess,wR=So.create,bR=()=>Gh().optional(),CR=()=>Bh().optional(),xR=()=>$h().optional(),ER={string:e=>Sr.create({...e,coerce:!0}),number:e=>Zr.create({...e,coerce:!0}),boolean:e=>tn.create({...e,coerce:!0}),bigint:e=>en.create({...e,coerce:!0}),date:e=>rn.create({...e,coerce:!0})};var IR=oe;var RR=I.object({name:I.string(),arguments:I.string()}),TR=I.object({id:I.string(),type:I.literal("function"),function:RR,encryptedValue:I.string().optional()}),ua=I.object({id:I.string(),role:I.string(),content:I.string().optional(),name:I.string().optional(),encryptedValue:I.string().optional()}),_R=I.object({type:I.literal("text"),text:I.string()}),Qh=I.object({type:I.literal("binary"),mimeType:I.string(),id:I.string().optional(),url:I.string().optional(),data:I.string().optional(),filename:I.string().optional()}),Hh=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:I.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},V4=Qh.superRefine((e,t)=>{Hh(e,t)}),kR=I.discriminatedUnion("type",[_R,Qh]),OR=kR.superRefine((e,t)=>{e.type==="binary"&&Hh(e,t)}),PR=ua.extend({role:I.literal("developer"),content:I.string()}),NR=ua.extend({role:I.literal("system"),content:I.string()}),FR=ua.extend({role:I.literal("assistant"),content:I.string().optional(),toolCalls:I.array(TR).optional()}),DR=ua.extend({role:I.literal("user"),content:I.union([I.string(),I.array(OR)])}),MR=I.object({id:I.string(),content:I.string(),role:I.literal("tool"),toolCallId:I.string(),error:I.string().optional(),encryptedValue:I.string().optional()}),jR=I.object({id:I.string(),role:I.literal("activity"),activityType:I.string(),content:I.record(I.any())}),qR=I.object({id:I.string(),role:I.literal("reasoning"),content:I.string(),encryptedValue:I.string().optional()}),zh=I.discriminatedUnion("role",[PR,NR,FR,DR,MR,jR,qR]),G4=I.union([I.literal("developer"),I.literal("system"),I.literal("assistant"),I.literal("user"),I.literal("tool"),I.literal("activity"),I.literal("reasoning")]),LR=I.object({description:I.string(),value:I.string()}),UR=I.object({name:I.string(),description:I.string(),parameters:I.any()}),VR=I.object({threadId:I.string(),runId:I.string(),parentRunId:I.string().optional(),state:I.any(),messages:I.array(zh),tools:I.array(UR),context:I.array(LR),forwardedProps:I.any()}),GR=I.any(),Pe=class extends Error{constructor(e){super(e)}},Jl=class extends Pe{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},Wh=I.union([I.literal("developer"),I.literal("system"),I.literal("assistant"),I.literal("user")]),N=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}({}),we=I.object({type:I.nativeEnum(N),timestamp:I.number().optional(),rawEvent:I.any().optional()}).passthrough(),BR=we.extend({type:I.literal(N.TEXT_MESSAGE_START),messageId:I.string(),role:Wh.default("assistant")}),Kh=we.extend({type:I.literal(N.TEXT_MESSAGE_CONTENT),messageId:I.string(),delta:I.string().refine(e=>e.length>0,"Delta must not be an empty string")}),$R=we.extend({type:I.literal(N.TEXT_MESSAGE_END),messageId:I.string()}),QR=we.extend({type:I.literal(N.TEXT_MESSAGE_CHUNK),messageId:I.string().optional(),role:Wh.optional(),delta:I.string().optional()}),HR=we.extend({type:I.literal(N.THINKING_TEXT_MESSAGE_START)}),zR=Kh.omit({messageId:!0,type:!0}).extend({type:I.literal(N.THINKING_TEXT_MESSAGE_CONTENT)}),WR=we.extend({type:I.literal(N.THINKING_TEXT_MESSAGE_END)}),KR=we.extend({type:I.literal(N.TOOL_CALL_START),toolCallId:I.string(),toolCallName:I.string(),parentMessageId:I.string().optional()}),YR=we.extend({type:I.literal(N.TOOL_CALL_ARGS),toolCallId:I.string(),delta:I.string()}),XR=we.extend({type:I.literal(N.TOOL_CALL_END),toolCallId:I.string()}),JR=we.extend({messageId:I.string(),type:I.literal(N.TOOL_CALL_RESULT),toolCallId:I.string(),content:I.string(),role:I.literal("tool").optional()}),ZR=we.extend({type:I.literal(N.TOOL_CALL_CHUNK),toolCallId:I.string().optional(),toolCallName:I.string().optional(),parentMessageId:I.string().optional(),delta:I.string().optional()}),eT=we.extend({type:I.literal(N.THINKING_START),title:I.string().optional()}),tT=we.extend({type:I.literal(N.THINKING_END)}),rT=we.extend({type:I.literal(N.STATE_SNAPSHOT),snapshot:GR}),nT=we.extend({type:I.literal(N.STATE_DELTA),delta:I.array(I.any())}),iT=we.extend({type:I.literal(N.MESSAGES_SNAPSHOT),messages:I.array(zh)}),oT=we.extend({type:I.literal(N.ACTIVITY_SNAPSHOT),messageId:I.string(),activityType:I.string(),content:I.record(I.any()),replace:I.boolean().optional().default(!0)}),sT=we.extend({type:I.literal(N.ACTIVITY_DELTA),messageId:I.string(),activityType:I.string(),patch:I.array(I.any())}),aT=we.extend({type:I.literal(N.RAW),event:I.any(),source:I.string().optional()}),cT=we.extend({type:I.literal(N.CUSTOM),name:I.string(),value:I.any()}),uT=we.extend({type:I.literal(N.RUN_STARTED),threadId:I.string(),runId:I.string(),parentRunId:I.string().optional(),input:VR.optional()}),lT=we.extend({type:I.literal(N.RUN_FINISHED),threadId:I.string(),runId:I.string(),result:I.any().optional()}),dT=we.extend({type:I.literal(N.RUN_ERROR),message:I.string(),code:I.string().optional()}),pT=we.extend({type:I.literal(N.STEP_STARTED),stepName:I.string()}),fT=we.extend({type:I.literal(N.STEP_FINISHED),stepName:I.string()}),mT=I.union([I.literal("tool-call"),I.literal("message")]),gT=we.extend({type:I.literal(N.REASONING_START),messageId:I.string()}),hT=we.extend({type:I.literal(N.REASONING_MESSAGE_START),messageId:I.string(),role:I.literal("reasoning")}),yT=we.extend({type:I.literal(N.REASONING_MESSAGE_CONTENT),messageId:I.string(),delta:I.string().refine(e=>e.length>0,"Delta must not be an empty string")}),vT=we.extend({type:I.literal(N.REASONING_MESSAGE_END),messageId:I.string()}),ST=we.extend({type:I.literal(N.REASONING_MESSAGE_CHUNK),messageId:I.string().optional(),delta:I.string().optional()}),AT=we.extend({type:I.literal(N.REASONING_END),messageId:I.string()}),wT=we.extend({type:I.literal(N.REASONING_ENCRYPTED_VALUE),subtype:mT,entityId:I.string(),encryptedValue:I.string()}),la=I.discriminatedUnion("type",[BR,Kh,$R,QR,eT,tT,HR,zR,WR,KR,YR,XR,ZR,JR,rT,nT,iT,oT,sT,aT,cT,uT,lT,dT,pT,fT,gT,hT,yT,vT,ST,AT,wT]);m();d();f();p();var Zl={};Po(Zl,{JsonPatchError:()=>je,_areEquals:()=>bo,applyOperation:()=>gn,applyPatch:()=>br,applyReducer:()=>IT,deepClone:()=>xT,getValueByPointer:()=>ga,validate:()=>Xh,validator:()=>ha});m();d();f();p();m();d();f();p();var bT=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),CT=Object.prototype.hasOwnProperty;function pa(e,t){return CT.call(e,t)}function fa(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 i in e)pa(e,i)&&n.push(i);return n}function Je(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function ma(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 Vt(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ao(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function da(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(da(e[t]))return!0}else if(typeof e=="object"){for(var n=fa(e),i=n.length,o=0;o<i;o++)if(da(e[n[o]]))return!0}}return!1}function Yh(e,t){var r=[e];for(var n in t){var i=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof i<"u"&&r.push(n+": "+i)}return r.join(`
|
|
32
|
-
`)}var wo=function(e){bT(t,e);function t(r,n,i,o,s){var a=this.constructor,c=e.call(this,Yh(r,{name:n,index:i,operation:o,tree:s}))||this;return c.name=n,c.index=i,c.operation=o,c.tree=s,Object.setPrototypeOf(c,a.prototype),c.message=Yh(r,{name:n,index:i,operation:o,tree:s}),c}return t}(Error);var je=wo,xT=Je,hi={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=ga(r,this.path);n&&(n=Je(n));var i=gn(r,{op:"remove",path:this.from}).removed;return gn(r,{op:"add",path:this.path,value:i}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=ga(r,this.from);return gn(r,{op:"add",path:this.path,value:Je(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:bo(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},ET={add:function(e,t,r){return ma(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:hi.move,copy:hi.copy,test:hi.test,_get:hi._get};function ga(e,t){if(t=="")return e;var r={op:"_get",path:t};return gn(e,r),r.value}function gn(e,t,r,n,i,o){if(r===void 0&&(r=!1),n===void 0&&(n=!0),i===void 0&&(i=!0),o===void 0&&(o=0),r&&(typeof r=="function"?r(t,0,e,t.path):ha(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=ga(e,t.from),t.op==="move"&&(s.removed=e),s;if(t.op==="test"){if(s.test=bo(e,t.value),s.test===!1)throw new je("Test operation failed","TEST_OPERATION_FAILED",o,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 je("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",o,t,e);return s}}else{n||(e=Je(e));var a=t.path||"",c=a.split("/"),u=e,h=1,v=c.length,S=void 0,g=void 0,y=void 0;for(typeof r=="function"?y=r:y=ha;;){if(g=c[h],g&&g.indexOf("~")!=-1&&(g=Ao(g)),i&&(g=="__proto__"||g=="prototype"&&h>0&&c[h-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&&S===void 0&&(u[g]===void 0?S=c.slice(0,h).join("/"):h==v-1&&(S=t.path),S!==void 0&&y(t,0,e,S)),h++,Array.isArray(u)){if(g==="-")g=u.length;else{if(r&&!ma(g))throw new je("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",o,t,e);ma(g)&&(g=~~g)}if(h>=v){if(r&&t.op==="add"&&g>u.length)throw new je("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",o,t,e);var s=ET[t.op].call(t,u,g,e);if(s.test===!1)throw new je("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return s}}else if(h>=v){var s=hi[t.op].call(t,u,g,e);if(s.test===!1)throw new je("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return s}if(u=u[g],r&&h<v&&(!u||typeof u!="object"))throw new je("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",o,t,e)}}}function br(e,t,r,n,i){if(n===void 0&&(n=!0),i===void 0&&(i=!0),r&&!Array.isArray(t))throw new je("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=Je(e));for(var o=new Array(t.length),s=0,a=t.length;s<a;s++)o[s]=gn(e,t[s],r,!0,i,s),e=o[s].newDocument;return o.newDocument=e,o}function IT(e,t,r){var n=gn(e,t);if(n.test===!1)throw new je("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function ha(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new je("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(hi[e.op]){if(typeof e.path!="string")throw new je("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new je("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 je("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 je("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")&&da(e.value))throw new je("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 i=e.path.split("/").length,o=n.split("/").length;if(i!==o+1&&i!==o)throw new je("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 je("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=Xh([s],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new je("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new je("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function Xh(e,t,r){try{if(!Array.isArray(e))throw new je("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)br(Je(t),Je(e),r||!0);else{r=r||ha;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(i){if(i instanceof je)return i;throw i}}function bo(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),i,o,s;if(r&&n){if(o=e.length,o!=t.length)return!1;for(i=o;i--!==0;)if(!bo(e[i],t[i]))return!1;return!0}if(r!=n)return!1;var a=Object.keys(e);if(o=a.length,o!==Object.keys(t).length)return!1;for(i=o;i--!==0;)if(!t.hasOwnProperty(a[i]))return!1;for(i=o;i--!==0;)if(s=a[i],!bo(e[s],t[s]))return!1;return!0}return e!==e&&t!==t}var nd={};Po(nd,{compare:()=>FT,generate:()=>ed,observe:()=>NT,unobserve:()=>PT});m();d();f();p();var td=new WeakMap,RT=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),TT=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function _T(e){return td.get(e)}function kT(e,t){return e.observers.get(t)}function OT(e,t){e.observers.delete(t.callback)}function PT(e,t){t.unobserve()}function NT(e,t){var r=[],n,i=_T(e);if(!i)i=new RT(e),td.set(e,i);else{var o=kT(i,t);n=o&&o.observer}if(n)return n;if(n={},i.value=Je(e),t){n.callback=t,n.next=null;var s=function(){ed(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(){ed(n),clearTimeout(n.next),OT(i,n),typeof window<"u"&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},i.observers.set(t,new TT(t,n)),n}function ed(e,t){t===void 0&&(t=!1);var r=td.get(e.object);rd(r.value,e.object,e.patches,"",t),e.patches.length&&br(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function rd(e,t,r,n,i){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var o=fa(t),s=fa(e),a=!1,c=!1,u=s.length-1;u>=0;u--){var h=s[u],v=e[h];if(pa(t,h)&&!(t[h]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var S=t[h];typeof v=="object"&&v!=null&&typeof S=="object"&&S!=null&&Array.isArray(v)===Array.isArray(S)?rd(v,S,r,n+"/"+Vt(h),i):v!==S&&(a=!0,i&&r.push({op:"test",path:n+"/"+Vt(h),value:Je(v)}),r.push({op:"replace",path:n+"/"+Vt(h),value:Je(S)}))}else Array.isArray(e)===Array.isArray(t)?(i&&r.push({op:"test",path:n+"/"+Vt(h),value:Je(v)}),r.push({op:"remove",path:n+"/"+Vt(h)}),c=!0):(i&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),a=!0)}if(!(!c&&o.length==s.length))for(var u=0;u<o.length;u++){var h=o[u];!pa(e,h)&&t[h]!==void 0&&r.push({op:"add",path:n+"/"+Vt(h),value:Je(t[h])})}}}function FT(e,t,r){r===void 0&&(r=!1);var n=[];return rd(e,t,n,"",r),n}var fW=Object.assign({},Zl,nd,{JsonPatchError:wo,deepClone:Je,escapePathComponent:Vt,unescapePathComponent:Ao});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var id=function(e,t){return id=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},id(e,t)};function Gt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");id(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Jh(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{u(n.next(h))}catch(v){s(v)}}function c(h){try{u(n.throw(h))}catch(v){s(v)}}function u(h){h.done?o(h.value):i(h.value).then(a,c)}u((n=n.apply(e,t||[])).next())})}function ya(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,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(h){return c([u,h])}}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,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function ir(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 yi(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-->0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o}function vi(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}function hn(e){return this instanceof hn?(this.v=e,this):new hn(e)}function Zh(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(g){return function(y){return Promise.resolve(y).then(g,v)}}function a(g,y){n[g]&&(i[g]=function(C){return new Promise(function(E,x){o.push([g,C,E,x])>1||c(g,C)})},y&&(i[g]=y(i[g])))}function c(g,y){try{u(n[g](y))}catch(C){S(o[0][3],C)}}function u(g){g.value instanceof hn?Promise.resolve(g.value.v).then(h,v):S(o[0][2],g)}function h(g){c("next",g)}function v(g){c("throw",g)}function S(g,y){g(y),o.shift(),o.length&&c(o[0][0],o[0][1])}}function ey(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 ir=="function"?ir(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(u){o({value:u,done:a})},s)}}m();d();f();p();function ge(e){return typeof e=="function"}m();d();f();p();m();d();f();p();m();d();f();p();function Si(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 va=Si(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
30
|
+
`;function ox(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var sx=["1",1,"yes",!0];function Cs(){let e=[];return Ou()&&e.push(window.doNotTrack),$u()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>sx.indexOf(t)!==-1)}var Pm="v15",Nm={default:"https://analytics.cloud.coveo.com/rest/ua",production:"https://analytics.cloud.coveo.com/rest/ua",hipaa:"https://analyticshipaa.cloud.coveo.com/rest/ua"};function ax(e=Nm.default,t=Pm,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 cx="38824e1f-37f5-42d3-8372-a4b8fa9df946",Ft=class{get defaultOptions(){return{endpoint:Nm.default,isCustomEndpoint:!1,token:"",version:Pm,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Tm}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=[Yw,Qw].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};Cs()?this.runtime=new ws:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(me.view,{newEventType:me.view,addClientIdParameter:!0}),this.addEventTypeMapping(me.click,{newEventType:me.click,addClientIdParameter:!0}),this.addEventTypeMapping(me.custom,{newEventType:me.custom,addClientIdParameter:!0}),this.addEventTypeMapping(me.search,{newEventType:me.search,addClientIdParameter:!0})}initRuntime(t){return Ou()&&Un()?new Bu(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(ox()&&console.warn(ix),new Gu(t))}get storage(){return this.runtime.storage}determineVisitorId(){return D(this,void 0,void 0,function*(){try{return Ou()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Ur()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Ur()}})}getCurrentVisitorId(){return D(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return D(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return D(this,void 0,void 0,function*(){if(vs(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(gm(t,gm(r,cx)))}})}getParameters(t,...r){return D(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return D(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(Ur()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(Cs())return null;try{let r=new URL(t).searchParams.get(ur.cvo_cid);if(r==null)return null;let n=ur.fromString(r);return!n||!Un()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return D(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:i=!1,usesMeasurementProtocol:o=!1,addClientIdParameter:s=!1}=this.eventTypeMapping[t]||{};return yield[g=>n.length>0?this.parseVariableArgumentsPayload(n,g):g[0],g=>D(this,void 0,void 0,function*(){return Object.assign(Object.assign({},g),{visitorId:i?yield this.getCurrentVisitorId():""})}),g=>D(this,void 0,void 0,function*(){return s?Object.assign(Object.assign({},g),{clientId:yield this.getCurrentVisitorId()}):g}),g=>o?this.ensureAnonymousUserWhenUsingApiKey(g):g,g=>this.beforeSendHooks.reduce((y,C)=>D(this,void 0,void 0,function*(){let E=yield y;return yield C(t,E)}),g)].reduce((g,y)=>D(this,void 0,void 0,function*(){let C=yield g;return yield y(C)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return D(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?WC(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,S)=>D(this,void 0,void 0,function*(){let g=yield v;return yield S(g)}),Promise.resolve(r))})}makeEvent(t,...r){return D(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},i=yield this.resolveParameters(t,...r),o=yield this.resolvePayloadForParameters(t,i);return{eventType:n,payload:o,log:s=>D(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},o),s)}),yield Promise.all(this.afterSendHooks.map(a=>a(t,Object.assign(Object.assign({},i),s)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return D(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return D(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 ys().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return D(this,void 0,void 0,function*(){return this.makeEvent(me.search,t)})}sendSearchEvent(t){return D(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Xt(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return D(this,void 0,void 0,function*(){return this.makeEvent(me.click,t)})}sendClickEvent(t){return D(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Xt(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return D(this,void 0,void 0,function*(){return this.makeEvent(me.custom,t)})}sendCustomEvent(t){return D(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=Xt(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return D(this,void 0,void 0,function*(){return this.makeEvent(me.view,t)})}sendViewEvent(t){return D(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return D(this,void 0,void 0,function*(){let r=yield(yield b(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return D(this,void 0,void 0,function*(){return yield(yield b(`${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 i=0,o=r.length;i<o;i++){let s=r[i];if(typeof s=="string")n[t[i]]=s;else if(typeof s=="object")return Object.assign(Object.assign({},n),s)}return n}isKeyAllowedEmpty(t,r){return({[me.search]:["queryText"]}[t]||[]).indexOf(r)!==-1}removeEmptyPayloadValues(t,r){let n=i=>typeof i<"u"&&i!==null&&i!=="";return Object.keys(t).filter(i=>this.isKeyAllowedEmpty(r,i)||n(t[i])).reduce((i,o)=>Object.assign(Object.assign({},i),{[o]:t[o]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(JC(n))return!0;console.log(n,"is not processed by coveoua")}).reduce((n,i)=>Object.assign(Object.assign({},n),{[i]:t[i]}),{})}processCustomParameters(t){let{custom:r}=t,n=Xt(t,["custom"]),i={};r&&hs(r)&&(i=this.lowercaseKeys(r));let o=ZC(n);return Object.assign(Object.assign({},i),o)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=Xt(t,["custom"]);if(r&&hs(r)){let i=this.lowercaseKeys(r);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},i),t.customData)})}else return t}lowercaseKeys(t){let r=Object.keys(t),n={};return r.forEach(i=>{n[i.toLowerCase()]=t[i]}),n}validateParams(t,r){let{anonymizeIp:n}=t,i=Xt(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(i.anonymizeIp=1),(r==me.view||r==me.click||r==me.search||r==me.custom)&&(i.originLevel3=this.limit(i.originLevel3,1024)),r==me.view&&(i.location=this.limit(i.location,1024)),(r=="pageview"||r=="event")&&(i.referrer=this.limit(i.referrer,2048),i.location=this.limit(i.location,2048),i.page=this.limit(i.page,2048)),i}ensureAnonymousUserWhenUsingApiKey(t){let{userId:r}=t,n=Xt(t,["userId"]);return nx(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=Xt(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&hs(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&hs(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"?dC(t,r):t}get baseUrl(){return ax(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},Jt;(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"})(Jt||(Jt={}));var j;(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.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.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})(j||(j={}));var wm={[j.triggerNotify]:"queryPipelineTriggers",[j.triggerExecute]:"queryPipelineTriggers",[j.triggerQuery]:"queryPipelineTriggers",[j.triggerRedirect]:"queryPipelineTriggers",[j.queryErrorBack]:"errors",[j.queryErrorClear]:"errors",[j.queryErrorRetry]:"errors",[j.pagerNext]:"getMoreResults",[j.pagerPrevious]:"getMoreResults",[j.pagerNumber]:"getMoreResults",[j.pagerResize]:"getMoreResults",[j.pagerScrolling]:"getMoreResults",[j.facetSearch]:"facet",[j.facetShowLess]:"facet",[j.facetShowMore]:"facet",[j.recommendation]:"recommendation",[j.likeSmartSnippet]:"smartSnippet",[j.dislikeSmartSnippet]:"smartSnippet",[j.expandSmartSnippet]:"smartSnippet",[j.collapseSmartSnippet]:"smartSnippet",[j.openSmartSnippetFeedbackModal]:"smartSnippet",[j.closeSmartSnippetFeedbackModal]:"smartSnippet",[j.sendSmartSnippetReason]:"smartSnippet",[j.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[j.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[j.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[j.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[j.clearRecentQueries]:"recentQueries",[j.recentResultClick]:"recentlyClickedDocuments",[j.clearRecentResults]:"recentlyClickedDocuments",[j.showLessFoldedResults]:"folding",[j.caseDetach]:"case",[j.likeGeneratedAnswer]:"generatedAnswer",[j.dislikeGeneratedAnswer]:"generatedAnswer",[j.openGeneratedAnswerSource]:"generatedAnswer",[j.generatedAnswerStreamEnd]:"generatedAnswer",[j.generatedAnswerSourceHover]:"generatedAnswer",[j.generatedAnswerCopyToClipboard]:"generatedAnswer",[j.generatedAnswerHideAnswers]:"generatedAnswer",[j.generatedAnswerShowAnswers]:"generatedAnswer",[j.generatedAnswerExpand]:"generatedAnswer",[j.generatedAnswerCollapse]:"generatedAnswer",[j.generatedAnswerFeedbackSubmit]:"generatedAnswer",[j.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[Jt.expandToFullUI]:"interface",[Jt.openUserActions]:"User Actions",[Jt.showPrecedingSessions]:"User Actions",[Jt.showFollowingSessions]:"User Actions",[Jt.clickViewedDocument]:"User Actions",[Jt.clickPageView]:"User Actions",[Jt.createArticle]:"createArticle"},Gn=class{constructor(){this.runtime=new ws,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(me.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(me.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(me.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(me.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return Tm}};function ux(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function lx(e){return e.map(t=>t.replace(/;/g,""))}function Fm(e){let r=e.join(";");return r.length<=256?r:Fm(e.slice(1))}var Cm=e=>{let t=lx(e),r=ux(t);return Fm(r)};function xm(e){let t=typeof e.partialQueries=="string"?e.partialQueries:Cm(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:Cm(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var xs=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Cs();this.coveoAnalyticsClient=n?new Gn:new Ft(t)}disable(){this.coveoAnalyticsClient=new Gn}enable(){this.coveoAnalyticsClient=new Ft(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(j.interfaceLoad)}logInterfaceLoad(){return D(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(j.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return D(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(j.recommendation)}logRecommendation(){return D(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent(j.recommendationOpen,t,r)}logRecommendationOpen(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(j.staticFilterClearAll,t)}logStaticFilterClearAll(t){return D(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent(j.staticFilterSelect,t)}logStaticFilterSelect(t){return D(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent(j.staticFilterDeselect,t)}logStaticFilterDeselect(t){return D(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(j.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return D(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent(j.interfaceChange,t)}logInterfaceChange(t){return D(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(j.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return D(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(j.didyoumeanClick)}logDidYouMeanClick(){return D(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(j.resultsSort,t)}logResultsSort(t){return D(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(j.searchboxSubmit)}logSearchboxSubmit(){return D(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(j.searchboxClear)}logSearchboxClear(){return D(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(j.searchboxAsYouType)}logSearchboxAsYouType(){return D(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(j.breadcrumbFacet,t)}logBreadcrumbFacet(t){return D(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(j.breadcrumbResetAll)}logBreadcrumbResetAll(){return D(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent(j.documentQuickview,t,r)}logDocumentQuickview(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent(j.documentOpen,t,r)}logDocumentOpen(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(j.omniboxAnalytics,xm(t))}logOmniboxAnalytics(t){return D(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(j.omniboxFromLink,xm(t))}logOmniboxFromLink(t){return D(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(j.searchFromLink)}logSearchFromLink(){return D(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(j.triggerNotify,t)}logTriggerNotify(t){return D(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(j.triggerExecute,t)}logTriggerExecute(t){return D(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(j.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return D(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(j.undoTriggerQuery,t)}logUndoTriggerQuery(t){return D(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(j.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return D(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(j.pagerResize,t)}logPagerResize(t){return D(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(j.pagerNumber,t)}logPagerNumber(t){return D(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(j.pagerNext,t)}logPagerNext(t){return D(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(j.pagerPrevious,t)}logPagerPrevious(t){return D(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(j.pagerScrolling)}logPagerScrolling(){return D(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(j.facetClearAll,t)}logFacetClearAll(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(j.facetSearch,t)}logFacetSearch(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(j.facetSelect,t)}logFacetSelect(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(j.facetDeselect,t)}logFacetDeselect(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(j.facetExclude,t)}logFacetExclude(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(j.facetUnexclude,t)}logFacetUnexclude(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(j.facetSelectAll,t)}logFacetSelectAll(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(j.facetUpdateSort,t)}logFacetUpdateSort(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(j.facetShowMore,t)}logFacetShowMore(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(j.facetShowLess,t)}logFacetShowLess(t){return D(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(j.queryError,t)}logQueryError(t){return D(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return D(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(j.queryErrorBack);return{description:t.description,log:()=>D(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(j.queryErrorBack)})}})}logQueryErrorBack(){return D(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return D(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(j.queryErrorRetry);return{description:t.description,log:()=>D(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(j.queryErrorRetry)})}})}logQueryErrorRetry(){return D(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return D(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(j.queryErrorClear);return{description:t.description,log:()=>D(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(j.queryErrorClear)})}})}logQueryErrorClear(){return D(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(j.likeSmartSnippet)}logLikeSmartSnippet(){return D(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(j.dislikeSmartSnippet)}logDislikeSmartSnippet(){return D(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(j.expandSmartSnippet)}logExpandSmartSnippet(){return D(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(j.collapseSmartSnippet)}logCollapseSmartSnippet(){return D(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(j.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return D(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(j.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return D(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent(j.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(j.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return D(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent(j.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return D(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent(j.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return D(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent(j.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return D(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent(j.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent(j.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(j.copyToClipboard,t,r)}logCopyToClipboard(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent(j.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent(j.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(j.recentQueryClick)}logRecentQueryClick(){return D(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(j.clearRecentQueries)}logClearRecentQueries(){return D(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent(j.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(j.clearRecentResults)}logClearRecentResults(){return D(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(j.noResultsBack)}logNoResultsBack(){return D(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent(j.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(j.showLessFoldedResults)}logShowLessFoldedResults(){return D(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 D(this,arguments,void 0,function*(n,i,o=wm[n]){this.coveoAnalyticsClient.getParameters;let s=Object.assign(Object.assign({},this.provider.getBaseMetadata()),i),a=Object.assign(Object.assign({},yield this.getBaseEventRequest(s)),{eventType:o,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 D(this,arguments,void 0,function*(n,i,o=wm[n]){return(yield this.makeCustomEvent(n,i,o)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return D(this,void 0,void 0,function*(){let i=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),o=Object.assign(Object.assign({},yield this.getBaseEventRequest(i)),{eventType:r,eventValue:t}),s=yield this.coveoAnalyticsClient.makeCustomEvent(o);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({lastSearchQueryUid:a})}})}logCustomEventWithType(t,r,n){return D(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return D(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),i=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(i,t),log:({searchUID:o})=>i.log({searchQueryUid:o})}})}makeClickEvent(t,r,n,i){return D(this,void 0,void 0,function*(){let o=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),i))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),s=yield this.coveoAnalyticsClient.makeClickEvent(o);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({searchQueryUid:a})}})}logClickEvent(t,r,n,i){return D(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,i)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return D(this,void 0,void 0,function*(){var n,i;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(i=(n=this.provider).getGeneratedAnswerMetadata)===null||i===void 0?void 0:i.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return D(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 Ft?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(j.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return D(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(j.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return D(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(j.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return D(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(j.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(j.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(j.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(j.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(j.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(j.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(j.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(j.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(j.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(j.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return D(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(j.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return D(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(j.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return D(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Es=Object.assign({},Wi),Em=Object.keys(Es).map(e=>Es[e]),Vn=class extends Fu{constructor({client:t,uuidGenerator:r=Ur}){super({client:t,uuidGenerator:r}),this.ticket={}}getApi(t){let r=super.getApi(t);if(r!==null)return r;switch(t){case"setTicket":return this.setTicket;default:return null}}addHooks(){this.addHooksForEvent(),this.addHooksForPageView(),this.addHooksForSVCEvents()}setTicket(t){this.ticket=t}clearPluginData(){this.ticket={}}addHooksForSVCEvents(){this.client.registerBeforeSendEventHook((t,...[r])=>Em.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Em.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Es.pageview,{newEventType:me.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Es.event,{newEventType:me.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,r){var n;let i=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}:{}),o=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},o),i),r)}getTicketPayload(){return hC(this.ticket)}};Vn.Id="svc";var Rs;(function(e){e.click="click",e.flowStart="flowStart"})(Rs||(Rs={}));var ht;(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"})(ht||(ht={}));var Is;(function(e){e.quit="Quit",e.solved="Solved"})(Is||(Is={}));var Ts=class{constructor(t,r){var n;this.options=t,this.provider=r;let i=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!Cs();this.coveoAnalyticsClient=i?new Ft(t):new Gn,this.svc=new Vn({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Gn,this.svc=new Vn({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Ft(this.options),this.svc=new Vn({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(ht.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(ht.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(ht.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(ht.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(ht.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(ht.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(ht.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(ht.caseCancelled,{reason:Is.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(ht.caseSolved,{reason:Is.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(ht.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Rs.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Rs.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return D(this,void 0,void 0,function*(){var r,n;let i=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:i,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 Ft?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,i,o;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:(i=this.provider)===null||i===void 0?void 0:i.getOriginLevel2(),originLevel3:(o=this.provider)===null||o===void 0?void 0:o.getOriginLevel3()}}logClickEvent(t,r,n,i){return D(this,void 0,void 0,function*(){var o,s;let a=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),i))),{searchQueryUid:(s=(o=this.provider)===null||o===void 0?void 0:o.getSearchUID())!==null&&s!==void 0?s:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(a)})}};m();d();f();p();var dx=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},Vr=class{constructor(t){this.getState=t;we(this,"state");this.state=t()}getLanguage(){return dx(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},i={};for(let[o,s]of Object.entries(n)){let a=`context_${o}`;i[a]=s}return r.analytics.analyticsMode==="legacy"&&(i.coveoHeadlessVersion=Fn),i}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||Mn()}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 $n=e=>new Ft(e).getCurrentVisitorId(),Xi=(e,t)=>typeof t=="function"?(...r)=>{let n=Oi(r[0]);try{return t.apply(t,r)}catch(i){return e.error(i,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,Ji=(e,t)=>(...r)=>{let n=Oi(r[1]);try{return t.apply(t,r)}catch(i){return e.error(i,"Error in analytics hook. Returning original request."),n}};var Zi=class extends Vr{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Dm=({logger:e,getState:t,analyticsClientMiddleware:r=(o,s)=>s,preprocessRequest:n,provider:i=new Zi(t)})=>{let o=t(),s=o.configuration.accessToken,a=o.configuration.analytics.apiBaseUrl??qe(o.configuration.organizationId,o.configuration.environment,"analytics"),c=o.configuration.analytics.runtimeEnvironment,u=o.configuration.analytics.enabled,h=new Ts({enableAnalytics:u,token:s,endpoint:a,runtimeEnvironment:c,preprocessRequest:Xi(e,n),beforeSendHooks:[Ji(e,r),(v,S)=>(e.info({...S,type:v,endpoint:a,token:s},"Analytics request"),S)]},i);return u||h.disable(),h};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function _s(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function Mm(e){let{activeValue:t,ancestryMap:r}=mx(e);return t?gx(t,r):[]}function mx(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 i of n.children)r.set(i,n);t.unshift(...n.children)}return{}}function gx(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var hx=(e,t)=>e.categoryFacetSet[t]?.request;var Qu=(e,t)=>{let r=hx(e,t);return Mm(r?.currentValues??[])};m();d();f();p();function ks(){return{}}m();d();f();p();function Os(){return{}}m();d();f();p();function Ps(){return{}}m();d();f();p();function Ns(){return{}}function Hu(e){return{facetSet:e.facetSet??Ns(),categoryFacetSet:e.categoryFacetSet??ks(),dateFacetSet:e.dateFacetSet??Os(),numericFacetSet:e.numericFacetSet??Ps(),automaticFacetSet:e.automaticFacetSet??_s()}}var zu=e=>{let t=[];return Sx(e).forEach((r,n)=>{let i=Ix(e,r.facetId),o=Ex(r,n+1);if(vx(r)){if(!!!Qu(e,r.facetId).length)return;t.push({...o,...Cx(e,r.facetId),facetType:i,state:"selected"});return}r.currentValues.forEach((s,a)=>{if(s.state==="idle")return;let c=jm(s,a+1,i),u=yx(r)?qm(s):bx(s);t.push({...o,...c,...u})})}),Ax(e).forEach((r,n)=>{let i=xx(r,n+1);r.values.forEach((o,s)=>{if(o.state==="idle")return;let a=jm(o,s+1,"specific"),c=qm(o);t.push({...i,...a,...c})})}),t},yx=e=>e.type==="specific",vx=e=>e.type==="hierarchical",Sx=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),Ax=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),jm=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),bx=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),qm=e=>({displayValue:e.value,value:e.value}),wx=(e,t)=>Qu(e,t).map(n=>n.value).join(";"),Cx=(e,t)=>{let n=wx(e,t);return{value:n,valuePosition:1,displayValue:n}},xx=(e,t)=>({title:Lm(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),Ex=(e,t)=>({title:Lm(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),Lm=(e,t)=>`${e}_${t}`,Rx=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,Ix=(e,t)=>{let r=Rx(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var Wu=e=>e.configuration.search.locale,Um=e=>e.configuration.search.timezone,Vm=e=>e.configuration.accessToken,Bm=e=>e.configuration.organizationId,Gm=e=>e.configuration.environment,Fs=e=>e.configuration?.knowledge?.agentId;var Br=e=>{if(Tx(e)||Ku(e))return e.generatedAnswer?.answerId;if(_x(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},Tx=e=>"answer"in e&&"generatedAnswer"in e&&!ie(e.generatedAnswer?.answerConfigurationId),Ku=e=>{let t=Fs(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},_x=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Yu=e=>e.generatedAnswer?.fieldsToIncludeInCitations,kx=De(e=>e.generatedAnswer?.citations,(e,t)=>t,(e,t)=>e?.find(r=>r.id===t));m();d();f();p();var It=()=>({q:"",enableQuerySyntax:!1});m();d();f();p();function Xu(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Dt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Xu(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Xu(),extendedResults:{},searchAction:void 0}}m();d();f();p();m();d();f();p();m();d();f();p();var $m=(r=>(r.Ascending="ascending",r.Descending="descending",r))($m||{}),Qm=(o=>(o.Relevancy="relevancy",o.QRE="qre",o.Date="date",o.Field="field",o.NoSort="nosort",o))(Qm||{}),Ju=e=>{if(bp(e))return e.map(t=>Ju(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""}},Hm=()=>({by:"relevancy"});var ML=new xe({values:{by:new Lc({enum:Qm,required:!0}),order:new Lc({enum:$m}),field:new J}});function Ds(){return Ju(Hm())}m();d();f();p();m();d();f();p();m();d();f();p();var Qn=class e{static set(t,r,n){let i,o,s;n&&(o=new Date,o.setTime(o.getTime()+n));let a=window.location.hostname,c=/^(\d{1,3}\.){3}\d{1,3}$/,u=/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/;c.test(a)||u.test(a)||a.indexOf(".")===-1?Zu(t,r,o):(s=a.split("."),i=s[s.length-2]+"."+s[s.length-1],Zu(t,r,o,i))}static get(t){let r=t+"=",n=document.cookie.split(";");for(let i=0;i<n.length;i++){let o=n[i];if(o=o.replace(/^\s+/,""),o.lastIndexOf(r,0)===0)return o.substring(r.length,o.length)}return null}static erase(t){e.set(t,"",-1)}};function Zu(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}m();d();f();p();function Ox(){return typeof navigator<"u"}function zm(){try{return typeof localStorage<"u"}catch{return!1}}function Wm(){try{return typeof sessionStorage<"u"}catch{return!1}}function Km(){return!!(Ox()&&navigator.cookieEnabled)}var Ym=null;function Xm(){return Ym||(zm()?localStorage:Km()?new el:Wm()?sessionStorage:new tl)}var Hn=class Hn{getItem(t){return Qn.get(`${Hn.prefix}${t}`)}removeItem(t){Qn.erase(`${Hn.prefix}${t}`)}setItem(t,r,n){Qn.set(`${Hn.prefix}${t}`,r,n)}};we(Hn,"prefix","coveo_");var el=Hn;var tl=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var Ms="__coveo.analytics.history",Px=20,Nx=1e3*60,Fx=75,Gr=class Gr{constructor(t){we(this,"store");this.store=t||Xm()}static getInstance(t){return Gr.instance||(Gr.instance=new Gr(t)),Gr.instance}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(Ms);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this6=this;return _asyncToGenerator(function*(){try{let t=yield _this6.store.getItem(Ms);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(Ms,JSON.stringify(t.slice(0,Px)))}catch{}}clear(){try{this.store.removeItem(Ms)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,i)=>(i.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,Fx)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value===t.value?(t.internalTime||0)-(r.internalTime||0)>Nx:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:i,value:o}=r;return{name:n,time:i,value:o}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:i}=t;return r&&typeof i=="string"&&r.toLowerCase()==="query"&&i.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};we(Gr,"instance",null);var rl=Gr,Mt=rl;var eo=class eo extends Vr{constructor(){super(...arguments);we(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 zu(Hu(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||eo.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||Dt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||eo.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),i=Br(r);return i&&(n.generativeQuestionAnsweringId=i),n}getFacetMetadata(r,n){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetValue:n,facetTitle:`${o}_${r}`}}getFacetClearAllMetadata(r){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetTitle:`${i}_${r}`}}getFacetUpdateSortMetadata(r,n){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,criteria:n,facetTitle:`${o}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${o}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??Ds()}}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 o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:o,categoryFacetPath:n,categoryFacetTitle:`${o}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let i=this.state.querySuggest?.[r],o=i.completions.map(u=>u.expression),s=i.partialQueries.length-1,a=i.partialQueries[s]||"",c=i.responseId;return{...this.getBaseMetadata(),suggestionRanking:o.indexOf(n),partialQuery:a,partialQueries:i.partialQueries.length>0?i.partialQueries:"",suggestions:o.length>0?o:"",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||It().q}get responseTime(){return this.state.search?.duration||Dt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Dt().response.totalCountFiltered}};we(eo,"fallbackPipelineName","default");var lr=eo,Jm=({logger:e,getState:t,analyticsClientMiddleware:r=(o,s)=>s,preprocessRequest:n,provider:i})=>{let o=t(),s=o.configuration.accessToken,a=o.configuration.analytics.apiBaseUrl??qe(o.configuration.organizationId,o.configuration.environment,"analytics"),c=o.configuration.analytics.runtimeEnvironment,u=o.configuration.analytics.enabled,h=new xs({token:s,endpoint:a,runtimeEnvironment:c,preprocessRequest:Xi(e,n),beforeSendHooks:[Ji(e,r),(v,S)=>(e.info({...S,type:v,endpoint:a,token:s},"Analytics request"),S)]},i);return u||h.disable(),h},nl=()=>{let t=Mt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};m();d();f();p();function Zm(e){let t=eg(e),r=[e,...t].filter(i=>i.parentResult).map(i=>i.parentResult);return lp([e,...t,...r],i=>i.uniqueId)}function eg(e){return e.childResults?e.childResults.flatMap(t=>[t,...eg(t)]):[]}m();d();f();p();var js=()=>"";function tg(e,t){return{...new lr(t).getBaseMetadata(),actionCause:e,type:e}}function Dx(e){return Object.assign(e,{instantlyCallable:!0})}function Mx(e,t){let r=o=>Dx(ve(e,o)),n=r(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(o,{getState:s,extra:a}){let{analyticsClientMiddleware:c,preprocessRequest:u,logger:h}=a;return yield(yield t({getState:s,analyticsClientMiddleware:c,preprocessRequest:u,logger:h})).log({state:s(),extra:a})});return function(_x32,_x33){return _ref14.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref15=_asyncToGenerator(function*({getState:o,analyticsClientMiddleware:s,preprocessRequest:a,logger:c}){let{description:u,log:h}=yield t({getState:o,analyticsClientMiddleware:s,preprocessRequest:a,logger:c});return{description:u,action:r(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(v,{getState:S,extra:g}){return yield h({state:S(),extra:g})});return function(_x35,_x36){return _ref16.apply(this,arguments)}}())}});return function prepare(_x34){return _ref15.apply(this,arguments)}}()}),n}var rg=(e,t,r)=>{function n(...i){let o=i.length===1?{...i[0],__legacy__getBuilder:t(i[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:r}:{prefix:i[0],__legacy__getBuilder:t(i[1]),__legacy__provider:i[2],analyticsConfigurator:e,providerClass:r};return Lx(o)}return n},jx=e=>e.configuration.analytics.analyticsMode==="legacy",qx=e=>e.configuration.analytics.analyticsMode==="next",Lx=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:i,analyticsConfigurator:o,providerClass:s})=>(r??(r=a=>new s(a)),Mx(e,/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*({getState:a,analyticsClientMiddleware:c,preprocessRequest:u,logger:h}){let v=[],S={log:function(){var _ref18=_asyncToGenerator(function*({state:x}){for(let I of v)yield I(x)});return function log(_x38){return _ref18.apply(this,arguments)}}()},g=a(),y=o({getState:a,logger:h,analyticsClientMiddleware:c,preprocessRequest:u,provider:r(a)}),C=yield t(y,a());S.description=C?.description,v.push(/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(x){jx(x)&&(yield Ux(C,r,x,h,y.coveoAnalyticsClient))});return function(_x39){return _ref19.apply(this,arguments)}}());let{emit:E}=$i(g);return v.push(/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(x){if(qx(x)&&i&&n){let I=n(x);yield Wx(E,i,I)}});return function(_x40){return _ref20.apply(this,arguments)}}()),S});return function(_x37){return _ref17.apply(this,arguments)}}()));function Ux(_x41,_x42,_x43,_x44,_x45){return _Ux.apply(this,arguments)}function _Ux(){_Ux=_asyncToGenerator(function*(e,t,r,n,i){t(()=>r);let o=yield e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:i,response:o},"Analytics response")});return _Ux.apply(this,arguments)}var Vx=e=>r=>(n,i)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref21=_asyncToGenerator(function*(o){r(n,i)});return function log(_x46){return _ref21.apply(this,arguments)}}()}),et=rg(e=>Jm({...e,provider:e.provider||new lr(e.getState)}),e=>e,lr),pt=rg(Dm,Vx("caseAssist"),Zi);var il=(e,t)=>{let r=o=>o+(t.pagination?.firstResult??0),n=-1,i=t.search?.results;return n=og(e,i),n<0&&(n=zx(e,i)),n<0&&(n=0),Bx(e,r(n),t)};function Bx(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:Qx(e),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:Hx(e),queryPipeline:r.pipeline||js()}}var ol=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||""}),ng={urihash:new J,sourcetype:new J,permanentid:new J},ig={uniqueId:te,raw:new xe({values:ng}),title:te,uri:te,clickUri:te,rankingModifier:new J({required:!1,emptyAllowed:!0})};function Gx(e){return Object.assign({},...Object.keys(ng).map(t=>({[t]:e[t]})))}function $x(e){return Object.assign({},...Object.keys(ig).map(t=>({[t]:e[t]})),{raw:Gx(e.raw)})}function Qx(e){let t=e.raw.author;return ie(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function Hx(e){let t=e.raw.source;return ie(t)?"unknown":t}var sl=e=>new xt(ig).validate($x(e));function zx(e,t){for(let[r,n]of t.entries()){let i=Zm(n);if(og(e,i)!==-1)return r}return-1}function og(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function Wx(_x47,_x48,_x49){return _Wx.apply(this,arguments)}function _Wx(){_Wx=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _Wx.apply(this,arguments)}m();d();f();p();var zn=e=>et({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(t,r)=>{let n=Br(r),i=e?!r.generatedAnswer?.answer||!r.generatedAnswer?.answer.length:void 0;return n?t.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:n,answerGenerated:e,answerTextIsEmpty:i}):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:t=>({answerId:Br(t)??"",answerGenerated:e??!1})}),Wn=()=>et({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:e=>({answerId:Br(e)??"",responseId:e.search?.searchResponseId||e.search?.response.searchUid||""})});m();d();f();p();m();d();f();p();var sg=De(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:i}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(i&&{lq:i})}});m();d();f();p();var $r=(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:jn(e)}});m();d();f();p();var ag=e=>e.context;m();d();f();p();var al=e=>e.pipeline;m();d();f();p();m();d();f();p();var ro=Ct(qs(),1),fg=Ct(cg(),1);m();d();f();p();var lg=Ct(qs(),1),dg=Ct(ug(),1);lg.default.extend(dg.default);var Kx="YYYY/MM/DD@HH:mm:ss";function pg(e){return e.format(Kx)}ro.default.extend(fg.default);var Yx=["past","now","next"],Xx=["minute","hour","day","week","month","quarter","year"];function Jx(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,ro.default)().subtract(r,n);case"next":return(0,ro.default)().add(r,n);case"now":return(0,ro.default)()}}function ml(e){return pg(Jx(Zx(e)))}function mg(e){return e.toLocaleLowerCase().split("-")}function gl(e){let[t,r,n]=mg(e);if(t==="now")return!0;if(!Yx.includes(t)||!Xx.includes(n))return!1;let i=parseInt(r);return!(Number.isNaN(i)||i<=0)}function Zx(e){let[t,r,n]=mg(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r):void 0,unit:n||void 0}}m();d();f();p();function gg(e){return e.type==="dateRange"}function hg(e){return`start${e}`}function yg(e){return`end${e}`}var hl=()=>({dateFacetValueMap:{}});function eE(e,t,r){let n=e.start,i=e.end;return gl(n)&&(n=ml(n),r.dateFacetValueMap[t][hg(n)]=e.start),gl(i)&&(i=ml(i),r.dateFacetValueMap[t][yg(i)]=e.end),{...e,start:n,end:i}}function yl(e,t){if(gg(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(i=>eE(i,r,t))}}return e}function dr(e){let t=hl();return{request:{...e,facets:e.facets?.map(n=>yl(n,t))},mappings:t}}function tE(e,t,r){return{...e,start:r.dateFacetValueMap[t][hg(e.start)]||e.start,end:r.dateFacetValueMap[t][yg(e.end)]||e.end}}function rE(e,t){return e.facetId in t.dateFacetValueMap}function nE(e,t){return rE(e,t)?{...e,values:e.values.map(r=>tE(r,e.facetId,t))}:e}function Ls(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>nE(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function pr(e){return Object.values(e).map(t=>t.request)}function vl(e,t){let r={};e.forEach(o=>{r[o.facetId]=o});let n=[];t.forEach(o=>{o in r&&(n.push(r[o]),delete r[o])});let i=Object.values(r);return[...n,...i]}function vg(e){return pr(e).map(t=>{let n=t.currentValues.some(({state:i})=>i!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Sl={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function iE(e){return pr(e).map(t=>{let r=Sl[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function oE(e){return[...iE(e.facetSet??{}),...vg(e.numericFacetSet??{}),...vg(e.dateFacetSet??{}),...pr(e.categoryFacetSet??{})]}function sE(e){return oE(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function Us(e){return vl(sE(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();m();d();f();p();var Sg=/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield $n(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}),...(nl()&&{pageId:nl()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:jn(e)})}}});return function Sg(_x50,_x51){return _ref22.apply(this,arguments)}}();var Kn=/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??wn(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:Mt.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 Sg(e.configuration.analytics,t))),...(e.excerptLength&&!ie(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function Kn(_x52,_x53){return _ref23.apply(this,arguments)}}();m();d();f();p();var Vs=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??wn(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&&$r(e.configuration.analytics,t,r)),...(e.excerptLength&&!ie(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});m();d();f();p();var Ag=De(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(o=>o.state==="selected"&&!!o.expression.trim()),i=n.map(o=>o.expression).join(" OR ");return n.length>1?`(${i})`:i}));var fr=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t,r){let n=bl(e),i=aE(e),o=cE(e),s=e.configuration.analytics.analyticsMode==="legacy"?yield Kn(e,r):Vs(e,t,r);return dr({...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}),...(i.length&&{facets:i}),...(e.pagination&&{numberOfResults:Al(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:o}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function fr(_x54,_x55,_x56){return _ref24.apply(this,arguments)}}();function Al(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function aE(e){return vl(lE(e),e.facetOrder??[])}function cE(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(uE).filter(r=>r.currentValues.length>0):void 0}function uE(e){let{field:t,label:r,values:n}=e,i=n.filter(o=>o.state==="selected");return{field:t,label:r,currentValues:i}}function lE(e){return dE(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function dE(e){return[...pE(e.facetSet??{}),...bg(e.numericFacetSet??{}),...bg(e.dateFacetSet??{}),...pr(e.categoryFacetSet??{})]}function pE(e){return pr(e).map(t=>{let r=Sl[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function bg(e){return pr(e).map(t=>{let r=t.currentValues,n=r.some(({state:o})=>o!=="idle"),i=r.some(o=>o.previousState);return t.generateAutomaticRanges&&!n&&!i?{...t,currentValues:[]}:t})}function bl(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(o=>o.isActive)?.expression.trim()||"",i=Ag(e);return[t,n,...i].filter(o=>!!o).join(" AND ")}m();d();f();p();m();d();f();p();var io=(e,t)=>{let r=e;return ie(r[t])?ie(e.raw[t])?null:e.raw[t]:r[t]},fE=e=>t=>e.every(r=>!ie(io(t,r))),mE=e=>t=>e.every(r=>ie(io(t,r))),gE=(e,t)=>r=>{let n=wg(e,r);return t.some(i=>n.some(o=>`${o}`.toLowerCase()===i.toLowerCase()))},hE=(e,t)=>r=>{let n=wg(e,r);return t.every(i=>n.every(o=>`${o}`.toLowerCase()!==i.toLowerCase()))},wg=(e,t)=>{let r=io(t,e);return up(r)?r:[r]},Cg={getResultProperty:io,fieldsMustBeDefined:fE,fieldsMustNotBeDefined:mE,fieldMustMatch:gE,fieldMustNotMatch:hE};var wl=De(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var Cl=e=>e.searchHub;m();d();f();p();var xl=De(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),Z2=De(e=>e,e=>{let t=xl(e);return t&&e?e[t].expression:""});m();d();f();p();var xg=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var Eg=e=>e.excerptLength?.length;m();d();f();p();var Rg=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var Ig=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 Tg=e=>e.sortCriteria;var _g=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:qe(e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function _g(_x57){return _ref25.apply(this,arguments)}}(),kg=(e,t)=>{let r=Lr(e)?.q,{aq:n,cq:i,dq:o,lq:s}=vE(e),a=ag(e),c=$r(e.configuration.analytics,t,{actionCause:wl(e)}),u=Cl(e),h=al(e),v=Yu(e)??[],S=Pg(e),g=xl(e.tabSet)||"default",y=Wu(e),C=Um(e),E=t.referrer||"",x=Rg(e),I=Tg(e),T=yE(e),_=Eg(e),M=Ig(e),P=xg(e);return{q:r,...(n&&{aq:n}),...(i&&{cq:i}),...(o&&{dq:o}),...(s&&{lq:s}),...(e.query&&{enableQuerySyntax:pm(e)}),...(a?.contextValues&&{context:a.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(u?.length&&{searchHub:u}),...(h?.length&&{pipeline:h}),...(S.length&&{facets:S}),...(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:Al(e),firstResult:e.pagination.firstResult}),tab:g,locale:y,timezone:C,...(e.debug!==void 0&&{debug:e.debug}),referrer:E,...T,...(M??{}),...(_&&{excerptLength:_}),...(P&&{dictionaryFieldContext:P}),sortCriteria:I,...(x&&{facetOptions:x}),...c,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Og=(e,t)=>{let r=Lr(e)?.q,n=Pg(e),i=$r(e.configuration.analytics,t,{actionCause:wl(e)}),o=Wu(e),s=Cl(e),a=al(e),c=Yu(e)??[];return{q:r||"",...(n.length&&{facets:n}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:c}},...(s?.length&&{searchHub:s}),...(a?.length&&{pipeline:a}),...i,locale:o}},Pg=e=>Us(e)?.map(t=>yl(t,hl())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),yE=e=>({actionsHistory:e.configuration.analytics.enabled?Mt.getInstance().getHistory():[]}),vE=e=>{let t=sg(e),r=bl(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var Yn=["searching","thinking","answering"];m();d();f();p();var Ng=["text/plain","text/markdown"];var Xn=new J({required:!0}),Fg=new J,Jn=new Fe({required:!0}),El={id:Xn,title:Xn,uri:Xn,permanentid:Xn,clickUri:Fg},Bs=new J({required:!0,constrainTo:Ng}),SG=q("generatedAnswer/setIsVisible",e=>z(e,Jn)),Gs=q("generatedAnswer/setAnswerId",e=>z(e,te)),AG=q("generatedAnswer/setAnswerGenerationMode",e=>z(e,new J({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),bG=q("generatedAnswer/setIsEnabled",e=>z(e,Jn)),so=q("generatedAnswer/updateMessage",e=>z(e,{textDelta:Xn})),ao=q("generatedAnswer/updateCitations",e=>z(e,{citations:new Et({required:!0,each:new xe({values:El})})})),co=q("generatedAnswer/updateError",e=>z(e,{message:Fg,code:new Le({min:0})})),$s=q("generatedAnswer/resetAnswer"),wG=q("generatedAnswer/like"),CG=q("generatedAnswer/dislike"),xG=q("generatedAnswer/feedbackModal/open"),EG=q("generatedAnswer/expand"),RG=q("generatedAnswer/collapse"),IG=q("generatedAnswer/setId",e=>z(e,{id:new J({required:!0})})),TG=q("generatedAnswer/feedbackModal/close"),_G=q("generatedAnswer/sendFeedback"),mr=q("generatedAnswer/setIsLoading",e=>z(e,Jn)),oo=q("generatedAnswer/setIsStreaming",e=>z(e,Jn)),uo=q("generatedAnswer/setAnswerContentFormat",e=>z(e,Bs)),kG=q("generatedAnswer/updateResponseFormat",e=>z(e,{contentFormat:new Et({each:Bs,default:["text/plain"]})})),OG=q("knowledge/updateAnswerConfigurationId",e=>z(e,Xn)),PG=q("generatedAnswer/registerFieldsToIncludeInCitations",e=>z(e,hf)),Rl=q("generatedAnswer/setIsAnswerGenerated",e=>z(e,Jn)),lo=q("generatedAnswer/setCannotAnswer",e=>z(e,Jn)),SE=q("generatedAnswer/setAnswerApiQueryParams",e=>z(e,new xe({}))),Dg=q("generatedAnswer/startStep",e=>z(e,{name:new J({required:!0,constrainTo:Yn}),startedAt:new Le({min:0,required:!0})})),Mg=q("generatedAnswer/finishStep",e=>z(e,{name:new J({required:!0,constrainTo:Yn}),finishedAt:new Le({min:0,required:!0})})),NG=ve("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:i,getState:o}=t,{search:s}=o(),{queryExecuted:a}=s,{setAbortControllerRef:c}=e,u=yield _g(r),h=(g,y)=>{switch(g){case"genqa.headerMessageType":{let C=JSON.parse(y);n(uo(C.contentFormat));break}case"genqa.messageType":n(so(JSON.parse(y)));break;case"genqa.citationsType":n(ao(JSON.parse(y)));break;case"genqa.endOfStreamType":{let C=JSON.parse(y).answerGenerated,E=a.length!==0&&!C;n(lo(E)),n(oo(!1)),n(Rl(C)),n(zn(C)),n(Wn());break}default:r.debug&&i.logger.warn(`Unknown payloadType: "${g}"`)}};n(mr(!0));let v=g=>g.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,S=i.streamingClient?.streamGeneratedAnswer(u,{write:g=>{v(u)&&(n(mr(!1)),g.payload&&g.payloadType&&h(g.payloadType,g.payload))},abort:g=>{v(u)&&n(co(g))},close:()=>{v(u)&&n(oo(!1))},resetAnswer:()=>{v(u)&&n($s())}});S?c(S):n(mr(!1))});return function(_x58,_x59){return _ref26.apply(this,arguments)}}()),FG=ve("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:i}}){r($s());let o=t();if(o.generatedAnswer.answerConfigurationId){let s=kg(o,n);r(SE(s)),yield r(jg(s))}else i.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.")});return function(_x60,_x61){return _ref27.apply(this,arguments)}}());m();d();f();p();m();d();f();p();function Lg(_x62,_x63){return _Lg.apply(this,arguments)}function _Lg(){_Lg=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _Lg.apply(this,arguments)}function Ug(e){let t,r,n,i=!1;return function(s){t===void 0?(t=s,r=0,n=-1):t=bE(t,s);let a=t.length,c=0;for(;r<a;){i&&(t[r]===10&&(c=++r),i=!1);let u=-1;for(;r<a&&u===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-c);break;case 13:i=!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 Vg(e,t,r){let n=qg(),i=new TextDecoder;return function(s,a){if(s.length===0)r?.(n),n=qg();else if(a>0){let c=i.decode(s.subarray(0,a)),u=a+(s[a+1]===32?2:1),h=i.decode(s.subarray(u));switch(c){case"data":n.data=n.data?`${n.data}
|
|
31
|
+
${h}`:h;break;case"event":n.event=h;break;case"id":e(n.id=h);break;case"retry":AE(h,n,t);break}}}}function AE(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function bE(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function qg(){return{data:"",event:"",id:"",retry:void 0}}var Il="text/event-stream",wE=1e3,Bg="last-event-id";function Gg(){return typeof window<"u"}function $g(e,{signal:t,headers:r,onopen:n,onmessage:i,onclose:o,onerror:s,openWhenHidden:a,fetch:c,...u}){return new Promise((h,v)=>{let S={...r};S.accept||(S.accept=Il);let g;function y(){g?.abort(),document.hidden||_()}!a&&Gg()&&document.addEventListener("visibilitychange",y);let C=wE,E;function x(){Gg()&&document.removeEventListener("visibilitychange",y),clearTimeout(E),g?.abort()}t?.addEventListener("abort",()=>{x(),h()});let I=c??b,T=n??CE;function _(){return _2.apply(this,arguments)}function _2(){_2=_asyncToGenerator(function*(){g=l.AbortController?new l.AbortController:null;try{let M=yield I(e,{...u,headers:S,signal:g?.signal});yield T(M),yield Lg(M.body,Ug(Vg(P=>{P?S[Bg]=P:delete S[Bg]},P=>{C=P},i))),o?.(),x(),h()}catch(M){if(!g?.signal?.aborted)try{let P=s?.(M)??C;clearTimeout(E),E=setTimeout(_,P)}catch(P){x(),v(P)}}});return _2.apply(this,arguments)}_()})}function CE(e){let t=e.headers.get("content-type");if(!t?.startsWith(Il))throw new Error(`Expected content-type to be ${Il}, Actual: ${t}`)}m();d();f();p();var xE=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:i,environment:o,organizationId:s}=n.configuration,a=n.generatedAnswer.answerConfigurationId,c={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${i}`}};try{let u=qe(s,o);return{data:im({baseUrl:`${u}/rest/organizations/${s}/answer/v1/configs/${a}`,fetchFn:function(){var _ref29=_asyncToGenerator(function*(v){if(v instanceof String)throw new Error("The provided 'request' must be a Request object.");let S=v.url,g={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(y=>{g[y]=v[y]}),g.duplex="half",g.body=yield v.text(),b(S,g)});return function fetchFn(_x67){return _ref29.apply(this,arguments)}}()})(c,{...t,signal:null},r)}}catch(u){return{error:u}}});return function xE(_x64,_x65,_x66){return _ref28.apply(this,arguments)}}(),Qg=dm({reducerPath:"answer",baseQuery:om(xE,{maxRetries:3}),endpoints:()=>({})});var EE=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},RE=(e,t)=>{e.answer===void 0?e.answer=t.textDelta:typeof t.textDelta=="string"&&(e.answer=e.answer.concat(t.textDelta))},IE=(e,t)=>{e.citations=t.citations},TE=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},_E=(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})`)},kE=(e,t,r)=>{let n=JSON.parse(e.data);n.finishReason==="ERROR"&&n.errorMessage&&_E(t,n);let i=n.payload.length?JSON.parse(n.payload):{};switch(n.payloadType){case"genqa.headerMessageType":i.contentFormat&&(EE(t,i),r(uo(i.contentFormat)));break;case"genqa.messageType":i.textDelta&&(RE(t,i),r(so({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(IE(t,i),r(ao({citations:i.citations})));break;case"genqa.endOfStreamType":TE(t,i),r(zn(i.answerGenerated??!1)),r(Wn());break}},OE=(e,t,r,n)=>{if(!e||!t||!r)throw new Error("Missing required parameters for answer endpoint");let i=`/rest/organizations/${t}`,o=n?`insight/v1/configs/${n}/answer`:"answer/v1/configs";return`${e}${i}/${o}/${r}/generate`},Tl=Qg.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,...i}=r;return`${t}(${JSON.stringify(i)})`},onCacheEntryAdded(_x68,_x69){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:i,dispatch:o}){yield n;let{configuration:s,generatedAnswer:a,insightConfiguration:c}=r(),{organizationId:u,environment:h,accessToken:v}=s,S=qe(u,h),g=OE(S,u,a.answerConfigurationId,c?.insightId);yield $g(g,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${v}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:b,onopen:function(){var _ref30=_asyncToGenerator(function*(y){let C=y.headers.get("x-answer-id");C&&i(E=>{E.answerId=C,o(Gs(C))})});return function onopen(_x70){return _ref30.apply(this,arguments)}}(),onmessage:y=>{i(C=>{kE(y,C,o)})},onerror:y=>{throw y},onclose:()=>{i(y=>{o(lo(!y.generated))})}})}).apply(this,arguments)}})})}),jg=e=>Tl.endpoints.getAnswer.initiate(e);m();d();f();p();var Hg=Ve(Fn,e=>e);m();d();f();p();function PE(e){let t=e.payload?.analyticsAction;return zg(e)&&!ie(t)}function zg(e){return"type"in e}var Wg=e=>t=>r=>{let n;PE(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let i=t(r);return zg(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),i};m();d();f();p();m();d();f();p();m();d();f();p();var O$=q("tab/register",e=>{let t=new xe({values:{id:te,expression:Rt}});return z(e,t)}),Kg=q("tab/updateActiveTab",e=>z(e,te));m();d();f();p();var Qs=Ct(qs(),1),Jg=Ct(Yg(),1),Zg=Ct(Xg(),1);Qs.default.extend(Zg.default);Qs.default.extend(Jg.default);var eh=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:Qs.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 NE=/(^|; )Coveo-Pendragon=([^;]*)/;function Nl(){return typeof window>"u"?!1:NE.exec(document.cookie)?.pop()||null}var th=Ve(eh(),e=>e.addCase(Dn,(t,r)=>{FE(t,r.payload)}).addCase(ss,(t,r)=>{DE(t,r.payload)}).addCase(as,(t,r)=>{ME(t,r.payload)}).addCase(cs,t=>{t.analytics.enabled=!1}).addCase(us,t=>{t.analytics.enabled=!0}).addCase(If,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(Tf,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(Kg,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(bf,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(ns,(t,r)=>{ie(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(_f,(t,{payload:r})=>{t.knowledge.agentId=r}));function FE(e,t){ie(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ie(t.organizationId)||(e.organizationId=t.organizationId)}function DE(e,t){ie(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),ie(t.locale)||(e.search.locale=t.locale),ie(t.timezone)||(e.search.timezone=t.timezone),ie(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function ME(e,t){ie(t.enabled)||(e.analytics.enabled=t.enabled),ie(t.originContext)||(e.analytics.originContext=t.originContext),ie(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),ie(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),ie(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),ie(t.trackingId)||(e.analytics.trackingId=t.trackingId),ie(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),ie(t.source)||(e.analytics.source=t.source);try{let r=Nl();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}ie(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),ie(t.anonymous)||(e.analytics.anonymous=t.anonymous),ie(t.deviceId)||(e.analytics.deviceId=t.deviceId),ie(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),ie(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}var ft=th;m();d();f();p();function jE(e){return e.instantlyCallable}var rh=()=>e=>t=>e(jE(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 Ye=[];for(let e=0;e<256;++e)Ye.push((e+256).toString(16).slice(1));function nh(e,t=0){return(Ye[e[t+0]]+Ye[e[t+1]]+Ye[e[t+2]]+Ye[e[t+3]]+"-"+Ye[e[t+4]]+Ye[e[t+5]]+"-"+Ye[e[t+6]]+Ye[e[t+7]]+"-"+Ye[e[t+8]]+Ye[e[t+9]]+"-"+Ye[e[t+10]]+Ye[e[t+11]]+Ye[e[t+12]]+Ye[e[t+13]]+Ye[e[t+14]]+Ye[e[t+15]]).toLowerCase()}m();d();f();p();var Fl,qE=new Uint8Array(16);function Dl(){if(!Fl){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Fl=crypto.getRandomValues.bind(crypto)}return Fl(qE)}m();d();f();p();m();d();f();p();var LE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ml={randomUUID:LE};function UE(e,t,r){if(Ml.randomUUID&&!t&&!e)return Ml.randomUUID();e=e||{};let n=e.random??e.rng?.()??Dl();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 i=0;i<16;++i)t[r+i]=n[i];return t}return nh(n)}var gr=UE;m();d();f();p();m();d();f();p();var R={};Io(R,{BRAND:()=>pR,DIRTY:()=>Qr,EMPTY_PATH:()=>$E,INVALID:()=>oe,NEVER:()=>YR,OK:()=>tt,ParseStatus:()=>Xe,Schema:()=>fe,ZodAny:()=>vr,ZodArray:()=>rr,ZodBigInt:()=>zr,ZodBoolean:()=>Wr,ZodBranded:()=>fo,ZodCatch:()=>sn,ZodDate:()=>Kr,ZodDefault:()=>on,ZodDiscriminatedUnion:()=>Ws,ZodEffects:()=>At,ZodEnum:()=>rn,ZodError:()=>st,ZodFirstPartyTypeKind:()=>se,ZodFunction:()=>Ys,ZodIntersection:()=>Zr,ZodIssueCode:()=>H,ZodLazy:()=>en,ZodLiteral:()=>tn,ZodMap:()=>ii,ZodNaN:()=>si,ZodNativeEnum:()=>nn,ZodNever:()=>Tt,ZodNull:()=>Xr,ZodNullable:()=>Lt,ZodNumber:()=>Hr,ZodObject:()=>at,ZodOptional:()=>vt,ZodParsedType:()=>X,ZodPipeline:()=>mo,ZodPromise:()=>Sr,ZodReadonly:()=>an,ZodRecord:()=>Ks,ZodSchema:()=>fe,ZodSet:()=>oi,ZodString:()=>yr,ZodSymbol:()=>ri,ZodTransformer:()=>At,ZodTuple:()=>qt,ZodType:()=>fe,ZodUndefined:()=>Yr,ZodUnion:()=>Jr,ZodUnknown:()=>tr,ZodVoid:()=>ni,addIssueToContext:()=>Y,any:()=>bR,array:()=>ER,bigint:()=>hR,boolean:()=>mh,coerce:()=>KR,custom:()=>dh,date:()=>yR,datetimeRegex:()=>uh,defaultErrorMap:()=>Zt,discriminatedUnion:()=>_R,effect:()=>VR,enum:()=>qR,function:()=>DR,getErrorMap:()=>Zn,getParsedType:()=>jt,instanceof:()=>mR,intersection:()=>kR,isAborted:()=>Hs,isAsync:()=>ei,isDirty:()=>zs,isValid:()=>hr,late:()=>fR,lazy:()=>MR,literal:()=>jR,makeIssue:()=>po,map:()=>NR,nan:()=>gR,nativeEnum:()=>LR,never:()=>CR,null:()=>AR,nullable:()=>GR,number:()=>fh,object:()=>RR,objectUtil:()=>jl,oboolean:()=>WR,onumber:()=>zR,optional:()=>BR,ostring:()=>HR,pipeline:()=>QR,preprocess:()=>$R,promise:()=>UR,quotelessJson:()=>VE,record:()=>PR,set:()=>FR,setErrorMap:()=>GE,strictObject:()=>IR,string:()=>ph,symbol:()=>vR,transformer:()=>VR,tuple:()=>OR,undefined:()=>SR,union:()=>TR,unknown:()=>wR,util:()=>ye,void:()=>xR});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var ye;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},e.getValidEnumValues=i=>{let o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},e.find=(i,o)=>{for(let s of i)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(ye||(ye={}));var jl;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(jl||(jl={}));var X=ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),jt=e=>{switch(typeof e){case"undefined":return X.undefined;case"string":return X.string;case"number":return Number.isNaN(e)?X.nan:X.number;case"boolean":return X.boolean;case"function":return X.function;case"bigint":return X.bigint;case"symbol":return X.symbol;case"object":return Array.isArray(e)?X.array:e===null?X.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?X.promise:typeof Map<"u"&&e instanceof Map?X.map:typeof Set<"u"&&e instanceof Set?X.set:typeof Date<"u"&&e instanceof Date?X.date:X.object;default:return X.unknown}};var H=ye.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"]),VE=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),st=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(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(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 i(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,ye.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};st.create=e=>new st(e);var BE=(e,t)=>{let r;switch(e.code){case H.invalid_type:e.received===X.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case H.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ye.jsonStringifyReplacer)}`;break;case H.unrecognized_keys:r=`Unrecognized key(s) in object: ${ye.joinValues(e.keys,", ")}`;break;case H.invalid_union:r="Invalid input";break;case H.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ye.joinValues(e.options)}`;break;case H.invalid_enum_value:r=`Invalid enum value. Expected ${ye.joinValues(e.options)}, received '${e.received}'`;break;case H.invalid_arguments:r="Invalid function arguments";break;case H.invalid_return_type:r="Invalid function return type";break;case H.invalid_date:r="Invalid date";break;case H.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}"`:ye.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case H.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 H.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 H.custom:r="Invalid input";break;case H.invalid_intersection_types:r="Intersection results could not be merged";break;case H.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case H.not_finite:r="Number must be finite";break;default:r=t.defaultError,ye.assertNever(e)}return{message:r}},Zt=BE;var ih=Zt;function GE(e){ih=e}function Zn(){return ih}m();d();f();p();var po=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...(i.path||[])],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...i,path:o,message:a}},$E=[];function Y(e,t){let r=Zn(),n=po({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Zt?void 0:Zt].filter(i=>!!i)});e.common.issues.push(n)}var Xe=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 i of r){if(i.status==="aborted")return oe;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let i of r){let o=yield i.key,s=yield i.value;n.push({key:o,value:s})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return oe;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:t.value,value:n}}},oe=Object.freeze({status:"aborted"}),Qr=e=>({status:"dirty",value:e}),tt=e=>({status:"valid",value:e}),Hs=e=>e.status==="aborted",zs=e=>e.status==="dirty",hr=e=>e.status==="valid",ei=e=>typeof Promise<"u"&&e instanceof Promise;m();d();f();p();m();d();f();p();var Z;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Z||(Z={}));var St=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}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}},oh=(e,t)=>{if(hr(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 st(e.common.issues);return this._error=r,this._error}}};function de(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=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:i}:{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:i}}var fe=class{get description(){return this._def.description}_getType(t){return jt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:jt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Xe,ctx:{common:t.parent.common,data:t.data,parsedType:jt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(ei(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:jt(t)},i=this._parseSync({data:t,path:n.path,parent:n});return oh(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:jt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return hr(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=>hr(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:jt(t)},i=_this8._parse({data:t,path:n.path,parent:n}),o=yield ei(i)?i:Promise.resolve(i);return oh(n,o)})()}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=t(i),a=()=>o.addIssue({code:H.custom,...n(i)});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,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new At({schema:this,typeName:se.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 vt.create(this,this._def)}nullable(){return Lt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rr.create(this)}promise(){return Sr.create(this,this._def)}or(t){return Jr.create([this,t],this._def)}and(t){return Zr.create(this,t,this._def)}transform(t){return new At({...de(this._def),schema:this,typeName:se.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new on({...de(this._def),innerType:this,defaultValue:r,typeName:se.ZodDefault})}brand(){return new fo({typeName:se.ZodBranded,type:this,...de(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new sn({...de(this._def),innerType:this,catchValue:r,typeName:se.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return mo.create(this,t)}readonly(){return an.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},QE=/^c[^\s-]{8,}$/i,HE=/^[0-9a-z]+$/,zE=/^[0-9A-HJKMNP-TV-Z]{26}$/i,WE=/^[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,KE=/^[a-z0-9_-]{21}$/i,YE=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,XE=/^[-+]?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)?)??$/,JE=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ZE="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ql,eR=/^(?:(?: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])$/,tR=/^(?:(?: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])$/,rR=/^(([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]))$/,nR=/^(([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])$/,iR=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,oR=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ah="((\\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])))",sR=new RegExp(`^${ah}$`);function ch(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 aR(e){return new RegExp(`^${ch(e)}$`)}function uh(e){let t=`${ah}T${ch(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 cR(e,t){return!!((t==="v4"||!t)&&eR.test(e)||(t==="v6"||!t)&&rR.test(e))}function uR(e,t){if(!YE.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,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function lR(e,t){return!!((t==="v4"||!t)&&tR.test(e)||(t==="v6"||!t)&&nR.test(e))}var yr=class e extends fe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==X.string){let o=this._getOrReturnCtx(t);return Y(o,{code:H.invalid_type,expected:X.string,received:o.parsedType}),oe}let n=new Xe,i;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),Y(i,{code:H.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),Y(i,{code:H.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=t.data.length>o.value,a=t.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(t,i),s?Y(i,{code:H.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&Y(i,{code:H.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")JE.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"email",code:H.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")ql||(ql=new RegExp(ZE,"u")),ql.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"emoji",code:H.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")WE.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"uuid",code:H.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")KE.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"nanoid",code:H.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")QE.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"cuid",code:H.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")HE.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"cuid2",code:H.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")zE.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"ulid",code:H.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Y(i,{validation:"url",code:H.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"regex",code:H.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),Y(i,{code:H.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),Y(i,{code:H.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),Y(i,{code:H.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?uh(o).test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{code:H.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?sR.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{code:H.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?aR(o).test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{code:H.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?XE.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"duration",code:H.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?cR(t.data,o.version)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"ip",code:H.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?uR(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"jwt",code:H.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?lR(t.data,o.version)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"cidr",code:H.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?iR.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"base64",code:H.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?oR.test(t.data)||(i=this._getOrReturnCtx(t,i),Y(i,{validation:"base64url",code:H.invalid_string,message:o.message}),n.dirty()):ye.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:H.invalid_string,...Z.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Z.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Z.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Z.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Z.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Z.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Z.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Z.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Z.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Z.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Z.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Z.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Z.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Z.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,...Z.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,...Z.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Z.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Z.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...Z.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Z.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Z.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Z.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Z.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Z.errToObj(r)})}nonempty(t){return this.min(1,Z.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}};yr.create=e=>new yr({checks:[],typeName:se.ZodString,coerce:e?.coerce??!1,...de(e)});function dR(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return o%s/10**i}var Hr=class e extends fe{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)!==X.number){let o=this._getOrReturnCtx(t);return Y(o,{code:H.invalid_type,expected:X.number,received:o.parsedType}),oe}let n,i=new Xe;for(let o of this._def.checks)o.kind==="int"?ye.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),Y(n,{code:H.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),Y(n,{code:H.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),Y(n,{code:H.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?dR(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),Y(n,{code:H.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),Y(n,{code:H.not_finite,message:o.message}),i.dirty()):ye.assertNever(o);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Z.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Z.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Z.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Z.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Z.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Z.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Z.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Z.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Z.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Z.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Z.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Z.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Z.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Z.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"&&ye.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)}};Hr.create=e=>new Hr({checks:[],typeName:se.ZodNumber,coerce:e?.coerce||!1,...de(e)});var zr=class e extends fe{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)!==X.bigint)return this._getInvalidInput(t);let n,i=new Xe;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),Y(n,{code:H.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),Y(n,{code:H.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),Y(n,{code:H.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):ye.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Y(r,{code:H.invalid_type,expected:X.bigint,received:r.parsedType}),oe}gte(t,r){return this.setLimit("min",t,!0,Z.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Z.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Z.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Z.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Z.toString(i)}]})}_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:Z.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Z.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Z.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Z.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Z.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}};zr.create=e=>new zr({checks:[],typeName:se.ZodBigInt,coerce:e?.coerce??!1,...de(e)});var Wr=class extends fe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==X.boolean){let n=this._getOrReturnCtx(t);return Y(n,{code:H.invalid_type,expected:X.boolean,received:n.parsedType}),oe}return tt(t.data)}};Wr.create=e=>new Wr({typeName:se.ZodBoolean,coerce:e?.coerce||!1,...de(e)});var Kr=class e extends fe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==X.date){let o=this._getOrReturnCtx(t);return Y(o,{code:H.invalid_type,expected:X.date,received:o.parsedType}),oe}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return Y(o,{code:H.invalid_date}),oe}let n=new Xe,i;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),Y(i,{code:H.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),Y(i,{code:H.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ye.assertNever(o);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:Z.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Z.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}};Kr.create=e=>new Kr({checks:[],coerce:e?.coerce||!1,typeName:se.ZodDate,...de(e)});var ri=class extends fe{_parse(t){if(this._getType(t)!==X.symbol){let n=this._getOrReturnCtx(t);return Y(n,{code:H.invalid_type,expected:X.symbol,received:n.parsedType}),oe}return tt(t.data)}};ri.create=e=>new ri({typeName:se.ZodSymbol,...de(e)});var Yr=class extends fe{_parse(t){if(this._getType(t)!==X.undefined){let n=this._getOrReturnCtx(t);return Y(n,{code:H.invalid_type,expected:X.undefined,received:n.parsedType}),oe}return tt(t.data)}};Yr.create=e=>new Yr({typeName:se.ZodUndefined,...de(e)});var Xr=class extends fe{_parse(t){if(this._getType(t)!==X.null){let n=this._getOrReturnCtx(t);return Y(n,{code:H.invalid_type,expected:X.null,received:n.parsedType}),oe}return tt(t.data)}};Xr.create=e=>new Xr({typeName:se.ZodNull,...de(e)});var vr=class extends fe{constructor(){super(...arguments),this._any=!0}_parse(t){return tt(t.data)}};vr.create=e=>new vr({typeName:se.ZodAny,...de(e)});var tr=class extends fe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return tt(t.data)}};tr.create=e=>new tr({typeName:se.ZodUnknown,...de(e)});var Tt=class extends fe{_parse(t){let r=this._getOrReturnCtx(t);return Y(r,{code:H.invalid_type,expected:X.never,received:r.parsedType}),oe}};Tt.create=e=>new Tt({typeName:se.ZodNever,...de(e)});var ni=class extends fe{_parse(t){if(this._getType(t)!==X.undefined){let n=this._getOrReturnCtx(t);return Y(n,{code:H.invalid_type,expected:X.void,received:n.parsedType}),oe}return tt(t.data)}};ni.create=e=>new ni({typeName:se.ZodVoid,...de(e)});var rr=class e extends fe{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==X.array)return Y(r,{code:H.invalid_type,expected:X.array,received:r.parsedType}),oe;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(Y(r,{code:s?H.too_big:H.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Y(r,{code:H.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Y(r,{code:H.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new St(r,s,r.path,a)))).then(s=>Xe.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new St(r,s,r.path,a)));return Xe.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:Z.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:Z.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:Z.toString(r)}})}nonempty(t){return this.min(1,t)}};rr.create=(e,t)=>new rr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:se.ZodArray,...de(t)});function ti(e){if(e instanceof at){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=vt.create(ti(n))}return new at({...e._def,shape:()=>t})}else return e instanceof rr?new rr({...e._def,type:ti(e.element)}):e instanceof vt?vt.create(ti(e.unwrap())):e instanceof Lt?Lt.create(ti(e.unwrap())):e instanceof qt?qt.create(e.items.map(t=>ti(t))):e}var at=class e extends fe{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=ye.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==X.object){let u=this._getOrReturnCtx(t);return Y(u,{code:H.invalid_type,expected:X.object,received:u.parsedType}),oe}let{status:n,ctx:i}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Tt&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let h=o[u],v=i.data[u];c.push({key:{status:"valid",value:u},value:h._parse(new St(i,v,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Tt){let u=this._def.unknownKeys;if(u==="passthrough")for(let h of a)c.push({key:{status:"valid",value:h},value:{status:"valid",value:i.data[h]}});else if(u==="strict")a.length>0&&(Y(i,{code:H.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 h of a){let v=i.data[h];c.push({key:{status:"valid",value:h},value:u._parse(new St(i,v,i.path,h)),alwaysSet:h in i.data})}}return i.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let u=[];for(let h of c){let v=yield h.key,S=yield h.value;u.push({key:v,value:S,alwaysSet:h.alwaysSet})}return u})).then(u=>Xe.mergeObjectSync(n,u)):Xe.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return Z.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Z.errToObj(t).message??i}:{message:i}}}:{})})}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:se.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 ye.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 ye.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return ti(this)}partial(t){let r={};for(let n of ye.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of ye.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof vt;)o=o._def.innerType;r[n]=o}return new e({...this._def,shape:()=>r})}keyof(){return lh(ye.objectKeys(this.shape))}};at.create=(e,t)=>new at({shape:()=>e,unknownKeys:"strip",catchall:Tt.create(),typeName:se.ZodObject,...de(t)});at.strictCreate=(e,t)=>new at({shape:()=>e,unknownKeys:"strict",catchall:Tt.create(),typeName:se.ZodObject,...de(t)});at.lazycreate=(e,t)=>new at({shape:e,unknownKeys:"strip",catchall:Tt.create(),typeName:se.ZodObject,...de(t)});var Jr=class extends fe{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new st(a.ctx.common.issues));return Y(r,{code:H.invalid_union,unionErrors:s}),oe}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(o){let s={...r,common:{...r.common,issues:[]},parent:null};return{result:yield o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}});return function(_x71){return _ref32.apply(this,arguments)}}())).then(i);{let o,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},h=c._parseSync({data:r.data,path:r.path,parent:u});if(h.status==="valid")return h;h.status==="dirty"&&!o&&(o={result:h,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new st(c));return Y(r,{code:H.invalid_union,unionErrors:a}),oe}}get options(){return this._def.options}};Jr.create=(e,t)=>new Jr({options:e,typeName:se.ZodUnion,...de(t)});var er=e=>e instanceof en?er(e.schema):e instanceof At?er(e.innerType()):e instanceof tn?[e.value]:e instanceof rn?e.options:e instanceof nn?ye.objectValues(e.enum):e instanceof on?er(e._def.innerType):e instanceof Yr?[void 0]:e instanceof Xr?[null]:e instanceof vt?[void 0,...er(e.unwrap())]:e instanceof Lt?[null,...er(e.unwrap())]:e instanceof fo||e instanceof an?er(e.unwrap()):e instanceof sn?er(e._def.innerType):[],Ws=class e extends fe{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==X.object)return Y(r,{code:H.invalid_type,expected:X.object,received:r.parsedType}),oe;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(Y(r,{code:H.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),oe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let o of r){let s=er(o.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(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,o)}}return new e({typeName:se.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...de(n)})}};function Ll(e,t){let r=jt(e),n=jt(t);if(e===t)return{valid:!0,data:e};if(r===X.object&&n===X.object){let i=ye.objectKeys(t),o=ye.objectKeys(e).filter(a=>i.indexOf(a)!==-1),s={...e,...t};for(let a of o){let c=Ll(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===X.array&&n===X.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],c=Ll(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===X.date&&n===X.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Zr=class extends fe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(o,s)=>{if(Hs(o)||Hs(s))return oe;let a=Ll(o.value,s.value);return a.valid?((zs(o)||zs(s))&&r.dirty(),{status:r.value,value:a.data}):(Y(n,{code:H.invalid_intersection_types}),oe)};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(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Zr.create=(e,t,r)=>new Zr({left:e,right:t,typeName:se.ZodIntersection,...de(r)});var qt=class e extends fe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==X.array)return Y(n,{code:H.invalid_type,expected:X.array,received:n.parsedType}),oe;if(n.data.length<this._def.items.length)return Y(n,{code:H.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),oe;!this._def.rest&&n.data.length>this._def.items.length&&(Y(n,{code:H.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new St(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>Xe.mergeArray(r,s)):Xe.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};qt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new qt({items:e,typeName:se.ZodTuple,rest:null,...de(t)})};var Ks=class e extends fe{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!==X.object)return Y(n,{code:H.invalid_type,expected:X.object,received:n.parsedType}),oe;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new St(n,a,n.path,a)),value:s._parse(new St(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Xe.mergeObjectAsync(r,i):Xe.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof fe?new e({keyType:t,valueType:r,typeName:se.ZodRecord,...de(n)}):new e({keyType:yr.create(),valueType:t,typeName:se.ZodRecord,...de(r)})}},ii=class extends fe{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!==X.map)return Y(n,{code:H.invalid_type,expected:X.map,received:n.parsedType}),oe;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new St(n,a,n.path,[u,"key"])),value:o._parse(new St(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,h=yield c.value;if(u.status==="aborted"||h.status==="aborted")return oe;(u.status==="dirty"||h.status==="dirty")&&r.dirty(),a.set(u.value,h.value)}return{status:r.value,value:a}}))}else{let a=new Map;for(let c of s){let u=c.key,h=c.value;if(u.status==="aborted"||h.status==="aborted")return oe;(u.status==="dirty"||h.status==="dirty")&&r.dirty(),a.set(u.value,h.value)}return{status:r.value,value:a}}}};ii.create=(e,t,r)=>new ii({valueType:t,keyType:e,typeName:se.ZodMap,...de(r)});var oi=class e extends fe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==X.set)return Y(n,{code:H.invalid_type,expected:X.set,received:n.parsedType}),oe;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Y(n,{code:H.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Y(n,{code:H.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let h of c){if(h.status==="aborted")return oe;h.status==="dirty"&&r.dirty(),u.add(h.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new St(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:Z.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:Z.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};oi.create=(e,t)=>new oi({valueType:e,minSize:null,maxSize:null,typeName:se.ZodSet,...de(t)});var Ys=class e extends fe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==X.function)return Y(r,{code:H.invalid_type,expected:X.function,received:r.parsedType}),oe;function n(a,c){return po({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Zn(),Zt].filter(u=>!!u),issueData:{code:H.invalid_arguments,argumentsError:c}})}function i(a,c){return po({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Zn(),Zt].filter(u=>!!u),issueData:{code:H.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Sr){let a=this;return tt(/*#__PURE__*/_asyncToGenerator(function*(...c){let u=new st([]),h=yield a._def.args.parseAsync(c,o).catch(g=>{throw u.addIssue(n(c,g)),u}),v=yield Reflect.apply(s,this,h);return yield a._def.returns._def.type.parseAsync(v,o).catch(g=>{throw u.addIssue(i(v,g)),u})}))}else{let a=this;return tt(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new st([n(c,u.error)]);let h=Reflect.apply(s,this,u.data),v=a._def.returns.safeParse(h,o);if(!v.success)throw new st([i(h,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:qt.create(t).rest(tr.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||qt.create([]).rest(tr.create()),returns:r||tr.create(),typeName:se.ZodFunction,...de(n)})}},en=class extends fe{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})}};en.create=(e,t)=>new en({getter:e,typeName:se.ZodLazy,...de(t)});var tn=class extends fe{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Y(r,{received:r.data,code:H.invalid_literal,expected:this._def.value}),oe}return{status:"valid",value:t.data}}get value(){return this._def.value}};tn.create=(e,t)=>new tn({value:e,typeName:se.ZodLiteral,...de(t)});function lh(e,t){return new rn({values:e,typeName:se.ZodEnum,...de(t)})}var rn=class e extends fe{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return Y(r,{expected:ye.joinValues(n),received:r.parsedType,code:H.invalid_type}),oe}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 Y(r,{received:r.data,code:H.invalid_enum_value,options:n}),oe}return tt(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})}};rn.create=lh;var nn=class extends fe{_parse(t){let r=ye.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==X.string&&n.parsedType!==X.number){let i=ye.objectValues(r);return Y(n,{expected:ye.joinValues(i),received:n.parsedType,code:H.invalid_type}),oe}if(this._cache||(this._cache=new Set(ye.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=ye.objectValues(r);return Y(n,{received:n.data,code:H.invalid_enum_value,options:i}),oe}return tt(t.data)}get enum(){return this._def.values}};nn.create=(e,t)=>new nn({values:e,typeName:se.ZodNativeEnum,...de(t)});var Sr=class extends fe{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==X.promise&&r.common.async===!1)return Y(r,{code:H.invalid_type,expected:X.promise,received:r.parsedType}),oe;let n=r.parsedType===X.promise?r.data:Promise.resolve(r.data);return tt(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Sr.create=(e,t)=>new Sr({type:e,typeName:se.ZodPromise,...de(t)});var At=class extends fe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===se.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this9=this;let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:s=>{Y(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(a){if(r.value==="aborted")return oe;let c=yield _this9._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?oe:c.status==="dirty"?Qr(c.value):r.value==="dirty"?Qr(c.value):c});return function(_x72){return _ref35.apply(this,arguments)}}());{if(r.value==="aborted")return oe;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?oe:a.status==="dirty"?Qr(a.value):r.value==="dirty"?Qr(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);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"?oe:(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"?oe:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!hr(s))return oe;let a=i.transform(s.value,o);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=>hr(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):oe);ye.assertNever(i)}};At.create=(e,t,r)=>new At({schema:e,typeName:se.ZodEffects,effect:t,...de(r)});At.createWithPreprocess=(e,t,r)=>new At({schema:t,effect:{type:"preprocess",transform:e},typeName:se.ZodEffects,...de(r)});var vt=class extends fe{_parse(t){return this._getType(t)===X.undefined?tt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};vt.create=(e,t)=>new vt({innerType:e,typeName:se.ZodOptional,...de(t)});var Lt=class extends fe{_parse(t){return this._getType(t)===X.null?tt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Lt.create=(e,t)=>new Lt({innerType:e,typeName:se.ZodNullable,...de(t)});var on=class extends fe{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===X.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};on.create=(e,t)=>new on({innerType:e,typeName:se.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...de(t)});var sn=class extends fe{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ei(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};sn.create=(e,t)=>new sn({innerType:e,typeName:se.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...de(t)});var si=class extends fe{_parse(t){if(this._getType(t)!==X.nan){let n=this._getOrReturnCtx(t);return Y(n,{code:H.invalid_type,expected:X.nan,received:n.parsedType}),oe}return{status:"valid",value:t.data}}};si.create=e=>new si({typeName:se.ZodNaN,...de(e)});var pR=Symbol("zod_brand"),fo=class extends fe{_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}},mo=class e extends fe{_parse(t){var _this0=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let o=yield _this0._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?oe:o.status==="dirty"?(r.dirty(),Qr(o.value)):_this0._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?oe:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:se.ZodPipeline})}},an=class extends fe{_parse(t){let r=this._def.innerType._parse(t),n=i=>(hr(i)&&(i.value=Object.freeze(i.value)),i);return ei(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};an.create=(e,t)=>new an({innerType:e,typeName:se.ZodReadonly,...de(t)});function sh(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function dh(e,t={},r){return e?vr.create().superRefine((n,i)=>{let o=e(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=sh(t,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=sh(t,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):vr.create()}var fR={object:at.lazycreate},se;(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"})(se||(se={}));var mR=(e,t={message:`Input not instance of ${e.name}`})=>dh(r=>r instanceof e,t),ph=yr.create,fh=Hr.create,gR=si.create,hR=zr.create,mh=Wr.create,yR=Kr.create,vR=ri.create,SR=Yr.create,AR=Xr.create,bR=vr.create,wR=tr.create,CR=Tt.create,xR=ni.create,ER=rr.create,RR=at.create,IR=at.strictCreate,TR=Jr.create,_R=Ws.create,kR=Zr.create,OR=qt.create,PR=Ks.create,NR=ii.create,FR=oi.create,DR=Ys.create,MR=en.create,jR=tn.create,qR=rn.create,LR=nn.create,UR=Sr.create,VR=At.create,BR=vt.create,GR=Lt.create,$R=At.createWithPreprocess,QR=mo.create,HR=()=>ph().optional(),zR=()=>fh().optional(),WR=()=>mh().optional(),KR={string:e=>yr.create({...e,coerce:!0}),number:e=>Hr.create({...e,coerce:!0}),boolean:e=>Wr.create({...e,coerce:!0}),bigint:e=>zr.create({...e,coerce:!0}),date:e=>Kr.create({...e,coerce:!0})};var YR=oe;var XR=R.object({name:R.string(),arguments:R.string()}),JR=R.object({id:R.string(),type:R.literal("function"),function:XR,encryptedValue:R.string().optional()}),Xs=R.object({id:R.string(),role:R.string(),content:R.string().optional(),name:R.string().optional(),encryptedValue:R.string().optional()}),ZR=R.object({type:R.literal("text"),text:R.string()}),gh=R.object({type:R.literal("binary"),mimeType:R.string(),id:R.string().optional(),url:R.string().optional(),data:R.string().optional(),filename:R.string().optional()}),hh=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:R.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},cH=gh.superRefine((e,t)=>{hh(e,t)}),eI=R.discriminatedUnion("type",[ZR,gh]),tI=eI.superRefine((e,t)=>{e.type==="binary"&&hh(e,t)}),rI=Xs.extend({role:R.literal("developer"),content:R.string()}),nI=Xs.extend({role:R.literal("system"),content:R.string()}),iI=Xs.extend({role:R.literal("assistant"),content:R.string().optional(),toolCalls:R.array(JR).optional()}),oI=Xs.extend({role:R.literal("user"),content:R.union([R.string(),R.array(tI)])}),sI=R.object({id:R.string(),content:R.string(),role:R.literal("tool"),toolCallId:R.string(),error:R.string().optional(),encryptedValue:R.string().optional()}),aI=R.object({id:R.string(),role:R.literal("activity"),activityType:R.string(),content:R.record(R.any())}),cI=R.object({id:R.string(),role:R.literal("reasoning"),content:R.string(),encryptedValue:R.string().optional()}),yh=R.discriminatedUnion("role",[rI,nI,iI,oI,sI,aI,cI]),uH=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user"),R.literal("tool"),R.literal("activity"),R.literal("reasoning")]),uI=R.object({description:R.string(),value:R.string()}),lI=R.object({name:R.string(),description:R.string(),parameters:R.any()}),dI=R.object({threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),state:R.any(),messages:R.array(yh),tools:R.array(lI),context:R.array(uI),forwardedProps:R.any()}),pI=R.any(),Oe=class extends Error{constructor(e){super(e)}},Ul=class extends Oe{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},vh=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user")]),N=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}({}),be=R.object({type:R.nativeEnum(N),timestamp:R.number().optional(),rawEvent:R.any().optional()}).passthrough(),fI=be.extend({type:R.literal(N.TEXT_MESSAGE_START),messageId:R.string(),role:vh.default("assistant")}),Sh=be.extend({type:R.literal(N.TEXT_MESSAGE_CONTENT),messageId:R.string(),delta:R.string().refine(e=>e.length>0,"Delta must not be an empty string")}),mI=be.extend({type:R.literal(N.TEXT_MESSAGE_END),messageId:R.string()}),gI=be.extend({type:R.literal(N.TEXT_MESSAGE_CHUNK),messageId:R.string().optional(),role:vh.optional(),delta:R.string().optional()}),hI=be.extend({type:R.literal(N.THINKING_TEXT_MESSAGE_START)}),yI=Sh.omit({messageId:!0,type:!0}).extend({type:R.literal(N.THINKING_TEXT_MESSAGE_CONTENT)}),vI=be.extend({type:R.literal(N.THINKING_TEXT_MESSAGE_END)}),SI=be.extend({type:R.literal(N.TOOL_CALL_START),toolCallId:R.string(),toolCallName:R.string(),parentMessageId:R.string().optional()}),AI=be.extend({type:R.literal(N.TOOL_CALL_ARGS),toolCallId:R.string(),delta:R.string()}),bI=be.extend({type:R.literal(N.TOOL_CALL_END),toolCallId:R.string()}),wI=be.extend({messageId:R.string(),type:R.literal(N.TOOL_CALL_RESULT),toolCallId:R.string(),content:R.string(),role:R.literal("tool").optional()}),CI=be.extend({type:R.literal(N.TOOL_CALL_CHUNK),toolCallId:R.string().optional(),toolCallName:R.string().optional(),parentMessageId:R.string().optional(),delta:R.string().optional()}),xI=be.extend({type:R.literal(N.THINKING_START),title:R.string().optional()}),EI=be.extend({type:R.literal(N.THINKING_END)}),RI=be.extend({type:R.literal(N.STATE_SNAPSHOT),snapshot:pI}),II=be.extend({type:R.literal(N.STATE_DELTA),delta:R.array(R.any())}),TI=be.extend({type:R.literal(N.MESSAGES_SNAPSHOT),messages:R.array(yh)}),_I=be.extend({type:R.literal(N.ACTIVITY_SNAPSHOT),messageId:R.string(),activityType:R.string(),content:R.record(R.any()),replace:R.boolean().optional().default(!0)}),kI=be.extend({type:R.literal(N.ACTIVITY_DELTA),messageId:R.string(),activityType:R.string(),patch:R.array(R.any())}),OI=be.extend({type:R.literal(N.RAW),event:R.any(),source:R.string().optional()}),PI=be.extend({type:R.literal(N.CUSTOM),name:R.string(),value:R.any()}),NI=be.extend({type:R.literal(N.RUN_STARTED),threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),input:dI.optional()}),FI=be.extend({type:R.literal(N.RUN_FINISHED),threadId:R.string(),runId:R.string(),result:R.any().optional()}),DI=be.extend({type:R.literal(N.RUN_ERROR),message:R.string(),code:R.string().optional()}),MI=be.extend({type:R.literal(N.STEP_STARTED),stepName:R.string()}),jI=be.extend({type:R.literal(N.STEP_FINISHED),stepName:R.string()}),qI=R.union([R.literal("tool-call"),R.literal("message")]),LI=be.extend({type:R.literal(N.REASONING_START),messageId:R.string()}),UI=be.extend({type:R.literal(N.REASONING_MESSAGE_START),messageId:R.string(),role:R.literal("reasoning")}),VI=be.extend({type:R.literal(N.REASONING_MESSAGE_CONTENT),messageId:R.string(),delta:R.string().refine(e=>e.length>0,"Delta must not be an empty string")}),BI=be.extend({type:R.literal(N.REASONING_MESSAGE_END),messageId:R.string()}),GI=be.extend({type:R.literal(N.REASONING_MESSAGE_CHUNK),messageId:R.string().optional(),delta:R.string().optional()}),$I=be.extend({type:R.literal(N.REASONING_END),messageId:R.string()}),QI=be.extend({type:R.literal(N.REASONING_ENCRYPTED_VALUE),subtype:qI,entityId:R.string(),encryptedValue:R.string()}),Js=R.discriminatedUnion("type",[fI,Sh,mI,gI,xI,EI,hI,yI,vI,SI,AI,bI,CI,wI,RI,II,TI,_I,kI,OI,PI,NI,FI,DI,MI,jI,LI,UI,VI,BI,GI,$I,QI]);m();d();f();p();var Vl={};Io(Vl,{JsonPatchError:()=>Me,_areEquals:()=>yo,applyOperation:()=>cn,applyPatch:()=>Ar,applyReducer:()=>YI,deepClone:()=>WI,getValueByPointer:()=>na,validate:()=>bh,validator:()=>ia});m();d();f();p();m();d();f();p();var HI=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),zI=Object.prototype.hasOwnProperty;function ea(e,t){return zI.call(e,t)}function ta(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 i in e)ea(e,i)&&n.push(i);return n}function Je(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function ra(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 Ut(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function go(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Zs(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Zs(e[t]))return!0}else if(typeof e=="object"){for(var n=ta(e),i=n.length,o=0;o<i;o++)if(Zs(e[n[o]]))return!0}}return!1}function Ah(e,t){var r=[e];for(var n in t){var i=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof i<"u"&&r.push(n+": "+i)}return r.join(`
|
|
32
|
+
`)}var ho=function(e){HI(t,e);function t(r,n,i,o,s){var a=this.constructor,c=e.call(this,Ah(r,{name:n,index:i,operation:o,tree:s}))||this;return c.name=n,c.index=i,c.operation=o,c.tree=s,Object.setPrototypeOf(c,a.prototype),c.message=Ah(r,{name:n,index:i,operation:o,tree:s}),c}return t}(Error);var Me=ho,WI=Je,ai={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=na(r,this.path);n&&(n=Je(n));var i=cn(r,{op:"remove",path:this.from}).removed;return cn(r,{op:"add",path:this.path,value:i}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=na(r,this.from);return cn(r,{op:"add",path:this.path,value:Je(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:yo(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},KI={add:function(e,t,r){return ra(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:ai.move,copy:ai.copy,test:ai.test,_get:ai._get};function na(e,t){if(t=="")return e;var r={op:"_get",path:t};return cn(e,r),r.value}function cn(e,t,r,n,i,o){if(r===void 0&&(r=!1),n===void 0&&(n=!0),i===void 0&&(i=!0),o===void 0&&(o=0),r&&(typeof r=="function"?r(t,0,e,t.path):ia(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=na(e,t.from),t.op==="move"&&(s.removed=e),s;if(t.op==="test"){if(s.test=yo(e,t.value),s.test===!1)throw new Me("Test operation failed","TEST_OPERATION_FAILED",o,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 Me("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",o,t,e);return s}}else{n||(e=Je(e));var a=t.path||"",c=a.split("/"),u=e,h=1,v=c.length,S=void 0,g=void 0,y=void 0;for(typeof r=="function"?y=r:y=ia;;){if(g=c[h],g&&g.indexOf("~")!=-1&&(g=go(g)),i&&(g=="__proto__"||g=="prototype"&&h>0&&c[h-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&&S===void 0&&(u[g]===void 0?S=c.slice(0,h).join("/"):h==v-1&&(S=t.path),S!==void 0&&y(t,0,e,S)),h++,Array.isArray(u)){if(g==="-")g=u.length;else{if(r&&!ra(g))throw new Me("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",o,t,e);ra(g)&&(g=~~g)}if(h>=v){if(r&&t.op==="add"&&g>u.length)throw new Me("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",o,t,e);var s=KI[t.op].call(t,u,g,e);if(s.test===!1)throw new Me("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return s}}else if(h>=v){var s=ai[t.op].call(t,u,g,e);if(s.test===!1)throw new Me("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return s}if(u=u[g],r&&h<v&&(!u||typeof u!="object"))throw new Me("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",o,t,e)}}}function Ar(e,t,r,n,i){if(n===void 0&&(n=!0),i===void 0&&(i=!0),r&&!Array.isArray(t))throw new Me("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=Je(e));for(var o=new Array(t.length),s=0,a=t.length;s<a;s++)o[s]=cn(e,t[s],r,!0,i,s),e=o[s].newDocument;return o.newDocument=e,o}function YI(e,t,r){var n=cn(e,t);if(n.test===!1)throw new Me("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function ia(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Me("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(ai[e.op]){if(typeof e.path!="string")throw new Me("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Me("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 Me("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 Me("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")&&Zs(e.value))throw new Me("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 i=e.path.split("/").length,o=n.split("/").length;if(i!==o+1&&i!==o)throw new Me("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 Me("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=bh([s],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new Me("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Me("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function bh(e,t,r){try{if(!Array.isArray(e))throw new Me("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Ar(Je(t),Je(e),r||!0);else{r=r||ia;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(i){if(i instanceof Me)return i;throw i}}function yo(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),i,o,s;if(r&&n){if(o=e.length,o!=t.length)return!1;for(i=o;i--!==0;)if(!yo(e[i],t[i]))return!1;return!0}if(r!=n)return!1;var a=Object.keys(e);if(o=a.length,o!==Object.keys(t).length)return!1;for(i=o;i--!==0;)if(!t.hasOwnProperty(a[i]))return!1;for(i=o;i--!==0;)if(s=a[i],!yo(e[s],t[s]))return!1;return!0}return e!==e&&t!==t}var Ql={};Io(Ql,{compare:()=>iT,generate:()=>Bl,observe:()=>nT,unobserve:()=>rT});m();d();f();p();var Gl=new WeakMap,XI=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),JI=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function ZI(e){return Gl.get(e)}function eT(e,t){return e.observers.get(t)}function tT(e,t){e.observers.delete(t.callback)}function rT(e,t){t.unobserve()}function nT(e,t){var r=[],n,i=ZI(e);if(!i)i=new XI(e),Gl.set(e,i);else{var o=eT(i,t);n=o&&o.observer}if(n)return n;if(n={},i.value=Je(e),t){n.callback=t,n.next=null;var s=function(){Bl(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(){Bl(n),clearTimeout(n.next),tT(i,n),typeof window<"u"&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},i.observers.set(t,new JI(t,n)),n}function Bl(e,t){t===void 0&&(t=!1);var r=Gl.get(e.object);$l(r.value,e.object,e.patches,"",t),e.patches.length&&Ar(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function $l(e,t,r,n,i){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var o=ta(t),s=ta(e),a=!1,c=!1,u=s.length-1;u>=0;u--){var h=s[u],v=e[h];if(ea(t,h)&&!(t[h]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var S=t[h];typeof v=="object"&&v!=null&&typeof S=="object"&&S!=null&&Array.isArray(v)===Array.isArray(S)?$l(v,S,r,n+"/"+Ut(h),i):v!==S&&(a=!0,i&&r.push({op:"test",path:n+"/"+Ut(h),value:Je(v)}),r.push({op:"replace",path:n+"/"+Ut(h),value:Je(S)}))}else Array.isArray(e)===Array.isArray(t)?(i&&r.push({op:"test",path:n+"/"+Ut(h),value:Je(v)}),r.push({op:"remove",path:n+"/"+Ut(h)}),c=!0):(i&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),a=!0)}if(!(!c&&o.length==s.length))for(var u=0;u<o.length;u++){var h=o[u];!ea(e,h)&&t[h]!==void 0&&r.push({op:"add",path:n+"/"+Ut(h),value:Je(t[h])})}}}function iT(e,t,r){r===void 0&&(r=!1);var n=[];return $l(e,t,n,"",r),n}var FH=Object.assign({},Vl,Ql,{JsonPatchError:ho,deepClone:Je,escapePathComponent:Ut,unescapePathComponent:go});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Hl=function(e,t){return Hl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Hl(e,t)};function Vt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Hl(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function wh(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{u(n.next(h))}catch(v){s(v)}}function c(h){try{u(n.throw(h))}catch(v){s(v)}}function u(h){h.done?o(h.value):i(h.value).then(a,c)}u((n=n.apply(e,t||[])).next())})}function oa(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,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(h){return c([u,h])}}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,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function nr(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 ci(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-->0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o}function ui(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}function un(e){return this instanceof un?(this.v=e,this):new un(e)}function Ch(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(g){return function(y){return Promise.resolve(y).then(g,v)}}function a(g,y){n[g]&&(i[g]=function(C){return new Promise(function(E,x){o.push([g,C,E,x])>1||c(g,C)})},y&&(i[g]=y(i[g])))}function c(g,y){try{u(n[g](y))}catch(C){S(o[0][3],C)}}function u(g){g.value instanceof un?Promise.resolve(g.value.v).then(h,v):S(o[0][2],g)}function h(g){c("next",g)}function v(g){c("throw",g)}function S(g,y){g(y),o.shift(),o.length&&c(o[0][0],o[0][1])}}function xh(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 nr=="function"?nr(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(u){o({value:u,done:a})},s)}}m();d();f();p();function ge(e){return typeof e=="function"}m();d();f();p();m();d();f();p();m();d();f();p();function li(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 sa=li(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
33
33
|
`+r.map(function(n,i){return i+1+") "+n.toString()}).join(`
|
|
34
|
-
`):"",this.name="UnsubscriptionError",this.errors=r}});m();d();f();p();function Co(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ai=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,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=ir(s),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(C){t={error:C}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var h=this.initialTeardown;if(ge(h))try{h()}catch(C){o=C instanceof va?C.errors:[C]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var S=ir(v),g=S.next();!g.done;g=S.next()){var y=g.value;try{ty(y)}catch(C){o=o??[],C instanceof va?o=vi(vi([],yi(o)),yi(C.errors)):o.push(C)}}}catch(C){n={error:C}}finally{try{g&&!g.done&&(i=S.return)&&i.call(S)}finally{if(n)throw n.error}}}if(o)throw new va(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)ty(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)&&Co(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Co(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var od=Ai.EMPTY;function Sa(e){return e instanceof Ai||e&&"closed"in e&&ge(e.remove)&&ge(e.add)&&ge(e.unsubscribe)}function ty(e){ge(e)?e():e.unsubscribe()}m();d();f();p();var kt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var wi={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=wi.delegate;return i?.setTimeout?i.setTimeout.apply(i,vi([e,t],yi(r))):setTimeout.apply(void 0,vi([e,t],yi(r)))},clearTimeout:function(e){var t=wi.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Aa(e){wi.setTimeout(function(){var t=kt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function xo(){}m();d();f();p();var ry=function(){return sd("C",void 0,void 0)}();function ny(e){return sd("E",void 0,e)}function iy(e){return sd("N",e,void 0)}function sd(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var yn=null;function bi(e){if(kt.useDeprecatedSynchronousErrorHandling){var t=!yn;if(t&&(yn={errorThrown:!1,error:null}),e(),t){var r=yn,n=r.errorThrown,i=r.error;if(yn=null,n)throw i}}else e()}function oy(e){kt.useDeprecatedSynchronousErrorHandling&&yn&&(yn.errorThrown=!0,yn.error=e)}var Eo=function(e){Gt(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Sa(r)&&r.add(n)):n.destination=LT,n}return t.create=function(r,n,i){return new ba(r,n,i)},t.prototype.next=function(r){this.isStopped?cd(iy(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?cd(ny(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?cd(ry,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}(Ai);var MT=Function.prototype.bind;function ad(e,t){return MT.call(e,t)}var jT=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){wa(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){wa(n)}else wa(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){wa(r)}},e}(),ba=function(e){Gt(t,e);function t(r,n,i){var o=e.call(this)||this,s;if(ge(r)||!r)s={next:r??void 0,error:n??void 0,complete:i??void 0};else{var a;o&&kt.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return o.unsubscribe()},s={next:r.next&&ad(r.next,a),error:r.error&&ad(r.error,a),complete:r.complete&&ad(r.complete,a)}):s=r}return o.destination=new jT(s),o}return t}(Eo);function wa(e){kt.useDeprecatedSynchronousErrorHandling?oy(e):Aa(e)}function qT(e){throw e}function cd(e,t){var r=kt.onStoppedNotification;r&&wi.setTimeout(function(){return r(e,t)})}var LT={closed:!0,next:xo,error:qT,complete:xo};m();d();f();p();var Ci=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function xi(e){return e}function Ca(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ud(e)}function ud(e){return e.length===0?xi:e.length===1?e[0]:function(r){return e.reduce(function(n,i){return i(n)},r)}}var _e=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 i=this,o=VT(t)?t:new ba(t,r,n);return bi(function(){var s=i,a=s.operator,c=s.source;o.add(a?a.call(o,c):c?i._subscribe(o):i._trySubscribe(o))}),o},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=sy(r),new r(function(i,o){var s=new ba({next:function(a){try{t(a)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});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[Ci]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return ud(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=sy(t),new t(function(n,i){var o;r.subscribe(function(s){return o=s},function(s){return i(s)},function(){return n(o)})})},e.create=function(t){return new e(t)},e}();function sy(e){var t;return(t=e??kt.Promise)!==null&&t!==void 0?t:Promise}function UT(e){return e&&ge(e.next)&&ge(e.error)&&ge(e.complete)}function VT(e){return e&&e instanceof Eo||UT(e)&&Sa(e)}m();d();f();p();function GT(e){return ge(e?.lift)}function Ue(e){return function(t){if(GT(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 Be(e,t,r,n,i){return new BT(e,t,r,n,i)}var BT=function(e){Gt(t,e);function t(r,n,i,o,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(h){r.error(h)}}:e.prototype._next,c._error=o?function(u){try{o(u)}catch(h){r.error(h)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=i?function(){try{i()}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}(Eo);m();d();f();p();m();d();f();p();var ay=Si(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Bt=function(e){Gt(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 cy(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new ay},t.prototype.next=function(r){var n=this;bi(function(){var i,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=ir(n.currentObservers),a=s.next();!a.done;a=s.next()){var c=a.value;c.next(r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},t.prototype.error=function(r){var n=this;bi(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var i=n.observers;i.length;)i.shift().error(r)}})},t.prototype.complete=function(){var r=this;bi(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,i=this,o=i.hasError,s=i.isStopped,a=i.observers;return o||s?od:(this.currentObservers=null,a.push(r),new Ai(function(){n.currentObservers=null,Co(a,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,i=n.hasError,o=n.thrownError,s=n.isStopped;i?r.error(o):s&&r.complete()},t.prototype.asObservable=function(){var r=new _e;return r.source=this,r},t.create=function(r,n){return new cy(r,n)},t}(_e);var cy=function(e){Gt(t,e);function t(r,n){var i=e.call(this)||this;return i.destination=r,i.source=n,i}return t.prototype.next=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,r)},t.prototype.error=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.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,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&i!==void 0?i:od},t}(Bt);m();d();f();p();m();d();f();p();var ld={now:function(){return(ld.delegate||Date).now()},delegate:void 0};var xa=function(e){Gt(t,e);function t(r,n,i){r===void 0&&(r=1/0),n===void 0&&(n=1/0),i===void 0&&(i=ld);var o=e.call(this)||this;return o._bufferSize=r,o._windowTime=n,o._timestampProvider=i,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,r),o._windowTime=Math.max(1,n),o}return t.prototype.next=function(r){var n=this,i=n.isStopped,o=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,c=n._windowTime;i||(o.push(r),!s&&o.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),i=this,o=i._infiniteTimeWindow,s=i._buffer,a=s.slice(),c=0;c<a.length&&!r.closed;c+=o?1:2)r.next(a[c]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,i=r._timestampProvider,o=r._buffer,s=r._infiniteTimeWindow,a=(s?1:2)*n;if(n<1/0&&a<o.length&&o.splice(0,o.length-a),!s){for(var c=i.now(),u=0,h=1;h<o.length&&o[h]<=c;h+=2)u=h;u&&o.splice(0,u+1)}},t}(Bt);m();d();f();p();var Ea=new _e(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function uy(e){return e&&ge(e.schedule)}function $T(e){return e[e.length-1]}function ly(e){return uy($T(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 Ia=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function Ra(e){return ge(e?.then)}m();d();f();p();function Ta(e){return ge(e[Ci])}m();d();f();p();function _a(e){return Symbol.asyncIterator&&ge(e?.[Symbol.asyncIterator])}m();d();f();p();function ka(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 QT(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Oa=QT();function Pa(e){return ge(e?.[Oa])}m();d();f();p();function Na(e){return Zh(this,arguments,function(){var r,n,i,o;return ya(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,hn(r.read())];case 3:return n=s.sent(),i=n.value,o=n.done,o?[4,hn(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,hn(i)];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 Fa(e){return ge(e?.getReader)}function $e(e){if(e instanceof _e)return e;if(e!=null){if(Ta(e))return HT(e);if(Ia(e))return zT(e);if(Ra(e))return WT(e);if(_a(e))return dy(e);if(Pa(e))return KT(e);if(Fa(e))return YT(e)}throw ka(e)}function HT(e){return new _e(function(t){var r=e[Ci]();if(ge(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function zT(e){return new _e(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function WT(e){return new _e(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Aa)})}function KT(e){return new _e(function(t){var r,n;try{for(var i=ir(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.complete()})}function dy(e){return new _e(function(t){XT(e,t).catch(function(r){return t.error(r)})})}function YT(e){return dy(Na(e))}function XT(e,t){var r,n,i,o;return Jh(this,void 0,void 0,function(){var s,a;return ya(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=ey(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(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(o=r.return)?[4,o.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}m();d();f();p();m();d();f();p();function wt(e,t,r,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var o=t.schedule(function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(o),!i)return o}function Da(e,t){return t===void 0&&(t=0),Ue(function(r,n){r.subscribe(Be(n,function(i){return wt(n,e,function(){return n.next(i)},t)},function(){return wt(n,e,function(){return n.complete()},t)},function(i){return wt(n,e,function(){return n.error(i)},t)}))})}m();d();f();p();function Ma(e,t){return t===void 0&&(t=0),Ue(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function py(e,t){return $e(e).pipe(Ma(t),Da(t))}m();d();f();p();function fy(e,t){return $e(e).pipe(Ma(t),Da(t))}m();d();f();p();function my(e,t){return new _e(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 gy(e,t){return new _e(function(r){var n;return wt(r,t,function(){n=e[Oa](),wt(r,t,function(){var i,o,s;try{i=n.next(),o=i.value,s=i.done}catch(a){r.error(a);return}s?r.complete():r.next(o)},0,!0)}),function(){return ge(n?.return)&&n.return()}})}m();d();f();p();function ja(e,t){if(!e)throw new Error("Iterable cannot be null");return new _e(function(r){wt(r,t,function(){var n=e[Symbol.asyncIterator]();wt(r,t,function(){n.next().then(function(i){i.done?r.complete():r.next(i.value)})},0,!0)})})}m();d();f();p();function hy(e,t){return ja(Na(e),t)}function yy(e,t){if(e!=null){if(Ta(e))return py(e,t);if(Ia(e))return my(e,t);if(Ra(e))return fy(e,t);if(_a(e))return ja(e,t);if(Pa(e))return gy(e,t);if(Fa(e))return hy(e,t)}throw ka(e)}function vn(e,t){return t?yy(e,t):$e(e)}function Ne(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=ly(e);return vn(e,r)}m();d();f();p();function ke(e,t){var r=ge(e)?e:function(){return e},n=function(i){return i.error(r())};return new _e(t?function(i){return t.schedule(n,0,i)}:n)}m();d();f();p();m();d();f();p();var vy=Si(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function qa(e,t){var r=typeof t=="object";return new Promise(function(n,i){var o=!1,s;e.subscribe({next:function(a){s=a,o=!0},error:i,complete:function(){o?n(s):r?n(t.defaultValue):i(new vy)}})})}m();d();f();p();function Sn(e,t){return Ue(function(r,n){var i=0;r.subscribe(Be(n,function(o){n.next(e.call(t,o,i++))}))})}m();d();f();p();m();d();f();p();m();d();f();p();function Sy(e,t,r,n,i,o,s,a){var c=[],u=0,h=0,v=!1,S=function(){v&&!c.length&&!u&&t.complete()},g=function(C){return u<n?y(C):c.push(C)},y=function(C){o&&t.next(C),u++;var E=!1;$e(r(C,h++)).subscribe(Be(t,function(x){i?.(x),o?g(x):t.next(x)},function(){E=!0},void 0,function(){if(E)try{u--;for(var x=function(){var R=c.shift();s?wt(t,s,function(){return y(R)}):y(R)};c.length&&u<n;)x();S()}catch(R){t.error(R)}}))};return e.subscribe(Be(t,g,function(){v=!0,S()})),function(){a?.()}}function ct(e,t,r){return r===void 0&&(r=1/0),ge(t)?ct(function(n,i){return Sn(function(o,s){return t(n,o,i,s)})($e(e(n,i)))},r):(typeof t=="number"&&(r=t),Ue(function(n,i){return Sy(n,i,e,r)}))}function dd(e){return e===void 0&&(e=1/0),ct(xi,e)}m();d();f();p();function pd(e){return new _e(function(t){$e(e()).subscribe(t)})}m();d();f();p();function Io(e){return Ue(function(t,r){var n=null,i=!1,o;n=t.subscribe(Be(r,void 0,void 0,function(s){o=$e(e(s,Io(e)(t))),n?(n.unsubscribe(),n=null,o.subscribe(r)):i=!0})),i&&(n.unsubscribe(),n=null,o.subscribe(r))})}m();d();f();p();function La(e,t){return ge(t)?ct(e,t,1):ct(e,1)}m();d();f();p();function fd(e){return Ue(function(t,r){var n=!1;t.subscribe(Be(r,function(i){n=!0,r.next(i)},function(){n||r.next(e),r.complete()}))})}m();d();f();p();function An(e){return Ue(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function md(e,t){return Ue(function(r,n){var i=null,o=0,s=!1,a=function(){return s&&!i&&n.complete()};r.subscribe(Be(n,function(c){i?.unsubscribe();var u=0,h=o++;$e(e(c,h)).subscribe(i=Be(n,function(v){return n.next(t?t(c,v,h,u++):v)},function(){i=null,a()}))},function(){s=!0,a()}))})}m();d();f();p();function Ua(e){return Ue(function(t,r){$e(e).subscribe(Be(r,function(){return r.complete()},xo)),!r.closed&&t.subscribe(r)})}m();d();f();p();function gd(e,t,r){var n=ge(e)||t||r?{next:e,error:t,complete:r}:e;return n?Ue(function(i,o){var s;(s=n.subscribe)===null||s===void 0||s.call(n);var a=!0;i.subscribe(Be(o,function(c){var u;(u=n.next)===null||u===void 0||u.call(n,c),o.next(c)},function(){var c;a=!1,(c=n.complete)===null||c===void 0||c.call(n),o.complete()},function(c){var u;a=!1,(u=n.error)===null||u===void 0||u.call(n,c),o.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)}))}):xi}m();d();f();p();m();d();f();p();function Ay(e){return` \r
|
|
35
|
-
`.indexOf(e)>=0}function Va(e){for(var t=["topLevel"],r=0,n,i,o,s=function(R){return t.push(R)},a=function(R){return t[t.length-1]=R},c=function(R){n==null&&(n=r,i=t.length,o=R)},u=function(R){R===o&&(n=void 0,i=void 0,o=void 0)},h=function(){return t.pop()},v=function(){return r--},S=function(R){if("0"<=R&&R<="9"){s("number");return}switch(R){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}},g=e.length;r<g;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":S(y);break;case"string":switch(y){case"\"":h();break;case"\\":c("stringEscape"),s("stringEscaped");break}break;case"stringEscaped":y==="u"?s("stringUnicode"):(u("stringEscape"),h());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(u("stringEscape"),h());break;case"number":y==="."?a("numberNeedsDigit"):y==="e"||y==="E"?a("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),h());break;case"numberNeedsDigit":a("number");break;case"numberNeedsExponent":a(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),h());break;case"arrayNeedsValue":y==="]"?h():Ay(y)||(u("collectionItem"),a("arrayNeedsComma"),S(y));break;case"arrayNeedsComma":y==="]"?h():y===","&&(c("collectionItem"),a("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?h():y==="\""&&(c("collectionItem"),a("objectNeedsColon"),s("string"));break;case"objectNeedsColon":y===":"&&a("objectNeedsValue");break;case"objectNeedsValue":Ay(y)||(u("collectionItem"),a("objectNeedsComma"),S(y));break;case"objectNeedsComma":y==="}"?h():y===","&&(c("collectionItem"),a("objectNeedsKey"));break}}i!=null&&(t.length=i);for(var C=[n!=null?e.slice(0,n):e],E=function(R){return C.push(R.slice(e.length-e.lastIndexOf(R[0])))},x=t.length-1;x>=0;x--)switch(t[x]){case"string":C.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":C.push("0");break;case"true":E("true");break;case"false":E("false");break;case"null":E("null");break;case"arrayNeedsValue":case"arrayNeedsComma":C.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":C.push("}");break}return C.join("")}m();d();f();p();m();d();f();p();m();d();f();p();function by(){let e=0,t=0;for(let n=0;n<28;n+=7){let i=this.buf[this.pos++];if(e|=(i&127)<<n,(i&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 i=this.buf[this.pos++];if(t|=(i&127)<<n,(i&128)==0)return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function Ba(e,t,r){for(let o=0;o<28;o=o+7){let s=e>>>o,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,i=t>>3!=0;if(r.push((i?n|128:n)&255),!!i){for(let o=3;o<31;o=o+7){let s=t>>>o,a=!!(s>>>7),c=(a?s|128:s)&255;if(r.push(c),!a)return}r.push(t>>>31&1)}}var Ga=4294967296;function hd(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,i=0;function o(s,a){let c=Number(e.slice(s,a));i*=r,n=n*r+c,n>=Ga&&(i=i+(n/Ga|0),n=n%Ga)}return o(-24,-18),o(-18,-12),o(-12,-6),o(-6),t?xy(n,i):vd(n,i)}function Cy(e,t){let r=vd(e,t),n=r.hi&2147483648;n&&(r=xy(r.lo,r.hi));let i=yd(r.lo,r.hi);return n?"-"+i:i}function yd(e,t){if({lo:e,hi:t}=JT(e,t),t<=2097151)return String(Ga*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,i=t>>16&65535,o=r+n*6777216+i*6710656,s=n+i*8147497,a=i*2,c=1e7;return o>=c&&(s+=Math.floor(o/c),o%=c),s>=c&&(a+=Math.floor(s/c),s%=c),a.toString()+wy(s)+wy(o)}function JT(e,t){return{lo:e>>>0,hi:t>>>0}}function vd(e,t){return{lo:e|0,hi:t|0}}function xy(e,t){return t=~t,e?e=~e+1:t+=1,vd(e,t)}var wy=e=>{let t=String(e);return"0000000".slice(t.length)+t};function Sd(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 Ey(){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 Ot=ZT();function ZT(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!A.Deno||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),i=BigInt("0"),o=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>o||a<i)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()),Iy(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),Ry(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),Iy(r),hd(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),Ry(r),hd(r)},dec(r,n){return Cy(r,n)},uDec(r,n){return yd(r,n)}}}function Iy(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function Ry(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var Ad=Symbol.for("@bufbuild/protobuf/text-encoding");function wd(){if(A[Ad]==null){let e=new A.TextEncoder,t=new A.TextDecoder;A[Ad]={encodeUtf8(r){return e.encode(r)},decodeUtf8(r){return t.decode(r)},checkUtf8(r){try{return encodeURIComponent(r),!0}catch{return!1}}}}return A[Ad]}var Cr;(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"})(Cr||(Cr={}));var e_=34028234663852886e22,t_=-34028234663852886e22,r_=4294967295,n_=2147483647,i_=-2147483648,Ce=class{constructor(t=wd().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 i=0;i<this.chunks.length;i++)t+=this.chunks[i].length;let r=new Uint8Array(t),n=0;for(let i=0;i<this.chunks.length;i++)r.set(this.chunks[i],n),n+=this.chunks[i].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(Ty(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return bd(t),Sd(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){o_(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){Ty(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){bd(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return bd(t),t=(t<<1^t>>31)>>>0,Sd(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),i=Ot.enc(t);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(r)}fixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),i=Ot.uEnc(t);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(r)}int64(t){let r=Ot.enc(t);return Ba(r.lo,r.hi,this.buf),this}sint64(t){let r=Ot.enc(t),n=r.hi>>31,i=r.lo<<1^n,o=(r.hi<<1|r.lo>>>31)^n;return Ba(i,o,this.buf),this}uint64(t){let r=Ot.uEnc(t);return Ba(r.lo,r.hi,this.buf),this}},re=class{constructor(t,r=wd().decodeUtf8){this.decodeUtf8=r,this.varint64=by,this.uint32=Ey,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.uint32(),r=t>>>3,n=t&7;if(r<=0||n<0||n>5)throw new Error("illegal tag: field no "+r+" wire type "+n);return[r,n]}skip(t,r){let n=this.pos;switch(t){case Cr.Varint:for(;this.buf[this.pos++]&128;);break;case Cr.Bit64:this.pos+=4;case Cr.Bit32:this.pos+=4;break;case Cr.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Cr.StartGroup:for(;;){let[o,s]=this.tag();if(s===Cr.EndGroup){if(r!==void 0&&o!==r)throw new Error("invalid end group tag");break}this.skip(s,o)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(n,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 Ot.dec(...this.varint64())}uint64(){return Ot.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Ot.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 Ot.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Ot.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(){return this.decodeUtf8(this.bytes())}};function bd(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>n_||e<i_)throw new Error("invalid int32: "+e)}function Ty(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>r_||e<0)throw new Error("invalid uint32: "+e)}function o_(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>e_||e<t_))throw new Error("invalid float32: "+e)}var s_=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Cd(){return{fields:{}}}var Ro={encode(e,t=new Ce){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&Id.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Cd();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:{if(o!==10)break;let s=Id.decode(r,r.uint32());s.value!==void 0&&(i.fields[s.key]=s.value);continue}}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ro.fromPartial(e??{})},fromPartial(e){let t=Cd();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,i])=>(i!==void 0&&(r[n]=i),r),{}),t},wrap(e){let t=Cd();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 _y(){return{key:"",value:void 0}}var Id={encode(e,t=new Ce){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&Se.encode(Se.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=_y();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.key=r.string();continue;case 2:if(o!==18)break;i.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Id.fromPartial(e??{})},fromPartial(e){let t=_y();return t.key=e.key??"",t.value=e.value??void 0,t}};function xd(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var Se={encode(e,t=new Ce){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&&Ro.encode(Ro.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&To.encode(To.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=xd();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==8)break;i.nullValue=r.int32();continue;case 2:if(o!==17)break;i.numberValue=r.double();continue;case 3:if(o!==26)break;i.stringValue=r.string();continue;case 4:if(o!==32)break;i.boolValue=r.bool();continue;case 5:if(o!==42)break;i.structValue=Ro.unwrap(Ro.decode(r,r.uint32()));continue;case 6:if(o!==50)break;i.listValue=To.unwrap(To.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Se.fromPartial(e??{})},fromPartial(e){let t=xd();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=xd();if(e===null)t.nullValue=s_.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(A.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new A.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function Ed(){return{values:[]}}var To={encode(e,t=new Ce){for(let r of e.values)Se.encode(Se.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Ed();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.values.push(Se.unwrap(Se.decode(r,r.uint32())));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return To.fromPartial(e??{})},fromPartial(e){let t=Ed();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=Ed();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&A.Array.isArray(e.values)?e.values:e}},a_=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 ky(){return{op:0,path:"",from:void 0,value:void 0}}var $a={encode(e,t=new Ce){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&Se.encode(Se.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=ky();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==8)break;i.op=r.int32();continue;case 2:if(o!==18)break;i.path=r.string();continue;case 3:if(o!==26)break;i.from=r.string();continue;case 4:if(o!==34)break;i.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return $a.fromPartial(e??{})},fromPartial(e){let t=ky();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function Oy(){return{id:"",type:"",function:void 0}}var Qa={encode(e,t=new Ce){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&Ha.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Oy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.id=r.string();continue;case 2:if(o!==18)break;i.type=r.string();continue;case 3:if(o!==26)break;i.function=Ha.decode(r,r.uint32());continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Qa.fromPartial(e??{})},fromPartial(e){let t=Oy();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?Ha.fromPartial(e.function):void 0,t}};function Py(){return{name:"",arguments:""}}var Ha={encode(e,t=new Ce){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 re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Py();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.name=r.string();continue;case 2:if(o!==18)break;i.arguments=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ha.fromPartial(e??{})},fromPartial(e){let t=Py();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function Ny(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0}}var za={encode(e,t=new Ce){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)Qa.encode(r,t.uint32(42).fork()).join();return e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Ny();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.id=r.string();continue;case 2:if(o!==18)break;i.role=r.string();continue;case 3:if(o!==26)break;i.content=r.string();continue;case 4:if(o!==34)break;i.name=r.string();continue;case 5:if(o!==42)break;i.toolCalls.push(Qa.decode(r,r.uint32()));continue;case 6:if(o!==50)break;i.toolCallId=r.string();continue;case 7:if(o!==58)break;i.error=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return za.fromPartial(e??{})},fromPartial(e){let t=Ny();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=>Qa.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t}},c_=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 Fy(){return{type:0,timestamp:void 0,rawEvent:void 0}}var ne={encode(e,t=new Ce){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&Se.encode(Se.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Fy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==8)break;i.type=r.int32();continue;case 2:if(o!==16)break;i.timestamp=u_(r.int64());continue;case 3:if(o!==26)break;i.rawEvent=Se.unwrap(Se.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return ne.fromPartial(e??{})},fromPartial(e){let t=Fy();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function Dy(){return{baseEvent:void 0,messageId:"",role:void 0}}var Wa={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.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),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Dy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messageId=r.string();continue;case 3:if(o!==26)break;i.role=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Wa.fromPartial(e??{})},fromPartial(e){let t=Dy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t}};function My(){return{baseEvent:void 0,messageId:"",delta:""}}var Ka={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.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 re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=My();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messageId=r.string();continue;case 3:if(o!==26)break;i.delta=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ka.fromPartial(e??{})},fromPartial(e){let t=My();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function jy(){return{baseEvent:void 0,messageId:""}}var Ya={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=jy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messageId=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ya.fromPartial(e??{})},fromPartial(e){let t=jy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function qy(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var Xa={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.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 re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=qy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.toolCallId=r.string();continue;case 3:if(o!==26)break;i.toolCallName=r.string();continue;case 4:if(o!==34)break;i.parentMessageId=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Xa.fromPartial(e??{})},fromPartial(e){let t=qy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function Ly(){return{baseEvent:void 0,toolCallId:"",delta:""}}var Ja={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.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 re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Ly();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.toolCallId=r.string();continue;case 3:if(o!==26)break;i.delta=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ja.fromPartial(e??{})},fromPartial(e){let t=Ly();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function Uy(){return{baseEvent:void 0,toolCallId:""}}var Za={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Uy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.toolCallId=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Za.fromPartial(e??{})},fromPartial(e){let t=Uy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function Vy(){return{baseEvent:void 0,snapshot:void 0}}var ec={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&Se.encode(Se.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Vy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.snapshot=Se.unwrap(Se.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return ec.fromPartial(e??{})},fromPartial(e){let t=Vy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function Gy(){return{baseEvent:void 0,delta:[]}}var tc={encode(e,t=new Ce){e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)$a.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Gy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.delta.push($a.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return tc.fromPartial(e??{})},fromPartial(e){let t=Gy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>$a.fromPartial(r))||[],t}};function By(){return{baseEvent:void 0,messages:[]}}var rc={encode(e,t=new Ce){e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)za.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=By();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messages.push(za.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return rc.fromPartial(e??{})},fromPartial(e){let t=By();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>za.fromPartial(r))||[],t}};function $y(){return{baseEvent:void 0,event:void 0,source:void 0}}var nc={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&Se.encode(Se.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=$y();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.event=Se.unwrap(Se.decode(r,r.uint32()));continue;case 3:if(o!==26)break;i.source=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return nc.fromPartial(e??{})},fromPartial(e){let t=$y();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function Qy(){return{baseEvent:void 0,name:"",value:void 0}}var ic={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&Se.encode(Se.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Qy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.name=r.string();continue;case 3:if(o!==26)break;i.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return ic.fromPartial(e??{})},fromPartial(e){let t=Qy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function Hy(){return{baseEvent:void 0,threadId:"",runId:""}}var oc={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.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 re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Hy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.threadId=r.string();continue;case 3:if(o!==26)break;i.runId=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return oc.fromPartial(e??{})},fromPartial(e){let t=Hy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function zy(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0}}var sc={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&Se.encode(Se.wrap(e.result),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=zy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.threadId=r.string();continue;case 3:if(o!==26)break;i.runId=r.string();continue;case 4:if(o!==34)break;i.result=Se.unwrap(Se.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return sc.fromPartial(e??{})},fromPartial(e){let t=zy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t}};function Wy(){return{baseEvent:void 0,code:void 0,message:""}}var ac={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.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 re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Wy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.code=r.string();continue;case 3:if(o!==26)break;i.message=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return ac.fromPartial(e??{})},fromPartial(e){let t=Wy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function Ky(){return{baseEvent:void 0,stepName:""}}var cc={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Ky();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.stepName=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return cc.fromPartial(e??{})},fromPartial(e){let t=Ky();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function Yy(){return{baseEvent:void 0,stepName:""}}var uc={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Yy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.stepName=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return uc.fromPartial(e??{})},fromPartial(e){let t=Yy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function Xy(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0}}var lc={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.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),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Xy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messageId=r.string();continue;case 3:if(o!==26)break;i.role=r.string();continue;case 4:if(o!==34)break;i.delta=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return lc.fromPartial(e??{})},fromPartial(e){let t=Xy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t}};function Jy(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var dc={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.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 re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Jy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.toolCallId=r.string();continue;case 3:if(o!==26)break;i.toolCallName=r.string();continue;case 4:if(o!==34)break;i.parentMessageId=r.string();continue;case 5:if(o!==42)break;i.delta=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return dc.fromPartial(e??{})},fromPartial(e){let t=Jy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.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 Zy(){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 ev={encode(e,t=new Ce){return e.textMessageStart!==void 0&&Wa.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Ka.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Ya.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Xa.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Ja.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Za.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&ec.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&tc.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&rc.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&nc.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&ic.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&oc.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&sc.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&ac.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&cc.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&uc.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&lc.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&dc.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Zy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.textMessageStart=Wa.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.textMessageContent=Ka.decode(r,r.uint32());continue;case 3:if(o!==26)break;i.textMessageEnd=Ya.decode(r,r.uint32());continue;case 4:if(o!==34)break;i.toolCallStart=Xa.decode(r,r.uint32());continue;case 5:if(o!==42)break;i.toolCallArgs=Ja.decode(r,r.uint32());continue;case 6:if(o!==50)break;i.toolCallEnd=Za.decode(r,r.uint32());continue;case 7:if(o!==58)break;i.stateSnapshot=ec.decode(r,r.uint32());continue;case 8:if(o!==66)break;i.stateDelta=tc.decode(r,r.uint32());continue;case 9:if(o!==74)break;i.messagesSnapshot=rc.decode(r,r.uint32());continue;case 10:if(o!==82)break;i.raw=nc.decode(r,r.uint32());continue;case 11:if(o!==90)break;i.custom=ic.decode(r,r.uint32());continue;case 12:if(o!==98)break;i.runStarted=oc.decode(r,r.uint32());continue;case 13:if(o!==106)break;i.runFinished=sc.decode(r,r.uint32());continue;case 14:if(o!==114)break;i.runError=ac.decode(r,r.uint32());continue;case 15:if(o!==122)break;i.stepStarted=cc.decode(r,r.uint32());continue;case 16:if(o!==130)break;i.stepFinished=uc.decode(r,r.uint32());continue;case 17:if(o!==138)break;i.textMessageChunk=lc.decode(r,r.uint32());continue;case 18:if(o!==146)break;i.toolCallChunk=dc.decode(r,r.uint32());continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return ev.fromPartial(e??{})},fromPartial(e){let t=Zy();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Wa.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Ka.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Ya.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Xa.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Ja.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Za.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?ec.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?tc.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?rc.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?nc.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?ic.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?oc.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?sc.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?ac.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?cc.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?uc.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?lc.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?dc.fromPartial(e.toolCallChunk):void 0,t}};function u_(e){let t=A.Number(e.toString());if(t>A.Number.MAX_SAFE_INTEGER)throw new A.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<A.Number.MIN_SAFE_INTEGER)throw new A.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}function tv(e){let t=ev.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=c_[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.type===N.MESSAGES_SNAPSHOT)for(let n of r.messages){let i=n;i.toolCalls?.length===0&&(i.toolCalls=void 0)}if(r.type===N.STATE_DELTA)for(let n of r.delta)n.op=a_[n.op].toLowerCase(),Object.keys(n).forEach(i=>{n[i]===void 0&&delete n[i]});return Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n]}),la.parse(r)}var rv="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var d_=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Rd=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(d_);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},nv=e=>e==="*"||e==="x"||e==="X",iv=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},p_=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],f_=(e,t)=>{if(nv(e)||nv(t))return 0;let[r,n]=p_(iv(e),iv(t));return r>n?1:r<n?-1:0},Td=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=f_(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var pc=(e,t)=>{let r=Rd(e),n=Rd(t),i=r.pop(),o=n.pop(),s=Td(r,n);return s!==0?s:i&&o?Td(i.split("."),o.split(".")):i||o?i?-1:1:0};var Ie=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return{...e}}};function _o(){return yr()}function Ee(_x82,_x83,_x84,_x85){return _Ee.apply(this,arguments)}function _Ee(){_Ee=_asyncToGenerator(function*(e,t,r,n){let i=t,o=r,s;for(let a of e)try{let c=yield n(a,Ie(i),Ie(o));if(c===void 0)continue;if(c.messages!==void 0&&(i=c.messages),c.state!==void 0&&(o=c.state),s=c.stopPropagation,s===!0)break}catch(c){process.env.VITEST_WORKER_ID!==void 0||console.error("Subscriber error:",c);continue}return{...(JSON.stringify(i)===JSON.stringify(t)?{}:{messages:i}),...(JSON.stringify(o)===JSON.stringify(r)?{}:{state:o}),...(s===void 0?{}:{stopPropagation:s})}});return _Ee.apply(this,arguments)}var lv=(e,t,r,n)=>{let i=Ie(r.messages),o=Ie(e.state),s={},a=u=>{u.messages!==void 0&&(i=u.messages,s.messages=u.messages),u.state!==void 0&&(o=u.state,s.state=u.state)},c=()=>{let u=Ie(s);return s={},u.messages!==void 0||u.state!==void 0?Ne(u):Ea};return t.pipe(La(/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(u){let h=yield Ee(n,i,o,(v,S,g)=>v.onEvent?.({event:u,agent:r,input:e,messages:S,state:g}));if(a(h),h.stopPropagation===!0)return c();switch(u.type){case N.TEXT_MESSAGE_START:{let v=yield Ee(n,i,o,(S,g,y)=>S.onTextMessageStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{messageId:S,role:g="assistant"}=u;if(!i.find(y=>y.id===S)){let y={id:S,role:g,content:""};i.push(y),a({messages:i})}}return c()}case N.TEXT_MESSAGE_CONTENT:{let{messageId:v,delta:S}=u,g=i.find(C=>C.id===v);if(!g)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${v}'`),c();let y=yield Ee(n,i,o,(C,E,x)=>C.onTextMessageContentEvent?.({event:u,messages:E,state:x,agent:r,input:e,textMessageBuffer:typeof g.content=="string"?g.content:""}));return a(y),y.stopPropagation!==!0&&(g.content=`${typeof g.content=="string"?g.content:""}${S}`,a({messages:i})),c()}case N.TEXT_MESSAGE_END:{let{messageId:v}=u,S=i.find(g=>g.id===v);return S?(a(yield Ee(n,i,o,(g,y,C)=>g.onTextMessageEndEvent?.({event:u,messages:y,state:C,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:S,messages:i,state:o,agent:r,input:e})})),c()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${v}'`),c())}case N.TOOL_CALL_START:{let v=yield Ee(n,i,o,(S,g,y)=>S.onToolCallStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{toolCallId:S,toolCallName:g,parentMessageId:y}=u,C;y&&i.length>0&&i[i.length-1].id===y?C=i[i.length-1]:(C={id:y||S,role:"assistant",toolCalls:[]},i.push(C)),C.toolCalls??(C.toolCalls=[]),C.toolCalls.push({id:S,type:"function",function:{name:g,arguments:""}}),a({messages:i})}return c()}case N.TOOL_CALL_ARGS:{let{toolCallId:v,delta:S}=u,g=i.find(E=>E.toolCalls?.some(x=>x.id===v));if(!g)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${v}'`),c();let y=g.toolCalls?.find(E=>E.id===v);if(!y)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${v}'`),c();let C=yield Ee(n,i,o,(E,x,R)=>{let T=y.function.arguments,_=y.function.name,M={};try{M=Va(T)}catch{}return E.onToolCallArgsEvent?.({event:u,messages:x,state:R,agent:r,input:e,toolCallBuffer:T,toolCallName:_,partialToolCallArgs:M})});return a(C),C.stopPropagation!==!0&&(y.function.arguments+=S,a({messages:i})),c()}case N.TOOL_CALL_END:{let{toolCallId:v}=u,S=i.find(y=>y.toolCalls?.some(C=>C.id===v));if(!S)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${v}'`),c();let g=S.toolCalls?.find(y=>y.id===v);return g?(a(yield Ee(n,i,o,(y,C,E)=>{let x=g.function.arguments,R=g.function.name,T={};try{T=JSON.parse(x)}catch{}return y.onToolCallEndEvent?.({event:u,messages:C,state:E,agent:r,input:e,toolCallName:R,toolCallArgs:T})})),yield Promise.all(n.map(y=>{y.onNewToolCall?.({toolCall:g,messages:i,state:o,agent:r,input:e})})),c()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${v}'`),c())}case N.TOOL_CALL_RESULT:{let v=yield Ee(n,i,o,(S,g,y)=>S.onToolCallResultEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{messageId:S,toolCallId:g,content:y,role:C}=u,E={id:S,toolCallId:g,role:C||"tool",content:y};i.push(E),yield Promise.all(n.map(x=>{x.onNewMessage?.({message:E,messages:i,state:o,agent:r,input:e})})),a({messages:i})}return c()}case N.STATE_SNAPSHOT:{let v=yield Ee(n,i,o,(S,g,y)=>S.onStateSnapshotEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{snapshot:S}=u;o=S,a({state:o})}return c()}case N.STATE_DELTA:{let v=yield Ee(n,i,o,(S,g,y)=>S.onStateDeltaEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{delta:S}=u;try{o=br(o,S,!0,!1).newDocument,a({state:o})}catch(g){let y=g instanceof Error?g.message:String(g);console.warn(`Failed to apply state patch:
|
|
34
|
+
`):"",this.name="UnsubscriptionError",this.errors=r}});m();d();f();p();function vo(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var di=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,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=nr(s),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(C){t={error:C}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var h=this.initialTeardown;if(ge(h))try{h()}catch(C){o=C instanceof sa?C.errors:[C]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var S=nr(v),g=S.next();!g.done;g=S.next()){var y=g.value;try{Eh(y)}catch(C){o=o??[],C instanceof sa?o=ui(ui([],ci(o)),ci(C.errors)):o.push(C)}}}catch(C){n={error:C}}finally{try{g&&!g.done&&(i=S.return)&&i.call(S)}finally{if(n)throw n.error}}}if(o)throw new sa(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Eh(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)&&vo(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&vo(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var zl=di.EMPTY;function aa(e){return e instanceof di||e&&"closed"in e&&ge(e.remove)&&ge(e.add)&&ge(e.unsubscribe)}function Eh(e){ge(e)?e():e.unsubscribe()}m();d();f();p();var _t={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var pi={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=pi.delegate;return i?.setTimeout?i.setTimeout.apply(i,ui([e,t],ci(r))):setTimeout.apply(void 0,ui([e,t],ci(r)))},clearTimeout:function(e){var t=pi.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function ca(e){pi.setTimeout(function(){var t=_t.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function So(){}m();d();f();p();var Rh=function(){return Wl("C",void 0,void 0)}();function Ih(e){return Wl("E",void 0,e)}function Th(e){return Wl("N",e,void 0)}function Wl(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var ln=null;function fi(e){if(_t.useDeprecatedSynchronousErrorHandling){var t=!ln;if(t&&(ln={errorThrown:!1,error:null}),e(),t){var r=ln,n=r.errorThrown,i=r.error;if(ln=null,n)throw i}}else e()}function _h(e){_t.useDeprecatedSynchronousErrorHandling&&ln&&(ln.errorThrown=!0,ln.error=e)}var Ao=function(e){Vt(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,aa(r)&&r.add(n)):n.destination=uT,n}return t.create=function(r,n,i){return new la(r,n,i)},t.prototype.next=function(r){this.isStopped?Yl(Th(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Yl(Ih(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Yl(Rh,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}(di);var sT=Function.prototype.bind;function Kl(e,t){return sT.call(e,t)}var aT=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){ua(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){ua(n)}else ua(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){ua(r)}},e}(),la=function(e){Vt(t,e);function t(r,n,i){var o=e.call(this)||this,s;if(ge(r)||!r)s={next:r??void 0,error:n??void 0,complete:i??void 0};else{var a;o&&_t.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return o.unsubscribe()},s={next:r.next&&Kl(r.next,a),error:r.error&&Kl(r.error,a),complete:r.complete&&Kl(r.complete,a)}):s=r}return o.destination=new aT(s),o}return t}(Ao);function ua(e){_t.useDeprecatedSynchronousErrorHandling?_h(e):ca(e)}function cT(e){throw e}function Yl(e,t){var r=_t.onStoppedNotification;r&&pi.setTimeout(function(){return r(e,t)})}var uT={closed:!0,next:So,error:cT,complete:So};m();d();f();p();var mi=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function gi(e){return e}function da(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Xl(e)}function Xl(e){return e.length===0?gi:e.length===1?e[0]:function(r){return e.reduce(function(n,i){return i(n)},r)}}var Te=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 i=this,o=dT(t)?t:new la(t,r,n);return fi(function(){var s=i,a=s.operator,c=s.source;o.add(a?a.call(o,c):c?i._subscribe(o):i._trySubscribe(o))}),o},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=kh(r),new r(function(i,o){var s=new la({next:function(a){try{t(a)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});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[mi]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Xl(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=kh(t),new t(function(n,i){var o;r.subscribe(function(s){return o=s},function(s){return i(s)},function(){return n(o)})})},e.create=function(t){return new e(t)},e}();function kh(e){var t;return(t=e??_t.Promise)!==null&&t!==void 0?t:Promise}function lT(e){return e&&ge(e.next)&&ge(e.error)&&ge(e.complete)}function dT(e){return e&&e instanceof Ao||lT(e)&&aa(e)}m();d();f();p();function pT(e){return ge(e?.lift)}function Ue(e){return function(t){if(pT(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 Ge(e,t,r,n,i){return new fT(e,t,r,n,i)}var fT=function(e){Vt(t,e);function t(r,n,i,o,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(h){r.error(h)}}:e.prototype._next,c._error=o?function(u){try{o(u)}catch(h){r.error(h)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=i?function(){try{i()}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}(Ao);m();d();f();p();m();d();f();p();var Oh=li(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Bt=function(e){Vt(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 Ph(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new Oh},t.prototype.next=function(r){var n=this;fi(function(){var i,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=nr(n.currentObservers),a=s.next();!a.done;a=s.next()){var c=a.value;c.next(r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},t.prototype.error=function(r){var n=this;fi(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var i=n.observers;i.length;)i.shift().error(r)}})},t.prototype.complete=function(){var r=this;fi(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,i=this,o=i.hasError,s=i.isStopped,a=i.observers;return o||s?zl:(this.currentObservers=null,a.push(r),new di(function(){n.currentObservers=null,vo(a,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,i=n.hasError,o=n.thrownError,s=n.isStopped;i?r.error(o):s&&r.complete()},t.prototype.asObservable=function(){var r=new Te;return r.source=this,r},t.create=function(r,n){return new Ph(r,n)},t}(Te);var Ph=function(e){Vt(t,e);function t(r,n){var i=e.call(this)||this;return i.destination=r,i.source=n,i}return t.prototype.next=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,r)},t.prototype.error=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.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,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&i!==void 0?i:zl},t}(Bt);m();d();f();p();m();d();f();p();var Jl={now:function(){return(Jl.delegate||Date).now()},delegate:void 0};var pa=function(e){Vt(t,e);function t(r,n,i){r===void 0&&(r=1/0),n===void 0&&(n=1/0),i===void 0&&(i=Jl);var o=e.call(this)||this;return o._bufferSize=r,o._windowTime=n,o._timestampProvider=i,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,r),o._windowTime=Math.max(1,n),o}return t.prototype.next=function(r){var n=this,i=n.isStopped,o=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,c=n._windowTime;i||(o.push(r),!s&&o.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),i=this,o=i._infiniteTimeWindow,s=i._buffer,a=s.slice(),c=0;c<a.length&&!r.closed;c+=o?1:2)r.next(a[c]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,i=r._timestampProvider,o=r._buffer,s=r._infiniteTimeWindow,a=(s?1:2)*n;if(n<1/0&&a<o.length&&o.splice(0,o.length-a),!s){for(var c=i.now(),u=0,h=1;h<o.length&&o[h]<=c;h+=2)u=h;u&&o.splice(0,u+1)}},t}(Bt);m();d();f();p();var fa=new Te(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function Nh(e){return e&&ge(e.schedule)}function mT(e){return e[e.length-1]}function Fh(e){return Nh(mT(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 ma=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function ga(e){return ge(e?.then)}m();d();f();p();function ha(e){return ge(e[mi])}m();d();f();p();function ya(e){return Symbol.asyncIterator&&ge(e?.[Symbol.asyncIterator])}m();d();f();p();function va(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 gT(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Sa=gT();function Aa(e){return ge(e?.[Sa])}m();d();f();p();function ba(e){return Ch(this,arguments,function(){var r,n,i,o;return oa(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,un(r.read())];case 3:return n=s.sent(),i=n.value,o=n.done,o?[4,un(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,un(i)];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 wa(e){return ge(e?.getReader)}function $e(e){if(e instanceof Te)return e;if(e!=null){if(ha(e))return hT(e);if(ma(e))return yT(e);if(ga(e))return vT(e);if(ya(e))return Dh(e);if(Aa(e))return ST(e);if(wa(e))return AT(e)}throw va(e)}function hT(e){return new Te(function(t){var r=e[mi]();if(ge(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function yT(e){return new Te(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function vT(e){return new Te(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,ca)})}function ST(e){return new Te(function(t){var r,n;try{for(var i=nr(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.complete()})}function Dh(e){return new Te(function(t){bT(e,t).catch(function(r){return t.error(r)})})}function AT(e){return Dh(ba(e))}function bT(e,t){var r,n,i,o;return wh(this,void 0,void 0,function(){var s,a;return oa(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=xh(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(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(o=r.return)?[4,o.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}m();d();f();p();m();d();f();p();function bt(e,t,r,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var o=t.schedule(function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(o),!i)return o}function Ca(e,t){return t===void 0&&(t=0),Ue(function(r,n){r.subscribe(Ge(n,function(i){return bt(n,e,function(){return n.next(i)},t)},function(){return bt(n,e,function(){return n.complete()},t)},function(i){return bt(n,e,function(){return n.error(i)},t)}))})}m();d();f();p();function xa(e,t){return t===void 0&&(t=0),Ue(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function Mh(e,t){return $e(e).pipe(xa(t),Ca(t))}m();d();f();p();function jh(e,t){return $e(e).pipe(xa(t),Ca(t))}m();d();f();p();function qh(e,t){return new Te(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 Lh(e,t){return new Te(function(r){var n;return bt(r,t,function(){n=e[Sa](),bt(r,t,function(){var i,o,s;try{i=n.next(),o=i.value,s=i.done}catch(a){r.error(a);return}s?r.complete():r.next(o)},0,!0)}),function(){return ge(n?.return)&&n.return()}})}m();d();f();p();function Ea(e,t){if(!e)throw new Error("Iterable cannot be null");return new Te(function(r){bt(r,t,function(){var n=e[Symbol.asyncIterator]();bt(r,t,function(){n.next().then(function(i){i.done?r.complete():r.next(i.value)})},0,!0)})})}m();d();f();p();function Uh(e,t){return Ea(ba(e),t)}function Vh(e,t){if(e!=null){if(ha(e))return Mh(e,t);if(ma(e))return qh(e,t);if(ga(e))return jh(e,t);if(ya(e))return Ea(e,t);if(Aa(e))return Lh(e,t);if(wa(e))return Uh(e,t)}throw va(e)}function dn(e,t){return t?Vh(e,t):$e(e)}function Pe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Fh(e);return dn(e,r)}m();d();f();p();function _e(e,t){var r=ge(e)?e:function(){return e},n=function(i){return i.error(r())};return new Te(t?function(i){return t.schedule(n,0,i)}:n)}m();d();f();p();m();d();f();p();var Bh=li(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Ra(e,t){var r=typeof t=="object";return new Promise(function(n,i){var o=!1,s;e.subscribe({next:function(a){s=a,o=!0},error:i,complete:function(){o?n(s):r?n(t.defaultValue):i(new Bh)}})})}m();d();f();p();function pn(e,t){return Ue(function(r,n){var i=0;r.subscribe(Ge(n,function(o){n.next(e.call(t,o,i++))}))})}m();d();f();p();m();d();f();p();m();d();f();p();function Gh(e,t,r,n,i,o,s,a){var c=[],u=0,h=0,v=!1,S=function(){v&&!c.length&&!u&&t.complete()},g=function(C){return u<n?y(C):c.push(C)},y=function(C){o&&t.next(C),u++;var E=!1;$e(r(C,h++)).subscribe(Ge(t,function(x){i?.(x),o?g(x):t.next(x)},function(){E=!0},void 0,function(){if(E)try{u--;for(var x=function(){var I=c.shift();s?bt(t,s,function(){return y(I)}):y(I)};c.length&&u<n;)x();S()}catch(I){t.error(I)}}))};return e.subscribe(Ge(t,g,function(){v=!0,S()})),function(){a?.()}}function ct(e,t,r){return r===void 0&&(r=1/0),ge(t)?ct(function(n,i){return pn(function(o,s){return t(n,o,i,s)})($e(e(n,i)))},r):(typeof t=="number"&&(r=t),Ue(function(n,i){return Gh(n,i,e,r)}))}function Zl(e){return e===void 0&&(e=1/0),ct(gi,e)}m();d();f();p();function ed(e){return new Te(function(t){$e(e()).subscribe(t)})}m();d();f();p();function bo(e){return Ue(function(t,r){var n=null,i=!1,o;n=t.subscribe(Ge(r,void 0,void 0,function(s){o=$e(e(s,bo(e)(t))),n?(n.unsubscribe(),n=null,o.subscribe(r)):i=!0})),i&&(n.unsubscribe(),n=null,o.subscribe(r))})}m();d();f();p();function Ia(e,t){return ge(t)?ct(e,t,1):ct(e,1)}m();d();f();p();function td(e){return Ue(function(t,r){var n=!1;t.subscribe(Ge(r,function(i){n=!0,r.next(i)},function(){n||r.next(e),r.complete()}))})}m();d();f();p();function fn(e){return Ue(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function rd(e,t){return Ue(function(r,n){var i=null,o=0,s=!1,a=function(){return s&&!i&&n.complete()};r.subscribe(Ge(n,function(c){i?.unsubscribe();var u=0,h=o++;$e(e(c,h)).subscribe(i=Ge(n,function(v){return n.next(t?t(c,v,h,u++):v)},function(){i=null,a()}))},function(){s=!0,a()}))})}m();d();f();p();function Ta(e){return Ue(function(t,r){$e(e).subscribe(Ge(r,function(){return r.complete()},So)),!r.closed&&t.subscribe(r)})}m();d();f();p();function nd(e,t,r){var n=ge(e)||t||r?{next:e,error:t,complete:r}:e;return n?Ue(function(i,o){var s;(s=n.subscribe)===null||s===void 0||s.call(n);var a=!0;i.subscribe(Ge(o,function(c){var u;(u=n.next)===null||u===void 0||u.call(n,c),o.next(c)},function(){var c;a=!1,(c=n.complete)===null||c===void 0||c.call(n),o.complete()},function(c){var u;a=!1,(u=n.error)===null||u===void 0||u.call(n,c),o.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)}))}):gi}m();d();f();p();m();d();f();p();function $h(e){return` \r
|
|
35
|
+
`.indexOf(e)>=0}function _a(e){for(var t=["topLevel"],r=0,n,i,o,s=function(I){return t.push(I)},a=function(I){return t[t.length-1]=I},c=function(I){n==null&&(n=r,i=t.length,o=I)},u=function(I){I===o&&(n=void 0,i=void 0,o=void 0)},h=function(){return t.pop()},v=function(){return r--},S=function(I){if("0"<=I&&I<="9"){s("number");return}switch(I){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}},g=e.length;r<g;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":S(y);break;case"string":switch(y){case"\"":h();break;case"\\":c("stringEscape"),s("stringEscaped");break}break;case"stringEscaped":y==="u"?s("stringUnicode"):(u("stringEscape"),h());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(u("stringEscape"),h());break;case"number":y==="."?a("numberNeedsDigit"):y==="e"||y==="E"?a("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),h());break;case"numberNeedsDigit":a("number");break;case"numberNeedsExponent":a(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),h());break;case"arrayNeedsValue":y==="]"?h():$h(y)||(u("collectionItem"),a("arrayNeedsComma"),S(y));break;case"arrayNeedsComma":y==="]"?h():y===","&&(c("collectionItem"),a("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?h():y==="\""&&(c("collectionItem"),a("objectNeedsColon"),s("string"));break;case"objectNeedsColon":y===":"&&a("objectNeedsValue");break;case"objectNeedsValue":$h(y)||(u("collectionItem"),a("objectNeedsComma"),S(y));break;case"objectNeedsComma":y==="}"?h():y===","&&(c("collectionItem"),a("objectNeedsKey"));break}}i!=null&&(t.length=i);for(var C=[n!=null?e.slice(0,n):e],E=function(I){return C.push(I.slice(e.length-e.lastIndexOf(I[0])))},x=t.length-1;x>=0;x--)switch(t[x]){case"string":C.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":C.push("0");break;case"true":E("true");break;case"false":E("false");break;case"null":E("null");break;case"arrayNeedsValue":case"arrayNeedsComma":C.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":C.push("}");break}return C.join("")}m();d();f();p();m();d();f();p();m();d();f();p();function Hh(){let e=0,t=0;for(let n=0;n<28;n+=7){let i=this.buf[this.pos++];if(e|=(i&127)<<n,(i&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 i=this.buf[this.pos++];if(t|=(i&127)<<n,(i&128)==0)return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function Oa(e,t,r){for(let o=0;o<28;o=o+7){let s=e>>>o,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,i=t>>3!=0;if(r.push((i?n|128:n)&255),!!i){for(let o=3;o<31;o=o+7){let s=t>>>o,a=!!(s>>>7),c=(a?s|128:s)&255;if(r.push(c),!a)return}r.push(t>>>31&1)}}var ka=4294967296;function id(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,i=0;function o(s,a){let c=Number(e.slice(s,a));i*=r,n=n*r+c,n>=ka&&(i=i+(n/ka|0),n=n%ka)}return o(-24,-18),o(-18,-12),o(-12,-6),o(-6),t?Wh(n,i):sd(n,i)}function zh(e,t){let r=sd(e,t),n=r.hi&2147483648;n&&(r=Wh(r.lo,r.hi));let i=od(r.lo,r.hi);return n?"-"+i:i}function od(e,t){if({lo:e,hi:t}=wT(e,t),t<=2097151)return String(ka*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,i=t>>16&65535,o=r+n*6777216+i*6710656,s=n+i*8147497,a=i*2,c=1e7;return o>=c&&(s+=Math.floor(o/c),o%=c),s>=c&&(a+=Math.floor(s/c),s%=c),a.toString()+Qh(s)+Qh(o)}function wT(e,t){return{lo:e>>>0,hi:t>>>0}}function sd(e,t){return{lo:e|0,hi:t|0}}function Wh(e,t){return t=~t,e?e=~e+1:t+=1,sd(e,t)}var Qh=e=>{let t=String(e);return"0000000".slice(t.length)+t};function ad(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 Kh(){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 kt=CT();function CT(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!A.Deno||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),i=BigInt("0"),o=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>o||a<i)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()),Yh(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),Xh(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),Yh(r),id(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),Xh(r),id(r)},dec(r,n){return zh(r,n)},uDec(r,n){return od(r,n)}}}function Yh(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function Xh(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var cd=Symbol.for("@bufbuild/protobuf/text-encoding");function ud(){if(A[cd]==null){let e=new A.TextEncoder,t=new A.TextDecoder;A[cd]={encodeUtf8(r){return e.encode(r)},decodeUtf8(r){return t.decode(r)},checkUtf8(r){try{return encodeURIComponent(r),!0}catch{return!1}}}}return A[cd]}var br;(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"})(br||(br={}));var xT=34028234663852886e22,ET=-34028234663852886e22,RT=4294967295,IT=2147483647,TT=-2147483648,Ce=class{constructor(t=ud().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 i=0;i<this.chunks.length;i++)t+=this.chunks[i].length;let r=new Uint8Array(t),n=0;for(let i=0;i<this.chunks.length;i++)r.set(this.chunks[i],n),n+=this.chunks[i].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(Jh(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return ld(t),ad(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){_T(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){Jh(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){ld(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return ld(t),t=(t<<1^t>>31)>>>0,ad(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),i=kt.enc(t);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(r)}fixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),i=kt.uEnc(t);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(r)}int64(t){let r=kt.enc(t);return Oa(r.lo,r.hi,this.buf),this}sint64(t){let r=kt.enc(t),n=r.hi>>31,i=r.lo<<1^n,o=(r.hi<<1|r.lo>>>31)^n;return Oa(i,o,this.buf),this}uint64(t){let r=kt.uEnc(t);return Oa(r.lo,r.hi,this.buf),this}},re=class{constructor(t,r=ud().decodeUtf8){this.decodeUtf8=r,this.varint64=Hh,this.uint32=Kh,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.uint32(),r=t>>>3,n=t&7;if(r<=0||n<0||n>5)throw new Error("illegal tag: field no "+r+" wire type "+n);return[r,n]}skip(t,r){let n=this.pos;switch(t){case br.Varint:for(;this.buf[this.pos++]&128;);break;case br.Bit64:this.pos+=4;case br.Bit32:this.pos+=4;break;case br.LengthDelimited:let i=this.uint32();this.pos+=i;break;case br.StartGroup:for(;;){let[o,s]=this.tag();if(s===br.EndGroup){if(r!==void 0&&o!==r)throw new Error("invalid end group tag");break}this.skip(s,o)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(n,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 kt.dec(...this.varint64())}uint64(){return kt.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,kt.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 kt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return kt.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(){return this.decodeUtf8(this.bytes())}};function ld(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>IT||e<TT)throw new Error("invalid int32: "+e)}function Jh(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>RT||e<0)throw new Error("invalid uint32: "+e)}function _T(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>xT||e<ET))throw new Error("invalid float32: "+e)}var kT=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function dd(){return{fields:{}}}var wo={encode(e,t=new Ce){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&md.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=dd();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:{if(o!==10)break;let s=md.decode(r,r.uint32());s.value!==void 0&&(i.fields[s.key]=s.value);continue}}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return wo.fromPartial(e??{})},fromPartial(e){let t=dd();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,i])=>(i!==void 0&&(r[n]=i),r),{}),t},wrap(e){let t=dd();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 Zh(){return{key:"",value:void 0}}var md={encode(e,t=new Ce){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&Se.encode(Se.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Zh();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.key=r.string();continue;case 2:if(o!==18)break;i.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return md.fromPartial(e??{})},fromPartial(e){let t=Zh();return t.key=e.key??"",t.value=e.value??void 0,t}};function pd(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var Se={encode(e,t=new Ce){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&&wo.encode(wo.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Co.encode(Co.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=pd();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==8)break;i.nullValue=r.int32();continue;case 2:if(o!==17)break;i.numberValue=r.double();continue;case 3:if(o!==26)break;i.stringValue=r.string();continue;case 4:if(o!==32)break;i.boolValue=r.bool();continue;case 5:if(o!==42)break;i.structValue=wo.unwrap(wo.decode(r,r.uint32()));continue;case 6:if(o!==50)break;i.listValue=Co.unwrap(Co.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Se.fromPartial(e??{})},fromPartial(e){let t=pd();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=pd();if(e===null)t.nullValue=kT.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(A.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new A.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function fd(){return{values:[]}}var Co={encode(e,t=new Ce){for(let r of e.values)Se.encode(Se.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=fd();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.values.push(Se.unwrap(Se.decode(r,r.uint32())));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Co.fromPartial(e??{})},fromPartial(e){let t=fd();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=fd();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&A.Array.isArray(e.values)?e.values:e}},OT=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 ey(){return{op:0,path:"",from:void 0,value:void 0}}var Pa={encode(e,t=new Ce){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&Se.encode(Se.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=ey();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==8)break;i.op=r.int32();continue;case 2:if(o!==18)break;i.path=r.string();continue;case 3:if(o!==26)break;i.from=r.string();continue;case 4:if(o!==34)break;i.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Pa.fromPartial(e??{})},fromPartial(e){let t=ey();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function ty(){return{id:"",type:"",function:void 0}}var Na={encode(e,t=new Ce){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&Fa.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=ty();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.id=r.string();continue;case 2:if(o!==18)break;i.type=r.string();continue;case 3:if(o!==26)break;i.function=Fa.decode(r,r.uint32());continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Na.fromPartial(e??{})},fromPartial(e){let t=ty();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?Fa.fromPartial(e.function):void 0,t}};function ry(){return{name:"",arguments:""}}var Fa={encode(e,t=new Ce){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 re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=ry();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.name=r.string();continue;case 2:if(o!==18)break;i.arguments=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Fa.fromPartial(e??{})},fromPartial(e){let t=ry();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function ny(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0}}var Da={encode(e,t=new Ce){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)Na.encode(r,t.uint32(42).fork()).join();return e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=ny();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.id=r.string();continue;case 2:if(o!==18)break;i.role=r.string();continue;case 3:if(o!==26)break;i.content=r.string();continue;case 4:if(o!==34)break;i.name=r.string();continue;case 5:if(o!==42)break;i.toolCalls.push(Na.decode(r,r.uint32()));continue;case 6:if(o!==50)break;i.toolCallId=r.string();continue;case 7:if(o!==58)break;i.error=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Da.fromPartial(e??{})},fromPartial(e){let t=ny();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=>Na.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t}},PT=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 iy(){return{type:0,timestamp:void 0,rawEvent:void 0}}var ne={encode(e,t=new Ce){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&Se.encode(Se.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=iy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==8)break;i.type=r.int32();continue;case 2:if(o!==16)break;i.timestamp=NT(r.int64());continue;case 3:if(o!==26)break;i.rawEvent=Se.unwrap(Se.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return ne.fromPartial(e??{})},fromPartial(e){let t=iy();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function oy(){return{baseEvent:void 0,messageId:"",role:void 0}}var Ma={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.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),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=oy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messageId=r.string();continue;case 3:if(o!==26)break;i.role=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ma.fromPartial(e??{})},fromPartial(e){let t=oy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t}};function sy(){return{baseEvent:void 0,messageId:"",delta:""}}var ja={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.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 re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=sy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messageId=r.string();continue;case 3:if(o!==26)break;i.delta=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return ja.fromPartial(e??{})},fromPartial(e){let t=sy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function ay(){return{baseEvent:void 0,messageId:""}}var qa={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=ay();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messageId=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return qa.fromPartial(e??{})},fromPartial(e){let t=ay();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function cy(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var La={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.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 re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=cy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.toolCallId=r.string();continue;case 3:if(o!==26)break;i.toolCallName=r.string();continue;case 4:if(o!==34)break;i.parentMessageId=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return La.fromPartial(e??{})},fromPartial(e){let t=cy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function uy(){return{baseEvent:void 0,toolCallId:"",delta:""}}var Ua={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.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 re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=uy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.toolCallId=r.string();continue;case 3:if(o!==26)break;i.delta=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ua.fromPartial(e??{})},fromPartial(e){let t=uy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function ly(){return{baseEvent:void 0,toolCallId:""}}var Va={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=ly();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.toolCallId=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Va.fromPartial(e??{})},fromPartial(e){let t=ly();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function dy(){return{baseEvent:void 0,snapshot:void 0}}var Ba={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&Se.encode(Se.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=dy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.snapshot=Se.unwrap(Se.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ba.fromPartial(e??{})},fromPartial(e){let t=dy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function py(){return{baseEvent:void 0,delta:[]}}var Ga={encode(e,t=new Ce){e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)Pa.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=py();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.delta.push(Pa.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ga.fromPartial(e??{})},fromPartial(e){let t=py();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>Pa.fromPartial(r))||[],t}};function fy(){return{baseEvent:void 0,messages:[]}}var $a={encode(e,t=new Ce){e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Da.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=fy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messages.push(Da.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return $a.fromPartial(e??{})},fromPartial(e){let t=fy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Da.fromPartial(r))||[],t}};function my(){return{baseEvent:void 0,event:void 0,source:void 0}}var Qa={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&Se.encode(Se.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=my();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.event=Se.unwrap(Se.decode(r,r.uint32()));continue;case 3:if(o!==26)break;i.source=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Qa.fromPartial(e??{})},fromPartial(e){let t=my();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function gy(){return{baseEvent:void 0,name:"",value:void 0}}var Ha={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&Se.encode(Se.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=gy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.name=r.string();continue;case 3:if(o!==26)break;i.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ha.fromPartial(e??{})},fromPartial(e){let t=gy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function hy(){return{baseEvent:void 0,threadId:"",runId:""}}var za={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.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 re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=hy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.threadId=r.string();continue;case 3:if(o!==26)break;i.runId=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return za.fromPartial(e??{})},fromPartial(e){let t=hy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function yy(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0}}var Wa={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&Se.encode(Se.wrap(e.result),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=yy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.threadId=r.string();continue;case 3:if(o!==26)break;i.runId=r.string();continue;case 4:if(o!==34)break;i.result=Se.unwrap(Se.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Wa.fromPartial(e??{})},fromPartial(e){let t=yy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t}};function vy(){return{baseEvent:void 0,code:void 0,message:""}}var Ka={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.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 re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=vy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.code=r.string();continue;case 3:if(o!==26)break;i.message=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ka.fromPartial(e??{})},fromPartial(e){let t=vy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function Sy(){return{baseEvent:void 0,stepName:""}}var Ya={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Sy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.stepName=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ya.fromPartial(e??{})},fromPartial(e){let t=Sy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function Ay(){return{baseEvent:void 0,stepName:""}}var Xa={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Ay();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.stepName=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Xa.fromPartial(e??{})},fromPartial(e){let t=Ay();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function by(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0}}var Ja={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.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),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=by();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messageId=r.string();continue;case 3:if(o!==26)break;i.role=r.string();continue;case 4:if(o!==34)break;i.delta=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ja.fromPartial(e??{})},fromPartial(e){let t=by();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t}};function wy(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var Za={encode(e,t=new Ce){return e.baseEvent!==void 0&&ne.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 re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=wy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=ne.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.toolCallId=r.string();continue;case 3:if(o!==26)break;i.toolCallName=r.string();continue;case 4:if(o!==34)break;i.parentMessageId=r.string();continue;case 5:if(o!==42)break;i.delta=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Za.fromPartial(e??{})},fromPartial(e){let t=wy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.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 Cy(){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 xy={encode(e,t=new Ce){return e.textMessageStart!==void 0&&Ma.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&ja.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&qa.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&La.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Ua.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Va.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Ba.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Ga.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&$a.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Qa.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Ha.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&za.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Wa.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Ka.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Ya.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Xa.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Ja.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Za.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,i=Cy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.textMessageStart=Ma.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.textMessageContent=ja.decode(r,r.uint32());continue;case 3:if(o!==26)break;i.textMessageEnd=qa.decode(r,r.uint32());continue;case 4:if(o!==34)break;i.toolCallStart=La.decode(r,r.uint32());continue;case 5:if(o!==42)break;i.toolCallArgs=Ua.decode(r,r.uint32());continue;case 6:if(o!==50)break;i.toolCallEnd=Va.decode(r,r.uint32());continue;case 7:if(o!==58)break;i.stateSnapshot=Ba.decode(r,r.uint32());continue;case 8:if(o!==66)break;i.stateDelta=Ga.decode(r,r.uint32());continue;case 9:if(o!==74)break;i.messagesSnapshot=$a.decode(r,r.uint32());continue;case 10:if(o!==82)break;i.raw=Qa.decode(r,r.uint32());continue;case 11:if(o!==90)break;i.custom=Ha.decode(r,r.uint32());continue;case 12:if(o!==98)break;i.runStarted=za.decode(r,r.uint32());continue;case 13:if(o!==106)break;i.runFinished=Wa.decode(r,r.uint32());continue;case 14:if(o!==114)break;i.runError=Ka.decode(r,r.uint32());continue;case 15:if(o!==122)break;i.stepStarted=Ya.decode(r,r.uint32());continue;case 16:if(o!==130)break;i.stepFinished=Xa.decode(r,r.uint32());continue;case 17:if(o!==138)break;i.textMessageChunk=Ja.decode(r,r.uint32());continue;case 18:if(o!==146)break;i.toolCallChunk=Za.decode(r,r.uint32());continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return xy.fromPartial(e??{})},fromPartial(e){let t=Cy();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Ma.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?ja.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?qa.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?La.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Ua.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Va.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Ba.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Ga.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?$a.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Qa.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Ha.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?za.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Wa.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Ka.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Ya.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Xa.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Ja.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Za.fromPartial(e.toolCallChunk):void 0,t}};function NT(e){let t=A.Number(e.toString());if(t>A.Number.MAX_SAFE_INTEGER)throw new A.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<A.Number.MIN_SAFE_INTEGER)throw new A.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}function Ey(e){let t=xy.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=PT[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.type===N.MESSAGES_SNAPSHOT)for(let n of r.messages){let i=n;i.toolCalls?.length===0&&(i.toolCalls=void 0)}if(r.type===N.STATE_DELTA)for(let n of r.delta)n.op=OT[n.op].toLowerCase(),Object.keys(n).forEach(i=>{n[i]===void 0&&delete n[i]});return Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n]}),Js.parse(r)}var Ry="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var DT=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,gd=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(DT);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Iy=e=>e==="*"||e==="x"||e==="X",Ty=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},MT=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],jT=(e,t)=>{if(Iy(e)||Iy(t))return 0;let[r,n]=MT(Ty(e),Ty(t));return r>n?1:r<n?-1:0},hd=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=jT(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var ec=(e,t)=>{let r=gd(e),n=gd(t),i=r.pop(),o=n.pop(),s=hd(r,n);return s!==0?s:i&&o?hd(i.split("."),o.split(".")):i||o?i?-1:1:0};var Re=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return{...e}}};function xo(){return gr()}function Ee(_x73,_x74,_x75,_x76){return _Ee.apply(this,arguments)}function _Ee(){_Ee=_asyncToGenerator(function*(e,t,r,n){let i=t,o=r,s;for(let a of e)try{let c=yield n(a,Re(i),Re(o));if(c===void 0)continue;if(c.messages!==void 0&&(i=c.messages),c.state!==void 0&&(o=c.state),s=c.stopPropagation,s===!0)break}catch(c){process.env.VITEST_WORKER_ID!==void 0||console.error("Subscriber error:",c);continue}return{...(JSON.stringify(i)===JSON.stringify(t)?{}:{messages:i}),...(JSON.stringify(o)===JSON.stringify(r)?{}:{state:o}),...(s===void 0?{}:{stopPropagation:s})}});return _Ee.apply(this,arguments)}var Fy=(e,t,r,n)=>{let i=Re(r.messages),o=Re(e.state),s={},a=u=>{u.messages!==void 0&&(i=u.messages,s.messages=u.messages),u.state!==void 0&&(o=u.state,s.state=u.state)},c=()=>{let u=Re(s);return s={},u.messages!==void 0||u.state!==void 0?Pe(u):fa};return t.pipe(Ia(/*#__PURE__*/function(){var _ref37=_asyncToGenerator(function*(u){let h=yield Ee(n,i,o,(v,S,g)=>v.onEvent?.({event:u,agent:r,input:e,messages:S,state:g}));if(a(h),h.stopPropagation===!0)return c();switch(u.type){case N.TEXT_MESSAGE_START:{let v=yield Ee(n,i,o,(S,g,y)=>S.onTextMessageStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{messageId:S,role:g="assistant"}=u;if(!i.find(y=>y.id===S)){let y={id:S,role:g,content:""};i.push(y),a({messages:i})}}return c()}case N.TEXT_MESSAGE_CONTENT:{let{messageId:v,delta:S}=u,g=i.find(C=>C.id===v);if(!g)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${v}'`),c();let y=yield Ee(n,i,o,(C,E,x)=>C.onTextMessageContentEvent?.({event:u,messages:E,state:x,agent:r,input:e,textMessageBuffer:typeof g.content=="string"?g.content:""}));return a(y),y.stopPropagation!==!0&&(g.content=`${typeof g.content=="string"?g.content:""}${S}`,a({messages:i})),c()}case N.TEXT_MESSAGE_END:{let{messageId:v}=u,S=i.find(g=>g.id===v);return S?(a(yield Ee(n,i,o,(g,y,C)=>g.onTextMessageEndEvent?.({event:u,messages:y,state:C,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:S,messages:i,state:o,agent:r,input:e})})),c()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${v}'`),c())}case N.TOOL_CALL_START:{let v=yield Ee(n,i,o,(S,g,y)=>S.onToolCallStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{toolCallId:S,toolCallName:g,parentMessageId:y}=u,C;y&&i.length>0&&i[i.length-1].id===y?C=i[i.length-1]:(C={id:y||S,role:"assistant",toolCalls:[]},i.push(C)),C.toolCalls??(C.toolCalls=[]),C.toolCalls.push({id:S,type:"function",function:{name:g,arguments:""}}),a({messages:i})}return c()}case N.TOOL_CALL_ARGS:{let{toolCallId:v,delta:S}=u,g=i.find(E=>E.toolCalls?.some(x=>x.id===v));if(!g)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${v}'`),c();let y=g.toolCalls?.find(E=>E.id===v);if(!y)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${v}'`),c();let C=yield Ee(n,i,o,(E,x,I)=>{let T=y.function.arguments,_=y.function.name,M={};try{M=_a(T)}catch{}return E.onToolCallArgsEvent?.({event:u,messages:x,state:I,agent:r,input:e,toolCallBuffer:T,toolCallName:_,partialToolCallArgs:M})});return a(C),C.stopPropagation!==!0&&(y.function.arguments+=S,a({messages:i})),c()}case N.TOOL_CALL_END:{let{toolCallId:v}=u,S=i.find(y=>y.toolCalls?.some(C=>C.id===v));if(!S)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${v}'`),c();let g=S.toolCalls?.find(y=>y.id===v);return g?(a(yield Ee(n,i,o,(y,C,E)=>{let x=g.function.arguments,I=g.function.name,T={};try{T=JSON.parse(x)}catch{}return y.onToolCallEndEvent?.({event:u,messages:C,state:E,agent:r,input:e,toolCallName:I,toolCallArgs:T})})),yield Promise.all(n.map(y=>{y.onNewToolCall?.({toolCall:g,messages:i,state:o,agent:r,input:e})})),c()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${v}'`),c())}case N.TOOL_CALL_RESULT:{let v=yield Ee(n,i,o,(S,g,y)=>S.onToolCallResultEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{messageId:S,toolCallId:g,content:y,role:C}=u,E={id:S,toolCallId:g,role:C||"tool",content:y};i.push(E),yield Promise.all(n.map(x=>{x.onNewMessage?.({message:E,messages:i,state:o,agent:r,input:e})})),a({messages:i})}return c()}case N.STATE_SNAPSHOT:{let v=yield Ee(n,i,o,(S,g,y)=>S.onStateSnapshotEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{snapshot:S}=u;o=S,a({state:o})}return c()}case N.STATE_DELTA:{let v=yield Ee(n,i,o,(S,g,y)=>S.onStateDeltaEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{delta:S}=u;try{o=Ar(o,S,!0,!1).newDocument,a({state:o})}catch(g){let y=g instanceof Error?g.message:String(g);console.warn(`Failed to apply state patch:
|
|
36
36
|
Current state: ${JSON.stringify(o,null,2)}
|
|
37
37
|
Patch operations: ${JSON.stringify(S,null,2)}
|
|
38
|
-
Error: ${y}`)}}return c()}case N.MESSAGES_SNAPSHOT:{let v=yield Ee(n,i,o,(S,g,y)=>S.onMessagesSnapshotEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{messages:S}=u;i=S,a({messages:i})}return c()}case N.ACTIVITY_SNAPSHOT:{let v=u,S=i.findIndex(x=>x.id===v.messageId),g=S>=0?i[S]:void 0,y=g?.role==="activity"?g:void 0,C=v.replace??!0,E=yield Ee(n,i,o,(x,R,T)=>x.onActivitySnapshotEvent?.({event:v,messages:R,state:T,agent:r,input:e,activityMessage:y,existingMessage:g}));if(a(E),E.stopPropagation!==!0){let x={id:v.messageId,role:"activity",activityType:v.activityType,content:Ie(v.content)},R;S===-1?(i.push(x),R=x):y?C&&(i[S]={...y,activityType:v.activityType,content:Ie(v.content)}):C&&(i[S]=x,R=x),a({messages:i}),R&&(yield Promise.all(n.map(T=>T.onNewMessage?.({message:R,messages:i,state:o,agent:r,input:e}))))}return c()}case N.ACTIVITY_DELTA:{let v=u,S=i.findIndex(E=>E.id===v.messageId);if(S===-1)return console.warn(`ACTIVITY_DELTA: No message found with ID '${v.messageId}' to apply patch`),c();let g=i[S];if(g.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${v.messageId}' is not an activity message`),c();let y=g,C=yield Ee(n,i,o,(E,x,R)=>E.onActivityDeltaEvent?.({event:v,messages:x,state:R,agent:r,input:e,activityMessage:y}));if(a(C),C.stopPropagation!==!0)try{let E=Ie(y.content??{}),x=br(E,v.patch??[],!0,!1).newDocument;i[S]={...y,content:Ie(x),activityType:v.activityType},a({messages:i})}catch(E){let x=E instanceof Error?E.message:String(E);console.warn(`Failed to apply activity patch for '${v.messageId}': ${x}`)}return c()}case N.RAW:return a(yield Ee(n,i,o,(v,S,g)=>v.onRawEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case N.CUSTOM:return a(yield Ee(n,i,o,(v,S,g)=>v.onCustomEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case N.RUN_STARTED:{let v=yield Ee(n,i,o,(S,g,y)=>S.onRunStartedEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let S=u;if(S.input?.messages){for(let g of S.input.messages)i.find(y=>y.id===g.id)||i.push(g);a({messages:i})}}return c()}case N.RUN_FINISHED:return a(yield Ee(n,i,o,(v,S,g)=>v.onRunFinishedEvent?.({event:u,messages:S,state:g,agent:r,input:e,result:u.result}))),c();case N.RUN_ERROR:return a(yield Ee(n,i,o,(v,S,g)=>v.onRunErrorEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case N.STEP_STARTED:return a(yield Ee(n,i,o,(v,S,g)=>v.onStepStartedEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case N.STEP_FINISHED:return a(yield Ee(n,i,o,(v,S,g)=>v.onStepFinishedEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case N.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case N.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case N.THINKING_START:return c();case N.THINKING_END:return c();case N.THINKING_TEXT_MESSAGE_START:return c();case N.THINKING_TEXT_MESSAGE_CONTENT:return c();case N.THINKING_TEXT_MESSAGE_END:return c();case N.REASONING_START:return a(yield Ee(n,i,o,(v,S,g)=>v.onReasoningStartEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case N.REASONING_MESSAGE_START:{let v=yield Ee(n,i,o,(S,g,y)=>S.onReasoningMessageStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{messageId:S}=u;if(!i.find(g=>g.id===S)){let g={id:S,role:"reasoning",content:""};i.push(g),a({messages:i})}}return c()}case N.REASONING_MESSAGE_CONTENT:{let{messageId:v,delta:S}=u,g=i.find(C=>C.id===v);if(!g)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${v}'`),c();let y=yield Ee(n,i,o,(C,E,x)=>C.onReasoningMessageContentEvent?.({event:u,messages:E,state:x,agent:r,input:e,reasoningMessageBuffer:typeof g.content=="string"?g.content:""}));return a(y),y.stopPropagation!==!0&&(g.content=`${typeof g.content=="string"?g.content:""}${S}`,a({messages:i})),c()}case N.REASONING_MESSAGE_END:{let{messageId:v}=u,S=i.find(g=>g.id===v);return S?(a(yield Ee(n,i,o,(g,y,C)=>g.onReasoningMessageEndEvent?.({event:u,messages:y,state:C,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:S,messages:i,state:o,agent:r,input:e})})),c()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${v}'`),c())}case N.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case N.REASONING_END:return a(yield Ee(n,i,o,(v,S,g)=>v.onReasoningEndEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case N.REASONING_ENCRYPTED_VALUE:{let{subtype:v,entityId:S,encryptedValue:g}=u,y=yield Ee(n,i,o,(C,E,x)=>C.onReasoningEncryptedValueEvent?.({event:u,messages:E,state:x,agent:r,input:e}));if(a(y),y.stopPropagation!==!0){let C=!1;if(v==="tool-call"){for(let E of i)if(E.role==="assistant"&&E.toolCalls){let x=E.toolCalls.find(R=>R.id===S);if(x){x.encryptedValue=g,C=!0;break}}}else{let E=i.find(x=>x.id===S);E?.role!=="activity"&&E&&(E.encryptedValue=g,C=!0)}C&&(s.messages=i)}return c()}}return u.type,c()});return function(_x86){return _ref40.apply(this,arguments)}}()),dd(),n.length>0?fd({}):u=>u)},_d=e=>t=>{let r=new Map,n=new Map,i=!1,o=!1,s=!1,a=new Map,c=!1,u=!1,h=!1,v=()=>{r.clear(),n.clear(),a.clear(),c=!1,u=!1,i=!1,o=!1,h=!0};return t.pipe(ct(S=>{let g=S.type;if(e&&console.debug("[VERIFY]:",JSON.stringify(S)),o)return ke(()=>new Pe(`Cannot send event type '${g}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(i&&g!==N.RUN_ERROR&&g!==N.RUN_STARTED)return ke(()=>new Pe(`Cannot send event type '${g}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(s){if(g===N.RUN_STARTED){if(h&&!i)return ke(()=>new Pe("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&&v()}}else if(s=!0,g!==N.RUN_STARTED&&g!==N.RUN_ERROR)return ke(()=>new Pe("First event must be 'RUN_STARTED'"));switch(g){case N.TEXT_MESSAGE_START:{let y=S.messageId;return r.has(y)?ke(()=>new Pe(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${y}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(r.set(y,!0),Ne(S))}case N.TEXT_MESSAGE_CONTENT:{let y=S.messageId;return r.has(y)?Ne(S):ke(()=>new Pe(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${y}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case N.TEXT_MESSAGE_END:{let y=S.messageId;return r.has(y)?(r.delete(y),Ne(S)):ke(()=>new Pe(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${y}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case N.TOOL_CALL_START:{let y=S.toolCallId;return n.has(y)?ke(()=>new Pe(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${y}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(n.set(y,!0),Ne(S))}case N.TOOL_CALL_ARGS:{let y=S.toolCallId;return n.has(y)?Ne(S):ke(()=>new Pe(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${y}'. Start a tool call with 'TOOL_CALL_START' first.`))}case N.TOOL_CALL_END:{let y=S.toolCallId;return n.has(y)?(n.delete(y),Ne(S)):ke(()=>new Pe(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${y}'. A 'TOOL_CALL_START' event must be sent first.`))}case N.STEP_STARTED:{let y=S.stepName;return a.has(y)?ke(()=>new Pe(`Step "${y}" is already active for 'STEP_STARTED'`)):(a.set(y,!0),Ne(S))}case N.STEP_FINISHED:{let y=S.stepName;return a.has(y)?(a.delete(y),Ne(S)):ke(()=>new Pe(`Cannot send 'STEP_FINISHED' for step "${y}" that was not started`))}case N.RUN_STARTED:return h=!0,Ne(S);case N.RUN_FINISHED:if(a.size>0){let y=Array.from(a.keys()).join(", ");return ke(()=>new Pe(`Cannot send 'RUN_FINISHED' while steps are still active: ${y}`))}if(r.size>0){let y=Array.from(r.keys()).join(", ");return ke(()=>new Pe(`Cannot send 'RUN_FINISHED' while text messages are still active: ${y}`))}if(n.size>0){let y=Array.from(n.keys()).join(", ");return ke(()=>new Pe(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${y}`))}return i=!0,Ne(S);case N.RUN_ERROR:return o=!0,Ne(S);case N.CUSTOM:return Ne(S);case N.THINKING_TEXT_MESSAGE_START:return c?u?ke(()=>new Pe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(u=!0,Ne(S)):ke(()=>new Pe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case N.THINKING_TEXT_MESSAGE_CONTENT:return u?Ne(S):ke(()=>new Pe("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case N.THINKING_TEXT_MESSAGE_END:return u?(u=!1,Ne(S)):ke(()=>new Pe("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case N.THINKING_START:return c?ke(()=>new Pe("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(c=!0,Ne(S));case N.THINKING_END:return c?(c=!1,Ne(S)):ke(()=>new Pe("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Ne(S)}}))},wn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),m_=(e,t)=>pd(()=>vn(w(e,t))).pipe(md(r=>{if(!r.ok){let o=r.headers.get("content-type")||"";return vn(r.text()).pipe(ct(s=>{let a=s;if(o.includes("application/json"))try{a=JSON.parse(s)}catch{}let c=Error(`HTTP ${r.status}: ${typeof a=="string"?a:JSON.stringify(a)}`);return c.status=r.status,c.payload=a,ke(()=>c)}))}let n={type:wn.HEADERS,status:r.status,headers:r.headers},i=r.body?.getReader();return i?new _e(o=>(o.next(n),_asyncToGenerator(function*(){try{for(;;){let{done:s,value:a}=yield i.read();if(s)break;let c={type:wn.DATA,data:a};o.next(c)}o.complete()}catch(s){o.error(s)}})(),()=>{i.cancel().catch(s=>{if(s?.name!=="AbortError")throw s})})):ke(()=>Error("Failed to getReader() from response"))})),g_=e=>{let t=new Bt,r=new TextDecoder("utf-8",{fatal:!1}),n="";e.subscribe({next:o=>{if(o.type!==wn.HEADERS&&o.type===wn.DATA&&o.data){let s=r.decode(o.data,{stream:!0});n+=s;let a=n.split(/\n\n/);n=a.pop()||"";for(let c of a)i(c)}},error:o=>t.error(o),complete:()=>{n&&(n+=r.decode(),i(n)),t.complete()}});function i(o){let s=o.split(`
|
|
38
|
+
Error: ${y}`)}}return c()}case N.MESSAGES_SNAPSHOT:{let v=yield Ee(n,i,o,(S,g,y)=>S.onMessagesSnapshotEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{messages:S}=u;i=S,a({messages:i})}return c()}case N.ACTIVITY_SNAPSHOT:{let v=u,S=i.findIndex(x=>x.id===v.messageId),g=S>=0?i[S]:void 0,y=g?.role==="activity"?g:void 0,C=v.replace??!0,E=yield Ee(n,i,o,(x,I,T)=>x.onActivitySnapshotEvent?.({event:v,messages:I,state:T,agent:r,input:e,activityMessage:y,existingMessage:g}));if(a(E),E.stopPropagation!==!0){let x={id:v.messageId,role:"activity",activityType:v.activityType,content:Re(v.content)},I;S===-1?(i.push(x),I=x):y?C&&(i[S]={...y,activityType:v.activityType,content:Re(v.content)}):C&&(i[S]=x,I=x),a({messages:i}),I&&(yield Promise.all(n.map(T=>T.onNewMessage?.({message:I,messages:i,state:o,agent:r,input:e}))))}return c()}case N.ACTIVITY_DELTA:{let v=u,S=i.findIndex(E=>E.id===v.messageId);if(S===-1)return console.warn(`ACTIVITY_DELTA: No message found with ID '${v.messageId}' to apply patch`),c();let g=i[S];if(g.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${v.messageId}' is not an activity message`),c();let y=g,C=yield Ee(n,i,o,(E,x,I)=>E.onActivityDeltaEvent?.({event:v,messages:x,state:I,agent:r,input:e,activityMessage:y}));if(a(C),C.stopPropagation!==!0)try{let E=Re(y.content??{}),x=Ar(E,v.patch??[],!0,!1).newDocument;i[S]={...y,content:Re(x),activityType:v.activityType},a({messages:i})}catch(E){let x=E instanceof Error?E.message:String(E);console.warn(`Failed to apply activity patch for '${v.messageId}': ${x}`)}return c()}case N.RAW:return a(yield Ee(n,i,o,(v,S,g)=>v.onRawEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case N.CUSTOM:return a(yield Ee(n,i,o,(v,S,g)=>v.onCustomEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case N.RUN_STARTED:{let v=yield Ee(n,i,o,(S,g,y)=>S.onRunStartedEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let S=u;if(S.input?.messages){for(let g of S.input.messages)i.find(y=>y.id===g.id)||i.push(g);a({messages:i})}}return c()}case N.RUN_FINISHED:return a(yield Ee(n,i,o,(v,S,g)=>v.onRunFinishedEvent?.({event:u,messages:S,state:g,agent:r,input:e,result:u.result}))),c();case N.RUN_ERROR:return a(yield Ee(n,i,o,(v,S,g)=>v.onRunErrorEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case N.STEP_STARTED:return a(yield Ee(n,i,o,(v,S,g)=>v.onStepStartedEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case N.STEP_FINISHED:return a(yield Ee(n,i,o,(v,S,g)=>v.onStepFinishedEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case N.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case N.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case N.THINKING_START:return c();case N.THINKING_END:return c();case N.THINKING_TEXT_MESSAGE_START:return c();case N.THINKING_TEXT_MESSAGE_CONTENT:return c();case N.THINKING_TEXT_MESSAGE_END:return c();case N.REASONING_START:return a(yield Ee(n,i,o,(v,S,g)=>v.onReasoningStartEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case N.REASONING_MESSAGE_START:{let v=yield Ee(n,i,o,(S,g,y)=>S.onReasoningMessageStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{messageId:S}=u;if(!i.find(g=>g.id===S)){let g={id:S,role:"reasoning",content:""};i.push(g),a({messages:i})}}return c()}case N.REASONING_MESSAGE_CONTENT:{let{messageId:v,delta:S}=u,g=i.find(C=>C.id===v);if(!g)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${v}'`),c();let y=yield Ee(n,i,o,(C,E,x)=>C.onReasoningMessageContentEvent?.({event:u,messages:E,state:x,agent:r,input:e,reasoningMessageBuffer:typeof g.content=="string"?g.content:""}));return a(y),y.stopPropagation!==!0&&(g.content=`${typeof g.content=="string"?g.content:""}${S}`,a({messages:i})),c()}case N.REASONING_MESSAGE_END:{let{messageId:v}=u,S=i.find(g=>g.id===v);return S?(a(yield Ee(n,i,o,(g,y,C)=>g.onReasoningMessageEndEvent?.({event:u,messages:y,state:C,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:S,messages:i,state:o,agent:r,input:e})})),c()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${v}'`),c())}case N.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case N.REASONING_END:return a(yield Ee(n,i,o,(v,S,g)=>v.onReasoningEndEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case N.REASONING_ENCRYPTED_VALUE:{let{subtype:v,entityId:S,encryptedValue:g}=u,y=yield Ee(n,i,o,(C,E,x)=>C.onReasoningEncryptedValueEvent?.({event:u,messages:E,state:x,agent:r,input:e}));if(a(y),y.stopPropagation!==!0){let C=!1;if(v==="tool-call"){for(let E of i)if(E.role==="assistant"&&E.toolCalls){let x=E.toolCalls.find(I=>I.id===S);if(x){x.encryptedValue=g,C=!0;break}}}else{let E=i.find(x=>x.id===S);E?.role!=="activity"&&E&&(E.encryptedValue=g,C=!0)}C&&(s.messages=i)}return c()}}return u.type,c()});return function(_x77){return _ref37.apply(this,arguments)}}()),Zl(),n.length>0?td({}):u=>u)},yd=e=>t=>{let r=new Map,n=new Map,i=!1,o=!1,s=!1,a=new Map,c=!1,u=!1,h=!1,v=()=>{r.clear(),n.clear(),a.clear(),c=!1,u=!1,i=!1,o=!1,h=!0};return t.pipe(ct(S=>{let g=S.type;if(e&&console.debug("[VERIFY]:",JSON.stringify(S)),o)return _e(()=>new Oe(`Cannot send event type '${g}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(i&&g!==N.RUN_ERROR&&g!==N.RUN_STARTED)return _e(()=>new Oe(`Cannot send event type '${g}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(s){if(g===N.RUN_STARTED){if(h&&!i)return _e(()=>new Oe("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&&v()}}else if(s=!0,g!==N.RUN_STARTED&&g!==N.RUN_ERROR)return _e(()=>new Oe("First event must be 'RUN_STARTED'"));switch(g){case N.TEXT_MESSAGE_START:{let y=S.messageId;return r.has(y)?_e(()=>new Oe(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${y}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(r.set(y,!0),Pe(S))}case N.TEXT_MESSAGE_CONTENT:{let y=S.messageId;return r.has(y)?Pe(S):_e(()=>new Oe(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${y}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case N.TEXT_MESSAGE_END:{let y=S.messageId;return r.has(y)?(r.delete(y),Pe(S)):_e(()=>new Oe(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${y}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case N.TOOL_CALL_START:{let y=S.toolCallId;return n.has(y)?_e(()=>new Oe(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${y}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(n.set(y,!0),Pe(S))}case N.TOOL_CALL_ARGS:{let y=S.toolCallId;return n.has(y)?Pe(S):_e(()=>new Oe(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${y}'. Start a tool call with 'TOOL_CALL_START' first.`))}case N.TOOL_CALL_END:{let y=S.toolCallId;return n.has(y)?(n.delete(y),Pe(S)):_e(()=>new Oe(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${y}'. A 'TOOL_CALL_START' event must be sent first.`))}case N.STEP_STARTED:{let y=S.stepName;return a.has(y)?_e(()=>new Oe(`Step "${y}" is already active for 'STEP_STARTED'`)):(a.set(y,!0),Pe(S))}case N.STEP_FINISHED:{let y=S.stepName;return a.has(y)?(a.delete(y),Pe(S)):_e(()=>new Oe(`Cannot send 'STEP_FINISHED' for step "${y}" that was not started`))}case N.RUN_STARTED:return h=!0,Pe(S);case N.RUN_FINISHED:if(a.size>0){let y=Array.from(a.keys()).join(", ");return _e(()=>new Oe(`Cannot send 'RUN_FINISHED' while steps are still active: ${y}`))}if(r.size>0){let y=Array.from(r.keys()).join(", ");return _e(()=>new Oe(`Cannot send 'RUN_FINISHED' while text messages are still active: ${y}`))}if(n.size>0){let y=Array.from(n.keys()).join(", ");return _e(()=>new Oe(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${y}`))}return i=!0,Pe(S);case N.RUN_ERROR:return o=!0,Pe(S);case N.CUSTOM:return Pe(S);case N.THINKING_TEXT_MESSAGE_START:return c?u?_e(()=>new Oe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(u=!0,Pe(S)):_e(()=>new Oe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case N.THINKING_TEXT_MESSAGE_CONTENT:return u?Pe(S):_e(()=>new Oe("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case N.THINKING_TEXT_MESSAGE_END:return u?(u=!1,Pe(S)):_e(()=>new Oe("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case N.THINKING_START:return c?_e(()=>new Oe("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(c=!0,Pe(S));case N.THINKING_END:return c?(c=!1,Pe(S)):_e(()=>new Oe("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Pe(S)}}))},mn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),qT=(e,t)=>ed(()=>dn(b(e,t))).pipe(rd(r=>{if(!r.ok){let o=r.headers.get("content-type")||"";return dn(r.text()).pipe(ct(s=>{let a=s;if(o.includes("application/json"))try{a=JSON.parse(s)}catch{}let c=Error(`HTTP ${r.status}: ${typeof a=="string"?a:JSON.stringify(a)}`);return c.status=r.status,c.payload=a,_e(()=>c)}))}let n={type:mn.HEADERS,status:r.status,headers:r.headers},i=r.body?.getReader();return i?new Te(o=>(o.next(n),_asyncToGenerator(function*(){try{for(;;){let{done:s,value:a}=yield i.read();if(s)break;let c={type:mn.DATA,data:a};o.next(c)}o.complete()}catch(s){o.error(s)}})(),()=>{i.cancel().catch(s=>{if(s?.name!=="AbortError")throw s})})):_e(()=>Error("Failed to getReader() from response"))})),LT=e=>{let t=new Bt,r=new TextDecoder("utf-8",{fatal:!1}),n="";e.subscribe({next:o=>{if(o.type!==mn.HEADERS&&o.type===mn.DATA&&o.data){let s=r.decode(o.data,{stream:!0});n+=s;let a=n.split(/\n\n/);n=a.pop()||"";for(let c of a)i(c)}},error:o=>t.error(o),complete:()=>{n&&(n+=r.decode(),i(n)),t.complete()}});function i(o){let s=o.split(`
|
|
39
39
|
`),a=[];for(let c of s)c.startsWith("data:")&&a.push(c.slice(5).replace(/^ /,""));if(a.length>0)try{let c=a.join(`
|
|
40
|
-
`),u=JSON.parse(c);t.next(u)}catch(c){t.error(c)}}return t.asObservable()},
|
|
41
|
-
`)},k_=(e,t,r)=>n=>{let i={},o=!0,s=!0,a="",c=null,u=null,h=[],v={},S=g=>{typeof g=="object"&&g&&("messages"in g&&delete g.messages,i=g)};return n.pipe(ct(g=>{switch(g.type){case N.TEXT_MESSAGE_START:{let y=g;return[{type:Re.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case N.TEXT_MESSAGE_CONTENT:{let y=g;return[{type:Re.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case N.TEXT_MESSAGE_END:{let y=g;return[{type:Re.enum.TextMessageEnd,messageId:y.messageId}]}case N.TOOL_CALL_START:{let y=g;return h.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),s=!0,v[y.toolCallId]=y.toolCallName,[{type:Re.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case N.TOOL_CALL_ARGS:{let y=g,C=h.find(x=>x.id===y.toolCallId);if(!C)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];C.function.arguments+=y.delta;let E=!1;if(u){let x=u.find(R=>R.tool==C.function.name);if(x)try{let R=JSON.parse(Va(C.function.arguments));x.tool_argument&&x.tool_argument in R?(S({...i,[x.state_key]:R[x.tool_argument]}),E=!0):x.tool_argument||(S({...i,[x.state_key]:R}),E=!0)}catch{}}return[{type:Re.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(E?[{type:Re.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:s}]:[])]}case N.TOOL_CALL_END:{let y=g;return[{type:Re.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case N.TOOL_CALL_RESULT:{let y=g;return[{type:Re.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:v[y.toolCallId]||"unknown"}]}case N.RAW:return[];case N.CUSTOM:{let y=g;switch(y.name){case"Exit":o=!1;break;case"PredictState":u=y.value;break}return[{type:Re.enum.MetaEvent,name:y.name,value:y.value}]}case N.STATE_SNAPSHOT:return S(g.snapshot),[{type:Re.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:s}];case N.STATE_DELTA:{let y=g,C=br(i,y.delta,!0,!1);return C?(S(C.newDocument),[{type:Re.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:s}]):[]}case N.MESSAGES_SNAPSHOT:return c=g.messages,[{type:Re.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify({...i,...(c?{messages:c}:{})}),active:!0}];case N.RUN_STARTED:return[];case N.RUN_FINISHED:return c&&(i.messages=c),Object.keys(i).length===0?[]:[{type:Re.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify({...i,...(c?{messages:O_(c)}:{})}),active:!1}];case N.RUN_ERROR:{let y=g;return[{type:Re.enum.RunError,message:y.message,code:y.code}]}case N.STEP_STARTED:return a=g.stepName,h=[],u=null,[{type:Re.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:!0}];case N.STEP_FINISHED:return h=[],u=null,[{type:Re.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:!1}];default:return[]}}))};function O_(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=__(r.content);if(n){let i={id:r.id,role:r.role,content:n};t.push(i)}if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0)for(let i of r.toolCalls){let o={id:i.id,name:i.function.name,arguments:JSON.parse(i.function.arguments),parentMessageId:r.id};t.push(o)}}else if(r.role==="tool"){let n="unknown";for(let o of e)if(o.role==="assistant"&&o.toolCalls?.length){for(let s of o.toolCalls)if(s.id===r.toolCallId){n=s.function.name;break}}let i={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(i)}return t}var fc=e=>t=>{let r,n,i,o,s=()=>{if(!r||o!=="text")throw Error("No text message to close");let h={type:N.TEXT_MESSAGE_END,messageId:r.messageId};return o=void 0,r=void 0,e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_END",JSON.stringify(h)),h},a=()=>{if(!n||o!=="tool")throw Error("No tool call to close");let h={type:N.TOOL_CALL_END,toolCallId:n.toolCallId};return o=void 0,n=void 0,e&&console.debug("[TRANSFORM]: TOOL_CALL_END",JSON.stringify(h)),h},c=()=>{if(!i||o!=="reasoning")throw Error("No reasoning message to close");let h={type:N.REASONING_MESSAGE_END,messageId:i.messageId};return o=void 0,i=void 0,e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_END",JSON.stringify(h)),h},u=()=>o==="text"?[s()]:o==="tool"?[a()]:o==="reasoning"?[c()]:[];return t.pipe(ct(h=>{switch(h.type){case N.TEXT_MESSAGE_START:case N.TEXT_MESSAGE_CONTENT:case N.TEXT_MESSAGE_END:case N.TOOL_CALL_START:case N.TOOL_CALL_ARGS:case N.TOOL_CALL_END:case N.TOOL_CALL_RESULT:case N.STATE_SNAPSHOT:case N.STATE_DELTA:case N.MESSAGES_SNAPSHOT:case N.CUSTOM:case N.RUN_STARTED:case N.RUN_FINISHED:case N.RUN_ERROR:case N.STEP_STARTED:case N.STEP_FINISHED:case N.THINKING_START:case N.THINKING_END:case N.THINKING_TEXT_MESSAGE_START:case N.THINKING_TEXT_MESSAGE_CONTENT:case N.THINKING_TEXT_MESSAGE_END:case N.REASONING_START:case N.REASONING_MESSAGE_START:case N.REASONING_MESSAGE_CONTENT:case N.REASONING_MESSAGE_END:case N.REASONING_END:return[...u(),h];case N.RAW:case N.ACTIVITY_SNAPSHOT:case N.ACTIVITY_DELTA:case N.REASONING_ENCRYPTED_VALUE:return[h];case N.TEXT_MESSAGE_CHUNK:let v=h,S=[];if((o!=="text"||v.messageId!==void 0&&v.messageId!==r?.messageId)&&S.push(...u()),o!=="text"){if(v.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");r={messageId:v.messageId},o="text";let x={type:N.TEXT_MESSAGE_START,messageId:v.messageId,role:v.role||"assistant"};S.push(x),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_START",JSON.stringify(x))}if(v.delta!==void 0){let x={type:N.TEXT_MESSAGE_CONTENT,messageId:r.messageId,delta:v.delta};S.push(x),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_CONTENT",JSON.stringify(x))}return S;case N.TOOL_CALL_CHUNK:let g=h,y=[];if((o!=="tool"||g.toolCallId!==void 0&&g.toolCallId!==n?.toolCallId)&&y.push(...u()),o!=="tool"){if(g.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(g.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");n={toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId},o="tool";let x={type:N.TOOL_CALL_START,toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId};y.push(x),e&&console.debug("[TRANSFORM]: TOOL_CALL_START",JSON.stringify(x))}if(g.delta!==void 0){let x={type:N.TOOL_CALL_ARGS,toolCallId:n.toolCallId,delta:g.delta};y.push(x),e&&console.debug("[TRANSFORM]: TOOL_CALL_ARGS",JSON.stringify(x))}return y;case N.REASONING_MESSAGE_CHUNK:let C=h,E=[];if((o!=="reasoning"||C.messageId&&C.messageId!==i?.messageId)&&E.push(...u()),o!=="reasoning"){if(C.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");i={messageId:C.messageId},o="reasoning";let x={type:N.REASONING_MESSAGE_START,messageId:C.messageId};E.push(x),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_START",JSON.stringify(x))}if(C.delta!==void 0){let x={type:N.REASONING_MESSAGE_CONTENT,messageId:i.messageId,delta:C.delta};E.push(x),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_CONTENT",JSON.stringify(x))}return E}return h.type,[]}),An(()=>{u()}))},kd=class{runNext(e,t){return t.run(e).pipe(fc(!1))}runNextWithState(e,t){let r=Ie(e.messages||[]),n=Ie(e.state||{}),i=new xa;return lv(e,i,t,[]).subscribe(o=>{o.messages!==void 0&&(r=o.messages),o.state!==void 0&&(n=o.state)}),this.runNext(e,t).pipe(La(/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(o){return i.next(o),yield new Promise(s=>setTimeout(s,0)),{event:o,messages:Ie(r),state:Ie(n)}});return function(_x87){return _ref42.apply(this,arguments)}}()))}},P_=class extends kd{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function N_(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 F_=class extends kd{run(e,t){let{parentRunId:r,...n}=e,i={...n,messages:n.messages.map(N_)};return this.runNext(i,t)}},ov="THINKING_START",sv="THINKING_END",av="THINKING_TEXT_MESSAGE_START",cv="THINKING_TEXT_MESSAGE_CONTENT",uv="THINKING_TEXT_MESSAGE_END",D_=class extends kd{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){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(Sn(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case ov:{this.currentReasoningId=_o();let{title:t,...r}=e;return this.warnAboutTransformation(ov,N.REASONING_START),{...r,type:N.REASONING_START,messageId:this.currentReasoningId}}case av:return this.currentMessageId=_o(),this.warnAboutTransformation(av,N.REASONING_MESSAGE_START),{...e,type:N.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case cv:{let{delta:t,...r}=e;return this.warnAboutTransformation(cv,N.REASONING_MESSAGE_CONTENT),{...r,type:N.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??_o(),delta:t}}case uv:{let t=this.currentMessageId??_o();return this.warnAboutTransformation(uv,N.REASONING_MESSAGE_END),{...e,type:N.REASONING_MESSAGE_END,messageId:t}}case sv:{let t=this.currentReasoningId??_o();return this.warnAboutTransformation(sv,N.REASONING_END),{...e,type:N.REASONING_END,messageId:t}}default:return e}}},M_="0.0.45",j_=class{get maxVersion(){return M_}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:i,debug:o}={}){this.debug=!1,this.subscribers=[],this.isRunning=!1,this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??yr(),this.messages=Ie(n??[]),this.state=Ie(i??{}),this.debug=o??!1,pc(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new F_),pc(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new D_)}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 P_(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??yr();let r=_this1.prepareRunAgentInput(e),n,i=new Set(_this1.messages.map(c=>c.id)),o=[{onRunFinishedEvent:c=>{n=c.result}},..._this1.subscribers,t??{}];yield _this1.onInitialize(r,o),_this1.activeRunDetach$=new Bt;let s;_this1.activeRunCompletionPromise=new Promise(c=>{s=c}),yield qa(Ca(()=>_this1.middlewares.length===0?_this1.run(r):_this1.middlewares.reduceRight((c,u)=>({run:h=>u.run(h,c)}),_this1).run(r),fc(_this1.debug),_d(_this1.debug),c=>c.pipe(Ua(_this1.activeRunDetach$)),c=>_this1.apply(r,c,o),c=>_this1.processApplyEvents(r,c,o),Io(c=>(_this1.isRunning=!1,_this1.onError(r,c,o))),An(()=>{_this1.isRunning=!1,_this1.onFinalize(r,o),s?.(),s=void 0,_this1.activeRunCompletionPromise=void 0,_this1.activeRunDetach$=void 0}))(Ne(null)));let a=Ie(_this1.messages).filter(c=>!i.has(c.id));return{result:n,newMessages:a}}finally{_this1.isRunning=!1}})()}connect(e){throw new Jl}connectAgent(e,t){var _this10=this;return _asyncToGenerator(function*(){try{_this10.isRunning=!0,_this10.agentId=_this10.agentId??yr();let r=_this10.prepareRunAgentInput(e),n,i=new Set(_this10.messages.map(c=>c.id)),o=[{onRunFinishedEvent:c=>{n=c.result}},..._this10.subscribers,t??{}];yield _this10.onInitialize(r,o),_this10.activeRunDetach$=new Bt;let s;_this10.activeRunCompletionPromise=new Promise(c=>{s=c}),yield qa(Ca(()=>_this10.connect(r),fc(_this10.debug),_d(_this10.debug),c=>c.pipe(Ua(_this10.activeRunDetach$)),c=>_this10.apply(r,c,o),c=>_this10.processApplyEvents(r,c,o),Io(c=>(_this10.isRunning=!1,c instanceof Jl?Ea:_this10.onError(r,c,o))),An(()=>{_this10.isRunning=!1,_this10.onFinalize(r,o),s?.(),s=void 0,_this10.activeRunCompletionPromise=void 0,_this10.activeRunDetach$=void 0}))(Ne(null)));let a=Ie(_this10.messages).filter(c=>!i.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 lv(e,t,this,r)}processApplyEvents(e,t,r){return t.pipe(gd(n=>{n.messages&&(this.messages=n.messages,r.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,r.forEach(i=>{i.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Ie(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||yr(),tools:Ie(e?.tools??[]),context:Ie(e?.context??[]),forwardedProps:Ie(e?.forwardedProps??{}),state:Ie(this.state),messages:t}}onInitialize(e,t){var _this12=this;return _asyncToGenerator(function*(){let r=yield Ee(t,_this12.messages,_this12.state,(n,i,o)=>n.onRunInitialized?.({messages:i,state:o,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 vn(Ee(r,this.messages,this.state,(n,i,o)=>n.onRunFailed?.({error:t,messages:i,state:o,agent:this,input:e}))).pipe(Sn(n=>{let i=n;if((i.messages!==void 0||i.state!==void 0)&&(i.messages!==void 0&&(this.messages=i.messages,r.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),i.state!==void 0&&(this.state=i.state,r.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),i.stopPropagation!==!0)throw console.error("Agent execution failed:",t),t;return{}}))}onFinalize(e,t){var _this13=this;return _asyncToGenerator(function*(){let r=yield Ee(t,_this13.messages,_this13.state,(n,i,o)=>n.onRunFinalized?.({messages:i,state:o,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=Ie(this.messages),e.state=Ie(this.state),e.debug=this.debug,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],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=Ie(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=Ie(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??yr();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:i=>n.run(i,r)}),this).run(t)).pipe(fc(this.debug),_d(this.debug),k_(this.threadId,t.runId,this.agentId),r=>r.pipe(Sn(n=>(this.debug&&console.debug("[LEGACY]:",JSON.stringify(n)),n))))}},dv=class extends j_{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=Ie(e.headers??{})}run(e){return y_(m_(this.url,this.requestInit(e)))}clone(){let e=super.clone();e.url=this.url,e.headers=Ie(this.headers??{});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 pv=(e,t,r)=>{let n=Te(t,r),i=e?.trim();if(!n||!t||!i)throw new Error("Missing required parameters for answer endpoint");let o=`/api/preview/organizations/${t}/agents`;return`${n}${o}/${i}`};var Od=class extends dv{requestInit(t){let{params:r,accessToken:n}=t.forwardedProps||{};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(r),signal:this.abortController.signal}}},fv=(e,t,r)=>new Od({url:`${pv(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var q_={"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};function mv(e){return e?q_[e]??1004:1004}var gv=e=>({onRunStartedEvent:({event:t})=>{e(ii(t.runId)),e(Tt(!1)),e(fr(!0)),e(Rs(t.threadId))},onStepStartedEvent:({event:t})=>{e(Sh({name:t.stepName,startedAt:t.timestamp??Date.now()}))},onStepFinishedEvent:({event:t})=>{e(Ah({name:t.stepName,finishedAt:t.timestamp??Date.now()}))},onTextMessageContentEvent:({event:t})=>{e(Hr({textDelta:t.delta}))},onCustomEvent:({event:t})=>{let{name:r,value:n}=t;switch(r){case"header":{n?.contentFormat&&e(Kr(n.contentFormat)),n?.followUpEnabled&&e(Is(n.followUpEnabled));return}case"citations":{e(zr({citations:n.citations}));return}}},onRunErrorEvent:({event:t})=>{let r=mv(t.code);e(Wr({message:t.message,code:r}))},onRunFinishedEvent:({event:t})=>{let r=t.result?.answerGenerated??!1;e(po(r)),e(Yr(!r)),e(fr(!1))}});var hv=()=>{let e,t=()=>{e?.abortRun(),e=void 0};return{run:function(){var _ref47=_asyncToGenerator(function*(n,i,o){t();let s=lr(n),a=Um(n),c=Vm(n),u=Lm(n),h=fv(s,a,c);e=h;let v=gv(i),S=ra(n,o());try{i(Tt(!0)),yield h.runAgent({forwardedProps:{params:S,accessToken:u}},v)}catch(g){i(Tt(!1)),i(Wr({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",g)}});return function run(_x88,_x89,_x90){return _ref47.apply(this,arguments)}}(),abortRun:t}};m();d();f();p();m();d();f();p();var yv=q("breadcrumb/deselectAll"),vv=q("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var Sv=q("facet/updateFacetAutoSelection",e=>z(e,{allow:new De({required:!0})}));m();d();f();p();m();d();f();p();var mc=class extends pr{constructor(r){super(r);this.getState=r}get activeInstantResultQuery(){let r=this.getState().instantResults;for(let n in r)for(let i in r[n].cache)if(r[n].cache[i].isActive)return r[n].q;return null}get activeInstantResultCache(){let r=this.getState().instantResults;for(let n in r)for(let i in r[n].cache)if(r[n].cache[i].isActive)return r[n].cache[i];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??Rt().q}get responseTime(){return this.activeInstantResultCache?.duration??Mt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??Mt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var Av=()=>et("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new mc(e)),wv=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var Pd={id:te},L_={...Pd,q:It},Qee=q("instantResults/register",e=>z(e,Pd)),gc=q("instantResults/updateQuery",e=>z(e,L_)),Hee=q("instantResults/clearExpired",e=>z(e,Pd));m();d();f();p();var hc=new Le({required:!0,min:0}),tte=q("pagination/registerNumberOfResults",e=>z(e,hc)),rte=q("pagination/updateNumberOfResults",e=>z(e,hc)),nte=q("pagination/registerPage",e=>z(e,hc)),bv=q("pagination/updatePage",e=>z(e,hc)),ite=q("pagination/nextPage"),ote=q("pagination/previousPage");m();d();f();p();var Ei=q("query/updateQuery",e=>z(e,{q:new J,enableQuerySyntax:new De}));m();d();f();p();m();d();f();p();m();d();f();p();var Ii=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var Nd=()=>et("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),xr=e=>et("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||Rt().q,aq:r.advancedSearchQueries?.aq||Ii().aq,cq:r.advancedSearchQueries?.cq||Ii().cq,dq:r.advancedSearchQueries?.dq||Ii().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();m();d();f();p();var yc=e=>e.success!==void 0,ut=e=>e.error!==void 0;m();d();f();p();var rre=q("didYouMean/enable"),nre=q("didYouMean/disable"),ire=q("didYouMean/automaticCorrections/disable"),ore=q("didYouMean/automaticCorrections/enable"),vc=q("didYouMean/correction",e=>z(e,te)),sre=q("didYouMean/automaticCorrections/mode",e=>z(e,new J({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var Fd=()=>et("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var Cv=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function xv(){return{contextValues:{}}}m();d();f();p();function Ev(){return{contextValues:{}}}m();d();f();p();function Iv(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function Rv(){return[]}m();d();f();p();function Tv(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function _v(){return{}}m();d();f();p();function kv(){return{}}m();d();f();p();function Ov(){return{}}function $t(e){return{context:e.context||xv(),dictionaryFieldContext:e.dictionaryFieldContext||Ev(),facetSet:e.facetSet||Ws(),numericFacetSet:e.numericFacetSet||zs(),dateFacetSet:e.dateFacetSet||Hs(),categoryFacetSet:e.categoryFacetSet||Qs(),automaticFacetSet:e.automaticFacetSet??$s(),pagination:e.pagination||Tv(),query:e.query||Rt(),tabSet:e.tabSet||Ov(),advancedSearchQueries:e.advancedSearchQueries||Ii(),staticFilterSet:e.staticFilterSet||kv(),querySet:e.querySet||_v(),sortCriteria:e.sortCriteria||Ks(),pipeline:e.pipeline||Xs(),searchHub:e.searchHub||Bn(),facetOptions:e.facetOptions||Iv(),facetOrder:e.facetOrder??Rv(),debug:e.debug??us()}}m();d();f();p();var Pne=new xe({values:{undoneQuery:It},options:{required:!0}}),Pv=()=>et("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var Sc=q("trigger/query/ignore",e=>z(e,new J({emptyAllowed:!0,required:!0}))),Ac=q("trigger/query/modification",e=>z(e,new xe({values:{originalQuery:Ge,modification:Ge}})));m();d();f();p();var Er=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=G_(e),n=ea(e),i=U_(e),o=yield oi(e,t),s=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return mr({...o,...(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:i}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Er(_x91,_x92){return _ref48.apply(this,arguments)}}();function U_(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(V_).filter(r=>r.currentValues.length>0):void 0}function V_(e){let{field:t,label:r,values:n}=e,i=n.filter(o=>o.state==="selected");return{field:t,label:r,currentValues:i}}function G_(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(o=>o.isActive)?.expression.trim()||"",i=B_(e);return[t,n,...i].filter(o=>!!o).join(" AND ")}function B_(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(o=>o.state==="selected"&&!!o.expression.trim()),i=n.map(o=>o.expression).join(" OR ");return n.length>1?`(${i})`:i})}var Ir=class{constructor(t,r=n=>{this.dispatch(Ei({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x93,_x94){var _this18=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let i=Date.now(),o=Zs(yield _this18.extra.apiClient.search(r,n),t),s=Date.now()-i,a=_this18.getState().query?.q||"";return{response:o,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 ut(t.response)?(this.dispatch(xr(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:i,automaticallyCorrectQuery:o}=r.didYouMean,{results:s,queryCorrections:a,queryCorrection:c}=n;if(!i||!o)return null;let u=s.length===0&&a&&a.length!==0,h=!ie(c)&&!ie(c.correctedQuery);if(!u&&!h)return null;let S=u?yield _this20.processLegacyDidYouMeanAutoCorrection(t):_this20.processModernDidYouMeanAutoCorrection(t);return _this20.dispatch(Ft($t(_this20.getState()))),S})()}processLegacyDidYouMeanAutoCorrection(t){var _this21=this;return _asyncToGenerator(function*(){let r=_this21.getCurrentQuery(),n=_this21.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:i}=n.queryCorrections[0],o=yield _this21.automaticallyRetryQueryWithCorrection(i);return ut(o.response)?(_this21.dispatch(xr(o.response.error)),_this21.rejectWithValue(o.response.error)):(_this21.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this21.dispatch(Ft($t(_this21.getState()))),{...o,response:{...o.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Fd()})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:i}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:i,analyticsAction:Fd()}}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(Sc("")),null;_this22.analyticsAction&&(yield _this22.dispatch(_this22.analyticsAction));let o=_this22.getCurrentQuery(),s=yield _this22.automaticallyRetryQueryWithTriggerModification(n);return ut(s.response)?(_this22.dispatch(xr(s.response.error)),_this22.rejectWithValue(s.response.error)):(_this22.dispatch(Ft($t(_this22.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:o,analyticsAction:Pv()})})()}getStateAfterResponse(t,r,n,i){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??Rt().enableQuerySyntax},search:{...Mt(),duration:r,response:i,results:i.results}}}processSuccessResponse(t){return this.dispatch(Ft($t(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return yc(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this23=this;return _asyncToGenerator(function*(){_this23.onUpdateQueryForCorrection(t);let r=yield _this23.fetchFromAPI(yield Er(_this23.getState()),{origin:"mainSearch"});return _this23.dispatch(vc(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.dispatch(Ac({newQuery:t,originalQuery:_this24.getCurrentQuery()})),_this24.onUpdateQueryForCorrection(t),yield _this24.fetchFromAPI(yield Er(_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 Oie=ve("search/executeSearch",/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t){let r=t.getState();return yield wc(r,t,e)});return function(_x95,_x96){return _ref49.apply(this,arguments)}}()),Pie=ve("search/fetchPage",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Md(r,t,e)});return function(_x97,_x98){return _ref50.apply(this,arguments)}}()),Nie=ve("search/fetchMoreResults",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();return yield jd(t,r)});return function(_x99,_x100){return _ref51.apply(this,arguments)}}()),Fie=ve("search/fetchFacetValues",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield z_(t,e,r)});return function(_x101,_x102){return _ref52.apply(this,arguments)}}()),Die=ve("search/fetchInstantResults",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){return Dd(e,t)});return function(_x103,_x104){return _ref53.apply(this,arguments)}}()),$_=/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=yield Er(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function $_(_x105,_x106){return _ref54.apply(this,arguments)}}(),Q_=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield oi(e);return mr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function Q_(_x107,_x108,_x109){return _ref55.apply(this,arguments)}}(),H_=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){let r=yield Er(e,t);return r.request.numberOfResults=0,r});return function H_(_x110,_x111){return _ref56.apply(this,arguments)}}(),Nv=e=>{e.configuration.analytics.enabled&&jt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Dd(_x112,_x113){return _Dd.apply(this,arguments)}function _Dd(){_Dd=_asyncToGenerator(function*(e,t){z(e,{id:te,q:te,maxResultsPerQuery:new Le({required:!0,min:1}),cacheTimeout:new Le});let{q:r,maxResultsPerQuery:n}=e,i=t.getState(),o=new Ir({...t,analyticsAction:Av()},u=>{t.dispatch(gc({q:u,id:e.id}))}),s=yield Q_(i,r,n),a=yield o.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),c=yield o.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 _Dd.apply(this,arguments)}function Md(_x114,_x115,_x116){return _Md.apply(this,arguments)}function _Md(){_Md=_asyncToGenerator(function*(e,t,r){Nv(e);let{analyticsClientMiddleware:n,preprocessRequest:i,logger:o}=t.extra,{description:s}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:i,logger:o}),a=new Ir({...t,analyticsAction:r}),c=yield Er(e,s),u=yield a.fetchFromAPI(c,{origin:"mainSearch"});return yield a.process(u)});return _Md.apply(this,arguments)}function jd(_x117,_x118){return _jd.apply(this,arguments)}function _jd(){_jd=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:i}=e.extra,{description:o}=yield Nd().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:i}),s=new Ir({...e,analyticsAction:Nd()}),a=yield $_(t,o),c=yield s.fetchFromAPI(a,{origin:"mainSearch"});return yield s.process(c)});return _jd.apply(this,arguments)}function z_(_x119,_x120,_x121){return _z_.apply(this,arguments)}function _z_(){_z_=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:i,logger:o}=e.extra,{description:s}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:i,logger:o}),a=new Ir({...e,analyticsAction:t}),c=yield H_(r,s),u=yield a.fetchFromAPI(c,{origin:"facetValues"});return yield a.process(u)});return _z_.apply(this,arguments)}function wc(_x122,_x123,_x124){return _wc.apply(this,arguments)}function _wc(){_wc=_asyncToGenerator(function*(e,t,r){Nv(e);let{analyticsClientMiddleware:n,preprocessRequest:i,logger:o}=t.extra,{description:s}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:i,logger:o}),a=yield Er(e,s),c=new Ir({...t,analyticsAction:r}),u=yield c.fetchFromAPI(a,{origin:"mainSearch"});return yield c.process(u)});return _wc.apply(this,arguments)}m();d();f();p();var Rr=class{constructor(t,r=n=>{this.dispatch(Ei({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x125,_x126){var _this25=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let i=Date.now(),o=Zs(yield _this25.extra.apiClient.search(r,n),t),s=Date.now()-i,a=_this25.getState().query?.q||"";return{response:o,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 ut(t.response)?(this.dispatch(xr(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:i,automaticallyCorrectQuery:o}=r.didYouMean,{results:s,queryCorrections:a,queryCorrection:c}=n;if(!i||!o)return null;let u=s.length===0&&a&&a.length!==0,h=!ie(c)&&!ie(c.correctedQuery);if(!u&&!h)return null;let S=u?yield _this27.processLegacyDidYouMeanAutoCorrection(t):_this27.processModernDidYouMeanAutoCorrection(t);return _this27.dispatch(Ft($t(_this27.getState()))),S})()}processLegacyDidYouMeanAutoCorrection(t){var _this28=this;return _asyncToGenerator(function*(){let r=_this28.getCurrentQuery(),n=_this28.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:i}=n.queryCorrections[0],o=yield _this28.automaticallyRetryQueryWithCorrection(i);return ut(o.response)?(_this28.dispatch(xr(o.response.error)),_this28.rejectWithValue(o.response.error)):(_this28.dispatch(Ft($t(_this28.getState()))),{...o,response:{...o.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:i}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:i}}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(Sc("")),null;let o=_this29.getCurrentQuery(),s=yield _this29.automaticallyRetryQueryWithTriggerModification(n);return ut(s.response)?(_this29.dispatch(xr(s.response.error)),_this29.rejectWithValue(s.response.error)):(_this29.dispatch(Ft($t(_this29.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:o})})()}processSuccessResponse(t){return this.dispatch(Ft($t(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return yc(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this30=this;return _asyncToGenerator(function*(){_this30.onUpdateQueryForCorrection(t);let r=_this30.getState(),{actionCause:n}=Cv(),i=yield _this30.fetchFromAPI(yield hr(r,_this30.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this30.dispatch(vc(t)),i})()}automaticallyRetryQueryWithTriggerModification(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.dispatch(Ac({newQuery:t,originalQuery:_this31.getCurrentQuery()})),_this31.onUpdateQueryForCorrection(t),yield _this31.fetchFromAPI(yield hr(_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 Aoe=ve("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;z(e,{q:new J,enableQuerySyntax:new De,clearFilters:new De}),e.clearFilters&&(r(yv()),r(vv())),r(Sv({allow:!0})),r(Ei({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(bv(1))}),woe=q("search/updateSearchAction"),bc=ve("search/executeSearch",/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return wc(r,t,e.legacy);Mv(r);let n=e.next?jv(e.next):void 0,i=yield hr(r,t.extra.navigatorContext,n),o=new Rr({...t,analyticsAction:n??{}}),s=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(s)});return function(_x127,_x128){return _ref57.apply(this,arguments)}}()),Fv=ve("search/fetchPage",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t){let r=t.getState();if(Mv(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Md(r,t,e.legacy);let n=new Rr({...t,analyticsAction:e.next}),i=yield hr(r,t.extra.navigatorContext,e.next),o=yield n.fetchFromAPI(i,{origin:"mainSearch"});return yield n.process(o)});return function(_x129,_x130){return _ref58.apply(this,arguments)}}()),Dv=ve("search/fetchMoreResults",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return jd(t,r);let n=Mg("browseResults",t.getState),i=new Rr({...t,analyticsAction:n}),o=yield W_(r,t.extra.navigatorContext,n),s=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(s)});return function(_x131,_x132){return _ref59.apply(this,arguments)}}()),boe=ve("search/fetchFacetValues",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return wc(r,t,e.legacy);let n=new Rr({...t,analyticsAction:{}}),i=yield Y_(r,t.extra.navigatorContext),o=yield n.fetchFromAPI(i,{origin:"facetValues"});return yield n.process(o)});return function(_x133,_x134){return _ref60.apply(this,arguments)}}()),Coe=ve("search/fetchInstantResults",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Dd(e,t);z(e,{id:te,q:te,maxResultsPerQuery:new Le({required:!0,min:1}),cacheTimeout:new Le});let{q:n,maxResultsPerQuery:i}=e,o=jv(wv()),s=yield K_(r,t.extra.navigatorContext,n,i,o),a=new Rr({...t,analyticsAction:o},h=>{t.dispatch(gc({q:h,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(_x135,_x136){return _ref61.apply(this,arguments)}}()),W_=/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(e,t,r){let n=yield hr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function W_(_x137,_x138,_x139){return _ref62.apply(this,arguments)}}(),K_=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t,r,n,i){let o=ta(e,t,i);return mr({...o,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function K_(_x140,_x141,_x142,_x143,_x144){return _ref63.apply(this,arguments)}}(),Y_=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t,r){let n=yield hr(e,t,r);return n.request.numberOfResults=0,n});return function Y_(_x145,_x146,_x147){return _ref64.apply(this,arguments)}}(),Mv=e=>{e.configuration.analytics.enabled&&jt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},jv=e=>({actionCause:e.actionCause,type:e.actionCause});var qv=e=>{let t=Rf({extra:e}),r=hv();return t.startListening({actionCreator:bc.pending,effect:function(){var _ref65=_asyncToGenerator(function*(n,i){let o=i.getState();if(!ll(o))return;r.abortRun(),i.dispatch(ho()),i.dispatch(Ym());let s=Vr(o)?.q;!s||s.trim()===""||r.run(o,i.dispatch,e.getNavigatorContext)});return function effect(_x148,_x149){return _ref65.apply(this,arguments)}}()}),t};m();d();f();p();var Lv=e=>()=>t=>r=>{let n=r;if(!n.error)return t(r);let i=n.error;if(n.payload?.ignored||e.error({error:i,action:r},`Action dispatch error ${n.type}`),n.error.name!=="SchemaValidationError")return t(r)},Uv=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var qd=(e,t)=>{let{referrer:r,userAgent:n,location:i,clientId:o}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:i,clientId:o}};m();d();f();p();function Vv(e,t){let r={...e},n,i=o=>(s,a)=>{let c=o(s,a);return n?n(c,a):c};return{get combinedReducer(){let o=xp(Object.entries(t).filter(([s])=>!(s in r)).map(([s,a])=>[s,()=>a]));return i(Pn({...o,...r}))},containsAll(o){return Object.keys(o).every(a=>a in r)},add(o){Object.keys(o).filter(s=>!(s in r)).forEach(s=>{r[s]=o[s]})},addCrossReducer(o){n=o}}}m();d();f();p();m();d();f();p();var Ri=q("app/setError");m();d();f();p();function X_(e){if(!e||!J_(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),i=decodeURIComponent(n.split("").map(o=>`%${`00${o.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(i)}catch{return null}}function Gv(e,t=60){if(!e)return!1;let r=X_(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function J_(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function $v(e,t){let r=0,n=null,i=Mo(()=>{r=0},500),o=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(c,u=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(S){if(!u)throw S;return null}})().finally(()=>{n=null}));let v=yield n;return h&&v&&c.dispatch(Gn({accessToken:v})),v});return function o(_x150){return _ref66.apply(this,arguments)}}(),s=/*#__PURE__*/function(){var _ref68=_asyncToGenerator(function*(c){let u=c.getState(),h=ek(u);if(!(!h||!Gv(h))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield o(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(_x151){return _ref68.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(c,u,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),Bv(c,u.error),u;r++,i(),yield o(c,!0),c.dispatch(h)});return function a(_x152,_x153,_x154){return _ref69.apply(this,arguments)}}();return c=>u=>(/*#__PURE__*/function(){var _ref70=_asyncToGenerator(function*(h){let v=typeof h=="function",S=typeof t=="function";if(!v)return u(h);S&&(yield s(c));let g=yield u(h);return Z_(g)?S?yield a(c,g,h):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),Bv(c,g.error),g):g});return function(_x155){return _ref70.apply(this,arguments)}}())}function Z_(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Tn().name}function Bv(e,t){e.dispatch(Ri({status:401,statusCode:401,message:t.message,type:t.name}))}function ek(e){return e.configuration.accessToken}m();d();f();p();function Qv({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:i}){return ff({reducer:e,preloadedState:t,devTools:{stateSanitizer:o=>o.history?{...o,history:"<<OMIT>>"}:o,name:i,shouldHotReload:!1},middleware:o=>o({thunk:{extraArgument:n}}).prepend(...r).concat(Uv(n.logger))})}function tk(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...i}=r??{},o={...i,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return o.analyticsMode!=="next"&&Cp()?(t.info("Analytics disabled since doNotTrack is active."),{...o,enabled:!1}):o}function Hv(e,t){let r={...e.reducers,configuration:ft,version:bh},n=rk({...e,reducers:r},t,ft),{accessToken:i,environment:o,organizationId:s}=e.configuration;n.dispatch(Gn({accessToken:i,environment:o,organizationId:s}));let a=tk(e.configuration,n.logger);return a&&n.dispatch(ps(a)),n}function rk(e,t,r){let{reducers:n,navigatorContextProvider:i}=e,o=Vv({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&o.addCrossReducer(e.crossReducer);let s=t.logger,a={...t,get relay(){return Zi(u.state,i)},get navigatorContext(){return qd(this.relay,i)}},c=nk(e,a,o),u={addReducers(h){o.containsAll(h)||(o.add(h),c.replaceReducer(o.combinedReducer))},dispatch:c.dispatch,subscribe:c.subscribe,enableAnalytics(){c.dispatch(ms())},disableAnalytics(){c.dispatch(fs())},get state(){return c.getState()},get relay(){return Zi(this.state,i)},get navigatorContext(){return qd(this.relay,i)},logger:s,store:c};return u}function nk(e,t,r){let{preloadedState:n,configuration:i}=e,o=i.name||"coveo-headless",s=ik(e,t.logger,()=>t.navigatorContext);return Qv({preloadedState:n,reducer:r.combinedReducer,middlewares:s,thunkExtraArguments:t,name:o})}function ik(e,t,r){let{renewAccessToken:n}=e.configuration,i=$v(t,n),o=qv({getNavigatorContext:r});return[Ph,i,Lv(t),xh].concat(Ul.middleware,zn.middleware,o.middleware,e.middlewares||[])}var ok=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
|
|
40
|
+
`),u=JSON.parse(c);t.next(u)}catch(c){t.error(c)}}return t.asObservable()},UT=e=>{let t=new Bt,r=new Uint8Array;e.subscribe({next:i=>{if(i.type!==mn.HEADERS&&i.type===mn.DATA&&i.data){let o=new Uint8Array(r.length+i.data.length);o.set(r,0),o.set(i.data,r.length),r=o,n()}},error:i=>t.error(i),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 i=4+new DataView(r.buffer,r.byteOffset,4).getUint32(0,!1);if(r.length<i)break;try{let o=r.slice(4,i),s=Ey(o);t.next(s),r=r.slice(i)}catch(o){let s=o instanceof Error?o.message:String(o);t.error(Error(`Failed to decode protocol buffer message: ${s}`));return}}}return t.asObservable()},VT=e=>{let t=new Bt,r=new pa,n=!1;return e.subscribe({next:i=>{r.next(i),i.type===mn.HEADERS&&!n?(n=!0,i.headers.get("content-type")===Ry?UT(r).subscribe({next:o=>t.next(o),error:o=>t.error(o),complete:()=>t.complete()}):LT(r).subscribe({next:o=>{try{let s=Js.parse(o);t.next(s)}catch(s){t.error(s)}},error:o=>{if(o?.name==="AbortError"){t.next({type:N.RUN_ERROR,message:o.message||"Request aborted",code:"abort",rawEvent:o}),t.complete();return}return t.error(o)},complete:()=>t.complete()})):n||t.error(Error("No headers event received before data events"))},error:i=>{r.error(i),t.error(i)},complete:()=>{r.complete()}}),t.asObservable()},Ie=R.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),BT=R.enum(["LangGraphInterruptEvent","PredictState","Exit"]),GT=R.object({type:R.literal(Ie.enum.TextMessageStart),messageId:R.string(),parentMessageId:R.string().optional(),role:R.string().optional()}),$T=R.object({type:R.literal(Ie.enum.TextMessageContent),messageId:R.string(),content:R.string()}),QT=R.object({type:R.literal(Ie.enum.TextMessageEnd),messageId:R.string()}),HT=R.object({type:R.literal(Ie.enum.ActionExecutionStart),actionExecutionId:R.string(),actionName:R.string(),parentMessageId:R.string().optional()}),zT=R.object({type:R.literal(Ie.enum.ActionExecutionArgs),actionExecutionId:R.string(),args:R.string()}),WT=R.object({type:R.literal(Ie.enum.ActionExecutionEnd),actionExecutionId:R.string()}),KT=R.object({type:R.literal(Ie.enum.ActionExecutionResult),actionName:R.string(),actionExecutionId:R.string(),result:R.string()}),YT=R.object({type:R.literal(Ie.enum.AgentStateMessage),threadId:R.string(),agentName:R.string(),nodeName:R.string(),runId:R.string(),active:R.boolean(),role:R.string(),state:R.string(),running:R.boolean()}),XT=R.object({type:R.literal(Ie.enum.MetaEvent),name:BT,value:R.any()}),JT=R.object({type:R.literal(Ie.enum.RunError),message:R.string(),code:R.string().optional()});R.discriminatedUnion("type",[GT,$T,QT,HT,zT,WT,KT,YT,XT,JT]),R.object({id:R.string(),role:R.string(),content:R.string(),parentMessageId:R.string().optional()}),R.object({id:R.string(),name:R.string(),arguments:R.any(),parentMessageId:R.string().optional()}),R.object({id:R.string(),result:R.any(),actionExecutionId:R.string(),actionName:R.string()});var ZT=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(`
|
|
41
|
+
`)},e_=(e,t,r)=>n=>{let i={},o=!0,s=!0,a="",c=null,u=null,h=[],v={},S=g=>{typeof g=="object"&&g&&("messages"in g&&delete g.messages,i=g)};return n.pipe(ct(g=>{switch(g.type){case N.TEXT_MESSAGE_START:{let y=g;return[{type:Ie.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case N.TEXT_MESSAGE_CONTENT:{let y=g;return[{type:Ie.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case N.TEXT_MESSAGE_END:{let y=g;return[{type:Ie.enum.TextMessageEnd,messageId:y.messageId}]}case N.TOOL_CALL_START:{let y=g;return h.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),s=!0,v[y.toolCallId]=y.toolCallName,[{type:Ie.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case N.TOOL_CALL_ARGS:{let y=g,C=h.find(x=>x.id===y.toolCallId);if(!C)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];C.function.arguments+=y.delta;let E=!1;if(u){let x=u.find(I=>I.tool==C.function.name);if(x)try{let I=JSON.parse(_a(C.function.arguments));x.tool_argument&&x.tool_argument in I?(S({...i,[x.state_key]:I[x.tool_argument]}),E=!0):x.tool_argument||(S({...i,[x.state_key]:I}),E=!0)}catch{}}return[{type:Ie.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(E?[{type:Ie.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:s}]:[])]}case N.TOOL_CALL_END:{let y=g;return[{type:Ie.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case N.TOOL_CALL_RESULT:{let y=g;return[{type:Ie.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:v[y.toolCallId]||"unknown"}]}case N.RAW:return[];case N.CUSTOM:{let y=g;switch(y.name){case"Exit":o=!1;break;case"PredictState":u=y.value;break}return[{type:Ie.enum.MetaEvent,name:y.name,value:y.value}]}case N.STATE_SNAPSHOT:return S(g.snapshot),[{type:Ie.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:s}];case N.STATE_DELTA:{let y=g,C=Ar(i,y.delta,!0,!1);return C?(S(C.newDocument),[{type:Ie.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:s}]):[]}case N.MESSAGES_SNAPSHOT:return c=g.messages,[{type:Ie.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify({...i,...(c?{messages:c}:{})}),active:!0}];case N.RUN_STARTED:return[];case N.RUN_FINISHED:return c&&(i.messages=c),Object.keys(i).length===0?[]:[{type:Ie.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify({...i,...(c?{messages:t_(c)}:{})}),active:!1}];case N.RUN_ERROR:{let y=g;return[{type:Ie.enum.RunError,message:y.message,code:y.code}]}case N.STEP_STARTED:return a=g.stepName,h=[],u=null,[{type:Ie.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:!0}];case N.STEP_FINISHED:return h=[],u=null,[{type:Ie.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:!1}];default:return[]}}))};function t_(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=ZT(r.content);if(n){let i={id:r.id,role:r.role,content:n};t.push(i)}if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0)for(let i of r.toolCalls){let o={id:i.id,name:i.function.name,arguments:JSON.parse(i.function.arguments),parentMessageId:r.id};t.push(o)}}else if(r.role==="tool"){let n="unknown";for(let o of e)if(o.role==="assistant"&&o.toolCalls?.length){for(let s of o.toolCalls)if(s.id===r.toolCallId){n=s.function.name;break}}let i={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(i)}return t}var tc=e=>t=>{let r,n,i,o,s=()=>{if(!r||o!=="text")throw Error("No text message to close");let h={type:N.TEXT_MESSAGE_END,messageId:r.messageId};return o=void 0,r=void 0,e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_END",JSON.stringify(h)),h},a=()=>{if(!n||o!=="tool")throw Error("No tool call to close");let h={type:N.TOOL_CALL_END,toolCallId:n.toolCallId};return o=void 0,n=void 0,e&&console.debug("[TRANSFORM]: TOOL_CALL_END",JSON.stringify(h)),h},c=()=>{if(!i||o!=="reasoning")throw Error("No reasoning message to close");let h={type:N.REASONING_MESSAGE_END,messageId:i.messageId};return o=void 0,i=void 0,e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_END",JSON.stringify(h)),h},u=()=>o==="text"?[s()]:o==="tool"?[a()]:o==="reasoning"?[c()]:[];return t.pipe(ct(h=>{switch(h.type){case N.TEXT_MESSAGE_START:case N.TEXT_MESSAGE_CONTENT:case N.TEXT_MESSAGE_END:case N.TOOL_CALL_START:case N.TOOL_CALL_ARGS:case N.TOOL_CALL_END:case N.TOOL_CALL_RESULT:case N.STATE_SNAPSHOT:case N.STATE_DELTA:case N.MESSAGES_SNAPSHOT:case N.CUSTOM:case N.RUN_STARTED:case N.RUN_FINISHED:case N.RUN_ERROR:case N.STEP_STARTED:case N.STEP_FINISHED:case N.THINKING_START:case N.THINKING_END:case N.THINKING_TEXT_MESSAGE_START:case N.THINKING_TEXT_MESSAGE_CONTENT:case N.THINKING_TEXT_MESSAGE_END:case N.REASONING_START:case N.REASONING_MESSAGE_START:case N.REASONING_MESSAGE_CONTENT:case N.REASONING_MESSAGE_END:case N.REASONING_END:return[...u(),h];case N.RAW:case N.ACTIVITY_SNAPSHOT:case N.ACTIVITY_DELTA:case N.REASONING_ENCRYPTED_VALUE:return[h];case N.TEXT_MESSAGE_CHUNK:let v=h,S=[];if((o!=="text"||v.messageId!==void 0&&v.messageId!==r?.messageId)&&S.push(...u()),o!=="text"){if(v.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");r={messageId:v.messageId},o="text";let x={type:N.TEXT_MESSAGE_START,messageId:v.messageId,role:v.role||"assistant"};S.push(x),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_START",JSON.stringify(x))}if(v.delta!==void 0){let x={type:N.TEXT_MESSAGE_CONTENT,messageId:r.messageId,delta:v.delta};S.push(x),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_CONTENT",JSON.stringify(x))}return S;case N.TOOL_CALL_CHUNK:let g=h,y=[];if((o!=="tool"||g.toolCallId!==void 0&&g.toolCallId!==n?.toolCallId)&&y.push(...u()),o!=="tool"){if(g.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(g.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");n={toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId},o="tool";let x={type:N.TOOL_CALL_START,toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId};y.push(x),e&&console.debug("[TRANSFORM]: TOOL_CALL_START",JSON.stringify(x))}if(g.delta!==void 0){let x={type:N.TOOL_CALL_ARGS,toolCallId:n.toolCallId,delta:g.delta};y.push(x),e&&console.debug("[TRANSFORM]: TOOL_CALL_ARGS",JSON.stringify(x))}return y;case N.REASONING_MESSAGE_CHUNK:let C=h,E=[];if((o!=="reasoning"||C.messageId&&C.messageId!==i?.messageId)&&E.push(...u()),o!=="reasoning"){if(C.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");i={messageId:C.messageId},o="reasoning";let x={type:N.REASONING_MESSAGE_START,messageId:C.messageId};E.push(x),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_START",JSON.stringify(x))}if(C.delta!==void 0){let x={type:N.REASONING_MESSAGE_CONTENT,messageId:i.messageId,delta:C.delta};E.push(x),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_CONTENT",JSON.stringify(x))}return E}return h.type,[]}),fn(()=>{u()}))},vd=class{runNext(e,t){return t.run(e).pipe(tc(!1))}runNextWithState(e,t){let r=Re(e.messages||[]),n=Re(e.state||{}),i=new pa;return Fy(e,i,t,[]).subscribe(o=>{o.messages!==void 0&&(r=o.messages),o.state!==void 0&&(n=o.state)}),this.runNext(e,t).pipe(Ia(/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(o){return i.next(o),yield new Promise(s=>setTimeout(s,0)),{event:o,messages:Re(r),state:Re(n)}});return function(_x78){return _ref39.apply(this,arguments)}}()))}},r_=class extends vd{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function n_(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 i_=class extends vd{run(e,t){let{parentRunId:r,...n}=e,i={...n,messages:n.messages.map(n_)};return this.runNext(i,t)}},_y="THINKING_START",ky="THINKING_END",Oy="THINKING_TEXT_MESSAGE_START",Py="THINKING_TEXT_MESSAGE_CONTENT",Ny="THINKING_TEXT_MESSAGE_END",o_=class extends vd{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){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(pn(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case _y:{this.currentReasoningId=xo();let{title:t,...r}=e;return this.warnAboutTransformation(_y,N.REASONING_START),{...r,type:N.REASONING_START,messageId:this.currentReasoningId}}case Oy:return this.currentMessageId=xo(),this.warnAboutTransformation(Oy,N.REASONING_MESSAGE_START),{...e,type:N.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case Py:{let{delta:t,...r}=e;return this.warnAboutTransformation(Py,N.REASONING_MESSAGE_CONTENT),{...r,type:N.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??xo(),delta:t}}case Ny:{let t=this.currentMessageId??xo();return this.warnAboutTransformation(Ny,N.REASONING_MESSAGE_END),{...e,type:N.REASONING_MESSAGE_END,messageId:t}}case ky:{let t=this.currentReasoningId??xo();return this.warnAboutTransformation(ky,N.REASONING_END),{...e,type:N.REASONING_END,messageId:t}}default:return e}}},s_="0.0.45",a_=class{get maxVersion(){return s_}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:i,debug:o}={}){this.debug=!1,this.subscribers=[],this.isRunning=!1,this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??gr(),this.messages=Re(n??[]),this.state=Re(i??{}),this.debug=o??!1,ec(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new i_),ec(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new o_)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(r=>typeof r=="function"?new r_(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this1=this;return _asyncToGenerator(function*(){try{_this1.isRunning=!0,_this1.agentId=_this1.agentId??gr();let r=_this1.prepareRunAgentInput(e),n,i=new Set(_this1.messages.map(c=>c.id)),o=[{onRunFinishedEvent:c=>{n=c.result}},..._this1.subscribers,t??{}];yield _this1.onInitialize(r,o),_this1.activeRunDetach$=new Bt;let s;_this1.activeRunCompletionPromise=new Promise(c=>{s=c}),yield Ra(da(()=>_this1.middlewares.length===0?_this1.run(r):_this1.middlewares.reduceRight((c,u)=>({run:h=>u.run(h,c)}),_this1).run(r),tc(_this1.debug),yd(_this1.debug),c=>c.pipe(Ta(_this1.activeRunDetach$)),c=>_this1.apply(r,c,o),c=>_this1.processApplyEvents(r,c,o),bo(c=>(_this1.isRunning=!1,_this1.onError(r,c,o))),fn(()=>{_this1.isRunning=!1,_this1.onFinalize(r,o),s?.(),s=void 0,_this1.activeRunCompletionPromise=void 0,_this1.activeRunDetach$=void 0}))(Pe(null)));let a=Re(_this1.messages).filter(c=>!i.has(c.id));return{result:n,newMessages:a}}finally{_this1.isRunning=!1}})()}connect(e){throw new Ul}connectAgent(e,t){var _this10=this;return _asyncToGenerator(function*(){try{_this10.isRunning=!0,_this10.agentId=_this10.agentId??gr();let r=_this10.prepareRunAgentInput(e),n,i=new Set(_this10.messages.map(c=>c.id)),o=[{onRunFinishedEvent:c=>{n=c.result}},..._this10.subscribers,t??{}];yield _this10.onInitialize(r,o),_this10.activeRunDetach$=new Bt;let s;_this10.activeRunCompletionPromise=new Promise(c=>{s=c}),yield Ra(da(()=>_this10.connect(r),tc(_this10.debug),yd(_this10.debug),c=>c.pipe(Ta(_this10.activeRunDetach$)),c=>_this10.apply(r,c,o),c=>_this10.processApplyEvents(r,c,o),bo(c=>(_this10.isRunning=!1,c instanceof Ul?fa:_this10.onError(r,c,o))),fn(()=>{_this10.isRunning=!1,_this10.onFinalize(r,o),s?.(),s=void 0,_this10.activeRunCompletionPromise=void 0,_this10.activeRunDetach$=void 0}))(Pe(null)));let a=Re(_this10.messages).filter(c=>!i.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 Fy(e,t,this,r)}processApplyEvents(e,t,r){return t.pipe(nd(n=>{n.messages&&(this.messages=n.messages,r.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,r.forEach(i=>{i.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Re(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||gr(),tools:Re(e?.tools??[]),context:Re(e?.context??[]),forwardedProps:Re(e?.forwardedProps??{}),state:Re(this.state),messages:t}}onInitialize(e,t){var _this12=this;return _asyncToGenerator(function*(){let r=yield Ee(t,_this12.messages,_this12.state,(n,i,o)=>n.onRunInitialized?.({messages:i,state:o,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 dn(Ee(r,this.messages,this.state,(n,i,o)=>n.onRunFailed?.({error:t,messages:i,state:o,agent:this,input:e}))).pipe(pn(n=>{let i=n;if((i.messages!==void 0||i.state!==void 0)&&(i.messages!==void 0&&(this.messages=i.messages,r.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),i.state!==void 0&&(this.state=i.state,r.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),i.stopPropagation!==!0)throw console.error("Agent execution failed:",t),t;return{}}))}onFinalize(e,t){var _this13=this;return _asyncToGenerator(function*(){let r=yield Ee(t,_this13.messages,_this13.state,(n,i,o)=>n.onRunFinalized?.({messages:i,state:o,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=Re(this.messages),e.state=Re(this.state),e.debug=this.debug,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],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=Re(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=Re(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??gr();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:i=>n.run(i,r)}),this).run(t)).pipe(tc(this.debug),yd(this.debug),e_(this.threadId,t.runId,this.agentId),r=>r.pipe(pn(n=>(this.debug&&console.debug("[LEGACY]:",JSON.stringify(n)),n))))}},Dy=class extends a_{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=Re(e.headers??{})}run(e){return VT(qT(this.url,this.requestInit(e)))}clone(){let e=super.clone();e.url=this.url,e.headers=Re(this.headers??{});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 My=(e,t,r)=>{let n=qe(t,r),i=e?.trim();if(!n||!t||!i)throw new Error("Missing required parameters for answer endpoint");let o=`/api/preview/organizations/${t}/agents`;return`${n}${o}/${i}`};var Sd=class extends Dy{requestInit(t){let{params:r,accessToken:n}=t.forwardedProps||{};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(r),signal:this.abortController.signal}}},jy=(e,t,r)=>new Sd({url:`${My(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var c_=new J({required:!0}),qy=q("followUpAnswers/setIsEnabled",e=>z(e,new Fe({required:!0}))),Ly=q("followUpAnswers/setFollowUpAnswersConversationId",e=>z(e,te)),hX=q("followUpAnswers/createFollowUpAnswer",e=>z(e,{question:te})),yX=q("followUpAnswers/setActiveFollowUpAnswerId",e=>z(e,te)),vX=q("followUpAnswers/setFollowUpAnswerContentFormat",e=>z(e,{contentFormat:Bs,answerId:te})),SX=q("followUpAnswers/setFollowUpIsLoading",e=>z(e,{isLoading:new Fe({required:!0}),answerId:te})),AX=q("followUpAnswers/setFollowUpIsStreaming",e=>z(e,{isStreaming:new Fe({required:!0}),answerId:te})),bX=q("followUpAnswers/followUpMessageChunkReceived",e=>z(e,{textDelta:c_,answerId:te})),wX=q("followUpAnswers/followUpCitationsReceived",e=>z(e,{citations:new Et({required:!0,each:new xe({values:El})}),answerId:te})),CX=q("followUpAnswers/followUpCompleted",e=>z(e,{answerId:te,cannotAnswer:new Fe({required:!1})})),xX=q("followUpAnswers/followUpFailed",e=>z(e,{message:new J,code:new Le({min:0}),answerId:te})),EX=q("followUpAnswers/activeFollowUpStartFailed",e=>z(e,{message:new J})),RX=q("followUpAnswers/likeFollowUp",e=>z(e,{answerId:te})),IX=q("followUpAnswers/dislikeFollowUp",e=>z(e,{answerId:te})),TX=q("followUpAnswers/submitFollowUpFeedback",e=>z(e,{answerId:te})),Uy=q("followUpAnswers/resetFollowUpAnswers"),_X=q("followUpAnswers/stepStarted",e=>z(e,{answerId:te,name:new J({required:!0,constrainTo:Yn}),startedAt:new Le({min:0,required:!0})})),kX=q("followUpAnswers/stepFinished",e=>z(e,{answerId:te,name:new J({required:!0,constrainTo:Yn}),finishedAt:new Le({min:0,required:!0})}));m();d();f();p();var u_={"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};function Vy(e){return e?u_[e]??1004:1004}var By=e=>({onRunStartedEvent:({event:t})=>{e(Gs(t.runId)),e(mr(!1)),e(oo(!0)),e(Ly(t.threadId))},onStepStartedEvent:({event:t})=>{e(Dg({name:t.stepName,startedAt:t.timestamp??Date.now()}))},onStepFinishedEvent:({event:t})=>{e(Mg({name:t.stepName,finishedAt:t.timestamp??Date.now()}))},onTextMessageContentEvent:({event:t})=>{e(so({textDelta:t.delta}))},onCustomEvent:({event:t})=>{let{name:r,value:n}=t;switch(r){case"header":{n?.contentFormat&&e(uo(n.contentFormat)),n?.followUpEnabled&&e(qy(n.followUpEnabled));return}case"citations":{e(ao({citations:n.citations}));return}}},onRunErrorEvent:({event:t})=>{let r=Vy(t.code);e(co({message:t.message,code:r}))},onRunFinishedEvent:({event:t})=>{let r=t.result?.answerGenerated??!1;e(Rl(r)),e(lo(!r)),e(oo(!1)),e(zn(r)),e(Wn())}});var Gy=()=>{let e,t=()=>{e?.abortRun(),e=void 0};return{run:function(){var _ref44=_asyncToGenerator(function*(n,i,o){t();let s=Fs(n),a=Bm(n),c=Gm(n),u=Vm(n),h=jy(s,a,c);e=h;let v=By(i),S=Og(n,o());try{i(mr(!0)),yield h.runAgent({forwardedProps:{params:S,accessToken:u}},v)}catch(g){i(mr(!1)),i(co({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",g)}});return function run(_x79,_x80,_x81){return _ref44.apply(this,arguments)}}(),abortRun:t}};m();d();f();p();m();d();f();p();var $y=q("breadcrumb/deselectAll"),Qy=q("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var Hy=q("facet/updateFacetAutoSelection",e=>z(e,{allow:new Fe({required:!0})}));m();d();f();p();m();d();f();p();var rc=class extends lr{constructor(r){super(r);this.getState=r}get activeInstantResultQuery(){let r=this.getState().instantResults;for(let n in r)for(let i in r[n].cache)if(r[n].cache[i].isActive)return r[n].q;return null}get activeInstantResultCache(){let r=this.getState().instantResults;for(let n in r)for(let i in r[n].cache)if(r[n].cache[i].isActive)return r[n].cache[i];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??It().q}get responseTime(){return this.activeInstantResultCache?.duration??Dt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??Dt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var zy=()=>et("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new rc(e)),Wy=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var Ad={id:te},l_={...Ad,q:Rt},qJ=q("instantResults/register",e=>z(e,Ad)),nc=q("instantResults/updateQuery",e=>z(e,l_)),LJ=q("instantResults/clearExpired",e=>z(e,Ad));m();d();f();p();var ic=new Le({required:!0,min:0}),WJ=q("pagination/registerNumberOfResults",e=>z(e,ic)),KJ=q("pagination/updateNumberOfResults",e=>z(e,ic)),YJ=q("pagination/registerPage",e=>z(e,ic)),Ky=q("pagination/updatePage",e=>z(e,ic)),XJ=q("pagination/nextPage"),JJ=q("pagination/previousPage");m();d();f();p();var hi=q("query/updateQuery",e=>z(e,{q:new J,enableQuerySyntax:new Fe}));m();d();f();p();m();d();f();p();m();d();f();p();var yi=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var bd=()=>et("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),wr=e=>et("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||It().q,aq:r.advancedSearchQueries?.aq||yi().aq,cq:r.advancedSearchQueries?.cq||yi().cq,dq:r.advancedSearchQueries?.dq||yi().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();m();d();f();p();var oc=e=>e.success!==void 0,ut=e=>e.error!==void 0;m();d();f();p();var KZ=q("didYouMean/enable"),YZ=q("didYouMean/disable"),XZ=q("didYouMean/automaticCorrections/disable"),JZ=q("didYouMean/automaticCorrections/enable"),sc=q("didYouMean/correction",e=>z(e,te)),ZZ=q("didYouMean/automaticCorrections/mode",e=>z(e,new J({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var wd=()=>et("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var Yy=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function Xy(){return{contextValues:{}}}m();d();f();p();function Jy(){return{contextValues:{}}}m();d();f();p();function Zy(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function ev(){return[]}m();d();f();p();function tv(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function rv(){return{}}m();d();f();p();function nv(){return{}}m();d();f();p();function iv(){return{}}function Gt(e){return{context:e.context||Xy(),dictionaryFieldContext:e.dictionaryFieldContext||Jy(),facetSet:e.facetSet||Ns(),numericFacetSet:e.numericFacetSet||Ps(),dateFacetSet:e.dateFacetSet||Os(),categoryFacetSet:e.categoryFacetSet||ks(),automaticFacetSet:e.automaticFacetSet??_s(),pagination:e.pagination||tv(),query:e.query||It(),tabSet:e.tabSet||iv(),advancedSearchQueries:e.advancedSearchQueries||yi(),staticFilterSet:e.staticFilterSet||nv(),querySet:e.querySet||rv(),sortCriteria:e.sortCriteria||Ds(),pipeline:e.pipeline||js(),searchHub:e.searchHub||Mn(),facetOptions:e.facetOptions||Zy(),facetOrder:e.facetOrder??ev(),debug:e.debug??is()}}m();d();f();p();var Ete=new xe({values:{undoneQuery:Rt},options:{required:!0}}),ov=()=>et("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var ac=q("trigger/query/ignore",e=>z(e,new J({emptyAllowed:!0,required:!0}))),cc=q("trigger/query/modification",e=>z(e,new xe({values:{originalQuery:Be,modification:Be}})));m();d();f();p();var Cr=/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(e,t){let r=f_(e),n=Us(e),i=d_(e),o=yield Kn(e,t),s=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return dr({...o,...(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:i}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Cr(_x82,_x83){return _ref45.apply(this,arguments)}}();function d_(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(p_).filter(r=>r.currentValues.length>0):void 0}function p_(e){let{field:t,label:r,values:n}=e,i=n.filter(o=>o.state==="selected");return{field:t,label:r,currentValues:i}}function f_(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(o=>o.isActive)?.expression.trim()||"",i=m_(e);return[t,n,...i].filter(o=>!!o).join(" AND ")}function m_(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(o=>o.state==="selected"&&!!o.expression.trim()),i=n.map(o=>o.expression).join(" OR ");return n.length>1?`(${i})`:i})}var xr=class{constructor(t,r=n=>{this.dispatch(hi({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x84,_x85){var _this18=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let i=Date.now(),o=Ls(yield _this18.extra.apiClient.search(r,n),t),s=Date.now()-i,a=_this18.getState().query?.q||"";return{response:o,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 ut(t.response)?(this.dispatch(wr(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:i,automaticallyCorrectQuery:o}=r.didYouMean,{results:s,queryCorrections:a,queryCorrection:c}=n;if(!i||!o)return null;let u=s.length===0&&a&&a.length!==0,h=!ie(c)&&!ie(c.correctedQuery);if(!u&&!h)return null;let S=u?yield _this20.processLegacyDidYouMeanAutoCorrection(t):_this20.processModernDidYouMeanAutoCorrection(t);return _this20.dispatch(Nt(Gt(_this20.getState()))),S})()}processLegacyDidYouMeanAutoCorrection(t){var _this21=this;return _asyncToGenerator(function*(){let r=_this21.getCurrentQuery(),n=_this21.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:i}=n.queryCorrections[0],o=yield _this21.automaticallyRetryQueryWithCorrection(i);return ut(o.response)?(_this21.dispatch(wr(o.response.error)),_this21.rejectWithValue(o.response.error)):(_this21.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this21.dispatch(Nt(Gt(_this21.getState()))),{...o,response:{...o.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:wd()})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:i}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:i,analyticsAction:wd()}}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(ac("")),null;_this22.analyticsAction&&(yield _this22.dispatch(_this22.analyticsAction));let o=_this22.getCurrentQuery(),s=yield _this22.automaticallyRetryQueryWithTriggerModification(n);return ut(s.response)?(_this22.dispatch(wr(s.response.error)),_this22.rejectWithValue(s.response.error)):(_this22.dispatch(Nt(Gt(_this22.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:o,analyticsAction:ov()})})()}getStateAfterResponse(t,r,n,i){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??It().enableQuerySyntax},search:{...Dt(),duration:r,response:i,results:i.results}}}processSuccessResponse(t){return this.dispatch(Nt(Gt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return oc(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this23=this;return _asyncToGenerator(function*(){_this23.onUpdateQueryForCorrection(t);let r=yield _this23.fetchFromAPI(yield Cr(_this23.getState()),{origin:"mainSearch"});return _this23.dispatch(sc(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.dispatch(cc({newQuery:t,originalQuery:_this24.getCurrentQuery()})),_this24.onUpdateQueryForCorrection(t),yield _this24.fetchFromAPI(yield Cr(_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 xre=ve("search/executeSearch",/*#__PURE__*/function(){var _ref46=_asyncToGenerator(function*(e,t){let r=t.getState();return yield uc(r,t,e)});return function(_x86,_x87){return _ref46.apply(this,arguments)}}()),Ere=ve("search/fetchPage",/*#__PURE__*/function(){var _ref47=_asyncToGenerator(function*(e,t){let r=t.getState();return yield xd(r,t,e)});return function(_x88,_x89){return _ref47.apply(this,arguments)}}()),Rre=ve("search/fetchMoreResults",/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ed(t,r)});return function(_x90,_x91){return _ref48.apply(this,arguments)}}()),Ire=ve("search/fetchFacetValues",/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t){let r=t.getState();return yield v_(t,e,r)});return function(_x92,_x93){return _ref49.apply(this,arguments)}}()),Tre=ve("search/fetchInstantResults",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){return Cd(e,t)});return function(_x94,_x95){return _ref50.apply(this,arguments)}}()),g_=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=yield Cr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function g_(_x96,_x97){return _ref51.apply(this,arguments)}}(),h_=/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t,r){let n=yield Kn(e);return dr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function h_(_x98,_x99,_x100){return _ref52.apply(this,arguments)}}(),y_=/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=yield Cr(e,t);return r.request.numberOfResults=0,r});return function y_(_x101,_x102){return _ref53.apply(this,arguments)}}(),sv=e=>{e.configuration.analytics.enabled&&Mt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Cd(_x103,_x104){return _Cd.apply(this,arguments)}function _Cd(){_Cd=_asyncToGenerator(function*(e,t){z(e,{id:te,q:te,maxResultsPerQuery:new Le({required:!0,min:1}),cacheTimeout:new Le});let{q:r,maxResultsPerQuery:n}=e,i=t.getState(),o=new xr({...t,analyticsAction:zy()},u=>{t.dispatch(nc({q:u,id:e.id}))}),s=yield h_(i,r,n),a=yield o.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),c=yield o.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 _Cd.apply(this,arguments)}function xd(_x105,_x106,_x107){return _xd.apply(this,arguments)}function _xd(){_xd=_asyncToGenerator(function*(e,t,r){sv(e);let{analyticsClientMiddleware:n,preprocessRequest:i,logger:o}=t.extra,{description:s}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:i,logger:o}),a=new xr({...t,analyticsAction:r}),c=yield Cr(e,s),u=yield a.fetchFromAPI(c,{origin:"mainSearch"});return yield a.process(u)});return _xd.apply(this,arguments)}function Ed(_x108,_x109){return _Ed.apply(this,arguments)}function _Ed(){_Ed=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:i}=e.extra,{description:o}=yield bd().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:i}),s=new xr({...e,analyticsAction:bd()}),a=yield g_(t,o),c=yield s.fetchFromAPI(a,{origin:"mainSearch"});return yield s.process(c)});return _Ed.apply(this,arguments)}function v_(_x110,_x111,_x112){return _v_.apply(this,arguments)}function _v_(){_v_=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:i,logger:o}=e.extra,{description:s}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:i,logger:o}),a=new xr({...e,analyticsAction:t}),c=yield y_(r,s),u=yield a.fetchFromAPI(c,{origin:"facetValues"});return yield a.process(u)});return _v_.apply(this,arguments)}function uc(_x113,_x114,_x115){return _uc.apply(this,arguments)}function _uc(){_uc=_asyncToGenerator(function*(e,t,r){sv(e);let{analyticsClientMiddleware:n,preprocessRequest:i,logger:o}=t.extra,{description:s}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:i,logger:o}),a=yield Cr(e,s),c=new xr({...t,analyticsAction:r}),u=yield c.fetchFromAPI(a,{origin:"mainSearch"});return yield c.process(u)});return _uc.apply(this,arguments)}m();d();f();p();var Er=class{constructor(t,r=n=>{this.dispatch(hi({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x116,_x117){var _this25=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let i=Date.now(),o=Ls(yield _this25.extra.apiClient.search(r,n),t),s=Date.now()-i,a=_this25.getState().query?.q||"";return{response:o,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 ut(t.response)?(this.dispatch(wr(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:i,automaticallyCorrectQuery:o}=r.didYouMean,{results:s,queryCorrections:a,queryCorrection:c}=n;if(!i||!o)return null;let u=s.length===0&&a&&a.length!==0,h=!ie(c)&&!ie(c.correctedQuery);if(!u&&!h)return null;let S=u?yield _this27.processLegacyDidYouMeanAutoCorrection(t):_this27.processModernDidYouMeanAutoCorrection(t);return _this27.dispatch(Nt(Gt(_this27.getState()))),S})()}processLegacyDidYouMeanAutoCorrection(t){var _this28=this;return _asyncToGenerator(function*(){let r=_this28.getCurrentQuery(),n=_this28.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:i}=n.queryCorrections[0],o=yield _this28.automaticallyRetryQueryWithCorrection(i);return ut(o.response)?(_this28.dispatch(wr(o.response.error)),_this28.rejectWithValue(o.response.error)):(_this28.dispatch(Nt(Gt(_this28.getState()))),{...o,response:{...o.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:i}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:i}}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(ac("")),null;let o=_this29.getCurrentQuery(),s=yield _this29.automaticallyRetryQueryWithTriggerModification(n);return ut(s.response)?(_this29.dispatch(wr(s.response.error)),_this29.rejectWithValue(s.response.error)):(_this29.dispatch(Nt(Gt(_this29.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:o})})()}processSuccessResponse(t){return this.dispatch(Nt(Gt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return oc(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this30=this;return _asyncToGenerator(function*(){_this30.onUpdateQueryForCorrection(t);let r=_this30.getState(),{actionCause:n}=Yy(),i=yield _this30.fetchFromAPI(yield fr(r,_this30.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this30.dispatch(sc(t)),i})()}automaticallyRetryQueryWithTriggerModification(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.dispatch(cc({newQuery:t,originalQuery:_this31.getCurrentQuery()})),_this31.onUpdateQueryForCorrection(t),yield _this31.fetchFromAPI(yield fr(_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 fne=ve("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;z(e,{q:new J,enableQuerySyntax:new Fe,clearFilters:new Fe}),e.clearFilters&&(r($y()),r(Qy())),r(Hy({allow:!0})),r(hi({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(Ky(1))}),mne=q("search/updateSearchAction"),lc=ve("search/executeSearch",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return uc(r,t,e.legacy);uv(r);let n=e.next?lv(e.next):void 0,i=yield fr(r,t.extra.navigatorContext,n),o=new Er({...t,analyticsAction:n??{}}),s=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(s)});return function(_x118,_x119){return _ref54.apply(this,arguments)}}()),av=ve("search/fetchPage",/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t){let r=t.getState();if(uv(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return xd(r,t,e.legacy);let n=new Er({...t,analyticsAction:e.next}),i=yield fr(r,t.extra.navigatorContext,e.next),o=yield n.fetchFromAPI(i,{origin:"mainSearch"});return yield n.process(o)});return function(_x120,_x121){return _ref55.apply(this,arguments)}}()),cv=ve("search/fetchMoreResults",/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Ed(t,r);let n=tg("browseResults",t.getState),i=new Er({...t,analyticsAction:n}),o=yield S_(r,t.extra.navigatorContext,n),s=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(s)});return function(_x122,_x123){return _ref56.apply(this,arguments)}}()),gne=ve("search/fetchFacetValues",/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return uc(r,t,e.legacy);let n=new Er({...t,analyticsAction:{}}),i=yield b_(r,t.extra.navigatorContext),o=yield n.fetchFromAPI(i,{origin:"facetValues"});return yield n.process(o)});return function(_x124,_x125){return _ref57.apply(this,arguments)}}()),hne=ve("search/fetchInstantResults",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Cd(e,t);z(e,{id:te,q:te,maxResultsPerQuery:new Le({required:!0,min:1}),cacheTimeout:new Le});let{q:n,maxResultsPerQuery:i}=e,o=lv(Wy()),s=yield A_(r,t.extra.navigatorContext,n,i,o),a=new Er({...t,analyticsAction:o},h=>{t.dispatch(nc({q:h,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(_x126,_x127){return _ref58.apply(this,arguments)}}()),S_=/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t,r){let n=yield fr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function S_(_x128,_x129,_x130){return _ref59.apply(this,arguments)}}(),A_=/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t,r,n,i){let o=Vs(e,t,i);return dr({...o,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function A_(_x131,_x132,_x133,_x134,_x135){return _ref60.apply(this,arguments)}}(),b_=/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t,r){let n=yield fr(e,t,r);return n.request.numberOfResults=0,n});return function b_(_x136,_x137,_x138){return _ref61.apply(this,arguments)}}(),uv=e=>{e.configuration.analytics.enabled&&Mt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},lv=e=>({actionCause:e.actionCause,type:e.actionCause});var dv=e=>{let t=gf({extra:e}),r=Gy();return t.startListening({actionCreator:lc.pending,effect:function(){var _ref62=_asyncToGenerator(function*(n,i){let o=i.getState();if(!Ku(o))return;r.abortRun(),i.dispatch($s()),i.dispatch(Uy());let s=Lr(o)?.q;!s||s.trim()===""||r.run(o,i.dispatch,e.getNavigatorContext)});return function effect(_x139,_x140){return _ref62.apply(this,arguments)}}()}),t};m();d();f();p();var pv=e=>()=>t=>r=>{let n=r;if(!n.error)return t(r);let i=n.error;if(n.payload?.ignored||e.error({error:i,action:r},`Action dispatch error ${n.type}`),n.error.name!=="SchemaValidationError")return t(r)},fv=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var Rd=(e,t)=>{let{referrer:r,userAgent:n,location:i,clientId:o}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:i,clientId:o}};m();d();f();p();function mv(e,t){let r={...e},n,i=o=>(s,a)=>{let c=o(s,a);return n?n(c,a):c};return{get combinedReducer(){let o=pp(Object.entries(t).filter(([s])=>!(s in r)).map(([s,a])=>[s,()=>a]));return i(En({...o,...r}))},containsAll(o){return Object.keys(o).every(a=>a in r)},add(o){Object.keys(o).filter(s=>!(s in r)).forEach(s=>{r[s]=o[s]})},addCrossReducer(o){n=o}}}m();d();f();p();m();d();f();p();var vi=q("app/setError");m();d();f();p();function w_(e){if(!e||!C_(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),i=decodeURIComponent(n.split("").map(o=>`%${`00${o.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(i)}catch{return null}}function gv(e,t=60){if(!e)return!1;let r=w_(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function C_(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function yv(e,t){let r=0,n=null,i=Oo(()=>{r=0},500),o=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(c,u=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(S){if(!u)throw S;return null}})().finally(()=>{n=null}));let v=yield n;return h&&v&&c.dispatch(Dn({accessToken:v})),v});return function o(_x141){return _ref63.apply(this,arguments)}}(),s=/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(c){let u=c.getState(),h=E_(u);if(!(!h||!gv(h))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield o(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(_x142){return _ref65.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(c,u,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),hv(c,u.error),u;r++,i(),yield o(c,!0),c.dispatch(h)});return function a(_x143,_x144,_x145){return _ref66.apply(this,arguments)}}();return c=>u=>(/*#__PURE__*/function(){var _ref67=_asyncToGenerator(function*(h){let v=typeof h=="function",S=typeof t=="function";if(!v)return u(h);S&&(yield s(c));let g=yield u(h);return x_(g)?S?yield a(c,g,h):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),hv(c,g.error),g):g});return function(_x146){return _ref67.apply(this,arguments)}}())}function x_(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new bn().name}function hv(e,t){e.dispatch(vi({status:401,statusCode:401,message:t.message,type:t.name}))}function E_(e){return e.configuration.accessToken}m();d();f();p();function vv({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:i}){return ef({reducer:e,preloadedState:t,devTools:{stateSanitizer:o=>o.history?{...o,history:"<<OMIT>>"}:o,name:i,shouldHotReload:!1},middleware:o=>o({thunk:{extraArgument:n}}).prepend(...r).concat(fv(n.logger))})}function R_(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...i}=r??{},o={...i,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return o.analyticsMode!=="next"&&dp()?(t.info("Analytics disabled since doNotTrack is active."),{...o,enabled:!1}):o}function Sv(e,t){let r={...e.reducers,configuration:ft,version:Hg},n=I_({...e,reducers:r},t,ft),{accessToken:i,environment:o,organizationId:s}=e.configuration;n.dispatch(Dn({accessToken:i,environment:o,organizationId:s}));let a=R_(e.configuration,n.logger);return a&&n.dispatch(as(a)),n}function I_(e,t,r){let{reducers:n,navigatorContextProvider:i}=e,o=mv({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&o.addCrossReducer(e.crossReducer);let s=t.logger,a={...t,get relay(){return $i(u.state,i)},get navigatorContext(){return Rd(this.relay,i)}},c=T_(e,a,o),u={addReducers(h){o.containsAll(h)||(o.add(h),c.replaceReducer(o.combinedReducer))},dispatch:c.dispatch,subscribe:c.subscribe,enableAnalytics(){c.dispatch(us())},disableAnalytics(){c.dispatch(cs())},get state(){return c.getState()},get relay(){return $i(this.state,i)},get navigatorContext(){return Rd(this.relay,i)},logger:s,store:c};return u}function T_(e,t,r){let{preloadedState:n,configuration:i}=e,o=i.name||"coveo-headless",s=__(e,t.logger,()=>t.navigatorContext);return vv({preloadedState:n,reducer:r.combinedReducer,middlewares:s,thunkExtraArguments:t,name:o})}function __(e,t,r){let{renewAccessToken:n}=e.configuration,i=yv(t,n),o=dv({getNavigatorContext:r});return[rh,i,pv(t),Wg].concat(Tl.middleware,o.middleware,e.middlewares||[])}var k_=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
|
|
42
42
|
However, this mode is not available for Coveo for Service features, and this configuration may not work as expected.
|
|
43
43
|
Please switch back to the "legacy" analytics mode to ensure proper functionality.
|
|
44
|
-
For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function zv(e){e==="next"&&console.warn(ok)}m();d();f();p();var rS=Ct(tS(),1);function nS(e){return(0,rS.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function iS(e,t){let r=Ck(e),n=bu,i=xk(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:i,logger:t}}function Ck(e){let{analytics:t}=e,r=(n,i)=>i;return t?.analyticsClientMiddleware||r}function xk(e){return e.preprocessRequest||qo}m();d();f();p();m();d();f();p();var oS={organizationId:te,accessToken:te,name:new J({required:!1,emptyAllowed:!1}),analytics:new xe({options:{required:!1},values:{enabled:new De({required:!1}),originContext:new J({required:!1}),originLevel2:new J({required:!1}),originLevel3:new J({required:!1}),analyticsMode:new J({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new J({required:!1,url:!0}),trackingId:new J({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/})}}),environment:new J({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};var sS=new xt({...oS,caseAssistId:te,locale:Ge});var Ek={debug:Mf,caseAssistConfiguration:ur,searchHub:Gf};function aS(e){let t=nS(e.loggerOptions);Ik(e.configuration,t);let r=Rk(e.configuration,t),n={...iS(e.configuration,t),apiClient:r},i={...e,reducers:Ek},o=Hv(i,n);zv(o.state.configuration.analytics.analyticsMode);let{caseAssistId:s,locale:a,searchHub:c,proxyBaseUrl:u}=e.configuration;return o.dispatch(as({caseAssistId:s,locale:a,proxyBaseUrl:u})),ie(c)||o.dispatch(ls(c)),{...o,get state(){return o.state}}}function Ik(e,t){try{sS.validate(e)}catch(r){throw t.error(r,"Case Assist engine configuration error"),r}}function Rk(e,t){return new Bo({logger:t,preprocessRequest:e.preprocessRequest||qo})}m();d();f();p();m();d();f();p();m();d();f();p();var cS=(o=>(o.id="id",o.subject="subject",o.description="description",o.category="category",o.productId="productId",o))(cS||{}),uS=e=>!Object.values(cS).includes(e),lt=e=>{let t=r=>Tk(e,r)??kk(e,r);return{id:t("id"),subject:t("subject"),description:t("description"),category:t("category"),productId:t("productId"),custom:{..._k(e),...Ok(e)}}},Tk=(e,t)=>e?.caseInput?.[t]?.value,_k=e=>Object.keys(e?.caseInput??[]).reduce((t,r)=>{if(uS(r)){let n=e?.caseInput?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),kk=(e,t)=>e?.caseField?.fields[t]?.value,Ok=e=>Object.keys(e?.caseField?.fields??[]).reduce((t,r)=>{if(uS(r)){let n=e?.caseField?.fields?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),$d=(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 o=e?.caseField?.fields[n]?.suggestions.find(a=>a.id===t),s={classificationId:o?.id??"",responseId:e.caseField?.status.lastResponseId??"",fieldName:n,classification:{value:o?.value??"",confidence:o?.confidence??0}};return r?{...s,autoSelection:r}:s},sr=(e,t,r=!1,n=!1)=>{let i,o=e.documentSuggestion?.documents.find((a,c)=>{let u=a.uniqueId===t;return u&&(i=c+1),u});if(!o)throw new Error(`Document Suggestion with ID '${t}' could not be found.`);let s={suggestionId:o.uniqueId,permanentId:o.fields.permanentid,responseId:e.documentSuggestion?.status.lastResponseId??"",suggestion:{documentUri:o.fields.uri,documentUriHash:o.fields.urihash,documentTitle:o.title,documentUrl:o.clickUri,documentPosition:i??0,sourceName:o.fields.source}};return r?{...s,fromQuickview:r}:n?{...s,openDocument:n}:s};var lS=()=>pt({prefix:"analytics/caseAssist/case/start",__legacy__getBuilder:(e,t)=>e.logEnterInterface({ticket:lt(t)}),analyticsType:"CaseAssist.Start",analyticsPayloadBuilder:()=>({})}),dS=e=>pt("analytics/caseAssist/case/nextStage",(t,r)=>t.logMoveToNextCaseStep({ticket:lt(r),stage:e?.stageName})),pS=()=>pt({prefix:"analytics/caseAssist/case/create",__legacy__getBuilder:(e,t)=>e.logCaseCreated({ticket:lt(t)}),analyticsType:"CaseAssist.CreateTicket",analyticsPayloadBuilder:e=>{let{id:t,category:r,subject:n,description:i,productId:o}=lt(e);return{ticket:{id:t,category:r,subject:n,description:i,system:o}}}}),fS=()=>pt({prefix:"analytics/caseAssist/case/solve",__legacy__getBuilder:(e,t)=>e.logCaseSolved({ticket:lt(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"solved"})}),mS=()=>pt({prefix:"analytics/caseAssist/case/abandon",__legacy__getBuilder:(e,t)=>e.logCaseCancelled({ticket:lt(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"quit"})}),_i=e=>pt({prefix:"analytics/caseAssist/case/field/update",__legacy__getBuilder:(t,r)=>t.logUpdateCaseField({fieldName:e,ticket:lt(r)}),analyticsType:"CaseAssist.UpdateField",analyticsPayloadBuilder:t=>{let r=t.caseField?.fields?.[e]?.value||t.caseInput?.[e]?.value||"";return{fieldName:e,fieldValue:r}}}),gS=e=>pt({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:$d(r,e,!0),ticket:lt(r)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let r=t.caseField?.status?.lastResponseId;if(r)return{autoselected:!0,classificationId:e,responseId:r}}}),Ec=e=>pt({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:$d(r,e),ticket:lt(r)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let r=t.caseField?.status?.lastResponseId;if(r)return{autoselected:!1,classificationId:e,responseId:r}}}),hS=e=>pt({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logSelectDocumentSuggestion({suggestion:sr(r,e),ticket:lt(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=sr(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}}}}),Ic=e=>pt({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logQuickviewDocumentSuggestion({suggestion:sr(r,e),ticket:lt(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=sr(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}}}}),yS=e=>pt({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logSelectDocumentSuggestion({suggestion:sr(r,e,!1,!0),ticket:lt(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=sr(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}}}}),vS=(e,t)=>pt({prefix:"analytics/caseAssist/documentSuggestion/rate",__legacy__getBuilder:(r,n)=>r.logRateDocumentSuggestion({rating:t,suggestion:sr(n,e),ticket:lt(n)}),analyticsType:"CaseAssist.DocumentSuggestionFeedback",analyticsPayloadBuilder:r=>{let n=r.documentSuggestion?.status?.lastResponseId,i=sr(r,e);if(n)return{responseId:n,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:i.suggestionId,url:i.suggestion.documentUri,title:i.suggestion.documentTitle},liked:!!t}}});m();d();f();p();var ki=q("caseAssist/caseField/register",e=>z(e,{fieldName:te,fieldValue:It})),Oi=q("caseAssist/caseField/update",e=>z(e,{fieldName:te,fieldValue:It})),Qt=ve("caseAssist/classifications/fetch",/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let i=t(),o=yield n.getCaseClassifications(yield Pk(i));return ut(o)?r(o.error):{response:o.success}});return function(_x156,_x157){return _ref71.apply(this,arguments)}}()),Pk=/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??Te(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield Zn(e.configuration.analytics)}),fields:e.caseInput,context:e.caseField?Go(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function Pk(_x158){return _ref72.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var SS=()=>({status:{loading:!1,error:null,lastResponseId:""},fields:{}});var _r=Ve(SS(),e=>{e.addCase(ki,(t,r)=>{let{fieldName:n,fieldValue:i}=r.payload;t.fields[n]={value:i,suggestions:[]}}).addCase(Oi,(t,r)=>{let{fieldName:n,fieldValue:i}=r.payload;t.fields[n].value=i}).addCase(Qt.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase(Qt.fulfilled,(t,r)=>{let n={value:"",suggestions:[]};Object.entries(r.payload.response.fields).forEach(([i,o])=>{t.fields[i]||(t.fields[i]={...n}),t.fields[i].suggestions=o.predictions}),t.status.lastResponseId=r.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase(Qt.pending,t=>{t.status.loading=!0}).addCase(Ri,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();m();d();f();p();var Cn=q("caseAssist/caseInput/update",e=>z(e,{fieldName:te,fieldValue:It}));m();d();f();p();var AS=()=>({});var kr=Ve(AS(),e=>{e.addCase(Cn,(t,r)=>{t[r.payload.fieldName]={value:r.payload.fieldValue}})});m();d();f();p();var bt=ve("caseAssist/documentSuggestions/fetch",/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:i}}){let o=t(),s=yield n.getDocumentSuggestions(yield Nk(o,i));return ut(s)?r(s.error):{response:s.success}});return function(_x159,_x160){return _ref73.apply(this,arguments)}}()),Nk=/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??Te(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield Zn(e.configuration.analytics)}),...(e.configuration.analytics.enabled&&Xr(e.configuration.analytics,t,{actionCause:"documentSuggestion"})),fields:e.caseInput,context:e.caseField?Go(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function Nk(_x161,_x162){return _ref74.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var wS=()=>({status:{loading:!1,error:null,lastResponseId:""},documents:[]});var Ht=Ve(wS(),e=>{e.addCase(bt.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase(bt.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(bt.pending,t=>{t.status.loading=!0}).addCase(Ri,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();function zt(e){let t,r=new Map,n=()=>r.size===0,i=o=>{try{let s=JSON.stringify(o),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(o){o();let s=Symbol(),a;return n()&&(t=JSON.stringify(this.state),a=e.subscribe(()=>{i(this.state)&&r.forEach(c=>c())})),r.set(s,o),()=>{r.delete(s),n()&&a?.()}},get state(){return{}}}}var Fk=new xt({field:te});function bS(e,t={}){if(!Dk(e))throw gt;let r=zt(e),{dispatch:n}=e,i=ss(e,Fk,t.options,"buildCaseField"),o=()=>e.state;return o().caseField?.fields?.[i.field]||n(ki({fieldName:i.field,fieldValue:""})),{...r,get state(){let a=o().caseField?.status?.loading??!1,c=o().caseField?.status?.error??null,u=o().caseField?.fields?.[i.field],h=u?.value??"",v=u?.suggestions??[];return{loading:a,error:c,value:h,suggestions:v}},update(a,c,u){let h=o().caseField?.fields?.[i.field]?.suggestions?.find(v=>v.value===a)?.id;h&&n(u?gS(h):Ec(h)),n(Oi({fieldName:i.field,fieldValue:a})),!u&&n(_i(i.field)),c?.caseClassifications&&n(Qt()),c?.documentSuggestions&&n(bt())}}}function Dk(e){return e.addReducers({configuration:ft,caseAssistConfiguration:ur,caseInput:kr,caseField:_r,documentSuggestion:Ht}),!0}m();d();f();p();function Mk(e,t){let r=new xt({field:te});ss(e,r,t,"buildCaseInput")}function CS(e,t){if(!jk(e))throw gt;let r=zt(e),{dispatch:n}=e,i=()=>e.state;Mk(e,t.options);let o=t.options.field;return i().caseInput?.[o]||n(Cn({fieldName:o,fieldValue:""})),{...r,update(a,c){n(Cn({fieldName:o,fieldValue:a})),n(_i(o)),c?.caseClassifications&&n(Qt()),c?.documentSuggestions&&n(bt())},get state(){return i().caseInput[o]}}}function jk(e){return e.addReducers({configuration:ft,caseAssistConfiguration:ur,caseInput:kr,caseField:_r,documentSuggestion:Ht}),!0}m();d();f();p();m();d();f();p();function xS(e,t,r){if(!qk(e))throw gt;let n=1e3,i={selectionDelay:n,debounceWait:n,...t.options},o;return{select:Mo(r,i.debounceWait,{isImmediate:!0}),beginDelayedSelect(){o=setTimeout(r,i.selectionDelay)},cancelPendingSelect(){o&&clearTimeout(o)}}}function qk(e){return e.addReducers({configuration:ft}),!0}function ES(e,t){let r=!1;return xS(e,t,()=>{r||(r=!0,e.dispatch(yS(t.options.result.uniqueId)))})}m();d();f();p();function Qd(e){if(!Lk(e))throw gt;let t=zt(e),{dispatch:r}=e,n=()=>e.state;return{...t,fetch(){r(bt())},get state(){let i=n().documentSuggestion;return{loading:i.status.loading,error:i.status.error,documents:i.documents}}}}function Lk(e){return e.addReducers({configuration:ft,caseAssistConfiguration:ur,caseInput:kr,caseField:_r,documentSuggestion:Ht}),!0}m();d();f();p();m();d();f();p();m();d();f();p();function Rc(_x163,_x164){return _Rc.apply(this,arguments)}function _Rc(){_Rc=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:i}=e.configuration,o=e.query?.q||"";return{url:r.apiBaseUrl??_n(e.configuration.organizationId,e.configuration.environment),accessToken:n,organizationId:i,enableNavigation:!1,q:o,...t,requestedOutputSize:t.requestedOutputSize||0,...(r.authenticationProviders.length&&{authentication:r.authenticationProviders.join(",")})}});return _Rc.apply(this,arguments)}var Oo=ve("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let i=r(),o=yield Rc(i,e),s=yield t.apiClient.html(o);return ut(s)?n(s.error):{content:s.success,uniqueId:e.uniqueId}});return function(_x165,_x166){return _ref75.apply(this,arguments)}}()),Tc=q("resultPreview/next"),_c=q("resultPreview/previous"),kc=q("resultPreview/prepare",e=>z(e,{results:new Et({required:!0})})),IS=2048,Oc=ve("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),i=Dp(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return i?.length>IS&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${IS} characters.`),{contentURL:i}});return function(_x167,_x168){return _ref76.apply(this,arguments)}}());m();d();f();p();m();d();f();p();m();d();f();p();function Hd(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var zd=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:i}=Hd();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=i},Wd=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),RS=Ve(Hd(),e=>{e.addCase(Oo.pending,t=>{t.isLoading=!0}).addCase(Oo.fulfilled,(t,r)=>{let{content:n,uniqueId:i}=r.payload;t.position=t.resultsWithPreview.indexOf(i),t.content=n,t.uniqueId=i,t.isLoading=!1}).addCase(bc.fulfilled,(t,r)=>{zd(t),t.resultsWithPreview=Wd(r.payload.response.results)}).addCase(Dv.fulfilled,(t,r)=>{zd(t),t.resultsWithPreview=t.resultsWithPreview.concat(Wd(r.payload.response.results))}).addCase(Fv.fulfilled,zd).addCase(kc,(t,r)=>{t.resultsWithPreview=Wd(r.payload.results)}).addCase(Tc,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(_c,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(Oc.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});function TS(e,t,r,n,i){if(!Uk(e))throw gt;let{dispatch:o}=e,s=()=>e.state,a=zt(e),{result:c,maximumPreviewSize:u}=t.options,h=()=>{let{resultsWithPreview:S,position:g}=s().resultPreview;return S[g]},v=S=>{o(Oc({uniqueId:S,requestedOutputSize:u,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||o(Oo({uniqueId:S,requestedOutputSize:u})),i&&i()};return{...a,fetchResultContent(){v(c.uniqueId)},next(){o(Tc()),v(h())},previous(){o(_c()),v(h())},get state(){let S=s(),g=c.hasHtmlVersion,y=S.resultPreview,C=c.uniqueId===y.uniqueId?y.content:"",E=y.isLoading,x=y.contentURL,R=h();return{content:C,resultHasPreview:g,isLoading:E,contentURL:x,currentResultUniqueId:R}}}}function Uk(e){return e.addReducers({configuration:ft,resultPreview:RS}),!0}function _S(e,t){if(!Vk(e))throw gt;let{dispatch:r}=e,n=()=>e.state,i=()=>n().documentSuggestion.documents,a=TS(e,t,Rc,"/html",()=>{e.dispatch(Ic(t.options.result.uniqueId))});return r(kc({results:i()})),{...a,get state(){return{...a.state,currentDocument:i().findIndex(c=>c.uniqueId===a.state.currentResultUniqueId)+1,totalDocuments:i().length}}}}function Vk(e){return e.addReducers({documentSuggestion:Ht}),!0}m();d();f();p();m();d();f();p();var Kd=e=>z(e,{evt:te,type:Ge}),kS=e=>et("analytics/generic/search",t=>{Kd(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),OS=e=>et("analytics/generic/click",(t,r)=>(wl(e.result),Kd(e),t.makeClickEvent(e.evt,Sl(e.result,r),Al(e.result),e.meta))),PS=e=>et("analytics/generic/custom",t=>(Kd(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));function Gk(e){return e.addReducers({}),{logSearchEvent:kS,logClickEvent:OS,logCustomEvent:PS}}m();d();f();p();function Bk(e){return e.addReducers({}),{logCaseStart:lS,logCaseNextStage:dS,logCreateCase:pS,logSolveCase:fS,logAbandonCase:mS,logUpdateCaseField:_i,logClassificationClick:Ec,logDocumentSuggestionClick:hS,logDocumentSuggestionRating:vS,logQuickviewDocumentSuggestionClick:Ic}}m();d();f();p();function $k(e){return e.addReducers({caseField:_r}),{registerCaseField:ki,updateCaseField:Oi,fetchCaseClassifications:Qt}}m();d();f();p();function Qk(e){return e.addReducers({caseInput:kr}),{updateCaseInput:Cn}}m();d();f();p();function Hk(e){return e.addReducers({documentSuggestion:Ht}),{fetchDocumentSuggestions:bt}}/**
|
|
44
|
+
For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function Av(e){e==="next"&&console.warn(k_)}m();d();f();p();var _v=Ct(Tv(),1);function kv(e){return(0,_v.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function Ov(e,t){let r=W_(e),n=lu,i=K_(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:i,logger:t}}function W_(e){let{analytics:t}=e,r=(n,i)=>i;return t?.analyticsClientMiddleware||r}function K_(e){return e.preprocessRequest||No}m();d();f();p();m();d();f();p();var Pv={organizationId:te,accessToken:te,name:new J({required:!1,emptyAllowed:!1}),analytics:new xe({options:{required:!1},values:{enabled:new Fe({required:!1}),originContext:new J({required:!1}),originLevel2:new J({required:!1}),originLevel3:new J({required:!1}),analyticsMode:new J({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new J({required:!1,url:!0}),trackingId:new J({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/})}}),environment:new J({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};var Nv=new xt({...Pv,caseAssistId:te,locale:Be});var Y_={debug:xf,caseAssistConfiguration:cr,searchHub:kf};function Fv(e){let t=kv(e.loggerOptions);X_(e.configuration,t);let r=J_(e.configuration,t),n={...Ov(e.configuration,t),apiClient:r},i={...e,reducers:Y_},o=Sv(i,n);Av(o.state.configuration.analytics.analyticsMode);let{caseAssistId:s,locale:a,searchHub:c,proxyBaseUrl:u}=e.configuration;return o.dispatch(rs({caseAssistId:s,locale:a,proxyBaseUrl:u})),ie(c)||o.dispatch(os(c)),{...o,get state(){return o.state}}}function X_(e,t){try{Nv.validate(e)}catch(r){throw t.error(r,"Case Assist engine configuration error"),r}}function J_(e,t){return new qo({logger:t,preprocessRequest:e.preprocessRequest||No})}m();d();f();p();m();d();f();p();m();d();f();p();var Dv=(o=>(o.id="id",o.subject="subject",o.description="description",o.category="category",o.productId="productId",o))(Dv||{}),Mv=e=>!Object.values(Dv).includes(e),lt=e=>{let t=r=>Z_(e,r)??tk(e,r);return{id:t("id"),subject:t("subject"),description:t("description"),category:t("category"),productId:t("productId"),custom:{...ek(e),...rk(e)}}},Z_=(e,t)=>e?.caseInput?.[t]?.value,ek=e=>Object.keys(e?.caseInput??[]).reduce((t,r)=>{if(Mv(r)){let n=e?.caseInput?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),tk=(e,t)=>e?.caseField?.fields[t]?.value,rk=e=>Object.keys(e?.caseField?.fields??[]).reduce((t,r)=>{if(Mv(r)){let n=e?.caseField?.fields?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),Pd=(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 o=e?.caseField?.fields[n]?.suggestions.find(a=>a.id===t),s={classificationId:o?.id??"",responseId:e.caseField?.status.lastResponseId??"",fieldName:n,classification:{value:o?.value??"",confidence:o?.confidence??0}};return r?{...s,autoSelection:r}:s},or=(e,t,r=!1,n=!1)=>{let i,o=e.documentSuggestion?.documents.find((a,c)=>{let u=a.uniqueId===t;return u&&(i=c+1),u});if(!o)throw new Error(`Document Suggestion with ID '${t}' could not be found.`);let s={suggestionId:o.uniqueId,permanentId:o.fields.permanentid,responseId:e.documentSuggestion?.status.lastResponseId??"",suggestion:{documentUri:o.fields.uri,documentUriHash:o.fields.urihash,documentTitle:o.title,documentUrl:o.clickUri,documentPosition:i??0,sourceName:o.fields.source}};return r?{...s,fromQuickview:r}:n?{...s,openDocument:n}:s};var jv=()=>pt({prefix:"analytics/caseAssist/case/start",__legacy__getBuilder:(e,t)=>e.logEnterInterface({ticket:lt(t)}),analyticsType:"CaseAssist.Start",analyticsPayloadBuilder:()=>({})}),qv=e=>pt("analytics/caseAssist/case/nextStage",(t,r)=>t.logMoveToNextCaseStep({ticket:lt(r),stage:e?.stageName})),Lv=()=>pt({prefix:"analytics/caseAssist/case/create",__legacy__getBuilder:(e,t)=>e.logCaseCreated({ticket:lt(t)}),analyticsType:"CaseAssist.CreateTicket",analyticsPayloadBuilder:e=>{let{id:t,category:r,subject:n,description:i,productId:o}=lt(e);return{ticket:{id:t,category:r,subject:n,description:i,system:o}}}}),Uv=()=>pt({prefix:"analytics/caseAssist/case/solve",__legacy__getBuilder:(e,t)=>e.logCaseSolved({ticket:lt(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"solved"})}),Vv=()=>pt({prefix:"analytics/caseAssist/case/abandon",__legacy__getBuilder:(e,t)=>e.logCaseCancelled({ticket:lt(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"quit"})}),Ai=e=>pt({prefix:"analytics/caseAssist/case/field/update",__legacy__getBuilder:(t,r)=>t.logUpdateCaseField({fieldName:e,ticket:lt(r)}),analyticsType:"CaseAssist.UpdateField",analyticsPayloadBuilder:t=>{let r=t.caseField?.fields?.[e]?.value||t.caseInput?.[e]?.value||"";return{fieldName:e,fieldValue:r}}}),Bv=e=>pt({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:Pd(r,e,!0),ticket:lt(r)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let r=t.caseField?.status?.lastResponseId;if(r)return{autoselected:!0,classificationId:e,responseId:r}}}),fc=e=>pt({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:Pd(r,e),ticket:lt(r)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let r=t.caseField?.status?.lastResponseId;if(r)return{autoselected:!1,classificationId:e,responseId:r}}}),Gv=e=>pt({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logSelectDocumentSuggestion({suggestion:or(r,e),ticket:lt(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=or(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}}}}),mc=e=>pt({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logQuickviewDocumentSuggestion({suggestion:or(r,e),ticket:lt(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=or(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}}}}),$v=e=>pt({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logSelectDocumentSuggestion({suggestion:or(r,e,!1,!0),ticket:lt(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=or(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}}}}),Qv=(e,t)=>pt({prefix:"analytics/caseAssist/documentSuggestion/rate",__legacy__getBuilder:(r,n)=>r.logRateDocumentSuggestion({rating:t,suggestion:or(n,e),ticket:lt(n)}),analyticsType:"CaseAssist.DocumentSuggestionFeedback",analyticsPayloadBuilder:r=>{let n=r.documentSuggestion?.status?.lastResponseId,i=or(r,e);if(n)return{responseId:n,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:i.suggestionId,url:i.suggestion.documentUri,title:i.suggestion.documentTitle},liked:!!t}}});m();d();f();p();var bi=q("caseAssist/caseField/register",e=>z(e,{fieldName:te,fieldValue:Rt})),wi=q("caseAssist/caseField/update",e=>z(e,{fieldName:te,fieldValue:Rt})),$t=ve("caseAssist/classifications/fetch",/*#__PURE__*/function(){var _ref68=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let i=t(),o=yield n.getCaseClassifications(yield nk(i));return ut(o)?r(o.error):{response:o.success}});return function(_x147,_x148){return _ref68.apply(this,arguments)}}()),nk=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??qe(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield $n(e.configuration.analytics)}),fields:e.caseInput,context:e.caseField?jo(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function nk(_x149){return _ref69.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var Hv=()=>({status:{loading:!1,error:null,lastResponseId:""},fields:{}});var Ir=Ve(Hv(),e=>{e.addCase(bi,(t,r)=>{let{fieldName:n,fieldValue:i}=r.payload;t.fields[n]={value:i,suggestions:[]}}).addCase(wi,(t,r)=>{let{fieldName:n,fieldValue:i}=r.payload;t.fields[n].value=i}).addCase($t.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase($t.fulfilled,(t,r)=>{let n={value:"",suggestions:[]};Object.entries(r.payload.response.fields).forEach(([i,o])=>{t.fields[i]||(t.fields[i]={...n}),t.fields[i].suggestions=o.predictions}),t.status.lastResponseId=r.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase($t.pending,t=>{t.status.loading=!0}).addCase(vi,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();m();d();f();p();var hn=q("caseAssist/caseInput/update",e=>z(e,{fieldName:te,fieldValue:Rt}));m();d();f();p();var zv=()=>({});var Tr=Ve(zv(),e=>{e.addCase(hn,(t,r)=>{t[r.payload.fieldName]={value:r.payload.fieldValue}})});m();d();f();p();var wt=ve("caseAssist/documentSuggestions/fetch",/*#__PURE__*/function(){var _ref70=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:i}}){let o=t(),s=yield n.getDocumentSuggestions(yield ik(o,i));return ut(s)?r(s.error):{response:s.success}});return function(_x150,_x151){return _ref70.apply(this,arguments)}}()),ik=/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??qe(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield $n(e.configuration.analytics)}),...(e.configuration.analytics.enabled&&$r(e.configuration.analytics,t,{actionCause:"documentSuggestion"})),fields:e.caseInput,context:e.caseField?jo(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function ik(_x152,_x153){return _ref71.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var Wv=()=>({status:{loading:!1,error:null,lastResponseId:""},documents:[]});var Qt=Ve(Wv(),e=>{e.addCase(wt.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase(wt.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(wt.pending,t=>{t.status.loading=!0}).addCase(vi,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();function Ht(e){let t,r=new Map,n=()=>r.size===0,i=o=>{try{let s=JSON.stringify(o),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(o){o();let s=Symbol(),a;return n()&&(t=JSON.stringify(this.state),a=e.subscribe(()=>{i(this.state)&&r.forEach(c=>c())})),r.set(s,o),()=>{r.delete(s),n()&&a?.()}},get state(){return{}}}}var ok=new xt({field:te});function Kv(e,t={}){if(!sk(e))throw gt;let r=Ht(e),{dispatch:n}=e,i=ts(e,ok,t.options,"buildCaseField"),o=()=>e.state;return o().caseField?.fields?.[i.field]||n(bi({fieldName:i.field,fieldValue:""})),{...r,get state(){let a=o().caseField?.status?.loading??!1,c=o().caseField?.status?.error??null,u=o().caseField?.fields?.[i.field],h=u?.value??"",v=u?.suggestions??[];return{loading:a,error:c,value:h,suggestions:v}},update(a,c,u){let h=o().caseField?.fields?.[i.field]?.suggestions?.find(v=>v.value===a)?.id;h&&n(u?Bv(h):fc(h)),n(wi({fieldName:i.field,fieldValue:a})),!u&&n(Ai(i.field)),c?.caseClassifications&&n($t()),c?.documentSuggestions&&n(wt())}}}function sk(e){return e.addReducers({configuration:ft,caseAssistConfiguration:cr,caseInput:Tr,caseField:Ir,documentSuggestion:Qt}),!0}m();d();f();p();function ak(e,t){let r=new xt({field:te});ts(e,r,t,"buildCaseInput")}function Yv(e,t){if(!ck(e))throw gt;let r=Ht(e),{dispatch:n}=e,i=()=>e.state;ak(e,t.options);let o=t.options.field;return i().caseInput?.[o]||n(hn({fieldName:o,fieldValue:""})),{...r,update(a,c){n(hn({fieldName:o,fieldValue:a})),n(Ai(o)),c?.caseClassifications&&n($t()),c?.documentSuggestions&&n(wt())},get state(){return i().caseInput[o]}}}function ck(e){return e.addReducers({configuration:ft,caseAssistConfiguration:cr,caseInput:Tr,caseField:Ir,documentSuggestion:Qt}),!0}m();d();f();p();m();d();f();p();function Xv(e,t,r){if(!uk(e))throw gt;let n=1e3,i={selectionDelay:n,debounceWait:n,...t.options},o;return{select:Oo(r,i.debounceWait,{isImmediate:!0}),beginDelayedSelect(){o=setTimeout(r,i.selectionDelay)},cancelPendingSelect(){o&&clearTimeout(o)}}}function uk(e){return e.addReducers({configuration:ft}),!0}function Jv(e,t){let r=!1;return Xv(e,t,()=>{r||(r=!0,e.dispatch($v(t.options.result.uniqueId)))})}m();d();f();p();function Nd(e){if(!lk(e))throw gt;let t=Ht(e),{dispatch:r}=e,n=()=>e.state;return{...t,fetch(){r(wt())},get state(){let i=n().documentSuggestion;return{loading:i.status.loading,error:i.status.error,documents:i.documents}}}}function lk(e){return e.addReducers({configuration:ft,caseAssistConfiguration:cr,caseInput:Tr,caseField:Ir,documentSuggestion:Qt}),!0}m();d();f();p();m();d();f();p();m();d();f();p();function gc(_x154,_x155){return _gc.apply(this,arguments)}function _gc(){_gc=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:i}=e.configuration,o=e.query?.q||"";return{url:r.apiBaseUrl??wn(e.configuration.organizationId,e.configuration.environment),accessToken:n,organizationId:i,enableNavigation:!1,q:o,...t,requestedOutputSize:t.requestedOutputSize||0,...(r.authenticationProviders.length&&{authentication:r.authenticationProviders.join(",")})}});return _gc.apply(this,arguments)}var Ro=ve("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let i=r(),o=yield gc(i,e),s=yield t.apiClient.html(o);return ut(s)?n(s.error):{content:s.success,uniqueId:e.uniqueId}});return function(_x156,_x157){return _ref72.apply(this,arguments)}}()),hc=q("resultPreview/next"),yc=q("resultPreview/previous"),vc=q("resultPreview/prepare",e=>z(e,{results:new Et({required:!0})})),Zv=2048,Sc=ve("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),i=Cp(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return i?.length>Zv&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${Zv} characters.`),{contentURL:i}});return function(_x158,_x159){return _ref73.apply(this,arguments)}}());m();d();f();p();m();d();f();p();m();d();f();p();function Fd(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var Dd=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:i}=Fd();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=i},Md=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),eS=Ve(Fd(),e=>{e.addCase(Ro.pending,t=>{t.isLoading=!0}).addCase(Ro.fulfilled,(t,r)=>{let{content:n,uniqueId:i}=r.payload;t.position=t.resultsWithPreview.indexOf(i),t.content=n,t.uniqueId=i,t.isLoading=!1}).addCase(lc.fulfilled,(t,r)=>{Dd(t),t.resultsWithPreview=Md(r.payload.response.results)}).addCase(cv.fulfilled,(t,r)=>{Dd(t),t.resultsWithPreview=t.resultsWithPreview.concat(Md(r.payload.response.results))}).addCase(av.fulfilled,Dd).addCase(vc,(t,r)=>{t.resultsWithPreview=Md(r.payload.results)}).addCase(hc,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(yc,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(Sc.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});function tS(e,t,r,n,i){if(!dk(e))throw gt;let{dispatch:o}=e,s=()=>e.state,a=Ht(e),{result:c,maximumPreviewSize:u}=t.options,h=()=>{let{resultsWithPreview:S,position:g}=s().resultPreview;return S[g]},v=S=>{o(Sc({uniqueId:S,requestedOutputSize:u,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||o(Ro({uniqueId:S,requestedOutputSize:u})),i&&i()};return{...a,fetchResultContent(){v(c.uniqueId)},next(){o(hc()),v(h())},previous(){o(yc()),v(h())},get state(){let S=s(),g=c.hasHtmlVersion,y=S.resultPreview,C=c.uniqueId===y.uniqueId?y.content:"",E=y.isLoading,x=y.contentURL,I=h();return{content:C,resultHasPreview:g,isLoading:E,contentURL:x,currentResultUniqueId:I}}}}function dk(e){return e.addReducers({configuration:ft,resultPreview:eS}),!0}function rS(e,t){if(!pk(e))throw gt;let{dispatch:r}=e,n=()=>e.state,i=()=>n().documentSuggestion.documents,a=tS(e,t,gc,"/html",()=>{e.dispatch(mc(t.options.result.uniqueId))});return r(vc({results:i()})),{...a,get state(){return{...a.state,currentDocument:i().findIndex(c=>c.uniqueId===a.state.currentResultUniqueId)+1,totalDocuments:i().length}}}}function pk(e){return e.addReducers({documentSuggestion:Qt}),!0}m();d();f();p();m();d();f();p();var jd=e=>z(e,{evt:te,type:Be}),nS=e=>et("analytics/generic/search",t=>{jd(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),iS=e=>et("analytics/generic/click",(t,r)=>(sl(e.result),jd(e),t.makeClickEvent(e.evt,il(e.result,r),ol(e.result),e.meta))),oS=e=>et("analytics/generic/custom",t=>(jd(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));function fk(e){return e.addReducers({}),{logSearchEvent:nS,logClickEvent:iS,logCustomEvent:oS}}m();d();f();p();function mk(e){return e.addReducers({}),{logCaseStart:jv,logCaseNextStage:qv,logCreateCase:Lv,logSolveCase:Uv,logAbandonCase:Vv,logUpdateCaseField:Ai,logClassificationClick:fc,logDocumentSuggestionClick:Gv,logDocumentSuggestionRating:Qv,logQuickviewDocumentSuggestionClick:mc}}m();d();f();p();function gk(e){return e.addReducers({caseField:Ir}),{registerCaseField:bi,updateCaseField:wi,fetchCaseClassifications:$t}}m();d();f();p();function hk(e){return e.addReducers({caseInput:Tr}),{updateCaseInput:hn}}m();d();f();p();function yk(e){return e.addReducers({documentSuggestion:Qt}),{fetchDocumentSuggestions:wt}}/**
|
|
45
45
|
* @license
|
|
46
46
|
*
|
|
47
47
|
* Copyright 2026 Coveo Solutions Inc.
|
|
@@ -74,4 +74,4 @@ fast-json-patch/module/duplex.mjs:
|
|
|
74
74
|
*)
|
|
75
75
|
*/if(__exports!=exports)module.exports=exports;return module.exports});
|
|
76
76
|
|
|
77
|
-
window.coveoQuanticVersion = '3.36.
|
|
77
|
+
window.coveoQuanticVersion = '3.36.8';
|