PageSourceSearch

https://www.philips.hu/c-e/shop/checkout/assets/recommendation.index-HpBP6c2g.js

js philips.hu collected 2026-10-02 10:35:49 UTC 481,680 bytes, 29 lines download raw bytes

1import{g as e}from"./vendor-CV6ISSGl.js";
2/**
3 * @license
4 *
5 * Copyright 2026 Coveo Solutions Inc.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 * 
11 *       http://www.apache.org/licenses/LICENSE-2.0
12 * 
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */var t=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},n=class{constructor(e){this.definition=e}validate(e={},n=""){const r={...this.default,...e},i=[];for(const t in this.definition){const e=this.definition[t].validate(r[t]);e&&i.push(`${t}: ${e}`)}if(i.length)throw function(e,n){const r=`\n  The following properties are invalid:\n\n    ${e.join("\n\t")}\n  \n  ${n}\n  `;return new t(r)}(i,n);return r}get default(){const e={};for(const t in this.definition){const n=this.definition[t].default;void 0!==n&&(e[t]=n)}return e}},r=class{constructor(e={}){this.baseConfig=e}validate(e){return this.baseConfig.required&&a(e)?"value is required.":null}get default(){return this.baseConfig.default instanceof Function?this.baseConfig.default():this.baseConfig.default}get required(){return!0===this.baseConfig.required}};function i(e){return void 0===e}function a(e){return i(e)||function(e){return null===e}(e)}var s=class{value;constructor(e={}){this.value=new r(e)}validate(e){const t=this.value.validate(e);return t||(function(e){return i(e)||o(e)}(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function o(e){return"boolean"==typeof e}var c=class{constructor(e={}){this.config=e,this.value=new r(e)}value;validate(e){const t=this.value.validate(e);return t||(function(e){return i(e)||u(e)}(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 u(e){return"number"==typeof e&&!Number.isNaN(e)}var l=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,d=class{value;config;constructor(e={}){this.config={emptyAllowed:!0,url:!1,...e},this.value=new r(this.config)}validate(e){const{emptyAllowed:t,url:n,regex:r,constrainTo:a,ISODate:s}=this.config,o=this.value.validate(e);if(o)return o;if(i(e))return null;if(!p(e))return"value is not a string.";if(!t&&!e.length)return"value is an empty string.";if(n)try{new URL(e)}catch(c){return"value is not a valid URL."}if(r&&!r.test(e))return`value did not match provided regex ${r}`;if(a&&!a.includes(e)){return`value should be one of: ${a.join(", ")}.`}return!s||l.test(e)&&"Invalid Date"!==new Date(e).toString()?null:"value is not a valid ISO8601 date string"}get default(){return this.value.default}get required(){return this.value.required}};function p(e){return"[object String]"===Object.prototype.toString.call(e)}var f=class{config;constructor(e={}){this.config={options:{required:!1},values:{},...e}}validate(e){if(i(e))return this.config.options.required?"value is required and is currently undefined":null;if(!h(e))return"value is not an object";for(const[n,r]of Object.entries(this.config.values))if(r.required&&a(e[n]))return`value does not contain ${n}`;let t="";for(const[n,r]of Object.entries(this.config.values)){const i=e[n],a=r.validate(i);null!==a&&(t+=` ${a}`)}return""===t?null:t}get default(){}get required(){return!!this.config.options.required}};function h(e){return void 0!==e&&"object"==typeof e}var g=class{constructor(e={}){this.config=e,this.value=new r(this.config)}value;validate(e){if(!a(e)&&!Array.isArray(e))return"value is not an array";const t=this.value.validate(e);if(null!==t)return t;if(a(e))return null;if(void 0!==this.config.max&&e.length>this.config.max)return`value contains more than ${this.config.max}`;if(void 0!==this.config.min&&e.length<this.config.min)return`value contains less than ${this.config.min}`;if(void 0!==this.config.each){let t="";return e.forEach(n=>{this.config.each.required&&a(n)&&(t=`value is null or undefined: ${e.join(",")}`);const r=this.validatePrimitiveValue(n,this.config.each);null!==r&&(t+=` ${r}`)}),""===t?null:t}return null}validatePrimitiveValue(e,t){return o(e)||p(e)||u(e)||h(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};var m=class{constructor(e){this.config=e,this.value=new r(e)}value;validate(e){const t=this.value.validate(e);if(null!==t)return t;if(i(e))return null;return Object.values(this.config.enum).find(t=>t===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};function y(e){return""===e.trim()}const v=new Set(["1",1,"yes",!0]);function w(){if("undefined"==typeof navigator||"undefined"==typeof window)return!1;const e=navigator,t=window;return[e.globalPrivacyControl,e.doNotTrack,e.msDoNotTrack,t.doNotTrack].some(e=>v.has(e))}function b(e){if("object"!=typeof e)return e;if(!e)return e;try{return JSON.parse(JSON.stringify(e))}catch(t){return e}}function S(e,t,n={}){let r;return(...i)=>{const a=n.isImmediate&&!r;if(clearTimeout(r),r=setTimeout(()=>{r=void 0,n.isImmediate||e.apply(void 0,i)},t),a)return e.apply(void 0,i)}}function E(e,t){return t?t.open+e+t.close:e}function _(e){const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},n=`(?:${Object.keys(t).join("|")})`,r=RegExp(n),i=RegExp(n,"g");return r.test(e)?e.replace(i,e=>t[e]):e}const A=Object.freeze(Object.defineProperty({__proto__:null,escapeHtml:_,getHighlightedSuggestion:function(e,t){return(e=_(e)).replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(e,n,r,i)=>n?E(n,t.notMatchDelimiters):r?E(r,t.exactMatchDelimiters):i?E(i,t.correctionDelimiters):e)},highlightString:function(e){if(y(e.openingDelimiter)||y(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(a(e.content)||y(e.content))return e.content;if(0===e.highlights.length)return _(e.content);const t=e.content.length;let n="",r=0;for(let i=0;i<e.highlights.length;i++){const a=e.highlights[i],s=a.offset,o=s+a.length;if(o>t)break;n+=_(e.content.slice(r,s)),n+=e.openingDelimiter,n+=_(e.content.slice(s,o)),n+=e.closingDelimiter,r=o}return r!==t&&(n+=_(e.content.slice(r))),n}},Symbol.toStringTag,{value:"Module"}));var I,k={},T={};var C,x={},O={},R={},N={},D={};var M,P,q,F,U={};function j(){if(P)return N;P=1,Object.defineProperty(N,"__esModule",{value:!0});var e=(C||(C=1,Object.defineProperty(D,"__esModule",{value:!0}),D.fullJitter=function(e){var t=Math.random()*e;return Math.round(t)}),D),t=(M||(M=1,Object.defineProperty(U,"__esModule",{value:!0}),U.noJitter=function(e){return e}),U);return N.JitterFactory=function(n){return"full"===n.jitter?e.fullJitter:t.noJitter},N}function L(){if(q)return R;q=1,Object.defineProperty(R,"__esModule",{value:!0});var e=j(),t=function(){function t(e){this.options=e,this.attempt=0}return t.prototype.apply=function(){var e=this;return new Promise(function(t){return setTimeout(t,e.jitteredDelay)})},t.prototype.setAttemptNumber=function(e){this.attempt=e},Object.defineProperty(t.prototype,"jitteredDelay",{get:function(){return e.JitterFactory(this.options)(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"delay",{get:function(){var e=this.options.startingDelay,t=this.options.timeMultiple,n=this.numOfDelayedAttempts,r=e*Math.pow(t,n);return Math.min(r,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),t}();return R.Delay=t,R}function $(){if(F)return O;F=1;var e=O&&O.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}
18(),t=O&&O.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,a){function s(e){try{c(r.next(e))}catch(t){a(t)}}function o(e){try{c(r.throw(e))}catch(t){a(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,o)}c((r=r.apply(e,t||[])).next())})},n=O&&O.__generator||function(e,t){var n,r,i,a,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(a){return function(o){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(o){a=[6,o],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,o])}}};
18Object.defineProperty(O,"__esModule",{value:!0});var r=function(r){function i(){return null!==r&&r.apply(this,arguments)||this}return e(i,r),i.prototype.apply=function(){return t(this,void 0,void 0,function(){return n(this,function(e){return[2,!!this.isFirstAttempt||r.prototype.apply.call(this)]})})},Object.defineProperty(i.prototype,"isFirstAttempt",{get:function(){return 0===this.attempt},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),i}(L().Delay);return O.SkipFirstDelay=r,O}var V,G,Q,z={};function H(){if(G)return x;G=1,Object.defineProperty(x,"__esModule",{value:!0});var e=$(),t=function(){if(V)return z;V=1;var e=z&&z.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(z,"__esModule",{value:!0});var t=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n}(L().Delay);return z.AlwaysDelay=t,z}();return x.DelayFactory=function(n,r){var i=function(n){if(!n.delayFirstAttempt)return new e.SkipFirstDelay(n);return new t.AlwaysDelay(n)}(n);return i.setAttemptNumber(r),i},x}var B=function(){if(Q)return k;Q=1;var e=k&&k.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,a){function s(e){try{c(r.next(e))}catch(t){a(t)}}function o(e){try{c(r.throw(e))}catch(t){a(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,o)}c((r=r.apply(e,t||[])).next())})},t=k&&k.__generator||function(e,t){var n,r,i,a,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(a){return function(o){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(o){a=[6,o],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,o])}}};Object.defineProperty(k,"__esModule",{value:!0});var n=function(){if(I)return T;I=1;var e=T&&T.__assign||function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};Object.defineProperty(T,"__esModule",{value:!0});var t={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};return T.getSanitizedOptions=function(n){var r=e(e({},t),n);return r.numOfAttempts<1&&(r.numOfAttempts=1),r},T}(),r=H();k.backOff=function(r,a){return void 0===a&&(a={}),e(this,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return e=n.getSanitizedOptions(a),[4,new i(r,e).execute()];case 1:return[2,t.sent()]}})})};var i=function(){function n(e,t){this.request=e,this.options=t,this.attemptNumber=0}return n.prototype.execute=function(){return e(this,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:if(this.attemptLimitReached)return[3,7];t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return t.sent(),[4,this.request()];case 3:return[2,t.sent()];case 4:return e=t.sent(),this.attemptNumber++,[4,this.options.retry(e,this.attemptNumber)];case 5:if(!t.sent()||this.attemptLimitReached)throw e;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}})})},Object.defineProperty(n.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),n.prototype.applyDelay=function(){return e(this,void 0,void 0,function(){return t(this,function(e){switch(e.label){case 0:return[4,r.DelayFactory(this.options,this.attemptNumber).apply()];case 1:return e.sent(),[2]}})})},n}();return k}();
18class K 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."}}class Y extends Error{statusCode;constructor(e,t){super(),this.name="Disconnected",this.message=`Client could not connect to the following URL: ${e}`,this.statusCode=t??0}}function Z(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}function W(e){return 429===e}class J{static async call(e){const t=function(e){const{url:t,method:n,requestParams:r,contentType:i,accessToken:a,signal:s}=e,o="POST"===e.method||"PUT"===e.method,c=function(e,t){if("application/x-www-form-urlencoded"===t)return"object"==typeof(n=e)&&n&&Object.values(n).every(Z)?function(e){const t=[];for(const n in e){const r=encodeURIComponent(n),i=encodeURIComponent(e[n]);t.push(`${r}=${i}`)}return t.join("&")}(e):"";var n;return JSON.stringify(e)}(r,i);return{url:t,method:n,headers:{"Content-Type":i,Authorization:`Bearer ${a}`,...e.headers},...o&&{body:c},signal:s}}(e),{logger:n}=e,r=await J.preprocessRequest(t,e);n.info(r,"Platform request");const{url:i,...a}=r,s=async()=>{const e=await fetch(i,a);if(W(e.status))throw e;return e};try{const e=await B.backOff(s,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:async e=>{const t=e&&W(e.status);return t&&(n.info("Platform retrying request"),await new Promise(e=>setTimeout(e,1e3))),t}});switch(e.status){case 419:case 401:throw n.info("Platform renewing token"),new K;case 404:throw new Y(i,e.status);default:return n.info({response:e,requestInfo:r},"Platform response"),e}}catch(o){return"Failed to fetch"===o.message?new Y(i):o}}static async preprocessRequest(e,t){const{origin:n,preprocessRequest:r,logger:i,requestMetadata:a}=t,{signal:s,...o}=e,c=b(o);try{const t=await r(e,n,a);return{...e,...t}}catch(u){i.error(u,"Platform request preprocessing failed. Returning default request options.")}return c}}function X(e,t="prod",n="platform"){return`https://${e}${"platform"===n?"":`.${n}`}.org${"prod"===t?"":t}.coveo.com`}function ee(e,t,n="prod"){return e??X(t,n)}function te(e,t="prod"){return`${X(e,t)}/rest/search/v2`}function ne(e,t="prod"){return`${X(e,t,"analytics")}/rest/organizations/${e}/events/v1`}const re=e=>e;function ie(e){const{url:t,accessToken:n,organizationId:r,authentication:i,...a}=e;return a}const ae=e=>{const{response:t}=e;return t.body?se(e):oe(t)},se=e=>void 0!==e.body.exception?ce(e):function(e){return void 0!==e.body.statusCode}(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},oe=e=>{const t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};const ce=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});class ue{currentAbortController=null;async enqueue(e,t){const n=this.currentAbortController;this.currentAbortController=new AbortController;const r=this.currentAbortController;n&&(t.warnOnAbort&&t.logger.warn("Cancelling current pending search query"),n.abort());try{return await e(r?.signal??null)}finally{this.currentAbortController===r&&(this.currentAbortController=null)}}}class le{_basePath;_params={};constructor(e){this._basePath=e}addParam(e,t){this._params={...this.params,[e]:t}}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(([e,t])=>`${e}=${encodeURIComponent(t)}`).join("&")}`:this.basePath}}const de=(e,t,n,r)=>{const i=new le(`${e.url}${r}`);return i.addParam("organizationId",e.organizationId),e.authentication&&i.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:n,url:i.href,origin:"searchApiFetch"}};function pe(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function fe(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function he(e,t){if(t&&"AbortError"===e.name)return{error:fe(e)};if(e instanceof Y)return{error:pe(e)};throw e}class ge{options;constructor(e){this.options=e}async plan(e){const t=await J.call({...de(e,"POST","application/json","/plan"),requestParam
18s:ie(e),requestMetadata:{method:"plan"},...this.options});if(t instanceof Error)return he(t);const n=await t.json();return function(e){return void 0!==e.preprocessingOutput}(n)?{success:n}:{error:ae({response:t,body:n})}}async querySuggest(e){const t=await J.call({...de(e,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:ie(e),...this.options});if(t instanceof Error)return he(t);const n=await t.json(),r={response:t,body:n};if(function(e){return void 0!==e.completions}(n)){return{success:(await this.options.postprocessQuerySuggestResponseMiddleware(r)).body}}return{error:ae(r)}}apiCallsQueues={unknown:new ue,mainSearch:new ue,facetValues:new ue,foldingCollection:new ue,instantResults:new ue};async search(e,t){const n=t?.origin??"unknown",r=await this.apiCallsQueues[n].enqueue(n=>J.call({...de(e,"POST","application/json",""),requestParams:ie(e),requestMetadata:{method:"search",origin:t?.origin},...this.options,signal:n??void 0}),{logger:this.options.logger,warnOnAbort:!t?.disableAbortWarning});if(r instanceof Error)return he(r,t?.disableAbortWarning);const i=await r.json(),a={response:r,body:i};if(ve(i)){a.body=we(i);return{success:(await this.options.postprocessSearchResponseMiddleware(a)).body}}return{error:ae(a)}}async facetSearch(e){const t=await J.call({...de(e,"POST","application/json","/facet"),requestParams:ie(e),requestMetadata:{method:"facetSearch"},...this.options});if(t instanceof Error)throw t;const n=await t.json(),r={response:t,body:n};return(await this.options.postprocessFacetSearchResponseMiddleware(r)).body}async recommendations(e){const t=await J.call({...de(e,"POST","application/json",""),requestParams:ie(e),requestMetadata:{method:"recommendations"},...this.options});if(t instanceof Error)throw t;const n=await t.json();if(ve(n)){const e={response:t,body:n};e.body=we(n);return{success:(await this.options.postprocessSearchResponseMiddleware(e)).body}}return{error:ae({response:t,body:n})}}async html(e){return(async(e,t)=>{const n=await J.call({...de(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:ie(e),requestMetadata:{method:"html"},...t});if(n instanceof Error)throw n;const r=function(e){return((e.headers.get("content-type")||"").split(";").find(e=>-1!==e.indexOf("charset="))||"").split("=")[1]||"UTF-8"}(n),i=await n.arrayBuffer(),a=new TextDecoder(r).decode(i);return function(e){return"string"==typeof e}(a)?{success:a}:{error:ae({response:n,body:a})}})(e,{...this.options})}async fieldDescriptions(e){const t=await J.call({...de(e,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},...this.options});if(t instanceof Error)throw t;const n=await t.json();return function(e){return void 0!==e.fields}(n)?{success:n}:{error:ae({response:t,body:n})}}}const me=e=>void 0!==e.success,ye=e=>void 0!==e.error;function ve(e){return void 0!==e.results}function we(e){const t={answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0};return a(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}const be=e=>e,Se=e=>e,Ee=e=>e;function _e(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 Ae=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Ie=()=>Math.random().toString(36).substring(7).split("").join("."),ke={INIT:`@@redux/INIT${Ie()}`,REPLACE:`@@redux/REPLACE${Ie()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ie()}`};function Te(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function Ce(e,t,n){if("function"!=typeof e)throw new Error(_e(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(_e(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(_e(1));return n(Ce)(e,t)}let r=e,i=t,a=new Map,s=a,o=0,c=!1;function u(){s===a&&(s=new Map,a.forEach((e,t)=>{s.set(t,e)}))}function l(){if(c)throw new Error(_e(3));return i}function d(e){if("function"!=typeof e)throw new Error(_e(4));if(c)throw new Error(_e(5));let t=!0;u();const n=o++;return s.set(n,e),function(){if(t){if(c)throw new Error(_e(6));t=!1,u(),s.delete(n),a=null}}}function p(e){if(!Te(e))throw new Error(_e(7));if(void 0===e.type)throw new Error(_e(8));if("string"!=typeof e.type)throw new Error(_e(17));if(c)throw new Error(_e(9));try{c=!0,i=r(i,e)}finally{c=!1}
18return(a=s).forEach(e=>{e()}),e}p({type:ke.INIT});return{dispatch:p,subscribe:d,getState:l,replaceReducer:function(e){if("function"!=typeof e)throw new Error(_e(10));r=e,p({type:ke.REPLACE})},[Ae]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(_e(11));function n(){const e=t;e.next&&e.next(l())}n();return{unsubscribe:e(n)}},[Ae](){return this}}}}}function xe(e){const t=Object.keys(e),n={};for(let s=0;s<t.length;s++){const r=t[s];"function"==typeof e[r]&&(n[r]=e[r])}const r=Object.keys(n);let i;try{!function(e){Object.keys(e).forEach(t=>{const n=e[t];if(void 0===n(void 0,{type:ke.INIT}))throw new Error(_e(12));if(void 0===n(void 0,{type:ke.PROBE_UNKNOWN_ACTION()}))throw new Error(_e(13))})}(n)}catch(a){i=a}return function(e={},t){if(i)throw i;let a=!1;const s={};for(let i=0;i<r.length;i++){const o=r[i],c=n[o],u=e[o],l=c(u,t);if(void 0===l)throw t&&t.type,new Error(_e(14));s[o]=l,a=a||l!==u}return a=a||r.length!==Object.keys(e).length,a?s:e}}function Oe(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function Re(e){return Te(e)&&"type"in e&&"string"==typeof e.type}var Ne=Symbol.for("immer-nothing"),De=Symbol.for("immer-draftable"),Me=Symbol.for("immer-state");function Pe(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var qe=Object,Fe=qe.getPrototypeOf,Ue="constructor",je="prototype",Le="configurable",$e="enumerable",Ve="writable",Ge="value",Qe=e=>!!e&&!!e[Me];function ze(e){return!!e&&(Ke(e)||et(e)||!!e[De]||!!e[Ue]?.[De]||tt(e)||nt(e))}var He=qe[je][Ue].toString(),Be=new WeakMap;function Ke(e){if(!e||!rt(e))return!1;const t=Fe(e);if(null===t||t===qe[je])return!0;const n=qe.hasOwnProperty.call(t,Ue)&&t[Ue];if(n===Object)return!0;if(!it(n))return!1;let r=Be.get(n);return void 0===r&&(r=Function.toString.call(n),Be.set(n,r)),r===He}function Ye(e,t,n=!0){if(0===Ze(e)){(n?Reflect.ownKeys(e):qe.keys(e)).forEach(n=>{t(n,e[n],e)})}else e.forEach((n,r)=>t(r,n,e))}function Ze(e){const t=e[Me];return t?t.type_:et(e)?1:tt(e)?2:nt(e)?3:0}var We=(e,t,n=Ze(e))=>2===n?e.has(t):qe[je].hasOwnProperty.call(e,t),Je=(e,t,n=Ze(e))=>2===n?e.get(t):e[t],Xe=(e,t,n,r=Ze(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n};var et=Array.isArray,tt=e=>e instanceof Map,nt=e=>e instanceof Set,rt=e=>"object"==typeof e,it=e=>"function"==typeof e,at=e=>"boolean"==typeof e;var st=e=>e.copy_||e.base_,ot=e=>e.modified_?e.copy_:e.base_;function ct(e,t){if(tt(e))return new Map(e);if(nt(e))return new Set(e);if(et(e))return Array[je].slice.call(e);const n=Ke(e);if(!0===t||"class_only"===t&&!n){const t=qe.getOwnPropertyDescriptors(e);delete t[Me];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const i=n[r],a=t[i];!1===a[Ve]&&(a[Ve]=!0,a[Le]=!0),(a.get||a.set)&&(t[i]={[Le]:!0,[Ve]:!0,[$e]:a[$e],[Ge]:e[i]})}return qe.create(Fe(e),t)}{const t=Fe(e);if(null!==t&&n)return{...e};const r=qe.create(t);return qe.assign(r,e)}}function ut(e,t=!1){return dt(e)||Qe(e)||!ze(e)||(Ze(e)>1&&qe.defineProperties(e,{set:lt,add:lt,clear:lt,delete:lt}),qe.freeze(e),t&&Ye(e,(e,t)=>{ut(t,!0)},!1)),e}var lt={[Ge]:function(){Pe(2)}};function dt(e){return null===e||!rt(e)||qe.isFrozen(e)}var pt="MapSet",ft="Patches",ht="ArrayMethods",gt={};function mt(e){const t=gt[e];return t||Pe(0),t}var yt,vt=e=>!!gt[e];var wt=()=>yt;function bt(e,t){t&&(e.patchPlugin_=mt(ft),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function St(e){Et(e),e.drafts_.forEach(At),e.drafts_=null}function Et(e){e===yt&&(yt=e.parent_)}var _t=e=>yt={drafts_:[],parent_:yt,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:vt(pt)?mt(pt):void 0,arrayMethodsPlugin_:vt(ht)?mt(ht):void 0};function At(e){const t=e[Me];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function It(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(void 0!==e&&e!==n){n[Me].modified_&&(St(t),Pe(4)),ze(e)&&(e=kt(t,e));const{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[Me].base_,e,t)}else e=kt(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ut(t,n)}(t,e,!0),St(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ne?e:void 0}function kt(e,t){if(dt(t))return t;const n=t[Me];if(!n){return Nt(t,e.handledSet_,e)}if(!Ct(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:t}=n;if(t)for(;t.length>0;){t.pop()(e)}Rt(n,e)}return n.copy_}function Tt(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ct=(e,t)=>
18e.scope_===t,xt=[];function Ot(e,t,n,r){const i=st(e),a=e.type_;if(void 0!==r){if(Je(i,r,a)===t)return void Xe(i,r,n,a)}if(!e.draftLocations_){const t=e.draftLocations_=new Map;Ye(i,(e,n)=>{if(Qe(n)){const r=t.get(n)||[];r.push(e),t.set(n,r)}})}const s=e.draftLocations_.get(t)??xt;for(const o of s)Xe(i,o,n,a)}function Rt(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:n}=t;if(n){const r=n.getPath(e);r&&n.generatePatches_(e,r,t)}Tt(e)}}function Nt(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Qe(e)||t.has(e)||!ze(e)||dt(e)||(t.add(e),Ye(e,(r,i)=>{if(Qe(i)){const t=i[Me];if(Ct(t,n)){const n=ot(t);Xe(e,r,n,e.type_),Tt(t)}}else ze(i)&&Nt(i,t,n)})),e}var Dt={get(e,t){if(t===Me)return e;let n=e.scope_.arrayMethodsPlugin_;const r=1===e.type_&&"string"==typeof t;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=st(e);if(!We(i,t,e.type_))return function(e,t,n){const r=qt(t,n);return r?Ge in r?r[Ge]:r.get?.call(e.draft_):void 0}(e,i,t);const a=i[t];if(e.finalized_||!ze(a))return a;if(r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&function(e){const t=+e;return Number.isInteger(t)&&String(t)===e}(t))return a;if(a===Pt(e.base_,t)){Ut(e);const n=1===e.type_?+t:t,r=jt(e.scope_,a,e,n);return e.copy_[n]=r}return a},has:(e,t)=>t in st(e),ownKeys:e=>Reflect.ownKeys(st(e)),set(e,t,n){const r=qt(st(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Pt(st(e),t),s=r?.[Me];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(((i=n)===(a=r)?0!==i||1/i==1/a:i!=i&&a!=a)&&(void 0!==n||We(e.base_,t,e.type_)))return!0;Ut(e),Ft(e)}var i,a;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),function(e,t,n){const{scope_:r}=e;if(Qe(n)){const i=n[Me];Ct(i,r)&&i.callbacks_.push(function(){Ut(e);const r=ot(i);Ot(e,n,r,t)})}else ze(n)&&e.callbacks_.push(function(){const i=st(e);3===e.type_?i.has(n)&&Nt(n,r.handledSet_,r):Je(i,t,e.type_)===n&&r.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&Nt(Je(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n)),!0},deleteProperty:(e,t)=>(Ut(e),void 0!==Pt(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),Ft(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=st(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[Ve]:!0,[Le]:1!==e.type_||"length"!==t,[$e]:r[$e],[Ge]:n[t]}:r},defineProperty(){Pe(11)},getPrototypeOf:e=>Fe(e.base_),setPrototypeOf(){Pe(12)}},Mt={};for(let QS in Dt){let e=Dt[QS];Mt[QS]=function(){const t=arguments;return t[0]=t[0][0],e.apply(this,t)}}function Pt(e,t){const n=e[Me];return(n?st(n):e)[t]}function qt(e,t){if(!(t in e))return;let n=Fe(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Fe(n)}}function Ft(e){e.modified_||(e.modified_=!0,e.parent_&&Ft(e.parent_))}function Ut(e){e.copy_||(e.assigned_=new Map,e.copy_=ct(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Mt.deleteProperty=function(e,t){return Mt.set.call(this,e,t,void 0)},Mt.set=function(e,t,n){return Dt.set.call(this,e[0],t,n,e[0])};function jt(e,t,n,r){const[i,a]=tt(t)?mt(pt).proxyMap_(t,n):nt(t)?mt(pt).proxySet_(t,n):function(e,t){const n=et(e),r={type_:n?1:0,scope_:t?t.scope_:wt(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,a=Dt;n&&(i=[r],a=Mt);const{revoke:s,proxy:o}=Proxy.revocable(i,a);return r.draft_=o,r.revoke_=s,[o,r]}(t,n);return(n?.scope_??wt()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&void 0!==r?function(e,t,n){e.callbacks_.push(function(r){const i=t;if(!i||!Ct(i,r))return;r.mapSetPlugin_?.fixSetContents(i);const a=ot(i);Ot(e,i.draft_??i,a,n),Rt(i,r)})}(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);const{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function Lt(e){return Qe(e)||Pe(10),$t(e)}function $t(e){if(!ze(e)||dt(e))return e;const t=e[Me];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ct(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=ct(e,!0);return Ye(n,(e,t)=>{Xe(n,e,$t(t))},r),t&&(t.finalized_=!1),n}function Vt(){const e="replace",t="add",n="remove";function r(e){if(!ze(e))return e;if(et(e))return e.map(r);if(tt(e))return new Map(Array.from(e.entries()).map(([e,t])=>[e,r(t)]));if(nt(e))return new Set(Array.from(e).map(r));const t=Object.create(Fe(e));for(const n in e)t[n]=r(e[n]);return We(e,De)&&(t[De]=e[De]),t}function i(e){return Qe(e)?r(e):e}var a,s;s={applyPatches_:function(i,a){return a.forEach(a=>{const{path:s,op:o}=a;let c=i;for(let e=0;e<s.length-1;e++){const t=Ze(c);let n=s[e];"string"!=typeof n&&"number"!=typeof n&&(n=""+n),0!==t&&1!==t||"__proto__"!==n&&n!==Ue||Pe(19),it(c)&&n===je&&Pe(19),c=Je(c,n),rt(c)||Pe(18,s.join("/"))}const u=Ze(c),l=r(a.value),d=s[s.length-1];switch(o){case e:switch(u){case 2:return c.set(d,l);case 3:Pe(16);default:return c[d]=l}case t:switch(u){case 1:return"-"===d?c.push(l):c.splice(d,0,l);case 2:return c.set(d,l);case 3:return c.add(l);default:return c[d]=l}case n:switch(u){case 1:return c.splice(d,1);
18case 2:return c.delete(d);case 3:return c.delete(a.value);default:return delete c[d]}default:Pe(17)}}),i},generatePatches_:function(r,a,s){if(r.scope_.processedForPatches_.has(r))return;r.scope_.processedForPatches_.add(r);const{patches_:o,inversePatches_:c}=s;switch(r.type_){case 0:case 2:return function(r,a,s,o){const{base_:c,copy_:u,type_:l}=r;Ye(r.assigned_,(r,d)=>{const p=Je(c,r,l),f=Je(u,r,l),h=d?We(c,r)?e:t:n;if(p===f&&h===e)return;const g=a.concat(r);s.push(h===n?{op:h,path:g}:{op:h,path:g,value:i(f)}),o.push(h===t?{op:n,path:g}:h===n?{op:t,path:g,value:i(p)}:{op:e,path:g,value:i(p)})})}(r,a,o,c);case 1:return function(r,a,s,o){let{base_:c,assigned_:u}=r,l=r.copy_;l.length<c.length&&([c,l]=[l,c],[s,o]=[o,s]);const d=!0===r.allIndicesReassigned_;for(let t=0;t<c.length;t++){const n=l[t],r=c[t];if((d||u?.get(t.toString()))&&n!==r){const c=n?.[Me];if(c&&c.modified_)continue;const u=a.concat([t]);s.push({op:e,path:u,value:i(n)}),o.push({op:e,path:u,value:i(r)})}}for(let e=c.length;e<l.length;e++){const n=a.concat([e]);s.push({op:t,path:n,value:i(l[e])})}for(let e=l.length-1;c.length<=e;--e){const t=a.concat([e]);o.push({op:n,path:t})}}(r,a,o,c);case 3:return function(e,r,i,a){let{base_:s,copy_:o}=e,c=0;s.forEach(e=>{if(!o.has(e)){const s=r.concat([c]);i.push({op:n,path:s,value:e}),a.unshift({op:t,path:s,value:e})}c++}),c=0,o.forEach(e=>{if(!s.has(e)){const s=r.concat([c]);i.push({op:t,path:s,value:e}),a.unshift({op:n,path:s,value:e})}c++})}(r,a,o,c)}},generateReplacementPatches_:function(t,n,r){const{patches_:i,inversePatches_:a}=r;i.push({op:e,path:[],value:n===Ne?void 0:n}),a.push({op:e,path:[],value:t})},getPath:function e(t,n=[]){if(void 0!==t.key_){const e=t.parent_.copy_??t.parent_.base_,i=(r=Je(e,t.key_),rt(r)?r?.[Me]:null),a=Je(e,t.key_);if(void 0===a)return null;if(a!==t.draft_&&a!==t.base_&&a!==t.copy_)return null;if(null!=i&&i.base_!==t.base_)return null;const s=3===t.parent_.type_;let o;if(s){const e=t.parent_;o=Array.from(e.drafts_.keys()).indexOf(t.key_)}else o=t.key_;if(!(s&&e.size>o||We(e,o)))return null;n.push(o)}var r;if(t.parent_)return e(t.parent_,n);n.reverse();try{!function(e,t){let n=e;for(let r=0;r<t.length-1;r++){const e=t[r];if(n=Je(n,e),!rt(n)||null===n)throw new Error(`Cannot resolve path at '${t.join("/")}'`)}}(t.copy_,n)}catch(i){return null}return n}},gt[a=ft]||(gt[a]=s)}var Gt=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(it(e)&&!it(t)){const n=t;t=e;const r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}let r;if(it(t)||Pe(6),void 0===n||it(n)||Pe(7),ze(e)){const i=_t(this),a=jt(i,e,void 0);let s=!0;try{r=t(a),s=!1}finally{s?St(i):Et(i)}return bt(i,n),It(r,i)}if(!e||!rt(e)){if(r=t(e),void 0===r&&(r=e),r===Ne&&(r=void 0),this.autoFreeze_&&ut(r,!0),n){const t=[],i=[];mt(ft).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}Pe(1)},this.produceWithPatches=(e,t)=>{if(it(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},at(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),at(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),at(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ze(e)||Pe(8),Qe(e)&&(e=Lt(e));const t=_t(this),n=jt(t,e,void 0);return n[Me].isManual_=!0,Et(t),n}finishDraft(e,t){const n=e&&e[Me];n&&n.isManual_||Pe(9);const{scope_:r}=n;return bt(r,t),It(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=mt(ft).applyPatches_;return Qe(e)?r(e,t):this.produce(e,e=>r(e,t))}},Qt=Gt.produce,zt=Gt.produceWithPatches.bind(Gt),Ht=Gt.applyPatches.bind(Gt);var Bt=e=>Array.isArray(e)?e:[e];function Kt(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(e=>"function"==typeof e)){const n=e.map(e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}var Yt=class{constructor(e){this.value=e}deref(){return this.value}},Zt=(()=>"undefined"==typeof WeakRef?Yt:WeakRef)();function Wt(){return{s:0,v:void 0,o:null,p:null}}function Jt(e,t={}){let n={s:0,v:void 0,o:null,p:null};const{resultEqualityCheck:r}=t;let i,a=0;function s(){let t=n;const{length:s}=arguments;for(let e=0,n=s;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const r=e.get(n);void 0===r?(t=Wt(),e.set(n,t)):t=r}else{let e=t.p;null===e&&(t.p=e=new Map);const r=e.get(n);void 0===r?(t=Wt(),e.set(n,t)):t=r}}const o=t;
18let c;if(1===t.s)c=t.v;else if(c=e.apply(null,arguments),a++,r){const e=(u=i)instanceof Zt?u.deref():u;null!=e&&r(e,c)&&(c=e,0!==a&&a--);i="object"==typeof c&&null!==c||"function"==typeof c?new Zt(c):c}var u;return o.s=1,o.v=c,c}return s.clearCache=()=>{n={s:0,v:void 0,o:null,p:null},s.resetResultsCount()},s.resultsCount=()=>a,s.resetResultsCount=()=>{a=0},s}function Xt(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,i=0,a={},s=e.pop();"object"==typeof s&&(a=s,s=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);const o={...n,...a},{memoize:c,memoizeOptions:u=[],argsMemoize:l=Jt,argsMemoizeOptions:d=[]}=o,p=Bt(u),f=Bt(d),h=Kt(e),g=c(function(){return r++,s.apply(null,arguments)},...p),m=l(function(){i++;const e=function(e,t){const n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}(h,arguments);return t=g.apply(null,e),t},...f);return Object.assign(m,{resultFunc:s,memoizedResultFunc:g,dependencies:h,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:c,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var en=Xt(Jt);function tn(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var nn=tn(),rn=tn,an="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Oe:Oe.apply(null,arguments)};function sn(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error(vr(0));return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>Re(t)&&t.type===e,n}var on=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function cn(e){return ze(e)?Qt(e,()=>{}):e}function un(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var ln="RTK_autoBatch",dn=()=>e=>({payload:e,meta:{[ln]:!0}}),pn=e=>t=>{setTimeout(t,e)},fn=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,a=!1,s=!1;const o=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?"undefined"!=typeof window&&window.requestAnimationFrame?(u=window.requestAnimationFrame,l=100,e=>{let t=!1;const n=()=>{t||(t=!0,cancelAnimationFrame(r),clearTimeout(i),e())},r=u(n),i=setTimeout(n,l)}):pn(10):"callback"===e.type?e.queueNotification:pn(e.timeout);var u,l;const d=()=>{s=!1,a&&(a=!1,o.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){const t=r.subscribe(()=>i&&e());return o.add(e),()=>{t(),o.delete(e)}},dispatch(e){try{return i=!e?.meta?.[ln],a=!i,a&&(s||(s=!0,c(d))),r.dispatch(e)}finally{i=!0}}})};function hn(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{};let a=new on;return t&&("boolean"==typeof t?a.push(nn):a.push(rn(t.extraArgument))),a},{reducer:n,middleware:r,devTools:i=!0,preloadedState:a,enhancers:s}=e||{};let o,c;if("function"==typeof n)o=n;else{if(!Te(n))throw new Error(vr(1));o=xe(n)}c="function"==typeof r?r(t):t();let u=Oe;i&&(u=an({trace:!1,..."object"==typeof i&&i}));const l=function(...e){return t=>(n,r)=>{const i=t(n,r);let a=()=>{throw new Error(_e(15))};const s={getState:i.getState,dispatch:(e,...t)=>a(e,...t)},o=e.map(e=>e(s));return a=Oe(...o)(i.dispatch),{...i,dispatch:a}}}(...c),d=(e=>function(t){const{autoBatch:n=!0}=t??{};let r=new on(e);return n&&r.push(fn("object"==typeof n?n:void 0)),r})(l);return Ce(o,a,u(..."function"==typeof s?s(d):d()))}function gn(e){const t={},n=[];let r;const i={addCase(e,n){const r="string"==typeof e?e:e.type;if(!r)throw new Error(vr(28));if(r in t)throw new Error(vr(29));return t[r]=n,i},addAsyncThunk:(e,r)=>
18(r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i),addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),i),addDefaultCase:e=>(r=e,i)};return e(i),[t,n,r]}function mn(e,t){let n,[r,i,a]=gn(t);if("function"==typeof e)n=()=>cn(e());else{const t=cn(e);n=()=>t}function s(e=n(),t){let s=[r[t.type],...i.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return 0===s.filter(e=>!!e).length&&(s=[a]),s.reduce((e,n)=>{if(n){if(Qe(e)){const r=n(e,t);return void 0===r?e:r}if(ze(e))return Qt(e,e=>n(e,t));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}}return e},e)}return s.getInitialState=n,s}var yn=(e,t)=>{return(n=e)&&"function"==typeof n.match?e.match(t):e(t);var n};function vn(...e){return t=>e.some(e=>yn(e,t))}function wn(...e){return t=>e.every(e=>yn(e,t))}function bn(e,t){if(!e||!e.meta)return!1;const n="string"==typeof e.meta.requestId,r=t.indexOf(e.meta.requestStatus)>-1;return n&&r}function Sn(e){return"function"==typeof e[0]&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function En(...e){return 0===e.length?e=>bn(e,["pending"]):Sn(e)?vn(...e.map(e=>e.pending)):En()(e[0])}function _n(...e){return 0===e.length?e=>bn(e,["rejected"]):Sn(e)?vn(...e.map(e=>e.rejected)):_n()(e[0])}function An(...e){const t=e=>e&&e.meta&&e.meta.rejectedWithValue;return 0===e.length||Sn(e)?wn(_n(...e),t):An()(e[0])}function In(...e){return 0===e.length?e=>bn(e,["fulfilled"]):Sn(e)?vn(...e.map(e=>e.fulfilled)):In()(e[0])}function kn(...e){return 0===e.length?e=>bn(e,["pending","fulfilled","rejected"]):Sn(e)?vn(...e.flatMap(e=>[e.pending,e.rejected,e.fulfilled])):kn()(e[0])}var Tn=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},Cn=["name","message","stack","code"],xn=class{constructor(e,t){this.payload=e,this.meta=t}payload;meta;_type},On=class{constructor(e,t){this.payload=e,this.meta=t}payload;meta;_type},Rn=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Cn)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Nn="External signal was aborted",Dn=(()=>{function e(e,t,n){const r=sn(e+"/fulfilled",(e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:"fulfilled"}})),i=sn(e+"/pending",(e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}})),a=sn(e+"/rejected",(e,t,r,i,a)=>({payload:i,error:(n&&n.serializeError||Rn)(e||"Rejected"),meta:{...a||{},arg:r,requestId:t,rejectedWithValue:!!i,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}}));return Object.assign(function(e,{signal:s}={}){return(o,c,u)=>{const l=n?.idGenerator?n.idGenerator(e):Tn(),d=new AbortController;let p,f;function h(e){f=e,d.abort()}s&&(s.aborted?h(Nn):s.addEventListener("abort",()=>h(Nn),{once:!0}));const g=async function(){let s;try{let a=n?.condition?.(e,{getState:c,extra:u});if(null!==(g=a)&&"object"==typeof g&&"function"==typeof g.then&&(a=await a),!1===a||d.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise((e,t)=>{p=()=>{t({name:"AbortError",message:f||"Aborted"})},d.signal.addEventListener("abort",p,{once:!0})});o(i(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:c,extra:u}))),s=await Promise.race([m,Promise.resolve(t(e,{dispatch:o,getState:c,extra:u,requestId:l,signal:d.signal,abort:h,rejectWithValue:(e,t)=>new xn(e,t),fulfillWithValue:(e,t)=>new On(e,t)})).then(t=>{if(t instanceof xn)throw t;return t instanceof On?r(t.payload,l,e,t.meta):r(t,l,e)})])}catch(m){s=m instanceof xn?a(null,l,e,m.payload,m.meta):a(m,l,e)}finally{p&&d.signal.removeEventListener("abort",p)}var g;return n&&!n.dispatchConditionRejection&&a.match(s)&&s.meta.condition||o(s),s}();return Object.assign(g,{abort:h,requestId:l,arg:e,unwrap:()=>g.then(Mn)})}},{pending:i,rejected:a,fulfilled:r,settled:vn(a,r),typePrefix:e})}return e.withTypes=()=>e,e})();function Mn(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Pn=Symbol.for("rtk-slice-createasyncthunk");function qn(e,t){return`${e}/${t}`}function Fn({creators:e}={}){const t=e?.asyncThunk?.[Pn];return function(e){const{name:n,reducerPath:r=n}=e;if(!n)throw new Error(vr(11));const i=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},a=Object.keys(i),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},o={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(vr(12));if(n in s.sliceCaseReducersByType)throw new Error(vr(13));return s.sliceCaseReducersByType[n]=t,o},addMatcher:(e,t)=>(s.sliceMatchers.push({matcher:e,reducer:t}),o),exposeAction:(e,t)=>(s.actionCreators[e]=t,o),exposeCaseReducer:(e,t)=>(s.sliceCaseReducersByName[e]=t,o)};function c(){const[t={},n=[],r]="function"==typeof e.extraReducers?gn(e.extraReducers):[e.extraReducers],i={...t,...s.sliceCaseReducersByType};return mn(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}
18a.forEach(r=>{const a=i[r],s={reducerName:r,type:qn(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(a)?function({type:e,reducerName:t,createNotation:n},r,i){let a,s;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error(vr(17));a=r.reducer,s=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,s?sn(e,s):sn(e))}(s,a,o):function({type:e,reducerName:t},n,r,i){if(!i)throw new Error(vr(18));const{payloadCreator:a,fulfilled:s,pending:o,rejected:c,settled:u,options:l}=n,d=i(e,a,l);r.exposeAction(t,d),s&&r.addCase(d.fulfilled,s);o&&r.addCase(d.pending,o);c&&r.addCase(d.rejected,c);u&&r.addMatcher(d.settled,u);r.exposeCaseReducer(t,{fulfilled:s||Ln,pending:o||Ln,rejected:c||Ln,settled:u||Ln})}(s,a,o,t)});const u=e=>e,l=new Map,d=new WeakMap;let p;function f(e,t){return p||(p=c()),p(e,t)}function h(){return p||(p=c()),p.getInitialState()}function g(t,n=!1){function r(e){let i=e[t];return void 0===i&&n&&(i=un(d,r,h)),i}function i(t=u){const r=un(l,n,()=>new WeakMap);return un(r,t,()=>{const r={};for(const[i,a]of Object.entries(e.selectors??{}))r[i]=Un(a,t,()=>un(d,t,h),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}const m={name:n,reducer:f,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:h,...g(r),injectInto(e,{reducerPath:t,...n}={}){const i=t??r;return e.inject({reducerPath:i,reducer:f},n),{...m,...g(i,!0)}}};return m}}function Un(e,t,n,r){function i(i,...a){let s=t(i);return void 0===s&&r&&(s=n()),e(s,...a)}return i.unwrapped=e,i}var jn=Fn();function Ln(){}var $n="listener",Vn="completed",Gn="cancelled",Qn=`task-${Gn}`,zn=`task-${Vn}`,Hn=`${$n}-${Gn}`,Bn=`${$n}-${Vn}`,Kn=class{constructor(e){this.code=e,this.message=`task ${Gn} (reason: ${e})`}code;name="TaskAbortError";message},Yn=(e,t)=>{if("function"!=typeof e)throw new TypeError(vr(32))},Zn=()=>{},Wn=(e,t=Zn)=>(e.catch(t),e),Jn=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Xn=e=>{if(e.aborted)throw new Kn(e.reason)};function er(e,t){let n=Zn;return new Promise((r,i)=>{const a=()=>i(new Kn(e.reason));e.aborted?a():(n=Jn(e,a),t.finally(()=>n()).then(r,i))}).finally(()=>{n=Zn})}var tr=e=>t=>Wn(er(e,t).then(t=>(Xn(e),t))),nr=e=>{const t=tr(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:rr}=Object,ir={},ar="listenerMiddleware",sr=(e,t)=>(n,r)=>{Yn(n);const i=new AbortController;var a;a=i,Jn(e,()=>a.abort(e.reason));const s=(async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof Kn?"cancelled":"rejected",error:n}}finally{t?.()}})(async()=>{Xn(e),Xn(i.signal);const t=await n({pause:tr(i.signal),delay:nr(i.signal),signal:i.signal});return Xn(i.signal),t},()=>i.abort(zn));return r?.autoJoin&&t.push(s.catch(Zn)),{result:tr(e)(s),cancel(){i.abort(Qn)}}},or=(e,t)=>(n,r)=>Wn((async(n,r)=>{Xn(t);let i=()=>{};const a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];null!=r&&a.push(new Promise(e=>setTimeout(e,r,null)));try{const e=await er(t,Promise.race(a));return Xn(t),e}finally{i()}})(n,r)),cr=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=sn(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(vr(21));return Yn(a),{predicate:i,type:t,effect:a}},ur=rr(e=>{const{type:t,predicate:n,effect:r}=cr(e);return{id:Tn(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(vr(22))}}},{withTypes:()=>ur}),lr=(e,t)=>{const{type:n,effect:r,predicate:i}=cr(t);return Array.from(e.values()).find(e=>("string"==typeof n?e.type===n:e.predicate===i)&&e.effect===r)},dr=e=>{e.pending.forEach(e=>{e.abort(Hn)})},pr=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},fr=rr(sn(`${ar}/add`),{withTypes:()=>fr}),hr=sn(`${ar}/removeAll`),gr=rr(sn(`${ar}/remove`),{withTypes:()=>gr}),mr=(...e)=>{console.error(`${ar}/error`,...e)},yr=(e={})=>{const t=new Map,n=new Map,{extra:r,onError:i=mr}=e;Yn(i);const a=e=>(e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&dr(e)}))(lr(t,e)??ur(e));rr(a,{withTypes:()=>a});const s=e=>{const n=lr(t,e);return n&&(n.unsubscribe(),e.cancelActive&&dr(n)),!!n};rr(s,{withTypes:()=>s});
18const o=async(e,s,o,c)=>{const u=new AbortController,l=or(a,u.signal),d=[];try{e.pending.add(u),(e=>{const t=n.get(e)??0;n.set(e,t+1)})(e),await Promise.resolve(e.effect(s,rr({},o,{getOriginalState:c,condition:(e,t)=>l(e,t).then(Boolean),take:l,delay:nr(u.signal),pause:tr(u.signal),extra:r,signal:u.signal,fork:sr(u.signal,d),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(Hn),n.delete(e))})},cancel:()=>{u.abort(Hn),e.pending.delete(u)},throwIfCancelled:()=>{Xn(u.signal)}})))}catch(p){p instanceof Kn||pr(i,p,{raisedBy:"effect"})}finally{await Promise.all(d),u.abort(Bn),(e=>{const t=n.get(e)??1;1===t?n.delete(e):n.set(e,t-1)})(e),e.pending.delete(u)}},c=((e,t)=>()=>{for(const e of t.keys())dr(e);e.clear()})(t,n);return{middleware:e=>n=>r=>{if(!Re(r))return n(r);if(fr.match(r))return a(r.payload);if(hr.match(r))return void c();if(gr.match(r))return s(r.payload);let u=e.getState();const l=()=>{if(u===ir)throw new Error(vr(23));return u};let d;try{if(d=n(r),t.size>0){const n=e.getState(),a=Array.from(t.values());for(const t of a){let a=!1;try{a=t.predicate(r,n,u)}catch(p){a=!1,pr(i,p,{raisedBy:"predicate"})}a&&o(t,r,e,l)}}}finally{u=ir}return d},startListening:a,stopListening:s,clearListeners:c}};function vr(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. `}const wr=new d({required:!0,emptyAllowed:!1}),br=new d({required:!1,emptyAllowed:!1}),Sr=new d({required:!0,emptyAllowed:!0});new d({required:!1,emptyAllowed:!0});const Er=new g({each:wr,required:!0}),_r=new d({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Ar=new d({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/});new d({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/});const Ir=({message:e,name:t,stack:n})=>({message:e,name:t,stack:n}),kr=(e,r)=>{if("required"in r)return{payload:new n({value:r}).validate({value:e}).value};const i=new f({options:{required:!0},values:r}).validate(e);if(i)throw new t(i);return{payload:e}},Tr=(e,t)=>{try{return kr(e,t)}catch(n){return{payload:e,error:Ir(n)}}},Cr=(e,t,n,r,i)=>{try{return t.validate(n,r)}catch(a){throw e.logger.error(a,i),a}},xr="3.54.0",Or=()=>br,Rr=()=>wr,Nr=sn("configuration/updateBasicConfiguration",e=>Tr(e,{accessToken:br,environment:new d({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:br})),Dr=sn("configuration/updateSearchConfiguration",e=>Tr(e,{proxyBaseUrl:new d({required:!1,url:!0}),pipeline:new d({required:!1,emptyAllowed:!0}),searchHub:br,timezone:br,locale:br,authenticationProviders:new g({required:!1,each:wr})})),Mr={enabled:new s({default:!0}),originContext:Or(),originLevel2:Or(),originLevel3:Or(),proxyBaseUrl:new d({required:!1,url:!0}),runtimeEnvironment:new r,anonymous:new s({default:!1}),deviceId:br,userDisplayName:br,documentLocation:br,trackingId:Ar,analyticsMode:new d({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new f({options:{required:!1},values:["@coveo/atomic","@coveo/quantic"].reduce((e,t)=>(e[t]=_r,e),{})})},Pr=sn("configuration/updateAnalyticsConfiguration",e=>Tr(e,Mr)),qr=sn("configuration/analytics/disable"),Fr=sn("configuration/analytics/enable"),Ur=sn("configuration/analytics/originlevel2",e=>Tr(e,{originLevel2:Rr()})),jr=sn("configuration/analytics/originlevel3",e=>Tr(e,{originLevel3:Rr()})),Lr=sn("knowledge/setAgentId",e=>Tr(e,new d({required:!0}))),$r={q:new d,enableQuerySyntax:new s,aq:new d,cq:new d,firstResult:new c({min:0}),numberOfResults:new c({min:0}),sortCriteria:new d,f:new f,fExcluded:new f,cf:new f,nf:new f,mnf:new f,df:new f,debug:new s,sf:new f,tab:new d,af:new f},Vr=sn("searchParameters/restore",e=>Tr(e,$r)),Gr=sn("searchParameters/restoreTab",e=>Tr(e,wr)),Qr=sn("debug/enable"),zr=sn("debug/disable"),Hr=mn(!1,e=>{e.addCase(Qr,()=>!0).addCase(zr,()=>!1).addCase(Vr,(e,t)=>t.payload.debug??e)}),Br=sn("pipeline/set",e=>Tr(e,new d({required:!0,emptyAllowed:!0}))),Kr=sn("history/undo"),Yr=sn("history/redo"),Zr=sn("history/snapshot");Dn("history/back",async(e,{dispatch:t})=>{t(Kr()),await t(Wr())}),Dn("history/forward",async(e,{dispatch:t})=>{t(Yr()),await t(Wr())});const Wr=Dn("history/change",async(e,{getState:t})=>t().history.present),Jr=mn("",e=>{e.addCase(Br,(e,t)=>t.payload).addCase(Wr.fulfilled,(e,t)=>t.payload?.pipeline??e).addCase(Dr,(e,t)=>t.payload.pipeline||e)}),Xr=sn("app/setError");let ei=class e{static set(e,t,n){let r,i,a;n&&(i=new Date,i.setTime(i.getTime()+n));const s=window.location.hostname;/^(\d{1,3}\.){3}\d{1,3}$/.test(s)||/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/.test(s)||-1===s.indexOf(".")?ti(e,t,i):(a=s.split("."),r=a[a.length-2]+"."+a[a.length-1],ti(e,t,i,r))}static get(e){const t=e+"=",n=document.cookie.split(";");for(let r=0;r<n.length;r++){let e=n[r];if(e=e.replace(/^\s+/,""),0===e.lastIndexOf(t,0))return e.substring(t.length,e.length)}return null}static erase(t){e.set(t,"",-1)}};function ti(e,t,n,r){document.cookie=`${e}=${t}`+(n?`;expires=${n.toUTCString()}`:"")+(r?`;domain=${r}`:"")+";path=/;SameSite=Lax"+("https:"===window.location.protocol?";Secure":"")}function ni(){return Boolean("undefined"!=typeof navigator&&navigator.cookieEnabled)}function ri(){return function(){try{return"undefined"!=typeof localStorage}catch(e){return!1}}()?localStorage:ni()?new ii:function(){try{return"undefined"!=typeof sessionStorage}catch(e){return!1}}()?sessionStorage:new ai}let ii=class e{static prefix="coveo_";getItem(t){return ei.get(`${e.prefix}${t}`)}removeItem(t){ei.erase(`${e.prefix}${t}`)}setItem(t,n,r){ei.set(`${e.prefix}${t}`,n,r)}},ai=class{getItem(e){return null}removeItem(e){}setItem(e,t){}};const si="__coveo.analytics.history";let oi=class e{static instance=null;static getInstance(t){return e.instance||(e.instance=new e(t)),e.instance}store;constructor(e){this.store=e||ri()}addElement(e){e.internalTime=(new Date).getTime(),e=this.cropQueryElement(this.stripEmptyQuery(e));const t=this.getHistoryWithInternalTime();null!==t?this.isValidEntry(e)&&this.setHistory([e].concat(t)):this.setHistory([e])}async addElementAsync(e){e.internalTime=(new Date).getTime(),e=this.cropQueryElement(this.stripEmptyQuery(e));const t=await this.getHistoryWithInternalTimeAsync();null!==t?this.isValidEntry(e)&&this.setHistory([e].concat(t)):this.setHistory([e])}getHistory(){const e=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(e))}async getHistoryAsync(){const e=await this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(e))}getHistoryWithInternalTime(){try{const e=this.store.getItem(si);return e&&"string"==typeof e?JSON.parse(e):[]}catch(e){return[]}}async getHistoryWithInternalTimeAsync(){try{const e=await this.store.getItem(si);return e?JSON.parse(e):[]}catch(e){return[]}}setHistory(e){try{this.store.setItem(si,JSON.stringify(e.slice(0,20)))}catch(t){}}clear(){try{this.store.removeItem(si)}catch(e){}}getMostRecentElement(){const e=this.getHistoryWithInternalTime();if(Array.isArray(e)){return e.sort((e,t)=>
18(t.internalTime||0)-(e.internalTime||0))[0]}return null}cropQueryElement(e){return e.name&&e.value&&"query"===e.name.toLowerCase()&&(e.value=e.value.slice(0,75)),e}isValidEntry(e){const t=this.getMostRecentElement();return!t||t.value!==e.value||(e.internalTime||0)-(t.internalTime||0)>6e4}stripInternalTime(e){return Array.isArray(e)?e.map(e=>{const{name:t,time:n,value:r}=e;return{name:t,time:n,value:r}}):[]}stripEmptyQuery(e){const{name:t,time:n,value:r}=e;return t&&"string"==typeof r&&"query"===t.toLowerCase()&&""===r.trim()?{name:t,time:n}:e}stripEmptyQueries(e){return e.map(e=>this.stripEmptyQuery(e))}};const ci=en(e=>e.source,e=>Object.entries(e).map(([e,t])=>`${e}@${t}`).concat(`@coveo/headless@${xr}`));function ui(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function li(e,t,n,r){return new(n||(n=Promise))(function(i,a){function s(e){try{c(r.next(e))}catch(t){a(t)}}function o(e){try{c(r.throw(e))}catch(t){a(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,o)}c((r=r.apply(e,t||[])).next())})}var di,pi;function fi(){return"undefined"!=typeof window}function hi(){return"undefined"!=typeof navigator}function gi(){return"undefined"!=typeof document}function mi(){try{return"undefined"!=typeof localStorage}catch(e){return!1}}function yi(){return hi()&&navigator.cookieEnabled}"function"==typeof SuppressedError&&SuppressedError,(pi=di||(di={})).search="search",pi.click="click",pi.custom="custom",pi.view="view",pi.collect="collect";const vi=[di.click,di.custom,di.search,di.view],wi=(e,t)=>-1!==vi.indexOf(e)?Object.assign({language:gi()?document.documentElement.lang:"unknown",userAgent:hi()?navigator.userAgent:"unknown"},t):t;class bi{static set(e,t,n){var r,i,a;n&&(r=new Date).setTime(r.getTime()+n),-1===(a=window.location.hostname).indexOf(".")?Si(e,t,r):Si(e,t,r,(i=a.split("."))[i.length-2]+"."+i[i.length-1])}static get(e){for(var t=e+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){var i=n[r];if(0===(i=i.replace(/^\s+/,"")).lastIndexOf(t,0))return i.substring(t.length,i.length)}return null}static erase(e){bi.set(e,"",-1)}}function Si(e,t,n,r){document.cookie=`${e}=${t}`+(n?`;expires=${n.toUTCString()}`:"")+(r?`;domain=${r}`:"")+";path=/;SameSite=Lax"+("https:"===window.location.protocol?";Secure":"")}function Ei(){return mi()?localStorage:yi()?new _i:function(){try{return"undefined"!=typeof sessionStorage}catch(e){return!1}}()?sessionStorage:new Ii}class _i{getItem(e){return bi.get(`${_i.prefix}${e}`)}removeItem(e){bi.erase(`${_i.prefix}${e}`)}setItem(e,t,n){bi.set(`${_i.prefix}${e}`,t,n)}}_i.prefix="coveo_";class Ai{constructor(){this.cookieStorage=new _i}getItem(e){return localStorage.getItem(e)||this.cookieStorage.getItem(e)}removeItem(e){this.cookieStorage.removeItem(e),localStorage.removeItem(e)}setItem(e,t){localStorage.setItem(e,t),this.cookieStorage.setItem(e,t,31556926e3)}}class Ii{getItem(e){return null}removeItem(e){}setItem(e,t){}}const ki="__coveo.analytics.history";class Ti{constructor(e){this.store=e||Ei()}addElement(e){e.internalTime=(new Date).getTime(),e=this.cropQueryElement(this.stripEmptyQuery(e));let t=this.getHistoryWithInternalTime();null!=t?this.isValidEntry(e)&&this.setHistory([e].concat(t)):this.setHistory([e])}addElementAsync(e){return li(this,void 0,void 0,function*(){e.internalTime=(new Date).getTime(),e=this.cropQueryElement(this.stripEmptyQuery(e));let t=yield this.getHistoryWithInternalTimeAsync();null!=t?this.isValidEntry(e)&&this.setHistory([e].concat(t)):this.setHistory([e])})}getHistory(){const e=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(e))}getHistoryAsync(){return li(this,void 0,void 0,function*(){const e=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(e))})}getHistoryWithInternalTime(){try{const e=this.store.getItem(ki);return e&&"string"==typeof e?JSON.parse(e):[]}catch(e){return[]}}getHistoryWithInternalTimeAsync(){return li(this,void 0,void 0,function*(){try{const e=yield this.store.getItem(ki);return e?JSON.parse(e):[]}catch(e){return[]}})}setHistory(e){try{this.store.setItem(ki,JSON.stringify(e.slice(0,20)))}catch(t){}}clear(){try{this.store.removeItem(ki)}catch(e){}}getMostRecentElement(){let e=this.getHistoryWithInternalTime();if(Array.isArray(e)){return e.sort((e,t)=>
18(t.internalTime||0)-(e.internalTime||0))[0]}return null}cropQueryElement(e){return e.name&&e.value&&"query"===e.name.toLowerCase()&&(e.value=e.value.slice(0,75)),e}isValidEntry(e){let t=this.getMostRecentElement();return!t||t.value!=e.value||(e.internalTime||0)-(t.internalTime||0)>6e4}stripInternalTime(e){return Array.isArray(e)?e.map(e=>{const{name:t,time:n,value:r}=e;return{name:t,time:n,value:r}}):[]}stripEmptyQuery(e){const{name:t,time:n,value:r}=e;return t&&"string"==typeof r&&"query"===t.toLowerCase()&&""===r.trim()?{name:t,time:n}:e}stripEmptyQueries(e){return e.map(e=>this.stripEmptyQuery(e))}}const Ci=(e,t)=>li(void 0,void 0,void 0,function*(){return e===di.view?(yield xi(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),xi=e=>li(void 0,void 0,void 0,function*(){const t=new Ti,n={name:"PageView",value:e,time:(new Date).toISOString()};yield t.addElementAsync(n)});var Oi=/^(?:[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 Ri(e){return"string"==typeof e&&Oi.test(e)}function Ni(e){if(!Ri(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,255&t,(t=parseInt(e.slice(9,13),16))>>>8,255&t,(t=parseInt(e.slice(14,18),16))>>>8,255&t,(t=parseInt(e.slice(19,23),16))>>>8,255&t,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,255&t)}const Di=[];for(let QS=0;QS<256;++QS)Di.push((QS+256).toString(16).slice(1));function Mi(e,t=0){return(Di[e[t+0]]+Di[e[t+1]]+Di[e[t+2]]+Di[e[t+3]]+"-"+Di[e[t+4]]+Di[e[t+5]]+"-"+Di[e[t+6]]+Di[e[t+7]]+"-"+Di[e[t+8]]+Di[e[t+9]]+"-"+Di[e[t+10]]+Di[e[t+11]]+Di[e[t+12]]+Di[e[t+13]]+Di[e[t+14]]+Di[e[t+15]]).toLowerCase()}const Pi=new Uint8Array(16);function qi(e,t,n,r,i,a){const s="string"==typeof n?function(e){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}(n):n,o="string"==typeof r?Ni(r):r;if("string"==typeof r&&(r=Ni(r)),16!==r?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+s.length);return c.set(o),c.set(s,o.length),c=t(c),c[6]=15&c[6]|e,c[8]=63&c[8]|128,Mi(c)}function Fi(e,t,n){return crypto.randomUUID?crypto.randomUUID():function(e){e=e||{};const t=e.random??e.rng?.()??crypto.getRandomValues(Pi);if(t.length<16)throw new Error("Random bytes length must be >= 16");return t[6]=15&t[6]|64,t[8]=63&t[8]|128,Mi(t)}(e)}function Ui(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function ji(e,t){return e<<t|e>>>32-t}function Li(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(e.length+1);r.set(e),r[e.length]=128;const i=(e=r).length/4+2,a=Math.ceil(i/16),s=new Array(a);for(let o=0;o<a;++o){const t=new Uint32Array(16);for(let n=0;n<16;++n)t[n]=e[64*o+4*n]<<24|e[64*o+4*n+1]<<16|e[64*o+4*n+2]<<8|e[64*o+4*n+3];s[o]=t}s[a-1][14]=8*(e.length-1)/2**32,s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=8*(e.length-1)&4294967295;for(let o=0;o<a;++o){const e=new Uint32Array(80);for(let t=0;t<16;++t)e[t]=s[o][t];for(let t=16;t<80;++t)e[t]=ji(e[t-3]^e[t-8]^e[t-14]^e[t-16],1);let r=n[0],i=n[1],a=n[2],c=n[3],u=n[4];for(let n=0;n<80;++n){const s=Math.floor(n/20),o=ji(r,5)+Ui(s,i,a,c)+u+t[s]+e[n]>>>0;u=c,c=a,a=ji(i,30)>>>0,i=r,r=o}n[0]=n[0]+r>>>0,n[1]=n[1]+i>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+u>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>
18>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])}function $i(e,t,n,r){return qi(80,Li,e,t)}$i.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",$i.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";const Vi="2.31.0";class Gi{constructor(e,t){if(!Ri(e))throw Error("Not a valid uuid");this.clientId=e,this.creationDate=Math.floor(t/1e3)}toString(){return this.clientId.replace(/-/g,"")+"."+this.creationDate.toString()}get expired(){const e=Math.floor(Date.now()/1e3)-this.creationDate;return e<0||e>Gi.expirationTime}validate(e,t){return!this.expired&&this.matchReferrer(e,t)}matchReferrer(e,t){try{const n=new URL(e);return t.some(e=>new RegExp(e.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(n.host))}catch(n){return!1}}static fromString(e){const t=e.split(".");if(2!==t.length)return null;const[n,r]=t;if(32!==n.length||isNaN(parseInt(r)))return null;const i=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return Ri(i)?new Gi(i,1e3*Number.parseInt(r)):null}}Gi.cvo_cid="cvo_cid",Gi.expirationTime=120;const Qi=Object.keys;function zi(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function Hi(e){return 240==(248&e)?4:224==(240&e)?3:192==(224&e)?2:1}const Bi={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"},Ki=[...Qi(Bi).map(e=>Bi[e])].join("|"),Yi=new RegExp(`^(${Ki}$)`),Zi=[e=>Yi.test(e)],Wi={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Ji={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},Xi={action:"pa",list:"pal",listSource:"pls"},ea={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},ta={id:"quoteId",affiliation:"quoteAffiliation"},na={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},ra={add:Xi,bookmark_add:Xi,bookmark_remove:Xi,click:Xi,checkout:Xi,checkout_option:Xi,detail:Xi,impression:Xi,remove:Xi,refund:Object.assign(Object.assign({},Xi),ea),purchase:Object.assign(Object.assign({},Xi),ea),quickview:Xi,quote:Object.assign(Object.assign({},Xi),ta),review:Object.assign(Object.assign({},Xi),na)},ia=Qi(Wi).map(e=>Wi[e]),aa=Qi(Ji).map(e=>Ji[e]),sa=Qi(Xi).map(e=>Xi[e]),oa=Qi(ea).map(e=>ea[e]),ca=Qi(na).map(e=>na[e]),ua=Qi(ta).map(e=>ta[e]),la=[...ia,"custom"].join("|"),da=[...aa,"custom"].join("|"),pa="(pr[0-9]+)",fa="(il[0-9]+pi[0-9]+)",ha=new RegExp(`^${pa}(${la})$`),ga=new RegExp(`^(${fa}(${da}))|(il[0-9]+nm)$`),ma=new RegExp(`^(${sa.join("|")})$`),ya=new RegExp(`^(${oa.join("|")})$`),va=new RegExp(`^${pa}custom$`),wa=new RegExp(`^${fa}custom$`),ba=new RegExp(`^(${["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit",...ca,...ua].join("|")})$`),Sa=[e=>ga.test(e),e=>ha.test(e),e=>ma.test(e),e=>ya.test(e),e=>ba.test(e)],Ea=[va,wa],_a=Object.assign(Object.assign(Object.assign(Object.assign({},{anonymizeIp:"aip"}),{eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"}),{hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"}),["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"].reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Aa=Object.assign(Object.assign({},_a),{svcAction:"svc_action",svcActionData:"svc_action_data"}),Ia=Qi(Aa).map(e=>Aa[e]),ka=e=>-1!==Ia.indexOf(e),Ta=e=>"custom"===e,Ca=e=>{let t;return[...Ea].every(n=>{var r;return t=null===(r=n.exec(e))||void 0===r?void 0:r[1],!t}),t},xa=(e,t)=>Qi(t).reduce((n,r)=>Object.assign(Object.assign({},n),{[`${e}${r}`]:t[r]}),{});class Oa{constructor(e){this.opts=e}sendEvent(e,t){return li(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".');const{baseUrl:n,preprocessRequest:r}=this.opts,i=yield this.getQueryParamsForEventType(e),{url:a,payload:s}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${e}?${i}`,t,r),o=this.encodeForEventType(e,s),c=new Blob([o],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(a,c)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(e,t,n){return li(this,void 0,void 0,function*(){let r=e,i=t;if(n){const s=yield n({url:e,body:JSON.stringify(t)},"analyticsBeacon"),{url:o,body:c}=s;r=o||e;try{i=JSON.parse(c)}catch(a){console.error("Unable to process the request body as a JSON string",a)}}return{payload:i,url:r}})}encodeForEventType(e,t){return this.isEventTypeLegacy(e)?this.encodeEventToJson(e,t):this.encodeEventToJson(e,t,this.opts.token)}getQueryParamsForEventType(e){return li(this,void 0,void 0,function*(){const{token:t,visitorIdProvider:n}=this.opts,r=yield n.getCurrentVisitorId();return[t&&this.isEventTypeLegacy(e)?`access_token=${t}`:"",r?`visitorId=${r}`:"","discardVisitInfo=true"].filter(e=>!!e).join("&")})}isEventTypeLegacy(e){return-1!==[di.click,di.custom,di.search,di.view].indexOf(e)}encodeEventToJson(e,t,n){let r=`${e}Event=${encodeURIComponent(JSON.stringify(t))}`;return n&&(r=`access_token=${encodeURIComponent(n)}&${r}`),r}}class Ra{sendEvent(e,t){return li(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return li(this,void 0,void 0,function*(){return Promise.resolve()})}}const Na=globalThis.fetch;class Da{constructor(e){this.opts=e}sendEvent(e,t){return li(this,void 0,void 0,function*(){const{baseUrl:n,visitorIdProvider:r,preprocessRequest:i}=this.opts,a=this.shouldAppendVisitorId(e)?yield this.getVisitorIdParam():"",s={url:`${n}/analytics/${e}${a}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(t)},o=Object.assign(Object.assign({},s),i?yield i(s,"analyticsFetch"):{}),{url:c}=o,u=ui(o,["url"]);let l;try{l=yield Na(c,u)}catch(d){return void console.error("An error has occurred when sending the event.",d)}if(l.ok){const e=yield l.json();return e.visitorId&&r.setCurrentVisitorId(e.visitorId),e}try{l.json()}catch(p){}throw console.error(`An error has occurred when sending the "${e}" event.`,l,t),new Error(`An error has occurred when sending the "${e}" event. Check the console logs for more details.`)})}deleteHttpCookieVisitorId(){return li(this,void 0,void 0,function*(){const{baseUrl:e}=this.opts,t=`${e}/analytics/visit`;yield Na(t,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(e){return-1!==[di.click,di.custom,di.search,di.view].indexOf(e)}getVisitorIdParam(){return li(this,void 0,void 0,function*(){const{visitorIdProvider:e}=this.opts,t=yield e.getCurrentVisitorId();return t?`?visitor=${t}`:""})}getHeaders(){const{token:e}=this.opts;return Object.assign(Object.assign({},e?{Authorization:`Bearer ${e}`}:{}),{"Content-Type":"application/json"})}}class Ma{constructor(e,t){mi()&&yi()?this.storage=new Ai:mi()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Ii),this.client=new Da(e),this.beaconClient=new Oa(e),window.addEventListener("beforeunload",()=>{const e=t();for(let{eventType:t,payload:n}of e)this.beaconClient.sendEvent(t,n)})}
18getClientDependingOnEventType(e){return"click"===e&&this.beaconClient.isAvailable()?this.beaconClient:this.client}}class Pa{constructor(e,t){this.storage=t||new Ii,this.client=new Da(e)}getClientDependingOnEventType(e){return this.client}}class qa{constructor(){this.storage=new Ii,this.client=new Ra}getClientDependingOnEventType(e){return this.client}}const Fa=["1",1,"yes",!0];function Ua(e){return!0!==e&&function(){const e=[];return fi()&&e.push(window.doNotTrack),hi()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(e=>-1!==Fa.indexOf(e))}()}const ja="https://analytics.cloud.coveo.com/rest/ua";class La{get defaultOptions(){return{endpoint:ja,isCustomEndpoint:!1,token:"",version:"v15",beforeSendHooks:[],afterSendHooks:[]}}get version(){return Vi}constructor(e){if(this.acceptedLinkReferrers=[],!e)throw new Error("You have to pass options to this constructor");this.options=Object.assign(Object.assign({},this.defaultOptions),e),this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[Ci,wi].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};const t={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};Ua(this.options.disableBrowserPrivacySignals)?this.runtime=new qa:this.runtime=this.options.runtimeEnvironment||this.initRuntime(t),this.addEventTypeMapping(di.view,{newEventType:di.view,addClientIdParameter:!0}),this.addEventTypeMapping(di.click,{newEventType:di.click,addClientIdParameter:!0}),this.addEventTypeMapping(di.custom,{newEventType:di.custom,addClientIdParameter:!0}),this.addEventTypeMapping(di.search,{newEventType:di.search,addClientIdParameter:!0})}initRuntime(e){return fi()&&gi()?new Ma(e,()=>{const e=[...this.bufferedRequests];return this.bufferedRequests=[],e}):("undefined"!=typeof navigator&&"ReactNative"==navigator.product&&console.warn("\n        We've detected you're using React Native but have not provided the corresponding runtime, \n        for an optimal experience please use the \"coveo.analytics/react-native\" subpackage.\n        Follow the Readme on how to set it up: https://github.com/coveo/coveo.analytics.js#using-react-native\n    "),new Pa(e))}get storage(){return this.runtime.storage}determineVisitorId(){return li(this,void 0,void 0,function*(){try{return fi()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Fi()}catch(e){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",e),Fi()}})}getCurrentVisitorId(){return li(this,void 0,void 0,function*(){if(!this.visitorId){const e=yield this.determineVisitorId();yield this.setCurrentVisitorId(e)}return this.visitorId})}setCurrentVisitorId(e){return li(this,void 0,void 0,function*(){this.visitorId=e,yield this.storage.setItem("visitorId",e)})}setClientId(e,t){return li(this,void 0,void 0,function*(){if(Ri(e))this.setCurrentVisitorId(e.toLowerCase());else{if(!t)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId($i(e,$i(t,"38824e1f-37f5-42d3-8372-a4b8fa9df946")))}})}getParameters(e,...t){return li(this,void 0,void 0,function*(){return yield this.resolveParameters(e,...t)})}getPayload(e,...t){return li(this,void 0,void 0,function*(){const n=yield this.resolveParameters(e,...t);return yield this.resolvePayloadForParameters(e,n)})}get currentVisitorId(){return"string"!=typeof(this.visitorId||this.storage.getItem("visitorId"))&&this.setCurrentVisitorId(Fi()),this.visitorId}set currentVisitorId(e){this.visitorId=e,this.storage.setItem("visitorId",e)}extractClientIdFromLink(e){if(Ua(this.options.disableBrowserPrivacySignals))return null;try{const t=new URL(e).searchParams.get(Gi.cvo_cid);if(null==t)return null;const n=Gi.fromString(t);return n&&gi()&&n.validate(document.referrer,this.acceptedLinkReferrers)?n.clientId:null}catch(t){}return null}resolveParameters(e,...t){return li(this,void 0,void 0,function*(){const{variableLengthArgumentsNames:n=[],addVisitorIdParameter:r=!1,usesMeasurementProtocol:i=!1,addClientIdParameter:a=!1}=this.eventTypeMapping[e]||{};return yield[e=>n.length>0?this.parseVariableArgumentsPayload(n,e):e[0],e=>li(this,void 0,void 0,function*(){return Object.assign(Object.assign({},e),{visitorId:r?yield this.getCurrentVisitorId():""})}),e=>li(this,void 0,void 0,function*(){return a?Object.assign(Object.assign({},e),{clientId:yield this.getCurrentVisitorId()}):e}),e=>i?this.ensureAnonymousUserWhenUsingApiKey(e):e,t=>this.beforeSendHooks.reduce((t,n)=>li(this,void 0,void 0,function*(){const r=yield t;return yield n(e,r)}),t)].reduce((e,t)=>
18li(this,void 0,void 0,function*(){const n=yield e;return yield t(n)}),Promise.resolve(t))})}resolvePayloadForParameters(e,t){return li(this,void 0,void 0,function*(){const{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[e]||{};return yield[e=>this.setTrackingIdIfTrackingIdNotPresent(e),t=>this.removeEmptyPayloadValues(t,e),t=>this.validateParams(t,e),e=>n?(e=>{const t=!!e.action&&ra[e.action]||{};return Qi(e).reduce((n,r)=>{const i=t[r]||Aa[r]||r;return Object.assign(Object.assign({},n),{[i]:e[r]})},{})})(e):e,e=>n?this.removeUnknownParameters(e):e,e=>n?this.processCustomParameters(e):this.mapCustomParametersToCustomData(e)].reduce((e,t)=>li(this,void 0,void 0,function*(){const n=yield e;return yield t(n)}),Promise.resolve(t))})}makeEvent(e,...t){return li(this,void 0,void 0,function*(){const{newEventType:n=e}=this.eventTypeMapping[e]||{},r=yield this.resolveParameters(e,...t),i=yield this.resolvePayloadForParameters(e,r);return{eventType:n,payload:i,log:t=>li(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},i),t)}),yield Promise.all(this.afterSendHooks.map(n=>n(e,Object.assign(Object.assign({},r),t)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(e,...t){return li(this,void 0,void 0,function*(){return(yield this.makeEvent(e,...t)).log({})})}deferExecution(){return new Promise(e=>setTimeout(e,0))}sendFromBuffer(){return li(this,void 0,void 0,function*(){const e=this.bufferedRequests.shift();if(e){const{eventType:t,payload:n}=e;return this.runtime.getClientDependingOnEventType(t).sendEvent(t,n)}})}clear(){this.storage.removeItem("visitorId");(new Ti).clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(e){return li(this,void 0,void 0,function*(){return this.makeEvent(di.search,e)})}sendSearchEvent(e){return li(this,void 0,void 0,function*(){var{searchQueryUid:t}=e,n=ui(e,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:t})})}makeClickEvent(e){return li(this,void 0,void 0,function*(){return this.makeEvent(di.click,e)})}sendClickEvent(e){return li(this,void 0,void 0,function*(){var{searchQueryUid:t}=e,n=ui(e,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:t})})}makeCustomEvent(e){return li(this,void 0,void 0,function*(){return this.makeEvent(di.custom,e)})}sendCustomEvent(e){return li(this,void 0,void 0,function*(){var{lastSearchQueryUid:t}=e,n=ui(e,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:t})})}makeViewEvent(e){return li(this,void 0,void 0,function*(){return this.makeEvent(di.view,e)})}sendViewEvent(e){return li(this,void 0,void 0,function*(){return(yield this.makeViewEvent(e)).log({})})}getVisit(){return li(this,void 0,void 0,function*(){const e=yield fetch(`${this.baseUrl}/analytics/visit`),t=yield e.json();return this.visitorId=t.visitorId,t})}getHealth(){return li(this,void 0,void 0,function*(){const e=yield fetch(`${this.baseUrl}/analytics/monitoring/health`);return yield e.json()})}registerBeforeSendEventHook(e){this.beforeSendHooks.push(e)}registerAfterSendEventHook(e){this.afterSendHooks.push(e)}addEventTypeMapping(e,t){this.eventTypeMapping[e]=t}setAcceptedLinkReferrers(e){if(!Array.isArray(e)||!e.every(e=>"string"==typeof e))throw Error("Parameter should be an array of domain strings");this.acceptedLinkReferrers=e}parseVariableArgumentsPayload(e,t){const n={};for(let r=0,i=t.length;r<i;r++){const i=t[r];if("string"==typeof i)n[e[r]]=i;else if("object"==typeof i)return Object.assign(Object.assign({},n),i)}return n}isKeyAllowedEmpty(e,t){return-1!==({[di.search]:["queryText"]}[e]||[]).indexOf(t)}removeEmptyPayloadValues(e,t){return Object.keys(e).filter(n=>{return this.isKeyAllowedEmpty(t,n)||null!=(r=e[n])&&""!==r;var r}).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:e[n]}),{})}removeUnknownParameters(e){return Object.keys(e).filter(e=>{if((e=>[...Sa,...Zi,ka,Ta].some(t=>t(e)))(e))return!0;console.log(e,"is not processed by coveoua")}).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:e[n]}),{})}processCustomParameters(e){const{custom:t}=e,n=ui(e,["custom"]);let r={};t&&zi(t)&&(r=this.lowercaseKeys(t));const i=Qi(a=n).reduce((e,t)=>
18{const n=Ca(t);return n?Object.assign(Object.assign({},e),xa(n,a[t])):Object.assign(Object.assign({},e),{[t]:a[t]})},{});var a;return Object.assign(Object.assign({},r),i)}mapCustomParametersToCustomData(e){const{custom:t}=e,n=ui(e,["custom"]);if(t&&zi(t)){const r=this.lowercaseKeys(t);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},r),e.customData)})}return e}lowercaseKeys(e){const t=Object.keys(e);let n={};return t.forEach(t=>{n[t.toLowerCase()]=e[t]}),n}validateParams(e,t){const{anonymizeIp:n}=e,r=ui(e,["anonymizeIp"]);return void 0!==n&&-1==["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())&&(r.anonymizeIp=1),t!=di.view&&t!=di.click&&t!=di.search&&t!=di.custom||(r.originLevel3=this.limit(r.originLevel3,1024)),t==di.view&&(r.location=this.limit(r.location,1024)),"pageview"!=t&&"event"!=t||(r.referrer=this.limit(r.referrer,2048),r.location=this.limit(r.location,2048),r.page=this.limit(r.page,2048)),r}ensureAnonymousUserWhenUsingApiKey(e){const{userId:t}=e,n=ui(e,["userId"]);return(null==(r=this.options.token)?void 0:r.startsWith("xx"))&&!t?(n.userId="anonymous",n):e;var r}setTrackingIdIfTrackingIdNotPresent(e){const{trackingId:t}=e,n=ui(e,["trackingId"]);return t?e:(n.hasOwnProperty("custom")&&zi(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&zi(n.customData)&&(n.customData.hasOwnProperty("context_website")||n.customData.hasOwnProperty("siteName"))&&(n.trackingId=n.customData.context_website||n.customData.siteName),n)}limit(e,t){return"string"==typeof e?function(e,t){if(t<0||e.length<=t)return e;let n=e.indexOf("%",t-2);for(n<0||n>t?n=t:t=n;n>2&&"%"==e.charAt(n-3);){const r=Number.parseInt(e.substring(n-2,n),16);if(128&~r)break;if(n-=3,128!=(192&r)){t-n>=3*Hi(r)&&(n=t);break}}return e.substring(0,n)}(e,t):e}get baseUrl(){return function(e=ja,t="v15",n=!1){if(e=e.replace(/\/$/,""),n)return`${e}/${t}`;const r=e.endsWith("/rest")||e.endsWith("/rest/ua");return`${e}${r?"":"/rest"}/${t}`}(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}}var $a,Va,Ga,Qa;(Va=$a||($a={})).contextChanged="contextChanged",Va.expandToFullUI="expandToFullUI",Va.openUserActions="openUserActions",Va.showPrecedingSessions="showPrecedingSessions",Va.showFollowingSessions="showFollowingSessions",Va.clickViewedDocument="clickViewedDocument",Va.clickPageView="clickPageView",Va.createArticle="createArticle",(Qa=Ga||(Ga={})).interfaceLoad="interfaceLoad",Qa.interfaceChange="interfaceChange",Qa.didyoumeanAutomatic="didyoumeanAutomatic",Qa.didyoumeanClick="didyoumeanClick",Qa.resultsSort="resultsSort",Qa.searchboxSubmit="searchboxSubmit",Qa.searchboxClear="searchboxClear",Qa.searchboxAsYouType="searchboxAsYouType",Qa.breadcrumbFacet="breadcrumbFacet",Qa.breadcrumbResetAll="breadcrumbResetAll",Qa.documentQuickview="documentQuickview",Qa.documentOpen="documentOpen",Qa.omniboxAnalytics="omniboxAnalytics",Qa.omniboxFromLink="omniboxFromLink",Qa.searchFromLink="searchFromLink",Qa.triggerNotify="notify",Qa.triggerExecute="execute",Qa.triggerQuery="query",Qa.undoTriggerQuery="undoQuery",Qa.triggerRedirect="redirect",Qa.pagerResize="pagerResize",Qa.pagerNumber="pagerNumber",Qa.pagerNext="pagerNext",Qa.pagerPrevious="pagerPrevious",Qa.pagerScrolling="pagerScrolling",Qa.staticFilterClearAll="staticFilterClearAll",Qa.staticFilterSelect="staticFilterSelect",Qa.staticFilterDeselect="staticFilterDeselect",Qa.facetClearAll="facetClearAll",Qa.facetSearch="facetSearch",Qa.facetSelect="facetSelect",Qa.facetSelectAll="facetSelectAll",Qa.facetDeselect="facetDeselect",Qa.facetExclude="facetExclude",Qa.facetUnexclude="facetUnexclude",Qa.facetUpdateSort="facetUpdateSort",Qa.facetShowMore="showMoreFacetResults",Qa.facetShowLess="showLessFacetResults",Qa.queryError="query",Qa.queryErrorBack="errorBack",Qa.queryErrorClear="errorClearQuery",Qa.queryErrorRetry="errorRetry",Qa.recommendation="recommendation",Qa.recommendationInterfaceLoad="recommendationInterfaceLoad",Qa.recommendationOpen="recommendationOpen",Qa.likeSmartSnippet="likeSmartSnippet",Qa.dislikeSmartSnippet="dislikeSmartSnippet",Qa.expandSmartSnippet="expandSmartSnippet",Qa.collapseSmartSnippet="collapseSmartSnippet",Qa.openSmartSnippetFeedbackModal="openSmartSnippetFeedbackModal",Qa.closeSmartSnippetFeedbackModal="closeSmartSnippetFeedbackModal",Qa.sendSmartSnippetReason="sendSmartSnippetReason",Qa.expandSmartSnippetSuggestion="expandSmartSnippetSuggestion",Qa.collapseSmartSnippetSuggestion="collapseSmartSnippetSuggestion",Qa.showMoreSmartSnippetSuggestion="showMoreSmartSnippetSuggestion",Qa.showLessSmartSnippetSuggestion="showLessSmartSnippetSuggestion",Qa.openSmartSnippetSource="openSmartSnippetSource",Qa.openSmartSnippetSuggestionSource="openSmartSnippetSuggestionSource",Qa.openSmartSnippetInlineLink="openSmartSnippetInlineLink",Qa.openSmartSnippetSuggestionInlineLink="openSmartSnippetSuggestionInlineLink",Qa.recentQueryClick="recentQueriesClick",Qa.clearRecentQueries="clearRecentQueries",Qa.recentResultClick="recentResultClick",Qa.clearRecentResults="clearRecentResults",Qa.noResultsBack="noResultsBack",Qa.showMoreFoldedResults="showMoreFoldedResults",Qa.showLessFoldedResults="showLessFoldedResults",Qa.copyToClipboard="copyToClipboard",Qa.caseSendEmail="Case.SendEmail",Qa.feedItemTextPost="FeedItem.TextPost",Qa.caseAttach="caseAttach",Qa.caseDetach="caseDetach",Qa.retryGeneratedAnswer="retryGeneratedAnswer",Qa.likeGeneratedAnswer="likeGeneratedAnswer",Qa.dislikeGeneratedAnswer="dislikeGeneratedAnswer",Qa.openGeneratedAnswerSource="openGeneratedAnswerSource",Qa.generatedAnswerOpenInlineLink="generatedAnswerOpenInlineLink",Qa.generatedAnswerStreamEnd="generatedAnswerStreamEnd",Qa.generatedAnswerSourceHover="generatedAnswerSourceHover",Qa.generatedAnswerCopyToClipboard="generatedAnswerCopyToClipboard",Qa.generatedAnswerHideAnswers="generatedAnswerHideAnswers",Qa.generatedAnswerShowAnswers="generatedAnswerShowAnswers",Qa.generatedAnswerExpand="generatedAnswerExpand",Qa.generatedAnswerCollapse="generatedAnswerCollapse",Qa.generatedAnswerFeedbackSubmit="generatedAnswerFeedbackSubmit",Qa.rephraseGeneratedAnswer="rephraseGeneratedAnswer",Qa.generatedAnswerFeedbackSubmitV2="generatedAnswerFeedbackSubmitV2",Qa.generatedAnswerCitationClick="generatedAnswerCitationClick",Qa.generatedAnswerFollowupOpenSource="generatedAnswerFollowupOpenSource",Qa.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach";const za={[Ga.triggerNotify]:"queryPipelineTriggers",[Ga.triggerExecute]:"queryPipelineTriggers",[Ga.triggerQuery]:"queryPipelineTriggers",[Ga.triggerRedirect]:"queryPipelineTriggers",[Ga.queryErrorBack]:"errors",[Ga.queryErrorClear]:"errors",[Ga.queryErrorRetry]:"errors",[Ga.pagerNext]:"getMoreResults",[Ga.pagerPrevious]:"getMoreResults",[Ga.pagerNumber]:"getMoreResults",[Ga.pagerResize]:"getMoreResults",[Ga.pagerScrolling]:"getMoreResults",[Ga.facetSearch]:"facet",[Ga.facetShowLess]:"facet",[Ga.facetShowMore]:"facet",[Ga.recommendation]:"recommendation",[Ga.likeSmartSnippet]:"smartSnippet",[Ga.dislikeSmartSnippet]:"smartSnippet",[Ga.expandSmartSnippet]:"smartSnippet",[Ga.collapseSmartSnippet]:"smartSnippet",[Ga.openSmartSnippetFeedbackModal]:"smartSnippet",[Ga.closeSmartSnippetFeedbackModal]:"smartSnippet",[Ga.sendSmartSnippetReason]:"smartSnippet",[Ga.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[Ga.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[Ga.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[Ga.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[Ga.clearRecentQueries]:"recentQueries",[Ga.recentResultClick]:"recentlyClickedDocuments",[Ga.clearRecentResults]:"recentlyClickedDocuments",[Ga.showLessFoldedResults]:"folding",[Ga.caseDetach]:"case",[Ga.likeGeneratedAnswer]:"generatedAnswer",[Ga.dislikeGeneratedAnswer]:"generatedAnswer",[Ga.openGeneratedAnswerSource]:"generatedAnswer",[Ga.generatedAnswerOpenInlineLink]:"generatedAnswer",[Ga.generatedAnswerFollowupOpenSource]:"generatedAnswer",[Ga.generatedAnswerStreamEnd]:"generatedAnswer",[Ga.generatedAnswerSourceHover]:"generatedAnswer",[Ga.generatedAnswerCopyToClipboard]:"generatedAnswer",[Ga.generatedAnswerHideAnswers]:"generatedAnswer",[Ga.generatedAnswerShowAnswers]:"generatedAnswer",[Ga.generatedAnswerExpand]:"generatedAnswer",[Ga.generatedAnswerCollapse]:"generatedAnswer",[Ga.generatedAnswerFeedbackSubmit]:"generatedAnswer",[Ga.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[$a.expandToFullUI]:"interface",[$a.openUserActions]:"User Actions",[$a.showPrecedingSessions]:"User Actions",[$a.show
18FollowingSessions]:"User Actions",[$a.clickViewedDocument]:"User Actions",[$a.clickPageView]:"User Actions",[$a.createArticle]:"createArticle"};class Ha{constructor(){this.runtime=new qa,this.currentVisitorId=""}getPayload(){return Promise.resolve()}getParameters(){return Promise.resolve()}makeEvent(e){return Promise.resolve({eventType:e,payload:null,log:()=>Promise.resolve()})}sendEvent(){return Promise.resolve()}makeSearchEvent(){return this.makeEvent(di.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(di.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(di.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(di.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return Vi}}function Ba(e){const t=e.join(";");return t.length<=256?t:Ba(e.slice(1))}const Ka=e=>{const t=function(e){return e.map(e=>e.replace(/;/g,""))}(e),n=function(e){let t="";return e.filter(e=>{const n=e!==t;return t=e,n})}(t);return Ba(n)};function Ya(e){const t="string"==typeof e.partialQueries?e.partialQueries:Ka(e.partialQueries),n="string"==typeof e.suggestions?e.suggestions:Ka(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:n})}class Za{constructor(e,t){this.opts=e,this.provider=t;const n=!1===e.enableAnalytics||Ua(e.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new Ha:new La(e)}disable(){this.coveoAnalyticsClient=new Ha}enable(){this.coveoAnalyticsClient=new La(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(Ga.interfaceLoad)}logInterfaceLoad(){return li(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(Ga.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return li(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(Ga.recommendation)}logRecommendation(){return li(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(e,t){return this.makeClickEvent(Ga.recommendationOpen,e,t)}logRecommendationOpen(e,t){return li(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(e,t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(e){return this.makeSearchEvent(Ga.staticFilterClearAll,e)}logStaticFilterClearAll(e){return li(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(e)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(e){return this.makeSearchEvent(Ga.staticFilterSelect,e)}logStaticFilterSelect(e){return li(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(e)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(e){return this.makeSearchEvent(Ga.staticFilterDeselect,e)}logStaticFilterDeselect(e){return li(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(e)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(Ga.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return li(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(e){return this.makeSearchEvent(Ga.interfaceChange,e)}logInterfaceChange(e){return li(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(e)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(Ga.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return li(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(Ga.didyoumeanClick)}logDidYouMeanClick(){return li(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(e){return this.makeSearchEvent(Ga.resultsSort,e)}logResultsSort(e){return li(this,void 0,void 0,function*(){return(yield this.makeResultsSort(e)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(Ga.searchboxSubmit)}logSearchboxSubmit(){return li(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(Ga.searchboxClear)}logSearchboxClear(){return li(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(Ga.searchboxAsYouType)}logSearchboxAsYouType(){return li(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(e){return this.makeSearchEvent(Ga.breadcrumbFacet,e)}logBreadcrumbFacet(e){return li(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(e)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(Ga.breadcrumbResetAll)}logBreadcrumbResetAll(){return li(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(e,t){return this.makeClickEvent(Ga.documentQuickview,e,t)}logDocumentQuickview(e,t){return li(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(e,t)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(e,t){return this.makeClickEvent(Ga.documentOpen,e,t)}logDocumentOpen(e,t){return li(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(e,t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(e){return this.makeSearchEvent(Ga.omniboxAnalytics,Ya(e))}logOmniboxAnalytics(e){return li(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(e)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(e){return this.makeSearchEvent(Ga.omniboxFromLink,Ya(e))}logOmniboxFromLink(e){return li(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(e)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(Ga.searchFromLink)}logSearchFromLink(){return li(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(e){return this.makeCustomEvent(Ga.triggerNotify,e)}logTriggerNotify(e){return li(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(e)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(e){return this.makeCustomEvent(Ga.triggerExecute,e)}logTriggerExecute(e){return li(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(e)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(Ga.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return li(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(e){return this.makeSearchEvent(Ga.undoTriggerQuery,e)}logUndoTriggerQuery(e){return li(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(e)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(e){return this.makeCustomEvent(Ga.triggerRedirect,Object.assign(Object.assign({},e),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(e){return li(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(e)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(e){return this.makeCustomEvent(Ga.pagerResize,e)}logPagerResize(e){return li(this,void 0,void 0,function*(){return(yield this.makePagerResize(e)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(e){return this.makeCustomEvent(Ga.pagerNumber,e)}logPagerNumber(e){return li(this,void 0,void 0,function*(){return(yield this.makePagerNumber(e)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(e){return this.makeCustomEvent(Ga.pagerNext,e)}logPagerNext(e){return li(this,void 0,void 0,function*(){return(yield this.makePagerNext(e)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(e){return this.makeCustomEvent(Ga.pagerPrevious,e)}logPagerPrevious(e){return li(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(e)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(Ga.pagerScrolling)}logPagerScrolling(){return li(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(e){return this.makeSearchEvent(Ga.facetClearAll,e)}logFacetClearAll(e){return li(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(e)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(e){return this.makeSearchEvent(Ga.facetSearch,e)}logFacetSearch(e){return li(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(e)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(e){return this.makeSearchEvent(Ga.facetSelect,e)}logFacetSelect(e){return li(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(e)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(e){return this.makeSearchEvent(Ga.facetDeselect,e)}logFacetDeselect(e){return li(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(e)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(e){return this.makeSearchEvent(Ga.facetExclude,e)}logFacetExclude(e){return li(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(e)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(e){return this.makeSearchEvent(Ga.facetUnexclude,e)}logFacetUnexclude(e){return li(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(e)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(e){return this.makeSearchEvent(Ga.facetSelectAll,e)}logFacetSelectAll(e){return li(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(e)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(e){return this.makeSearchEvent(Ga.facetUpdateSort,e)}
vendor: 11,259 bytes, line 18
18logFacetUpdateSort(e){return li(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(e)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(e){return this.makeCustomEvent(Ga.facetShowMore,e)}logFacetShowMore(e){return li(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(e)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(e){return this.makeCustomEvent(Ga.facetShowLess,e)}logFacetShowLess(e){return li(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(e)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(e){return this.makeCustomEvent(Ga.queryError,e)}logQueryError(e){return li(this,void 0,void 0,function*(){return(yield this.makeQueryError(e)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return li(this,void 0,void 0,function*(){const e=yield this.makeCustomEvent(Ga.queryErrorBack);return{description:e.description,log:()=>li(this,void 0,void 0,function*(){return yield e.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(Ga.queryErrorBack)})}})}logQueryErrorBack(){return li(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return li(this,void 0,void 0,function*(){const e=yield this.makeCustomEvent(Ga.queryErrorRetry);return{description:e.description,log:()=>li(this,void 0,void 0,function*(){return yield e.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(Ga.queryErrorRetry)})}})}logQueryErrorRetry(){return li(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return li(this,void 0,void 0,function*(){const e=yield this.makeCustomEvent(Ga.queryErrorClear);return{description:e.description,log:()=>li(this,void 0,void 0,function*(){return yield e.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(Ga.queryErrorClear)})}})}logQueryErrorClear(){return li(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(Ga.likeSmartSnippet)}logLikeSmartSnippet(){return li(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(Ga.dislikeSmartSnippet)}logDislikeSmartSnippet(){return li(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(Ga.expandSmartSnippet)}logExpandSmartSnippet(){return li(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(Ga.collapseSmartSnippet)}logCollapseSmartSnippet(){return li(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(Ga.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return li(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(Ga.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return li(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(e,t){return this.makeCustomEvent(Ga.sendSmartSnippetReason,{reason:e,details:t})}logSmartSnippetFeedbackReason(e,t){return li(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(e,t)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(e){return this.makeCustomEvent(Ga.expandSmartSnippetSuggestion,"documentId"in e?e:{documentId:e})}logExpandSmartSnippetSuggestion(e){return li(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(e)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(e){return this.makeCustomEvent(Ga.collapseSmartSnippetSuggestion,"documentId"in e?e:{documentId:e})}logCollapseSmartSnippetSuggestion(e){return li(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(e)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(e){return this.makeCustomEvent(Ga.showMoreSmartSnippetSuggestion,e)}logShowMoreSmartSnippetSuggestion(e){return li(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(e)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(e){return this.makeCustomEvent(Ga.showLessSmartSnippetSuggestion,e)}logShowLessSmartSnippetSuggestion(e){return li(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(e)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(e,t){return this.makeClickEvent(Ga.openSmartSnippetSource,e,t)}logOpenSmartSnippetSource(e,t){return li(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(e,t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(e,t){return this.makeClickEvent(Ga.openSmartSnippetSuggestionSource,e,{contentIDKey:t.documentId.contentIdKey,contentIDValue:t.documentId.contentIdValue},t)}makeCopyToClipboard(e,t){return this.makeClickEvent(Ga.copyToClipboard,e,t)}logCopyToClipboard(e,t){return li(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(e,t)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(e,t){return li(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(e,t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(e,t){return this.makeClickEvent(Ga.openSmartSnippetInlineLink,e,{contentIDKey:t.contentIDKey,contentIDValue:t.contentIDValue},t)}logOpenSmartSnippetInlineLink(e,t){return li(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(e,t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(e,t){return this.makeClickEvent(Ga.openSmartSnippetSuggestionInlineLink,e,{contentIDKey:t.documentId.contentIdKey,contentIDValue:t.documentId.contentIdValue},t)}logOpenSmartSnippetSuggestionInlineLink(e,t){return li(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(e,t)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(Ga.recentQueryClick)}logRecentQueryClick(){return li(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(Ga.clearRecentQueries)}logClearRecentQueries(){return li(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(e,t){return this.makeCustomEvent(Ga.recentResultClick,{info:e,identifier:t})}logRecentResultClick(e,t){return li(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(e,t)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(Ga.clearRecentResults)}logClearRecentResults(){return li(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(Ga.noResultsBack)}logNoResultsBack(){return li(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(e,t){return this.makeClickEvent(Ga.showMoreFoldedResults,e,t)}logShowMoreFoldedResults(e,t){return li(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(e,t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(Ga.showLessFoldedResults)}logShowLessFoldedResults(){return li(this,void 0,void 0,function*(){return(yield this.makeShowLessFoldedResults()).log({searchUID:this.provider.getSearchUID()})})}makeEventDescription(e,t){var n;return{actionCause:t,customData:null===(n=e.payload)||void 0===n?void 0:n.customData}}makeCustomEvent(e,t){return li(this,arguments,void 0,function*(e,t,n=za[e]){this.coveoAnalyticsClient.getParameters;const r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t),i=Object.assign(Object.assign({},yield this.getBaseEventRequest(r)),{eventType:n,eventValue:e}),a=yield this.coveoAnalyticsClient.makeCustomEvent(i);return{description:this.makeEventDescription(a,e),log:({searchUID:e})=>a.log({lastSearchQueryUid:e})}})}logCustomEvent(e,t){return li(this,arguments,void 0,function*(e,t,n=za[e]){return(yield this.makeCustomEvent(e,t,n)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(e,t,n){return li(this,void 0,void 0,function*(){const r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),i=Object.assign(Object.assign({},yield this.getBaseEventRequest(r)),{eventType:t,eventValue:e}),a=yield this.coveoAnalyticsClient.makeCustomEvent(i);return{description:this.makeEventDescription(a,e),log:({searchUID:e})=>a.log({lastSearchQueryUid:e})}})}logCustomEventWithType(e,t,n){return li(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(e,t,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(e,t){return li(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(e,t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(e,t){return li(this,void 0,void 0,function*(){const n=yield this.getBaseSearchEventRequest(e,t),r=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(r,e),log:({searchUID:e})=>r.log({searchQueryUid:e})}})}makeClickEvent(e,t,n,r){return li(this,void 0,void 0,function*(){const i=Object.assign(Object.assign(Object.assign({},t),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),r))),{queryPipeline:this.provider.getPipeline(),actionCause:e}),a=yield this.coveoAnalyticsClient.makeClickEvent(i);return{description:this.makeEventDescription(a,e),log:({searchUID:e})=>a.log({searchQueryUid:e})}})}logClickEvent(e,t,n,r){return li(this,void 0,void 0,function*(){return(yield this.makeClickEvent(e,t,n,r)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(e,t){return li(this,void 0,void 0,function*(){var n,r;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},t),null===(r=(n=this.provider).getGeneratedAnswerMetadata)||void 0===r?void 0:r.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:e})})}getBaseEventRequest(e){return li(this,void 0,void 0,function*(){const t=Object.assign(Object.assign({},this.provider.getBaseMetadata()),e);return Object.assign(Object.assign(Object.assign({}
18,this.getOrigins()),this.getSplitTestRun()),{customData:t,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var e,t;return{originContext:null===(t=(e=this.provider).getOriginContext)||void 0===t?void 0:t.call(e),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof La?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getSplitTestRun(){const e=this.provider.getSplitTestRunName?this.provider.getSplitTestRunName():"",t=this.provider.getSplitTestRunVersion?this.provider.getSplitTestRunVersion():"";return Object.assign(Object.assign({},e&&{splitTestRunName:e}),t&&{splitTestRunVersion:t})}makeLikeGeneratedAnswer(e){return this.makeCustomEvent(Ga.likeGeneratedAnswer,e)}logLikeGeneratedAnswer(e){return li(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(e)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(e){return this.makeCustomEvent(Ga.dislikeGeneratedAnswer,e)}logDislikeGeneratedAnswer(e){return li(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(e)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(e){return this.makeCustomEvent(Ga.openGeneratedAnswerSource,e)}logOpenGeneratedAnswerSource(e){return li(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(e)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(e){return this.makeCustomEvent(Ga.generatedAnswerOpenInlineLink,e)}logGeneratedAnswerOpenInlineLink(e){return li(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(e)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(e,t){return this.makeClickEvent(Ga.generatedAnswerCitationClick,Object.assign(Object.assign({},e),{documentPosition:1}),{contentIDKey:t.documentId.contentIdKey,contentIDValue:t.documentId.contentIdValue},t)}logGeneratedAnswerCitationClick(e,t){return li(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(e,t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(e){return this.makeCustomEvent(Ga.generatedAnswerFollowupOpenSource,e)}logGeneratedAnswerFollowupOpenSource(e){return li(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(e)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(e){return this.makeCustomEvent(Ga.generatedAnswerSourceHover,e)}logGeneratedAnswerSourceHover(e){return li(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(e)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(e){return this.makeCustomEvent(Ga.generatedAnswerCopyToClipboard,e)}logGeneratedAnswerCopyToClipboard(e){return li(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(e)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(e){return this.makeCustomEvent(Ga.generatedAnswerHideAnswers,e)}logGeneratedAnswerHideAnswers(e){return li(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(e)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(e){return this.makeCustomEvent(Ga.generatedAnswerShowAnswers,e)}logGeneratedAnswerShowAnswers(e){return li(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(e)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(e){return this.makeCustomEvent(Ga.generatedAnswerExpand,e)}logGeneratedAnswerExpand(e){return li(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(e)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(e){return this.makeCustomEvent(Ga.generatedAnswerCollapse,e)}logGeneratedAnswerCollapse(e){return li(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(e)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(e){return this.makeCustomEvent(Ga.generatedAnswerFeedbackSubmit,e)}logGeneratedAnswerFeedbackSubmit(e){return li(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(e)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(e){return this.makeCustomEvent(Ga.generatedAnswerFeedbackSubmitV2,e)}logGeneratedAnswerFeedbackSubmitV2(e){return li(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(e)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(e){return this.makeSearchEvent(Ga.rephraseGeneratedAnswer,e)}
18logRephraseGeneratedAnswer(e){return li(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(e)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(Ga.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return li(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(e){return this.makeCustomEvent(Ga.generatedAnswerStreamEnd,e)}logGeneratedAnswerStreamEnd(e){return li(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(e)).log({searchUID:this.provider.getSearchUID()})})}}const Wa=Object.assign({},{pageview:"pageview",event:"event"});var Ja,Xa,es,ts,ns,rs;Object.keys(Wa).map(e=>Wa[e]),(Xa=Ja||(Ja={})).click="click",Xa.flowStart="flowStart",(ts=es||(es={})).enterInterface="ticket_create_start",ts.fieldUpdate="ticket_field_update",ts.fieldSuggestionClick="ticket_classification_click",ts.documentSuggestionClick="documentSuggestionClick",ts.documentSuggestionQuickview="documentSuggestionQuickview",ts.suggestionRate="suggestion_rate",ts.nextCaseStep="ticket_next_stage",ts.caseCancelled="ticket_cancel",ts.caseSolved="ticket_cancel",ts.caseCreated="ticket_create",(rs=ns||(ns={})).quit="Quit",rs.solved="Solved";const is=(e,t)=>"function"==typeof t?(...n)=>{const r=b(n[0]);try{return t.apply(t,n)}catch(i){return e.error(i,"Error in analytics preprocessRequest. Returning original request."),r}}:void 0,as=(e,t)=>(...n)=>{const r=b(n[1]);try{return t.apply(t,n)}catch(i){return e.error(i,"Error in analytics hook. Returning original request."),r}};function ss(e){const{activeValue:t,ancestryMap:n}=function(e){const t=[...e],n=new Map;for(;t.length>0;){const e=t.shift();if("selected"===e.state)return{activeValue:e,ancestryMap:n};if(n)for(const t of e.children)n.set(t,e);t.unshift(...e.children)}return{}}(e);return t?function(e,t){const n=[];if(!e)return[];let r=e;do{n.unshift(r),r=t.get(r)}while(r);return n}(t,n):[]}const os=(e,t)=>{const n=((e,t)=>e.categoryFacetSet[t]?.request)(e,t);return ss(n?.currentValues??[])};const cs=e=>"specific"===e.type,us=e=>"hierarchical"===e.type,ls=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(e=>e.request),ds=e=>[...Object.values(e.automaticFacetSet.set)].map(e=>e.response),ps=(e,t,n)=>({state:e.state,valuePosition:t,facetType:n}),fs=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),hs=e=>({displayValue:e.value,value:e.value}),gs=(e,t)=>{const n=((e,t)=>os(e,t).map(e=>e.value).join(";"))(e,t);return{value:n,valuePosition:1,displayValue:n}},ms=(e,t)=>({title:vs(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),ys=(e,t)=>({title:vs(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),vs=(e,t)=>`${e}_${t}`,ws=(e,t)=>{const n=((e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response)(e,t);return n?n.type:"specific"},bs=e=>e.configuration.search.locale,Ss=e=>e.configuration?.knowledge?.agentId,Es=e=>_s(e)||As(e)?e.generatedAnswer?.answerId:Is(e)?e.search?.response?.extendedResults?.generativeQuestionAnsweringId:void 0,_s=e=>"answer"in e&&"generatedAnswer"in e&&!a(e.generatedAnswer?.answerConfigurationId),As=e=>{const t=Ss(e);return"generatedAnswer"in e&&"string"==typeof t&&t.trim().length>0},Is=e=>"search"in e&&void 0!==e.search&&"object"==typeof e.search,ks=e=>e.generatedAnswer?.fieldsToIncludeInCitations,Ts=e=>e.followUpAnswers?.conversationId,Cs=en(e=>e.followUpAnswers?.followUpAnswers,e=>e?.flatMap(e=>e.citations)),xs=en(e=>e.generatedAnswer?.citations,Cs,(e,t)=>t,(e,t,n)=>e?.find(e=>e.id===n)??t?.find(e=>e.id===n));var Os,Rs,Ns,Ds;(Rs=Os||(Os={})).Ascending="ascending",Rs.Descending="descending",(Ds=Ns||(Ns={})).Relevancy="relevancy",Ds.QRE="qre",Ds.Date="date",Ds.Field="field",Ds.NoSort="nosort";const Ms=e=>{if(t=e,Array.isArray(t))return e.map(e=>Ms(e)).join(",");var t;switch(e.by){case Ns.Relevancy:case Ns.QRE:case Ns.NoSort:return e.by;case Ns.Date:return`date ${e.order}`;case Ns.Field:return`@${e.field} ${e.order}`;default:return""}};function Ps(){return Ms({by:Ns.Relevancy})}new f({values:{by:new m({enum:Ns,required:!0}),order:new m({enum:Os}),field:new d}});class qs{getState;state;
18constructor(e){this.getState=e,this.state=e()}getLanguage(){return(e=>{const t=e.configuration.search.locale.split("-")[0];return t&&2===t.length?t:"en"})(this.state)}getBaseMetadata(){const{context:e,configuration:t}=this.state,n=e?.contextValues||{},r={};for(const[i,a]of Object.entries(n)){r[`context_${i}`]=a}return"legacy"===t.analytics.analyticsMode&&(r.coveoHeadlessVersion=xr),r}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||"default"}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}}class Fs extends qs{static fallbackPipelineName="default";getFacetState(){return(e=>{const t=[];return ls(e).forEach((n,r)=>{const i=ws(e,n.facetId),a=ys(n,r+1);if(us(n)){if(!os(e,n.facetId).length)return;t.push({...a,...gs(e,n.facetId),facetType:i,state:"selected"})}else n.currentValues.forEach((e,r)=>{if("idle"===e.state)return;const s=ps(e,r+1,i),o=cs(n)?hs(e):fs(e);t.push({...a,...s,...o})})}),ds(e).forEach((e,n)=>{const r=ms(e,n+1);e.values.forEach((e,n)=>{if("idle"===e.state)return;const i=ps(e,n+1,"specific"),a=hs(e);t.push({...r,...i,...a})})}),t})({facetSet:(e=this.getState()).facetSet??{},categoryFacetSet:e.categoryFacetSet??{},dateFacetSet:e.dateFacetSet??{},numericFacetSet:e.numericFacetSet??{},automaticFacetSet:e.automaticFacetSet??{desiredCount:5,numberOfValues:8,set:{}}});var e}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Fs.fallbackPipelineName}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.resultURIs,numberOfResults:this.numberOfResults}}getSearchUID(){const e=this.getState();return e.search?.searchResponseId||e.search?.response.searchUid||""}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){const e=!!this.getSplitTestRunName(),t=this.state.search?.response.pipeline||this.state.pipeline||Fs.fallbackPipelineName;return e?t:void 0}getBaseMetadata(){const e=this.getState(),t=super.getBaseMetadata(),n=Es(e);return n&&(t.generativeQuestionAnsweringId=n),t}getFacetMetadata(e,t){const n=this.getFacetRequest(e),r=n?.field??"";return{...this.getBaseMetadata(),facetId:e,facetField:r,facetValue:t,facetTitle:`${r}_${e}`}}getFacetClearAllMetadata(e){const t=this.getFacetRequest(e),n=t?.field??"";return{...this.getBaseMetadata(),facetId:e,facetField:n,facetTitle:`${n}_${e}`}}getFacetUpdateSortMetadata(e,t){const n=this.getFacetRequest(e),r=n?.field??"";return{...this.getBaseMetadata(),facetId:e,facetField:r,criteria:t,facetTitle:`${r}_${e}`}}getRangeBreadcrumbFacetMetadata(e,t){const n=this.getFacetRequest(e),r=n?.field??"";return{...this.getBaseMetadata(),facetId:e,facetField:r,facetRangeEnd:t.end,facetRangeEndInclusive:t.endInclusive,facetRangeStart:t.start,facetTitle:`${r}_${e}`}}getFacetRequest=e=>this.state.facetSet?.[e]?.request||this.state.categoryFacetSet?.[e]?.request||this.state.dateFacetSet?.[e]?.request||this.state.numericFacetSet?.[e]?.request||this.state.automaticFacetSet?.set[e]?.response;getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??Ps()}}getStaticFilterToggleMetadata(e,t){return{...this.getBaseMetadata(),staticFilterId:e,staticFilterValue:t}}getStaticFilterClearAllMetadata(e){return{...this.getBaseMetadata(),staticFilterId:e}}getUndoTriggerQueryMetadata(e){return{...this.getBaseMetadata(),undoneQuery:e}}getCategoryBreadcrumbFacetMetadata(e,t){const n=this.getFacetRequest(e),r=n?.field??"";return{...this.getBaseMetadata(),categoryFacetId:e,categoryFacetField:r,categoryFacetPath:t,categoryFacetTitle:`${r}_${e}`}}getOmniboxAnalyticsMetadata(e,t){const n=this.state.querySuggest?.[e],r=n.completions.map(e=>e.expression),i=n.partialQueries.length-1,a=n.partialQueries[i]||"",s=n.responseId;return{...this.getBaseMetadata(),suggestionRanking:r.indexOf(t),partialQuery:a,partialQueries:n.partialQueries.length>0?n.partialQueries:"",suggestions:r.length>0?r:"",querySuggestResponseId:s}}getInterfaceChangeMetadata(){return{...this.getBaseMetadata(),interfaceChangeTo:this.state.configuration.analytics.originLevel2}}getOmniboxFromLinkMetadata(e){return{...this.getBaseMetadata(),...e}}getGeneratedAnswerMetadata(){const e=this.getState(),t={};return void 0!==e.generatedAnswer?.isVisible&&(t.showGeneratedAnswer=e.generatedAnswer.isVisible),t}get resultURIs(){return this.results?.map(e=>({documentUri:e.uri,documentUriHash:e.raw.urihash}))}get results(){return this.state.search?.response.results}get queryText(){return this.state.query?.q||""}get responseTime(){return this.state.search?.duration||0}get numberOfResults(){return this.state.search?.response.totalCountFiltered||0}}const Us=()=>{const e=oi.getInstance().getHistory().reverse().find(e=>"PageView"===e.name&&e.value);return e?e.value:""},js=async(e,t)=>{const n="next"===e.analyticsMode;return{analytics:{clientId:await(r=e,new La(r).getCurrentVisitorId()),clientTimestamp:(new Date).toISOString(),documentReferrer:e.originLevel3,originContext:e.originContext,...t&&{actionCause:t.actionCause,customData:t.customData},...t&&!n&&{customData:t.customData},...e.userDisplayName&&{userDisplayName:e.userDisplayName},...e.documentLocation&&{documentLocation:e.documentLocation},...e.deviceId&&{deviceId:e.deviceId},...Us()&&{pageId:Us()},...n&&e.trackingId&&{trackingId:e.trackingId},capture:n,...n&&{source:ci(e)}}};var r};class Ls extends qs{getPipeline(){return this.state.pipeline||this.state.recommendation?.pipeline||"default"}getSearchEventRequestPayload(){return{queryText:"",responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getSearchUID(){const e=this.getState();return e.recommendation?.searchUid||""}getSplitTestRunName(){return this.state.recommendation?.splitTestRun}getSplitTestRunVersion(){const e=!!this.getSplitTestRunName(),t=this.state.recommendation?.pipeline||this.state.pipeline||"default";return e?t:void 0}get responseTime(){return this.state.recommendation?.duration||0}mapResultsToAnalyticsDocument(){return this.state.recommendation?.recommendations.map(e=>({documentUri:e.uri,documentUriHash:e.raw.urihash}))}get numberOfResults(){return this.state.recommendation?.recommendations.length||0}}const $s=/^(?:[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;const Vs=[];for(let QS=0;QS<256;++QS)Vs.push((QS+256).toString(16).slice(1));const Gs=new Uint8Array(16);function Qs(e,t,n){return crypto.randomUUID?crypto.randomUUID():function(e){e=e||{};const t=e.random??e.rng?.()??crypto.getRandomValues(Gs);if(t.length<16)throw new Error("Random bytes length must be >= 16");return t[6]=15&t[6]|64,t[8]=63&t[8]|128,function(e,t=0){return(Vs[e[t+0]]+Vs[e[t+1]]+Vs[e[t+2]]+Vs[e[t+3]]+"-"+Vs[e[t+4]]+Vs[e[t+5]]+"-"+Vs[e[t+6]]+Vs[e[t+7]]+"-"+Vs[e[t+8]]+Vs[e[t+9]]+"-"+Vs[e[t+10]]+Vs[e[t+11]]+Vs[e[t+12]]+Vs[e[t+13]]+Vs[e[t+14]]+Vs[e[t+15]]).toLowerCase()}(t)}(e)}const zs="2.1.3";function Hs(e){return 240==(248&e)?4:224==(240&e)?3:192==(224&e)?2:1}function Bs(e){return(e.source||[]).concat([`relay@${zs}`])}function Ks(e,t,n){const{getReferrer:r,getLocation:i,getUserAgent:a}=n,s=function(e){const{trackingId:t}=e;return{trackingId:t}}(t),o=n.getClientId();return Object.freeze({type:e,config:s,ts:Date.now(),source:Bs(t),clientId:o,userAgent:a(),referrer:Ys(r()),location:Ys(i())})}function Ys(e){return null!==e?function(e,t){if(t<0||e.length<=t)return e;let n=e.indexOf("%",t-2);for(n<0||n>t?n=t:t=n;n>2&&"%"==e.charAt(n-3);){const r=Number.parseInt(e.substring(n-2,n),16);if(128&~r)break;if(n-=3,128!=(192&r)){t-n>=3*Hs(r)&&(n=t);break}}return e.substring(0,n)}(e,1024):null}function Zs(){const e=[];function t({type:t,callback:n}){return e.findIndex(e=>e.type===t&&e.callback===n)}function n(n,r){r?function(n){const r=t(n);r>=0&&e.splice(r,1)}({type:n,callback:r}):function(t){if("*"===t)e.length=0;else for(let n=e.length-1;n>=0;n--)e[n].type===t&&e.splice(n,1)}(n)}return{add:function(r){return t(r)<0&&e.push(r),()=>n(r.type,r.callback)}
18,call:function(t){e.forEach(e=>{if(function(e,t){return"*"===e.type||t===e.type}(e,t.meta.type))try{e.callback(t)}catch(n){console.error(n)}})},remove:n}}function Ws({url:e,token:t,trackingId:n,...r}){return Object.freeze({url:e,token:t,trackingId:n,...!!r.mode&&{mode:r.mode},...!!r.source&&{source:r.source},...!!r.environment&&{environment:r.environment}})}const Js=function(){const e="coveo_";return{getItem(t){const n=`${e}${t}=`,r=document.cookie.split(";");for(const e of r){const t=e.replace(/^\s+/,"");if(0===t.lastIndexOf(n,0))return t.substring(n.length,t.length)}return null},setItem(t,n,r){const i=(e=>{const t=e.split(".").slice(-2);return 2==t.length?t.join("."):""})(window.location.hostname),a=`;expires=${new Date((new Date).getTime()+r).toUTCString()}`,s=i?`;domain=${i}`:"";document.cookie=`${e}${t}=${n}${a}${s};path=/;SameSite=Lax`},removeItem(e){this.setItem(e,"",-1)}}}();const Xs="visitorId";function eo(){const e={getItem:e=>Js.getItem(e)||localStorage.getItem(e),removeItem(e){Js.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Js.setItem(e,t,31556952e3)}};return{runtime:"browser",send:async(e,t,n)=>{const r=fetch(e,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});(function(){const e="undefined"!=typeof window;return{sendMessage(t){e&&window.postMessage(t,"*")}}})().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:e,token:t});const i=await r;if(!i?.ok)throw new Error(`Error ${i.status}: Failed to send the event(s).`);{let e;try{e=await i.json()}catch{return}for(const t of e.events)if(!t.accepted)throw new Error(`Received event was rejected for processing: ${t.errorMessage}`)}},getReferrer:()=>function(){const e=document.referrer;return""===e?null:e}(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{const t=e.getItem(Xs);if(t&&("string"==typeof(n=t)&&$s.test(n)))return t;var n;const r=Qs();return e.setItem(Xs,r),r}}}function to(e){const t="disabled"!==e.get().mode,n=e.get().environment,r={runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""};return t&&n?{...n,runtime:"custom"}:t&&function(){try{return"object"==typeof window}catch{return!1}}()&&function(){try{const e="__storage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return e instanceof DOMException&&"QuotaExceededError"===e.name&&localStorage&&0!==localStorage.length}}()?eo():r}function no(e){const t=function(e){let t=Ws(e);return{get:()=>t,update:e=>{t=Ws({...t,...e})}}}(e),n=Zs(),r=function(e){return{get:()=>Object.freeze(to(e))}}(t);return{emit:async(e,i)=>{const a=t.get(),s=r.get(),o=function(e,t,n,r){return{...t,meta:Ks(e,n,r)}}(e,i,a,s);return async function({config:e,environment:t,event:n,listenerManager:r}){const{url:i,token:a,mode:s}=e;if("disabled"!==s)return r.call(n),t.send(i,a,n)}({config:a,environment:s,event:o,listenerManager:n})},getMeta:e=>Ks(e,t.get(),r.get()),on:(e,t)=>n.add({type:e,callback:t}),off:(e,t)=>n.remove(e,t),updateConfig:e=>t.update(e),version:zs}}const ro=en(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>ci(e.configuration.analytics),(e,t)=>t,(e,t,n,{trackingId:r,apiBaseUrl:i,enabled:a},s,o)=>{const c=ao(o);return no({mode:a?"emit":"disabled",url:i??ne(e,t),token:n,trackingId:r??null,source:s,environment:c})}),io={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:async()=>{}},ao=e=>{if(!e)return;const t=e();return{..."undefined"!=typeof window&&"undefined"!=typeof document?eo():io,getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};function so(e,t){const n=t=>{const n=Dn(e,t);return r=Object.assign(n,{type:n.typePrefix}),Object.assign(r,{instantlyCallable:!0});var r},r=n(async(e,{getState:n,extra:r})=>{const{analyticsClientMiddleware:i,preprocessRequest:a,logger:s,disableBrowserPrivacySignals:o}=r;return await(await t({getState:n,analyticsClientMiddleware:i,preprocessRequest:a,logger:s,disableBrowserPrivacySignals:o})).log({state:n(),extra:r})});return Object.assign(r,{prepare:async({getState:e,analyticsClientMiddleware:r,preprocessRequest:i,logger:a,disableBrowserPrivacySignals:s})=>{const{description:o,log:c}=await t({getState:e,analyticsClientMiddleware:r,preprocessRequest:i,logger:a,disableBrowserPrivacySignals:s});return{description:o,action:n(async(e,{getState:t,extra:n})=>await c({state:t(),extra:n}))}}}),r}const oo=({prefix:e,__legacy__getBuilder:t,__legacy__provider:n,analyticsPayloadBuilder:r,analyticsType:i,analyticsConfigurator:a,providerClass:s})=>(n??=e=>new s(e),so(e,async({getState:e,analyticsClientMiddleware:s,preprocessRequest:o,logger:c,disableBrowserPrivacySignals:u})=>{const l=[],d={log:async({state:e})=>{for(const t of l)await t(e)}},p=e(),f=a({getState:e,logger:c,analyticsClientMiddleware:s,preprocessRequest:o,disableBrowserPrivacySignals:u,provider:n(e)}),h=await t(f,e());d.description=h?.description,l.push(async e=>{(e=>"legacy"===e.configuration.analytics.analyticsMode)(e)&&await async function(e,t,n,r,i){t(()=>n);const a=await(e?.log({searchUID:t(()=>n).getSearchUID()}));r.info({client:i,response:a},"Analytics response")}(h,n,e,c,f.coveoAnalyticsClient)});const{emit:g}=ro(p);return l.push(async e=>{if((e=>"next"===e.configuration.analytics.analyticsMode)(e)&&i&&r){const t=r(e);await async function(e,t,n){return void(await e(t,n))}(g,i,t)}}),d}));const co=(uo=e=>(({logger:e,getState:t,analyticsClientMiddleware:n=(e,t)=>t,preprocessRequest:r,provider:i,disableBrowserPrivacySignals:a})=>{const s=t(),o=s.configuration.accessToken,c=s.configuration.analytics.apiBaseUrl??X(s.configuration.organizationId,s.configuration.environment,"analytics"),u=s.configuration.analytics.runtimeEnvironment,l=s.configuration.analytics.enabled,d=new Za({token:o,endpoint:c,runtimeEnvironment:u,disableBrowserPrivacySignals:a,preprocessRequest:is(e,r),beforeSendHooks:[as(e,n),(t,n)=>(e.info({...n,type:t,endpoint:c,token:o},"Analytics request"),n)]},i);return l||d.disable(),d})({...e,provider:e.provider||new Fs(e.getState)}),lo=e=>e,po=Fs,function(...e){const t=1===e.length?{...e[0],__legacy__getBuilder:lo(e[0].__legacy__getBuilder),analyticsConfigurator:uo,providerClass:
18po}:{prefix:e[0],__legacy__getBuilder:lo(e[1]),__legacy__provider:e[2],analyticsConfigurator:uo,providerClass:po};return oo(t)});var uo,lo,po;const fo=(e,t)=>{const n=t.recommendation?.recommendations.findIndex(({uniqueId:t})=>e.uniqueId===t)||0;return function(e,t,n){const r=e.raw.collection;return{collectionName:"string"==typeof r?r:"default",documentAuthor:So(e),...yo(e)?{documentCategory:yo(e)}:{},documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:Eo(e),queryPipeline:n.pipeline||""}}(e,n,t)},ho=(e,t)=>({sourceName:go(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||""});function go(e){const t=e.source;return a(t)?"unknown":t}const mo=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function yo(e){return e.raw?.objecttype||void 0}const vo=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||""}),wo={urihash:new d,sourcetype:new d,permanentid:new d},bo={uniqueId:wr,raw:new f({values:wo}),title:wr,uri:wr,clickUri:wr,rankingModifier:new d({required:!1,emptyAllowed:!0})};function So(e){const t=e.raw.author;return a(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function Eo(e){const t=e.raw.source;return a(t)?"unknown":t}const _o=e=>new n(bo).validate(function(e){return Object.assign({},...Object.keys(bo).map(t=>({[t]:e[t]})),{raw:(t=e.raw,Object.assign({},...Object.keys(wo).map(e=>({[e]:t[e]}))))});var t}(e));var Ao;!function(e){e.interfaceLoad="interfaceLoad",e.interfaceChange="interfaceChange",e.didYouMeanAutomatic="didYouMeanAutomatic",e.didYouMeanClick="didYouMeanClick",e.resultsSort="resultsSort",e.searchboxSubmit="searchboxSubmit",e.searchboxAsYouType="searchboxAsYouType",e.breadcrumbFacet="breadcrumbFacet",e.breadcrumbResetAll="breadcrumbResetAll",e.documentOpen="documentOpen",e.omniboxAnalytics="omniboxAnalytics",e.omniboxFromLink="omniboxFromLink",e.searchFromLink="searchFromLink",e.triggerQuery="query",e.browseResults="browseResults",e.staticFilterDeselect="staticFilterDeselect",e.facetClearAll="facetClearAll",e.facetSelect="facetSelect",e.facetDeselect="facetDeselect",e.facetExclude="facetExclude",e.facetUnexclude="facetUnexclude",e.facetUpdateSort="facetUpdateSort",e.documentSuggestion="documentSuggestion",e.facetShowMore="showMoreFacetResults",e.facetShowLess="showLessFacetResults",e.queryError="query",e.recommendationInterfaceLoad="recommendationInterfaceLoad",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.openSmartSnippetSource="openSmartSnippetSource",e.openSmartSnippetSuggestionSource="openSmartSnippetSuggestionSource",e.showMoreFoldedResults="showMoreFoldedResults",e.showLessFoldedResults="showLessFoldedResults",e.copyToClipboard="copyToClipboard",e.caseSendEmail="Case.SendEmail",e.feedItemTextPost="FeedItem.TextPost",e.caseAttach="caseAttach",e.caseDetach="caseDetach",e.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach",e.retryGeneratedAnswer="retryGeneratedAnswer",e.likeGeneratedAnswer="likeGeneratedAnswer",e.dislikeGeneratedAnswer="dislikeGeneratedAnswer",e.openGeneratedAnswerSource="openGeneratedAnswerSource",e.generatedAnswerStreamEnd="generatedAnswerStreamEnd",e.contextChanged="contextChanged",e.generatedAnswerSourceHover="generatedAnswerSourceHover",e.generatedAnswerFeedbackSubmit="generatedAnswerFeedbackSubmit",e.generatedAnswerHideAnswers="generatedAnswerHideAnswers",e.generatedAnswerShowAnswers="generatedAnswerShowAnswers",e.generatedAnswerExpand="generatedAnswerExpand",e.generatedAnswerCollapse="generatedAnswerCollapse",e.generatedAnswerCopyToClipboard="generatedAnswerCopyToClipboard",e.expandToFullUI="expandToFullUI",e.createArticle="createArticle",e.recentQueriesClick="recentQueriesClick",e.clearRecentQueries="clearRecentQueries"}(Ao||(Ao={}));const Io=e=>co({prefix:"analytics/recommendation/open",__legacy__getBuilder:(t,n)=>(_o(e),t.makeRecommendationOpen(fo(e,n),vo(e))),__legacy__provider:e=>new Ls(e),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{const n=fo(e,t),r=vo(e);return{responseId:e.searchUid??"",position:n.documentPosition,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:n.documentTitle,author:n.documentAuthor,url:n.documentUrl}}}}),ko=sn("recommendation/set",e=>Tr(e,{id:wr})),To=Dn("recommendation/get",async(e,{getState:t,rejectWithValue:n,extra:{apiClient:r}})=>{const i=t(),a=Date.now(),s=await Co(i),o=await r.recommendations(s),c=Date.now()-a;return ye(o)?n(o.error):{recommendations:o.success.results,analyticsAction:co("analytics/recommendation/update",e=>e.makeRecommendationInterfaceLoad(),e=>new Ls(e)),duration:c,searchUid:o.success.searchUid,splitTestRun:o.success.splitTestRun,pipeline:o.success.pipeline}}),Co=async e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??te(e.configuration.organizationId,e.configuration.environment),recommendation:e.recommendation.id,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,locale:e.configuration.search.locale,actionsHistory:e.configuration.analytics.enabled?oi.getInstance().getHistory():[],...e.advancedSearchQueries&&{aq:e.advancedSearchQueries.aq,cq:e.advancedSearchQueries.cq},...e.pipeline&&{pipeline:e.pipeline},...e.searchHub&&{searchHub:e.searchHub},...e.context&&{context:e.context.contextValues},...e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues},...e.fields&&{fieldsToInclude:e.fields.fieldsToInclude},...e.configuration.analytics.enabled&&await xo(e,{actionCause:Ao.recommendationInterfaceLoad}),...e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")},...e.pagination&&{numberOfResults:e.pagination.numberOfResults}}),xo=async(e,t)=>{const n="legacy"===e.configuration.analytics.analyticsMode?void 0:{actionCause:t.actionCause,type:t.actionCause};return await js(e.configuration.analytics,n)},Oo=mn({duration:0,error:null,isLoading:!1,id:"Recommendation",recommendations:[],searchUid:"",splitTestRun:"",pipeline:""},e=>{e.addCase(ko,(e,t)=>
18{e.id=t.payload.id}).addCase(To.rejected,(e,t)=>{e.error=t.payload?t.payload:null,e.isLoading=!1}).addCase(To.fulfilled,(e,t)=>{e.error=null,e.recommendations=t.payload.recommendations.map(e=>({...e,searchUid:t.payload.searchUid})),e.duration=t.payload.duration,e.isLoading=!1,e.searchUid=t.payload.searchUid,e.splitTestRun=t.payload.splitTestRun,e.pipeline=t.payload.pipeline}).addCase(To.pending,e=>{e.isLoading=!0}).addCase(Xr,(e,t)=>{e.error=t.payload,e.isLoading=!1})}),Ro=sn("searchHub/set",e=>Tr(e,new d({required:!0,emptyAllowed:!0}))),No=mn("default",e=>{e.addCase(Ro,(e,t)=>t.payload).addCase(Wr.fulfilled,(e,t)=>t.payload?.searchHub??e).addCase(Dr,(e,t)=>t.payload.searchHub||e)});var Do=class extends Error{issues;constructor(e){super(e[0].message),this.name="SchemaError",this.issues=e}},Mo="uninitialized",Po="pending",qo="fulfilled",Fo="rejected";function Uo(e){return{status:e,isUninitialized:e===Mo,isLoading:e===Po,isSuccess:e===qo,isError:e===Fo}}var jo=Te;function Lo(e,t){if(e===t||!(jo(e)&&jo(t)||Array.isArray(e)&&Array.isArray(t)))return t;const n=Object.keys(t),r=Object.keys(e);let i=n.length===r.length;const a=Array.isArray(t)?[]:{};for(const s of n)a[s]=Lo(e[s],t[s]),i&&(i=e[s]===a[s]);return i?e:a}function $o(e,t,n){return e.reduce((e,r,i)=>(t(r,i)&&e.push(n(r,i)),e),[]).flat()}function Vo(e){return null!=e}function Go(e){return[...e?.values()??[]].filter(Vo)}function Qo(e,t){if(!e)return t;if(!t)return e;if(function(e){return new RegExp("(^|:)//").test(e)}(t))return t;const n=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=(e=>e.replace(/\/$/,""))(e),`${e}${n}${t=(e=>e.replace(/^\//,""))(t)}`}function zo(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var Ho=()=>new Map,Bo=e=>{const t=new AbortController;return setTimeout(()=>{const e="signal timed out",n="TimeoutError";t.abort("undefined"!=typeof DOMException?new DOMException(e,n):Object.assign(new Error(e),{name:n}))},e),t.signal},Ko=(...e)=>{for(const n of e)if(n.aborted)return AbortSignal.abort(n.reason);const t=new AbortController;for(const n of e)n.addEventListener("abort",()=>t.abort(n.reason),{signal:t.signal,once:!0});return t.signal},Yo=(...e)=>fetch(...e),Zo=e=>e.status>=200&&e.status<=299,Wo=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Jo(e){if(!Te(e))return e;const t={...e};for(const[n,r]of Object.entries(t))void 0===r&&delete t[n];return t}function Xo({baseUrl:e,prepareHeaders:t=e=>e,fetchFn:n=Yo,paramsSerializer:r,isJsonContentType:i=Wo,jsonContentType:a="application/json",jsonReplacer:s,timeout:o,responseHandler:c,validateStatus:u,...l}={}){return"undefined"==typeof fetch&&n===Yo&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),async(p,f,h)=>{const{getState:g,extra:m,endpoint:y,forced:v,type:w}=f;let b,{url:S,headers:E=new Headers(l.headers),params:_,responseHandler:A=c??"json",validateStatus:I=u??Zo,timeout:k=o,...T}="string"==typeof p?{url:p}:p,C={...l,signal:k?Ko(f.signal,Bo(k)):f.signal,...T};E=new Headers(Jo(E)),C.headers=await t(E,{getState:g,arg:p,extra:m,endpoint:y,forced:v,type:w,extraOptions:h})||E;const x="object"==typeof(O=C.body)&&(Te(O)||Array.isArray(O)||"function"==typeof O.toJSON);var O;if(null==C.body||x||"string"==typeof C.body||C.headers.delete("content-type"),!C.headers.has("content-type")&&x&&C.headers.set("content-type",a),x&&i(C.headers)&&(C.body=JSON.stringify(C.body,s)),C.headers.has("accept")||("json"===A?C.headers.set("accept","application/json"):"text"===A&&C.headers.set("accept","text/plain, text/html, */*")),_){const e=~S.indexOf("?")?"&":"?";S+=e+(r?r(_):new URLSearchParams(Jo(_)))}S=Qo(e,S);const R=new Request(S,C);let N;b={request:new Request(S,C)};try{N=await n(R)}catch(q){return{error:{status:(q instanceof Error||"undefined"!=typeof DOMException&&q instanceof DOMException)&&"TimeoutError"===q.name?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(q)},meta:b}}const D=N.clone();let M;b.response=D;let P="";try{let e;if(await Promise.all([d(N,A).then(e=>M=e,t=>e=t),D.text().then(e=>P=e,()=>{})]),e)throw e}catch(q){return{error:{status:"PARSING_ERROR",originalStatus:N.status,data:P,error:String(q)},meta:b}}return I(N,M)?{data:M,meta:b}:{error:{status:N.status,data:M},meta:b}};async function d(e,t){if("function"==typeof t)return t(e);if("content-type"===t&&(t=i(e.headers)?"json":"text"),"json"===t){const t=await e.text();return t.length?JSON.parse(t):null}return e.text()}}var ec=class{constructor(e,t=void 0){this.value=e,this.meta=t}value;meta};async function tc(e=0,t=5,n){const r=Math.min(e,t),i=~~((Math.random()+.4)*(300<<r));await new Promise((e,t)=>
18{const r=setTimeout(()=>e(),i);if(n){const e=()=>{clearTimeout(r),t(new Error("Aborted"))};n.aborted?(clearTimeout(r),t(new Error("Aborted"))):n.addEventListener("abort",e,{once:!0})}})}function nc(e,t){throw Object.assign(new ec({error:e,meta:t}),{throwImmediately:!0})}function rc(e){e.aborted&&nc({status:"CUSTOM_ERROR",error:"Aborted"})}var ic={},ac=(e,t)=>async(n,r,i)=>{const a=[5,(t||ic).maxRetries,(i||ic).maxRetries].filter(e=>void 0!==e),[s]=a.slice(-1),o={maxRetries:s,backoff:tc,retryCondition:(e,t,{attempt:n})=>n<=s,...t,...i};let c=0;for(;;){rc(r.signal);try{const t=await e(n,r,i);if(t.error)throw new ec(t);return t}catch(u){if(c++,u.throwImmediately){if(u instanceof ec)return u.value;throw u}if(u instanceof ec){if(!o.retryCondition(u.value.error,n,{attempt:c,baseQueryApi:r,extraOptions:i}))return u.value}else if(c>o.maxRetries)return{error:u};rc(r.signal);try{await o.backoff(c,o.maxRetries,r.signal)}catch(l){throw rc(r.signal),l}}}},sc=Object.assign(ac,{fail:nc}),oc="__rtkq/",cc="focused",uc=sn(`${oc}${cc}`),lc=sn(`${oc}un${cc}`),dc=sn(`${oc}online`),pc=sn(`${oc}offline`),fc="query",hc="mutation",gc="infinitequery";function mc(e){return e.type===fc}function yc(e){return e.type===gc}function vc(e){return mc(e)||yc(e)}function wc(e,t,n,r,i,a){const s="function"==typeof e?e(t,n,r,i):e;return s?$o(s,Vo,e=>a(bc(e))):[]}function bc(e){return"string"==typeof e?{type:e}:e}var Sc=(e,t)=>e.endpointDefinitions[t],Ec=Symbol("forceQueryFn"),_c=e=>"function"==typeof e[Ec];var Ac=class extends Do{constructor(e,t,n,r){super(e),this.value=t,this.schemaName=n,this._bqMeta=r}value;schemaName;_bqMeta},Ic=(e,t)=>Array.isArray(e)?e.includes(t):!!e;async function kc(e,t,n,r){const i=await e["~standard"].validate(t);if(i.issues)throw new Ac(i.issues,t,n,r);return i.value}function Tc(e){return e}var Cc=(e={})=>({...e,[ln]:!0});function xc(e,{pages:t,pageParams:n},r){const i=t.length-1;return e.getNextPageParam(t[i],t,n[i],n,r)}function Oc(e,{pages:t,pageParams:n},r){return e.getPreviousPageParam?.(t[0],t,n[0],n,r)}function Rc(e,t,n,r){return wc(n[e.meta.arg.endpointName][t],In(e)?e.payload:void 0,An(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,r)}function Nc(e){return Qe(e)?Lt(e):e}function Dc(e,t,n){const r=e[t];r&&n(r)}function Mc(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function Pc(e,t,n){const r=e[Mc(t)];r&&n(r)}var qc={};function Fc({reducerPath:e,queryThunk:t,mutationThunk:n,serializeQueryArgs:r,context:{endpointDefinitions:i,apiUid:a,extractRehydrationInfo:s,hasRehydrationInfo:o},assertTagType:c,config:u}){const l=sn(`${e}/resetApiState`);function d(e,t,n,r){e[t.queryCacheKey]??={status:Mo,endpointName:t.endpointName},Dc(e,t.queryCacheKey,e=>{e.status=Po,e.requestId=n&&e.requestId?e.requestId:r.requestId,void 0!==t.originalArgs&&(e.originalArgs=t.originalArgs),e.startedTimeStamp=r.startedTimeStamp;yc(i[r.arg.endpointName])&&"direction"in t&&(e.direction=t.direction)})}function p(e,t,n,r){Dc(e,t.arg.queryCacheKey,e=>{if(e.requestId!==t.requestId&&!r)return;const{merge:a}=i[t.arg.endpointName];if(e.status=qo,a)if(void 0!==e.data){const{fulfilledTimeStamp:r,arg:i,baseQueryMeta:s,requestId:o}=t;let c=Qt(e.data,e=>a(e,n,{arg:i.originalArgs,baseQueryMeta:s,fulfilledTimeStamp:r,requestId:o}));e.data=c}else e.data=n;else e.data=i[t.arg.endpointName].structuralSharing??1?Lo(Qe(e.data)?(s=e.data,Qe(s)||Pe(15),s[Me].base_):e.data,n):n;var s;delete e.error,e.fulfilledTimeStamp=t.fulfilledTimeStamp})}const f=jn({name:`${e}/queries`,initialState:qc,reducers:{removeQueryResult:{reducer(e,{payload:{queryCacheKey:t}}){delete e[t]},prepare:dn()}
18,cacheEntriesUpserted:{reducer(e,t){for(const n of t.payload){const{queryDescription:r,value:i}=n;d(e,r,!0,{arg:r,requestId:t.meta.requestId,startedTimeStamp:t.meta.timestamp}),p(e,{arg:r,requestId:t.meta.requestId,fulfilledTimeStamp:t.meta.timestamp,baseQueryMeta:{}},i,!0)}},prepare:e=>({payload:e.map(e=>{const{endpointName:t,arg:n,value:a}=e,s=i[t];return{queryDescription:{type:fc,endpointName:t,originalArgs:e.arg,queryCacheKey:r({queryArgs:n,endpointDefinition:s,endpointName:t})},value:a}}),meta:{[ln]:!0,requestId:Tn(),timestamp:Date.now()}})},queryResultPatched:{reducer(e,{payload:{queryCacheKey:t,patches:n}}){Dc(e,t,e=>{e.data=Ht(e.data,n.concat())})},prepare:dn()}},extraReducers(e){e.addCase(t.pending,(e,{meta:t,meta:{arg:n}})=>{d(e,n,_c(n),t)}).addCase(t.fulfilled,(e,{meta:t,payload:n})=>{p(e,t,n,_c(t.arg))}).addCase(t.rejected,(e,{meta:{condition:t,arg:n,requestId:r},error:i,payload:a})=>{Dc(e,n.queryCacheKey,e=>{if(t);else{if(e.requestId!==r)return;e.status=Fo,e.error=a??i}})}).addMatcher(o,(e,t)=>{const{queries:n}=s(t);for(const[r,i]of Object.entries(n))i?.status!==qo&&i?.status!==Fo||(e[r]=i)})}}),h=jn({name:`${e}/mutations`,initialState:qc,reducers:{removeMutationResult:{reducer(e,{payload:t}){const n=Mc(t);n in e&&delete e[n]},prepare:dn()}},extraReducers(e){e.addCase(n.pending,(e,{meta:t,meta:{requestId:n,arg:r,startedTimeStamp:i}})=>{r.track&&(e[Mc(t)]={requestId:n,status:Po,endpointName:r.endpointName,startedTimeStamp:i})}).addCase(n.fulfilled,(e,{payload:t,meta:n})=>{n.arg.track&&Pc(e,n,e=>{e.requestId===n.requestId&&(e.status=qo,e.data=t,e.fulfilledTimeStamp=n.fulfilledTimeStamp)})}).addCase(n.rejected,(e,{payload:t,error:n,meta:r})=>{r.arg.track&&Pc(e,r,e=>{e.requestId===r.requestId&&(e.status=Fo,e.error=t??n)})}).addMatcher(o,(e,t)=>{const{mutations:n}=s(t);for(const[r,i]of Object.entries(n))i?.status!==qo&&i?.status!==Fo||r===i?.requestId||(e[r]=i)})}}),g=jn({name:`${e}/invalidation`,initialState:{tags:{},keys:{}},reducers:{updateProvidedBy:{reducer(e,t){for(const{queryCacheKey:n,providedTags:r}of t.payload){m(e,n);for(const{type:t,id:i}of r){const r=(e.tags[t]??={})[i||"__internal_without_id"]??=[];r.includes(n)||r.push(n)}e.keys[n]=r}},prepare:dn()}},extraReducers(e){e.addCase(f.actions.removeQueryResult,(e,{payload:{queryCacheKey:t}})=>{m(e,t)}).addMatcher(o,(e,t)=>{const{provided:n}=s(t);for(const[r,i]of Object.entries(n.tags??{}))for(const[t,a]of Object.entries(i)){const i=(e.tags[r]??={})[t||"__internal_without_id"]??=[];for(const t of a){i.includes(t)||i.push(t),e.keys[t]=n.keys[t]}}}).addMatcher(vn(In(t),An(t)),(e,t)=>{y(e,[t])}).addMatcher(f.actions.cacheEntriesUpserted.match,(e,t)=>{y(e,t.payload.map(({queryDescription:e,value:t})=>({type:"UNKNOWN",payload:t,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:e}})))})}});function m(e,t){const n=Nc(e.keys[t]??[]);for(const r of n){const n=r.type,i=r.id??"__internal_without_id",a=e.tags[n]?.[i];a&&(e.tags[n][i]=Nc(a).filter(e=>e!==t))}delete e.keys[t]}function y(e,t){const n=t.map(e=>{const t=Rc(e,"providesTags",i,c),{queryCacheKey:n}=e.meta.arg;return{queryCacheKey:n,providedTags:t}});g.caseReducers.updateProvidedBy(e,g.actions.updateProvidedBy(n))}const v=jn({name:`${e}/subscriptions`,initialState:qc,reducers:{updateSubscriptionOptions(e,t){},unsubscribeQueryResult(e,t){},internal_getRTKQSubscriptions(){}}}),w=jn({name:`${e}/internalSubscriptions`,initialState:qc,reducers:{subscriptionsUpdated:{reducer:(e,t)=>Ht(e,t.payload),prepare:dn()}}}),b=jn({name:`${e}/config`,initialState:{online:"undefined"==typeof navigator||void 0===navigator.onLine||navigator.onLine,focused:"undefined"==typeof document||"hidden"!==document.visibilityState,middlewareRegistered:!1,...u},reducers:{middlewareRegistered(e,{payload:t}){e.middlewareRegistered="conflict"!==e.middlewareRegistered&&a===t||"conflict"}},extraReducers:e=>{e.addCase(dc,e=>{e.online=!0}).addCase(pc,e=>{e.online=!1}).addCase(uc,e=>{e.focused=!0}).addCase(lc,e=>{e.focused=!1}).addMatcher(o,e=>({...e}))}}),S=xe({queries:f.reducer,mutations:h.reducer,provided:g.reducer,subscriptions:w.reducer,config:b.reducer});return{reducer:(e,t)=>S(l.match(t)?void 0:e,t),actions:{...b.actions,...f.actions,...v.actions,...w.actions,...h.actions,...g.actions,resetApiState:l}}}var Uc=Symbol.for("RTKQ/skipToken"),jc={status:Mo},Lc=Qt(jc,()=>{}),$c=Qt(jc,()=>{});var Vc=WeakMap?new WeakMap:void 0,Gc=({endpointName:e,queryArgs:t})=>{let n="";const r=Vc?.get(t);if("string"==typeof r)n=r;else{const e=JSON.stringify(t,(e,t)=>t=Te(t="bigint"==typeof t?{$bigint:t.toString()}:t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t);Te(t)&&Vc?.set(t,e),n=e}return`${e}(${n})`};function Qc(...e){return function(t){const n=Jt(e=>t.extractRehydrationInfo?.(e,{reducerPath:t.reducerPath??"api"}
18)),r={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...t,extractRehydrationInfo:n,serializeQueryArgs(e){let n=Gc;if("serializeQueryArgs"in e.endpointDefinition){const t=e.endpointDefinition.serializeQueryArgs;n=e=>{const n=t(e);return"string"==typeof n?n:Gc({...e,queryArgs:n})}}else t.serializeQueryArgs&&(n=t.serializeQueryArgs);return n(e)},tagTypes:[...t.tagTypes||[]]},i={endpointDefinitions:{},batch(e){e()},apiUid:Tn(),extractRehydrationInfo:n,hasRehydrationInfo:Jt(e=>null!=n(e))},a={injectEndpoints:function(e){const t=e.endpoints({query:e=>({...e,type:fc}),mutation:e=>({...e,type:hc}),infiniteQuery:e=>({...e,type:gc})});for(const[n,r]of Object.entries(t))if(!0!==e.overrideExisting&&n in i.endpointDefinitions){if("throw"===e.overrideExisting)throw new Error(vr(39))}else{i.endpointDefinitions[n]=r;for(const e of s)e.injectEndpoint(n,r)}return a},enhanceEndpoints({addTagTypes:e,endpoints:t}){if(e)for(const n of e)r.tagTypes.includes(n)||r.tagTypes.push(n);if(t)for(const[n,r]of Object.entries(t))"function"==typeof r?r(Sc(i,n)):Object.assign(Sc(i,n)||{},r);return a}},s=e.map(e=>e.init(a,r,i));return a.injectEndpoints({endpoints:t.endpoints})}}function zc(e,...t){return Object.assign(e,...t)}var Hc=({api:e,queryThunk:t,internalState:n,mwApi:r})=>{const i=`${e.reducerPath}/subscriptions`;let a=null,s=null;const{updateSubscriptionOptions:o,unsubscribeQueryResult:c}=e.internalActions,u=()=>n.currentSubscriptions,l={getSubscriptions:u,getSubscriptionCount:e=>{const t=u().get(e);return t?.size??0},isRequestSubscribed:(e,t)=>{const n=u();return!!n?.get(e)?.get(t)}};function d(e){return JSON.parse(JSON.stringify(Object.fromEntries([...e].map(([e,t])=>[e,Object.fromEntries(t)]))))}return(r,u)=>{if(a||(a=d(n.currentSubscriptions)),e.util.resetApiState.match(r))return a={},n.currentSubscriptions.clear(),s=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(r))return[!1,l];const p=((n,r)=>{if(o.match(r)){const{queryCacheKey:e,requestId:t,options:i}=r.payload,a=n.get(e);return a?.has(t)&&a.set(t,i),!0}if(c.match(r)){const{queryCacheKey:e,requestId:t}=r.payload,i=n.get(e);return i&&i.delete(t),!0}if(e.internalActions.removeQueryResult.match(r))return n.delete(r.payload.queryCacheKey),!0;if(t.pending.match(r)){const{meta:{arg:e,requestId:t}}=r,i=zo(n,e.queryCacheKey,Ho);return e.subscribe&&i.set(t,e.subscriptionOptions??i.get(t)??{}),!0}let i=!1;if(t.rejected.match(r)){const{meta:{condition:e,arg:t,requestId:a}}=r;if(e&&t.subscribe){const e=zo(n,t.queryCacheKey,Ho);e.set(a,t.subscriptionOptions??e.get(a)??{}),i=!0}}return i})(n.currentSubscriptions,r);let f=!0;if(p){s||(s=setTimeout(()=>{const t=d(n.currentSubscriptions),[,r]=zt(a,()=>t);u.next(e.internalActions.subscriptionsUpdated(r)),a=t,s=null},500));const o="string"==typeof r.type&&!!r.type.startsWith(i),c=t.rejected.match(r)&&r.meta.condition&&!!r.meta.arg.subscribe;f=!o&&!c}return[f,!1]}},Bc=({reducerPath:e,api:t,queryThunk:n,context:r,internalState:i,selectors:{selectQueryEntry:a,selectConfig:s},getRunningQueryThunk:o,mwApi:c})=>{const{removeQueryResult:u,unsubscribeQueryResult:l,cacheEntriesUpserted:d}=t.internalActions,p=vn(l.match,n.fulfilled,n.rejected,d.match);function f(e){const t=i.currentSubscriptions.get(e);if(!t)return!1;return t.size>0}const h={};function g(e){for(const t of e.values())t?.abort?.()}function m(e,t,n){const r=t.getState();for(const i of e){const e=a(r,i);e?.endpointName&&y(i,e.endpointName,t,n)}}function y(e,t,n,i){const s=Sc(r,t),c=s?.keepUnusedDataFor??i.keepUnusedDataFor;if(c===1/0)return;const l=Math.max(0,Math.min(c,2147482.647));if(!f(e)){const t=h[e];t&&clearTimeout(t),h[e]=setTimeout(()=>{if(!f(e)){const t=a(n.getState(),e);if(t?.endpointName){const e=n.dispatch(o(t.endpointName,t.originalArgs));e?.abort()}n.dispatch(u({queryCacheKey:e}))}delete h[e]},1e3*l)}}return(e,n)=>{const a=n.getState(),o=s(a);if(p(e)){let t;if(d.match(e))t=e.payload.map(e=>e.queryDescription.queryCacheKey);else{const{queryCacheKey:n}=l.match(e)?e.payload:e.meta.arg;t=[n]}m(t,n,o)}if(t.util.resetApiState.match(e)){for(const[e,t]of Object.entries(h))t&&clearTimeout(t),delete h[e];g(i.runningQueries),g(i.runningMutations)}if(r.hasRehydrationInfo(e)){const{queries:t}=r.extractRehydrationInfo(e);m(Object.keys(t),n,o)}}},Kc=new Error("Promise never resolved before cacheEntryRemoved."),Yc=({api:e,reducerPath:t,context:n,queryThunk:r,mutationThunk:i,internalState:a,selectors:{selectQueryEntry:s,selectApiState:o}})=>{const c=kn(r),u=kn(i),l=In(r,i),d={},{removeQueryResult:p,removeMutationResult:f,cacheEntriesUpserted:h}=e.internalActions;function g(e,t,n){const r=d[e];r?.valueResolved&&(r.valueResolved({data:t,meta:n}),delete r.valueResolved)}function m(e){const t=d[e];t&&(delete d[e],t.cacheEntryRemoved())}function y(e){const{arg:t,requestId:n}=e.meta,{endpointName:r,originalArgs:i}=t;return[r,i,n]}function v(t,r,i,a,s){const o=Sc(n,t),c=o?.onCacheEntryAdded;if(!c)return;const u={},l=new Promise(e=>{u.cacheEntryRemoved=e}),p=Promise.race([new Promise(e=>{u.valueResolved=e}),l.then(()=>{throw Kc})]);p.catch(()=>{}),d[i]=u;const f=e.endpoints[t].select(vc(o)?r:i),h=a.dispatch((e,t,n)=>n),g={...a,getCacheEntry:()=>f(a.getState()),requestId:s,extra:h,updateCachedData:vc(o)?n=>a.dispatch(e.util.updateQueryData(t,r,n)):void 0,cacheDataLoaded:p,cacheEntryRemoved:l},m=c(r,g);
18Promise.resolve(m).catch(e=>{if(e!==Kc)throw e})}return(n,a,o)=>{const w=function(e){if(c(e))return e.meta.arg.queryCacheKey;if(u(e))return e.meta.arg.fixedCacheKey??e.meta.requestId;return p.match(e)?e.payload.queryCacheKey:f.match(e)?Mc(e.payload):""}(n);function b(e,t,n,r){const i=s(o,t),c=s(a.getState(),t);!i&&c&&v(e,r,t,a,n)}if(r.pending.match(n)){const[e,t,r]=y(n);b(e,w,r,t)}else if(h.match(n))for(const{queryDescription:e,value:t}of n.payload){const{endpointName:r,originalArgs:i,queryCacheKey:a}=e;b(r,a,n.meta.requestId,i),g(a,t,{})}else if(i.pending.match(n)){if(a.getState()[t].mutations[w]){const[e,t,r]=y(n);v(e,t,w,a,r)}}else if(l(n))g(w,n.payload,n.meta.baseQueryMeta);else if(p.match(n)||f.match(n))m(w);else if(e.util.resetApiState.match(n))for(const e of Object.keys(d))m(e)}},Zc=({api:e,context:{apiUid:t},reducerPath:n})=>(n,r)=>{e.util.resetApiState.match(n)&&r.dispatch(e.internalActions.middlewareRegistered(t))},Wc=({reducerPath:e,context:t,context:{endpointDefinitions:n},mutationThunk:r,queryThunk:i,api:a,assertTagType:s,refetchQuery:o,internalState:c})=>{const{removeQueryResult:u}=a.internalActions,l=vn(In(r),An(r)),d=vn(In(i,r),_n(i,r));let p=[],f=0;function h(n,r){const i=r.getState(),s=i[e];if(p.push(...n),"delayed"===s.config.invalidationBehavior&&f>0)return;const l=p;if(p=[],0===l.length)return;const d=a.util.selectInvalidatedBy(i,l);t.batch(()=>{const e=Array.from(d.values());for(const{queryCacheKey:t}of e){const e=s.queries[t],n=zo(c.currentSubscriptions,t,Ho);e&&(0===n.size?r.dispatch(u({queryCacheKey:t})):e.status!==Mo&&r.dispatch(o(e)))}})}return(e,t)=>{(i.pending.match(e)||r.pending.match(e))&&f++,d(e)&&(f=Math.max(0,f-1)),l(e)?h(Rc(e,"invali
18datesTags",n,s),t):d(e)?h([],t):a.util.invalidateTags.match(e)&&h(wc(e.payload,void 0,void 0,void 0,void 0,s),t)}},Jc=({reducerPath:e,queryThunk:t,api:n,refetchQuery:r,internalState:i})=>{const{currentPolls:a,currentSubscriptions:s}=i,o=new Set;let c=null;function u(e,t){o.add(e),c||(c=setTimeout(()=>{for(const e of o)d({queryCacheKey:e},t);o.clear(),c=null},0))}function l({queryCacheKey:t},n){const i=n.getState()[e],o=i.queries[t],c=s.get(t);if(!o||o.status===Mo)return;const{lowestPollingInterval:u,skipPollingIfUnfocused:d}=f(c);if(!Number.isFinite(u))return;const p=a.get(t);p?.timeout&&(clearTimeout(p.timeout),p.timeout=void 0);const h=Date.now()+u;a.set(t,{nextPollTimestamp:h,pollingInterval:u,timeout:setTimeout(()=>{!i.config.focused&&d||n.dispatch(r(o)),l({queryCacheKey:t},n)},u)})}function d({queryCacheKey:t},n){const r=n.getState()[e].queries[t],i=s.get(t);if(!r||r.status===Mo)return;const{lowestPollingInterval:o}=f(i);if(!Number.isFinite(o))return void p(t);const c=a.get(t),u=Date.now()+o;(!c||u<c.nextPollTimestamp)&&l({queryCacheKey:t},n)}function p(e){const t=a.get(e);t?.timeout&&clearTimeout(t.timeout),a.delete(e)}function f(e=new Map){let t=!1,n=Number.POSITIVE_INFINITY;for(const r of e.values())r.pollingInterval&&(n=Math.min(r.pollingInterval,n),t=r.skipPollingIfUnfocused||t);return{lowestPollingInterval:n,skipPollingIfUnfocused:t}}return(e,r)=>{(n.internalActions.updateSubscriptionOptions.match(e)||n.internalActions.unsubscribeQueryResult.match(e))&&u(e.payload.queryCacheKey,r),(t.pending.match(e)||t.rejected.match(e)&&e.meta.condition)&&u(e.meta.arg.queryCacheKey,r),(t.fulfilled.match(e)||t.rejected.match(e)&&!e.meta.condition)&&l(e.meta.arg,r),n.util.resetApiState.match(e)&&(!function(){for(const e of a.keys())p(e)}(),c&&(clearTimeout(c),c=null),o.clear())}},Xc=({api:e,context:t,queryThunk:n,mutationThunk:r})=>{const i=En(n,r),a=_n(n,r),s=In(n,r),o={};return(n,r)=>{if(i(n)){const{requestId:i,arg:{endpointName:a,originalArgs:s}}=n.meta,c=Sc(t,a),u=c?.onQueryStarted;if(u){const t={},n=new Promise((e,n)=>{t.resolve=e,t.reject=n});n.catch(()=>{}),o[i]=t;const l=e.endpoints[a].select(vc(c)?s:i),d=r.dispatch((e,t,n)=>n),p={...r,getCacheEntry:()=>l(r.getState()),requestId:i,extra:d,updateCachedData:vc(c)?t=>r.dispatch(e.util.updateQueryData(a,s,t)):void 0,queryFulfilled:n};u(s,p)}}else if(s(n)){const{requestId:e,baseQueryMeta:t}=n.meta;o[e]?.resolve({data:n.payload,meta:t}),delete o[e]}else if(a(n)){const{requestId:e,rejectedWithValue:t,baseQueryMeta:r}=n.meta;o[e]?.reject({error:n.payload??n.error,isUnhandledError:!t,meta:r}),delete o[e]}}};function eu(e){const{reducerPath:t,queryThunk:n,api:r,context:i,getInternalState:a}=e,{apiUid:s}=i,o={invalidateTags:sn(`${t}/invalidateTags`)},c=e=>e.type.startsWith(`${t}/`),u=[Zc,Bc,Wc,Jc,Yc,Xc];return{middleware:n=>{let o=!1;const d=a(n.dispatch),p={...e,internalState:d,refetchQuery:l,isThisApiSliceAction:c,mwApi:n},f=u.map(e=>e(p)),h=Hc(p),g=(({reducerPath:e,context:t,api:n,refetchQuery:r,internalState:i})=>{const{removeQueryResult:a}=n.internalActions;function s(n,s){const o=n.getState()[e],c=o.queries,u=i.currentSubscriptions;t.batch(()=>{for(const e of u.keys()){const t=c[e],i=u.get(e);if(!i||!t)continue;const l=[...i.values()];(l.some(e=>!0===e[s])||l.every(e=>void 0===e[s])&&o.config[s])&&(0===i.size?n.dispatch(a({queryCacheKey:e})):t.status!==Mo&&n.dispatch(r(t)))}})}return(e,t)=>{uc.match(e)&&s(t,"refetchOnFocus"),dc.match(e)&&s(t,"refetchOnReconnect")}})(p);return e=>a=>{if(!Re(a))return e(a);o||(o=!0,n.dispatch(r.internalActions.middlewareRegistered(s)));const u={...n,next:e},l=n.getState(),[d,p]=h(a,u,l);let m;if(m=d?e(a):p,n.getState()[t]&&(g(a,u,l),c(a)||i.hasRehydrationInfo(a)))for(const e of f)e(a,u,l);return m}},actions:o};function l(t){return e.api.endpoints[t.endpointName].initiate(t.originalArgs,{subscribe:!1,forceRefetch:!0})}}var tu=Symbol(),nu=Qc((({createSelector:e=en}={})=>({name:tu,init(t,{baseQuery:n,tagTypes:r,reducerPath:i,serializeQueryArgs:a,keepUnusedDataFor:s,refetchOnMountOrArgChange:o,refetchOnFocus:c,refetchOnReconnect:u,invalidationBehavior:l,onSchemaFailure:d,catchSchemaFailure:p,skipSchemaValidation:f},h){Vt();const g=e=>e;Object.assign(t,{reducerPath:i,endpoints:{},internalActions:{onOnline:dc,onOffline:pc,onFocus:uc,onFocusLost:lc},util:{}});const m=function({serializeQueryArgs:e,reducerPath:t,createSelector:n}){const r=e=>Lc,i=e=>$c;return{buildQuerySelector:function(e,t){return u(e,t,a)},buildInfiniteQuerySelector:function(e,t){const{infiniteQueryOptions:n}=t;return u(e,t,function(e){const t={...e,...Uo(e.status)},{isLoading:r,isError:i,direction:a}=t,s="forward"===a,o="backward"===a;return{...t,hasNextPage:l(n,t.data,t.originalArgs),hasPreviousPage:d(n,t.data,t.originalArgs),isFetchingNextPage:r&&s,isFetchingPreviousPage:r&&o,isFetchNextPageError:i&&s,isFetchPreviousPageError:i&&o}})},buildMutationSelector:function(){return e=>{let t;return t="object"==typeof e?Mc(e)??Uc:e,n(t===Uc?i:e=>s(e)?.mutations?.[t]??$c,a)}},selectInvalidatedBy:function(e,n){const r=e[t],i=new Set,a=$o(n,Vo,bc);for(const t of a){const e=r.provided.tags[t.type];if(!e)continue;let n=(void 0!==t.id?e[t.id]:Object.values(e).flat())??[];for(const t of n)i.add(t)}return Array.from(i.values()).flatMap(e=>{const t=r.queries[e];return t?{queryCacheKey:e,endpointName:t.endpointName,originalArgs:t.originalArgs}:[]})},selectCachedArgsForQuery:function(e,t){return $o(Object.values(o(e)),e=>e?.endpointName===t&&e.status!==Mo,e=>e.originalArgs)},selectApiState:s,selectQueries:o,selectMutations:function(e){return s(e)?.mutations},selectQueryEntry:c,selectConfig:function(e){return s(e)?.config}};function a(e){return{...e,...Uo(e.status)}}function s(e){return e[t]}function o(e){return s(e)?.queries}function c(e,t){return o(e)?.[t]}function u(t,i,a){return s=>{if(s===Uc)return n(r,a);const o=e({queryArgs:s,endpointDefinition:i,endpointName:t});return n(e=>c(e,o)??Lc,a)}}function l(e,t,n){return!!t&&null!=xc(e,t,n)}function d(e,t,n){return!(!t||!e.getPreviousPageParam)&&null!=Oc(e,t,n)}}({serializeQueryArgs:a,reducerPath:i,createSelector:e}),{selectInvalidatedBy:y,selectCachedArgsForQuery:v,buildQuerySelector:w,buildInfiniteQuerySelector:b,buildMutationSelector:S}=m;zc(t.util,{selectInvalidatedBy:y,selectCachedArgsForQuery:v});const{queryThunk:E,infiniteQueryThunk:_,mutationThunk:A,patchQueryData:I,updateQueryData:k,upsertQueryData:T,prefetch:C,buildMatchThunkActions:x}=function({reducerPath:e,baseQuery:t,context:{endpointDefinitions:n},serializeQueryArgs:r,api:i,assertTagType:a,selectors:s,onSchemaFailure:o,catchSchemaFailure:c,skipSchemaValidation:u}){function l(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}function d(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}const p=(e,t)=>e.query&&e[t]?e[t]:Tc,f=async(e,{signal:r,abort:i,rejectWithValue:a,fulfillWithValue:f,dispatch:g,getState:m,extra:y})=>{const v=n[e.endpointName],{metaSchema:w,skipSchemaValidation:b=u}=v,S=e.type===fc;try{let A=Tc;const I={signal:r,abort:i,dispatch:g,getState:m,extra:y,endpoint:e.endpointName,type:e.type,forced:S?h(e,m()):void 0,queryCacheKey:S?e.queryCacheKey:void 0},k=S?e[Ec]:void 0;let T;const C=async(t,n,r,i)=>{if(null==n&&t.pages.length)return Promise.resolve({data:t});const a={queryArg:e.originalArgs,pageParam:n},s=await x(a),o=i?l:d;return{data:{pages:o(t.pages,s.data,r),pageParams:o(t.pageParams,n,r)},meta:s.meta}};async function x(e){let n;const{extraOptions:r,argSchema:i,rawResponseSchema:a,responseSchema:s}=v;if(i&&!Ic(b,"arg")&&(e=await kc(i,e,"argSchema",{})),k?n=k():v.query?(A=p(v,"transformResponse"),n=await t(v.query(e),I,r)):n=await v.queryFn(e,I,r,e=>
18t(e,I,r)),n.error)throw new ec(n.error,n.meta);let{data:o}=n;a&&!Ic(b,"rawResponse")&&(o=await kc(a,n.data,"rawResponseSchema",n.meta));let c=await A(o,n.meta,e);return s&&!Ic(b,"response")&&(c=await kc(s,c,"responseSchema",n.meta)),{...n,data:c}}if(S&&"infiniteQueryOptions"in v){const{infiniteQueryOptions:O}=v,{maxPages:R=1/0}=O,N=e.refetchCachedPages??O.refetchCachedPages??!0;let D;const M={pages:[],pageParams:[]},P=s.selectQueryEntry(m(),e.queryCacheKey)?.data,q=h(e,m())&&!e.direction||!P?M:P;if("direction"in e&&e.direction&&q.pages.length){const F="backward"===e.direction,U=(F?Oc:xc)(O,q,e.originalArgs);D=await C(q,U,R,F)}else{const{initialPageParam:j=O.initialPageParam}=e,L=P?.pageParams??[],$=L[0]??j,V=L.length;if(D=await C(q,$,R),k&&(D={data:D.data.pages[0]}),N)for(let G=1;G<V;G++){const Q=xc(O,D.data,e.originalArgs);D=await C(D.data,Q,R)}}T=D}else T=await x(e.originalArgs);return w&&!Ic(b,"meta")&&T.meta&&(T.meta=await kc(w,T.meta,"metaSchema",T.meta)),f(T.data,Cc({fulfilledTimeStamp:Date.now(),baseQueryMeta:T.meta}))}catch(E){let z=E;if(z instanceof ec){let H=p(v,"transformErrorResponse");const{rawErrorResponseSchema:B,errorResponseSchema:K}=v;let{value:Y,meta:Z}=z;try{B&&!Ic(b,"rawErrorResponse")&&(Y=await kc(B,Y,"rawErrorResponseSchema",Z)),w&&!Ic(b,"meta")&&(Z=await kc(w,Z,"metaSchema",Z));let W=await H(Y,Z,e.originalArgs);return K&&!Ic(b,"errorResponse")&&(W=await kc(K,W,"errorResponseSchema",Z)),a(W,Cc({baseQueryMeta:Z}))}catch(_){z=_}}try{if(z instanceof Ac){const J={endpoint:e.endpointName,arg:e.originalArgs,type:e.type,queryCacheKey:S?e.queryCacheKey:void 0};v.onSchemaFailure?.(z,J),o?.(z,J);const{catchSchemaFailure:X=c}=v;if(X)return a(X(z,J),Cc({baseQueryMeta:z._bqMeta}))}}catch(_){z=_}throw console.error(z),z}};function h(e,t){const n=s.selectQueryEntry(t,e.queryCacheKey),r=s.selectConfig(t).refetchOnMountOrArgChange,i=n?.fulfilledTimeStamp,a=e.forceRefetch??(e.subscribe&&r);return!!a&&(!0===a||(Number(new Date)-Number(i))/1e3>=a)}const g=()=>Dn(`${e}/executeQuery`,f,{getPendingMeta({arg:e}){const t=n[e.endpointName];return Cc({startedTimeStamp:Date.now(),...yc(t)?{direction:e.direction}:{}})},condition(e,{getState:t}){const r=t(),i=s.selectQueryEntry(r,e.queryCacheKey),a=i?.fulfilledTimeStamp,o=e.originalArgs,c=i?.originalArgs,u=n[e.endpointName],l=e.direction;return!(!_c(e)&&("pending"===i?.status||!h(e,r)&&(!mc(u)||!u?.forceRefetch?.({currentArg:o,previousArg:c,endpointState:i,state:r}))&&a&&!l))},dispatchConditionRejection:!0}),m=g(),y=g(),v=Dn(`${e}/executeMutation`,f,{getPendingMeta:()=>Cc({startedTimeStamp:Date.now()})});function w(e){return t=>t?.meta?.arg?.endpointName===e}return{queryThunk:m,mutationThunk:v,infiniteQueryThunk:y,prefetch:(e,t,n={})=>(r,a)=>{const s=(e=>"force"in e)(n)&&n.force,o=(e=>"ifOlderThan"in e)(n)&&n.ifOlderThan,c=(n=!0)=>{const r={forceRefetch:n,subscribe:!1};return i.endpoints[e].initiate(t,r)},u=i.endpoints[e].select(t)(a());if(s)r(c());else if(o){const e=u?.fulfilledTimeStamp;if(!e)return void r(c());(Number(new Date)-Number(new Date(e)))/1e3>=o&&r(c())}else r(c(!1))},updateQueryData:(e,t,n,r=!0)=>(a,s)=>{const o=i.endpoints[e].select(t)(s()),c={patches:[],inversePatches:[],undo:()=>a(i.util.patchQueryData(e,t,c.inversePatches,r))};if(o.status===Mo)return c;let u;if("data"in o)if(ze(o.data)){const[e,t,r]=zt(o.data,n);c.patches.push(...t),c.inversePatches.push(...r),u=e}else u=n(o.data),c.patches.push({op:"replace",path:[],value:u}),c.inversePatches.push({op:"replace",path:[],value:o.data});return 0===c.patches.length||a(i.util.patchQueryData(e,t,c.patches,r)),c},upsertQueryData:(e,t,n)=>r=>r(i.endpoints[e].initiate(t,{subscribe:!1,forceRefetch:!0,[Ec]:()=>({data:n})})),patchQueryData:(e,t,s,o)=>(c,u)=>{const l=n[e],d=r({queryArgs:t,endpointDefinition:l,endpointName:e});if(c(i.internalActions.queryResultPatched({queryCacheKey:d,patches:s})),!o)return;const p=i.endpoints[e].select(t)(u()),f=wc(l.providesTags,p.data,void 0,t,{},a);c(i.internalActions.updateProvidedBy([{queryCacheKey:d,providedTags:f}]))},buildMatchThunkActions:function(e,t){return{matchPending:wn(En(e),w(t)),matchFulfilled:wn(In(e),w(t)),matchRejected:wn(_n(e),w(t))}}}}({baseQuery:n,reducerPath:i,context:h,api:t,serializeQueryArgs:a,assertTagType:g,selectors:m,onSchemaFailure:d,catchSchemaFailure:p,skipSchemaValidation:f}),{reducer:O,actions:R}=Fc({context:h,queryThunk:E,mutationThunk:A,serializeQueryArgs:a,reducerPath:i,assertTagType:g,config:{refetchOnFocus:c,refetchOnReconnect:u,refetchOnMountOrArgChange:o,keepUnusedData
18For:s,reducerPath:i,invalidationBehavior:l}});zc(t.util,{patchQueryData:I,updateQueryData:k,upsertQueryData:T,prefetch:C,resetApiState:R.resetApiState,upsertQueryEntries:R.cacheEntriesUpserted}),zc(t.internalActions,R);const N=new WeakMap,D=e=>zo(N,e,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:M,buildInitiateInfiniteQuery:P,buildInitiateMutation:q,getRunningMutationThunk:F,getRunningMutationsThunk:U,getRunningQueriesThunk:j,getRunningQueryThunk:L}=function({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:n,mutationThunk:r,api:i,context:a,getInternalState:s}){const o=e=>s(e)?.runningQueries,c=e=>s(e)?.runningMutations,{unsubscribeQueryResult:u,removeMutationResult:l,updateSubscriptionOptions:d}=i.internalActions;return{buildInitiateQuery:function(e,t){return p(e,t)},buildInitiateInfiniteQuery:function(e,t){return p(e,t)},buildInitiateMutation:function(e){return(t,{track:n=!0,fixedCacheKey:i}={})=>(a,s)=>{const o=r({type:"mutation",endpointName:e,originalArgs:t,track:n,fixedCacheKey:i}),u=a(o),{requestId:d,abort:p,unwrap:f}=u,h=(g=e=>({error:e}),u.unwrap().then(e=>({data:e})).catch(g));var g;const m=Object.assign(h,{arg:u.arg,requestId:d,abort:p,unwrap:f,reset:()=>{a(l({requestId:d,fixedCacheKey:i}))}}),y=c(a);return y.set(d,m),m.then(()=>{y.delete(d)}),i&&(y.set(i,m),m.then(()=>{y.get(i)===m&&y.delete(i)})),m}},getRunningQueryThunk:function(t,n){return r=>{const i=Sc(a,t),s=e({queryArgs:n,endpointDefinition:i,endpointName:t});return o(r)?.get(s)}},getRunningMutationThunk:function(e,t){return e=>c(e)?.get(t)},getRunningQueriesThunk:function(){return e=>Go(o(e))},getRunningMutationsThunk:function(){return e=>Go(c(e))}};function p(r,a){const s=(c,{subscribe:l=!0,forceRefetch:p,subscriptionOptions:f,[Ec]:h,...g}={})=>(m,y)=>{const v=e({queryArgs:c,endpointDefinition:a,endpointName:r});let w;const b={...g,type:fc,subscribe:l,forceRefetch:p,subscriptionOptions:f,endpointName:r,originalArgs:c,queryCacheKey:v,[Ec]:h};if(mc(a))w=t(b);else{const{direction:e,initialPageParam:t,refetchCachedPages:r}=g;w=n({...b,direction:e,initialPageParam:t,refetchCachedPages:r})}const S=i.endpoints[r].select(c),E=m(w),_=S(y()),{requestId:A,abort:I}=E,k=_.requestId!==A,T=o(m)?.get(v),C=()=>S(y()),x=Object.assign(h?E.then(C):k&&!T?Promise.resolve(_):Promise.all([T,E]).then(C),{arg:c,requestId:A,subscriptionOptions:f,queryCacheKey:v,abort:I,async unwrap(){const e=await x;if(e.isError)throw e.error;return e.data},refetch:e=>m(s(c,{subscribe:!1,forceRefetch:!0,...e})),unsubscribe(){l&&m(u({queryCacheKey:v,requestId:A}))},updateSubscriptionOptions(e){x.subscriptionOptions=e,m(d({endpointName:r,requestId:A,queryCacheKey:v,options:e}))}});if(!T&&!k&&!h){const e=o(m);e.set(v,x),x.then(()=>{e.delete(v)})}return x};return s}}({queryThunk:E,mutationThunk:A,infiniteQueryThunk:_,api:t,serializeQueryArgs:a,context:h,getInternalState:D});zc(t.util,{getRunningMutationThunk:F,getRunningMutationsThunk:U,getRunningQueryThunk:L,getRunningQueriesThunk:j});const{middleware:$,actions:V}=eu({reducerPath:i,context:h,queryThunk:E,mutationThunk:A,infiniteQueryThunk:_,api:t,assertTagType:g,selectors:m,getRunningQueryThunk:L,getInternalState:D});return zc(t.util,V),zc(t,{reducer:O,middleware:$}),{name:tu,injectEndpoint(e,n){const r=t,i=r.endpoints[e]??={};mc(n)&&zc(i,{name:e,select:w(e,n),initiate:M(e,n)},x(E,e)),n.type===hc&&zc(i,{name:e,select:S(),initiate:q(e)},x(A,e)),yc(n)&&zc(i,{name:e,select:b(e,n),initiate:P(e,n)},x(E,e))}}}}))());const ru=e=>e.query,iu=e=>e.query?.enableQuerySyntax;en(e=>ru(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,n,r,i)=>({q:e,requestId:t,cannotAnswer:n,analyticsMode:r,actionCause:i})),en(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);const au=e=>"yes"===e||"no"!==e&&void 0;const su=(e,t,n)=>co({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(r,i)=>{const a=t??Es(i);if(!a)return null;const s=Ts(i);return r.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:a,answerGenerated:e,answerTextIsEmpty:n,...s&&{conversationId:s}})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Es(n)??"",answerGenerated:e??!1})}),ou=e=>co({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:e=>({answerId:Es(e)??"",responseId:e.search?.searchResponseId||e.search?.response.searchUid||""})});const cu={logCopyGeneratedAnswer:function(e){return co({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,n)=>{const r=e??Es(n);if(!r)return null;const i=Ts(n);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:r,...i&&{conversationId:i}})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Es(t)??"",action:"copyToClipboard"})})},logGeneratedAnswerHideAnswers:()=>co({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{const n=Es(t);return n?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:n}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Es(e)??"",action:"hide"})}),logGeneratedAnswerShowAnswers:()=>co({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{const n=Es(t);return n?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:n}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Es(e)??"",action:"show"})}),logGeneratedAnswerStreamEnd:su,logGeneratedAnswerFeedback:e=>co({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,n)=>{const r=Es(n);return r?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:r,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{const n=Es(t),{helpful:r,readable:i,documented:a,hallucinationFree:s,correctTopic:o,documentUrl:c,details:u}=e;return{answerId:n??"",helpful:r,details:{readable:au(i),documented:au(a),correctTopic:au(o),hallucinationFree:au(s)},additionalNotes:u,correctAnswerUrl:c}}}),logDislikeGeneratedAnswer:function(e){return co({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,n)=>{const r=e??Es(n);if(!r)return null;const i=Ts(n);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:r,...i&&{conversationId:i}})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Es(t)??"",action:"dislike"})})},logLikeGeneratedAnswer:function(e){return co({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,n)=>{const r=e??Es(n);if(!r)return null;const i=Ts(n);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:r,...i&&{conversationId:i}})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Es(t)??"",action:"like"})})},logGeneratedAnswerOpenInlineLink:function(e,t){return co({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:n=>n.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})},logHoverCitation:function(e,t,n){return co({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(r,i)=>{const a=n??Es(i),s=xs(i,e);if(!a||!s)return null;const o=Ts(i);return r.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:a,permanentId:s.permanentid,citationId:s.id,citationHoverTimeMs:t,...o&&{conversationId:o}})}
18,analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:r=>{const i=xs(r,e);return{answerId:n??Es(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:i?.permanentid??"",title:i?.title,url:i?.clickUri},citationHoverTimeInMs:t}}})},logOpenGeneratedAnswerSource:function(e,t){return co({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(n,r)=>{const i=t??Es(r),a=xs(r,e);if(!i||!a)return null;const s=Ts(r);return n.makeGeneratedAnswerCitationClick(((e,t)=>({sourceName:go(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||""}))(a,r),{generativeQuestionAnsweringId:i,citationId:a.id,documentId:mo(a),...s&&{conversationId:s}})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:n=>{const r=xs(n,e);return{answerId:t??Es(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:r?.permanentid??"",title:r?.title,url:r?.clickUri}}}})},logOpenGeneratedAnswerFollowUpSource:function(e,t){return co({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(n,r)=>{const i=xs(r,e);if(!i)return null;const a=Ts(r);return a?n.makeGeneratedAnswerFollowupOpenSource({...ho(i,r),generativeQuestionAnsweringId:t,citationId:i.id,permanentId:i.permanentid,conversationId:a}):null}})},logRetryGeneratedAnswer:()=>co("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer()),logGeneratedAnswerExpand:()=>co({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{const n=Es(t);return n?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:n}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Es(e)??"",action:"expand"})}),logGeneratedAnswerCollapse:()=>co({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{const n=Es(t);return n?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:n}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Es(e)??"",action:"collapse"})})},uu=en(e=>e.advancedSearchQueries,e=>{if(!e)return{};const{aq:t,cq:n,dq:r,lq:i}=e;return{...t&&{aq:t},...n&&{cq:n},...r&&{dq:r},...i&&{lq:i}}}),lu=(e,t,n)=>({analytics:{clientId:t.clientId,clientTimestamp:(new Date).toISOString(),documentReferrer:t.referrer,documentLocation:t.location,originContext:e.originContext,...n&&{actionCause:n.actionCause},...n&&{customData:n.customData},...e.userDisplayName&&{userDisplayName:e.userDisplayName},...e.deviceId&&{deviceId:e.deviceId},...e.trackingId&&{trackingId:e.trackingId},capture:t.capture??""!==t.clientId,source:ci(e)}}),du=e=>e.context,pu=e=>e.pipeline;var fu,hu={exports:{}};var gu=(fu||(fu=1,hu.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",i="second",a="minute",s="hour",o="day",c="week",u="month",l="quarter",d="year",p="date",f="Invalid Date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m={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(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},y=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},v={s:y,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?"+":"-")+y(r,2,"0")+":"+y(i,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,u),a=n-i<0,s=t.clone().add(r+(a?-1:1),u);return+(-(r+(n-i)/(a?i-s:s-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:u,y:d,w:c,d:o,D:p,h:s,m:a,s:i,ms:r,Q:l}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},w="en",b={};b[w]=m;var S="$isDayjsObject",E=function(e){return e instanceof k||!(!e||!e[S])},_=function e(t,n,r){var i;if(!t)return w;if("string"==typeof t){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var s=t.split("-");if(!i&&s.length>1)return e(s[0])}else{var o=t.name;b[o]=t,i=o}return!r&&i&&(w=i),i||!r&&w},A=function(e,t){if(E(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new k(n)},I=v;I.l=_,I.i=E,I.w=function(e,t){return A(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var k=function(){function m(e){this.$L=_(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[S]=!0}var y=m.prototype;return y.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(I.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(h);if(r){var i=r[2]-1||0,a=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},y.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},y.$utils=function(){return I},y.isValid=function(){return!(this.$d.toString()===f)},y.isSame=function(e,t){var n=A(e);return this.startOf(t)<=n&&n<=this.endOf(t)},y.isAfter=function(e,t){return A(e)<this.startOf(t)},y.isBefore=function(e,t){return this.endOf(t)<A(e)},y.$g=function(e,t,n){return I.u(e)?this[t]:this.set(n,e)},y.unix=function(){return Math.floor(this.valueOf()/1e3)},y.valueOf=function(){return this.$d.getTime()},y.startOf=function(e,t){var n=this,r=!!I.u(t)||t,l=I.p(e),f=function(e,t){var i=I.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(o)},h=function(e,t){return I.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},g=this.$W,m=this.$M,y=this.$D,v="set"+(this.$u?"UTC":"");switch(l){case d:return r?f(1,0):f(31,11);case u:return r?f(1,m):f(0,m+1);case c:var w=this.$locale().weekStart||0,b=(g<w?g+7:g)-w;return f(r?y-b:y+(6-b),m);case o:case p:return h(v+"Hours",0);case s:return h(v+"Minutes",1);case a:return h(v+"Seconds",2);case i:return h(v+"Milliseconds",3);default:return this.clone()}},y.endOf=function(e){return this.startOf(e,!1)},y.$set=function(e,t){var n,c=I.p(e),l="set"+(this.$u?"UTC":""),f=(n={},n[o]=l+"Date",n[p]=l+"Date",n[u]=l+"Month",n[d]=l+"FullYear",n[s]=l+"Hours",n[a]=l+"Minutes",n[i]=l+"Seconds",n[r]=l+"Milliseconds",n)[c],h=c===o?this.$D+(t-this.$W):t;if(c===u||c===d){var g=this.clone().set(p,1);
vendor: 5,106 bytes, line 18
18g.$d[f](h),g.init(),this.$d=g.set(p,Math.min(this.$D,g.daysInMonth())).$d}else f&&this.$d[f](h);return this.init(),this},y.set=function(e,t){return this.clone().$set(e,t)},y.get=function(e){return this[I.p(e)]()},y.add=function(r,l){var p,f=this;r=Number(r);var h=I.p(l),g=function(e){var t=A(f);return I.w(t.date(t.date()+Math.round(e*r)),f)};if(h===u)return this.set(u,this.$M+r);if(h===d)return this.set(d,this.$y+r);if(h===o)return g(1);if(h===c)return g(7);var m=(p={},p[a]=t,p[s]=n,p[i]=e,p)[h]||1,y=this.$d.getTime()+r*m;return I.w(y,this)},y.subtract=function(e,t){return this.add(-1*e,t)},y.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||f;var r=e||"YYYY-MM-DDTHH:mm:ssZ",i=I.z(this),a=this.$H,s=this.$m,o=this.$M,c=n.weekdays,u=n.months,l=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},p=function(e){return I.s(a%12||12,e,"0")},h=l||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(g,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return I.s(t.$y,4,"0");case"M":return o+1;case"MM":return I.s(o+1,2,"0");case"MMM":return d(n.monthsShort,o,u,3);case"MMMM":return d(u,o);case"D":return t.$D;case"DD":return I.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return d(n.weekdaysMin,t.$W,c,2);case"ddd":return d(n.weekdaysShort,t.$W,c,3);case"dddd":return c[t.$W];case"H":return String(a);case"HH":return I.s(a,2,"0");case"h":return p(1);case"hh":return p(2);case"a":return h(a,s,!0);case"A":return h(a,s,!1);case"m":return String(s);case"mm":return I.s(s,2,"0");case"s":return String(t.$s);case"ss":return I.s(t.$s,2,"0");case"SSS":return I.s(t.$ms,3,"0");case"Z":return i}return null}(e)||i.replace(":","")})},y.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},y.diff=function(r,p,f){var h,g=this,m=I.p(p),y=A(r),v=(y.utcOffset()-this.utcOffset())*t,w=this-y,b=function(){return I.m(g,y)};switch(m){case d:h=b()/12;break;case u:h=b();break;case l:h=b()/3;break;case c:h=(w-v)/6048e5;break;case o:h=(w-v)/864e5;break;case s:h=w/n;break;case a:h=w/t;break;case i:h=w/e;break;default:h=w}return f?h:I.a(h)},y.daysInMonth=function(){return this.endOf(u).$D},y.$locale=function(){return b[this.$L]},y.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=_(e,t,!0);return r&&(n.$L=r),n},y.clone=function(){return I.w(this.$d,this)},y.toDate=function(){return new Date(this.valueOf())},y.toJSON=function(){return this.isValid()?this.toISOString():null},y.toISOString=function(){return this.$d.toISOString()},y.toString=function(){return this.$d.toUTCString()},m}(),T=k.prototype;return A.prototype=T,[["$ms",r],["$s",i],["$m",a],["$H",s],["$W",o],["$M",u],["$y",d],["$D",p]].forEach(function(e){T[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),A.extend=function(e,t){return e.$i||(e(t,k,A),e.$i=!0),A},A.locale=_,A.isDayjs=E,A.unix=function(e){return A(1e3*e)},A.en=b[w],A.Ls=b,A.p={},A}()),hu.exports);const mu=e(gu);var yu,vu={exports:{}};var wu,bu,Su=yu?vu.exports:(yu=1,vu.exports=(wu="month",bu="quarter",function(e,t){var n=t.prototype;n.quarter=function(e){return this.$utils().u(e)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(e-1))};var r=n.add;n.add=function(e,t){return e=Number(e),this.$utils().p(t)===bu?this.add(3*e,wu):r.bind(this)(e,t)};var i=n.startOf;n.startOf=function(e,t){var n=this.$utils(),r=!!n.u(t)||t;if(n.p(e)===bu){var a=this.quarter()-1;return r?this.month(3*a).startOf(wu).startOf("day"):this.month(3*a+2).endOf(wu).endOf("day")}return i.bind(this)(e,t)}}));const Eu=e(Su);var _u,Au={exports:{}};var Iu=(_u||(_u=1,Au.exports=function(){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,n=/\d/,r=/\d\d/,i=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,s={},o=function(e){return(e=+e)+(e>68?1900:2e3)},c=function(e){return function(t){this[e]=+t}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e)}],l=function(e){var t=s[e];return t&&(t.indexOf?t:t.s.concat(t.f))},d=function(e,t){var n,r=s.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?"pm":"PM");return n},p={A:[a,function(e){this.afternoon=d(e,!1)}],a:[a,function(e){this.afternoon=d(e,!0)}],Q:[n,function(e){this.month=3*(e-1)+1}],S:[n,function(e){this.milliseconds=100*+e}],SS:[r,function(e){this.milliseconds=10*+e}],SSS:[/\d{3}/,function(e){this.milliseconds=+e}],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:[r,c("day")],Do:[a,function(e){var t=s.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r)}],w:[i,c("week")],ww:[r,c("week")],M:[i,c("month")],MM:[r,c("month")],MM
18M:[a,function(e){var t=l("months"),n=(l("monthsShort")||t.map(function(e){return e.slice(0,3)})).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n}],MMMM:[a,function(e){var t=l("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t}],Y:[/[+-]?\d+/,c("year")],YY:[r,function(e){this.year=o(e)}],YYYY:[/\d{4}/,c("year")],Z:u,ZZ:u};function f(n){var r,i;r=n,i=s&&s.formats;for(var a=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(t,n,r){var a=r&&r.toUpperCase();return n||i[r]||e[r]||i[a].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,n){return t||n.slice(1)})})).match(t),o=a.length,c=0;c<o;c+=1){var u=a[c],l=p[u],d=l&&l[0],f=l&&l[1];a[c]=f?{regex:d,parser:f}:u.replace(/^\[|\]$/g,"")}return function(e){for(var t={},n=0,r=0;n<o;n+=1){var i=a[n];if("string"==typeof i)r+=i.length;else{var s=i.regex,c=i.parser,u=e.slice(r),l=s.exec(u)[0];c.call(t,l),e=e.replace(l,"")}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(o=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,a=e.args;this.$u=r;var o=a[1];if("string"==typeof o){var c=!0===a[2],u=!0===a[3],l=c||u,d=a[2];u&&(d=a[2]),s=this.$locale(),!c&&d&&(s=n.Ls[d]),this.$d=function(e,t,n,r){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var i=f(t)(e),a=i.year,s=i.month,o=i.day,c=i.hours,u=i.minutes,l=i.seconds,d=i.milliseconds,p=i.zone,h=i.week,g=new Date,m=o||(a||s?1:g.getDate()),y=a||g.getFullYear(),v=0;a&&!s||(v=s>0?s-1:g.getMonth());var w,b=c||0,S=u||0,E=l||0,_=d||0;return p?new Date(Date.UTC(y,v,m,b,S,E,_+60*p.offset*1e3)):n?new Date(Date.UTC(y,v,m,b,S,E,_)):(w=new Date(y,v,m,b,S,E,_),h&&(w=r(w).week(h).toDate()),w)}catch(A){return new Date("")}}(t,o,r,n),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),l&&t!=this.format(o)&&(this.$d=new Date("")),s={}}else if(o instanceof Array)for(var p=o.length,h=1;h<=p;h+=1){a[1]=o[h-1];var g=n.apply(this,a);if(g.isValid()){this.$d=g.$d,this.$L=g.$L,this.init();break}h===p&&(this.$d=new Date(""))}else i.call(this,e)}}}()),Au.exports);const ku=e(Iu);mu.extend(ku);const Tu="YYYY/MM/DD@HH:mm:ss";function Cu(e,t){const n=mu(e,t);return n.isValid()||t?n:mu(e,Tu)}function xu(e){return e.format(Tu)}function Ou(e){if(e.isBefore("1401-01-01"))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}mu.extend(Eu);const Ru=["past","now","next"],Nu=["minute","hour","day","week","month","quarter","year"];function Du(e){if("string"==typeof e&&!Fu(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);const t="string"==typeof e?Uu(e):e;new n((e=>{const t="now"===e;return{amount:new c({required:!t,min:1}),unit:new d({required:!t,constrainTo:Nu}),period:new d({required:!0,constrainTo:Ru})}})(t.period)).validate(t);const r=Mu(t),i=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${i}`);Ou(r)}function Mu(e){const{period:t,amount:n,unit:r}=e;switch(t){case"past":return mu().subtract(n,r);case"next":return mu().add(n,r);case"now":return mu()}}function Pu(e){return xu(Mu(Uu(e)))}function qu(e){return e.toLocaleLowerCase().split("-")}function Fu(e){const[t,n,r]=qu(e);if("now"===t)return!0;if(!Ru.includes(t))return!1;if(!Nu.includes(r))return!1;const i=parseInt(n,10);return!(Number.isNaN(i)||i<=0)}function Uu(e){const[t,n,r]=qu(e);return"now"===t?{period:"now"}:{period:t,amount:n?parseInt(n,10):void 0,unit:r||void 0}}function ju(e){return`start${e}`}function Lu(e){return`end${e}`}function $u(e,t){if("dateRange"===e.type){const{facetId:n,currentValues:r}=e;return t.dateFacetValueMap[n]={},{...e,currentValues:r.map(e=>function(e,t,n){let r=e.start,i=e.end;return Fu(r)&&(r=Pu(r),n.dateFacetValueMap[t][ju(r)]=e.start),Fu(i)&&(i=Pu(i),n.dateFacetValueMap[t][Lu(i)]=e.end),{...e,start:r,end:i}}(e,n,t))}}return e}function Vu(e){const t={dateFacetValueMap:{}};return{request:{...e,facets:e.facets?.map(e=>$u(e,t))},mappings:t}}function Gu(e,t){return function(e,t){return e.facetId in t.dateFacetValueMap}(e,t)?{...e,values:e.values.map(n=>function(e,t,n){return{...e,start:n.dateFacetValueMap[t][ju(e.start)]||e.start,end:n.dateFacetValueMap[t][Lu(e.end)]||e.end}}(n,e.facetId,t))}:e}function Qu(e,t){if("success"in e){return{success:{...e.success,facets:e.success.facets?.map(e=>Gu(e,t))}}}return e}function zu(e){return Object.values(e).map(e=>e.request)}function Hu(e,t){const n={};
18e.forEach(e=>{n[e.facetId]=e});const r=[];t.forEach(e=>{e in n&&(r.push(n[e]),delete n[e])});const i=Object.values(n);return[...r,...i]}function Bu(e){return zu(e).map(e=>{const t=e.currentValues.some(({state:e})=>"idle"!==e);return e.generateAutomaticRanges&&!t?{...e,currentValues:[]}:e})}const Ku={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function Yu(e){return zu(e).map(e=>{const t=Ku[e.sortCriteria];return t?{...e,sortCriteria:t}:e})}function Zu(e){return function(e){return[...Yu(e.facetSet??{}),...Bu(e.numericFacetSet??{}),...Bu(e.dateFacetSet??{}),...zu(e.categoryFacetSet??{})]}(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function Wu(e){return Hu(Zu(e),e.facetOrder??[])}const Ju=5e3,Xu=async(e,t)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??te(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:oi.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&&await js(e.configuration.analytics,t),...e.excerptLength&&!a(e.excerptLength.length)&&{excerptLength:e.excerptLength.length},...e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}}),el=(e,t,n)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??te(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&&lu(e.configuration.analytics,t,n),...e.excerptLength&&!a(e.excerptLength.length)&&{excerptLength:e.excerptLength.length},...e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}}),tl=en(e=>e.staticFilterSet,e=>Object.values(e||{}).map(e=>{const t=e.values.filter(e=>"selected"===e.state&&!!e.expression.trim()),n=t.map(e=>e.expression).join(" OR ");return t.length>1?`(${n})`:n})),nl=async(e,t,n)=>{const r=ol(e),i=function(e){return Hu(function(e){return function(e){return[...al(e.facetSet??{}),...sl(e.numericFacetSet??{}),...sl(e.dateFacetSet??{}),...zu(e.categoryFacetSet??{})]}(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}(e),e.facetOrder??[])}(e),a=function(e){const t=e.automaticFacetSet?.set;return t?Object.values(t).map(e=>e.response).map(il).filter(e=>e.currentValues.length>0):void 0}(e);return Vu({..."legacy"===e.configuration.analytics.analyticsMode?await Xu(e,n):el(e,t,n),...e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&"next"===e.didYouMean.queryCorrectionMode,options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&"legacy"===e.didYouMean.queryCorrectionMode}
18,...r&&{cq:r},...i.length&&{facets:i},...e.pagination&&{numberOfResults:rl(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:a}},...e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}}})};function rl(e){if(!e.pagination)return;return e.pagination.firstResult+e.pagination.numberOfResults>Ju?Ju-e.pagination.firstResult:e.pagination.numberOfResults}function il(e){const{field:t,label:n,values:r}=e;return{field:t,label:n,currentValues:r.filter(e=>"selected"===e.state)}}function al(e){return zu(e).map(e=>{const t=Ku[e.sortCriteria];return t?{...e,sortCriteria:t}:e})}function sl(e){return zu(e).map(e=>{const t=e.currentValues,n=t.some(({state:e})=>"idle"!==e),r=t.some(e=>e.previousState);return!e.generateAutomaticRanges||n||r?e:{...e,currentValues:[]}})}function ol(e){const t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(e=>e.isActive);return[t,n?.expression.trim()||"",...tl(e)].filter(e=>!!e).join(" AND ")}const cl=(e,t)=>{const n=e;return a(n[t])?a(e.raw[t])?null:e.raw[t]:n[t]},ul=(e,t)=>
18{const n=cl(t,e);return r=n,Array.isArray(r)?n:[n];var r},ll={getResultProperty:cl,fieldsMustBeDefined:e=>t=>e.every(e=>!a(cl(t,e))),fieldsMustNotBeDefined:e=>t=>e.every(e=>a(cl(t,e))),fieldMustMatch:(e,t)=>n=>{const r=ul(e,n);return t.some(e=>r.some(t=>`${t}`.toLowerCase()===e.toLowerCase()))},fieldMustNotMatch:(e,t)=>n=>{const r=ul(e,n);return t.every(e=>r.every(t=>`${t}`.toLowerCase()!==e.toLowerCase()))}},dl=en(e=>e.search,e=>e?.searchAction?.actionCause||""),pl=e=>e.searchHub,fl=en(e=>e,e=>{if(!e)return"";for(const t in e)if(e[t].isActive)return e[t].id;return""});en(e=>e,e=>{const t=fl(e);return t&&e?e[t].expression:""});const hl=(e,t)=>{const n=ru(e)?.q,{aq:r,cq:i,dq:a,lq:s}=yl(e),o=du(e),c=lu(e.configuration.analytics,t,{actionCause:dl(e)}),u=pl(e),l=pu(e),d=ks(e)??[],p=gl(e),f=fl(e.tabSet)||"default",h=bs(e),g=(e=>e.configuration.search.timezone)(e),m=t.referrer||"",y=(e=>{const{freezeFacetOrder:t}=e.facetOptions??{};return void 0!==t?{freezeFacetOrder:t}:void 0})(e),v=(e=>e.sortCriteria)(e),w=ml(e),b=(e=>e.excerptLength?.length)(e),S=(e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}})(e),E=(e=>{if(e.dictionaryFieldContext&&Object.keys(e.dictionaryFieldContext.contextValues).length)return e.dictionaryFieldContext.contextValues})(e);return{q:n,...r&&{aq:r},...i&&{cq:i},...a&&{dq:a},...s&&{lq:s},...e.query&&{enableQuerySyntax:iu(e)},...o?.contextValues&&{context:o.contextValues},pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:d}},...u?.length&&{searchHub:u},...l?.length&&{pipeline:l},...p.length&&{facets:p},...e.fields&&{fieldsToInclude:e.fields.fieldsToInclude},...e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&"next"===e.didYouMean.queryCorrectionMode,options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&"legacy"===e.didYouMean.queryCorrectionMode},...e.pagination&&{numberOfResults:rl(e),firstResult:e.pagination.firstResult},tab:f,locale:h,timezone:g,...void 0!==e.debug&&{debug:e.debug},referrer:m,...w,...S??{},...b&&{excerptLength:b},...E&&{dictionaryFieldContext:E},sortCriteria:v,...y&&{facetOptions:y},...c,...e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext}}},gl=e=>Wu(e)?.map(e=>$u(e,{dateFacetValueMap:{}})).sort((e,t)=>e.facetId>t.facetId?1:t.facetId>e.facetId?-1:0),ml=e=>({actionsHistory:e.configuration.analytics.enabled?oi.getInstance().getHistory():[]}),yl=e=>{const t=uu(e),n=ol(e);return{...t,...n&&{cq:n}}},vl=["searching","thinking","answering"];function wl(e){return e.toLowerCase()}const bl=["search","generic"],Sl=new d({required:!0}),El=new d,_l=new s({required:!0}),Al={id:Sl,title:Sl,uri:Sl,permanentid:Sl,clickUri:El},Il=new d({required:!0,constrainTo:["text/plain","text/markdown"]}),kl=new d({required:!0,constrainTo:vl}),Tl=e=>({...e,name:wl(e.name)});sn("generatedAnswer/setIsVisible",e=>Tr(e,_l));const Cl=sn("generatedAnswer/setAnswerId",e=>Tr(e,wr));sn("generatedAnswer/setAnswerGenerationMode",e=>Tr(e,new d({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),sn("generatedAnswer/setIsEnabled",e=>Tr(e,_l));const xl=sn("generatedAnswer/updateMessage",e=>Tr(e,{textDelta:Sl})),Ol=sn("generatedAnswer/updateCitations",e=>Tr(e,{citations:new g({required:!0,each:new f({values:Al})})})),Rl=sn("generatedAnswer/updateError",e=>Tr(e,{message:El,code:new c({min:0})})),Nl=sn("generatedAnswer/resetAnswer");sn("generatedAnswer/like"),sn("generatedAnswer/dislike"),sn("generatedAnswer/feedbackModal/open"),sn("generatedAnswer/expand"),sn("generatedAnswer/collapse"),sn("generatedAnswer/setId",e=>Tr(e,{id:new d({required:!0})})),sn("generatedAnswer/feedbackModal/close"),sn("generatedAnswer/sendFeedback");const Dl=sn("generatedAnswer/setIsLoading",e=>Tr(e,_l)),Ml=sn("generatedAnswer/setIsStreaming",e=>Tr(e,_l)),Pl=sn("generatedAnswer/setAnswerContentFormat",e=>Tr(e,Il));sn("generatedAnswer/updateResponseFormat",e=>Tr(e,{contentFormat:new g({each:Il,default:["text/plain"]})})),sn("knowledge/updateAnswerConfigurationId",e=>Tr(e,Sl)),sn("generatedAnswer/registerFieldsToIncludeInCitations",e=>Tr(e,Er));const ql=sn("generatedAnswer/setIsAnswerGenerated",e=>Tr(e,_l)),Fl=sn("generatedAnswer/setCannotAnswer",e=>Tr(e,_l)),Ul=sn("generatedAnswer/setAnswerApiQueryParams",e=>Tr(e,new f({}))),jl=sn("generatedAnswer/startStep",e=>Tr(Tl(e),{name:kl,startedAt:new c({min:0,required:!0})})),Ll=sn("generatedAnswer/finishStep",e=>Tr(Tl(e),{name:kl,finishedAt:new c({min:0,required:!0})})),$l=sn("generatedAnswer/startToolCall",e=>Tr(e,{toolCallName:wr,startedAt:new c({min:0,required:!0}),toolCallId:wr})),Vl=sn("generatedAnswer/finishToolCall",e=>Tr(e,{finishedAt:new c({min:0,required:!0}),toolCallId:wr})),Gl=sn("generatedAnswer/toolCallArgs",e=>Tr(e,{toolCallId:wr,args:new f({options:{required:!0}}),type:new d({required:!0,constrainTo:bl})}));var Ql,zl;function Hl(e){let t,n,r,i=!1;return function(a){void 0===t?(t=a,n=0,r=-1):t=function(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}(t,a);const s=t.length;let o=0;for(;n<s;){i&&(t[n]===Ql.NewLine&&(o=++n),i=!1);let a=-1;for(;n<s&&-1===a;++n)switch(t[n]){case Ql.Colon:-1===r&&(r=n-o);break;case Ql.CarriageReturn:i=!0,a=n;break;case Ql.NewLine:a=n}if(-1===a)break;e(t.subarray(o,a),r),o=n,r=-1}o===s?t=void 0:0!==o&&(t=t.subarray(o),n-=o)}}function Bl(e,t,n){let r={data:"",event:"",id:"",retry:void 0};const i=new TextDecoder;return function(a,s){if(0===a.length)n?.(r),r={data:"",event:"",id:"",retry:void 0};else if(s>0){const n=i.decode(a.subarray(0,s)),o=s+(a[s+1]===Ql.Space?2:1),c=i.decode(a.subarray(o));switch(n){case"data":r.data=r.data?`${r.data}\n${c}`:c;break;case"event":r.event=c;break;case"id":e(r.id=c);break;case"retry":!function(e,t,n){const r=parseInt(e,10);Number.isNaN(r)||n(t.retry=r)}
18(c,r,t)}}}}Dn("generatedAnswer/streamAnswer",async(e,t)=>{const n=t.getState(),{dispatch:r,extra:i,getState:a}=t,{generatedAnswerAnalyticsClient:s}=i,{search:o}=a(),{queryExecuted:c}=o,{setAbortControllerRef:u}=e,l=await(async e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:ee(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}))(n);r(Dl(!0));const d=e=>e.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,p=i.streamingClient?.streamGeneratedAnswer(l,{write:e=>{d(l)&&(r(Dl(!1)),e.payload&&e.payloadType&&((e,t)=>{switch(e){case"genqa.headerMessageType":{const e=JSON.parse(t);r(Pl(e.contentFormat));break}case"genqa.messageType":r(xl(JSON.parse(t)));break;case"genqa.citationsType":r(Ol(JSON.parse(t)));break;case"genqa.endOfStreamType":{const e=JSON.parse(t).answerGenerated,{answerId:n,answer:i}=a().generatedAnswer,o=0!==c.length&&!e,u=!i?.trim();r(Fl(o)),r(Ml(!1)),r(ql(e)),r((s??cu).logGeneratedAnswerStreamEnd(e,n,e?u:void 0)),r(ou());break}default:n.debug&&i.logger.warn(`Unknown payloadType: "${e}"`)}})(e.payloadType,e.payload))},abort:e=>{d(l)&&r(Rl(e))},close:()=>{d(l)&&r(Ml(!1))},resetAnswer:()=>{d(l)&&r(Nl())}});p?u(p):r(Dl(!1))}),Dn("generatedAnswer/generateAnswer",async(e,{getState:t,dispatch:n,extra:{navigatorContext:r,logger:i}})=>{n(Nl());const a=t();if(!1!==a.generatedAnswer.isEnabled)if(a.generatedAnswer.answerConfigurationId){const e=hl(a,r);n(Ul(e)),await n(td(e))}else i.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.");else i.warn("[WARNING] The generateAnswer action was dispatched while the generated answer is disabled. No answer will be generated. Enable the generated answer before dispatching generateAnswer.")}),(zl=Ql||(Ql={}))[zl.NewLine=10]="NewLine",zl[zl.CarriageReturn=13]="CarriageReturn",zl[zl.Space=32]="Space",zl[zl.Colon=58]="Colon";const Kl="text/event-stream",Yl="last-event-id";function Zl(){return"undefined"!=typeof window}function Wl(e){const t=e.headers.get("content-type");if(!t?.startsWith(Kl))throw new Error(`Expected content-type to be ${Kl}, Actual: ${t}`)}const Jl=nu({reducerPath:"answer",baseQuery:sc(async(e,t,n)=>{const r=t.getState(),{accessToken:i,environment:a,organizationId:s}=r.configuration,o=r.generatedAnswer.answerConfigurationId,c={...e,headers:{...e?.headers||{},Authorization:`Bearer ${i}`}};try{return Xo({baseUrl:`${ee(r.configuration.search?.apiBaseUrl,s,a)}/rest/organizations/${s}/answer/v1/configs/${o}`})(c,t,n)}catch(u){return{error:u}}},{maxRetries:3}),endpoints:()=>({})}),Xl=(e,t,n,r)=>{const i=JSON.parse(e.data);"ERROR"===i.finishReason&&i.errorMessage&&((e,t)=>{const n=t.errorMessage||"Unknown error occurred";e.error={message:n,code:t.code},e.isStreaming=!1,e.isLoading=!1,console.error(`Generated answer error: ${n} (code: ${t.code})`)})(t,i);const a=i.payload.length?JSON.parse(i.payload):{};switch(i.payloadType){case"genqa.headerMessageType":a.contentFormat&&(((e,t)=>{const{contentFormat:n}=t;e.contentFormat=n,e.isStreaming=!0,e.isLoading=!1})(t,a),n(Pl(a.contentFormat)));break;case"genqa.messageType":"string"==typeof a.textDelta&&(((e,t)=>{const{textDelta:n}=t;if("string"!=typeof n)return;const r=e.answer;(r?.trim()||n.trim())&&(delete e.error,e.answer=r?.trim()?r.concat(n):n)})(t,a),n(xl({textDelta:a.textDelta})));break;case"genqa.citationsType":a.citations&&(((e,t)=>{delete e.error,e.citations=t.citations})(t,a),n(Ol({citations:a.citations})));break;case"genqa.endOfStreamType":{((e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1})(t,a);const e=t.answerId,i=a.answerGenerated??!1,s=i?!t.answer?.trim():void 0;n(r.logGeneratedAnswerStreamEnd(i,e,s)),n(ou());break}}},ed=Jl.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:e,queryArgs:t})=>{const{analytics:n,...r}=t;return`${e}(${JSON.stringify(r)})`},async onCacheEntryAdded(e,{getState:t,cacheDataLoaded:n,updateCachedData:r,dispatch:i,extra:a}){await n;const{configuration:s,generatedAnswer:o,insightConfiguration:c}=t(),{generatedAnswerAnalyticsClient:u}=await a,{organizationId:l,environment:d,accessToken:p}=s,f=((e,t,n,r)=>{if(!e||!t||!n)throw new Error("Missing required parameters for answer endpoint");return`${e}/rest/organizations/${t}/${r?`insight/v1/configs/${r}/answer`:"answer/v1/configs"}/${n}/generate`})(ee(s.search.apiBaseUrl,l,d),l,o.answerConfigurationId,c?.insightId);await function(e,{signal:t,headers:n,onopen:r,onmessage:i,onclose:a,onerror:s,openWhenHidden:o,fetch:c,...u}){return new Promise((l,d)=>{const p={...n};let f;function h(){f?.abort(),document.hidden||b()}p.accept||(p.accept=Kl),!o&&Zl()&&document.addEventListener("visibilitychange",h);let g,m=1e3;function y(){Zl()&&document.removeEventListener("visibilitychange",h),clearTimeout(g),f?.abort()}t?.addEventListener("abort",()=>{y(),l()});const v=c??fetch,w=r??Wl;async function b(){f=AbortController?new AbortController:null;try{const t=await v(e,{...u,headers:p,signal:f?.signal});await w(t),await async function(e,t){const n=e.getReader();let r;for(;!(r=await n.read()).done;)t(r.value)}(t.body,Hl(Bl(e=>{e?p[Yl]=e:delete p[Yl]},e=>{m=e},i))),a?.(),y(),l()}catch(t){if(!f?.signal?.aborted)try{const e=s?.(t)??m;clearTimeout(g),g=setTimeout(b,e)}catch(n){y(),d(n)}}}b()})}(f,{method:"POST",body:JSON.stringify(e),headers:{Authorization:`Bearer ${p}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:fetch,onopen:async e=>{const t=e.headers.get("x-answer-id");t&&r(e=>{e.answerId=t,i(Cl(t))})},onmessage:e=>{r(t=>{Xl(e,t,i,u??cu)})},onerror:e=>{throw e},onclose:()=>{r(e=>{i(Fl(!e.generated))})}})}})})}),td=e=>ed.endpoints.getAnswer.initiate(e),nd=mn(xr,e=>e);function rd(e){return"type"in e}const id=e=>t=>n=>{let r;(function(e){const t=e.payload?.analyticsAction;return rd(e)&&!a(t)})(n)&&(r=n.payload.analyticsAction,delete n.payload.analyticsAction);const i=t(n);return rd(n)&&("search/executeSearch/fullfilled"===n.type&&void 0===r&&console.error("No anal
18ytics action associated with search:",n),"recommendation/get/fullfilled"===n.type&&void 0===r&&console.error("No analytics action associated with recommendation:",n),"productRecommendations/get/fullfilled"===n.type&&void 0===r&&console.error("No analytics action associated with product recommendation:",n)),void 0!==r&&e.dispatch(r),i};sn("tab/register",e=>{const t=new f({values:{id:wr,expression:Sr}});return Tr(e,t)});const ad=sn("tab/updateActiveTab",e=>Tr(e,wr));var sd,od={exports:{}};var cd=(sd||(sd=1,od.exports=function(){var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(n,r,i){var a,s=function(e,n,r){void 0===r&&(r={});var i=new Date(e);return function(e,n){void 0===n&&(n={});var r=n.timeZoneName||"short",i=e+"|"+r,a=t[i];return a||(a=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:r}),t[i]=a),a}(n,r).formatToParts(i)},o=function(t,n){for(var r=s(t,n),a=[],o=0;o<r.length;o+=1){var c=r[o],u=c.type,l=c.value,d=e[u];d>=0&&(a[d]=parseInt(l,10))}var p=a[3],f=24===p?0:p,h=a[0]+"-"+a[1]+"-"+a[2]+" "+f+":"+a[4]+":"+a[5]+":000",g=+t;return(i.utc(h).valueOf()-(g-=g%1e3))/6e4},c=r.prototype;c.tz=function(e,t){void 0===e&&(e=a);var n,r=this.utcOffset(),s=this.toDate(),o=s.toLocaleString("en-US",{timeZone:e}),c=Math.round((s-new Date(o))/1e3/60),u=15*-Math.round(s.getTimezoneOffset()/15)-c;if(Number(u)){if(n=i(o,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(u,!0),t){var l=n.utcOffset();n=n.add(r-l,"minute")}}else n=this.utcOffset(0,t);return n.$x.$timezone=e,n},c.offsetName=function(e){var t=this.$x.$timezone||i.tz.guess(),n=s(this.valueOf(),t,{timeZoneName:e}).find(function(e){return"timezonename"===e.type.toLowerCase()});return n&&n.value};var u=c.startOf;c.startOf=function(e,t){if(!this.$x||!this.$x.$timezone)return u.call(this,e,t);var n=i(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return u.call(n,e,t).tz(this.$x.$timezone,!0)},i.tz=function(e,t,n){var r=n&&t,s=n||t||a,c=o(+i(),s);if("string"!=typeof e)return i(e).tz(s);var u=function(e,t,n){var r=e-60*t*1e3,i=o(r,n);if(t===i)return[r,t];var a=o(r-=60*(i-t)*1e3,n);return i===a?[r,i]:[e-60*Math.min(i,a)*1e3,Math.max(i,a)]}(i.utc(e,r).valueOf(),c,s),l=u[0],d=u[1],p=i(l).utcOffset(d);return p.$x.$timezone=s,p},i.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},i.tz.setDefault=function(e){a=e}}}()),od.exports);const ud=e(cd);var ld,dd={exports:{}};var pd=(ld||(ld=1,dd.exports=function(){var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(r,i,a){var s=i.prototype;a.utc=function(e){return new i({date:e,utc:!0,args:arguments})},s.utc=function(t){var n=a(this.toDate(),{locale:this.$L,utc:!0});return t?n.add(this.utcOffset(),e):n},s.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var o=s.parse;s.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),o.call(this,e)};var c=s.init;s.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else c.call(this)};var u=s.utcOffset;s.utcOffset=function(r,i){var a=this.$utils().u;if(a(r))return this.$u?0:a(this.$offset)?u.call(this):this.$offset;if("string"==typeof r&&null===(r=function(e){void 0===e&&(e="");var r=e.match(t);if(!r)return null;var i=(""+r[0]).match(n)||["-",0,0],a=i[0],s=60*+i[1]+ +i[2];return 0===s?0:"+"===a?s:-s}(r)))return this;var s=Math.abs(r)<=16?60*r:r;if(0===s)return this.utc(i);var o=this.clone();if(i)return o.$offset=s,o.$u=!1,o;var c=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(o=this.local().add(s+c,e)).$offset=s,o.$x.$localOffset=c,o};var l=s.format;s.format=function(e){var t=e||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return l.call(this,t)},s.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*e},s.isUTC=function(){return!!this.$u},s.toISOString=function(){return this.toDate().toISOString()},s.toString=function(){return this.toDate().toUTCString()};var d=s.toDate;s.toDate=function(e){return"s"===e&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():d.call(this)};var p=s.diff;s.diff=function(e,t,n){if(e&&this.$u===e.$u)return p.call(this,e,t,n);var r=this.local(),i=a(e).local();return p.call(r,i,t,n)}}}
18()),dd.exports);const fd=e(pd);mu.extend(fd),mu.extend(ud);const hd=/(^|; )Coveo-Pendragon=([^;]*)/,gd=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;const md=mn({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:mu.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"},e=>e.addCase(Nr,(e,t)=>{!function(e,t){a(t.accessToken)||(e.accessToken=t.accessToken);e.environment=t.environment??"prod",a(t.organizationId)||(e.organizationId=t.organizationId)}(e,t.payload)}).addCase(Dr,(e,t)=>{!function(e,t){a(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl);a(t.locale)||(e.search.locale=t.locale);a(t.timezone)||(e.search.timezone=t.timezone);a(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}(e,t.payload)}).addCase(Pr,(e,t)=>{!function(e,t){a(t.enabled)||(e.analytics.enabled=t.enabled);a(t.originContext)||(e.analytics.originContext=t.originContext);a(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2);a(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3);a(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl);a(t.trackingId)||(e.analytics.trackingId=t.trackingId);a(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode);a(t.source)||(e.analytics.source=t.source);try{const t="undefined"!=typeof window&&(hd.exec(document.cookie)?.pop()||null);t&&(e.analytics.analyticsMode="next",e.analytics.trackingId=t)}catch(n){}a(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment);a(t.anonymous)||(e.analytics.anonymous=t.anonymous);a(t.deviceId)||(e.analytics.deviceId=t.deviceId);a(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName);a(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}(e,t.payload)}).addCase(qr,e=>{e.analytics.enabled=!1}).addCase(Fr,e=>{e.analytics.enabled=!0}).addCase(Ur,(e,t)=>{e.analytics.originLevel2=t.payload.originLevel2}).addCase(jr,(e,t)=>{e.analytics.originLevel3=t.payload.originLevel3}).addCase(ad,(e,t)=>{e.analytics.originLevel2=t.payload}).addCase(Gr,(e,t)=>{e.analytics.originLevel2=t.payload}).addCase(Vr,(e,t)=>{a(t.payload.tab)||(e.analytics.originLevel2=t.payload.tab)}).addCase(Lr,(e,{payload:t})=>{!function(e,t){e.knowledge.agentId=t;try{"undefined"!=typeof window&&gd.test(document.cookie)&&(e.knowledge.debugAgentSession=!0)}catch(n){}}(e,t)}));const yd=()=>e=>t=>e(function(e){return e.instantlyCallable}(t)?t():t),vd=[];for(let QS=0;QS<256;++QS)vd.push((QS+256).toString(16).slice(1));let wd;const bd=new Uint8Array(16);const Sd={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ed(e,t,n){if(Sd.randomUUID&&!e)return Sd.randomUUID();const r=(e=e||{}).random??e.rng?.()??function(){if(!wd){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");wd=crypto.getRandomValues.bind(crypto)}return wd(bd)}();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(e,t=0){return(vd[e[t+0]]+vd[e[t+1]]+vd[e[t+2]]+vd[e[t+3]]+"-"+vd[e[t+4]]+vd[e[t+5]]+"-"+vd[e[t+6]]+vd[e[t+7]]+"-"+vd[e[t+8]]+vd[e[t+9]]+"-"+vd[e[t+10]]+vd[e[t+11]]+vd[e[t+12]]+vd[e[t+13]]+vd[e[t+14]]+vd[e[t+15]]).toLowerCase()}(r)}var _d,Ad,Id;(Ad=_d||(_d={})).assertEqual=e=>{},Ad.assertIs=function(e){},Ad.assertNever=function(e){throw new Error},Ad.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},Ad.getValidEnumValues=e=>{const t=Ad.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),n={};for(const r of t)n[r]=e[r];return Ad.objectValues(n)},Ad.objectValues=e=>Ad.objectKeys(e).map(function(t){return e[t]}),Ad.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},Ad.find=(e,t)=>{for(const n of e)if(t(n))return n},Ad.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,Ad.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},Ad.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(Id||(Id={})).mergeShapes=(e,t)=>({...e,...t});const kd=_d.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Td=e=>{switch(typeof e){case"undefined":return kd.undefined;case"string":return kd.string;case"number":return Number.isNaN(e)?kd.nan:kd.number;case"boolean":return kd.boolean;case"function":return kd.function;case"bigint":return kd.bigint;case"symbol":return kd.symbol;case"object":return Array.isArray(e)?kd.array:null===e?kd.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?kd.promise:"undefined"!=typeof Map&&e instanceof Map?kd.map:"undefined"!=typeof Set&&e instanceof Set?kd.set:"undefined"!=typeof Date&&e instanceof Date?kd.date:kd.object;default:return kd.unknown}}
vendor: 11,610 bytes, line 18
18,Cd=_d.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"]);class xd extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(r);else if("invalid_return_type"===i.code)r(i.returnTypeError);else if("invalid_arguments"===i.code)r(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){const n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof xd))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_d.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)if(r.path.length>0){const n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}xd.create=e=>new xd(e);const Od=(e,t)=>{let n;switch(e.code){case Cd.invalid_type:n=e.received===kd.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Cd.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,_d.jsonStringifyReplacer)}`;break;case Cd.unrecognized_keys:n=`Unrecognized key(s) in object: ${_d.joinValues(e.keys,", ")}`;break;case Cd.invalid_union:n="Invalid input";break;case Cd.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${_d.joinValues(e.options)}`;break;case Cd.invalid_enum_value:n=`Invalid enum value. Expected ${_d.joinValues(e.options)}, received '${e.received}'`;break;case Cd.invalid_arguments:n="Invalid function arguments";break;case Cd.invalid_return_type:n="Invalid function return type";break;case Cd.invalid_date:n="Invalid date";break;case Cd.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:_d.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Cd.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Cd.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Cd.custom:n="Invalid input";break;case Cd.invalid_intersection_types:n="Intersection results could not be merged";break;case Cd.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Cd.not_finite:n="Number must be finite";break;default:n=t.defaultError,_d.assertNever(e)}return{message:n}};let Rd=Od;function Nd(e,t){const n=Rd,r=(e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],s={...i,path:a};if(void 0!==i.message)return{...i,path:a,message:i.message};let o="";const c=r.filter(e=>!!e).slice().reverse();for(const u of c)o=u(s,{data:t,defaultError:o}).message;return{...i,path:a,message:o}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Od?void 0:Od].filter(e=>!!e)});e.common.issues.push(r)}class Dd{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return Md;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const e=await r.key,t=await r.value;n.push({key:e,value:t})}return Dd.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:i}=r;if("aborted"===t.status)return Md;if("aborted"===i.status)return Md;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!r.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const Md=Object.freeze({status:"aborted"}),Pd=e=>({status:"dirty",value:e}),qd=e=>({status:"valid",value:e}),Fd=e=>"aborted"===e.status,Ud=e=>"dirty"===e.status,jd=e=>"valid"===e.status,Ld=e=>"undefined"!=typeof Promise&&e instanceof Promise;var $d,Vd;(Vd=$d||($d={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},Vd.toString=e=>"string"==typeof e?e:e?.message;class Gd{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}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}}const Qd=(e,t)=>{if(jd(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;const t=new xd(e.common.issues);return this._error=t,this._error}}};function zd(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{const{message:a}=e;return"invalid_enum_value"===t.code?{message:a??i.defaultError}:void 0===i.data?{message:a??r??i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:a??n??i.defaultError}},description:i}}class Hd{get description(){return this._def.description}_getType(e){return Td(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Td(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Dd,ctx:{common:e.parent.common,data:e.data,parsedType:Td(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Ld(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Td(e)},r=this._parseSync({data:e,path:n.path,parent:n});return Qd(n,r)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Td(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return jd(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>jd(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Td(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(Ld(r)?r:Promise.resolve(r));return Qd(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{const i=e(t),a=()=>r.addIssue({code:Cd.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(a(),!1)):!!i||(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1))}_refinement(e){return new Bp({schema:this,typeName:nf.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,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:e=>this["~validate"](e)}}optional(){return Kp.create(this,this._def)}nullable(){return Yp.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xp.create(this)}promise(){return Hp.create(this,this._def)}or(e){return Np.create([this,e],this._def)}and(e){return qp.create(this,e,this._def)}transform(e){return new Bp({...zd(this._def),schema:this,typeName:nf.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Zp({...zd(this._def),innerType:this,defaultValue:t,typeName:nf.ZodDefault})}brand(){return new Xp({typeName:nf.ZodBranded,type:this,...zd(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Wp({...zd(this._def),innerType:this,catchValue:t,typeName:nf.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ef.create(this,e)}readonly(){return tf.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Bd=/^c[^\s-]{8,}
18$/i,Kd=/^[0-9a-z]+$/,Yd=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Zd=/^[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,Wd=/^[a-z0-9_-]{21}$/i,Jd=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Xd=/^[-+]?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)?)??$/,ep=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let tp;const np=/^(?:(?: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])$/,rp=/^(?:(?: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])$/,ip=/^(([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]))$/,ap=/^(([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])$/,sp=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,op=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cp="((\\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])))",up=new RegExp(`^${cp}$`);function lp(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function dp(e){return new RegExp(`^${lp(e)}$`)}function pp(e){let t=`${cp}T${lp(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function fp(e,t){return!("v4"!==t&&t||!np.test(e))||!("v6"!==t&&t||!ip.test(e))}function hp(e,t){if(!Jd.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return"object"==typeof i&&null!==i&&((!("typ"in i)||"JWT"===i?.typ)&&(!!i.alg&&(!t||i.alg===t)))}catch{return!1}}function gp(e,t){return!("v4"!==t&&t||!rp.test(e))||!("v6"!==t&&t||!ap.test(e))}class mp extends Hd{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==kd.string){const t=this._getOrReturnCtx(e);return Nd(t,{code:Cd.invalid_type,expected:kd.string,received:t.parsedType}),Md}const t=new Dd;let n;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),Nd(n,{code:Cd.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),Nd(n,{code:Cd.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?Nd(n,{code:Cd.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):a&&Nd(n,{code:Cd.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)ep.test(e.data)||(n=this._getOrReturnCtx(e,n),Nd(n,{validation:"email",code:Cd.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)tp||(tp=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),tp.test(e.data)||(n=this._getOrReturnCtx(e,n),Nd(n,{validation:"emoji",code:Cd.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)Zd.test(e.data)||(n=this._getOrReturnCtx(e,n),Nd(n,{validation:"uuid",code:Cd.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)Wd.test(e.data)||(n=this._getOrReturnCtx(e,n),Nd(n,{validation:"nanoid",code:Cd.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)Bd.test(e.data)||(n=this._getOrReturnCtx(e,n),Nd(n,{validation:"cuid",code:Cd.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)Kd.test(e.data)||(n=this._getOrReturnCtx(e,n),Nd(n,{validation:"cuid2",code:Cd.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)Yd.test(e.data)||(n=this._getOrReturnCtx(e,n),Nd(n,{validation:"ulid",code:Cd.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),Nd(n,{validation:"url",code:Cd.invalid_string,message:r.message}),t.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Nd(n,{validation:"regex",code:Cd.invalid_string,message:r.message}),t.dirty())}else if("trim"===r.kind)e.data=e.data.trim();else if("includes"===r.kind)e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),Nd(n,{code:Cd.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty());else if("toLowerCase"===r.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===r.kind)e.data=e.data.toUpperCase();else if("startsWith"===r.kind)e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),Nd(n,{code:Cd.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty());else if("endsWith"===r.kind)e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),Nd(n,{code:Cd.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty());else if("datetime"===r.kind){pp(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Nd(n,{code:Cd.invalid_string,validation:"datetime",message:r.message}),t.dirty())}else if("date"===r.kind){up.test(e.data)||(n=this._getOrReturnCtx(e,n),Nd(n,{code:Cd.invalid_string,validation:"date",message:r.message}),t.dirty())}else if("time"===r.kind){dp(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Nd(n,{code:Cd.invalid_string,validation:"time",message:r.message}),t.dirty())}else"duration"===r.kind?Xd.test(e.data)||(n=this._getOrReturnCtx(e,n),Nd(n,{validation:"duration",code:Cd.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?fp(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Nd(n,{validation:"ip",code:Cd.invalid_string,message:r.message}),t.dirty()):"jwt"===r.kind?hp(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),Nd(n,{validation:"jwt",code:Cd.invalid_string,message:r.message}),t.dirty()):"cidr"===r.kind?gp(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Nd(n,{validation:"cidr",code:Cd.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?sp.test(e.data)||(n=this._getOrReturnCtx(e,n),Nd(n,{validation:"base64",code:Cd.invalid_string,message:r.message}),t.dirty()):"base64url"===r.kind?op.test(e.data)||(n=this._getOrReturnCtx(e,n),Nd(n,{validation:"base64url",code:Cd.invalid_string,message:r.message}),t.dirty()):_d.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:Cd.invalid_string,...$d.errToObj(n)})}_addCheck(e){return new mp({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...$d.errToObj(e)})}url(e){return this._addCheck({kind:"url",...$d.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...$d.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...$d.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...$d.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...$d.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...$d.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...$d.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...$d.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...$d.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...$d.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...$d.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...$d.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...$d.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...$d.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...$d.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...$d.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...$d.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...$d.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...$d.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...$d.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...$d.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...$d.errToObj(t)})}nonempty(e){return this.min(1,$d.errToObj(e))}trim(){return new mp({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new mp({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new mp({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}
18get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function yp(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}mp.create=e=>new mp({checks:[],typeName:nf.ZodString,coerce:e?.coerce??!1,...zd(e)});class vp extends Hd{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==kd.number){const t=this._getOrReturnCtx(e);return Nd(t,{code:Cd.invalid_type,expected:kd.number,received:t.parsedType}),Md}let t;const n=new Dd;for(const r of this._def.checks)if("int"===r.kind)_d.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Nd(t,{code:Cd.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Nd(t,{code:Cd.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Nd(t,{code:Cd.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==yp(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),Nd(t,{code:Cd.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Nd(t,{code:Cd.not_finite,message:r.message}),n.dirty()):_d.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,$d.toString(t))}gt(e,t){return this.setLimit("min",e,!1,$d.toString(t))}lte(e,t){return this.setLimit("max",e,!0,$d.toString(t))}lt(e,t){return this.setLimit("max",e,!1,$d.toString(t))}setLimit(e,t,n,r){return new vp({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:$d.toString(r)}]})}_addCheck(e){return new vp({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:$d.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:$d.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:$d.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:$d.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:$d.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:$d.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:$d.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:$d.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:$d.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&_d.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}vp.create=e=>new vp({checks:[],typeName:nf.ZodNumber,coerce:e?.coerce||!1,...zd(e)});class wp extends Hd{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==kd.bigint)return this._getInvalidInput(e);let t;const n=new Dd;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Nd(t,{code:Cd.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Nd(t,{code:Cd.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Nd(t,{code:Cd.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):_d.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Nd(t,{code:Cd.invalid_type,expected:kd.bigint,received:t.parsedType}),Md}gte(e,t){return this.setLimit("min",e,!0,$d.toString(t))}gt(e,t){return this.setLimit("min",e,!1,$d.toString(t))}lte(e,t){return this.setLimit("max",e,!0,$d.toString(t))}lt(e,t){return this.setLimit("max",e,!1,$d.toString(t))}setLimit(e,t,n,r){return new wp({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:$d.toString(r)}]})}_addCheck(e){return new wp({...this._def,checks:[...this._def.checks,e]})}
vendor: 5,106 bytes, line 18
18positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:$d.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:$d.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:$d.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:$d.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:$d.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}wp.create=e=>new wp({checks:[],typeName:nf.ZodBigInt,coerce:e?.coerce??!1,...zd(e)});class bp extends Hd{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==kd.boolean){const t=this._getOrReturnCtx(e);return Nd(t,{code:Cd.invalid_type,expected:kd.boolean,received:t.parsedType}),Md}return qd(e.data)}}bp.create=e=>new bp({typeName:nf.ZodBoolean,coerce:e?.coerce||!1,...zd(e)});class Sp extends Hd{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==kd.date){const t=this._getOrReturnCtx(e);return Nd(t,{code:Cd.invalid_type,expected:kd.date,received:t.parsedType}),Md}if(Number.isNaN(e.data.getTime())){return Nd(this._getOrReturnCtx(e),{code:Cd.invalid_date}),Md}const t=new Dd;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),Nd(n,{code:Cd.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),Nd(n,{code:Cd.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):_d.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Sp({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:$d.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:$d.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Sp.create=e=>new Sp({checks:[],coerce:e?.coerce||!1,typeName:nf.ZodDate,...zd(e)});class Ep extends Hd{_parse(e){if(this._getType(e)!==kd.symbol){const t=this._getOrReturnCtx(e);return Nd(t,{code:Cd.invalid_type,expected:kd.symbol,received:t.parsedType}),Md}return qd(e.data)}}Ep.create=e=>new Ep({typeName:nf.ZodSymbol,...zd(e)});class _p extends Hd{_parse(e){if(this._getType(e)!==kd.undefined){const t=this._getOrReturnCtx(e);return Nd(t,{code:Cd.invalid_type,expected:kd.undefined,received:t.parsedType}),Md}return qd(e.data)}}_p.create=e=>new _p({typeName:nf.ZodUndefined,...zd(e)});class Ap extends Hd{_parse(e){if(this._getType(e)!==kd.null){const t=this._getOrReturnCtx(e);return Nd(t,{code:Cd.invalid_type,expected:kd.null,received:t.parsedType}),Md}return qd(e.data)}}Ap.create=e=>new Ap({typeName:nf.ZodNull,...zd(e)});class Ip extends Hd{constructor(){super(...arguments),this._any=!0}_parse(e){return qd(e.data)}}Ip.create=e=>new Ip({typeName:nf.ZodAny,...zd(e)});class kp extends Hd{constructor(){super(...arguments),this._unknown=!0}_parse(e){return qd(e.data)}}kp.create=e=>new kp({typeName:nf.ZodUnknown,...zd(e)});class Tp extends Hd{_parse(e){const t=this._getOrReturnCtx(e);return Nd(t,{code:Cd.invalid_type,expected:kd.never,received:t.parsedType}),Md}}Tp.create=e=>new Tp({typeName:nf.ZodNever,...zd(e)});class Cp extends Hd{_parse(e){if(this._getType(e)!==kd.undefined){const t=this._getOrReturnCtx(e);return Nd(t,{code:Cd.invalid_type,expected:kd.void,received:t.parsedType}),Md}return qd(e.data)}}Cp.create=e=>new Cp({typeName:nf.ZodVoid,...zd(e)});class xp extends Hd{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==kd.array)return Nd(t,{code:Cd.invalid_type,expected:kd.array,received:t.parsedType}),Md;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(Nd(t,{code:e?Cd.too_big:Cd.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(Nd(t,{code:Cd.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(Nd(t,{code:Cd.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new Gd(t,e,t.path,n)))).then(e=>Dd.mergeArray(n,e));const i=[...t.data].map((e,n)=>r.type._parseSync(new Gd(t,e,t.path,n)));return Dd.mergeArray(n,i)}
vendor: 5,180 bytes, line 18
18get element(){return this._def.type}min(e,t){return new xp({...this._def,minLength:{value:e,message:$d.toString(t)}})}max(e,t){return new xp({...this._def,maxLength:{value:e,message:$d.toString(t)}})}length(e,t){return new xp({...this._def,exactLength:{value:e,message:$d.toString(t)}})}nonempty(e){return this.min(1,e)}}function Op(e){if(e instanceof Rp){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Kp.create(Op(r))}return new Rp({...e._def,shape:()=>t})}return e instanceof xp?new xp({...e._def,type:Op(e.element)}):e instanceof Kp?Kp.create(Op(e.unwrap())):e instanceof Yp?Yp.create(Op(e.unwrap())):e instanceof Fp?Fp.create(e.items.map(e=>Op(e))):e}xp.create=(e,t)=>new xp({type:e,minLength:null,maxLength:null,exactLength:null,typeName:nf.ZodArray,...zd(t)});class Rp extends Hd{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=_d.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==kd.object){const t=this._getOrReturnCtx(e);return Nd(t,{code:Cd.invalid_type,expected:kd.object,received:t.parsedType}),Md}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Tp&&"strip"===this._def.unknownKeys))for(const o in n.data)i.includes(o)||a.push(o);const s=[];for(const o of i){const e=r[o],t=n.data[o];s.push({key:{status:"valid",value:o},value:e._parse(new Gd(n,t,n.path,o)),alwaysSet:o in n.data})}if(this._def.catchall instanceof Tp){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of a)s.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)a.length>0&&(Nd(n,{code:Cd.unrecognized_keys,keys:a}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of a){const r=n.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new Gd(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of s){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Dd.mergeObjectSync(t,e)):Dd.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(e){return $d.errToObj,new Rp({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{const r=this._def.errorMap?.(t,n).message??n.defaultError;return"unrecognized_keys"===t.code?{message:$d.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new Rp({...this._def,unknownKeys:"strip"})}passthrough(){return new Rp({...this._def,unknownKeys:"passthrough"})}extend(e){return new Rp({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Rp({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:nf.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Rp({...this._def,catchall:e})}pick(e){const t={};for(const n of _d.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new Rp({...this._def,shape:()=>t})}omit(e){const t={};for(const n of _d.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new Rp({...this._def,shape:()=>t})}deepPartial(){return Op(this)}partial(e){const t={};for(const n of _d.objectKeys(this.shape)){const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}return new Rp({...this._def,shape:()=>t})}required(e){const t={};for(const n of _d.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Kp;)e=e._def.innerType;t[n]=e}return new Rp({...this._def,shape:()=>t})}keyof(){return Gp(_d.objectKeys(this.shape))}}Rp.create=(e,t)=>new Rp({shape:()=>e,unknownKeys:"strip",catchall:Tp.create(),typeName:nf.ZodObject,...zd(t)}),Rp.strictCreate=(e,t)=>new Rp({shape:()=>e,unknownKeys:"strict",catchall:Tp.create(),typeName:nf.ZodObject,...zd(t)}),Rp.lazycreate=(e,t)=>new Rp({shape:e,unknownKeys:"strip",catchall:Tp.create(),typeName:nf.ZodObject,...zd(t)});class Np extends Hd{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const n=e.map(e=>new xd(e.ctx.common.issues));return Nd(t,{code:Cd.invalid_union,unionErrors:n}),Md});{let e;const r=[];for(const a of n){const n={...t,common:{...t.common,issues:[]},parent:null},i=a._parseSync({data:t.data,path:t.path,parent:n});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=r.map(e=>new xd(e));return Nd(t,{code:Cd.invalid_union,unionErrors:i}),Md}}get options(){return this._def.options}}Np.create=(e,t)=>
vendor: 4,228 bytes, line 18
18new Np({options:e,typeName:nf.ZodUnion,...zd(t)});const Dp=e=>e instanceof $p?Dp(e.schema):e instanceof Bp?Dp(e.innerType()):e instanceof Vp?[e.value]:e instanceof Qp?e.options:e instanceof zp?_d.objectValues(e.enum):e instanceof Zp?Dp(e._def.innerType):e instanceof _p?[void 0]:e instanceof Ap?[null]:e instanceof Kp?[void 0,...Dp(e.unwrap())]:e instanceof Yp?[null,...Dp(e.unwrap())]:e instanceof Xp||e instanceof tf?Dp(e.unwrap()):e instanceof Wp?Dp(e._def.innerType):[];class Mp extends Hd{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==kd.object)return Nd(t,{code:Cd.invalid_type,expected:kd.object,received:t.parsedType}),Md;const n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(Nd(t,{code:Cd.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Md)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const i of t){const t=Dp(i.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(r.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);r.set(n,i)}}return new Mp({typeName:nf.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...zd(n)})}}function Pp(e,t){const n=Td(e),r=Td(t);if(e===t)return{valid:!0,data:e};if(n===kd.object&&r===kd.object){const n=_d.objectKeys(t),r=_d.objectKeys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};for(const a of r){const n=Pp(e[a],t[a]);if(!n.valid)return{valid:!1};i[a]=n.data}return{valid:!0,data:i}}if(n===kd.array&&r===kd.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const i=Pp(e[r],t[r]);if(!i.valid)return{valid:!1};n.push(i.data)}return{valid:!0,data:n}}return n===kd.date&&r===kd.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}class qp extends Hd{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Fd(e)||Fd(r))return Md;const i=Pp(e.value,r.value);return i.valid?((Ud(e)||Ud(r))&&t.dirty(),{status:t.value,value:i.data}):(Nd(n,{code:Cd.invalid_intersection_types}),Md)};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(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}qp.create=(e,t,n)=>new qp({left:e,right:t,typeName:nf.ZodIntersection,...zd(n)});class Fp extends Hd{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==kd.array)return Nd(n,{code:Cd.invalid_type,expected:kd.array,received:n.parsedType}),Md;if(n.data.length<this._def.items.length)return Nd(n,{code:Cd.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Md;!this._def.rest&&n.data.length>this._def.items.length&&(Nd(n,{code:Cd.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new Gd(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>Dd.mergeArray(t,e)):Dd.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Fp({...this._def,rest:e})}}Fp.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fp({items:e,typeName:nf.ZodTuple,rest:null,...zd(t)})};class Up extends Hd{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==kd.object)return Nd(n,{code:Cd.invalid_type,expected:kd.object,received:n.parsedType}),Md;const r=[],i=this._def.keyType,a=this._def.valueType;for(const s in n.data)r.push({key:i._parse(new Gd(n,s,n.path,s)),value:a._parse(new Gd(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Dd.mergeObjectAsync(t,r):Dd.mergeObjectSync(t,r)}
18get element(){return this._def.valueType}static create(e,t,n){return new Up(t instanceof Hd?{keyType:e,valueType:t,typeName:nf.ZodRecord,...zd(n)}:{keyType:mp.create(),valueType:e,typeName:nf.ZodRecord,...zd(t)})}}class jp extends Hd{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==kd.map)return Nd(n,{code:Cd.invalid_type,expected:kd.map,received:n.parsedType}),Md;const r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new Gd(n,e,n.path,[a,"key"])),value:i._parse(new Gd(n,t,n.path,[a,"value"]))}));if(n.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const n of a){const r=await n.key,i=await n.value;if("aborted"===r.status||"aborted"===i.status)return Md;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{const e=new Map;for(const n of a){const r=n.key,i=n.value;if("aborted"===r.status||"aborted"===i.status)return Md;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}}jp.create=(e,t,n)=>new jp({valueType:t,keyType:e,typeName:nf.ZodMap,...zd(n)});class Lp extends Hd{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==kd.set)return Nd(n,{code:Cd.invalid_type,expected:kd.set,received:n.parsedType}),Md;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(Nd(n,{code:Cd.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(Nd(n,{code:Cd.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function a(e){const n=new Set;for(const r of e){if("aborted"===r.status)return Md;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const s=[...n.data.values()].map((e,t)=>i._parse(new Gd(n,e,n.path,t)));return n.common.async?Promise.all(s).then(e=>a(e)):a(s)}min(e,t){return new Lp({...this._def,minSize:{value:e,message:$d.toString(t)}})}max(e,t){return new Lp({...this._def,maxSize:{value:e,message:$d.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Lp.create=(e,t)=>new Lp({valueType:e,minSize:null,maxSize:null,typeName:nf.ZodSet,...zd(t)});class $p extends Hd{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}$p.create=(e,t)=>new $p({getter:e,typeName:nf.ZodLazy,...zd(t)});class Vp extends Hd{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Nd(t,{received:t.data,code:Cd.invalid_literal,expected:this._def.value}),Md}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Gp(e,t){return new Qp({values:e,typeName:nf.ZodEnum,...zd(t)})}Vp.create=(e,t)=>new Vp({value:e,typeName:nf.ZodLiteral,...zd(t)});class Qp extends Hd{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return Nd(t,{expected:_d.joinValues(n),received:t.parsedType,code:Cd.invalid_type}),Md}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return Nd(t,{received:t.data,code:Cd.invalid_enum_value,options:n}),Md}return qd(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Qp.create(e,{...this._def,...t})}exclude(e,t=this._def){return Qp.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}Qp.create=Gp;class zp extends Hd{_parse(e){const t=_d.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==kd.string&&n.parsedType!==kd.number){const e=_d.objectValues(t);return Nd(n,{expected:_d.joinValues(e),received:n.parsedType,code:Cd.invalid_type}),Md}if(this._cache||(this._cache=new Set(_d.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=_d.objectValues(t);return Nd(n,{received:n.data,code:Cd.invalid_enum_value,options:e}),Md}return qd(e.data)}get enum(){return this._def.values}}zp.create=(e,t)=>
vendor: 4,094 bytes, line 18
18new zp({values:e,typeName:nf.ZodNativeEnum,...zd(t)});class Hp extends Hd{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==kd.promise&&!1===t.common.async)return Nd(t,{code:Cd.invalid_type,expected:kd.promise,received:t.parsedType}),Md;const n=t.parsedType===kd.promise?t.data:Promise.resolve(t.data);return qd(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Hp.create=(e,t)=>new Hp({type:e,typeName:nf.ZodPromise,...zd(t)});class Bp extends Hd{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===nf.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{Nd(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===r.type){const e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return Md;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?Md:"dirty"===r.status||"dirty"===t.value?Pd(r.value):r});{if("aborted"===t.value)return Md;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?Md:"dirty"===r.status||"dirty"===t.value?Pd(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?Md:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>"aborted"===n.status?Md:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!jd(e))return Md;const a=r.transform(e.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>jd(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):Md)}_d.assertNever(r)}}Bp.create=(e,t,n)=>new Bp({schema:e,typeName:nf.ZodEffects,effect:t,...zd(n)}),Bp.createWithPreprocess=(e,t,n)=>new Bp({schema:t,effect:{type:"preprocess",transform:e},typeName:nf.ZodEffects,...zd(n)});class Kp extends Hd{_parse(e){return this._getType(e)===kd.undefined?qd(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Kp.create=(e,t)=>new Kp({innerType:e,typeName:nf.ZodOptional,...zd(t)});class Yp extends Hd{_parse(e){return this._getType(e)===kd.null?qd(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Yp.create=(e,t)=>new Yp({innerType:e,typeName:nf.ZodNullable,...zd(t)});class Zp extends Hd{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===kd.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Zp.create=(e,t)=>new Zp({innerType:e,typeName:nf.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...zd(t)});class Wp extends Hd{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ld(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new xd(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new xd(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Wp.create=(e,t)=>
18new Wp({innerType:e,typeName:nf.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...zd(t)});class Jp extends Hd{_parse(e){if(this._getType(e)!==kd.nan){const t=this._getOrReturnCtx(e);return Nd(t,{code:Cd.invalid_type,expected:kd.nan,received:t.parsedType}),Md}return{status:"valid",value:e.data}}}Jp.create=e=>new Jp({typeName:nf.ZodNaN,...zd(e)});class Xp extends Hd{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class ef extends Hd{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Md:"dirty"===e.status?(t.dirty(),Pd(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Md:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new ef({in:e,out:t,typeName:nf.ZodPipeline})}}class tf extends Hd{_parse(e){const t=this._def.innerType._parse(e),n=e=>(jd(e)&&(e.value=Object.freeze(e.value)),e);return Ld(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}}var nf,rf;tf.create=(e,t)=>new tf({innerType:e,typeName:nf.ZodReadonly,...zd(t)}),(rf=nf||(nf={})).ZodString="ZodString",rf.ZodNumber="ZodNumber",rf.ZodNaN="ZodNaN",rf.ZodBigInt="ZodBigInt",rf.ZodBoolean="ZodBoolean",rf.ZodDate="ZodDate",rf.ZodSymbol="ZodSymbol",rf.ZodUndefined="ZodUndefined",rf.ZodNull="ZodNull",rf.ZodAny="ZodAny",rf.ZodUnknown="ZodUnknown",rf.ZodNever="ZodNever",rf.ZodVoid="ZodVoid",rf.ZodArray="ZodArray",rf.ZodObject="ZodObject",rf.ZodUnion="ZodUnion",rf.ZodDiscriminatedUnion="ZodDiscriminatedUnion",rf.ZodIntersection="ZodIntersection",rf.ZodTuple="ZodTuple",rf.ZodRecord="ZodRecord",rf.ZodMap="ZodMap",rf.ZodSet="ZodSet",rf.ZodFunction="ZodFunction",rf.ZodLazy="ZodLazy",rf.ZodLiteral="ZodLiteral",rf.ZodEnum="ZodEnum",rf.ZodEffects="ZodEffects",rf.ZodNativeEnum="ZodNativeEnum",rf.ZodOptional="ZodOptional",rf.ZodNullable="ZodNullable",rf.ZodDefault="ZodDefault",rf.ZodCatch="ZodCatch",rf.ZodPromise="ZodPromise",rf.ZodBranded="ZodBranded",rf.ZodPipeline="ZodPipeline",rf.ZodReadonly="ZodReadonly";const af=mp.create,sf=vp.create,of=bp.create,cf=Ip.create,uf=kp.create;Tp.create;const lf=xp.create,df=Rp.create,pf=Np.create,ff=Mp.create;qp.create,Fp.create;const hf=Up.create,gf=Vp.create,mf=Qp.create,yf=zp.create;Hp.create,Kp.create,Yp.create;const vf=df({name:af(),arguments:af()}),wf=df({id:af(),type:gf("function"),function:vf,encryptedValue:af().optional()}),bf=df({id:af(),role:af(),content:af().optional(),name:af().optional(),encryptedValue:af().optional()}),Sf=df({type:gf("text"),text:af()}),Ef=ff("type",[df({type:gf("data"),value:af(),mimeType:af()}),df({type:gf("url"),value:af(),mimeType:af().optional()})]),_f=df({type:gf("image"),source:Ef,metadata:uf().optional()}),Af=df({type:gf("audio"),source:Ef,metadata:uf().optional()}),If=df({type:gf("video"),source:Ef,metadata:uf().optional()}),kf=df({type:gf("document"),source:Ef,metadata:uf().optional()}),Tf=df({type:gf("binary"),mimeType:af(),id:af().optional(),url:af().optional(),data:af().optional(),filename:af().optional()}),Cf=(e,t)=>{e.id||e.url||e.data||t.addIssue({code:Cd.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})};Tf.superRefine((e,t)=>{Cf(e,t)});const xf=ff("type",[Sf,_f,Af,If,kf,Tf]).superRefine((e,t)=>{"binary"===e.type&&Cf(e,t)}),Of=ff("role",[bf.extend({role:gf("developer"),content:af()}),bf.extend({role:gf("system"),content:af()}),bf.extend({role:gf("assistant"),content:af().optional(),toolCalls:lf(wf).optional()}),bf.extend({role:gf("user"),content:pf([af(),lf(xf)])}),df({id:af(),content:af(),role:gf("tool"),toolCallId:af(),error:af().optional(),encryptedValue:af().optional()}),df({id:af(),role:gf("activity"),activityType:af(),content:hf(cf())}),df({id:af(),role:gf("reasoning"),content:af(),encryptedValue:af().optional()})]);pf([gf("developer"),gf("system"),gf("assistant"),gf("user"),gf("tool"),gf("activity"),gf("reasoning")]);const Rf=df({description:af(),value:af()}),Nf=df({name:af(),description:af(),parameters:cf(),metadata:hf(cf()).optional()}),Df=df({id:af(),reason:af(),message:af().optional(),toolCallId:af().optional(),responseSchema:hf(cf()).optional(),expiresAt:af().optional(),metadata:hf(cf()).optional()}),Mf=df({interruptId:af(),status:mf(["resolved","cancelled"]),payload:cf().optional()}),Pf=df({threadId:af(),runId:af(),parentRunId:af().optional(),state:cf(),messages:lf(Of),tools:lf(Nf),context:lf(Rf),forwardedProps:cf(),resume:lf(Mf).optional()}),qf=cf();
18var Ff=class extends Error{constructor(e){super(e)}},Uf=class extends Ff{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}};const jf=df({name:af(),description:af().optional()}),Lf=df({name:af().optional(),type:af().optional(),description:af().optional(),version:af().optional(),provider:af().optional(),documentationUrl:af().optional(),metadata:hf(uf()).optional()}),$f=df({streaming:of().optional(),websocket:of().optional(),httpBinary:of().optional(),pushNotifications:of().optional(),resumable:of().optional()}),Vf=df({supported:of().optional(),items:lf(Nf).optional(),parallelCalls:of().optional(),clientProvided:of().optional()}),Gf=df({structuredOutput:of().optional(),supportedMimeTypes:lf(af()).optional()}),Qf=df({snapshots:of().optional(),deltas:of().optional(),memory:of().optional(),persistentState:of().optional()}),zf=df({supported:of().optional(),delegation:of().optional(),handoffs:of().optional(),subAgents:lf(jf).optional()}),Hf=df({supported:of().optional(),streaming:of().optional(),encrypted:of().optional()}),Bf=df({image:of().optional(),audio:of().optional(),video:of().optional(),pdf:of().optional(),file:of().optional()}),Kf=df({image:of().optional(),audio:of().optional()}),Yf=df({input:Bf.optional(),output:Kf.optional()}),Zf=df({codeExecution:of().optional(),sandboxed:of().optional(),maxIterations:sf().optional(),maxExecutionTime:sf().optional()}),Wf=df({supported:of().optional(),approvals:of().optional(),interventions:of().optional(),feedback:of().optional(),interrupts:of().optional(),approveWithEdits:of().optional()});df({identity:Lf.optional(),transport:$f.optional(),tools:Vf.optional(),output:Gf.optional(),state:Qf.optional(),multiAgent:zf.optional(),reasoning:Hf.optional(),multimodal:Yf.optional(),execution:Zf.optional(),humanInTheLoop:Wf.optional(),custom:hf(uf()).optional()});const Jf=pf([gf("developer"),gf("system"),gf("assistant"),gf("user")]);let Xf=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_
18SNAPSHOT",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}({});const eh=df({type:yf(Xf),timestamp:sf().optional(),rawEvent:cf().optional()}).passthrough(),th=eh.extend({type:gf(Xf.TEXT_MESSAGE_START),messageId:af(),role:Jf.default("assistant"),name:af().optional()}),nh=eh.extend({type:gf(Xf.TEXT_MESSAGE_CONTENT),messageId:af(),delta:af()}),rh=eh.extend({type:gf(Xf.TEXT_MESSAGE_END),messageId:af()}),ih=eh.extend({type:gf(Xf.TEXT_MESSAGE_CHUNK),messageId:af().optional(),role:Jf.optional(),delta:af().optional(),name:af().optional()}),ah=eh.extend({type:gf(Xf.THINKING_TEXT_MESSAGE_START)}),sh=nh.omit({messageId:!0,type:!0}).extend({type:gf(Xf.THINKING_TEXT_MESSAGE_CONTENT)}),oh=eh.extend({type:gf(Xf.THINKING_TEXT_MESSAGE_END)}),ch=eh.extend({type:gf(Xf.TOOL_CALL_START),toolCallId:af(),toolCallName:af(),parentMessageId:af().optional()}),uh=eh.extend({type:gf(Xf.TOOL_CALL_ARGS),toolCallId:af(),delta:af()}),lh=eh.extend({type:gf(Xf.TOOL_CALL_END),toolCallId:af()}),dh=eh.extend({messageId:af(),type:gf(Xf.TOOL_CALL_RESULT),toolCallId:af(),content:af(),role:gf("tool").optional()}),ph=eh.extend({type:gf(Xf.TOOL_CALL_CHUNK),toolCallId:af().optional(),toolCallName:af().optional(),parentMessageId:af().optional(),delta:af().optional()}),fh=eh.extend({type:gf(Xf.THINKING_START),title:af().optional()}),hh=eh.extend({type:gf(Xf.THINKING_END)}),gh=eh.extend({type:gf(Xf.STATE_SNAPSHOT),snapshot:qf}),mh=eh.extend({type:gf(Xf.STATE_DELTA),delta:lf(cf())}),yh=eh.extend({type:gf(Xf.MESSAGES_SNAPSHOT),messages:lf(Of)}),vh=eh.extend({type:gf(Xf.ACTIVITY_SNAPSHOT),messageId:af(),activityType:af(),content:hf(cf()),replace:of().optional().default(!0)}),wh=eh.extend({type:gf(Xf.ACTIVITY_DELTA),messageId:af(),activityType:af(),patch:lf(cf())}),bh=eh.extend({type:gf(Xf.RAW),event:cf(),source:af().optional()}),Sh=eh.extend({type:gf(Xf.CUSTOM),name:af(),value:cf()}),Eh=eh.extend({type:gf(Xf.RUN_STARTED),threadId:af(),runId:af(),parentRunId:af().optional(),input:Pf.optional()}),_h=ff("type",[df({type:gf("success")}).strict(),df({type:gf("interrupt"),interrupts:lf(Df).min(1)}).strict()]),Ah=eh.extend({type:gf(Xf.RUN_FINISHED),threadId:af(),runId:af(),result:cf().optional(),outcome:_h.nullable().optional().transform(e=>e??void 0)}),Ih=eh.extend({type:gf(Xf.RUN_ERROR),message:af(),code:af().optional()}),kh=eh.extend({type:gf(Xf.STEP_STARTED),stepName:af()}),Th=eh.extend({type:gf(Xf.STEP_FINISHED),stepName:af()}),Ch=pf([gf("tool-call"),gf("message")]),xh=ff("type",[th,nh,rh,ih,fh,hh,ah,sh,oh,ch,uh,lh,ph,dh,gh,mh,yh,vh,wh,bh,Sh,Eh,Ah,Ih,kh,Th,eh.extend({type:gf(Xf.REASONING_START),messageId:af()}),eh.extend({type:gf(Xf.REASONING_MESSAGE_START),messageId:af(),role:gf("reasoning")}),eh.extend({type:gf(Xf.REASONING_MESSAGE_CONTENT),messageId:af(),delta:af()}),eh.extend({type:gf(Xf.REASONING_MESSAGE_END),messageId:af()}),eh.extend({type:gf(Xf.REASONING_MESSAGE_CHUNK),messageId:af().optional(),delta:af().optional()}),eh.extend({type:gf(Xf.REASONING_END),messageId:af()}),eh.extend({type:gf(Xf.REASONING_ENCRYPTED_VALUE),subtype:Ch,entityId:af(),encryptedValue:af()})]);
19/*!
20 * https://github.com/Starcounter-Jack/JSON-Patch
21 * (c) 2017-2022 Joachim Wester
22 * MIT licensed
23 */
24var Oh=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Rh=Object.prototype.hasOwnProperty;
vendor: 3,234 bytes, line 24
24function Nh(e,t){return Rh.call(e,t)}function Dh(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n<t.length;n++)t[n]=""+n;return t}if(Object.keys)return Object.keys(e);var r=[];for(var i in e)Nh(e,i)&&r.push(i);return r}function Mh(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Ph(e){for(var t,n=0,r=e.length;n<r;){if(!((t=e.charCodeAt(n))>=48&&t<=57))return!1;n++}return!0}function qh(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Fh(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Uh(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,n=e.length;t<n;t++)if(Uh(e[t]))return!0}else if("object"==typeof e)for(var r=Dh(e),i=r.length,a=0;a<i;a++)if(Uh(e[r[a]]))return!0;return!1}function jh(e,t){var n=[e];for(var r in t){var i="object"==typeof t[r]?JSON.stringify(t[r],null,2):t[r];void 0!==i&&n.push(r+": "+i)}return n.join("\n")}var Lh=function(e){function t(t,n,r,i,a){var s=this.constructor,o=e.call(this,jh(t,{name:n,index:r,operation:i,tree:a}))||this;return o.name=n,o.index=r,o.operation=i,o.tree=a,Object.setPrototypeOf(o,s.prototype),o.message=jh(t,{name:n,index:r,operation:i,tree:a}),o}return Oh(t,e),t}(Error),$h=Lh,Vh=Mh,Gh={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var r=e[t];return delete e[t],{newDocument:n,removed:r}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:function(e,t,n){var r=zh(n,this.path);r&&(r=Mh(r));var i=Hh(n,{op:"remove",path:this.from}).removed;return Hh(n,{op:"add",path:this.path,value:i}),{newDocument:n,removed:r}},copy:function(e,t,n){var r=zh(n,this.from);return Hh(n,{op:"add",path:this.path,value:Mh(r)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:Zh(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},Qh={add:function(e,t,n){return Ph(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:Gh.move,copy:Gh.copy,test:Gh.test,_get:Gh._get};function zh(e,t){if(""==t)return e;var n={op:"_get",path:t};return Hh(e,n),n.value}function Hh(e,t,n,r,i,a){if(void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===i&&(i=!0),void 0===a&&(a=0),n&&("function"==typeof n?n(t,0,e,t.path):Kh(t,0)),""===t.path){var s={newDocument:e};if("add"===t.op)return s.newDocument=t.value,s;if("replace"===t.op)return s.newDocument=t.value,s.removed=e,s;if("move"===t.op||"copy"===t.op)return s.newDocument=zh(e,t.from),"move"===t.op&&(s.removed=e),s;if("test"===t.op){if(s.test=Zh(e,t.value),!1===s.test)throw new $h("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return s.newDocument=e,s}if("remove"===t.op)return s.removed=e,s.newDocument=null,s;if("_get"===t.op)return t.value=e,s;if(n)throw new $h("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",a,t,e);return s}r||(e=Mh(e));var o=(t.path||"").split("/"),c=e,u=1,l=o.length,d=void 0,p=void 0,f=void 0;for(f="function"==typeof n?n:Kh;;
vendor: 5,446 bytes, lines 24-29
24){if((p=o[u])&&-1!=p.indexOf("~")&&(p=Fh(p)),i&&("__proto__"==p||"prototype"==p&&u>0&&"constructor"==o[u-1]))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(n&&void 0===d&&(void 0===c[p]?d=o.slice(0,u).join("/"):u==l-1&&(d=t.path),void 0!==d&&f(t,0,e,d)),u++,Array.isArray(c)){if("-"===p)p=c.length;else{if(n&&!Ph(p))throw new $h("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",a,t,e);Ph(p)&&(p=~~p)}if(u>=l){if(n&&"add"===t.op&&p>c.length)throw new $h("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",a,t,e);if(!1===(s=Qh[t.op].call(t,c,p,e)).test)throw new $h("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return s}}else if(u>=l){if(!1===(s=Gh[t.op].call(t,c,p,e)).test)throw new $h("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return s}if(c=c[p],n&&u<l&&(!c||"object"!=typeof c))throw new $h("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",a,t,e)}}function Bh(e,t,n,r,i){if(void 0===r&&(r=!0),void 0===i&&(i=!0),n&&!Array.isArray(t))throw new $h("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");r||(e=Mh(e));for(var a=new Array(t.length),s=0,o=t.length;s<o;s++)a[s]=Hh(e,t[s],n,!0,i,s),e=a[s].newDocument;return a.newDocument=e,a}function Kh(e,t,n,r){if("object"!=typeof e||null===e||Array.isArray(e))throw new $h("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,n);if(!Gh[e.op])throw new $h("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n);if("string"!=typeof e.path)throw new $h("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,n);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new $h('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new $h("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new $h("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&Uh(e.value))throw new $h("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n)if("add"==e.op){var i=e.path.split("/").length,a=r.split("/").length;if(i!==a+1&&i!==a)throw new $h("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==r)throw new $h("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if("move"===e.op||"copy"===e.op){var s=Yh([{op:"_get",path:e.from,value:void 0}],n);if(s&&"OPERATION_PATH_UNRESOLVABLE"===s.name)throw new $h("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}function Yh(e,t,n){try{if(!Array.isArray(e))throw new $h("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Bh(Mh(t),Mh(e),n||!0);else{n=n||Kh;for(var r=0;r<e.length;r++)n(e[r],r,t,void 0)}}catch(i){if(i instanceof $h)return i;throw i}}function Zh(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var n,r,i,a=Array.isArray(e),s=Array.isArray(t);if(a&&s){if((r=e.length)!=t.length)return!1;for(n=r;0!==n--;)if(!Zh(e[n],t[n]))return!1;return!0}if(a!=s)return!1;var o=Object.keys(e);if((r=o.length)!==Object.keys(t).length)return!1;for(n=r;0!==n--;)if(!t.hasOwnProperty(o[n]))return!1;for(n=r;0!==n--;)if(!Zh(e[i=o[n]],t[i]))return!1;return!0}return e!=e&&t!=t}const Wh=Object.freeze(Object.defineProperty({__proto__:null,JsonPatchError:$h,_areEquals:Zh,applyOperation:Hh,applyPatch:Bh,applyReducer:function(e,t,n){var r=Hh(e,t);if(!1===r.test)throw new $h("Test operation failed","TEST_OPERATION_FAILED",n,t,e);return r.newDocument},deepClone:Vh,getValueByPointer:zh,validate:Yh,validator:Kh},Symbol.toStringTag,{value:"Module"}));
25/*!
26 * https://github.com/Starcounter-Jack/JSON-Patch
27 * (c) 2017-2021 Joachim Wester
28 * MIT license
29 */var Jh=new WeakMap,Xh=function(){return function(e){this.observers=new Map,this.obj=e}}(),eg=function(){return function(e,t){this.callback=e,this.observer=t}}();function tg(e,t){void 0===t&&(t=!1);var n=Jh.get(e.object);ng(n.value,e.object,e.patches,"",t),e.patches.length&&Bh(n.value,e.patches);var r=e.patches;return r.length>0&&(e.patches=[],e.callback&&e.callback(r)),r}function ng(e,t,n,r,i){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var a=Dh(t),s=Dh(e),o=!1,c=s.length-1;c>=0;c--){var u=e[d=s[c]];if(!Nh(t,d)||void 0===t[d]&&void 0!==u&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:"test",path:r+"/"+qh(d),value:Mh(u)}),n.push({op:"remove",path:r+"/"+qh(d)}),o=!0):(i&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}));else{var l=t[d];"object"==typeof u&&null!=u&&"object"==typeof l&&null!=l&&Array.isArray(u)===Array.isArray(l)?ng
29(u,l,n,r+"/"+qh(d),i):u!==l&&(i&&n.push({op:"test",path:r+"/"+qh(d),value:Mh(u)}),n.push({op:"replace",path:r+"/"+qh(d),value:Mh(l)}))}}if(o||a.length!=s.length)for(c=0;c<a.length;c++){var d;Nh(e,d=a[c])||void 0===t[d]||n.push({op:"add",path:r+"/"+qh(d),value:Mh(t[d])})}}}const rg=Object.freeze(Object.defineProperty({__proto__:null,compare:function(e,t,n){void 0===n&&(n=!1);var r=[];return ng(e,t,r,"",n),r},generate:tg,observe:function(e,t){var n,r=function(e){return Jh.get(e)}(e);if(r){var i=function(e,t){return e.observers.get(t)}(r,t);n=i&&i.observer}else r=new Xh(e),Jh.set(e,r);if(n)return n;if(n={},r.value=Mh(e),t){n.callback=t,n.next=null;var a=function(){tg(n)},s=function(){clearTimeout(n.next),n.next=setTimeout(a)};"undefined"!=typeof window&&(window.addEventListener("mouseup",s),window.addEventListener("keyup",s),window.addEventListener("mousedown",s),window.addEventListener("keydown",s),window.addEventListener("change",s))}return n.patches=[],n.object=e,n.unobserve=function(){tg(n),clearTimeout(n.next),function(e,t){e.observers.delete(t.callback)}(r,n),"undefined"!=typeof window&&(window.removeEventListener("mouseup",s),window.removeEventListener("keyup",s),window.removeEventListener("mousedown",s),window.removeEventListener("keydown",s),window.removeEventListener("change",s))},r.observers.set(t,new eg(t,n)),n},unobserve:function(e,t){t.unobserve()}},Symbol.toStringTag,{value:"Module"})),ig=Object.assign({},Wh,rg,{JsonPatchError:Lh,deepClone:Mh,escapePathComponent:qh,unescapePathComponent:Fh});var ag=function(e,t){return(ag=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function sg(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}ag(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function og(e,t,n,r){return new(n||(n=Promise))(function(i,a){function s(e){try{c(r.next(e))}catch(t){a(t)}}function o(e){try{c(r.throw(e))}catch(t){a(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,o)}c((r=r.apply(e,t||[])).next())})}function cg(e,t){var n,r,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=o(0),s.throw=o(1),s.return=o(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(c){o=[6,c],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}function ug(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function lg(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)s.push(r.value)}catch(o){i={error:o}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return s}function dg(e,t,n){if(n||2===arguments.length)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function pg(e){return this instanceof pg?(this.v=e,this):new pg(e)}function fg(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),a=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",function(e){return function(t){return Promise.resolve(t).then(e,u)}}),r[Symbol.asyncIterator]=function(){return this},r;function s(e,t){i[e]&&(r[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||o(e,t)})},t&&(r[e]=t(r[e])))}function o(e,t){try{(n=i[e](t)).value instanceof pg?Promise.resolve(n.value.v).then(c,u):l(a[0][2],n)}catch(r){l(a[0][3],r)}var n}function c(e){o("next",e)}function u(e){o("throw",e)}function l(e,t){e(t),a.shift(),a.length&&o(a[0][0],a[0][1])}}function hg(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=ug(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,i){(function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)})(r,i,(t=e[n](t)).done,t.value)})}}}function gg(e){return"function"==typeof e}function mg(e){var t=e(function(e){Error.call(e),e.stack=(new Error).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var yg=mg(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n  "):"",this.name="UnsubscriptionError",this.errors=t}});function vg(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var wg=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=ug(a),o=s.next();!o.done;o=s.next()){o.value.remove(this)}}catch(f){e={error:f}}finally{try{o&&!o.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else a.remove(this);var c=this.initialTeardown;
29if(gg(c))try{c()}catch(h){i=h instanceof yg?h.errors:[h]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=ug(u),d=l.next();!d.done;d=l.next()){var p=d.value;try{Eg(p)}catch(g){i=null!=i?i:[],g instanceof yg?i=dg(dg([],lg(i)),lg(g.errors)):i.push(g)}}}catch(m){n={error:m}}finally{try{d&&!d.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(i)throw new yg(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Eg(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&vg(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&vg(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),bg=wg.EMPTY;function Sg(e){return e instanceof wg||e&&"closed"in e&&gg(e.remove)&&gg(e.add)&&gg(e.unsubscribe)}function Eg(e){gg(e)?e():e.unsubscribe()}var _g=void 0,Ag=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,dg([e,t],lg(n)))};function Ig(e){Ag(function(){throw e})}function kg(){}function Tg(e){e()}var Cg=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Sg(t)&&t.add(n)):n.destination=Ng,n}return sg(t,e),t.create=function(e,t,n){return new Og(e,t,n)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(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(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(wg),xg=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){Rg(n)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){Rg(n)}else Rg(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){Rg(t)}},e}(),Og=function(e){function t(t,n,r){var i,a=e.call(this)||this;return i=gg(t)||!t?{next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:t,a.destination=new xg(i),a}return sg(t,e),t}(Cg);function Rg(e){Ig(e)}var Ng={closed:!0,next:kg,error:function(e){throw e},complete:kg},Dg="function"==typeof Symbol&&Symbol.observable||"@@observable";function Mg(e){return e}function Pg(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return qg(e)}function qg(e){return 0===e.length?Mg:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var Fg=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,i=this,a=(r=e)&&r instanceof Cg||function(e){return e&&gg(e.next)&&gg(e.error)&&gg(e.complete)}(r)&&Sg(r)?e:new Og(e,t,n);return Tg(function(){var e=i,t=e.operator,n=e.source;a.add(t?t.call(a,n):n?i._subscribe(a):i._trySubscribe(a))}),a},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=Ug(t))(function(t,r){var i=new Og({next:function(t){try{e(t)}catch(n){r(n),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[Dg]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return qg(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Ug(e))(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function Ug(e){var t;return null!==(t=null!=e?e:_g)&&void 0!==t?t:Promise}function jg(e){return function(t){if(function(e){return gg(null==e?void 0:e.lift)}(t))return t.lift(function(t){try{return e(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function Lg(e,t,n,r,i){return new $g(e,t,n,r,i)}var $g=function(e){function t(t,n,r,i,a,s){var o=e.call(this,t)||this;return o.onFinalize=a,o.shouldUnsubscribe=s,o._next=n?function(e){try{n(e)}catch(r){t.error(r)}}:e.prototype._next,o._error=i?function(e){try{i(e)}catch(n){t.error(n)}finally{this.unsubscribe()}}:e.prototype._error,o._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,o}return sg(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(Cg),Vg=mg(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Gg=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return sg(t,e),t.prototype.lift=function(e){var t=new Qg(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Vg},t.prototype.next=function(e){var t=this;Tg(function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=ug(t.currentObservers),a=i.next();!a.done;a=i.next()){a.value.next(e)}}catch(s){n={error:s}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var t=this;Tg(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;Tg(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0}
29,enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,a=n.observers;return r||i?bg:(this.currentObservers=null,a.push(e),new wg(function(){t.currentObservers=null,vg(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new Fg;return e.source=this,e},t.create=function(e,t){return new Qg(e,t)},t}(Fg),Qg=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return sg(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:bg},t}(Gg),zg={now:function(){return(zg.delegate||Date).now()},delegate:void 0},Hg=function(e){function t(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=zg);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return sg(t,e),t.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,a=n._infiniteTimeWindow,s=n._timestampProvider,o=n._windowTime;r||(i.push(t),!a&&i.push(s.now()+o)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!e.closed;i+=n?1:2)e.next(r[i]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,n=e._timestampProvider,r=e._buffer,i=e._infiniteTimeWindow,a=(i?1:2)*t;if(t<1/0&&a<r.length&&r.splice(0,r.length-a),!i){for(var s=n.now(),o=0,c=1;c<r.length&&r[c]<=s;c+=2)o=c;o&&r.splice(0,o+1)}},t}(Gg),Bg=new Fg(function(e){return e.complete()});function Kg(e){return(t=(n=e)[n.length-1])&&gg(t.schedule)?e.pop():void 0;var t,n}var Yg=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function Zg(e){return gg(null==e?void 0:e.then)}function Wg(e){return gg(e[Dg])}function Jg(e){return Symbol.asyncIterator&&gg(null==e?void 0:e[Symbol.asyncIterator])}function Xg(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var em="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function tm(e){return gg(null==e?void 0:e[em])}function nm(e){return fg(this,arguments,function(){var t,n,r;return cg(this,function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,pg(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,pg(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,pg(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function rm(e){return gg(null==e?void 0:e.getReader)}function im(e){if(e instanceof Fg)return e;if(null!=e){if(Wg(e))return i=e,new Fg(function(e){var t=i[Dg]();if(gg(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(Yg(e))return r=e,new Fg(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()});if(Zg(e))return n=e,new Fg(function(e){n.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,Ig)});if(Jg(e))return am(e);if(tm(e))return t=e,new Fg(function(e){var n,r;try{for(var i=ug(t),a=i.next();!a.done;a=i.next()){var s=a.value;if(e.next(s),e.closed)return}}catch(o){n={error:o}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()});if(rm(e))return am(nm(e))}var t,n,r,i;throw Xg(e)}function am(e){return new Fg(function(t){(function(e,t){var n,r,i,a;return og(this,void 0,void 0,function(){var s,o;return cg(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=hg(e),c.label=1;case 1:return[4,n.next()];case 2:if((r=c.sent()).done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return o=c.sent(),i={error:o},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(a=n.return)?[4,a.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];
29case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function sm(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var a=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(a),!i)return a}function om(e,t){return void 0===t&&(t=0),jg(function(n,r){n.subscribe(Lg(r,function(n){return sm(r,e,function(){return r.next(n)},t)},function(){return sm(r,e,function(){return r.complete()},t)},function(n){return sm(r,e,function(){return r.error(n)},t)}))})}function cm(e,t){return void 0===t&&(t=0),jg(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function um(e,t){if(!e)throw new Error("Iterable cannot be null");return new Fg(function(n){sm(n,t,function(){var r=e[Symbol.asyncIterator]();sm(n,t,function(){r.next().then(function(e){e.done?n.complete():n.next(e.value)})},0,!0)})})}function lm(e,t){if(null!=e){if(Wg(e))return function(e,t){return im(e).pipe(cm(t),om(t))}(e,t);if(Yg(e))return function(e,t){return new Fg(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}(e,t);if(Zg(e))return function(e,t){return im(e).pipe(cm(t),om(t))}(e,t);if(Jg(e))return um(e,t);if(tm(e))return function(e,t){return new Fg(function(n){var r;return sm(n,t,function(){r=e[em](),sm(n,t,function(){var e,t,i;try{t=(e=r.next()).value,i=e.done}catch(a){return void n.error(a)}i?n.complete():n.next(t)},0,!0)}),function(){return gg(null==r?void 0:r.return)&&r.return()}})}(e,t);if(rm(e))return function(e,t){return um(nm(e),t)}(e,t)}throw Xg(e)}function dm(e,t){return t?lm(e,t):im(e)}function pm(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return dm(e,Kg(e))}function fm(e,t){var n=gg(e)?e:function(){return e};return new Fg(function(e){return e.error(n())})}var hm=mg(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function gm(e,t){var n="object"==typeof t;return new Promise(function(r,i){var a,s=!1;e.subscribe({next:function(e){a=e,s=!0},error:i,complete:function(){s?r(a):n?r(t.defaultValue):i(new hm)}})})}function mm(e,t){return jg(function(n,r){var i=0;n.subscribe(Lg(r,function(n){r.next(e.call(t,n,i++))}))})}function ym(e,t,n){return void 0===n&&(n=1/0),gg(t)?ym(function(n,r){return mm(function(e,i){return t(n,e,r,i)})(im(e(n,r)))},n):("number"==typeof t&&(n=t),jg(function(t,r){return function(e,t,n,r,i,a,s){var o=[],c=0,u=0,l=!1,d=function(){!l||o.length||c||t.complete()},p=function(e){c++;var i=!1;im(n(e,u++)).subscribe(Lg(t,function(e){t.next(e)},function(){i=!0},void 0,function(){if(i)try{c--;for(var e=function(){var e=o.shift();s||p(e)};o.length&&c<r;)e();d()}catch(n){t.error(n)}}))};return e.subscribe(Lg(t,function(e){return c<r?p(e):o.push(e)},function(){l=!0,d()})),function(){}}(t,r,e,n)}))}function vm(e){return new Fg(function(t){im(e()).subscribe(t)})}function wm(e){return jg(function(t,n){var r,i=null,a=!1;i=t.subscribe(Lg(n,void 0,void 0,function(s){r=im(e(s,wm(e)(t))),i?(i.unsubscribe(),i=null,r.subscribe(n)):a=!0})),a&&(i.unsubscribe(),i=null,r.subscribe(n))})}function bm(e,t){return gg(t)?ym(e,t,1):ym(e,1)}function Sm(e){return jg(function(t,n){try{t.subscribe(n)}finally{n.add(e)}})}function Em(e){return jg(function(t,n){im(e).subscribe(Lg(n,function(){return n.complete()},kg)),!n.closed&&t.subscribe(n)})}function _m(e){return" \r\n\t".indexOf(e)>=0}function Am(e){for(var t,n,r,i=["topLevel"],a=0,s=function(e){return i.push(e)},o=function(e){return i[i.length-1]=e},c=function(e){null==t&&(t=a,n=i.length,r=e)},u=function(e){e===r&&(t=void 0,n=void 0,r=void 0)},l=function(){return i.pop()},d=function(){return a--},p=function(e){if("0"<=e&&e<="9")s("number");else switch(e){case'"':return void s("string");case"-":return void s("numberNeedsDigit");case"t":return void s("true");case"f":return void s("false");case"n":return void s("null");case"[":return void s("arrayNeedsValue");case"{":return void s("objectNeedsKey")}},f=e.length;a<f;a++){var h=e[a];switch(i[i.length-1]){case"topLevel":p(h);break;case"string":switch(h){case'"':l();break;case"\\":c("stringEscape"),s("stringEscaped")}break;
29case"stringEscaped":"u"===h?s("stringUnicode"):(u("stringEscape"),l());break;case"stringUnicode":a-e.lastIndexOf("u",a)===4&&(u("stringEscape"),l());break;case"number":"."===h?o("numberNeedsDigit"):"e"===h||"E"===h?o("numberNeedsExponent"):(h<"0"||h>"9")&&(d(),l());break;case"numberNeedsDigit":o("number");break;case"numberNeedsExponent":o("+"===h||"-"===h?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(h<"a"||h>"z")&&(d(),l());break;case"arrayNeedsValue":"]"===h?l():_m(h)||(u("collectionItem"),o("arrayNeedsComma"),p(h));break;case"arrayNeedsComma":"]"===h?l():","===h&&(c("collectionItem"),o("arrayNeedsValue"));break;case"objectNeedsKey":"}"===h?l():'"'===h&&(c("collectionItem"),o("objectNeedsColon"),s("string"));break;case"objectNeedsColon":":"===h&&o("objectNeedsValue");break;case"objectNeedsValue":_m(h)||(u("collectionItem"),o("objectNeedsComma"),p(h));break;case"objectNeedsComma":"}"===h?l():","===h&&(c("collectionItem"),o("objectNeedsKey"))}}null!=n&&(i.length=n);for(var g=[null!=t?e.slice(0,t):e],m=function(t){return g.push(t.slice(e.length-e.lastIndexOf(t[0])))},y=i.length-1;y>=0;y--)switch(i[y]){case"string":g.push('"');break;case"numberNeedsDigit":case"numberNeedsExponent":g.push("0");break;case"true":m("true");break;case"false":m("false");break;case"null":m("null");break;case"arrayNeedsValue":case"arrayNeedsComma":g.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":g.push("}")}return g.join("")}function Im(){let e=0,t=0;for(let r=0;r<28;r+=7){let n=this.buf[this.pos++];if(e|=(127&n)<<r,!(128&n))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(15&n)<<28,t=(112&n)>>4,!(128&n))return this.assertBounds(),[e,t];for(let r=3;r<=31;r+=7){let n=this.buf[this.pos++];if(t|=(127&n)<<r,!(128&n))return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function km(e,t,n){for(let a=0;a<28;a+=7){const r=e>>>a,i=!(r>>>7==0&&0==t),s=255&(i?128|r:r);if(n.push(s),!i)return}const r=e>>>28&15|(7&t)<<4,i=!!(t>>3);if(n.push(255&(i?128|r:r)),i){for(let e=3;e<31;e+=7){const r=t>>>e,i=!(r>>>7==0),a=255&(i?128|r:r);if(n.push(a),!i)return}n.push(t>>>31&1)}}const Tm=4294967296;function Cm(e){const t="-"===e[0];t&&(e=e.slice(1));const n=1e6;let r=0,i=0;function a(t,a){const s=Number(e.slice(t,a));i*=n,r=r*n+s,r>=Tm&&(i+=r/Tm|0,r%=Tm)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?Rm(r,i):Om(r,i)}function xm(e,t){if(({lo:e,hi:t}=function(e,t){return{lo:e>>>0,hi:t>>>0}}(e,t)),t<=2097151)return String(Tm*t+e);const n=16777215&(e>>>24|t<<8),r=t>>16&65535;let i=(16777215&e)+6777216*n+6710656*r,a=n+8147497*r,s=2*r;const o=1e7;return i>=o&&(a+=Math.floor(i/o),i%=o),a>=o&&(s+=Math.floor(a/o),a%=o),s.toString()+Nm(a)+Nm(i)}function Om(e,t){return{lo:0|e,hi:0|t}}function Rm(e,t){return t=~t,e?e=1+~e:t+=1,Om(e,t)}const Nm=e=>{const t=String(e);return"0000000".slice(t.length)+t};function Dm(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(127&e|128),e>>=7;t.push(1)}}function Mm(){let e=this.buf[this.pos++],t=127&e;if(!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<7,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<14,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<21,!(128&e))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(15&e)<<28;for(let n=5;128&e&&n<10;n++)e=this.buf[this.pos++];if(128&e)throw new Error("invalid varint");return this.assertBounds(),t>>>0}var Pm={};const qm=Fm();function Fm(){const e=new DataView(new ArrayBuffer(8));if(!("function"!=typeof BigInt||"function"!=typeof e.getBigInt64||"function"!=typeof e.getBigUint64||"function"!=typeof e.setBigInt64||"function"!=typeof e.setBigUint64||!globalThis.Deno&&!globalThis.Bun&&"object"==typeof process&&"1"===Pm.BUF_BIGINT_DISABLE)){const t=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),r=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(e){const r="bigint"==typeof e?e:BigInt(e);if(r>n||r<t)throw new Error(`invalid int64: ${e}`);return r},uParse(e){const t="bigint"==typeof e?e:BigInt(e);if(t>i||t<r)throw new Error(`invalid uint64: ${e}`);return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)),uDec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0))}}return{zero:"0",supported:!1,parse:e=>("string"!=typeof e&&(e=e.toString()),Um(e),e),uParse:e=>("string"!=typeof e&&(e=e.toString()),jm(e),e),enc:e=>("string"!=typeof e&&(e=e.toString()),Um(e),Cm(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),jm(e),Cm(e)),dec:(e,t)=>function(e,t){let n=Om(e,t);const r=2147483648&n.hi;r&&(n=Rm(n.lo,n.hi));const i=xm(n.lo,n.hi);return r?"-"+i:i}(e,t),uDec:(e,t)=>xm(e,t)}}function Um(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function jm(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}const Lm=Symbol.for("@bufbuild/protobuf/text-encoding");function $m(){if(null==globalThis[Lm]){const e=new globalThis.TextEncoder,t=new globalThis.TextDecoder;let n;globalThis[Lm]={encodeUtf8:t=>e.encode(t),decodeUtf8:(e,r)=>r?(void 0===n&&(n=new globalThis.TextDecoder("utf-8",{fatal:!0})),n.decode(e)):t.decode(e),checkUtf8(e){try{return encodeURIComponent(e),!0}catch(t){return!1}}}}return globalThis[Lm]}var Vm,Gm;(Gm=Vm||(Vm={}))[Gm.Varint=0]="Varint",Gm[Gm.Bit64=1]="Bit64",Gm[Gm.LengthDelimited=2]="LengthDelimited",Gm[Gm.StartGroup=3]="StartGroup",Gm[Gm.EndGroup=4]="EndGroup",Gm[Gm.Bit32=5]="Bit32";const Qm=34028234663852886e22,zm=-34028234663852886e22;class Hm{constructor(e=$m().encodeUtf8){this.encodeUtf8=e,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let e=0;for(let r=0;r<this.chunks.length;r++)e+=this.chunks[r].length;let t=new Uint8Array(e),n=0;for(let r=0;r<this.chunks.length;r++)t.set(this.chunks[r],n),n+=this.chunks[r].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(Ym(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return Km(e),Dm(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.encodeUtf8(e);return this.uint32(t.byteLength),this.raw(t)}float(e){!function(e){if("string"==typeof e){const t=e;if(e=Number(e),Number.isNaN(e)&&"NaN"!==t)throw new Error("invalid float32: "+t)}else if("number"!=typeof e)throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>Qm||e<zm))throw new Error("invalid float32: "+e)}(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){Ym(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){Km(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return Km(e),Dm(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=qm.enc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=qm.uEnc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=qm.enc(e);return km(t.lo,t.hi,this.buf),this}sint64(e){const t=qm.enc(e),n=t.hi>>31;return km(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){const t=qm.uEnc(e);return km(t.lo,t.hi,this.buf),this}}class Bm{constructor(e,t=$m().decodeUtf8){this.decodeUtf8=t,this.varint64=Im,this.uint32=Mm,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){const e=this.pos,t=this.uint32(),n=this.pos-e;if(n>5||5==n&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");const r=t>>>3,i=7&t;if(r<=0||i>5)throw new Error("illegal tag: field no "+r+" wire type "+i);return[r,i]}skip(e,t,n=100){let r=this.pos;switch(e){case Vm.Varint:for(;128&this.buf[this.pos++];);break;case Vm.Bit64:this.pos+=4;case Vm.Bit32:this.pos+=4;break;case Vm.LengthDelimited:let r=this.uint32();this.pos+=r;break;case Vm.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){const[e,r]=this.tag();if(r===Vm.EndGroup){if(void 0!==t&&e!==t)throw new Error("invalid end group tag");break}this.skip(r,e,n-1)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(r,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return qm.dec(...this.varint64())}uint64(){return qm.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(1&e);return e=(e>>>1|(1&t)<<31)^n,t=t>>>1^n,qm.dec(e,t)}bool(){let[e,t]=this.varint64();return 0!==e||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return qm.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return qm.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 e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(e){return this.decodeUtf8(this.bytes(),e)}}function Km(e){if("string"==typeof e)e=Number(e);else if("number"!=typeof e)throw new Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw new Error("invalid int32: "+e)}function Ym(e){if("string"==typeof e)e=Number(e);else if("number"!=typeof e)throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw new Error("invalid uint32: "+e)}let Zm=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});const Wm={encode:(e,t=new Hm)=>
29(Object.entries(e.fields).forEach(([e,n])=>{void 0!==n&&Jm.encode({key:e,value:n},t.uint32(10).fork()).join()}),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={fields:{}};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:{if(10!==e)break;const t=Jm.decode(n,n.uint32());void 0!==t.value&&(i.fields[t.key]=t.value);continue}}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>Wm.fromPartial(e??{}),fromPartial(e){const t={fields:{}};return t.fields=Object.entries(e.fields??{}).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),{}),t},wrap(e){const t={fields:{}};if(void 0!==e)for(const n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){const t={};if(e.fields)for(const n of Object.keys(e.fields))t[n]=e.fields[n];return t}};const Jm={encode:(e,t=new Hm)=>(""!==e.key&&t.uint32(10).string(e.key),void 0!==e.value&&Xm.encode(Xm.wrap(e.value),t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={key:"",value:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.key=n.string();continue;case 2:if(18!==e)break;i.value=Xm.unwrap(Xm.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>Jm.fromPartial(e??{}),fromPartial(e){const t={key:"",value:void 0};return t.key=e.key??"",t.value=e.value??void 0,t}};const Xm={encode:(e,t=new Hm)=>(void 0!==e.nullValue&&t.uint32(8).int32(e.nullValue),void 0!==e.numberValue&&t.uint32(17).double(e.numberValue),void 0!==e.stringValue&&t.uint32(26).string(e.stringValue),void 0!==e.boolValue&&t.uint32(32).bool(e.boolValue),void 0!==e.structValue&&Wm.encode(Wm.wrap(e.structValue),t.uint32(42).fork()).join(),void 0!==e.listValue&&ey.encode(ey.wrap(e.listValue),t.uint32(50).fork()).join(),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;i.nullValue=n.int32();continue;case 2:if(17!==e)break;i.numberValue=n.double();continue;case 3:if(26!==e)break;
29i.stringValue=n.string();continue;case 4:if(32!==e)break;i.boolValue=n.bool();continue;case 5:if(42!==e)break;i.structValue=Wm.unwrap(Wm.decode(n,n.uint32()));continue;case 6:if(50!==e)break;i.listValue=ey.unwrap(ey.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>Xm.fromPartial(e??{}),fromPartial(e){const t={nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0};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){const t={nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0};if(null===e)t.nullValue=Zm.NULL_VALUE;else if("boolean"==typeof e)t.boolValue=e;else if("number"==typeof e)t.numberValue=e;else if("string"==typeof e)t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if("object"==typeof e)t.structValue=e;else if(void 0!==e)throw new globalThis.Error("Unsupported any value type: "+typeof e);return t},unwrap:e=>void 0!==e.stringValue?e.stringValue:void 0!==e?.numberValue?e.numberValue:void 0!==e?.boolValue?e.boolValue:void 0!==e?.structValue?e.structValue:void 0!==e?.listValue?e.listValue:void 0!==e?.nullValue?null:void 0};const ey={encode(e,t=new Hm){for(const n of e.values)Xm.encode(Xm.wrap(n),t.uint32(10).fork()).join();return t},decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={values:[]};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.values.push(Xm.unwrap(Xm.decode(n,n.uint32())));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>ey.fromPartial(e??{}),fromPartial(e){const t={values:[]};return t.values=e.values?.map(e=>e)||[],t},wrap(e){const t={values:[]};return t.values=e??[],t},unwrap:e=>e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e};let ty=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}({});const ny={encode:(e,t=new Hm)=>(0!==e.op&&t.uint32(8).int32(e.op),""!==e.path&&t.uint32(18).string(e.path),void 0!==e.from&&t.uint32(26).string(e.from),void 0!==e.value&&Xm.encode(Xm.wrap(e.value),t.uint32(34).fork()).join(),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={op:0,path:"",from:void 0,value:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;i.op=n.int32();continue;case 2:if(18!==e)break;i.path=n.string();continue;case 3:if(26!==e)break;i.from=n.string();continue;case 4:if(34!==e)break;i.value=Xm.unwrap(Xm.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>ny.fromPartial(e??{}),fromPartial(e){const t={op:0,path:"",from:void 0,value:void 0};return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};const ry={encode:(e,t=new Hm)=>(""!==e.id&&t.uint32(10).string(e.id),""!==e.type&&t.uint32(18).string(e.type),void 0!==e.function&&iy.encode(e.function,t.uint32(26).fork()).join(),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={id:"",type:"",function:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.id=n.string();continue;case 2:if(18!==e)break;i.type=n.string();continue;case 3:if(26!==e)break;i.function=iy.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>ry.fromPartial(e??{}),fromPartial(e){const t={id:"",type:"",function:void 0};return t.id=e.id??"",t.type=e.type??"",t.function=void 0!==e.function&&null!==e.function?iy.fromPartial(e.function):void 0,t}};const iy={encode:(e,t=new Hm)=>(""!==e.name&&t.uint32(10).string(e.name),""!==e.arguments&&t.uint32(18).string(e.arguments),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={name:"",arguments:""};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.name=n.string();continue;case 2:if(18!==e)break;i.arguments=n.string();continue}if(4==(7&e)||0===e)break;
29n.skip(7&e)}return i},create:e=>iy.fromPartial(e??{}),fromPartial(e){const t={name:"",arguments:""};return t.name=e.name??"",t.arguments=e.arguments??"",t}};const ay={encode:(e,t=new Hm)=>(""!==e.value&&t.uint32(10).string(e.value),""!==e.mimeType&&t.uint32(18).string(e.mimeType),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={value:"",mimeType:""};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.value=n.string();continue;case 2:if(18!==e)break;i.mimeType=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>ay.fromPartial(e??{}),fromPartial(e){const t={value:"",mimeType:""};return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};const sy={encode:(e,t=new Hm)=>(""!==e.value&&t.uint32(10).string(e.value),void 0!==e.mimeType&&t.uint32(18).string(e.mimeType),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={value:"",mimeType:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.value=n.string();continue;case 2:if(18!==e)break;i.mimeType=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>sy.fromPartial(e??{}),fromPartial(e){const t={value:"",mimeType:void 0};return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};const oy={encode:(e,t=new Hm)=>(void 0!==e.data&&ay.encode(e.data,t.uint32(10).fork()).join(),void 0!==e.url&&sy.encode(e.url,t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={data:void 0,url:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.data=ay.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.url=sy.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>oy.fromPartial(e??{}),fromPartial(e){const t={data:void 0,url:void 0};return t.data=void 0!==e.data&&null!==e.data?ay.fromPartial(e.data):void 0,t.url=void 0!==e.url&&null!==e.url?sy.fromPartial(e.url):void 0,t}};const cy={encode:(e,t=new Hm)=>(""!==e.text&&t.uint32(10).string(e.text),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={text:""};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.text=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>cy.fromPartial(e??{}),fromPartial(e){const t={text:""};return t.text=e.text??"",t}};const uy={encode:(e,t=new Hm)=>(void 0!==e.source&&oy.encode(e.source,t.uint32(10).fork()).join(),void 0!==e.metadata&&Xm.encode(Xm.wrap(e.metadata),t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={source:void 0,metadata:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.source=oy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.metadata=Xm.unwrap(Xm.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>uy.fromPartial(e??{}),fromPartial(e){const t={source:void 0,metadata:void 0};return t.source=void 0!==e.source&&null!==e.source?oy.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};const ly={encode:(e,t=new Hm)=>(void 0!==e.source&&oy.encode(e.source,t.uint32(10).fork()).join(),void 0!==e.metadata&&Xm.encode(Xm.wrap(e.metadata),t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={source:void 0,metadata:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.source=oy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.metadata=Xm.unwrap(Xm.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>ly.fromPartial(e??{}),fromPartial(e){const t={source:void 0,metadata:void 0};return t.source=void 0!==e.source&&null!==e.source?oy.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};const dy={encode:(e,t=new Hm)=>(void 0!==e.source&&oy.encode(e.source,t.uint32(10).fork()).join(),void 0!==e.metadata&&Xm.encode(Xm.wrap(e.metadata),t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={source:void 0,metadata:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.source=oy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.metadata=Xm.unwrap(Xm.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;
29n.skip(7&e)}return i},create:e=>dy.fromPartial(e??{}),fromPartial(e){const t={source:void 0,metadata:void 0};return t.source=void 0!==e.source&&null!==e.source?oy.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};const py={encode:(e,t=new Hm)=>(void 0!==e.source&&oy.encode(e.source,t.uint32(10).fork()).join(),void 0!==e.metadata&&Xm.encode(Xm.wrap(e.metadata),t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={source:void 0,metadata:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.source=oy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.metadata=Xm.unwrap(Xm.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>py.fromPartial(e??{}),fromPartial(e){const t={source:void 0,metadata:void 0};return t.source=void 0!==e.source&&null!==e.source?oy.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};const fy={encode:(e,t=new Hm)=>(void 0!==e.text&&cy.encode(e.text,t.uint32(10).fork()).join(),void 0!==e.image&&uy.encode(e.image,t.uint32(18).fork()).join(),void 0!==e.audio&&ly.encode(e.audio,t.uint32(26).fork()).join(),void 0!==e.video&&dy.encode(e.video,t.uint32(34).fork()).join(),void 0!==e.document&&py.encode(e.document,t.uint32(42).fork()).join(),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.text=cy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.image=uy.decode(n,n.uint32());continue;case 3:if(26!==e)break;i.audio=ly.decode(n,n.uint32());continue;case 4:if(34!==e)break;i.video=dy.decode(n,n.uint32());continue;case 5:if(42!==e)break;i.document=py.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>fy.fromPartial(e??{}),fromPartial(e){const t={text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0};return t.text=void 0!==e.text&&null!==e.text?cy.fromPartial(e.text):void 0,t.image=void 0!==e.image&&null!==e.image?uy.fromPartial(e.image):void 0,t.audio=void 0!==e.audio&&null!==e.audio?ly.fromPartial(e.audio):void 0,t.video=void 0!==e.video&&null!==e.video?dy.fromPartial(e.video):void 0,t.document=void 0!==e.document&&null!==e.document?py.fromPartial(e.document):void 0,t}};const hy={encode(e,t=new Hm){""!==e.id&&t.uint32(10).string(e.id),""!==e.role&&t.uint32(18).string(e.role),void 0!==e.content&&t.uint32(26).string(e.content),void 0!==e.name&&t.uint32(34).string(e.name);for(const n of e.toolCalls)ry.encode(n,t.uint32(42).fork()).join();void 0!==e.toolCallId&&t.uint32(50).string(e.toolCallId),void 0!==e.error&&t.uint32(58).string(e.error);for(const n of e.contentParts)fy.encode(n,t.uint32(66).fork()).join();return t},decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.id=n.string();continue;case 2:if(18!==e)break;i.role=n.string();continue;case 3:if(26!==e)break;i.content=n.string();continue;case 4:if(34!==e)break;i.name=n.string();continue;case 5:if(42!==e)break;i.toolCalls.push(ry.decode(n,n.uint32()));continue;case 6:if(50!==e)break;i.toolCallId=n.string();continue;case 7:if(58!==e)break;i.error=n.string();continue;case 8:if(66!==e)break;i.contentParts.push(fy.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>hy.fromPartial(e??{}),fromPartial(e){const t={id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]};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(e=>ry.fromPartial(e))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(e=>fy.fromPartial(e))||[],t}};const gy={encode:(e,t=new Hm)=>(""!==e.id&&t.uint32(10).string(e.id),""!==e.reason&&t.uint32(18).string(e.reason),void 0!==e.message&&t.uint32(26).string(e.message),void 0!==e.toolCallId&&t.uint32(34).string(e.toolCallId),void 0!==e.responseSchema&&Xm.encode(Xm.wrap(e.responseSchema),t.uint32(42).fork()).join(),void 0!==e.expiresAt&&t.uint32(50).string(e.expiresAt),void 0!==e.metadata&&Xm.encode(Xm.wrap(e.metadata),t.uint32(58).fork()).join(),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.id=n.string();continue;case 2:if(18!==e)break;i.reason=n.string();continue;case 3:if(26!==e)break;i.message=n.string();continue;case 4:if(34!==e)break;i.toolCallId=n.string();continue;case 5:if(42!==e)break;i.responseSchema=Xm.unwrap(Xm.decode(n,n.uint32()));continue;case 6:if(50!==e)break;i.expiresAt=n.string();continue;case 7:if(58!==e)break;i.metadata=Xm.unwrap(Xm.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;
29n.skip(7&e)}return i},create:e=>gy.fromPartial(e??{}),fromPartial(e){const t={id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0};return t.id=e.id??"",t.reason=e.reason??"",t.message=e.message??void 0,t.toolCallId=e.toolCallId??void 0,t.responseSchema=e.responseSchema??void 0,t.expiresAt=e.expiresAt??void 0,t.metadata=e.metadata??void 0,t}};let my=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}({});const yy={encode:(e,t=new Hm)=>(0!==e.type&&t.uint32(8).int32(e.type),void 0!==e.timestamp&&t.uint32(16).int64(e.timestamp),void 0!==e.rawEvent&&Xm.encode(Xm.wrap(e.rawEvent),t.uint32(26).fork()).join(),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={type:0,timestamp:void 0,rawEvent:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;i.type=n.int32();continue;case 2:if(16!==e)break;i.timestamp=Fy(n.int64());continue;case 3:if(26!==e)break;i.rawEvent=Xm.unwrap(Xm.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>yy.fromPartial(e??{}),fromPartial(e){const t={type:0,timestamp:void 0,rawEvent:void 0};return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};const vy={encode:(e,t=new Hm)=>(void 0!==e.baseEvent&&yy.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.messageId&&t.uint32(18).string(e.messageId),void 0!==e.role&&t.uint32(26).string(e.role),void 0!==e.name&&t.uint32(34).string(e.name),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,messageId:"",role:void 0,name:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.messageId=n.string();continue;case 3:if(26!==e)break;i.role=n.string();continue;case 4:if(34!==e)break;i.name=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>vy.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,messageId:"",role:void 0,name:void 0};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};const wy={encode:(e,t=new Hm)=>(void 0!==e.baseEvent&&yy.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){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,messageId:"",delta:""};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.messageId=n.string();continue;case 3:if(26!==e)break;i.delta=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>wy.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,messageId:"",delta:""};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};const by={encode:(e,t=new Hm)=>(void 0!==e.baseEvent&&yy.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.messageId&&t.uint32(18).string(e.messageId),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,messageId:""};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.messageId=n.string();continue}if(4==(7&e)||0===e)break;
29n.skip(7&e)}return i},create:e=>by.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,messageId:""};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};const Sy={encode:(e,t=new Hm)=>(void 0!==e.baseEvent&&yy.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.toolCallId&&t.uint32(18).string(e.toolCallId),""!==e.toolCallName&&t.uint32(26).string(e.toolCallName),void 0!==e.parentMessageId&&t.uint32(34).string(e.parentMessageId),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.toolCallId=n.string();continue;case 3:if(26!==e)break;i.toolCallName=n.string();continue;case 4:if(34!==e)break;i.parentMessageId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>Sy.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};const Ey={encode:(e,t=new Hm)=>(void 0!==e.baseEvent&&yy.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){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,toolCallId:"",delta:""};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.toolCallId=n.string();continue;case 3:if(26!==e)break;i.delta=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>Ey.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,toolCallId:"",delta:""};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};const _y={encode:(e,t=new Hm)=>(void 0!==e.baseEvent&&yy.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.toolCallId&&t.uint32(18).string(e.toolCallId),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,toolCallId:""};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.toolCallId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>_y.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,toolCallId:""};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};const Ay={encode:(e,t=new Hm)=>(void 0!==e.baseEvent&&yy.encode(e.baseEvent,t.uint32(10).fork()).join(),void 0!==e.snapshot&&Xm.encode(Xm.wrap(e.snapshot),t.uint32(18).fork()).join(),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,snapshot:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.snapshot=Xm.unwrap(Xm.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>Ay.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,snapshot:void 0};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};const Iy={encode(e,t=new Hm){void 0!==e.baseEvent&&yy.encode(e.baseEvent,t.uint32(10).fork()).join();for(const n of e.delta)ny.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,delta:[]};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.delta.push(ny.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;
29n.skip(7&e)}return i},create:e=>Iy.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,delta:[]};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(e=>ny.fromPartial(e))||[],t}};const ky={encode(e,t=new Hm){void 0!==e.baseEvent&&yy.encode(e.baseEvent,t.uint32(10).fork()).join();for(const n of e.messages)hy.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,messages:[]};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.messages.push(hy.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>ky.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,messages:[]};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(e=>hy.fromPartial(e))||[],t}};const Ty={encode:(e,t=new Hm)=>(void 0!==e.baseEvent&&yy.encode(e.baseEvent,t.uint32(10).fork()).join(),void 0!==e.event&&Xm.encode(Xm.wrap(e.event),t.uint32(18).fork()).join(),void 0!==e.source&&t.uint32(26).string(e.source),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,event:void 0,source:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.event=Xm.unwrap(Xm.decode(n,n.uint32()));continue;case 3:if(26!==e)break;i.source=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>Ty.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,event:void 0,source:void 0};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};const Cy={encode:(e,t=new Hm)=>(void 0!==e.baseEvent&&yy.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.name&&t.uint32(18).string(e.name),void 0!==e.value&&Xm.encode(Xm.wrap(e.value),t.uint32(26).fork()).join(),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,name:"",value:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.name=n.string();continue;case 3:if(26!==e)break;i.value=Xm.unwrap(Xm.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>Cy.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,name:"",value:void 0};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};const xy={encode:(e,t=new Hm)=>(void 0!==e.baseEvent&&yy.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){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,threadId:"",runId:""};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.threadId=n.string();continue;case 3:if(26!==e)break;i.runId=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>xy.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,threadId:"",runId:""};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};const Oy={encode(e,t=new Hm){void 0!==e.baseEvent&&yy.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.threadId&&t.uint32(18).string(e.threadId),""!==e.runId&&t.uint32(26).string(e.runId),void 0!==e.result&&Xm.encode(Xm.wrap(e.result),t.uint32(34).fork()).join(),""!==e.outcome&&t.uint32(42).string(e.outcome);for(const n of e.interrupts)gy.encode(n,t.uint32(50).fork()).join();return t},decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[]};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.threadId=n.string();continue;case 3:if(26!==e)break;
29i.runId=n.string();continue;case 4:if(34!==e)break;i.result=Xm.unwrap(Xm.decode(n,n.uint32()));continue;case 5:if(42!==e)break;i.outcome=n.string();continue;case 6:if(50!==e)break;i.interrupts.push(gy.decode(n,n.uint32()));continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>Oy.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[]};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interrupts=e.interrupts?.map(e=>gy.fromPartial(e))||[],t}};const Ry={encode:(e,t=new Hm)=>(void 0!==e.baseEvent&&yy.encode(e.baseEvent,t.uint32(10).fork()).join(),void 0!==e.code&&t.uint32(18).string(e.code),""!==e.message&&t.uint32(26).string(e.message),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,code:void 0,message:""};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.code=n.string();continue;case 3:if(26!==e)break;i.message=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>Ry.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,code:void 0,message:""};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};const Ny={encode:(e,t=new Hm)=>(void 0!==e.baseEvent&&yy.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.stepName&&t.uint32(18).string(e.stepName),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,stepName:""};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.stepName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>Ny.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,stepName:""};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};const Dy={encode:(e,t=new Hm)=>(void 0!==e.baseEvent&&yy.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.stepName&&t.uint32(18).string(e.stepName),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,stepName:""};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.stepName=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>Dy.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,stepName:""};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};const My={encode:(e,t=new Hm)=>(void 0!==e.baseEvent&&yy.encode(e.baseEvent,t.uint32(10).fork()).join(),void 0!==e.messageId&&t.uint32(18).string(e.messageId),void 0!==e.role&&t.uint32(26).string(e.role),void 0!==e.delta&&t.uint32(34).string(e.delta),void 0!==e.name&&t.uint32(42).string(e.name),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.messageId=n.string();continue;case 3:if(26!==e)break;i.role=n.string();continue;case 4:if(34!==e)break;i.delta=n.string();continue;case 5:if(42!==e)break;i.name=n.string();continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>My.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t}};const Py={encode:(e,t=new Hm)=>(void 0!==e.baseEvent&&yy.encode(e.baseEvent,t.uint32(10).fork()).join(),void 0!==e.toolCallId&&t.uint32(18).string(e.toolCallId),void 0!==e.toolCallName&&t.uint32(26).string(e.toolCallName),void 0!==e.parentMessageId&&t.uint32(34).string(e.parentMessageId),void 0!==e.delta&&t.uint32(42).string(e.delta),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=yy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.toolCallId=n.string();continue;case 3:if(26!==e)break;i.toolCallName=n.string();continue;case 4:if(34!==e)break;i.parentMessageId=n.string();continue;case 5:if(42!==e)break;i.delta=n.string();continue}if(4==(7&e)||0===e)break;
29n.skip(7&e)}return i},create:e=>Py.fromPartial(e??{}),fromPartial(e){const t={baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0};return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?yy.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}};const qy={encode:(e,t=new Hm)=>(void 0!==e.textMessageStart&&vy.encode(e.textMessageStart,t.uint32(10).fork()).join(),void 0!==e.textMessageContent&&wy.encode(e.textMessageContent,t.uint32(18).fork()).join(),void 0!==e.textMessageEnd&&by.encode(e.textMessageEnd,t.uint32(26).fork()).join(),void 0!==e.toolCallStart&&Sy.encode(e.toolCallStart,t.uint32(34).fork()).join(),void 0!==e.toolCallArgs&&Ey.encode(e.toolCallArgs,t.uint32(42).fork()).join(),void 0!==e.toolCallEnd&&_y.encode(e.toolCallEnd,t.uint32(50).fork()).join(),void 0!==e.stateSnapshot&&Ay.encode(e.stateSnapshot,t.uint32(58).fork()).join(),void 0!==e.stateDelta&&Iy.encode(e.stateDelta,t.uint32(66).fork()).join(),void 0!==e.messagesSnapshot&&ky.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),void 0!==e.raw&&Ty.encode(e.raw,t.uint32(82).fork()).join(),void 0!==e.custom&&Cy.encode(e.custom,t.uint32(90).fork()).join(),void 0!==e.runStarted&&xy.encode(e.runStarted,t.uint32(98).fork()).join(),void 0!==e.runFinished&&Oy.encode(e.runFinished,t.uint32(106).fork()).join(),void 0!==e.runError&&Ry.encode(e.runError,t.uint32(114).fork()).join(),void 0!==e.stepStarted&&Ny.encode(e.stepStarted,t.uint32(122).fork()).join(),void 0!==e.stepFinished&&Dy.encode(e.stepFinished,t.uint32(130).fork()).join(),void 0!==e.textMessageChunk&&My.encode(e.textMessageChunk,t.uint32(138).fork()).join(),void 0!==e.toolCallChunk&&Py.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t),decode(e,t){const n=e instanceof Bm?e:new Bm(e),r=void 0===t?n.len:n.pos+t,i={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};for(;n.pos<r;){const e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.textMessageStart=vy.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.textMessageContent=wy.decode(n,n.uint32());continue;case 3:if(26!==e)break;i.textMessageEnd=by.decode(n,n.uint32());continue;case 4:if(34!==e)break;i.toolCallStart=Sy.decode(n,n.uint32());continue;case 5:if(42!==e)break;i.toolCallArgs=Ey.decode(n,n.uint32());continue;case 6:if(50!==e)break;i.toolCallEnd=_y.decode(n,n.uint32());continue;case 7:if(58!==e)break;i.stateSnapshot=Ay.decode(n,n.uint32());continue;case 8:if(66!==e)break;i.stateDelta=Iy.decode(n,n.uint32());continue;case 9:if(74!==e)break;i.messagesSnapshot=ky.decode(n,n.uint32());continue;case 10:if(82!==e)break;i.raw=Ty.decode(n,n.uint32());continue;case 11:if(90!==e)break;i.custom=Cy.decode(n,n.uint32());continue;case 12:if(98!==e)break;i.runStarted=xy.decode(n,n.uint32());continue;case 13:if(106!==e)break;i.runFinished=Oy.decode(n,n.uint32());continue;case 14:if(114!==e)break;i.runError=Ry.decode(n,n.uint32());continue;case 15:if(122!==e)break;i.stepStarted=Ny.decode(n,n.uint32());continue;case 16:if(130!==e)break;i.stepFinished=Dy.decode(n,n.uint32());continue;case 17:if(138!==e)break;i.textMessageChunk=My.decode(n,n.uint32());continue;case 18:if(146!==e)break;i.toolCallChunk=Py.decode(n,n.uint32());continue}if(4==(7&e)||0===e)break;n.skip(7&e)}return i},create:e=>qy.fromPartial(e??{}),fromPartial(e){const t={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};return t.textMessageStart=void 0!==e.textMessageStart&&null!==e.textMessageStart?vy.fromPartial(e.textMessageStart):void 0,t.textMessageContent=void 0!==e.textMessageContent&&null!==e.textMessageContent?wy.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=void 0!==e.textMessageEnd&&null!==e.textMessageEnd?by.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=void 0!==e.toolCallStart&&null!==e.toolCallStart?Sy.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=void 0!==e.toolCallArgs&&null!==e.toolCallArgs?Ey.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=void 0!==e.toolCallEnd&&null!==e.toolCallEnd?_y.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=void 0!==e.stateSnapshot&&null!==e.stateSnapshot?Ay.fromPartial(e.stateSnapshot):void 0,t.stateDelta=void 0!==e.stateDelta&&null!==e.stateDelta?Iy.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=void 0!==e.messagesSnapshot&&null!==e.messagesSnapshot?ky.fromPartial(e.messagesSnapshot):void 0,t.raw=void 0!==e.raw&&null!==e.raw?Ty.fromPartial(e.raw):void 0,t.custom=void 0!==e.custom&&null!==e.custom?Cy.fromPartial(e.custom):void 0,t.runStarted=void 0!==e.runStarted&&null!==e.runStarted?xy.fromPartial(e.runStarted):void 0,t.runFinished=void 0!==e.runFinished&&null!==e.runFinished?Oy.fromPartial(e.runFinished):void 0,t.runError=void 0!==e.runError&&null!==e.runError?Ry.fromPartial(e.runError):void 0,t.stepStarted=void 0!==e.stepStarted&&null!==e.stepStarted?Ny.fromPartial(e.stepStarted):void 0,t.stepFinished=void 0!==e.stepFinished&&null!==e.stepFinished?Dy.fromPartial(e.stepFinished):void 0,t.textMessageChunk=void 0!==e.textMessageChunk&&null!==e.textMessageChunk?My.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=void 0!==e.toolCallChunk&&null!==e.toolCallChunk?Py.fromPartial(e.toolCallChunk):void 0,t}};function Fy(e){const t=globalThis.Number(e.toString());if(t>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<globalThis.Number.MIN_SAFE_INTEGER)throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}const Uy=e=>{if(e&&"object"==typeof e)return e.data?{type:"data",value:e.data.value,mimeType:e.data.mimeType}:e.url?{type:"url",value:e.url.value,mimeType:e.url.mimeType}:void 0},jy=e=>{if(e&&"object"==typeof e)return e.text?{type:"text",text:e.text.text}:e.image?{type:"image",source:Uy(e.image.source),metadata:e.image.metadata}:e.audio?{type:"audio",source:Uy(e.audio.source),metadata:e.audio.metadata}:e.video?{type:"video",source:Uy(e.video.source),metadata:e.video.metadata}:e.document?{type:"document",source:Uy(e.document.source),metadata:e.document.metadata}:void 0};function Ly(e){const t=qy.decode(e),n=Object.values(t).find(e=>void 0!==e);if(!n)throw new Error("Invalid event");
29if(n.type=my[n.baseEvent.type],n.timestamp=n.baseEvent.timestamp,n.rawEvent=n.baseEvent.rawEvent,delete n.baseEvent,n.type===Xf.MESSAGES_SNAPSHOT)for(const r of n.messages){const e=r;if("user"===e.role&&Array.isArray(e.contentParts)){const t=e.contentParts.map(e=>jy(e)).filter(e=>void 0!==e);t.length>0&&(e.content=t)}Array.isArray(e.contentParts)&&0===e.contentParts.length&&(e.contentParts=void 0),0===e.toolCalls?.length&&(e.toolCalls=void 0)}if(n.type===Xf.RUN_FINISHED){const e=n,t="string"==typeof e.outcome&&""!==e.outcome?e.outcome:void 0,r=Array.isArray(e.interrupts)?e.interrupts:[];delete e.interrupts,"interrupt"===t?e.outcome={type:"interrupt",interrupts:r}:"success"===t?e.outcome={type:"success"}:delete e.outcome}if(n.type===Xf.STATE_DELTA)for(const r of n.delta)r.op=ty[r.op].toLowerCase(),Object.keys(r).forEach(e=>{void 0===r[e]&&delete r[e]});return Object.keys(n).forEach(e=>{void 0===n[e]&&delete n[e]}),xh.parse(n)}const $y="application/vnd.ag-ui.event+proto",Vy=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Gy=e=>{if("string"!=typeof e)throw new TypeError("Invalid argument expected string");const t=e.match(Vy);
29if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Qy=e=>"*"===e||"x"===e||"X"===e,zy=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},Hy=(e,t)=>{if(Qy(e)||Qy(t))return 0;const[n,r]=((e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t])(zy(e),zy(t));return n>r?1:n<r?-1:0},By=(e,t)=>{for(let n=0;n<Math.max(e.length,t.length);n++){const r=Hy(e[n]||"0",t[n]||"0");if(0!==r)return r}return 0},Ky=(e,t)=>{const n=Gy(e),r=Gy(t),i=n.pop(),a=r.pop(),s=By(n,r);return 0!==s?s:i&&a?By(i.split("."),a.split(".")):i||a?i?-1:1:0};var Yy={};const Zy=e=>{if("function"==typeof structuredClone)return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function Wy(){return Ed()}function Jy(e){if(Object.freeze(e),"object"==typeof e&&e)for(let t of Object.values(e))"object"==typeof t&&t&&!Object.isFrozen(t)&&Jy(t);return e}const Xy=524288;function ev(e,t,n){let r=0,i=[e,t],a=new WeakSet;for(;i.length>0;){let e=i.pop();if("string"==typeof e){if(r+=e.length,r>n)return!0}else if("object"==typeof e&&e){if(a.has(e))continue;if(a.add(e),Array.isArray(e))for(let t=0;t<e.length;t++)i.push(e[t]);else{let t=Object.keys(e);for(let a=0;a<t.length;a++){let s=t[a];if(r+=s.length,r>n)return!0;i.push(e[s])}}}}return!1}async function tv(e,t,n,r){let i,a=typeof process<"u"&&void 0!==Yy,s=a&&!!Yy.VITEST_WORKER_ID,o=a&&!!Yy.VITEST_WORKER_ID,c=o&&!ev(t,n,Xy),u=c?Zy(t):t,l=c?Zy(n):n,d=!1,p=!1;for(let h of e)try{c&&(Jy(u),Jy(l));let e=await r(h,u,l);if(void 0===e)continue;let t=!1;if(void 0!==e.messages&&e.messages!==u&&(u=Zy(e.messages),d=!0,t=!0),void 0!==e.state&&e.state!==l&&(l=Zy(e.state),p=!0,t=!0),c&&t&&ev(u,l,Xy)&&(c=!1),i=e.stopPropagation,!0===i)break}catch(f){if(o&&f instanceof TypeError){if(s)throw f;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",f)}else s||console.error("Subscriber error:",f);continue}return{...d?{messages:Object.isFrozen(u)?Zy(u):u}:{},...p?{state:Object.isFrozen(l)?Zy(l):l}:{},...void 0===i?{}:{stopPropagation:i}}}function nv(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(!0===e)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,n=e.lifecycle??!0;return{enabled:t||n,events:t,lifecycle:n,verbose:e.verbose??!1}}function rv(e){return e instanceof iv?e:!0===e?new iv(nv(!0)):void 0}var iv=class{constructor(e){this.config=e}event(e,t,n,r){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,"string"==typeof n?n:JSON.stringify(n)):console.debug(`[${e}] ${t}`,r??n))}lifecycle(e,t,n){this.config.lifecycle&&(n?console.debug(`[${e}] ${t}`,n):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function av(e){return e.enabled?new iv(e):void 0}const sv=(e,t,n,r,i)=>{let a=rv(i),s=Zy(n.messages),o=Zy(e.state),c={},u=e=>{void 0!==e.messages&&(s=e.messages,c.messages=e.messages),void 0!==e.state&&(o=e.state,c.state=e.state)},l=()=>{let e=Zy(c);return c={},void 0!==e.messages||void 0!==e.state?pm(e):Bg};return t.pipe(bm(async t=>{let i=await tv(r,s,o,(r,i,a)=>r.onEvent?.({event:t,agent:n,input:e,messages:i,state:a}));if(u(i),!0===i.stopPropagation?a?.event("APPLY","Event dropped:",t,{type:t.type,reason:"stopPropagation by subscriber"}):a?.event("APPLY","Event applied:",t,{type:t.type,subscribers:r.length}),!0===i.stopPropagation)return l();switch(t.type){case Xf.TEXT_MESSAGE_START:{let i=await tv(r,s,o,(r,i,a)=>r.onTextMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(u(i),!0!==i.stopPropagation){let{messageId:e,role:n="assistant",name:r}=t;if(!s.find(t=>t.id===e)){let t={id:e,role:n,content:"",...void 0!==r&&{name:r}};s.push(t),u({messages:s})}}return l()}case Xf.TEXT_MESSAGE_CONTENT:{let{messageId:i,delta:a}=t,c=s.find(e=>e.id===i);if(!c)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${i}'`),l();let d=await tv(r,s,o,(r,i,a)=>r.onTextMessageContentEvent?.({event:t,messages:i,state:a,agent:n,input:e,textMessageBuffer:"string"==typeof c.content?c.content:""}));return u(d),!0!==d.stopPropagation&&(c.content=`${"string"==typeof c.content?c.content:""}${a}`,u({messages:s})),l()}case Xf.TEXT_MESSAGE_END:{let{messageId:i}=t,a=s.find(e=>e.id===i);return a?(u(await tv(r,s,o,(r,i,s)=>r.onTextMessageEndEvent?.({event:t,messages:i,state:s,agent:n,input:e,textMessageBuffer:"string"==typeof a.content?a.content:""}))),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:s,state:o,agent:n,input:e})})),l()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${i}'`),l())}case Xf.TOOL_CALL_START:{let i=await tv(r,s,o,(r,i,a)=>r.onToolCallStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(u(i),!0!==i.stopPropagation){let{toolCallId:e,toolCallName:n,parentMessageId:r}=t,i=function(e,t,n){if(t){let r=e.find(e=>e.id===t);if("assistant"===r?.role)return r;r&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${r.role}' message, not assistant — falling back to toolCallId`);let i={id:r?n:t,role:"assistant",toolCalls:[]};return e.push(i),i}let r={id:n,role:"assistant",toolCalls:[]};return e.push(r),r}(s,r,e);i.toolCalls??=[],i.toolCalls.push({id:e,type:"function",function:{name:n,arguments:""}}),u({messages:s})}return l()}case Xf.TOOL_CALL_ARGS:{let{toolCallId:i,delta:a}=t,c=s.find(e=>e.toolCalls?.some(e=>e.id===i));if(!c)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${i}'`),l();let d=c.toolCalls?.find(e=>e.id===i);if(!d)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${i}'`),l();let p=await tv(r,s,o,(r,i,a)=>{let s=d.function.arguments,o=d.function.name,c={};try{c=Am(s)}catch{}return r.onToolCallArgsEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallBuffer:s,toolCallName:o,partialToolCallArgs:c})});return u(p),!0!==p.stopPropagation&&(d.function.arguments+=a,u({messages:s})),l()}case Xf.TOOL_CALL_END:{let{toolCallId:i}=t,a=s.find(e=>e.toolCalls?.some(e=>e.id===i));if(!a)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${i}'`),l();let c=a.toolCalls?.find(e=>e.id===i);return c?(u(await tv(r,s,o,(r,i,a)=>{let s=c.function.arguments,o=c.function.name,u={};try{u=JSON.parse(s)}catch{}return r.onToolCallEndEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallName:o,toolCallArgs:u})})),await Promise.all(r.map(t=>{t.onNewToolCall?.({toolCall:c,messages:s,state:o,agent:n,input:e})})),l()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${i}'`),l())}case Xf.TOOL_CALL_RESULT:{let i=await tv(r,s,o,(r,i,a)=>r.onToolCallResultEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(u(i),!0!==i.stopPropagation){let{messageId:i,toolCallId:a,content:c,role:l}=t,d={id:i,toolCallId:a,role:l||"tool",content:c},p=s.findIndex(e=>"assistant"===e.role&&e.toolCalls?.some(e=>e.id===a));if(-1===p)s.push(d);else{let e=p+1;for(;e<s.length&&"tool"===s[e].role;)e++;s.splice(e,0,d)}await Promise.all(r.map(t=>{t.onNewMessage?.({message:d,messages:s,state:o,agent:n,input:e})})),u({messages:s})}return l()}case Xf.STATE_SNAPSHOT:{let i=await tv(r,s,o,(r,i,a)=>r.onStateSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(u(i),!0!==i.stopPropagation){let{snapshot:e}=t;o=e,u({state:o})}return l()}case Xf.STATE_DELTA:{let i=await tv(r,s,o,(r,i,a)=>r.onStateDeltaEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(u(i),!0!==i.stopPropagation){let{delta:e}=t;try{o=ig.applyPatch(o,e,!0,!1).newDocument,u({state:o})}catch(d){let t=d instanceof Error?d.message:String(d);console.warn(`Failed to apply state patch:\nCurrent state: ${JSON.stringify(o,null,2)}\nPatch operations: ${JSON.stringify(e,null,2)}\nError: ${t}`)}}return l()}case Xf.MESSAGES_SNAPSHOT:{let i=await tv(r,s,o,(r,i,a)=>r.onMessagesSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(u(i),!0!==i.stopPropagation){let{messages:e}
29=t,n=new Map(e.map(e=>[e.id,e])),r=e.some(e=>"reasoning"===e.role),i=e=>"activity"===e.role||"reasoning"===e.role&&!r;s=s.filter(e=>i(e)||n.has(e.id)).map(e=>i(e)?e:n.get(e.id));let a=new Set(s.map(e=>e.id));for(let t of e)a.has(t.id)||s.push(t);u({messages:s})}return l()}case Xf.ACTIVITY_SNAPSHOT:{let i=t,a=s.findIndex(e=>e.id===i.messageId),c=a>=0?s[a]:void 0,d="activity"===c?.role?c:void 0,p=i.replace??!0,f=await tv(r,s,o,(t,r,a)=>t.onActivitySnapshotEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:d,existingMessage:c}));if(u(f),!0!==f.stopPropagation){let t,c={id:i.messageId,role:"activity",activityType:i.activityType,content:Zy(i.content)};-1===a?(s.push(c),t=c):d?p&&(s[a]={...d,activityType:i.activityType,content:Zy(i.content)}):p&&(s[a]=c,t=c),u({messages:s}),t&&await Promise.all(r.map(r=>r.onNewMessage?.({message:t,messages:s,state:o,agent:n,input:e})))}return l()}case Xf.ACTIVITY_DELTA:{let i=t,a=s.findIndex(e=>e.id===i.messageId);if(-1===a)return l();let c=s[a];if("activity"!==c.role)return console.warn(`ACTIVITY_DELTA: Message '${i.messageId}' is not an activity message`),l();let d=c,f=await tv(r,s,o,(t,r,a)=>t.onActivityDeltaEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:d}));if(u(f),!0!==f.stopPropagation)try{let e=Zy(d.content??{}),t=ig.applyPatch(e,i.patch??[],!0,!1).newDocument;s[a]={...d,content:Zy(t),activityType:i.activityType},u({messages:s})}catch(p){let e=p instanceof Error?p.message:String(p);console.warn(`Failed to apply activity patch for '${i.messageId}': ${e}`)}return l()}case Xf.RAW:return u(await tv(r,s,o,(r,i,a)=>r.onRawEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),l();case Xf.CUSTOM:return u(await tv(r,s,o,(r,i,a)=>r.onCustomEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),l();case Xf.RUN_STARTED:{let i=await tv(r,s,o,(r,i,a)=>r.onRunStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(u(i),!0!==i.stopPropagation){let e=t;if(e.input?.messages){for(let t of e.input.messages)s.find(e=>e.id===t.id)||s.push(t);u({messages:s})}}return l()}case Xf.RUN_FINISHED:{let i=t,a="interrupt"===i.outcome?.type?{event:i,outcome:"interrupt",interrupts:i.outcome.interrupts}:{event:i,outcome:"success",result:i.result},c=await tv(r,s,o,(t,r,i)=>t.onRunFinishedEvent?.({...a,messages:r,state:i,agent:n,input:e}));return u(c),!0!==c.stopPropagation&&(n.pendingInterrupts="interrupt"===a.outcome?[...a.interrupts]:[]),l()}case Xf.RUN_ERROR:return u(await tv(r,s,o,(r,i,a)=>r.onRunErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),l();case Xf.STEP_STARTED:return u(await tv(r,s,o,(r,i,a)=>r.onStepStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),l();case Xf.STEP_FINISHED:return u(await tv(r,s,o,(r,i,a)=>r.onStepFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),l();case Xf.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case Xf.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case Xf.THINKING_START:case Xf.THINKING_END:case Xf.THINKING_TEXT_MESSAGE_START:case Xf.THINKING_TEXT_MESSAGE_CONTENT:case Xf.THINKING_TEXT_MESSAGE_END:return l();case Xf.REASONING_START:return u(await tv(r,s,o,(r,i,a)=>r.onReasoningStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),l();case Xf.REASONING_MESSAGE_START:{let i=await tv(r,s,o,(r,i,a)=>r.onReasoningMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(u(i),!0!==i.stopPropagation){let{messageId:e}=t;if(!s.find(t=>t.id===e)){let t={id:e,role:"reasoning",content:""};s.push(t),u({messages:s})}}return l()}case Xf.REASONING_MESSAGE_CONTENT:{let{messageId:i,delta:a}=t,c=s.find(e=>e.id===i);if(!c)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${i}'`),l();let d=await tv(r,s,o,(r,i,a)=>r.onReasoningMessageContentEvent?.({event:t,messages:i,state:a,agent:n,input:e,reasoningMessageBuffer:"string"==typeof c.content?c.content:""}));return u(d),!0!==d.stopPropagation&&(c.content=`${"string"==typeof c.content?c.content:""}${a}`,u({messages:s})),l()}case Xf.REASONING_MESSAGE_END:{let{messageId:i}=t,a=s.find(e=>e.id===i);return a?(u(await tv(r,s,o,(r,i,s)=>r.onReasoningMessageEndEvent?.({event:t,messages:i,state:s,agent:n,input:e,reasoningMessageBuffer:"string"==typeof a.content?a.content:""}))),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:s,state:o,agent:n,input:e})})),l()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${i}'`),l())}case Xf.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case Xf.REASONING_END:return u(await tv(r,s,o,(r,i,a)=>r.onReasoningEndEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),l();
29case Xf.REASONING_ENCRYPTED_VALUE:{let{subtype:i,entityId:a,encryptedValue:d}=t,p=await tv(r,s,o,(r,i,a)=>r.onReasoningEncryptedValueEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(u(p),!0!==p.stopPropagation){let e=!1;if("tool-call"===i){for(let t of s)if("assistant"===t.role&&t.toolCalls){let n=t.toolCalls.find(e=>e.id===a);if(n){n.encryptedValue=d,e=!0;break}}}else{let t=s.find(e=>e.id===a);"activity"!==t?.role&&t&&(t.encryptedValue=d,e=!0)}e&&(c.messages=s)}return l()}}return t.type,l()}),(void 0===p&&(p=1/0),ym(Mg,p)),r.length>0?(d={},jg(function(e,t){var n=!1;e.subscribe(Lg(t,function(e){n=!0,t.next(e)},function(){n||t.next(d),t.complete()}))})):e=>e);var d,p},ov=e=>t=>{let n=rv(e),r=new Map,i=new Map,a=!1,s=!1,o=!1,c=new Map,u=!1,l=!1,d=!1;return t.pipe(ym(e=>{let t=e.type;if(n?.event("VERIFY","Event:",e,{type:e.type}),s)return fm(()=>new Ff(`Cannot send event type '${t}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(a&&t!==Xf.RUN_ERROR&&t!==Xf.RUN_STARTED)return fm(()=>new Ff(`Cannot send event type '${t}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(o){if(t===Xf.RUN_STARTED){if(d&&!a)return fm(()=>new Ff("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));a&&(r.clear(),i.clear(),c.clear(),u=!1,l=!1,a=!1,s=!1,d=!0)}}else if(o=!0,t!==Xf.RUN_STARTED&&t!==Xf.RUN_ERROR)return fm(()=>new Ff("First event must be 'RUN_STARTED'"));switch(t){case Xf.TEXT_MESSAGE_START:{let t=e.messageId;return r.has(t)?fm(()=>new Ff(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${t}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(r.set(t,!0),pm(e))}case Xf.TEXT_MESSAGE_CONTENT:{let t=e.messageId;return r.has(t)?pm(e):fm(()=>new Ff(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${t}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case Xf.TEXT_MESSAGE_END:{let t=e.messageId;return r.has(t)?(r.delete(t),pm(e)):fm(()=>new Ff(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${t}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case Xf.TOOL_CALL_START:{let t=e.toolCallId;return i.has(t)?fm(()=>new Ff(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${t}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(i.set(t,!0),pm(e))}case Xf.TOOL_CALL_ARGS:{let t=e.toolCallId;return i.has(t)?pm(e):fm(()=>new Ff(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${t}'. Start a tool call with 'TOOL_CALL_START' first.`))}case Xf.TOOL_CALL_END:{let t=e.toolCallId;return i.has(t)?(i.delete(t),pm(e)):fm(()=>new Ff(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${t}'. A 'TOOL_CALL_START' event must be sent first.`))}case Xf.STEP_STARTED:{let t=e.stepName;return c.has(t)?fm(()=>new Ff(`Step "${t}" is already active for 'STEP_STARTED'`)):(c.set(t,!0),pm(e))}case Xf.STEP_FINISHED:{let t=e.stepName;return c.has(t)?(c.delete(t),pm(e)):fm(()=>new Ff(`Cannot send 'STEP_FINISHED' for step "${t}" that was not started`))}case Xf.RUN_STARTED:return d=!0,pm(e);case Xf.RUN_FINISHED:if(c.size>0){let e=Array.from(c.keys()).join(", ");return fm(()=>new Ff(`Cannot send 'RUN_FINISHED' while steps are still active: ${e}`))}if(r.size>0){let e=Array.from(r.keys()).join(", ");return fm(()=>new Ff(`Cannot send 'RUN_FINISHED' while text messages are still active: ${e}`))}if(i.size>0){let e=Array.from(i.keys()).join(", ");return fm(()=>new Ff(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${e}`))}return a=!0,pm(e);case Xf.RUN_ERROR:return s=!0,pm(e);case Xf.CUSTOM:return pm(e);case Xf.THINKING_TEXT_MESSAGE_START:return u?l?fm(()=>new Ff("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(l=!0,pm(e)):fm(()=>new Ff("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case Xf.THINKING_TEXT_MESSAGE_CONTENT:return l?pm(e):fm(()=>new Ff("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case Xf.THINKING_TEXT_MESSAGE_END:return l?(l=!1,pm(e)):fm(()=>new Ff("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case Xf.THINKING_START:return u?fm(()=>new Ff("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(u=!0,pm(e));case Xf.THINKING_END:return u?(u=!1,pm(e)):fm(()=>new Ff("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return pm(e)}}))};let cv=((uv={}).HEADERS="headers",uv.DATA="data",uv);var uv;const lv=e=>{return vm(()=>dm(e())).pipe((t=e=>{if(!e.ok){let t=e.headers.get("content-type")||"";return dm(e.text()).pipe(ym(n=>{let r=n;if(t.includes("application/json"))try{r=JSON.parse(n)}catch{}let i=Error(`HTTP ${e.status}: ${"string"==typeof r?r:JSON.stringify(r)}`);return i.status=e.status,i.payload=r,fm(()=>i)}))}let t={type:cv.HEADERS,status:e.status,headers:e.headers},n=e.body?.getReader();return n?new Fg(e=>(e.next(t),(async()=>{try{for(;;){let{done:t,value:r}=await n.read();if(t)break;let i={type:cv.DATA,data:r};e.next(i)}e.complete()}catch(t){e.error(t)}})(),()=>{n.cancel().catch(e=>{if("AbortError"!==e?.name)throw e})})):fm(()=>Error("Failed to getReader() from response"))},jg(function(e,r){var i=null,a=0,s=!1,o=function(){return s&&!i&&r.complete()};e.subscribe(Lg(r,function(e){null==i||i.unsubscribe();var s=0,c=a++;im(t(e,c)).subscribe(i=Lg(r,function(t){return r.next(n?n(e,t,c,s++):t)},function(){i=null,o()}))},function(){s=!0,o()}))})));var t,n},dv=(e,t)=>{let n=rv(t),r=new Gg,i=new Hg,a=!1;return e.subscribe({next:e=>{if(i.next(e),e.type!==cv.HEADERS||a)a||r.error(Error("No headers event received before data events"));else{a=!0;let t=e.headers.get("content-type");n?.lifecycle("HTTP","Stream format detected:",{contentType:t,parser:t===$y?"protobuf":"sse"}),t===$y?(e=>{let t=new Gg,n=new Uint8Array;function r(){for(;n.length>=4;){let r=4+new DataView(n.buffer,n.byteOffset,4).getUint32(0,!1);if(n.length<r)break;try{let e=Ly(n.slice(4,r));t.next(e),n=n.slice(r)}catch(e){let n=e instanceof Error?e.message:String(e);return void t.error(Error(`Failed to decode protocol buffer message: ${n}`))}}}return e.subscribe({next:e=>{if(e.type!==cv.HEADERS&&e.type===cv.DATA&&e.data){let t=new Uint8Array(n.length+e.data.length);t.set(n,0),t.set(e.data,n.length),n=t,r()}},error:e=>t.error(e),complete:()=>{if(n.length>0)try{r()}catch{console.warn("Incomplete or invalid protocol buffer data at stream end")}t.complete()}}),t.asObservable()})(i).subscribe({next:e=>r.next(e),error:e=>r.error(e),complete:()=>r.complete()}):((e,t)=>{let n=rv(t),r=new Gg,i=new TextDecoder("utf-8",{fatal:!1}),a="";function s(e){let t=e.split("\n"),i=[];for(let n of t)n.startsWith("data:")&&i.push(n.slice(5).replace(/^ /,""));if(i.length>0)try{let e=i.join("\n"),t=JSON.parse(e);n?.event("SSE","Event received:",t,{type:t.type}),r.next(t)}catch(a){r.error(a)}}return e.subscribe({next:e=>{if(e.type!==cv.HEADERS&&e.type===cv.DATA&&e.data){let t=i.decode(e.data,{stream:!0});a+=t;let n=a.split(/\n\n/);a=n.pop()||"";for(let e of n)s(e)}},error:e=>r.error(e),complete:()=>
29{a&&(a+=i.decode(),s(a)),r.complete()}}),r.asObservable()})(i,n).subscribe({next:e=>{try{let t=xh.parse(e);n?.event("HTTP","Event validated:",t,{type:t.type,valid:!0}),r.next(t)}catch(t){n?.event("HTTP","Event invalid:",{json:e,error:String(t)}),r.error(t)}},error:e=>"AbortError"===e?.name?(r.next({type:Xf.RUN_ERROR,message:e.message||"Request aborted",code:"abort",rawEvent:e}),void r.complete()):r.error(e),complete:()=>r.complete()})}},error:e=>{i.error(e),r.error(e)},complete:()=>{i.complete()}}),r.asObservable()},pv=mf(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),fv=mf(["LangGraphInterruptEvent","PredictState","Exit"]);ff("type",[df({type:gf(pv.enum.TextMessageStart),messageId:af(),parentMessageId:af().optional(),role:af().optional()}),df({type:gf(pv.enum.TextMessageContent),messageId:af(),content:af()}),df({type:gf(pv.enum.TextMessageEnd),messageId:af()}),df({type:gf(pv.enum.ActionExecutionStart),actionExecutionId:af(),actionName:af(),parentMessageId:af().optional()}),df({type:gf(pv.enum.ActionExecutionArgs),actionExecutionId:af(),args:af()}),df({type:gf(pv.enum.ActionExecutionEnd),actionExecutionId:af()}),df({type:gf(pv.enum.ActionExecutionResult),actionName:af(),actionExecutionId:af(),result:af()}),df({type:gf(pv.enum.AgentStateMessage),threadId:af(),agentName:af(),nodeName:af(),runId:af(),active:of(),role:af(),state:af(),running:of()}),df({type:gf(pv.enum.MetaEvent),name:fv,value:cf()}),df({type:gf(pv.enum.RunError),message:af(),code:af().optional()})]),df({id:af(),role:af(),content:af(),parentMessageId:af().optional()}),df({id:af(),name:af(),arguments:cf(),parentMessageId:af().optional()}),df({id:af(),result:cf(),actionExecutionId:af(),actionName:af()});const hv=e=>{if("string"==typeof e)return e;if(!Array.isArray(e))return;let t=e.filter(e=>"text"===e.type).map(e=>e.text).filter(e=>e.length>0);return 0!==t.length?t.join("\n"):void 0};function gv(e){let t=[];for(let n of e)if("assistant"===n.role||"user"===n.role||"system"===n.role){let e=hv(n.content);if(e){let r={id:n.id,role:n.role,content:e};t.push(r)}if("assistant"===n.role&&n.toolCalls&&n.toolCalls.length>0)for(let r of n.toolCalls){let e={id:r.id,name:r.function.name,arguments:JSON.parse(r.function.arguments),parentMessageId:n.id};t.push(e)}}else if("tool"===n.role){let r="unknown";for(let t of e)if("assistant"===t.role&&t.toolCalls?.length)for(let e of t.toolCalls)if(e.id===n.toolCallId){r=e.function.name;break}let i={id:n.id,result:n.content,actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}const mv=e=>t=>{let n,r,i,a,s=rv(e),o=()=>{if(!n||"text"!==a)throw Error("No text message to close");let e={type:Xf.TEXT_MESSAGE_END,messageId:n.messageId};return a=void 0,n=void 0,s?.event("TRANSFORM","TEXT_MESSAGE_END",e,{messageId:e.messageId}),e},c=()=>{if(!r||"tool"!==a)throw Error("No tool call to close");let e={type:Xf.TOOL_CALL_END,toolCallId:r.toolCallId};return a=void 0,r=void 0,s?.event("TRANSFORM","TOOL_CALL_END",e,{toolCallId:e.toolCallId}),e},u=()=>{if(!i||"reasoning"!==a)throw Error("No reasoning message to close");let e={type:Xf.REASONING_MESSAGE_END,messageId:i.messageId};return a=void 0,i=void 0,s?.event("TRANSFORM","REASONING_MESSAGE_END",e,{messageId:e.messageId}),e},l=()=>"text"===a?[o()]:"tool"===a?[c()]:"reasoning"===a?[u()]:[];return t.pipe(ym(e=>{switch(e.type){case Xf.TEXT_MESSAGE_START:case Xf.TEXT_MESSAGE_CONTENT:case Xf.TEXT_MESSAGE_END:case Xf.TOOL_CALL_START:case Xf.TOOL_CALL_ARGS:case Xf.TOOL_CALL_END:case Xf.TOOL_CALL_RESULT:case Xf.STATE_SNAPSHOT:case Xf.STATE_DELTA:case Xf.MESSAGES_SNAPSHOT:case Xf.CUSTOM:case Xf.RUN_STARTED:case Xf.RUN_FINISHED:case Xf.RUN_ERROR:case Xf.STEP_STARTED:case Xf.STEP_FINISHED:case Xf.THINKING_START:case Xf.THINKING_END:case Xf.THINKING_TEXT_MESSAGE_START:case Xf.THINKING_TEXT_MESSAGE_CONTENT:case Xf.THINKING_TEXT_MESSAGE_END:case Xf.REASONING_START:case Xf.REASONING_MESSAGE_START:case Xf.REASONING_MESSAGE_CONTENT:case Xf.REASONING_MESSAGE_END:case Xf.REASONING_END:return[...l(),e];case Xf.RAW:case Xf.ACTIVITY_SNAPSHOT:case Xf.ACTIVITY_DELTA:case Xf.REASONING_ENCRYPTED_VALUE:return[e];case Xf.TEXT_MESSAGE_CHUNK:let t=e,o=[];if(("text"!==a||void 0!==t.messageId&&t.messageId!==n?.messageId)&&o.push(...l()),"text"!==a){if(void 0===t.messageId)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");n={messageId:t.messageId,name:t.name},a="text";let e={type:Xf.TEXT_MESSAGE_START,messageId:t.messageId,role:t.role||"assistant",...void 0!==t.name&&{name:t.name}};o.push(e),s?.event("TRANSFORM","TEXT_MESSAGE_START",e,{messageId:t.messageId})}if(void 0!==t.delta){let e={type:Xf.TEXT_MESSAGE_CONTENT,messageId:n.messageId,delta:t.delta};o.push(e),s?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",e,{messageId:n.messageId})}return o;case Xf.TOOL_CALL_CHUNK:let c=e,u=[];if(("tool"!==a||void 0!==c.toolCallId&&c.toolCallId!==r?.toolCallId)&&u.push(...l()),"tool"!==a){if(void 0===c.toolCallId)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(void 0===c.toolCallName)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");r={toolCallId:c.toolCallId,toolCallName:c.toolCallName,parentMessageId:c.parentMessageId},a="tool";let e={type:Xf.TOOL_CALL_START,toolCallId:c.toolCallId,toolCallName:c.toolCallName,parentMessageId:c.parentMessageId};u.push(e),s?.event("TRANSFORM","TOOL_CALL_START",e,{toolCallId:c.toolCallId,toolCallName:c.toolCallName})}if(void 0!==c.delta){let e={type:Xf.TOOL_CALL_ARGS,toolCallId:r.toolCallId,delta:c.delta};u.push(e),s?.event("TRANSFORM","TOOL_CALL_ARGS",e,{toolCallId:r.toolCallId})}return u;case Xf.REASONING_MESSAGE_CHUNK:let d=e,p=[];if(("reasoning"!==a||d.messageId&&d.messageId!==i?.messageId)&&p.push(...l()),"reasoning"!==a){if(void 0===d.messageId)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");i={messageId:d.messageId},a="reasoning";let e={type:Xf.REASONING_MESSAGE_START,messageId:d.messageId};p.push(e),s?.event("TRANSFORM","REASONING_MESSAGE_START",e,{messageId:d.messageId})}if(void 0!==d.delta){let e={type:Xf.REASONING_MESSAGE_CONTENT,messageId:i.messageId,delta:d.delta};p.push(e),s?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",e,{messageId:i.messageId})}return p}return e.type,[]}),Sm(()=>{l()}))};function yv(e,t=new Date){return void 0!==e.expiresAt&&new Date(e.expiresAt)<=t}var vv=class{runNext(e,t){return t.run(e).pipe(mv(!1))}runNextWithState(e,t){let n=Zy(e.messages||[]),r=Zy(e.state||{}),i=new Hg;return sv(e,i,t,[]).subscribe(e=>{void 0!==e.messages&&(n=e.messages),void 0!==e.state&&(r=e.state)}),this.runNext(e,t).pipe(bm(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:Zy(n),state:Zy(r)})))}},wv=class extends vv{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function bv(e){let t=e.content;if(Array.isArray(t)){let n=t.filter(e=>"object"==typeof e&&!!e&&"type"in e&&"text"===e.type&&"string"==typeof e.text).map(e=>e.text).join("");return{...e,content:n}}return"string"==typeof t?e:{...e,content:""}}var Sv=class extends vv{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(bv)};return this.runNext(i,t)}};const Ev="THINKING_START",_v="THINKING_END",Av="THINKING_TEXT_MESSAGE_START",Iv="THINKING_TEXT_MESSAGE_CONTENT",kv="THINKING_TEXT_MESSAGE_END";var Tv=class extends vv{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<"u"&&void 0!==Yy&&Yy.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is convert
29ing ${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(mm(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case Ev:{this.currentReasoningId=Wy();let{title:t,...n}=e;return this.warnAboutTransformation(Ev,Xf.REASONING_START),{...n,type:Xf.REASONING_START,messageId:this.currentReasoningId}}case Av:return this.currentMessageId=Wy(),this.warnAboutTransformation(Av,Xf.REASONING_MESSAGE_START),{...e,type:Xf.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case Iv:{let{delta:t,...n}=e;return this.warnAboutTransformation(Iv,Xf.REASONING_MESSAGE_CONTENT),{...n,type:Xf.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Wy(),delta:t}}case kv:{let t=this.currentMessageId??Wy();return this.warnAboutTransformation(kv,Xf.REASONING_MESSAGE_END),{...e,type:Xf.REASONING_MESSAGE_END,messageId:t}}case _v:{let t=this.currentReasoningId??Wy();return this.warnAboutTransformation(_v,Xf.REASONING_END),{...e,type:Xf.REASONING_END,messageId:t}}default:return e}}};function Cv(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.map(e=>function(e){return"object"==typeof e&&!!e&&"type"in e&&"binary"===e.type&&"mimeType"in e&&"string"==typeof e.mimeType}(e)?function(e){let t=function(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}(e.mimeType);return e.data?{type:t,source:{type:"data",value:e.data,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e.url?{type:t,source:{type:"url",value:e.url,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e}(e):e);return{...e,content:n}}var xv=class extends vv{run(e,t){let n={...e,messages:e.messages.map(Cv)};return this.runNext(n,t)}},Ov=class{get maxVersion(){return"0.0.57"}get debug(){return this._debug}set debug(e){this._debug=nv(e),this._debugLogger=av(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger="boolean"==typeof e?e?av(nv(!0)):void 0:e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=n??Ed(),this.messages=Zy(r??[]),this.state=Zy(i??{}),this._debug=nv(a),this._debugLogger=av(this._debug),Ky(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new Sv),Ky(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new Tv),Ky(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new xv)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(e=>"function"==typeof e?new wv(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Ed();let n=this.prepareRunAgentInput(e);this.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:this.agentId,threadId:this.threadId});let r,i,a=new Set(this.messages.map(e=>e.id)),s=[{onRunFinishedEvent:e=>{"success"===e.outcome&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,s),this.activeRunDetach$=new Gg,this.activeRunCompletionPromise=new Promise(e=>{i=e}),await gm(Pg(()=>0===this.middlewares.length?this.run(n):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),mv(this.debugLogger),ov(this.debugLogger),e=>e.pipe(Em(this.activeRunDetach$)),e=>this.apply(n,e,s),e=>this.processApplyEvents(n,e,s),wm(e=>(this.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:this.agentId,error:e instanceof Error?e.message:String(e)}),this.isRunning=!1,this.onError(n,e,s))),Sm(()=>{this.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:this.agentId,threadId:this.threadId}),this.isRunning=!1,this.onFinalize(n,s),i?.(),i=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}
29))(pm(null)));let o=Zy(this.messages).filter(e=>!a.has(e.id));return{result:r,newMessages:o}}finally{this.isRunning=!1}}connect(e){throw new Uf}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Ed();let n,r,i=this.prepareRunAgentInput(e),a=new Set(this.messages.map(e=>e.id)),s=[{onRunFinishedEvent:e=>{"success"===e.outcome&&(n=e.result)}},...this.subscribers,t??{}];await this.onInitialize(i,s),this.activeRunDetach$=new Gg,this.activeRunCompletionPromise=new Promise(e=>{r=e}),await gm(Pg(()=>vm(()=>this.connect(i)),mv(this.debugLogger),ov(this.debugLogger),e=>e.pipe(Em(this.activeRunDetach$)),e=>this.apply(i,e,s),e=>this.processApplyEvents(i,e,s),wm(e=>(this.isRunning=!1,e instanceof Uf?Bg:this.onError(i,e,s))),Sm(()=>{this.isRunning=!1,this.onFinalize(i,s),r?.(),r=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(pm(null)),{defaultValue:void 0});let o=Zy(this.messages).filter(e=>!a.has(e.id));return{result:n,newMessages:o}}finally{this.isRunning=!1}}abortRun(){}async detachActiveRun(){if(!this.activeRunDetach$)return;let e=this.activeRunCompletionPromise??Promise.resolve();this.activeRunDetach$.next(),this.activeRunDetach$?.complete(),await e}apply(e,t,n){return sv(e,t,this,n,this.debugLogger)}
29processApplyEvents(e,t,n){return t.pipe((s=gg(r=t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))})||i||a?{next:r,error:i,complete:a}:r)?jg(function(e,t){var n;null===(n=s.subscribe)||void 0===n||n.call(s);var r=!0;e.subscribe(Lg(t,function(e){var n;null===(n=s.next)||void 0===n||n.call(s,e),t.next(e)},function(){var e;r=!1,null===(e=s.complete)||void 0===e||e.call(s),t.complete()},function(e){var n;r=!1,null===(n=s.error)||void 0===n||n.call(s,e),t.error(e)},function(){var e,t;r&&(null===(e=s.unsubscribe)||void 0===e||e.call(s)),null===(t=s.finalize)||void 0===t||t.call(s)}))}):Mg);var r,i,a,s}prepareRunAgentInput(e){let t=Zy(this.messages).filter(e=>"activity"!==e.role);return{threadId:this.threadId,runId:e?.runId||Ed(),tools:Zy(e?.tools??[]),context:Zy(e?.context??[]),forwardedProps:Zy(e?.forwardedProps??{}),state:Zy(this.state),messages:t,...void 0===e?.resume?{}:{resume:Zy(e.resume)}}}async onInitialize(e,t){if(this.pendingInterrupts.length>0){let t=new Set((e.resume??[]).map(e=>e.interruptId)),n=this.pendingInterrupts.map(e=>e.id).filter(e=>!t.has(e));if(n.length>0)throw new Ff(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(", ")}`);for(let e of this.pendingInterrupts)if(yv(e))throw new Ff(`Interrupt ${e.id} expired at ${e.expiresAt}`)}let n=await tv(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));(void 0!==n.messages||void 0!==n.state)&&(n.messages&&(this.messages=n.messages,e.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,e.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})})))}onError(e,t,n){return dm(tv(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(mm(r=>{let i=r;if((void 0!==i.messages||void 0!==i.state)&&(void 0!==i.messages&&(this.messages=i.messages,n.forEac
29h(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),void 0!==i.state&&(this.state=i.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),!0!==i.stopPropagation){let e=String(t);if("AbortError"!==t.name&&"Fetch is aborted"!==t.message&&"signal is aborted without reason"!==t.message&&"component unmounted"!==t.message&&"component unmounted"!==e)throw console.error("Agent execution failed:",t),t}return{}}))}async onFinalize(e,t){let n=await tv(t,this.messages,this.state,(t,n,r)=>t.onRunFinalized?.({messages:n,state:r,agent:this,input:e}));(void 0!==n.messages||void 0!==n.state)&&(void 0!==n.messages&&(this.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),void 0!==n.state&&(this.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,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=Zy(this.messages),e.state=Zy(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Zy(this.pendingInterrupts),e}addMessage(e){this.messages.push(e),(async()=>{for(let t of this.subscribers)await(t.onNewMessage?.({message:e,messages:this.messages,state:this.state,agent:this}));if("assistant"===e.role&&e.toolCalls)for(let t of e.toolCalls)for(let e of this.subscribers)await(e.onNewToolCall?.({toolCall:t,messages:this.messages,state:this.state,agent:this}));for(let e of this.subscribers)await(e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this}))})()}addMessages(e){this.messages.push(...e),(async()=>{for(let t of e){for(let e of this.subscribers)await(e.onNewMessage?.({message:t,messages:this.messages,state:this.state,agent:this}));if("assistant"===t.role&&t.toolCalls)for(let e of t.toolCalls)for(let t of this.subscribers)await(t.onNewToolCall?.({toolCall:e,messages:this.messages,state:this.state,agent:this}))}for(let e of this.subscribers)await(e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this}))})()}setMessages(e){this.messages=Zy(e),(async()=>{for(let e of this.subscribers)await(e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this}))})()}setState(e){this.state=Zy(e),(async()=>{for(let e of this.subscribers)await(e.onStateChanged?.({messages:this.messages,state:this.state,agent:this}))})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Ed();let t=this.prepareRunAgentInput(e);return(0===this.middlewares.length?this.run(t):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t)).pipe(mv(this.debugLogger),ov(this.debugLogger),((e,t,n)=>r=>{let i={},a=!0,s=!0,o="",c=null,u=null,l=[],d={},p=e=>{"object"==typeof e&&e&&("messages"in e&&delete e.messages,i=e)};return r.pipe(ym(r=>{switch(r.type){case Xf.TEXT_MESSAGE_START:{let e=r;return[{type:pv.enum.TextMessageStart,messageId:e.messageId,role:e.role}]}case Xf.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:pv.enum.TextMessageContent,messageId:e.messageId,content:e.delta}]}case Xf.TEXT_MESSAGE_END:{let e=r;return[{type:pv.enum.TextMessageEnd,messageId:e.messageId}]}case Xf.TOOL_CALL_START:{let e=r;return l.push({id:e.toolCallId,type:"function",function:{name:e.toolCallName,arguments:""}}),s=!0,d[e.toolCallId]=e.toolCallName,[{type:pv.enum.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case Xf.TOOL_CALL_ARGS:{let c=r,d=l.find(e=>e.id===c.toolCallId);if(!d)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${c.toolCallId}'`),[];d.function.arguments+=c.delta;let f=!1;if(u){let e=u.find(e=>e.tool==d.function.name);if(e)try{let t=JSON.parse(Am(d.function.arguments));e.tool_argument&&e.tool_argument in t?(p({...i,[e.state_key]:t[e.tool_argument]}
29),f=!0):e.tool_argument||(p({...i,[e.state_key]:t}),f=!0)}catch{}}return[{type:pv.enum.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...f?[{type:pv.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:o,runId:t,running:a,role:"assistant",state:JSON.stringify(i),active:s}]:[]]}case Xf.TOOL_CALL_END:{let e=r;return[{type:pv.enum.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case Xf.TOOL_CALL_RESULT:{let e=r;return[{type:pv.enum.ActionExecutionResult,actionExecutionId:e.toolCallId,result:e.content,actionName:d[e.toolCallId]||"unknown"}]}case Xf.RAW:return[];case Xf.CUSTOM:{let e=r;switch(e.name){case"Exit":a=!1;break;case"PredictState":u=e.value}return[{type:pv.enum.MetaEvent,name:e.name,value:e.value}]}case Xf.STATE_SNAPSHOT:return p(r.snapshot),[{type:pv.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:o,runId:t,running:a,role:"assistant",state:JSON.stringify(i),active:s}];case Xf.STATE_DELTA:{let c=r,u=ig.applyPatch(i,c.delta,!0,!1);return u?(p(u.newDocument),[{type:pv.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:o,runId:t,running:a,role:"assistant",state:JSON.stringify(i),active:s}]):[]}case Xf.MESSAGES_SNAPSHOT:return c=r.messages,[{type:pv.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:o,runId:t,running:a,role:"assistant",state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case Xf.RUN_STARTED:return[];case Xf.RUN_FINISHED:return c&&(i.messages=c),0===Object.keys(i).length?[]:[{type:pv.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:o,runId:t,running:a,role:"assistant",state:JSON.stringify({...i,...c?{messages:gv(c)}:{}}),active:!1}];case Xf.RUN_ERROR:{let e=r;return[{type:pv.enum.RunError,message:e.message,code:e.code}]}case Xf.STEP_STARTED:return o=r.stepName,l=[],u=null,[{type:pv.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:o,runId:t,running:a,role:"assistant",state:JSON.stringify(i),active:!0}];case Xf.STEP_FINISHED:return l=[],u=null,[{type:pv.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:o,runId:t,running:a,role:"assistant",state:JSON.stringify(i),active:!1}];default:return[]}}))})(this.threadId,t.runId,this.agentId),e=>e.pipe(mm(e=>(this.debugLogger?.event("LEGACY","Event:",e,{type:e.type}),e))))}},Rv=class extends Ov{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 AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new AbortController,this.url=e.url,this.headers=Zy(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return dv(lv(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Zy(this.headers??{}),e.fetch=this.fetch;let t=new AbortController,n=this.abortController.signal;return n.aborted&&t.abort(n.reason),e.abortController=t,e}};const Nv=(e,t,n)=>{const r=X(t,n),i=e?.trim();if(!r||!t||!i)throw new Error("Missing required parameters for answer endpoint");return`${r}${`/api/v1/organizations/${t}/agents`}/${i}`};class Dv extends Rv{requestInit(e){const{params:t,accessToken:n,recordDebugSession:r}=e.forwardedProps||{},i={...t,...r&&{recordDebugSession:!0}};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream, application/json"},body:JSON.stringify(i),signal:this.abortController.signal}}}const Mv=new d({required:!0}),Pv=new d({required:!0,constrainTo:vl}),qv=e=>({...e,name:wl(e.name)}),Fv=sn("followUpAnswers/setIsEnabled",e=>Tr(e,new s({required:!0}))),Uv=sn("followUpAnswers/setFollowUpAnswersConversationId",e=>Tr(e,wr)),jv=sn("followUpAnswers/setFollowUpAnswersConversationToken",e=>Tr(e,wr)),Lv=sn("followUpAnswers/clearFollowUpAnswersConversationToken");sn("followUpAnswers/createFollowUpAnswer",e=>Tr(e,{question:wr})),sn("followUpAnswers/setActiveFollowUpAnswerId",e=>Tr(e,wr)),sn("followUpAnswers/setFollowUpAnswerContentFormat",e=>Tr(e,{contentFormat:Il,answerId:wr})),sn("followUpAnswers/setFollowUpIsLoading",e=>Tr(e,{isLoading:new s({required:!0}),answerId:wr})),sn("followUpAnswers/setFollowUpIsStreaming",e=>Tr(e,{isStreaming:new s({required:!0}),answerId:wr})),sn("followUpAnswers/followUpMessageChunkReceived",e=>Tr(e,{textDelta:Mv,answerId:wr})),sn("followUpAnswers/followUpCitationsReceived",e=>Tr(e,{citations:new g({required:!0,each:new f({values:Al})}),answerId:wr})),sn("followUpAnswers/followUpCompleted",e=>Tr(e,{answerId:wr,cannotAnswer:new s({required:!1})})),sn("followUpAnswers/followUpFailed",e=>Tr(e,{message:new d,code:new c({min:0}),answerId:wr})),sn("followUpAnswers/activeFollowUpStartFailed",e=>Tr(e,{message:new d})),sn("followUpAnswers/likeFollowUp",e=>Tr(e,{answerId:wr}
29)),sn("followUpAnswers/dislikeFollowUp",e=>Tr(e,{answerId:wr})),sn("followUpAnswers/submitFollowUpFeedback",e=>Tr(e,{answerId:wr}));const $v=sn("followUpAnswers/resetFollowUpAnswers");var Vv,Gv;sn("followUpAnswers/stepStarted",e=>Tr(qv(e),{answerId:wr,name:Pv,startedAt:new c({min:0,required:!0})})),sn("followUpAnswers/stepFinished",e=>Tr(qv(e),{answerId:wr,name:Pv,finishedAt:new c({min:0,required:!0})})),sn("followUpAnswers/startToolCall",e=>Tr(e,{answerId:wr,toolCallName:wr,startedAt:new c({min:0,required:!0}),toolCallId:wr})),sn("followUpAnswers/finishToolCall",e=>Tr(e,{answerId:wr,finishedAt:new c({min:0,required:!0}),toolCallId:wr})),sn("followUpAnswers/toolCallArgs",e=>Tr(e,{answerId:wr,toolCallId:wr,args:new f({options:{required:!0}}),type:new d({required:!0,constrainTo:bl})})),(Gv=Vv||(Vv={}))[Gv.SseMaxDurationExceeded=1e3]="SseMaxDurationExceeded",Gv[Gv.SseFollowUpNotSupported=1001]="SseFollowUpNotSupported",Gv[Gv.ConversationNotFound=1002]="ConversationNotFound",Gv[Gv.SseModelsNotAvailable=1003]="SseModelsNotAvailable",Gv[Gv.SseInternalError=1004]="SseInternalError",Gv[Gv.SseTurnLimitReached=1005]="SseTurnLimitReached";const Qv={"KNOWLEDGE:SSE_MAX_DURATION_EXCEEDED":Vv.SseMaxDurationExceeded,"KNOWLEDGE:SSE_FOLLOW_UP_NOT_SUPPORTED":Vv.SseFollowUpNotSupported,"KNOWLEDGE:NOT_FOUND":Vv.ConversationNotFound,"KNOWLEDGE:SSE_MODELS_NOT_AVAILABLE":Vv.SseModelsNotAvailable,"KNOWLEDGE:SSE_INTERNAL_ERROR":Vv.SseInternalError,"KNOWLEDGE:SSE_TURN_LIMIT_REACHED":Vv.SseTurnLimitReached};const zv=e=>{let t="",n=!1;return{onRunStartedEvent:({event:r})=>{t=r.runId,n=!1,e(Cl(r.runId)),e(Dl(!1)),e(Ml(!0)),e(Uv(r.threadId)),e(Lv())},onStepStartedEvent:({event:t,agent:n})=>{!1!==n.isRunning&&e(jl({name:t.stepName,startedAt:t.timestamp??Date.now()}))},onStepFinishedEvent:({event:t,agent:n})=>{!1!==n.isRunning&&e(Ll({name:t.stepName,finishedAt:t.timestamp??Date.now()}))},onToolCallStartEvent:({event:t,agent:n})=>{if(!1===n.isRunning)return;const{toolCallName:r,toolCallId:i,timestamp:a}=t;e($l({toolCallId:i,toolCallName:r,startedAt:a??Date.now()}))},onToolCallEndEvent:({event:t,agent:n})=>{if(!1===n.isRunning)return;const{toolCallId:r,timestamp:i}=t;e(Vl({toolCallId:r,finishedAt:i??Date.now()}))},onToolCallArgsEvent:({event:t,agent:n})=>{if(!1===n.isRunning)return;const{toolCallId:r,delta:i}=t;try{const t=JSON.parse(i);e(Gl("string"==typeof t?.q?{toolCallId:r,args:t,type:"search"}:{toolCallId:r,args:{raw:i},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${i}`),e(Gl({toolCallId:r,args:{raw:i},type:"generic"}))}},onTextMessageContentEvent:({event:t,agent:r})=>{!1!==r.isRunning&&(t.delta.length>0&&(n=!0),e(xl({textDelta:t.delta})))},onCustomEvent:({event:t,agent:n})=>{if(!1===n.isRunning)return;const{name:r,value:i}=t;switch(r){case"header":return i?.contentFormat&&e(Pl(i.contentFormat)),"boolean"==typeof i?.followUpEnabled&&e(Fv(i.followUpEnabled)),void(i?.conversationToken&&e(jv(i.conversationToken)));case"citations":return void e(Ol({citations:i.citations}))}},onRunErrorEvent:({event:t,agent:n})=>{if(!1===n.isRunning)return;const r=(i=t.code)?Qv[i]??Vv.SseInternalError:Vv.SseInternalError;var i;e(Rl({message:t.message,code:r}))},onRunFinishedEvent:({event:r,agent:i})=>{if(!1===i.isRunning)return;const a="ANSWERED"===r.result?.completionReason,s=a?!n:void 0;e(ql(a)),e(Fl(!a)),e(Ml(!1)),e(su(a,t,s)),e(ou())}}},Hv=()=>{let e;const t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:async(n,r,i)=>{t();const a=Ss(n),s=(e=>e.configuration.organizationId)(n),o=(e=>e.configuration.environment)(n),c=(e=>e.configuration.accessToken)(n),u=(e=>e.configuration.knowledge.debugAgentSession)(n),l=((e,t,n)=>new Dv({url:`${Nv(e,t,n)}/answer`}))(a,s,o);e=l;const d=zv(r),p=((e,t)=>{const n=ru(e)?.q,r=gl(e),i=lu(e.configuration.analytics,t,{actionCause:dl(e)}),a=bs(e),s=fl(e.tabSet)||"default",o=t.referrer,{aq:c,cq:u}=yl(e),l=pl(e),d=pu(e),p=du(e),f=ks(e)??[];return{q:n||"",...r.length&&{facets:r},citationsFieldToInclude:f,...l?.length&&{searchHub:l},...d?.length&&{pipeline:d},...p?.contextValues&&{context:p.contextValues},...c&&{aq:c},...u&&{cq:u},tab:s,referrer:o,...i,locale:a}})(n,i());try{r(Dl(!0)),await l.runAgent({forwardedProps:{params:p,accessToken:c,recordDebugSession:u}},d)}catch(f){r(Dl(!1)),r(Rl({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",f)}},abortRun:t}},Bv=sn("breadcrumb/deselectAll"),Kv=sn("breadcrumb/deselectAllNonBreadcrumbs"),Yv=sn("facet/updateFacetAutoSelection",e=>Tr(e,{allow:new s({required:!0})}));class Zv extends Fs{getState;
29constructor(e){super(e),this.getState=e}get activeInstantResultQuery(){const e=this.getState().instantResults;for(const t in e)for(const n in e[t].cache)if(e[t].cache[n].isActive)return e[t].q;return null}get activeInstantResultCache(){const e=this.getState().instantResults;for(const t in e)for(const n in e[t].cache)if(e[t].cache[n].isActive)return e[t].cache[n];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??""}get responseTime(){return this.activeInstantResultCache?.duration??0}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??0}getSearchUID(){const e=this.activeInstantResultCache?.searchUid;return e||super.getSearchUID()}}const Wv={id:wr},Jv={...Wv,q:Sr};sn("instantResults/register",e=>Tr(e,Wv));const Xv=sn("instantResults/updateQuery",e=>Tr(e,Jv));sn("instantResults/clearExpired",e=>Tr(e,Wv));const ew=new c({required:!0,min:0}),tw=sn("pagination/registerNumberOfResults",e=>Tr(e,ew)),nw=sn("pagination/updateNumberOfResults",e=>Tr(e,ew)),rw=sn("pagination/registerPage",e=>Tr(e,ew)),iw=sn("pagination/updatePage",e=>Tr(e,ew)),aw=sn("pagination/nextPage"),sw=sn("pagination/previousPage"),ow=sn("query/updateQuery",e=>Tr(e,{q:new d,enableQuerySyntax:new s})),cw=()=>co("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),uw=e=>co("search/queryError",(t,n)=>t.makeQueryError({query:n.query?.q||"",aq:n.advancedSearchQueries?.aq||"",cq:n.advancedSearchQueries?.cq||"",dq:n.advancedSearchQueries?.dq||"",errorType:e.type,errorMessage:e.message}));sn("didYouMean/enable"),sn("didYouMean/disable"),sn("didYouMean/automaticCorrections/disable"),sn("didYouMean/automaticCorrections/enable");const lw=sn("didYouMean/correction",e=>Tr(e,wr));sn("didYouMean/automaticCorrections/mode",e=>Tr(e,new d({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));const dw=()=>co("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());function pw(e){return{context:e.context||{contextValues:{}},dictionaryFieldContext:e.dictionaryFieldContext||{contextValues:{}},facetSet:e.facetSet||{},numericFacetSet:e.numericFacetSet||{},dateFacetSet:e.dateFacetSet||{},categoryFacetSet:e.categoryFacetSet||{},automaticFacetSet:e.automaticFacetSet??{desiredCount:5,numberOfValues:8,set:{}},pagination:e.pagination||{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0},query:e.query||{q:"",enableQuerySyntax:!1},tabSet:e.tabSet||{},advancedSearchQueries:e.advancedSearchQueries||{cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}},staticFilterSet:e.staticFilterSet||{},querySet:e.querySet||{},sortCriteria:e.sortCriteria||Ps(),pipeline:e.pipeline||"",searchHub:e.searchHub||"default",facetOptions:e.facetOptions||{freezeFacetOrder:!1,facets:{}},facetOrder:e.facetOrder??[],debug:e.debug??!1}}new f({values:{undoneQuery:Sr},options:{required:!0}});const fw=sn("trigger/query/ignore",e=>Tr(e,new d({emptyAllowed:!0,required:!0}))),hw=sn("trigger/query/modification",e=>Tr(e,new f({values:{originalQuery:br,modification:br}}))),gw=async(e,t)=>{const n=function(e){const t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(e=>e.isActive),r=n?.expression.trim()||"",i=function(e){const t=Object.values(e.staticFilterSet||{});return t.map(e=>{const t=e.values.filter(e=>"selected"===e.state&&!!e.expression.trim()),n=t.map(e=>e.expression).join(" OR ");return t.length>1?`(${n})`:n})}(e);return[t,r,...i].filter(e=>!!e).join(" AND ")}(e),r=Wu(e),i=function(e){const t=e.automaticFacetSet?.set;return t?Object.values(t).map(e=>e.response).map(mw).filter(e=>e.currentValues.length>0):void 0}(e);return Vu({...await Xu(e,t),...e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&"next"===e.didYouMean.queryCorrectionMode,options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&"legacy"===e.didYouMean.queryCorrectionMode},...n&&{cq:n},...r.length&&{facets:r},...e.pagination&&{numberOfResults:(()=>
29{if(!e.pagination)return;return e.pagination.firstResult+e.pagination.numberOfResults>Ju?Ju-e.pagination.firstResult:e.pagination.numberOfResults})(),firstResult:e.pagination.firstResult},...e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}},...e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange},...e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:i}},...e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}}})};function mw(e){const{field:t,label:n,values:r}=e;return{field:t,label:n,currentValues:r.filter(e=>"selected"===e.state)}}let yw=class{config;onUpdateQueryForCorrection;constructor(e,t=e=>{this.dispatch(ow({q:e}))}){this.config=e,this.onUpdateQueryForCorrection=t}async fetchFromAPI({mappings:e,request:t},n){const r=Date.now();return{response:Qu(await this.extra.apiClient.search(t,n),e),duration:Date.now()-r,queryExecuted:this.getState().query?.q||"",requestExecuted:t}}async process(e){return this.processQueryErrorOrContinue(e)??await this.processQueryCorrectionsOrContinue(e)??await this.processQueryTriggersOrContinue(e)??this.processSuccessResponse(e)}processQueryErrorOrContinue(e){return ye(e.response)?(this.dispatch(uw(e.response.error)),this.rejectWithValue(e.response.error)):null}async processQueryCorrectionsOrContinue(e){const t=this.getState(),n=this.getSuccessResponse(e);if(!n||!t.didYouMean)return null;const{enableDidYouMean:r,automaticallyCorrectQuery:i}=t.didYouMean,{results:s,queryCorrections:o,queryCorrection:c}=n;if(!r||!i)return null;const u=0===s.length&&o&&0!==o.length,l=!a(c)&&!a(c.correctedQuery);if(!u&&!l)return null;const d=u?await this.processLegacyDidYouMeanAutoCorrection(e):this.processModernDidYouMeanAutoCorrection(e);return this.dispatch(Zr(pw(this.getState()))),d}async processLegacyDidYouMeanAutoCorrection(e){const t=this.getCurrentQuery(),n=this.getSuccessResponse(e);if(!n.queryCorrections)return null;const{correctedQuery:r}=n.queryCorrections[0],i=await this.automaticallyRetryQueryWithCorrection(r);return ye(i.response)?(this.dispatch(uw(i.response.error)),this.rejectWithValue(i.response.error)):(this.logOriginalAnalyticsQueryBeforeAutoCorrection(e),this.dispatch(Zr(pw(this.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:t,analyticsAction:dw()})}processModernDidYouMeanAutoCorrection(e){const t=this.getSuccessResponse(e),{correctedQuery:n,originalQuery:r}=t.queryCorrection;return this.onUpdateQueryForCorrection(n),{...e,response:{...t},queryExecuted:n,automaticallyCorrected:!0,originalQuery:r,analyticsAction:dw()}}logOriginalAnalyticsQueryBeforeAutoCorrection(e){const t=this.getState(),n=this.getSuccessResponse(e);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(e.queryExecuted,e.duration,t,n),this.extra)}async processQueryTriggersOrContinue(e){const t=this.getSuccessResponse(e);if(!t)return null;const n=t.triggers.find(e=>"query"===e.type)?.content||"";if(!n)return null;const r=this.getState().triggers?.queryModification.queryToIgnore;if(r===n)return this.dispatch(fw("")),null;this.analyticsAction&&await this.dispatch(this.analyticsAction);const i=this.getCurrentQuery(),a=await this.automaticallyRetryQueryWithTriggerModification(n);return ye(a.response)?(this.dispatch(uw(a.response.error)),this.rejectWithValue(a.response.error)):(this.dispatch(Zr(pw(this.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:co("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null)})}getStateAfterResponse(e,t,n,r){return{...n,query:{q:e,enableQuerySyntax:n.query?.enableQuerySyntax??!1},search:{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0},pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0},extendedResults:{},searchAction:void 0,duration:t,response:r,results:r.results}}}processSuccessResponse(e){return this.dispatch(Zr(pw(this.getState()))),{...e,response:this.getSuccessResponse(e),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(e){return me(e.response)?e.response.success:null}async automaticallyRetryQueryWithCorrection(e){this.onUpdateQueryForCorrection(e);const t=await this.fetchFromAPI(await gw(this.getState()),{origin:"mainSearch"});return this.dispatch(lw(e)),t}async automaticallyRetryQueryWithTriggerModification(e){this.dispatch(hw({newQuery:e,originalQuery:this.getCurrentQuery()})),this.onUpdateQueryForCorrection(e);return await this.fetchFromAPI(await gw(this.getState()),{origin:"mainSearch"})}getCurrentQuery(){const e=this.getState();return void 0!==e.query?.q?e.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}};Dn("search/executeSearch",async(e,t)=>{const n=t.getState();return await Iw(n,t,e)}),Dn("search/fetchPage",async(e,t)=>{const n=t.getState();return await _w(n,t,e)}),Dn("search/fetchMoreResults",async(e,t)=>{const n=t.getState();return await Aw(t,n)}),Dn("search/fetchFacetValues",async(e,t)=>{const n=t.getState();return await async function(e,t,n){const{analyticsClientMiddleware:r,preprocessRequest:i,logger:a}=e.extra,{description:s}=await t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:i,logger:a}),o=new yw({...e,analyticsAction:t}),c=await bw(n,s),u=await o.fetchFromAPI(c,{origin:"facetValues"});return await o.process(u)}(t,e,n)}
29),Dn("search/fetchInstantResults",async(e,t)=>Ew(e,t));const vw=async(e,t)=>{const n=await gw(e,t);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n},ww=async(e,t,n)=>Vu({...await Xu(e),...e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean},numberOfResults:n,q:t}),bw=async(e,t)=>{const n=await gw(e,t);return n.request.numberOfResults=0,n},Sw=e=>{e.configuration.analytics.enabled&&oi.getInstance().addElement({name:"Query",...e.query?.q&&{value:e.query.q},time:JSON.stringify(new Date)})};async function Ew(e,t){Tr(e,{id:wr,q:wr,maxResultsPerQuery:new c({required:!0,min:1}),cacheTimeout:new c});const{q:n,maxResultsPerQuery:r}=e,i=t.getState(),a=new yw({...t,analyticsAction:co("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Zv(e))},n=>{t.dispatch(Xv({q:n,id:e.id}))}),s=await ww(i,n,r),o=await a.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),u=await a.process(o);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,analyticsAction:u.analyticsAction,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u}async function _w(e,t,n){Sw(e);const{analyticsClientMiddleware:r,preprocessRequest:i,logger:a}=t.extra,{description:s}=await n.prepare({getState:()=>t.getState(),analyticsClientMiddleware:r,preprocessRequest:i,logger:a}),o=new yw({...t,analyticsAction:n}),c=await gw(e,s),u=await o.fetchFromAPI(c,{origin:"mainSearch"});return await o.process(u)}async function Aw(e,t){const{analyticsClientMiddleware:n,preprocessRequest:r,logger:i}=e.extra,{description:a}=await cw().prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:r,logger:i}),s=new yw({...e,analyticsAction:cw()}),o=await vw(t,a),c=await s.fetchFromAPI(o,{origin:"mainSearch"});return await s.process(c)}async function Iw(e,t,n){Sw(e);const{analyticsClientMiddleware:r,preprocessRequest:i,logger:a}=t.extra,{description:s}=await n.prepare({getState:()=>t.getState(),analyticsClientMiddleware:r,preprocessRequest:i,logger:a}),o=await gw(e,s),c=new yw({...t,analyticsAction:n}),u=await c.fetchFromAPI(o,{origin:"mainSearch"});return await c.process(u)}class kw{config;onUpdateQueryForCorrection;constructor(e,t=e=>{this.dispatch(ow({q:e}))}){this.config=e,this.onUpdateQueryForCorrection=t}async fetchFromAPI({mappings:e,request:t},n){const r=Date.now();return{response:Qu(await this.extra.apiClient.search(t,n),e),duration:Date.now()-r,queryExecuted:this.getState().query?.q||"",requestExecuted:t}}async process(e){return this.processQueryErrorOrContinue(e)??await this.processQueryCorrectionsOrContinue(e)??await this.processQueryTriggersOrContinue(e)??this.processSuccessResponse(e)}processQueryErrorOrContinue(e){return ye(e.response)?(this.dispatch(uw(e.response.error)),this.rejectWithValue(e.response.error)):null}async processQueryCorrectionsOrContinue(e){const t=this.getState(),n=this.getSuccessResponse(e);if(!n||!t.didYouMean)return null;const{enableDidYouMean:r,automaticallyCorrectQuery:i}=t.didYouMean,{results:s,queryCorrections:o,queryCorrection:c}=n;if(!r)return null;if(!i)return a(c)||a(c.correctedQuery)?null:this.processModernDidYouMeanAutoCorrection(e);const u=0===s.length&&o&&0!==o.length,l=!a(c)&&!a(c.correctedQuery);if(!u&&!l)return null;const d=u?await this.processLegacyDidYouMeanAutoCorrection(e):this.processModernDidYouMeanAutoCorrection(e);return this.dispatch(Zr(pw(this.getState()))),d}async processLegacyDidYouMeanAutoCorrection(e){const t=this.getCurrentQuery(),n=this.getSuccessResponse(e);if(!n.queryCorrections)return null;const{correctedQuery:r}=n.queryCorrections[0],i=await this.automaticallyRetryQueryWithCorrection(r);return ye(i.response)?(this.dispatch(uw(i.response.error)),this.rejectWithValue(i.response.error)):(this.dispatch(Zr(pw(this.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:t})}processModernDidYouMeanAutoCorrection(e){const t=this.getSuccessResponse(e),{correctedQuery:n,originalQuery:r}=t.queryCorrection;return this.onUpdateQueryForCorrection(n),{...e,response:{...t},queryExecuted:n,automaticallyCorrected:!0,originalQuery:r}}async processQueryTriggersOrContinue(e){const t=this.getSuccessResponse(e);if(!t)return null;const n=t.triggers.find(e=>"query"===e.type)?.content||"";if(!n)return null;const r=this.getState().triggers?.queryModification.queryToIgnore;if(r===n)return this.dispatch(fw("")),null;const i=this.getCurrentQuery(),a=await this.automaticallyRetryQueryWithTriggerModification(n);return ye(a.response)?(this.dispatch(uw(a.response.error)),this.rejectWithValue(a.response.error)):(this.dispatch(Zr(pw(this.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})}processSuccessResponse(e){return this.dispatch(Zr(pw(this.getState()))),{...e,response:this.getSuccessResponse(e),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(e){return me(e.response)?e.response.success:null}async automaticallyRetryQueryWithCorrection(e){this.onUpdateQueryForCorrection(e);const t=this.getState(),{actionCause:n}={actionCause:Ao.didYouMeanAutomatic},r=await this.fetchFromAPI(await nl(t,this.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return this.dispatch(lw(e)),r}async automaticallyRetryQueryWithTriggerModification(e){this.dispatch(hw({newQuery:e,originalQuery:this.getCurrentQuery()})),this.onUpdateQueryForCorrection(e);return await this.fetchFromAPI(await nl(this.getState(),this.extra.navigatorContext),{origin:"mainSearch"})}getCurrentQuery(){const e=this.getState();return void 0!==e.query?.q?e.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}}Dn("search/prepareForSearchWithQuery",(e,t)=>{const{dispatch:n}=t;Tr(e,{q:new d,enableQuerySyntax:new s,clearFilters:new s}
29),e.clearFilters&&(n(Bv()),n(Kv())),n(Yv({allow:!0})),n(ow({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),n(iw(1))}),sn("search/updateSearchAction");const Tw=Dn("search/executeSearch",async(e,t)=>{const n=t.getState();if("legacy"===n.configuration.analytics.analyticsMode)return Iw(n,t,e.legacy);Nw(n);const r=e.next?Dw(e.next):void 0,i=await nl(n,t.extra.navigatorContext,r),a=new kw({...t,analyticsAction:r??{}}),s=await a.fetchFromAPI(i,{origin:"mainSearch"});return await a.process(s)}),Cw=Dn("search/fetchPage",async(e,t)=>{const n=t.getState();if(Nw(n),"legacy"===n.configuration.analytics.analyticsMode||!e.next)return _w(n,t,e.legacy);const r=new kw({...t,analyticsAction:e.next}),i=await nl(n,t.extra.navigatorContext,e.next),a=await r.fetchFromAPI(i,{origin:"mainSearch"});return await r.process(a)});Dn("search/fetchMoreResults",async(e,t)=>{const n=t.getState();if("legacy"===n.configuration.analytics.analyticsMode)return Aw(t,n);const r=(i=Ao.browseResults,a=t.getState,{...new Fs(a).getBaseMetadata(),actionCause:i,type:i});var i,a;const s=new kw({...t,analyticsAction:r}),o=await xw(n,t.extra.navigatorContext,r),c=await s.fetchFromAPI(o,{origin:"mainSearch"});return await s.process(c)}),Dn("search/fetchFacetValues",async(e,t)=>{const n=t.getState();if("legacy"===n.configuration.analytics.analyticsMode)return Iw(n,t,e.legacy);const r=new kw({...t,analyticsAction:{}}),i=await Rw(n,t.extra.navigatorContext),a=await r.fetchFromAPI(i,{origin:"facetValues"});return await r.process(a)}),Dn("search/fetchInstantResults",async(e,t)=>{const n=t.getState();if("legacy"===n.configuration.analytics.analyticsMode)return Ew(e,t);Tr(e,{id:wr,q:wr,maxResultsPerQuery:new c({required:!0,min:1}),cacheTimeout:new c});const{q:r,maxResultsPerQuery:i}=e,a=Dw({actionCause:Ao.searchboxAsYouType}),s=await Ow(n,t.extra.navigatorContext,r,i,a),o=new kw({...t,analyticsAction:a},n=>{t.dispatch(Xv({q:n,id:e.id}))}),u=await o.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),l=await o.process(u);return"response"in l?{results:l.response.results,searchUid:l.response.searchUid,totalCountFiltered:l.response.totalCountFiltered,duration:l.duration}:l});const xw=async(e,t,n)=>{const r=await nl(e,t,n);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r},Ow=async(e,t,n,r,i)=>Vu({...el(e,t,i),...e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean},numberOfResults:r,q:n}),Rw=async(e,t,n)=>{const r=await nl(e,t,n);return r.request.numberOfResults=0,r},Nw=e=>{e.configuration.analytics.enabled&&oi.getInstance().addElement({name:"Query",...e.query?.q&&{value:e.query.q},time:JSON.stringify(new Date)})},Dw=e=>({actionCause:e.actionCause,type:e.actionCause}),Mw=e=>()=>t=>n=>{const r=n;if(!r.error)return t(n);const i=r.error;return r.payload?.ignored||e.error({error:i,action:n},`Action dispatch error ${r.type}`),"SchemaValidationError"!==r.error.name?t(n):void 0},Pw=(e,t)=>{const{referrer:n,userAgent:r,location:i,clientId:a}=e.getMeta("");return{...t?t():{},referrer:n,userAgent:r,location:i,clientId:a}};function qw(e,t){const n={...e};let r;return{get combinedReducer(){const e=function(e){const t={};for(const[n,r]of e)t[n]=r;return t}(Object.entries(t).filter(([e])=>!(e in n)).map(([e,t])=>[e,()=>t]));return i=xe({...e,...n}),(e,t)=>{const n=i(e,t);return r?r(n,t):n};var i},containsAll:e=>Object.keys(e).every(e=>e in n),add(e){Object.keys(e).filter(e=>!(e in n)).forEach(t=>{n[t]=e[t]})},addCrossReducer(e){r=e}}}function Fw(e,t=60){if(!e)return!1;const n=function(e){if(!e||!function(e){return!!e&&/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e)}(e))return null;try{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(t),r=decodeURIComponent(n.split("").map(e=>`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(r)}catch(t){return null}}(e);if(!n||"number"!=typeof n.exp)return!1;const r=Math.floor(Date.now()/1e3);return n.exp<=r+t}function Uw(e,t){let n=0,r=null;const i=S(()=>{n=0},500),a=async(e,n=!1)=>{const i=!r;i&&t&&(r=(async()=>{try{return await t()}catch(e){if(!n)throw e;return null}})().finally(()=>{r=null}));const a=await r;return i&&a&&e.dispatch(Nr({accessToken:a})),a};return s=>o=>async c=>{const u="function"==typeof t;if(!("function"==typeof c))return o(c);u&&await(async t=>{const n=(r=t.getState(),r.configuration.accessToken);var r;
29if(n&&Fw(n)){e.debug("Access token is expired or about to expire, attempting renewal.");try{await a(t)?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(i){e.warn(i,"Access token renewal failed. A retry will occur if necessary.")}}})(s);const l=await o(c);return function(e){return"object"==typeof e&&null!==e&&"error"in e&&e.error?.name===(new K).name}(l)?u?await(async(t,s,o)=>{if(n>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),jw(t,s.error),s;!r&&(n++,i());try{await a(t,!0)}catch(c){e.debug(c,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}t.dispatch(o)})(s,l,c):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),jw(s,l.error),l):l}}function jw(e,t){e.dispatch(Xr({status:401,statusCode:401,message:t.message,type:t.name}))}function Lw(e,t){const n={...e.reducers,configuration:md,version:nd},r=function(e,t,n){const{reducers:r,navigatorContextProvider:i}=e,a=qw({...r,configurationReducer:n},e.preloadedState??{});e.crossReducer&&a.addCrossReducer(e.crossReducer);const s=t.logger,o={...t,get relay(){return ro(u.state,i)},get navigatorContext(){return Pw(this.relay,i)}},c=function(e,t,n){const{preloadedState:r,configuration:i}=e,a=i.name||"coveo-headless",s=function(e,t,n){const{renewAccessToken:r}=e.configuration,i=Uw(t,r),a=(e=>{const t=yr({extra:e}),n=Hv();return t.startListening({actionCreator:Tw.pending,effect:async(t,r)=>{const i=r.getState();if(!As(i))return;if(n.abortRun(),r.dispatch(Nl()),r.dispatch($v()),!1===i.generatedAnswer.isEnabled)return;const a=ru(i)?.q;!a||""===a.trim()||n.run(i,r.dispatch,e.getNavigatorContext)}}),t})({getNavigatorContext:n});return[yd,i,Mw(t),id].concat(ed.middleware,a.middleware,e.middlewares||[])}(e,t.logger,()=>t.navigatorContext);return function({reducer:e,preloadedState:t,middlewares:n=[],thunkExtraArguments:r,name:i}){return hn({reducer:e,preloadedState:t,devTools:{stateSanitizer:e=>e.history?{...e,history:"<<OMIT>>"}:e,name:i,shouldHotReload:!1},middleware:e=>{return e({thunk:{extraArgument:r}}).prepend(...n).concat((t=r.logger,e=>n=>r=>(t.debug({action:r,nextState:e.getState()},`Action dispatched: ${r.type}`),n(r))));var t}})}({preloadedState:r,reducer:n.combinedReducer,middlewares:s,thunkExtraArguments:t,name:a})}(e,o,a),u={addReducers(e){a.containsAll(e)||(a.add(e),c.replaceReducer(a.combinedReducer))},dispatch:c.dispatch,subscribe:c.subscribe,enableAnalytics(){c.dispatch(Fr())},disableAnalytics(){c.dispatch(qr())},get state(){return c.getState()},get relay(){return ro(this.state,i)},get navigatorContext(){return Pw(this.relay,i)},logger:s,store:c};return u}({...e,reducers:n},t,md),{accessToken:i,environment:a,organizationId:s}=e.configuration;r.dispatch(Nr({accessToken:i,environment:a,organizationId:s}));const o=function(e,t){const{analytics:n}=e,{analyticsClientMiddleware:r,disableBrowserPrivacySignals:i,...a}=n??{},s={...a,...n?.proxyBaseUrl&&{apiBaseUrl:n.proxyBaseUrl,nexApiBaseUrl:n.proxyBaseUrl}},o="next"!==s.analyticsMode,c="legacy"===s.analyticsMode&&!0===i;return o&&w()&&!c?(t.info("Analytics disabled since doNotTrack is active."),{...s,enabled:!1}):(o&&w()&&c&&!1!==s.enabled&&t.warn("Browser privacy signals (Do Not Track and Global Privacy Control) are present but are being ignored because analytics.disableBrowserPrivacySignals is set to true. Legacy analytics events will be sent, and your integration is responsible for privacy compliance."),s)}(e.configuration,r.logger);return o&&r.dispatch(Pr(o)),r}var $w,Vw,Gw,Qw={exports:{}};var zw=function(){if(Gw)return Qw.exports;Gw=1;const e=function(){if(Vw)return $w;function e(e){try{return JSON.stringify(e)}catch(t){return'"[Circular]"'}}return Vw=1,$w=function(t,n,r){var i=r&&r.stringify||e;if("object"==typeof t&&null!==t){var a=n.length+1;if(1===a)return t;var s=new Array(a);s[0]=i(t);for(var o=1;o<a;o++)s[o]=i(n[o]);return s.join(" ")}if("string"!=typeof t)return t;var c=n.length;if(0===c)return t;for(var u="",l=0,d=-1,p=t&&t.length||0,f=0;f<p;){if(37===t.charCodeAt(f)&&f+1<p){switch(d=d>-1?d:0,t.charCodeAt(f+1)){case 100:case 102:if(l>=c)break;if(null==n[l])break;d<f&&(u+=t.slice(d,f)),u+=Number(n[l]),d=f+2,f++;break;case 105:if(l>=c)break;if(null==n[l])break;d<f&&(u+=t.slice(d,f)),u+=Math.floor(Number(n[l])),d=f+2,f++;break;case 79:case 111:case 106:if(l>=c)break;if(void 0===n[l])break;d<f&&(u+=t.slice(d,f));var h=typeof n[l];if("string"===h){u+="'"+n[l]+"'",d=f+2,f++;break}if("function"===h){u+=n[l].name||"<anonymous>",d=f+2,f++;break}u+=i(n[l]),d=f+2,f++;break;case 115:if(l>=c)break;d<f&&(u+=t.slice(d,f)),u+=String(n[l]),d=f+2,f++;break;case 37:d<f&&(u+=t.slice(d,f)),u+="%",d=f+2,f++,l--}
29++l}++f}return-1===d?t:(d<p&&(u+=t.slice(d)),u)}}();Qw.exports=c;const t=function(){function e(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(t){return e(self)||e(window)||e(this)||{}}}().console||{},n={mapHttpRequest:h,mapHttpResponse:h,wrapRequestSerializer:g,wrapResponseSerializer:g,wrapErrorSerializer:g,req:h,res:h,err:p,errWithCause:p};function r(e,t){return"silent"===e?1/0:t.levels.values[e]}const i=Symbol("pino.logFuncs"),a=Symbol("pino.hierarchy"),s={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function o(e,t){const n={logger:t,parent:e[a]};t[a]=n}function c(e){(e=e||{}).browser=e.browser||{};const n=e.browser.transmit;if(n&&"function"!=typeof n.send)throw Error("pino: transmit option must have a send function");const a=e.browser.write||t;e.browser.write&&(e.browser.asObject=!0);const p=e.serializers||{},h=function(e,t){if(Array.isArray(e))return e.filter(function(e){return"!stdSerializers.err"!==e});return!0===e&&Object.keys(t)}(e.browser.serialize,p);let g=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(g=!1);const y=Object.keys(e.customLevels||{}),v=["error","fatal","warn","info","debug","trace"].concat(y);"function"==typeof a&&v.forEach(function(e){a[e]=a}),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const w=e.level||"info",b=Object.create(a);b.log||(b.log=m),function(e,n,r){const a={};n.forEach(e=>{a[e]=r[e]?r[e]:t[e]||t[s[e]||"log"]||m}),e[i]=a}(b,v,a),o({},b),Object.defineProperty(b,"levelVal",{get:function(){return r(this.level,this)}}),Object.defineProperty(b,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,u(this,S,b,"error"),u(this,S,b,"fatal"),u(this,S,b,"warn"),u(this,S,b,"info"),u(this,S,b,"debug"),u(this,S,b,"trace"),y.forEach(e=>{u(this,S,b,e)})}});const S={transmit:n,serialize:h,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,reportCaller:e.browser.reportCaller,levels:v,timestamp:f(e),messageKey:e.messageKey||"msg",onChild:e.onChild||m};function E(t,r,i){if(!r)throw new Error("missing bindings for child Pino");i=i||{},h&&r.serializers&&(i.serializers=r.serializers);const a=i.serializers;if(h&&a){var s=Object.assign({},p,a),c=!0===e.browser.serialize?Object.keys(s):h;delete r.serializers,l([r],c,s,this._stdErrSerialize)}function u(e){this._childLevel=1+(0|e._childLevel),this.bindings=r,s&&(this.serializers=s,this._serialize=c),n&&(this._logEvent=d([].concat(e._logEvent.bindings,r)))}u.prototype=this;const f=new u(this);return o(this,f),f.child=function(...e){return E.call(this,t,...e)},f.level=i.level||this.level,t.onChild(f),f}return b.levels=function(e){const t=e.customLevels||{},n=Object.assign({},c.levels.values,t),r=Object.assign({},c.levels.labels,function(e){const t={};return Object.keys(e).forEach(function(n){t[e[n]]=n}),t}(t));return{values:n,labels:r}}(e),b.level=w,b.isLevelEnabled=function(e){return!!this.levels.values[e]&&this.levels.values[e]>=this.levels.values[this.level]},b.setMaxListeners=b.getMaxListeners=b.emit=b.addListener=b.on=b.prependListener=b.once=b.prependOnceListener=b.removeListener=b.removeAllListeners=b.listeners=b.listenerCount=b.eventNames=b.write=b.flush=m,b.serializers=p,b._serialize=h,b._stdErrSerialize=g,b.child=function(...e){return E.call(this,S,...e)},n&&(b._logEvent=d()),b}function u(n,s,o,c){if(Object.defineProperty(n,c,{value:r(n.level,o)>r(c,o)?m:o[i][c],writable:!0,enumerable:!0,configurable:!0}),n[c]===m){if(!s.transmit)return;const e=r(s.transmit.level||n.level,o);if(r(c,o)<e)return}n[c]=function(n,a,s,o){return function(i){return function(){const c=a.timestamp(),u=new Array(arguments.length),p=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var f=0;f<u.length;f++)u[f]=arguments[f];var h=!1;if(a.serialize&&(l(u,this._serialize,this.serializers,this._stdErrSerialize),h=!0),a.asObject||a.formatters){const t=function(t,n,r,i,a){const{level:s,log:o=e=>e}=a.formatters||{},c=r.slice();let u=c[0];const l={};let d=1+(0|t._childLevel);d<1&&(d=1);i&&(l.time=i);if(s){const e=s(n,t.levels.values[n]);Object.assign(l,e)}else l.level=t.levels.values[n];if(a.asObjectBindingsOnly){if(null!==u&&"object"==typeof u)for(;d--&&"object"==typeof c[0];)Object.assign(l,c.shift());return[o(l),...c]}if(null!==u&&"object"==typeof u){for(;d--&&"object"==typeof c[0];)Object.assign(l,c.shift());u=c.length?e(c.shift(),c):void 0}else"string"==typeof u&&(u=e(c.shift(),c));void 0!==u&&(l[a.messageKey]=u);return[o(l)]}(this,o,u,c,a);if(a.reportCaller&&t&&t.length>0&&t[0]&&"object"==typeof t[0])try{const e=w();e&&(t[0].caller=e)}catch(g){}i.call(p,...t)}else{if(a.reportCaller)try{const e=w();e&&u.push(e)}catch(g){}i.apply(p,u)}if(a.transmit){const e=r(a.transmit.level||n._level,s),t=r(o,s);if(t<e)return;!function(e,t,n,r=!1){const i=t.send,a=t.ts,s=t.methodLevel,o=t.methodValue,c=t.val,u=e._logEvent.bindings;r||l(n,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize);e._logEvent.ts=a,e._logEvent.messages=n.filter(function(e){return-1===u.indexOf(e)}),e._logEvent.level.label=s,e._logEvent.level.value=o,i(s,e._logEvent,c),e._logEvent=d(u)}(this,{ts:c,methodLevel:o,methodValue:t,transmitValue:s.levels.values[a.transmit.level||n._level],send:a.transmit.send,val:r(n._level,s)},u,h)}}}(n[i][o])}(n,s,o,c);const u=function(e){const t=[];e.bindings&&t.push(e.bindings);let n=e[a];for(;n.parent;)n=n.parent,n.logger.bindings&&t.push(n.logger.bindings);return t.reverse()}(n);0!==u.length&&(n[c]=function(e,t){return function(){return t.apply(this,[...e,...arguments])}}(u,n[c]))}function l(e,t,n,r){for(const i in e)if(r&&e[i]instanceof Error)e[i]=c.stdSerializers.err(e[i]);else if("object"==typeof e[i]&&!Array.isArray(e[i])&&t)for(const r in e[i])t.indexOf(r)>
29-1&&r in n&&(e[i][r]=n[r](e[i][r]))}function d(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function p(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const n in e)void 0===t[n]&&(t[n]=e[n]);return t}function f(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?y:v}function h(){return{}}function g(e){return e}function m(){}function y(){return!1}function v(){return Date.now()}function w(){const e=(new Error).stack;if(!e)return null;const t=e.split("\n");for(let n=1;n<t.length;n++){const e=t[n].trim();if(/(^at\s+)?(createWrap|LOG|set\s*\(|asObject|Object\.apply|Function\.apply)/.test(e))continue;if(-1!==e.indexOf("browser.js"))continue;if(-1!==e.indexOf("node:internal"))continue;if(-1!==e.indexOf("node_modules"))continue;let r=e.match(/\((.*?):(\d+):(\d+)\)/);if(r||(r=e.match(/at\s+(.*?):(\d+):(\d+)/)),r){return r[1]+":"+r[2]+":"+r[3]}}return null}return c.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"}},c.stdSerializers=n,c.stdTimeFunctions=Object.assign({},{nullTime:y,epochTime:v,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}}),Qw.exports.default=c,Qw.exports.pino=c,Qw.exports}();function Hw(e,t){const n=function(e){const{analytics:t}=e,n=(e,t)=>t;return t?.analyticsClientMiddleware||n}(e),r=kr,i=function(e){return e.preprocessRequest||re}(e);return{analyticsClientMiddleware:n,validatePayload:r,preprocessRequest:i,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}const Bw={organizationId:wr,accessToken:wr,name:new d({required:!1,emptyAllowed:!1}),analytics:new f({options:{required:!1},values:{enabled:new s({required:!1}),originContext:new d({required:!1}),originLevel2:new d({required:!1}),originLevel3:new d({required:!1}),analyticsMode:new d({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new d({required:!1,url:!0}),trackingId:new d({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new s({required:!1})}}),environment:new d({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};const Kw=new n({...Bw,pipeline:new d({required:!1,emptyAllowed:!0}),searchHub:br,locale:br,timezone:br});function Yw(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457",searchHub:"default"}}const Zw={debug:Hr,pipeline:Jr,searchHub:No,recommendation:Oo};function Ww(e){const t=function(e){return zw.pino({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}(e.loggerOptions);!function(e,t){try{Kw.validate(e)}catch(n){throw t.error(n,"Recommendation engine configuration error"),n}}(e.configuration,t);const n=function(e,t){return new ge({logger:t,preprocessRequest:e.preprocessRequest||re,postprocessSearchResponseMiddleware:e.preprocessSearchResponseMiddleware||be,postprocessFacetSearchResponseMiddleware:Se,postprocessQuerySuggestResponseMiddleware:Ee})}(e.configuration,t),r={...Hw(e.configuration,t),apiClient:n},i=Lw({...e,reducers:Zw},r),{pipeline:s,searchHub:o,timezone:c,locale:u,proxyBaseUrl:l}=e.configuration;return i.dispatch(Dr({timezone:c,locale:u,proxyBaseUrl:l})),a(s)||i.dispatch(Br(s)),a(o)||i.dispatch(Ro(o)),{...i,get state(){return i.state}}}const Jw=new g({each:wr,required:!0}),Xw=(e,t)=>(Tr(e,wr),p(t)?Tr(t,wr):Tr(t,Jw),{payload:{contextKey:e,contextValue:t}}),eb=sn("context/set",e=>{for(const[t,n]of Object.entries(e))Xw(t,n);return{payload:e}}),tb=sn("context/add",e=>Xw(e.contextKey,e.contextValue)),nb=sn("context/remove",e=>Tr(e,wr)),rb=mn({contextValues:{}},e=>{e.addCase(eb,(e,t)=>{e.contextValues=t.payload}).addCase(tb,(e,t)=>{e.contextValues[t.payload.contextKey]=t.payload.contextValue}).addCase(nb,(e,t)=>{delete e.contextValues[t.payload]}).addCase(Wr.fulfilled,(e,t)=>{t.payload&&(e.contextValues=t.payload.context.contextValues)})});function ib(e){let t;const n=new Map,r=()=>0===n.size;return{subscribe(i){i();const a=Symbol();let s;return r()&&(t=JSON.stringify(this.state),s=e.subscribe(()=>{(e=>{try{const n=JSON.stringify(e),r=t!==n;return t=n,r}catch(n){return console.warn('Could not detect if state has changed, check the controller "get state method"',n),!0}}
29)(this.state)&&n.forEach(e=>e())})),n.set(a,i),()=>{n.delete(a),r()&&s?.()}},get state(){return{}}}}const ab=["caseId","caseNumber"],sb={caseId:"caseContext",caseNumber:"caseContext"};class ob extends Error{constructor(e){super(`The key "${e}" is reserved for internal use. Use ${sb[e]} to set this value.}`)}}function cb(e){return ab.includes(e)}const ub=new n({values:new f({options:{required:!1}})});function lb(e,t={}){!function(e){e.addReducers({context:rb})}(e);const n=ib(e),{dispatch:r}=e,i=()=>e.state,a=((e,t,n,r)=>Cr(e,t,n,`Check the initialState of ${r}`,"Controller initialization error"))(e,ub,t.initialState,"buildContext");return a.values&&r(eb(a.values)),{...n,get state(){return{values:i().context.contextValues}},set(e){r(eb(e))},..."legacy"===i().configuration.analytics.analyticsMode?db(r):pb(r)}}const db=e=>({add(t,n){e(tb({contextKey:t,contextValue:n}))},remove(t){e(nb(t))}}),pb=e=>({add(t,n){if(cb(t))throw new ob(t);e(tb({contextKey:t,contextValue:n}))},remove(t){if(cb(t))throw new ob(t);e(nb(t))}});function fb(e,t){return lb(e,t)}const hb=sn("dictionaryFieldContext/set",e=>{const t=new f({options:{required:!0}}),n=Tr(e,t).error;if(n)return{payload:e,error:n};const r=Object.values(e),i=new g({each:Sr}),a=Tr(r,i).error;return a?{payload:e,error:a}:{payload:e}}),gb=sn("dictionaryFieldContext/add",e=>{const t=new f({options:{required:!0},values:{field:Sr,key:Sr}});return Tr(e,t)}),mb=sn("dictionaryFieldContext/remove",e=>Tr(e,Sr)),yb=mn({contextValues:{}},e=>{e.addCase(hb,(e,t)=>{e.contextValues=t.payload}).addCase(gb,(e,t)=>{const{field:n,key:r}=t.payload;e.contextValues[n]=r}).addCase(mb,(e,t)=>{delete e.contextValues[t.payload]}).addCase(Wr.fulfilled,(e,t)=>{t.payload&&(e.contextValues=t.payload.dictionaryFieldContext.contextValues)})});function vb(e){!function(e){e.addReducers({dictionaryFieldContext:yb})}(e);const t=ib(e),{dispatch:n}=e;return{...t,get state(){return{values:e.state.dictionaryFieldContext.contextValues}},set(e){n(hb(e))},add(e,t){n(gb({field:e,key:t}))},remove(e){n(mb(e))}}}const wb={value:wr,numberOfResults:new c({min:0}),state:wr},bb=wr,Sb=new c({min:1,default:8,required:!1}),Eb={desiredCount:new c({min:1,max:20,default:5,required:!1}),numberOfValues:Sb};sn("automaticFacet/setOptions",e=>Tr(e,Eb)),sn("automaticFacet/deselectAll",e=>Tr(e,bb));const _b=wr,Ab=sn("automaticFacet/toggleSelectValue",e=>Tr(e,{field:_b,selection:new f({values:wb})})),Ib={state:new r({required:!0}),numberOfResults:new c({required:!0,min:0}),value:new d({required:!0,emptyAllowed:!0}),path:new g({required:!0,each:wr}),moreValuesAvailable:new s({required:!1})};function kb(e){e.children.forEach(e=>{kb(e)}),kr({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},Ib)}const Tb={facetId:bb,field:wr,tabs:new f({options:{required:!1},values:{included:new g({each:new d}),excluded:new g({each:new d})}}),activeTab:new d({required:!1}),delimitingCharacter:new d({required:!1,emptyAllowed:!0}),filterFacetCount:new s({required:!1}),injectionDepth:new c({required:!1,min:0}),numberOfValues:new c({required:!1,min:1}),sortCriteria:new r({required:!1}),basePath:new g({required:!1,each:wr}),filterByBasePath:new s({required:!1})};sn("categoryFacet/register",e=>Tr(e,Tb));const Cb=sn("categoryFacet/toggleSelectValue",e=>{try{return kr(e.facetId,wr),kb(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:Ir(t)}}}),xb=sn("categoryFacet/deselectAll",e=>Tr(e,Tb.facetId));sn("categoryFacet/updateNumberOfValues",e=>Tr(e,{facetId:Tb.facetId,numberOfValues:Tb.numberOfValues})),sn("categoryFacet/updateSortCriterion",e=>Tr(e,{facetId:Tb.facetId,criterion:new r})),sn("categoryFacet/updateBasePath",e=>Tr(e,{facetId:Tb.facetId,basePath:new g({each:wr})}));const Ob={facetId:bb,captions:new f({options:{required:!1}}),numberOfValues:new c({required:!1,min:1}),query:new d({required:!1,emptyAllowed:!0})},Rb={path:new g({required:!0,each:wr}),displayValue:Sr,rawValue:Sr,count:new c({required:!0,min:0})},Nb=sn("categoryFacet/selectSearchResult",e=>Tr(e,{facetId:bb,value:new f({values:Rb})}));sn("categoryFacetSearch/register",e=>Tr(e,Ob));const Db={facetId:bb,value:new f({values:{displayValue:Sr,rawValue:Sr,count:new c({required:!0,min:0})}})};sn("facetSearch/register",e=>Tr(e,Ob)),sn("facetSearch/update",e=>Tr(e,Ob));const Mb=sn("facetSearch/toggleSelectValue",e=>Tr(e,Db)),Pb=sn("facetSearch/toggleExcludeValue",e=>Tr(e,Db));new d({regex:/^[a-zA-Z0-9-_]+$/}),new d({required:!0}),new g({each:new d}),new d;const qb=new c({min:1}),Fb=new f,Ub=new d;new f({values:{captions:Fb,numberOfValues:qb,query:Ub}});const jb=new f({options:{required:!1},values:{type:new d({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new g({required:!0,max:25,each:new d({emptyAllowed:!1,required:!0})})}}),Lb=new g({min:1,max:25,required:!1,each:new d({emptyAllowed:!1,required:!0})}),$b={facetId:bb,field:new d({required:!0,emptyAllowed:!0}),tabs:new f({options:{required:!1},values:{included:new g({each:new d}),excluded:new g({each:new d})}}),activeTab:new d({required:!1}),filterFacetCount:new s({required:!1}),injectionDepth:new c({required:!1,min:0}),numberOfValues:new c({required:!1,min:1}),sortCriteria:new r({required:!1}),resultsMustMatch:new r({required:!1}),allowedValues:jb,customSort:Lb};sn("facet/register",e=>Tr(e,$b));const Vb=sn("facet/toggleSelectValue",e=>Tr(e,{facetId:bb,selection:new f({values:wb})})),Gb=sn("facet/toggleExcludeValue",e=>Tr(e,{facetId:bb,selection:new f({values:wb})})),Qb=sn("facet/deselectAll",e=>Tr(e,bb));function zb(e,t){const{dateFormat:n}=t;return(r=e)&&"object"==typeof r&&"period"in r?(Du(e),function(e){const{period:t,amount:n,unit:r}=e;switch(t){case"past":case"next":return`${t}-${n}-${r}`;case"now":return t}}(e)):"string"==typeof e&&Fu(e)?(Du(e),e):(function(e,t){const n=Cu(e,t);if(!n.isValid())throw new Error(`Could not parse the provided date "${e}"${t?` with the format "${t}
29"`:". Please provide a date format string in the configuration options. See https://day.js.org/docs/en/parse/string-format for more information."}`);Ou(n)}(e,n),xu(Cu(e,n)));var r}sn("facet/updateSortCriterion",e=>Tr(e,{facetId:bb,criterion:new r({required:!0})})),sn("facet/updateNumberOfValues",e=>Tr(e,{facetId:bb,numberOfValues:new c({required:!0,min:1})})),sn("facet/updateIsFieldExpanded",e=>Tr(e,{facetId:bb,isFieldExpanded:new s({required:!0})})),sn("facet/updateFreezeCurrentValues",e=>Tr(e,{facetId:bb,freezeCurrentValues:new s({required:!0})})),sn("rangeFacet/updateSortCriterion",e=>Tr(e,{facetId:bb,criterion:new r({required:!0})}));const Hb={state:wr,start:new c({required:!0}),end:new c({required:!0}),endInclusive:new s({required:!0}),numberOfResults:new c({required:!0,min:0})},Bb={start:wr,end:wr,endInclusive:new s({required:!0}),state:wr,numberOfResults:new c({required:!0,min:0})},Kb={start:wr,end:wr,endInclusive:new s({required:!0}),state:wr},Yb={facetId:bb,field:wr,tabs:new f({options:{required:!1},values:{included:new g({each:new d}),excluded:new g({each:new d})}}),activeTab:new d({required:!1}),currentValues:new g({required:!1,each:new f({values:Kb})}),generateAutomaticRanges:new s({required:!0}),filterFacetCount:new s({required:!1}),injectionDepth:new c({required:!1,min:0}),numberOfValues:new c({required:!1,min:1}),sortCriteria:new r({required:!1}),rangeAlgorithm:new r({required:!1})};function Zb(e){return Fu(e)?Pu(e):e}function Wb(e){e.currentValues&&e.currentValues.forEach(e=>{const{start:t,end:n}={start:zb((r=e).start,r),end:zb(r.end,r),endInclusive:r.endInclusive??!1,state:r.state??"idle"};var r;if(Cu(Zb(t)).isAfter(Cu(Zb(n))))throw new Error(`The start value is greater than the end value for the date range ${e.start} to ${e.end}`)})}sn("dateFacet/register",e=>{try{return kr(e,Yb),Wb(e),{payload:e,error:null}}catch(t){return{payload:e,error:Ir(t)}}});const Jb=sn("dateFacet/toggleSelectValue",e=>Tr(e,{facetId:bb,selection:new f({values:Bb})})),Xb=sn("dateFacet/toggleExcludeValue",e=>Tr(e,{facetId:bb,selection:new f({values:Bb})})),eS=sn("dateFacet/updateFacetValues",e=>{try{return kr(e,{facetId:bb,values:new g({each:new f({values:Bb})})}),Wb({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Ir(t)}}}),tS={state:wr,start:new c({required:!0}),end:new c({required:!0}),endInclusive:new s({required:!0})},nS={facetId:bb,field:wr,tabs:new f({options:{required:!1},values:{included:new g({each:new d}),excluded:new g({each:new d})}}),activeTab:new d({required:!1}),currentValues:new g({required:!1,each:new f({values:tS})}),generateAutomaticRanges:new s({required:!0}),filterFacetCount:new s({required:!1}),injectionDepth:new c({required:!1,min:0}),numberOfValues:new c({required:!1,min:1}),sortCriteria:new r({required:!1}),rangeAlgorithm:new r({required:!1})};function rS(e){e.currentValues&&e.currentValues.forEach(({start:e,end:t})=>{if(e>t)throw new Error(`The start value is greater than the end value for the numeric range ${e} to ${t}`)})}sn("numericFacet/register",e=>{try{return Tr(e,nS),rS(e),{payload:e,error:null}}catch(t){return{payload:e,error:Ir(t)}}});const iS=sn("numericFacet/toggleSelectValue",e=>Tr(e,{facetId:bb,selection:new f({values:Hb})})),aS=sn("numericFacet/toggleExcludeValue",e=>Tr(e,{facetId:bb,selection:new f({values:Hb})})),sS=sn("numericFacet/updateFacetValues",e=>{try{return kr(e,{facetId:bb,values:new g({each:new f({values:Hb})})}),rS({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Ir(t)}}}),oS=mn({firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0},e=>{e.addCase(tw,(e,t)=>{const n=uS(e),r=t.payload;e.defaultNumberOfResults=e.numberOfResults=r,e.firstResult=lS(n,r)}).addCase(nw,(e,t)=>{e.numberOfResults=t.payload,e.firstResult=0}).addCase(ad,e=>{e.firstResult=0}).addCase(rw,(e,t)=>{const n=t.payload;e.firstResult=lS(n,e.numberOfResults)}).addCase(iw,(e,t)=>{const n=t.payload;e.firstResult=lS(n,e.numberOfResults)}).addCase(sw,e=>{const t=uS(e),n=Math.max(t-1,1);e.firstResult=lS(n,e.numberOfResults)}).addCase(aw,e=>{const t=uS(e),n=function(e){const{totalCountFiltered:t,numberOfResults:n}=e;return function(e,t){const n=Math.min(e,Ju);return Math.ceil(n/t)}(t,n)}(e),r=Math.min(t+1,n);e.firstResult=lS(r,e.numberOfResults)}).addCase(Wr.fulfilled,(e,t)=>{t.payload&&(e.numberOfResults=t.payload.pagination.numberOfResults,e.firstResult=t.payload.pagination.firstResult)}).addCase(Vr,(e,t)=>{e.firstResult=t.payload.firstResult??e.firstResult,e.numberOfResults=t.payload.numberOfResults??e.defaultNumberOfResults}).addCase(Tw.fulfilled,(e,t)=>{const{response:n}=t.payload;e.totalCountFiltered=n.totalCountFiltered}).addCase(Cw.fulfilled,(e,t)=>{const{response:n}=t.payload;e.totalCountFiltered=n.totalCountFiltered}).addCase(Qb,e=>{cS(e)}).addCase(Xb,e=>{cS(e)}).addCase(Gb,e=>{cS(e)}).addCase(aS,e=>{cS(e)}).addCase(Pb,e=>{cS(e)}).addCase(Vb,e=>{cS(e)}).addCase(xb,e=>{cS(e)}).addCase(Cb,e=>{cS(e)}).addCase(Nb,e=>{cS(e)}).addCase(Jb,e=>{cS(e)}).addCase(iS,e=>{cS(e)}).addCase(Bv,e=>{cS(e)}
29).addCase(eS,e=>{cS(e)}).addCase(sS,e=>{cS(e)}).addCase(Mb,e=>{cS(e)}).addCase(Ab,e=>{cS(e)})});function cS(e){e.firstResult=0}function uS(e){const{firstResult:t,numberOfResults:n}=e;return function(e,t){return Math.round(e/t)+1}(t,n)}function lS(e,t){return(e-1)*t}function dS(e){return e.addReducers({pagination:oS}),{nextPage:aw,previousPage:sw,registerNumberOfResults:tw,registerPage:rw,updateNumberOfResults:nw,updatePage:iw}}const pS=new n({id:new d({emptyAllowed:!0,required:!1,default:""}),numberOfRecommendations:new c({min:0})});function fS(e,t={}){!function(e){e.addReducers({recommendation:Oo,configuration:md})}(e);const n=ib(e),{dispatch:r}=e,i=((e,t,n,r)=>Cr(e,t,n,`Check the options of ${r}`,"Controller initialization error"))(e,pS,t.options,"buildRecommendationList");return""!==i.id&&r(ko({id:i.id})),i.numberOfRecommendations&&r(dS(e).updateNumberOfResults(i.numberOfRecommendations)),{...n,refresh(){r(To())},get state(){const t=e.state;return{recommendations:t.recommendation.recommendations,error:t.recommendation.error,isLoading:t.recommendation.isLoading,searchResponseId:t.recommendation.searchUid}}}}function hS(e,t,n){!function(e){e.addReducers({configuration:md})}(e);const r={selectionDelay:1e3,debounceWait:1e3,...t.options};let i;return{select:S(n,r.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(n,r.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function gS(e,t){let n=!1;return hS(e,t,()=>{n||(n=!0,e.dispatch(Io(t.options.result)))})}const mS=()=>new d({required:!1,emptyAllowed:!0}),yS=sn("advancedSearchQueries/update",e=>Tr(e,{aq:mS(),cq:mS(),lq:mS(),dq:mS()})),vS=sn("advancedSearchQueries/register",e=>Tr(e,{aq:mS(),cq:mS(),lq:mS(),dq:mS()})),wS=mn({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}},e=>{e.addCase(yS,(e,t)=>{const{aq:n,cq:r,lq:a,dq:s}=t.payload;i(n)||(e.aq=n,e.aqWasSet=!0),i(r)||(e.cq=r,e.cqWasSet=!0),i(a)||(e.lq=a,e.lqWasSet=!0),i(s)||(e.dq=s,e.dqWasSet=!0)}).addCase(vS,(e,t)=>{const{aq:n,cq:r,lq:a,dq:s}=t.payload;i(n)||(e.defaultFilters.aq=n,e.aqWasSet||(e.aq=n)),i(r)||(e.defaultFilters.cq=r,e.cqWasSet||(e.cq=r)),i(a)||(e.defaultFilters.lq=a,e.lqWasSet||(e.lq=a)),i(s)||(e.defaultFilters.dq=s,e.dqWasSet||(e.dq=s))}).addCase(Wr.fulfilled,(e,t)=>t.payload?.advancedSearchQueries??e).addCase(Vr,(e,t)=>{const{aq:n,cq:r}=t.payload;i(n)||(e.aq=n,e.aqWasSet=!0),i(r)||(e.cq=r,e.cqWasSet=!0)})});function bS(e){return e.addReducers({advancedSearchQueries:wS}),{updateAdvancedSearchQueries:yS,registerAdvancedSearchQueries:vS}}function SS(e){return e.addReducers({configuration:md}),{disableAnalytics:qr,enableAnalytics:Fr,setOriginLevel2:Ur,setOriginLevel3:jr,updateAnalyticsConfiguration:Pr,updateBasicConfiguration:Nr}}function ES(e){return e.addReducers({configuration:md,pipeline:Jr,searchHub:No}),{updateSearchConfiguration:Dr}}function _S(e){return e.addReducers({context:rb}),{addContext:tb,removeContext:nb,setContext:eb}}function AS(e){return e.addReducers({debug:Hr}),{disableDebug:zr,enableDebug:Qr}}function IS(e){return e.addReducers({dictionaryFieldContext:yb}),{addContext:gb,removeContext:mb,setContext:hb}}const kS={collectionField:new d({emptyAllowed:!1,required:!1}),parentField:new d({emptyAllowed:!1,required:!1}),childField:new d({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new c({min:0,required:!1})},TS=sn("folding/register",e=>Tr(e,kS));function CS(e){return""===e.query.q?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}Dn("folding/loadCollection",async(e,{getState:t,rejectWithValue:n,extra:{apiClient:r,navigatorContext:i}})=>{const a=t(),s="legacy"===a.configuration.analytics.analyticsMode?await Xu(a):el(a,i),o=await r.search({...s,q:CS(a),enableQuerySyntax:!0,cq:`@${a.folding.fields.collection}="${e}"`,filterField:a.folding.fields.collection,childField:a.folding.fields.parent,parentField:a.folding.fields.child,filterFieldRange:100},{origin:"foldingCollection"});return ye(o)?n(o.error):{collectionId:e,results:o.success.results,searchUid:o.success.searchUid,rootResult:a.folding.collections[e].result}});const xS=sn("fields/registerFieldsToInclude",e=>Tr(e,Er)),OS=sn("fields/fetchall/enable"),RS=sn("fields/fetchall/disable"),NS=Dn("fields/fetchDescription",async(e,{extra:t,getState:n,rejectWithValue:r})=>{const i=n(),{accessToken:a,environment:s,organizationId:o}=i.configuration,{apiBaseUrl:c}=i.configuration.search,u=await t.apiClient.fieldDescriptions({accessToken:a,organizationId:o,url:c??te(o,s)});return ye(u)?r(u.error):u.success.fields}),DS=["author","language","urihash","objecttype","collection","source","permanentid"],MS=[...DS,"date","filetype","parents"],PS=[...MS,"ec_price","ec_name","ec_description","ec_brand","ec_category","ec_item_group_id","ec_shortdesc","ec_thumbnails","ec_images","ec_promo_price","ec_in_stock","ec_rating"],qS=mn({fieldsToInclude:DS,fetchAllFields:!1,fieldsDescription:[]},e=>e.addCase(xS,(e,t)=>{e.fieldsToInclude=[...new Set(e.fieldsToInclude.concat(t.payload))]}).addCase(OS,e=>{e.fetchAllFields=!0}).addCase(RS,e=>{e.fetchAllFields=!1}).addCase(NS.fulfilled,(e,{payload:t})=>{e.fieldsDescription=t}).addCase(TS,(e,{payload:t})=>{const n={collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"};e.fieldsToInclude.push(t.collectionField??n.collection,t.parentField??n.parent,t.childField??n.child)}));function FS(e){return e.addReducers({fields:qS}),{registerFieldsToInclude:xS,enableFetchAllFields:OS,disableFetchAllFields:RS,fetchFieldsDescription:NS}}function US(e){return e.addReducers({pipeline:Jr}),{setPipeline:Br}}function jS(e){return e.addReducers({recommendation:Oo}),{getRecommendations:To,setRecommendationId:ko}}function LS(e){return e.addReducers({}),{logRecommendationOpen:Io}}const $S=new n({content:new r({required:!0}),conditions:new r({required:!0}),priority:new c({required:!1,default:0,min:0}),fields:new g({required:!1,each:wr})});function VS(e){!function(e){e.addReducers({fields:qS})}(e);const{registerTemplates:n,selectTemplate:r,selectLinkTemplate:i}=function(){const e=[],n=e=>{const n=$S.validate(e);if(!e.conditions.every(e=>e instanceof Function))throw new t("Each template condition should be a function that takes a Re
29sult or Product as an argument and returns a boolean");return n};return{registerTemplates(...t){t.forEach(t=>{const r={...n(t),fields:t.fields||[]};e.push(r)}),e.sort((e,t)=>t.priority-e.priority)},selectTemplate(t){const n=e.find(e=>e.conditions.every(e=>e(t)));return n?n.content:null},selectLinkTemplate(t){const n=e.find(e=>e.conditions.every(e=>e(t)));return n?n.linkContent:null}}}();return{registerTemplates:(...t)=>{n(...t);const r=[];t.forEach(e=>{e.fields&&r.push(...e.fields)}),e.dispatch(xS(r))},selectTemplate:r,selectLinkTemplate:i}}function GS(e){return e.addReducers({searchHub:No}),{setSearchHub:Ro}}export{MS as DefaultFieldsToInclude,PS as EcommerceDefaultFieldsToInclude,A as HighlightUtils,DS as MinimumFieldsToInclude,ll as ResultTemplatesHelpers,fb as buildContext,ib as buildController,vb as buildDictionaryFieldContext,gS as buildInteractiveResult,Ww as buildRecommendationEngine,fS as buildRecommendationList,VS as buildResultTemplatesManager,ne as getAnalyticsNextApiBaseUrl,X as getOrganizationEndpoint,Yw as getSampleRecommendationEngineConfiguration,bS as loadAdvancedSearchQueryActions,LS as loadClickAnalyticsActions,SS as loadConfigurationActions,_S as loadContextActions,AS as loadDebugActions,IS as loadDictionaryFieldContextActions,FS as loadFieldActions,dS as loadPaginationActions,US as loadPipelineActions,jS as loadRecommendationActions,ES as loadSearchConfigurationActions,GS as loadSearchHubActions};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.