@coveo/quantic 3.44.3 → 3.45.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/out/quantic-docs.json +58 -0
- package/force-app/main/default/labels/CustomLabels.labels-meta.xml +28 -0
- package/force-app/main/default/lwc/quanticLoadMoreResults/quanticLoadMoreResults.css +5 -0
- package/force-app/main/default/lwc/quanticLoadMoreResults/quanticLoadMoreResults.html +30 -0
- package/force-app/main/default/lwc/quanticLoadMoreResults/quanticLoadMoreResults.js +162 -0
- package/force-app/main/default/lwc/quanticLoadMoreResults/quanticLoadMoreResults.js-meta.xml +5 -0
- package/force-app/main/default/lwc/quanticPlaceholder/quanticPlaceholder.css +3 -3
- package/force-app/main/default/lwc/quanticPlaceholder/quanticPlaceholder.html +1 -1
- package/force-app/main/default/lwc/quanticResultLink/quanticResultLink.js +2 -2
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +16 -16
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/analytics/analytics-relay-client.d.ts +2 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/factories/build-factory.d.ts +14 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/build.d.ts +9 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/engine.d.ts +16 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/fetch-static-state.d.ts +31 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/hydrate-static-state.d.ts +30 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/access-token-manager.d.ts +7 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/build.d.ts +19 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/engine.d.ts +0 -13
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/types/build.d.ts +19 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/types/engine.d.ts +0 -13
- package/force-app/main/default/staticresources/coveoheadless/headless.js +18 -18
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +17 -17
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +15 -15
- package/force-app/main/default/staticresources/dompurify/purify.min.js +2 -2
- package/package.json +4 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/common/access-token-manager.d.ts +0 -19
|
@@ -14,32 +14,32 @@ function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessRecommendation",["crypto"],function(_d_0){var d={"crypto":_d_0},r=function(m){if(m in d)return d[m];if(typeof require=="function")return require(m);throw new Error("Cannot find module '"+m+"'")};return f(r)})}else{var gN={"crypto":"crypto"},gReq=function(r){var mod=r in gN?g[gN[r]]:g[r];return mod};g["CoveoHeadlessRecommendation"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var
|
|
18
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return a=c.done,c},e:function(c){s=!0,i=c},f:function(){try{a||r.return==null||r.return()}finally{if(s)throw i}}}}function hl(){return hl=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=mA(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},hl.apply(null,arguments)}function $n(e){return $n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$n(e)}function pA(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&yl(e,t)}function Lf(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Lf=function(){return!!e})()}function fA(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return lA(e)}function yl(e,t){return yl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},yl(e,t)}function mA(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=$n(e))!==null;);return e}function gA(e,t,r,n){var o=hl($n(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function hA(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yA(e){var t=hA(e,"string");return typeof t=="symbol"?t:t+""}function vA(e,t){if(e){if(typeof e=="string")return Df(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Df(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function SA(e){var t;try{t=new Event("abort")}catch{typeof document<"u"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}return t.reason=e,t}function bA(e){if(e===void 0)if(typeof document>"u")e=new Error("This operation was aborted"),e.name="AbortError";else try{e=new DOMException("signal is aborted without reason"),Object.defineProperty(e,"name",{value:"AbortError"})}catch{e=new Error("This operation was aborted"),e.name="AbortError"}return e}var jf=function(){function e(){vl(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Sl(e,[{key:"addEventListener",value:function(r,n,o){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:o})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var o=this.listeners[r],i=0,a=o.length;i<a;i++)if(o[i].callback===n){o.splice(i,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var o=this.listeners[r.type],i=o.slice(),a=function(){var h=i[s];try{h.callback.call(n,r)}catch(v){Promise.resolve().then(function(){throw v})}h.options&&h.options.once&&n.removeEventListener(r.type,h.callback)},s=0,c=i.length;s<c;s++)a();return!r.defaultPrevented}}}])}(),bl=function(e){function t(){var r;return vl(this,t),r=dA(this,t),r.listeners||jf.call(r),Object.defineProperty(r,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(r,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(r,"reason",{value:void 0,writable:!0,configurable:!0}),r}return pA(t,e),Sl(t,[{key:"toString",value:function(){return"[object AbortSignal]"}},{key:"dispatchEvent",value:function(n){n.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,n)),gA(t,"dispatchEvent",this,3)([n])}},{key:"throwIfAborted",value:function(){var n=this.aborted,o=this.reason,i=o===void 0?"Aborted":o;if(n)throw i}}],[{key:"timeout",value:function(n){var o=new Ra;return setTimeout(function(){return o.abort(new DOMException("This signal is timeout in ".concat(n,"ms"),"TimeoutError"))},n),o.signal}},{key:"any",value:function(n){var o=new Ra;function i(){o.abort(this.reason),a()}function a(){var h=qf(n),v;try{for(h.s();!(v=h.n()).done;){var C=v.value;C.removeEventListener("abort",i)}}catch(g){h.e(g)}finally{h.f()}}var s=qf(n),c;try{for(s.s();!(c=s.n()).done;){var u=c.value;if(u.aborted){o.abort(u.reason);break}else u.addEventListener("abort",i)}}catch(h){s.e(h)}finally{s.f()}return o.signal}}])}(jf),Ra=function(){function e(){vl(this,e),Object.defineProperty(this,"signal",{value:new bl,writable:!0,configurable:!0})}return Sl(e,[{key:"abort",value:function(r){var n=bA(r),o=SA(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Ra.prototype[Symbol.toStringTag]="AbortController",bl.prototype[Symbol.toStringTag]="AbortSignal");function wA(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function AA(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,o=n===void 0?r.Request:n,i=t.AbortController,a=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,s=a===void 0?!1:a;if(!wA({fetch:r,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s}))return{fetch:r,Request:c};var c=o;(c&&!c.prototype.hasOwnProperty("signal")||s)&&(c=function(C,g){var y;g&&g.signal&&(y=g.signal,delete g.signal);var S=new o(C,g);return y&&Object.defineProperty(S,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),S},c.prototype=o.prototype);var u=r,h=function(C,g){var y=c&&c.prototype.isPrototypeOf(C)?C.signal:g?g.signal:void 0;if(y){var S;try{S=new DOMException("Aborted","AbortError")}catch{S=new Error("Aborted"),S.name="AbortError"}if(y.aborted)return Promise.reject(S);var E=new Promise(function(R,k){y.addEventListener("abort",function(){return k(S)},{once:!0})});return g&&g.signal&&delete g.signal,Promise.race([E,u(C,g)])}return u(C,g)};return{fetch:h,Request:c}}oi.AbortController=Ra;oi.AbortSignal=bl;oi.abortableFetch=AA});var Uf,l,A,f=Gn(()=>{"use strict";Uf=qt(wl(),1),l=qt(wl(),1),{fetch:A}=(0,Uf.abortableFetch)({fetch})});function Al(e){return typeof e!="string"||e in{}}function xl(){return Object.create(null)}function Vf(e){return typeof e=="string"&&!!e.trim()}function Cl(e,t){var r=e.split(";").filter(Vf),n=r.shift();if(!n)return null;var o=xA(n),i=o.name,a=o.value;if(t=t?Object.assign({},Ia,t):Ia,Al(i))return null;try{a=t.decodeValues?decodeURIComponent(a):a}catch(c){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",c)}var s=xl();return s.name=i,s.value=a,r.forEach(function(c){var u=c.split("="),h=u.shift().trim().toLowerCase();if(!Al(h)){var v=u.join("=").trim();if(h==="expires")s.expires=new Date(v);else if(h==="max-age"){var C=parseInt(v,10);Number.isNaN(C)||(s.maxAge=C)}else h==="secure"?s.secure=!0:h==="httponly"?s.httpOnly=!0:h==="samesite"?s.sameSite=v:h==="partitioned"?s.partitioned=!0:h&&(s[h]=v)}}),s}function xA(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function Qn(e,t){if(t=t?Object.assign({},Ia,t):Ia,!e)return t.map?xl():[];if(e.headers)if(typeof e.headers.getSetCookie=="function")e=e.headers.getSetCookie();else if(e.headers["set-cookie"])e=e.headers["set-cookie"];else{var r=e.headers[Object.keys(e.headers).find(function(a){return a.toLowerCase()==="set-cookie"})];!r&&e.headers.cookie&&!t.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),e=r}var n=t.split,o=Array.isArray(e);if(n==="auto"&&(n=!o),o||(e=[e]),e=e.filter(Vf),n&&(e=e.map(Ta).flat()),t.map){var i=xl();return e.reduce(function(a,s){var c=Cl(s,t);return c&&!Al(c.name)&&(a[c.name]=c),a},i)}else return e.map(function(a){return Cl(a,t)}).filter(Boolean)}function Ta(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,i,a,s;function c(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function u(){return o=e.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<e.length;){for(n=r,s=!1;c();)if(o=e.charAt(r),o===","){for(i=r,r+=1,c(),a=r;r<e.length&&u();)r+=1;r<e.length&&e.charAt(r)==="="?(s=!0,r=a,t.push(e.substring(n,i)),n=r):r=i+1}else r+=1;(!s||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var Ia,Bf=Gn(()=>{"use strict";m();d();f();p();Ia={decodeValues:!0,map:!1,silent:!1,split:"auto"};Qn.parseSetCookie=Qn;Qn.parse=Qn;Qn.parseString=Cl;Qn.splitCookiesString=Ta});function ii(e){if(CA.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function El(e){return e.replace(EA,"")}function ai(e){if(typeof e!="string"||e.length===0)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>127||!RA(r))return!1}return!0}function RA(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function $f(e){if(typeof e!="string"||e.trim()!==e)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r===0||r===10||r===13)return!1}return!0}var CA,Gf,EA,Qf,Hn,Rl,Hf,x,Wf=Gn(()=>{"use strict";m();d();f();p();Bf();CA=/[^a-z0-9\-#$%&'*+.^_`|~]/i;Gf=[`
|
|
19
|
-
`,"\r","\t"," "],EA=new RegExp(`(^[${Gf.join("")}]|$[${Gf.join("")}])`,"g");Hn=Symbol("normalizedHeaders"),Rl=Symbol("rawHeaderNames"),Hf=", ",x=class zf{constructor(t){this[Hn]={},this[Rl]=new Map,this[Qf]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof zf||typeof w.Headers<"u"&&t instanceof w.Headers?t.forEach((r,n)=>{this.append(n,r)},this):Array.isArray(t)?t.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(Hf):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(Hf):n)})}[(Qf=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}*keys(){for(let[t]of this.entries())yield t}*values(){for(let[,t]of this.entries())yield t}*entries(){let t=Object.keys(this[Hn]).sort((r,n)=>r.localeCompare(n));for(let r of t)if(r==="set-cookie")for(let n of this.getSetCookie())yield[r,n];else yield[r,this.get(r)]}has(t){if(!ai(t))throw new TypeError(`Invalid header name "${t}"`);return this[Hn].hasOwnProperty(ii(t))}get(t){if(!ai(t))throw TypeError(`Invalid header name "${t}"`);return this[Hn][ii(t)]??null}set(t,r){if(!ai(t)||!$f(r))return;let n=ii(t),o=El(r);this[Hn][n]=El(o),this[Rl].set(n,t)}append(t,r){if(!ai(t)||!$f(r))return;let n=ii(t),o=El(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!ai(t)||!this.has(t))return;let r=ii(t);delete this[Hn][r],this[Rl].delete(r)}forEach(t,r){for(let[n,o]of this.entries())t.call(r,o,n,this)}getSetCookie(){let t=this.get("set-cookie");return t===null?[]:t===""?[""]:Ta(t)}}});var m=Gn(()=>{"use strict";Wf()});var tm=Ze(ui=>{"use strict";m();d();f();p();var Pa=ui&&ui.__assign||function(){return Pa=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Pa.apply(this,arguments)};Object.defineProperty(ui,"__esModule",{value:!0});var DA={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function MA(e){var t=Pa(Pa({},DA),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}ui.getSanitizedOptions=MA});var rm=Ze(Ol=>{"use strict";m();d();f();p();Object.defineProperty(Ol,"__esModule",{value:!0});function qA(e){var t=Math.random()*e;return Math.round(t)}Ol.fullJitter=qA});var nm=Ze(Pl=>{"use strict";m();d();f();p();Object.defineProperty(Pl,"__esModule",{value:!0});function jA(e){return e}Pl.noJitter=jA});var om=Ze(Nl=>{"use strict";m();d();f();p();Object.defineProperty(Nl,"__esModule",{value:!0});var LA=rm(),UA=nm();function VA(e){return e.jitter==="full"?LA.fullJitter:UA.noJitter}Nl.JitterFactory=VA});var Dl=Ze(Fl=>{"use strict";m();d();f();p();Object.defineProperty(Fl,"__esModule",{value:!0});var BA=om(),GA=function(){function e(t){this.options=t,this.attempt=0}return e.prototype.apply=function(){var t=this;return new Promise(function(r){return setTimeout(r,t.jitteredDelay)})},e.prototype.setAttemptNumber=function(t){this.attempt=t},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){var t=BA.JitterFactory(this.options);return t(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var t=this.options.startingDelay,r=this.options.timeMultiple,n=this.numOfDelayedAttempts,o=t*Math.pow(r,n);return Math.min(o,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();Fl.Delay=GA});var im=Ze(or=>{"use strict";m();d();f();p();var $A=or&&or.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),QA=or&&or.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(h){try{u(n.next(h))}catch(v){a(v)}}function c(h){try{u(n.throw(h))}catch(v){a(v)}}function u(h){h.done?i(h.value):o(h.value).then(s,c)}u((n=n.apply(e,t||[])).next())})},HA=or&&or.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],o=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(or,"__esModule",{value:!0});var zA=Dl(),WA=function(e){$A(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return QA(this,void 0,void 0,function(){return HA(this,function(r){return[2,this.isFirstAttempt?!0:e.prototype.apply.call(this)]})})},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return this.attempt===0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(zA.Delay);or.SkipFirstDelay=WA});var am=Ze(li=>{"use strict";m();d();f();p();var KA=li&&li.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(li,"__esModule",{value:!0});var YA=Dl(),XA=function(e){KA(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(YA.Delay);li.AlwaysDelay=XA});var sm=Ze(Ml=>{"use strict";m();d();f();p();Object.defineProperty(Ml,"__esModule",{value:!0});var ZA=im(),JA=am();function ex(e,t){var r=tx(e);return r.setAttemptNumber(t),r}Ml.DelayFactory=ex;function tx(e){return e.delayFirstAttempt?new JA.AlwaysDelay(e):new ZA.SkipFirstDelay(e)}});var cm=Ze(Zr=>{"use strict";m();d();f();p();var ql=Zr&&Zr.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(h){try{u(n.next(h))}catch(v){a(v)}}function c(h){try{u(n.throw(h))}catch(v){a(v)}}function u(h){h.done?i(h.value):o(h.value).then(s,c)}u((n=n.apply(e,t||[])).next())})},jl=Zr&&Zr.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],o=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(Zr,"__esModule",{value:!0});var rx=tm(),nx=sm();function ox(e,t){return t===void 0&&(t={}),ql(this,void 0,void 0,function(){var r,n;return jl(this,function(o){switch(o.label){case 0:return r=rx.getSanitizedOptions(t),n=new ix(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}Zr.backOff=ox;var ix=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return ql(this,void 0,void 0,function(){var t,r;return jl(this,function(n){switch(n.label){case 0:if(this.attemptLimitReached)return[3,7];n.label=1;case 1:return n.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return n.sent(),[4,this.request()];case 3:return[2,n.sent()];case 4:return t=n.sent(),this.attemptNumber++,[4,this.options.retry(t,this.attemptNumber)];case 5:if(r=n.sent(),!r||this.attemptLimitReached)throw t;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}})})},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return ql(this,void 0,void 0,function(){var t;return jl(this,function(r){switch(r.label){case 0:return t=nx.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var tc=Ze((tp,rp)=>{"use strict";m();d();f();p();(function(e,t){typeof tp=="object"&&typeof rp<"u"?rp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof w<"u"?w:e||self).dayjs=t()})(tp,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",c="week",u="month",h="quarter",v="year",C="date",g="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,S=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,E={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(P){var N=["th","st","nd","rd"],F=P%100;return"["+P+(N[(F-20)%10]||N[F]||N[0])+"]"}},R=function(P,N,F){var H=String(P);return!H||H.length>=N?P:""+Array(N+1-H.length).join(F)+P},k={s:R,z:function(P){var N=-P.utcOffset(),F=Math.abs(N),H=Math.floor(F/60),Q=F%60;return(N<=0?"+":"-")+R(H,2,"0")+":"+R(Q,2,"0")},m:function P(N,F){if(N.date()<F.date())return-P(F,N);var H=12*(F.year()-N.year())+(F.month()-N.month()),Q=N.clone().add(H,u),Z=F-Q<0,X=N.clone().add(H+(Z?-1:1),u);return+(-(H+(F-Q)/(Z?Q-X:X-Q))||0)},a:function(P){return P<0?Math.ceil(P)||0:Math.floor(P)},p:function(P){return{M:u,y:v,w:c,d:s,D:C,h:a,m:i,s:o,ms:n,Q:h}[P]||String(P||"").toLowerCase().replace(/s$/,"")},u:function(P){return P===void 0}},I="en",T={};T[I]=E;var _="$isDayjsObject",D=function(P){return P instanceof L||!(!P||!P[_])},G=function P(N,F,H){var Q;if(!N)return I;if(typeof N=="string"){var Z=N.toLowerCase();T[Z]&&(Q=Z),F&&(T[Z]=F,Q=Z);var X=N.split("-");if(!Q&&X.length>1)return P(X[0])}else{var W=N.name;T[W]=N,Q=W}return!H&&Q&&(I=Q),Q||!H&&I},V=function(P,N){if(D(P))return P.clone();var F=typeof N=="object"?N:{};return F.date=P,F.args=arguments,new L(F)},j=k;j.l=G,j.i=D,j.w=function(P,N){return V(P,{locale:N.$L,utc:N.$u,x:N.$x,$offset:N.$offset})};var L=function(){function P(F){this.$L=G(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[_]=!0}var N=P.prototype;return N.parse=function(F){this.$d=function(H){var Q=H.date,Z=H.utc;if(Q===null)return new Date(NaN);if(j.u(Q))return new Date;if(Q instanceof Date)return new Date(Q);if(typeof Q=="string"&&!/Z$/i.test(Q)){var X=Q.match(y);if(X){var W=X[2]-1||0,te=(X[7]||"0").substring(0,3);return Z?new Date(Date.UTC(X[1],W,X[3]||1,X[4]||0,X[5]||0,X[6]||0,te)):new Date(X[1],W,X[3]||1,X[4]||0,X[5]||0,X[6]||0,te)}}return new Date(Q)}(F),this.init()},N.init=function(){var F=this.$d;this.$y=F.getFullYear(),this.$M=F.getMonth(),this.$D=F.getDate(),this.$W=F.getDay(),this.$H=F.getHours(),this.$m=F.getMinutes(),this.$s=F.getSeconds(),this.$ms=F.getMilliseconds()},N.$utils=function(){return j},N.isValid=function(){return this.$d.toString()!==g},N.isSame=function(F,H){var Q=V(F);return this.startOf(H)<=Q&&Q<=this.endOf(H)},N.isAfter=function(F,H){return V(F)<this.startOf(H)},N.isBefore=function(F,H){return this.endOf(H)<V(F)},N.$g=function(F,H,Q){return j.u(F)?this[H]:this.set(Q,F)},N.unix=function(){return Math.floor(this.valueOf()/1e3)},N.valueOf=function(){return this.$d.getTime()},N.startOf=function(F,H){var Q=this,Z=!!j.u(H)||H,X=j.p(F),W=function(ge,me){var be=j.w(Q.$u?Date.UTC(Q.$y,me,ge):new Date(Q.$y,me,ge),Q);return Z?be:be.endOf(s)},te=function(ge,me){return j.w(Q.toDate()[ge].apply(Q.toDate("s"),(Z?[0,0,0,0]:[23,59,59,999]).slice(me)),Q)},ue=this.$W,Ee=this.$M,je=this.$D,ke="set"+(this.$u?"UTC":"");switch(X){case v:return Z?W(1,0):W(31,11);case u:return Z?W(1,Ee):W(0,Ee+1);case c:var Ne=this.$locale().weekStart||0,Fe=(ue<Ne?ue+7:ue)-Ne;return W(Z?je-Fe:je+(6-Fe),Ee);case s:case C:return te(ke+"Hours",0);case a:return te(ke+"Minutes",1);case i:return te(ke+"Seconds",2);case o:return te(ke+"Milliseconds",3);default:return this.clone()}},N.endOf=function(F){return this.startOf(F,!1)},N.$set=function(F,H){var Q,Z=j.p(F),X="set"+(this.$u?"UTC":""),W=(Q={},Q[s]=X+"Date",Q[C]=X+"Date",Q[u]=X+"Month",Q[v]=X+"FullYear",Q[a]=X+"Hours",Q[i]=X+"Minutes",Q[o]=X+"Seconds",Q[n]=X+"Milliseconds",Q)[Z],te=Z===s?this.$D+(H-this.$W):H;if(Z===u||Z===v){var ue=this.clone().set(C,1);ue.$d[W](te),ue.init(),this.$d=ue.set(C,Math.min(this.$D,ue.daysInMonth())).$d}else W&&this.$d[W](te);return this.init(),this},N.set=function(F,H){return this.clone().$set(F,H)},N.get=function(F){return this[j.p(F)]()},N.add=function(F,H){var Q,Z=this;F=Number(F);var X=j.p(H),W=function(Ee){var je=V(Z);return j.w(je.date(je.date()+Math.round(Ee*F)),Z)};if(X===u)return this.set(u,this.$M+F);if(X===v)return this.set(v,this.$y+F);if(X===s)return W(1);if(X===c)return W(7);var te=(Q={},Q[i]=t,Q[a]=r,Q[o]=e,Q)[X]||1,ue=this.$d.getTime()+F*te;return j.w(ue,this)},N.subtract=function(F,H){return this.add(-1*F,H)},N.format=function(F){var H=this,Q=this.$locale();if(!this.isValid())return Q.invalidDate||g;var Z=F||"YYYY-MM-DDTHH:mm:ssZ",X=j.z(this),W=this.$H,te=this.$m,ue=this.$M,Ee=Q.weekdays,je=Q.months,ke=Q.meridiem,Ne=function(me,be,he,He){return me&&(me[be]||me(H,Z))||he[be].slice(0,He)},Fe=function(me){return j.s(W%12||12,me,"0")},ge=ke||function(me,be,he){var He=me<12?"AM":"PM";return he?He.toLowerCase():He};return Z.replace(S,function(me,be){return be||function(he){switch(he){case"YY":return String(H.$y).slice(-2);case"YYYY":return j.s(H.$y,4,"0");case"M":return ue+1;case"MM":return j.s(ue+1,2,"0");case"MMM":return Ne(Q.monthsShort,ue,je,3);case"MMMM":return Ne(je,ue);case"D":return H.$D;case"DD":return j.s(H.$D,2,"0");case"d":return String(H.$W);case"dd":return Ne(Q.weekdaysMin,H.$W,Ee,2);case"ddd":return Ne(Q.weekdaysShort,H.$W,Ee,3);case"dddd":return Ee[H.$W];case"H":return String(W);case"HH":return j.s(W,2,"0");case"h":return Fe(1);case"hh":return Fe(2);case"a":return ge(W,te,!0);case"A":return ge(W,te,!1);case"m":return String(te);case"mm":return j.s(te,2,"0");case"s":return String(H.$s);case"ss":return j.s(H.$s,2,"0");case"SSS":return j.s(H.$ms,3,"0");case"Z":return X}return null}(me)||X.replace(":","")})},N.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},N.diff=function(F,H,Q){var Z,X=this,W=j.p(H),te=V(F),ue=(te.utcOffset()-this.utcOffset())*t,Ee=this-te,je=function(){return j.m(X,te)};switch(W){case v:Z=je()/12;break;case u:Z=je();break;case h:Z=je()/3;break;case c:Z=(Ee-ue)/6048e5;break;case s:Z=(Ee-ue)/864e5;break;case a:Z=Ee/r;break;case i:Z=Ee/t;break;case o:Z=Ee/e;break;default:Z=Ee}return Q?Z:j.a(Z)},N.daysInMonth=function(){return this.endOf(u).$D},N.$locale=function(){return T[this.$L]},N.locale=function(F,H){if(!F)return this.$L;var Q=this.clone(),Z=G(F,H,!0);return Z&&(Q.$L=Z),Q},N.clone=function(){return j.w(this.$d,this)},N.toDate=function(){return new Date(this.valueOf())},N.toJSON=function(){return this.isValid()?this.toISOString():null},N.toISOString=function(){return this.$d.toISOString()},N.toString=function(){return this.$d.toUTCString()},P}(),q=L.prototype;return V.prototype=q,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",u],["$y",v],["$D",C]].forEach(function(P){q[P[1]]=function(N){return this.$g(N,P[0],P[1])}}),V.extend=function(P,N){return P.$i||(P(N,L,V),P.$i=!0),V},V.locale=G,V.isDayjs=D,V.unix=function(P){return V(1e3*P)},V.en=T[I],V.Ls=T,V.p={},V})});var fy=Ze((np,op)=>{"use strict";m();d();f();p();(function(e,t){typeof np=="object"&&typeof op<"u"?op.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof w<"u"?w:e||self).dayjs_plugin_quarterOfYear=t()})(np,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(s){return this.$utils().u(s)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(s-1))};var i=o.add;o.add=function(s,c){return s=Number(s),this.$utils().p(c)===t?this.add(3*s,e):i.bind(this)(s,c)};var a=o.startOf;o.startOf=function(s,c){var u=this.$utils(),h=!!u.u(c)||c;if(u.p(s)===t){var v=this.quarter()-1;return h?this.month(3*v).startOf(e).startOf("day"):this.month(3*v+2).endOf(e).endOf("day")}return a.bind(this)(s,c)}}})});var my=Ze((ip,ap)=>{"use strict";m();d();f();p();(function(e,t){typeof ip=="object"&&typeof ap<"u"?ap.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof w<"u"?w:e||self).dayjs_plugin_customParseFormat=t()})(ip,function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,o=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,a={},s=function(y){return(y=+y)+(y>68?1900:2e3)},c=function(y){return function(S){this[y]=+S}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(S){if(!S||S==="Z")return 0;var E=S.match(/([+-]|\d\d)/g),R=60*E[1]+(+E[2]||0);return R===0?0:E[0]==="+"?-R:R}(y)}],h=function(y){var S=a[y];return S&&(S.indexOf?S:S.s.concat(S.f))},v=function(y,S){var E,R=a.meridiem;if(R){for(var k=1;k<=24;k+=1)if(y.indexOf(R(k,0,S))>-1){E=k>12;break}}else E=y===(S?"pm":"PM");return E},C={A:[i,function(y){this.afternoon=v(y,!1)}],a:[i,function(y){this.afternoon=v(y,!0)}],Q:[r,function(y){this.month=3*(y-1)+1}],S:[r,function(y){this.milliseconds=100*+y}],SS:[n,function(y){this.milliseconds=10*+y}],SSS:[/\d{3}/,function(y){this.milliseconds=+y}],s:[o,c("seconds")],ss:[o,c("seconds")],m:[o,c("minutes")],mm:[o,c("minutes")],H:[o,c("hours")],h:[o,c("hours")],HH:[o,c("hours")],hh:[o,c("hours")],D:[o,c("day")],DD:[n,c("day")],Do:[i,function(y){var S=a.ordinal,E=y.match(/\d+/);if(this.day=E[0],S)for(var R=1;R<=31;R+=1)S(R).replace(/\[|\]/g,"")===y&&(this.day=R)}],w:[o,c("week")],ww:[n,c("week")],M:[o,c("month")],MM:[n,c("month")],MMM:[i,function(y){var S=h("months"),E=(h("monthsShort")||S.map(function(R){return R.slice(0,3)})).indexOf(y)+1;if(E<1)throw new Error;this.month=E%12||E}],MMMM:[i,function(y){var S=h("months").indexOf(y)+1;if(S<1)throw new Error;this.month=S%12||S}],Y:[/[+-]?\d+/,c("year")],YY:[n,function(y){this.year=s(y)}],YYYY:[/\d{4}/,c("year")],Z:u,ZZ:u};function g(y){var S,E;S=y,E=a&&a.formats;for(var R=(y=S.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(V,j,L){var q=L&&L.toUpperCase();return j||E[L]||e[L]||E[q].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(P,N,F){return N||F.slice(1)})})).match(t),k=R.length,I=0;I<k;I+=1){var T=R[I],_=C[T],D=_&&_[0],G=_&&_[1];R[I]=G?{regex:D,parser:G}:T.replace(/^\[|\]$/g,"")}return function(V){for(var j={},L=0,q=0;L<k;L+=1){var P=R[L];if(typeof P=="string")q+=P.length;else{var N=P.regex,F=P.parser,H=V.slice(q),Q=N.exec(H)[0];F.call(j,Q),V=V.replace(Q,"")}}return function(Z){var X=Z.afternoon;if(X!==void 0){var W=Z.hours;X?W<12&&(Z.hours+=12):W===12&&(Z.hours=0),delete Z.afternoon}}(j),j}}return function(y,S,E){E.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(s=y.parseTwoDigitYear);var R=S.prototype,k=R.parse;R.parse=function(I){var T=I.date,_=I.utc,D=I.args;this.$u=_;var G=D[1];if(typeof G=="string"){var V=D[2]===!0,j=D[3]===!0,L=V||j,q=D[2];j&&(q=D[2]),a=this.$locale(),!V&&q&&(a=E.Ls[q]),this.$d=function(H,Q,Z,X){try{if(["x","X"].indexOf(Q)>-1)return new Date((Q==="X"?1e3:1)*H);var W=g(Q)(H),te=W.year,ue=W.month,Ee=W.day,je=W.hours,ke=W.minutes,Ne=W.seconds,Fe=W.milliseconds,ge=W.zone,me=W.week,be=new Date,he=Ee||(te||ue?1:be.getDate()),He=te||be.getFullYear(),Ke=0;te&&!ue||(Ke=ue>0?ue-1:be.getMonth());var Dt,At=je||0,Gt=ke||0,Rt=Ne||0,Mt=Fe||0;return ge?new Date(Date.UTC(He,Ke,he,At,Gt,Rt,Mt+60*ge.offset*1e3)):Z?new Date(Date.UTC(He,Ke,he,At,Gt,Rt,Mt)):(Dt=new Date(He,Ke,he,At,Gt,Rt,Mt),me&&(Dt=X(Dt).week(me).toDate()),Dt)}catch{return new Date("")}}(T,G,_,E),this.init(),q&&q!==!0&&(this.$L=this.locale(q).$L),L&&T!=this.format(G)&&(this.$d=new Date("")),a={}}else if(G instanceof Array)for(var P=G.length,N=1;N<=P;N+=1){D[1]=G[N-1];var F=E.apply(this,D);if(F.isValid()){this.$d=F.$d,this.$L=F.$L,this.init();break}N===P&&(this.$d=new Date(""))}else k.call(this,I)}}})});var lv=Ze((wp,Ap)=>{"use strict";m();d();f();p();(function(e,t){typeof wp=="object"&&typeof Ap<"u"?Ap.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof w<"u"?w:e||self).dayjs_plugin_timezone=t()})(wp,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,o){var i,a=function(h,v,C){C===void 0&&(C={});var g=new Date(h),y=function(S,E){E===void 0&&(E={});var R=E.timeZoneName||"short",k=S+"|"+R,I=t[k];return I||(I=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:S,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:R}),t[k]=I),I}(v,C);return y.formatToParts(g)},s=function(h,v){for(var C=a(h,v),g=[],y=0;y<C.length;y+=1){var S=C[y],E=S.type,R=S.value,k=e[E];k>=0&&(g[k]=parseInt(R,10))}var I=g[3],T=I===24?0:I,_=g[0]+"-"+g[1]+"-"+g[2]+" "+T+":"+g[4]+":"+g[5]+":000",D=+h;return(o.utc(_).valueOf()-(D-=D%1e3))/6e4},c=n.prototype;c.tz=function(h,v){if(h===void 0&&(h=i),!this.isValid())return this;var C,g=this.utcOffset(),y=this.toDate(),S=y.toLocaleString("en-US",{timeZone:h}),E=s(+y,h);if(!Number(E))C=this.utcOffset(0,v);else if(C=o(S,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(E,!0),v){var R=C.utcOffset();C=C.add(g-R,"minute")}return C.$x.$timezone=h,C},c.offsetName=function(h){var v=this.$x.$timezone||o.tz.guess(),C=a(this.valueOf(),v,{timeZoneName:h}).find(function(g){return g.type.toLowerCase()==="timezonename"});return C&&C.value};var u=c.startOf;c.startOf=function(h,v){if(!this.$x||!this.$x.$timezone)return u.call(this,h,v);var C=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return u.call(C,h,v).tz(this.$x.$timezone,!0)},o.tz=function(h,v,C){var g=C&&v,y=C||v||i,S=s(+o(),y);if(typeof h!="string")return o(h).tz(y);var E=o.utc(h,g).valueOf();if(Number.isNaN(E)){var R=o(NaN);return R.$x.$timezone=y,R}var k=function(D,G,V){var j=D-60*G*1e3,L=s(j,V);if(G===L)return[j,G];var q=s(j-=60*(L-G)*1e3,V);return L===q?[j,L]:[D-60*Math.min(L,q)*1e3,Math.max(L,q)]}(E,S,y),I=k[0],T=k[1],_=o(I).utcOffset(T);return _.$x.$timezone=y,_},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(h){i=h}}})});var dv=Ze((xp,Cp)=>{"use strict";m();d();f();p();(function(e,t){typeof xp=="object"&&typeof Cp<"u"?Cp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof w<"u"?w:e||self).dayjs_plugin_utc=t()})(xp,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,i){var a=o.prototype;i.utc=function(g){var y={date:g,utc:!0,args:arguments};return new o(y)},a.utc=function(g){var y=i(this.toDate(),{locale:this.$L,utc:!0});return g?y.add(this.utcOffset(),e):y},a.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var s=a.parse;a.parse=function(g){g.utc&&(this.$u=!0),this.$utils().u(g.$offset)||(this.$offset=g.$offset),s.call(this,g)};var c=a.init;a.init=function(){if(this.$u){var g=this.$d;this.$y=g.getUTCFullYear(),this.$M=g.getUTCMonth(),this.$D=g.getUTCDate(),this.$W=g.getUTCDay(),this.$H=g.getUTCHours(),this.$m=g.getUTCMinutes(),this.$s=g.getUTCSeconds(),this.$ms=g.getUTCMilliseconds()}else c.call(this)};var u=a.utcOffset;a.utcOffset=function(g,y){var S=this.$utils().u;if(S(g))return this.$u?0:S(this.$offset)?u.call(this):this.$offset;if(typeof g=="string"&&(g=function(I){I===void 0&&(I="");var T=I.match(t);if(!T)return null;var _=(""+T[0]).match(r)||["-",0,0],D=_[0],G=60*+_[1]+ +_[2];return G===0?0:D==="+"?G:-G}(g),g===null))return this;var E=Math.abs(g)<=16?60*g:g;if(E===0)return this.utc(y);var R=this.clone();if(y)return R.$offset=E,R.$u=!1,R;var k=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(R=this.local().add(E+k,e)).$offset=E,R.$x.$localOffset=k,R};var h=a.format;a.format=function(g){var y=g||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,y)},a.valueOf=function(){var g=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*g},a.isUTC=function(){return!!this.$u},a.toISOString=function(){return this.toDate().toISOString()},a.toString=function(){return this.toDate().toUTCString()};var v=a.toDate;a.toDate=function(g){return g==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var C=a.diff;a.diff=function(g,y,S){if(g&&this.$u===g.$u)return C.call(this,g,y,S);var E=this.local(),R=i(g).local();return C.call(E,R,y,S)}}})});var Zb=Ze((Nue,Xb)=>{"use strict";m();d();f();p();function pP(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}Xb.exports=fP;function fP(e,t,r){var n=r&&r.stringify||pP,o=1;if(typeof e=="object"&&e!==null){var i=t.length+o;if(i===1)return e;var a=new Array(i);a[0]=n(e);for(var s=1;s<i;s++)a[s]=n(t[s]);return a.join(" ")}if(typeof e!="string")return e;var c=t.length;if(c===0)return e;for(var u="",h=1-o,v=-1,C=e&&e.length||0,g=0;g<C;){if(e.charCodeAt(g)===37&&g+1<C){switch(v=v>-1?v:0,e.charCodeAt(g+1)){case 100:case 102:if(h>=c||t[h]==null)break;v<g&&(u+=e.slice(v,g)),u+=Number(t[h]),v=g+2,g++;break;case 105:if(h>=c||t[h]==null)break;v<g&&(u+=e.slice(v,g)),u+=Math.floor(Number(t[h])),v=g+2,g++;break;case 79:case 111:case 106:if(h>=c||t[h]===void 0)break;v<g&&(u+=e.slice(v,g));var y=typeof t[h];if(y==="string"){u+="'"+t[h]+"'",v=g+2,g++;break}if(y==="function"){u+=t[h].name||"<anonymous>",v=g+2,g++;break}u+=n(t[h]),v=g+2,g++;break;case 115:if(h>=c)break;v<g&&(u+=e.slice(v,g)),u+=String(t[h]),v=g+2,g++;break;case 37:v<g&&(u+=e.slice(v,g)),u+="%",v=g+2,g++,h--;break}++h}++g}return v===-1?e:(v<C&&(u+=e.slice(v)),u)}});var iw=Ze((jue,nl)=>{"use strict";m();d();f();p();var Jb=Zb();nl.exports=br;var Sa=TP().console||{},mP={mapHttpRequest:rl,mapHttpResponse:rl,wrapRequestSerializer:Af,wrapResponseSerializer:Af,wrapErrorSerializer:Af,req:rl,res:rl,err:tw,errWithCause:tw};function Kr(e,t){return e==="silent"?1/0:t.levels.values[e]}var Ef=Symbol("pino.logFuncs"),xf=Symbol("pino.hierarchy"),gP={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function ew(e,t){let r={logger:t,parent:e[xf]};t[xf]=r}function hP(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Sa[o]||Sa[gP[o]||"log"]||Ko}),e[Ef]=n}function yP(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function br(e){e=e||{},e.browser=e.browser||{};let t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");let r=e.browser.write||Sa;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=yP(e.browser.serialize,n),i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);let a=Object.keys(e.customLevels||{}),s=["error","fatal","warn","info","debug","trace"].concat(a);typeof r=="function"&&s.forEach(function(S){r[S]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let c=e.level||"info",u=Object.create(r);u.log||(u.log=Ko),hP(u,s,r),ew({},u),Object.defineProperty(u,"levelVal",{get:v}),Object.defineProperty(u,"level",{get:C,set:g});let h={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,reportCaller:e.browser.reportCaller,levels:s,timestamp:EP(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Ko};u.levels=vP(e),u.level=c,u.isLevelEnabled=function(S){return this.levels.values[S]?this.levels.values[S]>=this.levels.values[this.level]:!1},u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Ko,u.serializers=n,u._serialize=o,u._stdErrSerialize=i,u.child=function(...S){return y.call(this,h,...S)},t&&(u._logEvent=Cf());function v(){return Kr(this.level,this)}function C(){return this._level}function g(S){if(S!=="silent"&&!this.levels.values[S])throw Error("unknown level "+S);this._level=S,Ln(this,h,u,"error"),Ln(this,h,u,"fatal"),Ln(this,h,u,"warn"),Ln(this,h,u,"info"),Ln(this,h,u,"debug"),Ln(this,h,u,"trace"),a.forEach(E=>{Ln(this,h,u,E)})}function y(S,E,R){if(!E)throw new Error("missing bindings for child Pino");R=R||{},o&&E.serializers&&(R.serializers=E.serializers);let k=R.serializers;if(o&&k){var I=Object.assign({},n,k),T=e.browser.serialize===!0?Object.keys(I):o;delete E.serializers,Rf([E],T,I,this._stdErrSerialize)}function _(G){this._childLevel=(G._childLevel|0)+1,this.bindings=E,I&&(this.serializers=I,this._serialize=T),t&&(this._logEvent=Cf([].concat(G._logEvent.bindings,E)))}_.prototype=this;let D=new _(this);return ew(this,D),D.child=function(...G){return y.call(this,S,...G)},D.level=R.level||this.level,S.onChild(D),D}return u}function vP(e){let t=e.customLevels||{},r=Object.assign({},br.levels.values,t),n=Object.assign({},br.levels.labels,SP(t));return{values:r,labels:n}}function SP(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}br.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"}};br.stdSerializers=mP;br.stdTimeFunctions=Object.assign({},{nullTime:nw,epochTime:ow,unixTime:RP,isoTime:IP});function bP(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[xf];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Ln(e,t,r,n){if(Object.defineProperty(e,n,{value:Kr(e.level,r)>Kr(n,r)?Ko:r[Ef][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===Ko){if(!t.transmit)return;let i=t.transmit.level||e.level,a=Kr(i,r);if(Kr(n,r)<a)return}e[n]=AP(e,t,r,n);let o=bP(e);o.length!==0&&(e[n]=wP(o,e[n]))}function wP(e,t){return function(){return t.apply(this,[...e,...arguments])}}function AP(e,t,r,n){return function(o){return function(){let a=t.timestamp(),s=new Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Sa?Sa:this;for(var u=0;u<s.length;u++)s[u]=arguments[u];var h=!1;if(t.serialize&&(Rf(s,this._serialize,this.serializers,this._stdErrSerialize),h=!0),t.asObject||t.formatters){let v=xP(this,n,s,a,t);if(t.reportCaller&&v&&v.length>0&&v[0]&&typeof v[0]=="object")try{let C=rw();C&&(v[0].caller=C)}catch{}o.call(c,...v)}else{if(t.reportCaller)try{let v=rw();v&&s.push(v)}catch{}o.apply(c,s)}if(t.transmit){let v=t.transmit.level||e._level,C=Kr(v,r),g=Kr(n,r);if(g<C)return;CP(this,{ts:a,methodLevel:n,methodValue:g,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Kr(e._level,r)},s,h)}}}(e[Ef][n])}function xP(e,t,r,n,o){let{level:i,log:a=v=>v}=o.formatters||{},s=r.slice(),c=s[0],u={},h=(e._childLevel|0)+1;if(h<1&&(h=1),n&&(u.time=n),i){let v=i(t,e.levels.values[t]);Object.assign(u,v)}else u.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(c!==null&&typeof c=="object")for(;h--&&typeof s[0]=="object";)Object.assign(u,s.shift());return[a(u),...s]}else{if(c!==null&&typeof c=="object"){for(;h--&&typeof s[0]=="object";)Object.assign(u,s.shift());c=s.length?Jb(s.shift(),s):void 0}else typeof c=="string"&&(c=Jb(s.shift(),s));return c!==void 0&&(u[o.messageKey]=c),[a(u)]}}function Rf(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=br.stdSerializers.err(e[o]);else if(typeof e[o]=="object"&&!Array.isArray(e[o])&&t)for(let i in e[o])t.indexOf(i)>-1&&i in r&&(e[o][i]=r[i](e[o][i]))}function CP(e,t,r,n=!1){let o=t.send,i=t.ts,a=t.methodLevel,s=t.methodValue,c=t.val,u=e._logEvent.bindings;n||Rf(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter(function(h){return u.indexOf(h)===-1}),e._logEvent.level.label=a,e._logEvent.level.value=s,o(a,e._logEvent,c),e._logEvent=Cf(u)}function Cf(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function tw(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let r in e)t[r]===void 0&&(t[r]=e[r]);return t}function EP(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?nw:ow}function rl(){return{}}function Af(e){return e}function Ko(){}function nw(){return!1}function ow(){return Date.now()}function RP(){return Math.round(Date.now()/1e3)}function IP(){return new Date(Date.now()).toISOString()}function TP(){function e(t){return typeof t<"u"&&t}try{return typeof w<"u"?w:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),w)}catch{return e(self)||e(window)||e(this)||{}}}nl.exports.default=br;nl.exports.pino=br;function rw(){let e=new Error().stack;if(!e)return null;let t=e.split(`
|
|
20
|
-
`);for(let r=1;r<t.length;r++){let n=t[r].trim();if(/(^at\s+)?(createWrap|LOG|set\s*\(|asObject|Object\.apply|Function\.apply)/.test(n)||n.indexOf("browser.js")!==-1||n.indexOf("node:internal")!==-1||n.indexOf("node_modules")!==-1)continue;let o=n.match(/\((.*?):(\d+):(\d+)\)/);if(o||(o=n.match(/at\s+(.*?):(\d+):(\d+)/)),o){let i=o[1],a=o[2],s=o[3];return i+":"+a+":"+s}}return null}});var
|
|
17
|
+
*/(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessRecommendation",["crypto"],function(_d_0){var d={"crypto":_d_0},r=function(m){if(m in d)return d[m];if(typeof require=="function")return require(m);throw new Error("Cannot find module '"+m+"'")};return f(r)})}else{var gN={"crypto":"crypto"},gReq=function(r){var mod=r in gN?g[gN[r]]:g[r];return mod};g["CoveoHeadlessRecommendation"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var vw=Object.create;var ci=Object.defineProperty;var Sw=Object.getOwnPropertyDescriptor;var bw=Object.getOwnPropertyNames;var Aw=Object.getPrototypeOf,ww=Object.prototype.hasOwnProperty;var xw=(e,t,r)=>t in e?ci(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Hn=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var Ze=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},ui=(e,t)=>{for(var r in t)ci(e,r,{get:t[r],enumerable:!0})},Hf=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of bw(t))!ww.call(e,o)&&o!==r&&ci(e,o,{get:()=>t[o],enumerable:!(n=Sw(t,o))||n.enumerable});return e};var jt=(e,t,r)=>(r=e!=null?vw(Aw(e)):{},Hf(t||!e||!e.__esModule?ci(r,"default",{value:e,enumerable:!0}):r,e)),Cw=e=>Hf(ci({},"__esModule",{value:!0}),e);var ue=(e,t,r)=>xw(e,typeof t!="symbol"?t+"":t,r);var w,d=Hn(()=>{"use strict";w=typeof globalThis<"u"?globalThis:window});function ka(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ka=function(t){return typeof t}:ka=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ka(e)}function Iw(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=Tw.bind(this))}function Tw(e,t){var r=this.event&&this.event.type,n=r==="unload"||r==="beforeunload",o="XMLHttpRequest"in this?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");o.open("POST",e,!n),o.withCredentials=!0,o.setRequestHeader("Accept","*/*"),Ew(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):Rw(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var Ew,Rw,p=Hn(()=>{"use strict";Ew=function(t){return typeof t=="string"},Rw=function(t){return t instanceof Blob};Iw.call((typeof window>"u"?"undefined":ka(window))==="object"?window:{})});var Ol=Ze(li=>{"use strict";m();d();f();p();Object.defineProperty(li,"__esModule",{value:!0});function zf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function _w(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kw(e,t,r){return t=zn(t),Pw(e,Xf()?Reflect.construct(t,r||[],zn(e).constructor):t.apply(e,r))}function Tl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wf(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Mw(n.key),n)}}function _l(e,t,r){return t&&Wf(e.prototype,t),r&&Wf(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Kf(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Lw(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
18
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return a=u.done,u},e:function(u){s=!0,i=u},f:function(){try{a||r.return==null||r.return()}finally{if(s)throw i}}}}function Rl(){return Rl=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=Nw(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Rl.apply(null,arguments)}function zn(e){return zn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zn(e)}function Ow(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Il(e,t)}function Xf(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Xf=function(){return!!e})()}function Pw(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _w(e)}function Il(e,t){return Il=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Il(e,t)}function Nw(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=zn(e))!==null;);return e}function Fw(e,t,r,n){var o=Rl(zn(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function Dw(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Mw(e){var t=Dw(e,"string");return typeof t=="symbol"?t:t+""}function Lw(e,t){if(e){if(typeof e=="string")return zf(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?zf(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function qw(e){var t;try{t=new Event("abort")}catch{typeof document<"u"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}return t.reason=e,t}function jw(e){if(e===void 0)if(typeof document>"u")e=new Error("This operation was aborted"),e.name="AbortError";else try{e=new DOMException("signal is aborted without reason"),Object.defineProperty(e,"name",{value:"AbortError"})}catch{e=new Error("This operation was aborted"),e.name="AbortError"}return e}var Yf=function(){function e(){Tl(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return _l(e,[{key:"addEventListener",value:function(r,n,o){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:o})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var o=this.listeners[r],i=0,a=o.length;i<a;i++)if(o[i].callback===n){o.splice(i,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var o=this.listeners[r.type],i=o.slice(),a=function(){var g=i[s];try{g.callback.call(n,r)}catch(v){Promise.resolve().then(function(){throw v})}g.options&&g.options.once&&n.removeEventListener(r.type,g.callback)},s=0,u=i.length;s<u;s++)a();return!r.defaultPrevented}}}])}(),kl=function(e){function t(){var r;return Tl(this,t),r=kw(this,t),r.listeners||Yf.call(r),Object.defineProperty(r,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(r,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(r,"reason",{value:void 0,writable:!0,configurable:!0}),r}return Ow(t,e),_l(t,[{key:"toString",value:function(){return"[object AbortSignal]"}},{key:"dispatchEvent",value:function(n){n.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,n)),Fw(t,"dispatchEvent",this,3)([n])}},{key:"throwIfAborted",value:function(){var n=this.aborted,o=this.reason,i=o===void 0?"Aborted":o;if(n)throw i}}],[{key:"timeout",value:function(n){var o=new Oa;return setTimeout(function(){return o.abort(new DOMException("This signal is timeout in ".concat(n,"ms"),"TimeoutError"))},n),o.signal}},{key:"any",value:function(n){var o=new Oa;function i(){o.abort(this.reason),a()}function a(){var g=Kf(n),v;try{for(g.s();!(v=g.n()).done;){var R=v.value;R.removeEventListener("abort",i)}}catch(h){g.e(h)}finally{g.f()}}var s=Kf(n),u;try{for(s.s();!(u=s.n()).done;){var c=u.value;if(c.aborted){o.abort(c.reason);break}else c.addEventListener("abort",i)}}catch(g){s.e(g)}finally{s.f()}return o.signal}}])}(Yf),Oa=function(){function e(){Tl(this,e),Object.defineProperty(this,"signal",{value:new kl,writable:!0,configurable:!0})}return _l(e,[{key:"abort",value:function(r){var n=jw(r),o=qw(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Oa.prototype[Symbol.toStringTag]="AbortController",kl.prototype[Symbol.toStringTag]="AbortSignal");function Uw(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function Vw(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,o=n===void 0?r.Request:n,i=t.AbortController,a=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,s=a===void 0?!1:a;if(!Uw({fetch:r,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s}))return{fetch:r,Request:u};var u=o;(u&&!u.prototype.hasOwnProperty("signal")||s)&&(u=function(R,h){var y;h&&h.signal&&(y=h.signal,delete h.signal);var b=new o(R,h);return y&&Object.defineProperty(b,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),b},u.prototype=o.prototype);var c=r,g=function(R,h){var y=u&&u.prototype.isPrototypeOf(R)?R.signal:h?h.signal:void 0;if(y){var b;try{b=new DOMException("Aborted","AbortError")}catch{b=new Error("Aborted"),b.name="AbortError"}if(y.aborted)return Promise.reject(b);var x=new Promise(function(I,_){y.addEventListener("abort",function(){return _(b)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([x,c(R,h)])}return c(R,h)};return{fetch:g,Request:u}}li.AbortController=Oa;li.AbortSignal=kl;li.abortableFetch=Vw});var Zf,l,C,f=Hn(()=>{"use strict";Zf=jt(Ol(),1),l=jt(Ol(),1),{fetch:C}=(0,Zf.abortableFetch)({fetch})});function Pl(e){return typeof e!="string"||e in{}}function Nl(){return Object.create(null)}function Jf(e){return typeof e=="string"&&!!e.trim()}function Fl(e,t){var r=e.split(";").filter(Jf),n=r.shift();if(!n)return null;var o=Gw(n),i=o.name,a=o.value;if(t=t?Object.assign({},Pa,t):Pa,Pl(i))return null;try{a=t.decodeValues?decodeURIComponent(a):a}catch(u){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",u)}var s=Nl();return s.name=i,s.value=a,r.forEach(function(u){var c=u.split("="),g=c.shift().trim().toLowerCase();if(!Pl(g)){var v=c.join("=").trim();if(g==="expires")s.expires=new Date(v);else if(g==="max-age"){var R=parseInt(v,10);Number.isNaN(R)||(s.maxAge=R)}else g==="secure"?s.secure=!0:g==="httponly"?s.httpOnly=!0:g==="samesite"?s.sameSite=v:g==="partitioned"?s.partitioned=!0:g&&(s[g]=v)}}),s}function Gw(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function Wn(e,t){if(t=t?Object.assign({},Pa,t):Pa,!e)return t.map?Nl():[];if(e.headers)if(typeof e.headers.getSetCookie=="function")e=e.headers.getSetCookie();else if(e.headers["set-cookie"])e=e.headers["set-cookie"];else{var r=e.headers[Object.keys(e.headers).find(function(a){return a.toLowerCase()==="set-cookie"})];!r&&e.headers.cookie&&!t.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),e=r}var n=t.split,o=Array.isArray(e);if(n==="auto"&&(n=!o),o||(e=[e]),e=e.filter(Jf),n&&(e=e.map(Na).flat()),t.map){var i=Nl();return e.reduce(function(a,s){var u=Fl(s,t);return u&&!Pl(u.name)&&(a[u.name]=u),a},i)}else return e.map(function(a){return Fl(a,t)}).filter(Boolean)}function Na(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,i,a,s;function u(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function c(){return o=e.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<e.length;){for(n=r,s=!1;u();)if(o=e.charAt(r),o===","){for(i=r,r+=1,u(),a=r;r<e.length&&c();)r+=1;r<e.length&&e.charAt(r)==="="?(s=!0,r=a,t.push(e.substring(n,i)),n=r):r=i+1}else r+=1;(!s||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var Pa,em=Hn(()=>{"use strict";m();d();f();p();Pa={decodeValues:!0,map:!1,silent:!1,split:"auto"};Wn.parseSetCookie=Wn;Wn.parse=Wn;Wn.parseString=Fl;Wn.splitCookiesString=Na});function di(e){if(Bw.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Dl(e){return e.replace($w,"")}function pi(e){if(typeof e!="string"||e.length===0)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>127||!Qw(r))return!1}return!0}function Qw(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function rm(e){if(typeof e!="string"||e.trim()!==e)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r===0||r===10||r===13)return!1}return!0}var Bw,tm,$w,nm,Kn,Ml,om,E,am=Hn(()=>{"use strict";m();d();f();p();em();Bw=/[^a-z0-9\-#$%&'*+.^_`|~]/i;tm=[`
|
|
19
|
+
`,"\r","\t"," "],$w=new RegExp(`(^[${tm.join("")}]|$[${tm.join("")}])`,"g");Kn=Symbol("normalizedHeaders"),Ml=Symbol("rawHeaderNames"),om=", ",E=class im{constructor(t){this[Kn]={},this[Ml]=new Map,this[nm]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof im||typeof w.Headers<"u"&&t instanceof w.Headers?t.forEach((r,n)=>{this.append(n,r)},this):Array.isArray(t)?t.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(om):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(om):n)})}[(nm=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}*keys(){for(let[t]of this.entries())yield t}*values(){for(let[,t]of this.entries())yield t}*entries(){let t=Object.keys(this[Kn]).sort((r,n)=>r.localeCompare(n));for(let r of t)if(r==="set-cookie")for(let n of this.getSetCookie())yield[r,n];else yield[r,this.get(r)]}has(t){if(!pi(t))throw new TypeError(`Invalid header name "${t}"`);return this[Kn].hasOwnProperty(di(t))}get(t){if(!pi(t))throw TypeError(`Invalid header name "${t}"`);return this[Kn][di(t)]??null}set(t,r){if(!pi(t)||!rm(r))return;let n=di(t),o=Dl(r);this[Kn][n]=Dl(o),this[Ml].set(n,t)}append(t,r){if(!pi(t)||!rm(r))return;let n=di(t),o=Dl(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!pi(t)||!this.has(t))return;let r=di(t);delete this[Kn][r],this[Ml].delete(r)}forEach(t,r){for(let[n,o]of this.entries())t.call(r,o,n,this)}getSetCookie(){let t=this.get("set-cookie");return t===null?[]:t===""?[""]:Na(t)}}});var m=Hn(()=>{"use strict";am()});var fm=Ze(gi=>{"use strict";m();d();f();p();var La=gi&&gi.__assign||function(){return La=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},La.apply(this,arguments)};Object.defineProperty(gi,"__esModule",{value:!0});var ex={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function tx(e){var t=La(La({},ex),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}gi.getSanitizedOptions=tx});var mm=Ze(Vl=>{"use strict";m();d();f();p();Object.defineProperty(Vl,"__esModule",{value:!0});function rx(e){var t=Math.random()*e;return Math.round(t)}Vl.fullJitter=rx});var gm=Ze(Gl=>{"use strict";m();d();f();p();Object.defineProperty(Gl,"__esModule",{value:!0});function nx(e){return e}Gl.noJitter=nx});var hm=Ze(Bl=>{"use strict";m();d();f();p();Object.defineProperty(Bl,"__esModule",{value:!0});var ox=mm(),ix=gm();function ax(e){return e.jitter==="full"?ox.fullJitter:ix.noJitter}Bl.JitterFactory=ax});var Ql=Ze($l=>{"use strict";m();d();f();p();Object.defineProperty($l,"__esModule",{value:!0});var sx=hm(),cx=function(){function e(t){this.options=t,this.attempt=0}return e.prototype.apply=function(){var t=this;return new Promise(function(r){return setTimeout(r,t.jitteredDelay)})},e.prototype.setAttemptNumber=function(t){this.attempt=t},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){var t=sx.JitterFactory(this.options);return t(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var t=this.options.startingDelay,r=this.options.timeMultiple,n=this.numOfDelayedAttempts,o=t*Math.pow(r,n);return Math.min(o,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();$l.Delay=cx});var ym=Ze(ar=>{"use strict";m();d();f();p();var ux=ar&&ar.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),lx=ar&&ar.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(g){try{c(n.next(g))}catch(v){a(v)}}function u(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})},dx=ar&&ar.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(ar,"__esModule",{value:!0});var px=Ql(),fx=function(e){ux(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return lx(this,void 0,void 0,function(){return dx(this,function(r){return[2,this.isFirstAttempt?!0:e.prototype.apply.call(this)]})})},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return this.attempt===0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(px.Delay);ar.SkipFirstDelay=fx});var vm=Ze(hi=>{"use strict";m();d();f();p();var mx=hi&&hi.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(hi,"__esModule",{value:!0});var gx=Ql(),hx=function(e){mx(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(gx.Delay);hi.AlwaysDelay=hx});var Sm=Ze(Hl=>{"use strict";m();d();f();p();Object.defineProperty(Hl,"__esModule",{value:!0});var yx=ym(),vx=vm();function Sx(e,t){var r=bx(e);return r.setAttemptNumber(t),r}Hl.DelayFactory=Sx;function bx(e){return e.delayFirstAttempt?new vx.AlwaysDelay(e):new yx.SkipFirstDelay(e)}});var bm=Ze(tn=>{"use strict";m();d();f();p();var zl=tn&&tn.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(g){try{c(n.next(g))}catch(v){a(v)}}function u(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})},Wl=tn&&tn.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(tn,"__esModule",{value:!0});var Ax=fm(),wx=Sm();function xx(e,t){return t===void 0&&(t={}),zl(this,void 0,void 0,function(){var r,n;return Wl(this,function(o){switch(o.label){case 0:return r=Ax.getSanitizedOptions(t),n=new Cx(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}tn.backOff=xx;var Cx=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return zl(this,void 0,void 0,function(){var t,r;return Wl(this,function(n){switch(n.label){case 0:if(this.attemptLimitReached)return[3,7];n.label=1;case 1:return n.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return n.sent(),[4,this.request()];case 3:return[2,n.sent()];case 4:return t=n.sent(),this.attemptNumber++,[4,this.options.retry(t,this.attemptNumber)];case 5:if(r=n.sent(),!r||this.attemptLimitReached)throw t;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}})})},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return zl(this,void 0,void 0,function(){var t;return Wl(this,function(r){switch(r.label){case 0:return t=wx.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var sc=Ze((fp,mp)=>{"use strict";m();d();f();p();(function(e,t){typeof fp=="object"&&typeof mp<"u"?mp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof w<"u"?w:e||self).dayjs=t()})(fp,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",u="week",c="month",g="quarter",v="year",R="date",h="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,x={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(D){var q=["th","st","nd","rd"],U=D%100;return"["+D+(q[(U-20)%10]||q[U]||q[0])+"]"}},I=function(D,q,U){var H=String(D);return!H||H.length>=q?D:""+Array(q+1-H.length).join(U)+D},_={s:I,z:function(D){var q=-D.utcOffset(),U=Math.abs(q),H=Math.floor(U/60),Q=U%60;return(q<=0?"+":"-")+I(H,2,"0")+":"+I(Q,2,"0")},m:function D(q,U){if(q.date()<U.date())return-D(U,q);var H=12*(U.year()-q.year())+(U.month()-q.month()),Q=q.clone().add(H,c),J=U-Q<0,X=q.clone().add(H+(J?-1:1),c);return+(-(H+(U-Q)/(J?Q-X:X-Q))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:c,y:v,w:u,d:s,D:R,h:a,m:i,s:o,ms:n,Q:g}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},T="en",P={};P[T]=x;var A="$isDayjsObject",O=function(D){return D instanceof V||!(!D||!D[A])},k=function D(q,U,H){var Q;if(!q)return T;if(typeof q=="string"){var J=q.toLowerCase();P[J]&&(Q=J),U&&(P[J]=U,Q=J);var X=q.split("-");if(!Q&&X.length>1)return D(X[0])}else{var W=q.name;P[W]=q,Q=W}return!H&&Q&&(T=Q),Q||!H&&T},N=function(D,q){if(O(D))return D.clone();var U=typeof q=="object"?q:{};return U.date=D,U.args=arguments,new V(U)},M=_;M.l=k,M.i=O,M.w=function(D,q){return N(D,{locale:q.$L,utc:q.$u,x:q.$x,$offset:q.$offset})};var V=function(){function D(U){this.$L=k(U.locale,null,!0),this.parse(U),this.$x=this.$x||U.x||{},this[A]=!0}var q=D.prototype;return q.parse=function(U){this.$d=function(H){var Q=H.date,J=H.utc;if(Q===null)return new Date(NaN);if(M.u(Q))return new Date;if(Q instanceof Date)return new Date(Q);if(typeof Q=="string"&&!/Z$/i.test(Q)){var X=Q.match(y);if(X){var W=X[2]-1||0,te=(X[7]||"0").substring(0,3);return J?new Date(Date.UTC(X[1],W,X[3]||1,X[4]||0,X[5]||0,X[6]||0,te)):new Date(X[1],W,X[3]||1,X[4]||0,X[5]||0,X[6]||0,te)}}return new Date(Q)}(U),this.init()},q.init=function(){var U=this.$d;this.$y=U.getFullYear(),this.$M=U.getMonth(),this.$D=U.getDate(),this.$W=U.getDay(),this.$H=U.getHours(),this.$m=U.getMinutes(),this.$s=U.getSeconds(),this.$ms=U.getMilliseconds()},q.$utils=function(){return M},q.isValid=function(){return this.$d.toString()!==h},q.isSame=function(U,H){var Q=N(U);return this.startOf(H)<=Q&&Q<=this.endOf(H)},q.isAfter=function(U,H){return N(U)<this.startOf(H)},q.isBefore=function(U,H){return this.endOf(H)<N(U)},q.$g=function(U,H,Q){return M.u(U)?this[H]:this.set(Q,U)},q.unix=function(){return Math.floor(this.valueOf()/1e3)},q.valueOf=function(){return this.$d.getTime()},q.startOf=function(U,H){var Q=this,J=!!M.u(H)||H,X=M.p(U),W=function(ve,ge){var we=M.w(Q.$u?Date.UTC(Q.$y,ge,ve):new Date(Q.$y,ge,ve),Q);return J?we:we.endOf(s)},te=function(ve,ge){return M.w(Q.toDate()[ve].apply(Q.toDate("s"),(J?[0,0,0,0]:[23,59,59,999]).slice(ge)),Q)},le=this.$W,_e=this.$M,Ve=this.$D,Fe="set"+(this.$u?"UTC":"");switch(X){case v:return J?W(1,0):W(31,11);case c:return J?W(1,_e):W(0,_e+1);case u:var Me=this.$locale().weekStart||0,Le=(le<Me?le+7:le)-Me;return W(J?Ve-Le:Ve+(6-Le),_e);case s:case R:return te(Fe+"Hours",0);case a:return te(Fe+"Minutes",1);case i:return te(Fe+"Seconds",2);case o:return te(Fe+"Milliseconds",3);default:return this.clone()}},q.endOf=function(U){return this.startOf(U,!1)},q.$set=function(U,H){var Q,J=M.p(U),X="set"+(this.$u?"UTC":""),W=(Q={},Q[s]=X+"Date",Q[R]=X+"Date",Q[c]=X+"Month",Q[v]=X+"FullYear",Q[a]=X+"Hours",Q[i]=X+"Minutes",Q[o]=X+"Seconds",Q[n]=X+"Milliseconds",Q)[J],te=J===s?this.$D+(H-this.$W):H;if(J===c||J===v){var le=this.clone().set(R,1);le.$d[W](te),le.init(),this.$d=le.set(R,Math.min(this.$D,le.daysInMonth())).$d}else W&&this.$d[W](te);return this.init(),this},q.set=function(U,H){return this.clone().$set(U,H)},q.get=function(U){return this[M.p(U)]()},q.add=function(U,H){var Q,J=this;U=Number(U);var X=M.p(H),W=function(_e){var Ve=N(J);return M.w(Ve.date(Ve.date()+Math.round(_e*U)),J)};if(X===c)return this.set(c,this.$M+U);if(X===v)return this.set(v,this.$y+U);if(X===s)return W(1);if(X===u)return W(7);var te=(Q={},Q[i]=t,Q[a]=r,Q[o]=e,Q)[X]||1,le=this.$d.getTime()+U*te;return M.w(le,this)},q.subtract=function(U,H){return this.add(-1*U,H)},q.format=function(U){var H=this,Q=this.$locale();if(!this.isValid())return Q.invalidDate||h;var J=U||"YYYY-MM-DDTHH:mm:ssZ",X=M.z(this),W=this.$H,te=this.$m,le=this.$M,_e=Q.weekdays,Ve=Q.months,Fe=Q.meridiem,Me=function(ge,we,Se,He){return ge&&(ge[we]||ge(H,J))||Se[we].slice(0,He)},Le=function(ge){return M.s(W%12||12,ge,"0")},ve=Fe||function(ge,we,Se){var He=ge<12?"AM":"PM";return Se?He.toLowerCase():He};return J.replace(b,function(ge,we){return we||function(Se){switch(Se){case"YY":return String(H.$y).slice(-2);case"YYYY":return M.s(H.$y,4,"0");case"M":return le+1;case"MM":return M.s(le+1,2,"0");case"MMM":return Me(Q.monthsShort,le,Ve,3);case"MMMM":return Me(Ve,le);case"D":return H.$D;case"DD":return M.s(H.$D,2,"0");case"d":return String(H.$W);case"dd":return Me(Q.weekdaysMin,H.$W,_e,2);case"ddd":return Me(Q.weekdaysShort,H.$W,_e,3);case"dddd":return _e[H.$W];case"H":return String(W);case"HH":return M.s(W,2,"0");case"h":return Le(1);case"hh":return Le(2);case"a":return ve(W,te,!0);case"A":return ve(W,te,!1);case"m":return String(te);case"mm":return M.s(te,2,"0");case"s":return String(H.$s);case"ss":return M.s(H.$s,2,"0");case"SSS":return M.s(H.$ms,3,"0");case"Z":return X}return null}(ge)||X.replace(":","")})},q.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},q.diff=function(U,H,Q){var J,X=this,W=M.p(H),te=N(U),le=(te.utcOffset()-this.utcOffset())*t,_e=this-te,Ve=function(){return M.m(X,te)};switch(W){case v:J=Ve()/12;break;case c:J=Ve();break;case g:J=Ve()/3;break;case u:J=(_e-le)/6048e5;break;case s:J=(_e-le)/864e5;break;case a:J=_e/r;break;case i:J=_e/t;break;case o:J=_e/e;break;default:J=_e}return Q?J:M.a(J)},q.daysInMonth=function(){return this.endOf(c).$D},q.$locale=function(){return P[this.$L]},q.locale=function(U,H){if(!U)return this.$L;var Q=this.clone(),J=k(U,H,!0);return J&&(Q.$L=J),Q},q.clone=function(){return M.w(this.$d,this)},q.toDate=function(){return new Date(this.valueOf())},q.toJSON=function(){return this.isValid()?this.toISOString():null},q.toISOString=function(){return this.$d.toISOString()},q.toString=function(){return this.$d.toUTCString()},D}(),j=V.prototype;return N.prototype=j,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",c],["$y",v],["$D",R]].forEach(function(D){j[D[1]]=function(q){return this.$g(q,D[0],D[1])}}),N.extend=function(D,q){return D.$i||(D(q,V,N),D.$i=!0),N},N.locale=k,N.isDayjs=O,N.unix=function(D){return N(1e3*D)},N.en=P[T],N.Ls=P,N.p={},N})});var Cy=Ze((gp,hp)=>{"use strict";m();d();f();p();(function(e,t){typeof gp=="object"&&typeof hp<"u"?hp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof w<"u"?w:e||self).dayjs_plugin_quarterOfYear=t()})(gp,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(s){return this.$utils().u(s)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(s-1))};var i=o.add;o.add=function(s,u){return s=Number(s),this.$utils().p(u)===t?this.add(3*s,e):i.bind(this)(s,u)};var a=o.startOf;o.startOf=function(s,u){var c=this.$utils(),g=!!c.u(u)||u;if(c.p(s)===t){var v=this.quarter()-1;return g?this.month(3*v).startOf(e).startOf("day"):this.month(3*v+2).endOf(e).endOf("day")}return a.bind(this)(s,u)}}})});var Ey=Ze((yp,vp)=>{"use strict";m();d();f();p();(function(e,t){typeof yp=="object"&&typeof vp<"u"?vp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof w<"u"?w:e||self).dayjs_plugin_customParseFormat=t()})(yp,function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,o=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,a={},s=function(y){return(y=+y)+(y>68?1900:2e3)},u=function(y){return function(b){this[y]=+b}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(b){if(!b||b==="Z")return 0;var x=b.match(/([+-]|\d\d)/g),I=60*x[1]+(+x[2]||0);return I===0?0:x[0]==="+"?-I:I}(y)}],g=function(y){var b=a[y];return b&&(b.indexOf?b:b.s.concat(b.f))},v=function(y,b){var x,I=a.meridiem;if(I){for(var _=1;_<=24;_+=1)if(y.indexOf(I(_,0,b))>-1){x=_>12;break}}else x=y===(b?"pm":"PM");return x},R={A:[i,function(y){this.afternoon=v(y,!1)}],a:[i,function(y){this.afternoon=v(y,!0)}],Q:[r,function(y){this.month=3*(y-1)+1}],S:[r,function(y){this.milliseconds=100*+y}],SS:[n,function(y){this.milliseconds=10*+y}],SSS:[/\d{3}/,function(y){this.milliseconds=+y}],s:[o,u("seconds")],ss:[o,u("seconds")],m:[o,u("minutes")],mm:[o,u("minutes")],H:[o,u("hours")],h:[o,u("hours")],HH:[o,u("hours")],hh:[o,u("hours")],D:[o,u("day")],DD:[n,u("day")],Do:[i,function(y){var b=a.ordinal,x=y.match(/\d+/);if(this.day=x[0],b)for(var I=1;I<=31;I+=1)b(I).replace(/\[|\]/g,"")===y&&(this.day=I)}],w:[o,u("week")],ww:[n,u("week")],M:[o,u("month")],MM:[n,u("month")],MMM:[i,function(y){var b=g("months"),x=(g("monthsShort")||b.map(function(I){return I.slice(0,3)})).indexOf(y)+1;if(x<1)throw new Error;this.month=x%12||x}],MMMM:[i,function(y){var b=g("months").indexOf(y)+1;if(b<1)throw new Error;this.month=b%12||b}],Y:[/[+-]?\d+/,u("year")],YY:[n,function(y){this.year=s(y)}],YYYY:[/\d{4}/,u("year")],Z:c,ZZ:c};function h(y){var b,x;b=y,x=a&&a.formats;for(var I=(y=b.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(N,M,V){var j=V&&V.toUpperCase();return M||x[V]||e[V]||x[j].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(D,q,U){return q||U.slice(1)})})).match(t),_=I.length,T=0;T<_;T+=1){var P=I[T],A=R[P],O=A&&A[0],k=A&&A[1];I[T]=k?{regex:O,parser:k}:P.replace(/^\[|\]$/g,"")}return function(N){for(var M={},V=0,j=0;V<_;V+=1){var D=I[V];if(typeof D=="string")j+=D.length;else{var q=D.regex,U=D.parser,H=N.slice(j),Q=q.exec(H)[0];U.call(M,Q),N=N.replace(Q,"")}}return function(J){var X=J.afternoon;if(X!==void 0){var W=J.hours;X?W<12&&(J.hours+=12):W===12&&(J.hours=0),delete J.afternoon}}(M),M}}return function(y,b,x){x.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(s=y.parseTwoDigitYear);var I=b.prototype,_=I.parse;I.parse=function(T){var P=T.date,A=T.utc,O=T.args;this.$u=A;var k=O[1];if(typeof k=="string"){var N=O[2]===!0,M=O[3]===!0,V=N||M,j=O[2];M&&(j=O[2]),a=this.$locale(),!N&&j&&(a=x.Ls[j]),this.$d=function(H,Q,J,X){try{if(["x","X"].indexOf(Q)>-1)return new Date((Q==="X"?1e3:1)*H);var W=h(Q)(H),te=W.year,le=W.month,_e=W.day,Ve=W.hours,Fe=W.minutes,Me=W.seconds,Le=W.milliseconds,ve=W.zone,ge=W.week,we=new Date,Se=_e||(te||le?1:we.getDate()),He=te||we.getFullYear(),Ye=0;te&&!le||(Ye=le>0?le-1:we.getMonth());var Lt,xt=Ve||0,Qt=Fe||0,Tt=Me||0,qt=Le||0;return ve?new Date(Date.UTC(He,Ye,Se,xt,Qt,Tt,qt+60*ve.offset*1e3)):J?new Date(Date.UTC(He,Ye,Se,xt,Qt,Tt,qt)):(Lt=new Date(He,Ye,Se,xt,Qt,Tt,qt),ge&&(Lt=X(Lt).week(ge).toDate()),Lt)}catch{return new Date("")}}(P,k,A,x),this.init(),j&&j!==!0&&(this.$L=this.locale(j).$L),V&&P!=this.format(k)&&(this.$d=new Date("")),a={}}else if(k instanceof Array)for(var D=k.length,q=1;q<=D;q+=1){O[1]=k[q-1];var U=x.apply(this,O);if(U.isValid()){this.$d=U.$d,this.$L=U.$L,this.init();break}q===D&&(this.$d=new Date(""))}else _.call(this,T)}}})});var Av=Ze((Np,Fp)=>{"use strict";m();d();f();p();(function(e,t){typeof Np=="object"&&typeof Fp<"u"?Fp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof w<"u"?w:e||self).dayjs_plugin_timezone=t()})(Np,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,o){var i,a=function(g,v,R){R===void 0&&(R={});var h=new Date(g),y=function(b,x){x===void 0&&(x={});var I=x.timeZoneName||"short",_=b+"|"+I,T=t[_];return T||(T=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:b,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:I}),t[_]=T),T}(v,R);return y.formatToParts(h)},s=function(g,v){for(var R=a(g,v),h=[],y=0;y<R.length;y+=1){var b=R[y],x=b.type,I=b.value,_=e[x];_>=0&&(h[_]=parseInt(I,10))}var T=h[3],P=T===24?0:T,A=h[0]+"-"+h[1]+"-"+h[2]+" "+P+":"+h[4]+":"+h[5]+":000",O=+g;return(o.utc(A).valueOf()-(O-=O%1e3))/6e4},u=n.prototype;u.tz=function(g,v){if(g===void 0&&(g=i),!this.isValid())return this;var R,h=this.utcOffset(),y=this.toDate(),b=y.toLocaleString("en-US",{timeZone:g}),x=s(+y,g);if(!Number(x))R=this.utcOffset(0,v);else if(R=o(b,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(x,!0),v){var I=R.utcOffset();R=R.add(h-I,"minute")}return R.$x.$timezone=g,R},u.offsetName=function(g){var v=this.$x.$timezone||o.tz.guess(),R=a(this.valueOf(),v,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return R&&R.value};var c=u.startOf;u.startOf=function(g,v){if(!this.$x||!this.$x.$timezone)return c.call(this,g,v);var R=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return c.call(R,g,v).tz(this.$x.$timezone,!0)},o.tz=function(g,v,R){var h=R&&v,y=R||v||i,b=s(+o(),y);if(typeof g!="string")return o(g).tz(y);var x=o.utc(g,h).valueOf();if(Number.isNaN(x)){var I=o(NaN);return I.$x.$timezone=y,I}var _=function(O,k,N){var M=O-60*k*1e3,V=s(M,N);if(k===V)return[M,k];var j=s(M-=60*(V-k)*1e3,N);return V===j?[M,V]:[O-60*Math.min(V,j)*1e3,Math.max(V,j)]}(x,b,y),T=_[0],P=_[1],A=o(T).utcOffset(P);return A.$x.$timezone=y,A},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var wv=Ze((Dp,Mp)=>{"use strict";m();d();f();p();(function(e,t){typeof Dp=="object"&&typeof Mp<"u"?Mp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof w<"u"?w:e||self).dayjs_plugin_utc=t()})(Dp,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,i){var a=o.prototype;i.utc=function(h){var y={date:h,utc:!0,args:arguments};return new o(y)},a.utc=function(h){var y=i(this.toDate(),{locale:this.$L,utc:!0});return h?y.add(this.utcOffset(),e):y},a.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var s=a.parse;a.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),s.call(this,h)};var u=a.init;a.init=function(){if(this.$u){var h=this.$d;this.$y=h.getUTCFullYear(),this.$M=h.getUTCMonth(),this.$D=h.getUTCDate(),this.$W=h.getUTCDay(),this.$H=h.getUTCHours(),this.$m=h.getUTCMinutes(),this.$s=h.getUTCSeconds(),this.$ms=h.getUTCMilliseconds()}else u.call(this)};var c=a.utcOffset;a.utcOffset=function(h,y){var b=this.$utils().u;if(b(h))return this.$u?0:b(this.$offset)?c.call(this):this.$offset;if(typeof h=="string"&&(h=function(T){T===void 0&&(T="");var P=T.match(t);if(!P)return null;var A=(""+P[0]).match(r)||["-",0,0],O=A[0],k=60*+A[1]+ +A[2];return k===0?0:O==="+"?k:-k}(h),h===null))return this;var x=Math.abs(h)<=16?60*h:h;if(x===0)return this.utc(y);var I=this.clone();if(y)return I.$offset=x,I.$u=!1,I;var _=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(I=this.local().add(x+_,e)).$offset=x,I.$x.$localOffset=_,I};var g=a.format;a.format=function(h){var y=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,y)},a.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},a.isUTC=function(){return!!this.$u},a.toISOString=function(){return this.toDate().toISOString()},a.toString=function(){return this.toDate().toUTCString()};var v=a.toDate;a.toDate=function(h){return h==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var R=a.diff;a.diff=function(h,y,b){if(h&&this.$u===h.$u)return R.call(this,h,y,b);var x=this.local(),I=i(h).local();return R.call(x,I,y,b)}}})});var yA=Ze((ble,hA)=>{"use strict";m();d();f();p();function HP(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}hA.exports=zP;function zP(e,t,r){var n=r&&r.stringify||HP,o=1;if(typeof e=="object"&&e!==null){var i=t.length+o;if(i===1)return e;var a=new Array(i);a[0]=n(e);for(var s=1;s<i;s++)a[s]=n(t[s]);return a.join(" ")}if(typeof e!="string")return e;var u=t.length;if(u===0)return e;for(var c="",g=1-o,v=-1,R=e&&e.length||0,h=0;h<R;){if(e.charCodeAt(h)===37&&h+1<R){switch(v=v>-1?v:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=u||t[g]==null)break;v<h&&(c+=e.slice(v,h)),c+=Number(t[g]),v=h+2,h++;break;case 105:if(g>=u||t[g]==null)break;v<h&&(c+=e.slice(v,h)),c+=Math.floor(Number(t[g])),v=h+2,h++;break;case 79:case 111:case 106:if(g>=u||t[g]===void 0)break;v<h&&(c+=e.slice(v,h));var y=typeof t[g];if(y==="string"){c+="'"+t[g]+"'",v=h+2,h++;break}if(y==="function"){c+=t[g].name||"<anonymous>",v=h+2,h++;break}c+=n(t[g]),v=h+2,h++;break;case 115:if(g>=u)break;v<h&&(c+=e.slice(v,h)),c+=String(t[g]),v=h+2,h++;break;case 37:v<h&&(c+=e.slice(v,h)),c+="%",v=h+2,h++,g--;break}++g}++h}return v===-1?e:(v<R&&(c+=e.slice(v)),c)}});var CA=Ze((Ele,fl)=>{"use strict";m();d();f();p();var vA=yA();fl.exports=wr;var Ca=cN().console||{},WP={mapHttpRequest:pl,mapHttpResponse:pl,wrapRequestSerializer:Ff,wrapResponseSerializer:Ff,wrapErrorSerializer:Ff,req:pl,res:pl,err:bA,errWithCause:bA};function Zr(e,t){return e==="silent"?1/0:t.levels.values[e]}var Lf=Symbol("pino.logFuncs"),Df=Symbol("pino.hierarchy"),KP={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function SA(e,t){let r={logger:t,parent:e[Df]};t[Df]=r}function YP(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Ca[o]||Ca[KP[o]||"log"]||ti}),e[Lf]=n}function XP(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function wr(e){e=e||{},e.browser=e.browser||{};let t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");let r=e.browser.write||Ca;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=XP(e.browser.serialize,n),i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);let a=Object.keys(e.customLevels||{}),s=["error","fatal","warn","info","debug","trace"].concat(a);typeof r=="function"&&s.forEach(function(b){r[b]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let u=e.level||"info",c=Object.create(r);c.log||(c.log=ti),YP(c,s,r),SA({},c),Object.defineProperty(c,"levelVal",{get:v}),Object.defineProperty(c,"level",{get:R,set:h});let g={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,reportCaller:e.browser.reportCaller,levels:s,timestamp:iN(e),messageKey:e.messageKey||"msg",onChild:e.onChild||ti};c.levels=ZP(e),c.level=u,c.isLevelEnabled=function(b){return this.levels.values[b]?this.levels.values[b]>=this.levels.values[this.level]:!1},c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=ti,c.serializers=n,c._serialize=o,c._stdErrSerialize=i,c.child=function(...b){return y.call(this,g,...b)},t&&(c._logEvent=Mf());function v(){return Zr(this.level,this)}function R(){return this._level}function h(b){if(b!=="silent"&&!this.levels.values[b])throw Error("unknown level "+b);this._level=b,Gn(this,g,c,"error"),Gn(this,g,c,"fatal"),Gn(this,g,c,"warn"),Gn(this,g,c,"info"),Gn(this,g,c,"debug"),Gn(this,g,c,"trace"),a.forEach(x=>{Gn(this,g,c,x)})}function y(b,x,I){if(!x)throw new Error("missing bindings for child Pino");I=I||{},o&&x.serializers&&(I.serializers=x.serializers);let _=I.serializers;if(o&&_){var T=Object.assign({},n,_),P=e.browser.serialize===!0?Object.keys(T):o;delete x.serializers,qf([x],P,T,this._stdErrSerialize)}function A(k){this._childLevel=(k._childLevel|0)+1,this.bindings=x,T&&(this.serializers=T,this._serialize=P),t&&(this._logEvent=Mf([].concat(k._logEvent.bindings,x)))}A.prototype=this;let O=new A(this);return SA(this,O),O.child=function(...k){return y.call(this,b,...k)},O.level=I.level||this.level,b.onChild(O),O}return c}function ZP(e){let t=e.customLevels||{},r=Object.assign({},wr.levels.values,t),n=Object.assign({},wr.levels.labels,JP(t));return{values:r,labels:n}}function JP(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}wr.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};wr.stdSerializers=WP;wr.stdTimeFunctions=Object.assign({},{nullTime:wA,epochTime:xA,unixTime:aN,isoTime:sN});function eN(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[Df];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Gn(e,t,r,n){if(Object.defineProperty(e,n,{value:Zr(e.level,r)>Zr(n,r)?ti:r[Lf][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===ti){if(!t.transmit)return;let i=t.transmit.level||e.level,a=Zr(i,r);if(Zr(n,r)<a)return}e[n]=rN(e,t,r,n);let o=eN(e);o.length!==0&&(e[n]=tN(o,e[n]))}function tN(e,t){return function(){return t.apply(this,[...e,...arguments])}}function rN(e,t,r,n){return function(o){return function(){let a=t.timestamp(),s=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Ca?Ca:this;for(var c=0;c<s.length;c++)s[c]=arguments[c];var g=!1;if(t.serialize&&(qf(s,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let v=nN(this,n,s,a,t);if(t.reportCaller&&v&&v.length>0&&v[0]&&typeof v[0]=="object")try{let R=AA();R&&(v[0].caller=R)}catch{}o.call(u,...v)}else{if(t.reportCaller)try{let v=AA();v&&s.push(v)}catch{}o.apply(u,s)}if(t.transmit){let v=t.transmit.level||e._level,R=Zr(v,r),h=Zr(n,r);if(h<R)return;oN(this,{ts:a,methodLevel:n,methodValue:h,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Zr(e._level,r)},s,g)}}}(e[Lf][n])}function nN(e,t,r,n,o){let{level:i,log:a=v=>v}=o.formatters||{},s=r.slice(),u=s[0],c={},g=(e._childLevel|0)+1;if(g<1&&(g=1),n&&(c.time=n),i){let v=i(t,e.levels.values[t]);Object.assign(c,v)}else c.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(u!==null&&typeof u=="object")for(;g--&&typeof s[0]=="object";)Object.assign(c,s.shift());return[a(c),...s]}else{if(u!==null&&typeof u=="object"){for(;g--&&typeof s[0]=="object";)Object.assign(c,s.shift());u=s.length?vA(s.shift(),s):void 0}else typeof u=="string"&&(u=vA(s.shift(),s));return u!==void 0&&(c[o.messageKey]=u),[a(c)]}}function qf(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=wr.stdSerializers.err(e[o]);else if(typeof e[o]=="object"&&!Array.isArray(e[o])&&t)for(let i in e[o])t.indexOf(i)>-1&&i in r&&(e[o][i]=r[i](e[o][i]))}function oN(e,t,r,n=!1){let o=t.send,i=t.ts,a=t.methodLevel,s=t.methodValue,u=t.val,c=e._logEvent.bindings;n||qf(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter(function(g){return c.indexOf(g)===-1}),e._logEvent.level.label=a,e._logEvent.level.value=s,o(a,e._logEvent,u),e._logEvent=Mf(c)}function Mf(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function bA(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let r in e)t[r]===void 0&&(t[r]=e[r]);return t}function iN(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?wA:xA}function pl(){return{}}function Ff(e){return e}function ti(){}function wA(){return!1}function xA(){return Date.now()}function aN(){return Math.round(Date.now()/1e3)}function sN(){return new Date(Date.now()).toISOString()}function cN(){function e(t){return typeof t<"u"&&t}try{return typeof w<"u"?w:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),w)}catch{return e(self)||e(window)||e(this)||{}}}fl.exports.default=wr;fl.exports.pino=wr;function AA(){let e=new Error().stack;if(!e)return null;let t=e.split(`
|
|
20
|
+
`);for(let r=1;r<t.length;r++){let n=t[r].trim();if(/(^at\s+)?(createWrap|LOG|set\s*\(|asObject|Object\.apply|Function\.apply)/.test(n)||n.indexOf("browser.js")!==-1||n.indexOf("node:internal")!==-1||n.indexOf("node_modules")!==-1)continue;let o=n.match(/\((.*?):(\d+):(\d+)\)/);if(o||(o=n.match(/at\s+(.*?):(\d+):(\d+)/)),o){let i=o[1],a=o[2],s=o[3];return i+":"+a+":"+s}}return null}});var cF={};ui(cF,{DefaultFieldsToInclude:()=>$f,EcommerceDefaultFieldsToInclude:()=>pw,HighlightUtils:()=>Ul,MinimumFieldsToInclude:()=>Cl,ResultTemplatesHelpers:()=>$y,buildContext:()=>FA,buildController:()=>Jr,buildDictionaryFieldContext:()=>DA,buildInteractiveResult:()=>cw,buildRecommendationEngine:()=>OA,buildRecommendationList:()=>aw,buildResultTemplatesManager:()=>gw,getAnalyticsNextApiBaseUrl:()=>qa,getOrganizationEndpoint:()=>_t,getSampleRecommendationEngineConfiguration:()=>jf,loadAdvancedSearchQueryActions:()=>zN,loadClickAnalyticsActions:()=>oF,loadConfigurationActions:()=>WN,loadContextActions:()=>YN,loadDebugActions:()=>XN,loadDictionaryFieldContextActions:()=>ZN,loadFieldActions:()=>tF,loadPaginationActions:()=>Bf,loadPipelineActions:()=>rF,loadRecommendationActions:()=>nF,loadSearchConfigurationActions:()=>KN,loadSearchHubActions:()=>sF});module.exports=Cw(cF);m();d();f();p();var Ul={};ui(Ul,{escapeHtml:()=>Yn,getHighlightedSuggestion:()=>Jw,highlightString:()=>Zw});m();d();f();p();m();d();f();p();function Hw(e,t){let r=`
|
|
21
21
|
The following properties are invalid:
|
|
22
22
|
|
|
23
23
|
${e.join(`
|
|
24
24
|
`)}
|
|
25
25
|
|
|
26
26
|
${t}
|
|
27
|
-
`;return new si(r)}var si=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},ht=class{constructor(e){ae(this,"definition");this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let i=this.definition[o].validate(r[o]);i&&n.push(`${o}: ${i}`)}if(n.length)throw IA(n,t);return r}get default(){let e={};for(let t in this.definition){let r=this.definition[t].default;r!==void 0&&(e[t]=r)}return e}},De=class{constructor(e={}){ae(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&se(e)?"value is required.":null}get default(){return this.baseConfig.default instanceof Function?this.baseConfig.default():this.baseConfig.default}get required(){return this.baseConfig.required===!0}};function Je(e){return e===void 0}function TA(e){return e===null}function se(e){return Je(e)||TA(e)}var fe=class{constructor(e={}){ae(this,"value");this.value=new De(e)}validate(e){let t=this.value.validate(e);return t||(_A(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function _A(e){return Je(e)||Kf(e)}function Kf(e){return typeof e=="boolean"}var oe=class{constructor(e={}){ae(this,"config");ae(this,"value");this.config=e,this.value=new De(e)}validate(e){let t=this.value.validate(e);return t||(kA(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 kA(e){return Je(e)||Yf(e)}function Yf(e){return typeof e=="number"&&!Number.isNaN(e)}var OA=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,z=class{constructor(e={}){ae(this,"value");ae(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new De(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:i}=this.config,a=this.value.validate(e);if(a)return a;if(Je(e))return null;if(!_a(e))return"value is not a string.";if(!t&&!e.length)return"value is an empty string.";if(r)try{new URL(e)}catch{return"value is not a valid URL."}return n&&!n.test(e)?`value did not match provided regex ${n}`:o&&!o.includes(e)?`value should be one of: ${o.join(", ")}.`:i&&!(OA.test(e)&&new Date(e).toString()!=="Invalid Date")?"value is not a valid ISO8601 date string":null}get default(){return this.value.default}get required(){return this.value.required}};function _a(e){return Object.prototype.toString.call(e)==="[object String]"}var ne=class{constructor(e={}){ae(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Je(e))return this.config.options.required?"value is required and is currently undefined":null;if(!Xf(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&se(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],i=n.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function Xf(e){return e!==void 0&&typeof e=="object"}var Se=class{constructor(e={}){ae(this,"config");ae(this,"value");this.config=e,this.value=new De(this.config)}validate(e){if(!se(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(se(e))return null;if(this.config.max!==void 0&&e.length>this.config.max)return`value contains more than ${this.config.max}`;if(this.config.min!==void 0&&e.length<this.config.min)return`value contains less than ${this.config.min}`;if(this.config.each!==void 0){let r="";return e.forEach(n=>{this.config.each.required&&se(n)&&(r=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(n,this.config.each);o!==null&&(r+=` ${o}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return Kf(e)||_a(e)||Yf(e)||Xf(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Zf(e){return Array.isArray(e)}var Il=class{constructor(e){ae(this,"config");ae(this,"value");this.config=e,this.value=new De(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Je(e)||Object.values(this.config.enum).find(n=>n===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();f();p();function Jf(e){return Array.isArray(e)}function ka(e){return e.trim()===""}var PA=new Set(["1",1,"yes",!0]);function Tl(){if(typeof navigator>"u"||typeof window>"u")return!1;let e=navigator,t=window;return[e.globalPrivacyControl,e.doNotTrack,e.msDoNotTrack,t.doNotTrack].some(r=>PA.has(r))}function em(e){let t={};for(let[r,n]of e)t[r]=n;return t}function ci(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Oa(e,t,r={}){let n;return(...o)=>{let i=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,o)},t),i)return e.apply(void 0,o)}}function NA(e){if(ka(e.openingDelimiter)||ka(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(se(e.content)||ka(e.content))return e.content;if(e.highlights.length===0)return zn(e.content);let t=e.content.length,r="",n=0;for(let o=0;o<e.highlights.length;o++){let i=e.highlights[o],a=i.offset,s=a+i.length;if(s>t)break;r+=zn(e.content.slice(n,a)),r+=e.openingDelimiter,r+=zn(e.content.slice(a,s)),r+=e.closingDelimiter,n=s}return n!==t&&(r+=zn(e.content.slice(n))),r}function FA(e,t){return e=zn(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?_l(n,t.notMatchDelimiters):o?_l(o,t.exactMatchDelimiters):i?_l(i,t.correctionDelimiters):r)}function _l(e,t){return t?t.open+e+t.close:e}function zn(e){let t={"&":"&","<":"<",">":">","\"":""","'":"'","`":"`"},r=`(?:${Object.keys(t).join("|")})`,n=RegExp(r),o=RegExp(r,"g");return n.test(e)?e.replace(o,i=>t[i]):e}m();d();f();p();var pm=qt(cm(),1);m();d();f();p();var $t=new Error("Failed to load reducers."),Wn=class extends Error{constructor(){super(),this.name="UnauthorizedTokenError",this.message="The token being used to perform the request is unauthorized. It may be expired or invalid."}},Jr=class extends Error{constructor(r,n){super();ae(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};m();d();f();p();function um(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function lm(e){return typeof e!="object"||!e?!1:Object.values(e).every(ax)}function ax(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function dm(e){return e===429}var jt=class e{static call(t){return _asyncToGenerator(function*(){let r=sx(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:i,...a}=o,s=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let c=yield A(i,a);if(dm(c.status))throw c;return c});return function s(){return _ref.apply(this,arguments)}}();try{let c=yield(0,pm.backOff)(s,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(u){let h=u&&dm(u.status);return h&&(n.info("Platform retrying request"),yield new Promise(v=>setTimeout(v,1e3))),h});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(c.status){case 419:case 401:throw n.info("Platform renewing token"),new Wn;case 404:throw new Jr(i,c.status);default:return n.info({response:c,requestInfo:o},"Platform response"),c}}catch(c){return c.message==="Failed to fetch"?new Jr(i):c}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:s,...c}=t,u=ci(c);try{let h=yield o(t,n,a);return{...t,...h}}catch(h){i.error(h,"Platform request preprocessing failed. Returning default request options.")}return u})()}};function It(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Kn(e,t,r="prod"){return e??It(t,r)}function wr(e,t="prod"){return`${It(e,t)}/rest/search/v2`}function Na(e,t="prod"){return`${It(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function sx(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,s=e.method==="POST"||e.method==="PUT",c=cx(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(s&&{body:c}),signal:a}}function cx(e,t){return t==="application/x-www-form-urlencoded"?lm(e)?um(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();var Fa=e=>e;m();d();f();p();m();d();f();p();function Da(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Qt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Da(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Da(),extendedResults:{},searchAction:void 0}}m();d();f();p();function Ar(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var xr=e=>{let{response:t}=e;return t.body?ux(e):lx(t)},ux=e=>px(e)?fx(e):dx(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},lx=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function dx(e){return e.body.statusCode!==void 0}function px(e){return e.body.exception!==void 0}var fx=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();var Cr=class{constructor(){ae(this,"currentAbortController",null)}enqueue(t,r){var _this=this;return _asyncToGenerator(function*(){let n=_this.currentAbortController;_this.currentAbortController=new l.AbortController;let o=_this.currentAbortController;n&&(r.warnOnAbort&&r.logger.warn("Cancelling current pending search query"),n.abort());try{return yield t(o?.signal??null)}finally{_this.currentAbortController===o&&(_this.currentAbortController=null)}})()}};m();d();f();p();m();d();f();p();var di=class{constructor(t){ae(this,"_basePath");ae(this,"_params",{});this._basePath=t}addParam(t,r){this._params={...this.params,[t]:r}}get basePath(){return this._basePath}get params(){return this._params}get hasParams(){return Object.entries(this._params).length}get href(){return this.hasParams?`${this.basePath}?${Object.entries(this.params).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}`:this.basePath}};m();d();f();p();function fm(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var ir=(e,t,r,n)=>{let o=new di(`${e.url}${n}`);return o.addParam("organizationId",e.organizationId),e.authentication&&o.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:o.href,origin:"searchApiFetch"}};var mm=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield jt.call({...ir(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Ar(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=fm(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return mx(a)?{success:a}:{error:xr({response:r,body:a})}});return function mm(_x3,_x4){return _ref3.apply(this,arguments)}}();function mx(e){return typeof e=="string"}m();d();f();p();function gx(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function hx(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Ma(e,t){if(t&&e.name==="AbortError")return{error:hx(e)};if(e instanceof Jr)return{error:gx(e)};throw e}var qa=class{constructor(t){ae(this,"options",t);ae(this,"apiCallsQueues",{unknown:new Cr,mainSearch:new Cr,facetValues:new Cr,foldingCollection:new Cr,instantResults:new Cr})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield jt.call({...ir(t,"POST","application/json","/plan"),requestParams:Ar(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return Ma(r);let n=yield r.json();return vx(n)?{success:n}:{error:xr({response:r,body:n})}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield jt.call({...ir(t,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:Ar(t),..._this3.options});if(r instanceof Error)return Ma(r);let n=yield r.json(),o={response:r,body:n};return yx(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:xr(o)}})()}search(t,r){var _this4=this;return _asyncToGenerator(function*(){let n=r?.origin??"unknown",o=yield _this4.apiCallsQueues[n].enqueue(s=>jt.call({...ir(t,"POST","application/json",""),requestParams:Ar(t),requestMetadata:{method:"search",origin:r?.origin},..._this4.options,signal:s??void 0}),{logger:_this4.options.logger,warnOnAbort:!r?.disableAbortWarning});if(o instanceof Error)return Ma(o,r?.disableAbortWarning);let i=yield o.json(),a={response:o,body:i};return gm(i)?(a.body=hm(i),{success:(yield _this4.options.postprocessSearchResponseMiddleware(a)).body}):{error:xr(a)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield jt.call({...ir(t,"POST","application/json","/facet"),requestParams:Ar(t),requestMetadata:{method:"facetSearch"},..._this5.options});if(r instanceof Error)throw r;let n=yield r.json(),o={response:r,body:n};return(yield _this5.options.postprocessFacetSearchResponseMiddleware(o)).body})()}recommendations(t){var _this6=this;return _asyncToGenerator(function*(){let r=yield jt.call({...ir(t,"POST","application/json",""),requestParams:Ar(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if(gm(n)){let o={response:r,body:n};return o.body=hm(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:xr({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return mm(t,{..._this7.options})})()}fieldDescriptions(t){var _this8=this;return _asyncToGenerator(function*(){let r=yield jt.call({...ir(t,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},..._this8.options});if(r instanceof Error)throw r;let n=yield r.json();return Sx(n)?{success:n}:{error:xr({response:r,body:n})}})()}},ja=e=>e.success!==void 0,yt=e=>e.error!==void 0;function gm(e){return e.results!==void 0}function hm(e){let t=Da();return se(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function yx(e){return e.completions!==void 0}function vx(e){return e.preprocessingOutput!==void 0}function Sx(e){return e.fields!==void 0}m();d();f();p();var ym=e=>e,vm=e=>e,Sm=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();function et(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var bx=typeof Symbol=="function"&&Symbol.observable||"@@observable",bm=bx,Ll=()=>Math.random().toString(36).substring(7).split("").join("."),wx={INIT:`@@redux/INIT${Ll()}`,REPLACE:`@@redux/REPLACE${Ll()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ll()}`},La=wx;function Ht(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Ul(e,t,r){if(typeof e!="function")throw new Error(et(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(et(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(et(1));return r(Ul)(e,t)}let n=e,o=t,i=new Map,a=i,s=0,c=!1;function u(){a===i&&(a=new Map,i.forEach((E,R)=>{a.set(R,E)}))}function h(){if(c)throw new Error(et(3));return o}function v(E){if(typeof E!="function")throw new Error(et(4));if(c)throw new Error(et(5));let R=!0;u();let k=s++;return a.set(k,E),function(){if(R){if(c)throw new Error(et(6));R=!1,u(),a.delete(k),i=null}}}function C(E){if(!Ht(E))throw new Error(et(7));if(typeof E.type>"u")throw new Error(et(8));if(typeof E.type!="string")throw new Error(et(17));if(c)throw new Error(et(9));try{c=!0,o=n(o,E)}finally{c=!1}return(i=a).forEach(k=>{k()}),E}function g(E){if(typeof E!="function")throw new Error(et(10));n=E,C({type:La.REPLACE})}function y(){let E=v;return{subscribe(R){if(typeof R!="object"||R===null)throw new Error(et(11));function k(){let T=R;T.next&&T.next(h())}return k(),{unsubscribe:E(k)}},[bm](){return this}}}return C({type:La.INIT}),{dispatch:C,subscribe:v,getState:h,replaceReducer:g,[bm]:y}}function Ax(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:La.INIT})>"u")throw new Error(et(12));if(typeof r(void 0,{type:La.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(et(13))})}function Yn(e){let t=Object.keys(e),r={};for(let a=0;a<t.length;a++){let s=t[a];typeof e[s]=="function"&&(r[s]=e[s])}let n=Object.keys(r),o,i;try{Ax(r)}catch(a){i=a}return function(s={},c){if(i)throw i;let u=!1,h={};for(let v=0;v<n.length;v++){let C=n[v],g=r[C],y=s[C],S=g(y,c);if(typeof S>"u"){let E=c&&c.type;throw new Error(et(14))}h[C]=S,u=u||S!==y}return u=u||n.length!==Object.keys(s).length,u?h:s}}function pi(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function wm(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(et(15))},a={getState:o.getState,dispatch:(c,...u)=>i(c,...u)},s=e.map(c=>c(a));return i=pi(...s)(o.dispatch),{...o,dispatch:i}}}function fi(e){return Ht(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var Kl=Symbol.for("immer-nothing"),mi=Symbol.for("immer-draftable"),We=Symbol.for("immer-state");function tt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var xt=Object,tn=xt.getPrototypeOf,gi="constructor",bi="prototype",Gl="configurable",Ga="enumerable",Va="writable",hi="value",ft=e=>!!e&&!!e[We];function ut(e){return e?_m(e)||Ai(e)||!!e[mi]||!!e[gi]?.[mi]||xi(e)||Ci(e):!1}var xx=xt[bi][gi].toString(),Am=new WeakMap;function _m(e){if(!e||!Zn(e))return!1;let t=tn(e);if(t===null||t===xt[bi])return!0;let r=xt.hasOwnProperty.call(t,gi)&&t[gi];if(r===Object)return!0;if(!en(r))return!1;let n=Am.get(r);return n===void 0&&(n=Function.toString.call(r),Am.set(r,n)),n===xx}function km(e){return ft(e)||tt(15,e),e[We].base_}function wi(e,t,r=!0){rn(e)===0?(r?Reflect.ownKeys(e):xt.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function rn(e){let t=e[We];return t?t.type_:Ai(e)?1:xi(e)?2:Ci(e)?3:0}var Xn=(e,t,r=rn(e))=>r===2?e.has(t):xt[bi].hasOwnProperty.call(e,t),ar=(e,t,r=rn(e))=>r===2?e.get(t):e[t],$a=(e,t,r,n=rn(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function Cx(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ai=Array.isArray,xi=e=>e instanceof Map,Ci=e=>e instanceof Set,Zn=e=>typeof e=="object",en=e=>typeof e=="function",Vl=e=>typeof e=="boolean";function Ex(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Rx=e=>Zn(e)?e?.[We]:null,sr=e=>e.copy_||e.base_;var Yl=e=>e.modified_?e.copy_:e.base_;function $l(e,t){if(xi(e))return new Map(e);if(Ci(e))return new Set(e);if(Ai(e))return Array[bi].slice.call(e);let r=_m(e);if(t===!0||t==="class_only"&&!r){let n=xt.getOwnPropertyDescriptors(e);delete n[We];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],s=n[a];s[Va]===!1&&(s[Va]=!0,s[Gl]=!0),(s.get||s.set)&&(n[a]={[Gl]:!0,[Va]:!0,[Ga]:s[Ga],[hi]:e[a]})}return xt.create(tn(e),n)}else{let n=tn(e);if(n!==null&&r)return{...e};let o=xt.create(n);return xt.assign(o,e)}}function Xl(e,t=!1){return Ya(e)||ft(e)||!ut(e)||(rn(e)>1&&xt.defineProperties(e,{set:Ua,add:Ua,clear:Ua,delete:Ua}),xt.freeze(e),t&&wi(e,(r,n)=>{Xl(n,!0)},!1)),e}function Ix(){tt(2)}var Ua={[hi]:Ix};function Ya(e){return e===null||!Zn(e)?!0:xt.isFrozen(e)}var Qa="MapSet",Ha="Patches",xm="ArrayMethods",za={};function nn(e){let t=za[e];return t||tt(0,e),t}var Cm=e=>!!za[e];function Tx(e,t){za[e]||(za[e]=t)}var yi,Om=()=>yi,_x=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Cm(Qa)?nn(Qa):void 0,arrayMethodsPlugin_:Cm(xm)?nn(xm):void 0});function Em(e,t){t&&(e.patchPlugin_=nn(Ha),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ql(e){Hl(e),e.drafts_.forEach(kx),e.drafts_=null}function Hl(e){e===yi&&(yi=e.parent_)}var Rm=e=>yi=_x(yi,e);function kx(e){let t=e[We];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Im(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[We].modified_&&(Ql(t),tt(4)),ut(e)&&(e=Tm(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[We].base_,e,t)}else e=Tm(t,r);return Ox(t,e,!0),Ql(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Kl?e:void 0}function Tm(e,t){if(Ya(t))return t;let r=t[We];if(!r)return Wa(t,e.handledSet_,e);if(!Xa(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){let{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);Fm(r,e)}return r.copy_}function Ox(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Xl(t,r)}function Pm(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Xa=(e,t)=>e.scope_===t,Px=[];function Nm(e,t,r,n){let o=sr(e),i=e.type_;if(n!==void 0&&ar(o,n,i)===t){$a(o,n,r,i);return}if(!e.draftLocations_){let s=e.draftLocations_=new Map;wi(o,(c,u)=>{if(ft(u)){let h=s.get(u)||[];h.push(c),s.set(u,h)}})}let a=e.draftLocations_.get(t)??Px;for(let s of a)$a(o,s,r,i)}function Nx(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!Xa(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let a=Yl(i);Nm(e,i.draft_??i,a,r),Fm(i,o)})}function Fm(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let o=n.getPath(e);o&&n.generatePatches_(e,o,t)}Pm(e)}}function Fx(e,t,r){let{scope_:n}=e;if(ft(r)){let o=r[We];Xa(o,n)&&o.callbacks_.push(function(){Ba(e);let a=Yl(o);Nm(e,r,a,t)})}else ut(r)&&e.callbacks_.push(function(){let i=sr(e);e.type_===3?i.has(r)&&Wa(r,n.handledSet_,n):ar(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Wa(ar(e.copy_,t,e.type_),n.handledSet_,n)})}function Wa(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||ft(e)||t.has(e)||!ut(e)||Ya(e)||(t.add(e),wi(e,(n,o)=>{if(ft(o)){let i=o[We];if(Xa(i,r)){let a=Yl(i);$a(e,n,a,e.type_),Pm(i)}}else ut(o)&&Wa(o,t,r)})),e}function Dx(e,t){let r=Ai(e),n={type_:r?1:0,scope_:t?t.scope_:Om(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=n,i=Ka;r&&(o=[n],i=vi);let{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,[s,n]}var Ka={get(e,t){if(t===We)return e;let r=e.scope_.arrayMethodsPlugin_,n=e.type_===1&&typeof t=="string";if(n&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let o=sr(e);if(!Xn(o,t,e.type_))return qx(e,o,t);let i=o[t];if(e.finalized_||!ut(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Ex(t))return i;if(i===Bl(e.base_,t)||Mx(e,t,i)){Ba(e);let a=e.type_===1?+t:t,s=Wl(e.scope_,i,e,a);return e.copy_[a]=s}return i},has(e,t){return t in sr(e)},ownKeys(e){return Reflect.ownKeys(sr(e))},set(e,t,r){let n=Dm(sr(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Bl(sr(e),t),i=o?.[We];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(Cx(r,o)&&(r!==void 0||Xn(e.base_,t,e.type_)))return!0;Ba(e),zl(e)}return e.copy_[t]===r&&(r!==void 0||Xn(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Fx(e,t,r)),!0},deleteProperty(e,t){return Ba(e),Bl(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),zl(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=sr(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Va]:!0,[Gl]:e.type_!==1||t!=="length",[Ga]:n[Ga],[hi]:r[t]}},defineProperty(){tt(11)},getPrototypeOf(e){return tn(e.base_)},setPrototypeOf(){tt(12)}},vi={};for(let e in Ka){let t=Ka[e];vi[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}vi.deleteProperty=function(e,t){return vi.set.call(this,e,t,void 0)};vi.set=function(e,t,r){return Ka.set.call(this,e[0],t,r,e[0])};function Bl(e,t){let r=e[We];return(r?sr(r):e)[t]}function Mx(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!ut(r)||r[We]?!1:e.baseRefs_.has(r)}function qx(e,t,r){let n=Dm(t,r);return n?hi in n?n[hi]:n.get?.call(e.draft_):void 0}function Dm(e,t){if(!(t in e))return;let r=tn(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=tn(r)}}function zl(e){e.modified_||(e.modified_=!0,e.parent_&&zl(e.parent_))}function Ba(e){e.copy_||(e.assigned_=new Map,e.copy_=$l(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var jx=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(en(t)&&!en(r)){let i=r;r=t;let a=this;return function(c=i,...u){return a.produce(c,h=>r.call(this,h,...u))}}en(r)||tt(6),n!==void 0&&!en(n)&&tt(7);let o;if(ut(t)){let i=Rm(this),a=Wl(i,t,void 0),s=!0;try{o=r(a),s=!1}finally{s?Ql(i):Hl(i)}return Em(i,n),Im(o,i)}else if(!t||!Zn(t)){if(o=r(t),o===void 0&&(o=t),o===Kl&&(o=void 0),this.autoFreeze_&&Xl(o,!0),n){let i=[],a=[];nn(Ha).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:a}),n(i,a)}return o}else tt(1,t)},this.produceWithPatches=(t,r)=>{if(en(t))return(a,...s)=>this.produceWithPatches(a,c=>t(c,...s));let n,o;return[this.produce(t,r,(a,s)=>{n=a,o=s}),n,o]},Vl(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Vl(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Vl(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ut(e)||tt(8),ft(e)&&(e=Za(e));let t=Rm(this),r=Wl(t,e,void 0);return r[We].isManual_=!0,Hl(t),r}finishDraft(e,t){let r=e&&e[We];(!r||!r.isManual_)&&tt(9);let{scope_:n}=r;return Em(n,t),Im(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let o=t[r];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}r>-1&&(t=t.slice(r+1));let n=nn(Ha).applyPatches_;return ft(e)?n(e,t):this.produce(e,o=>n(o,t))}};function Wl(e,t,r,n){let[o,i]=xi(t)?nn(Qa).proxyMap_(t,r):Ci(t)?nn(Qa).proxySet_(t,r):Dx(t,r);return(r?.scope_??Om()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?Nx(r,i,n):i.callbacks_.push(function(c){c.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:u}=c;i.modified_&&u&&u.generatePatches_(i,[],c)}),o}function Za(e){return ft(e)||tt(10,e),Mm(e)}function Mm(e){if(!ut(e)||Ya(e))return e;let t=e[We],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=$l(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=$l(e,!0);return wi(r,(o,i)=>{$a(r,o,Mm(i))},n),t&&(t.finalized_=!1),r}function qm(){function t(y,S=[]){if(y.key_!==void 0){let E=y.parent_.copy_??y.parent_.base_,R=Rx(ar(E,y.key_)),k=ar(E,y.key_);if(k===void 0||k!==y.draft_&&k!==y.base_&&k!==y.copy_||R!=null&&R.base_!==y.base_)return null;let I=y.parent_.type_===3,T;if(I){let _=y.parent_;T=Array.from(_.drafts_.keys()).indexOf(y.key_)}else T=y.key_;if(!(I&&E.size>T||Xn(E,T)))return null;S.push(T)}if(y.parent_)return t(y.parent_,S);S.reverse();try{r(y.copy_,S)}catch{return null}return S}function r(y,S){let E=y;for(let R=0;R<S.length-1;R++){let k=S[R];if(E=ar(E,k),!Zn(E)||E===null)throw new Error(`Cannot resolve path at '${S.join("/")}'`)}return E}let n="replace",o="add",i="remove";function a(y,S,E){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:R,inversePatches_:k}=E;switch(y.type_){case 0:case 2:return c(y,S,R,k);case 1:return s(y,S,R,k);case 3:return u(y,S,R,k)}}function s(y,S,E,R){let{base_:k,assigned_:I}=y,T=y.copy_;T.length<k.length&&([k,T]=[T,k],[E,R]=[R,E]);let _=y.allIndicesReassigned_===!0;for(let D=0;D<k.length;D++){let G=T[D],V=k[D];if((_||I?.get(D.toString()))&&G!==V){let L=G?.[We];if(L&&L.modified_)continue;let q=S.concat([D]);E.push({op:n,path:q,value:g(G)}),R.push({op:n,path:q,value:g(V)})}}for(let D=k.length;D<T.length;D++){let G=S.concat([D]);E.push({op:o,path:G,value:g(T[D])})}for(let D=T.length-1;k.length<=D;--D){let G=S.concat([D]);R.push({op:i,path:G})}}function c(y,S,E,R){let{base_:k,copy_:I,type_:T}=y;wi(y.assigned_,(_,D)=>{let G=ar(k,_,T),V=ar(I,_,T),j=D?Xn(k,_)?n:o:i;if(G===V&&j===n)return;let L=S.concat(_);E.push(j===i?{op:j,path:L}:{op:j,path:L,value:g(V)}),R.push(j===o?{op:i,path:L}:j===i?{op:o,path:L,value:g(G)}:{op:n,path:L,value:g(G)})})}function u(y,S,E,R){let{base_:k,copy_:I}=y,T=0;k.forEach(_=>{if(!I.has(_)){let D=S.concat([T]);E.push({op:i,path:D,value:_}),R.unshift({op:o,path:D,value:_})}T++}),T=0,I.forEach(_=>{if(!k.has(_)){let D=S.concat([T]);E.push({op:o,path:D,value:_}),R.unshift({op:i,path:D,value:_})}T++})}function h(y,S,E){let{patches_:R,inversePatches_:k}=E;R.push({op:n,path:[],value:S===Kl?void 0:S}),k.push({op:n,path:[],value:y})}function v(y,S){return S.forEach(E=>{let{path:R,op:k}=E,I=y;for(let G=0;G<R.length-1;G++){let V=rn(I),j=R[G];typeof j!="string"&&typeof j!="number"&&(j=""+j),(V===0||V===1)&&(j==="__proto__"||j===gi)&&tt(19),en(I)&&j===bi&&tt(19),I=ar(I,j),(I===null||!Zn(I))&&tt(18,R.join("/"))}let T=rn(I),_=C(E.value),D=R[R.length-1];switch(k){case n:switch(T){case 2:return I.set(D,_);case 3:tt(16);default:return I[D]=_}case o:switch(T){case 1:return D==="-"?I.push(_):I.splice(D,0,_);case 2:return I.set(D,_);case 3:return I.add(_);default:return I[D]=_}case i:switch(T){case 1:return I.splice(D,1);case 2:return I.delete(D);case 3:return I.delete(E.value);default:return delete I[D]}default:tt(17,k)}}),y}function C(y){if(!ut(y))return y;if(Ai(y))return y.map(C);if(xi(y))return new Map(Array.from(y.entries()).map(([E,R])=>[E,C(R)]));if(Ci(y))return new Set(Array.from(y).map(C));let S=Object.create(tn(y));for(let E in y)S[E]=C(y[E]);return Xn(y,mi)&&(S[mi]=y[mi]),S}function g(y){return ft(y)?C(y):y}Tx(Ha,{applyPatches_:v,generatePatches_:a,generateReplacementPatches_:h,getPath:t})}var Lx=w.Iterator,rq=typeof Lx?.from=="function";var Si=new jx,on=Si.produce,Zl=Si.produceWithPatches.bind(Si);var Jl=Si.applyPatches.bind(Si);m();d();f();p();function Ux(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Vx(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){let r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var jm=e=>Array.isArray(e)?e:[e];function Bx(e){let t=Array.isArray(e[0])?e[0]:e;return Vx(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Gx(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var $x=class{constructor(e){this.value=e}deref(){return this.value}},Qx=()=>typeof WeakRef>"u"?$x:WeakRef,Um=Qx(),Hx=0,Lm=1;function Ja(){return{s:Hx,v:void 0,o:null,p:null}}function zx(e){return e instanceof Um?e.deref():e}function Ei(e,t={}){let r=Ja(),{resultEqualityCheck:n}=t,o,i=0;function a(){let s=r,{length:c}=arguments;for(let v=0,C=c;v<C;v++){let g=arguments[v];if(typeof g=="function"||typeof g=="object"&&g!==null){let y=s.o;y===null&&(s.o=y=new WeakMap);let S=y.get(g);S===void 0?(s=Ja(),y.set(g,s)):s=S}else{let y=s.p;y===null&&(s.p=y=new Map);let S=y.get(g);S===void 0?(s=Ja(),y.set(g,s)):s=S}}let u=s,h;if(s.s===Lm)h=s.v;else if(h=e.apply(null,arguments),i++,n){let v=zx(o);v!=null&&n(v,h)&&(h=v,i!==0&&i--),o=typeof h=="object"&&h!==null||typeof h=="function"?new Um(h):h}return u.s=Lm,u.v=h,h}return a.clearCache=()=>{r=Ja(),a.resetResultsCount()},a.resultsCount=()=>i,a.resetResultsCount=()=>{i=0},a}function Wx(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,a=0,s,c={},u=o.pop();typeof u=="object"&&(c=u,u=o.pop()),Ux(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);let h={...r,...c},{memoize:v,memoizeOptions:C=[],argsMemoize:g=Ei,argsMemoizeOptions:y=[]}=h,S=jm(C),E=jm(y),R=Bx(o),k=v(function(){return i++,u.apply(null,arguments)},...S),I=!0,T=g(function(){a++;let D=Gx(R,arguments);return s=k.apply(null,D),s},...E);return Object.assign(T,{resultFunc:u,memoizedResultFunc:k,dependencies:R,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>s,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:g})};return Object.assign(n,{withTypes:()=>n}),n}var $e=Wx(Ei);m();d();f();p();function Vm(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var Bm=Vm(),Gm=Vm;var Kx=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?pi:pi.apply(null,arguments)},Rq=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},Yx=e=>e&&typeof e.match=="function";function O(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(mt(0));return{type:e,payload:o.payload,...("meta"in o&&{meta:o.meta}),...("error"in o&&{error:o.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>fi(n)&&n.type===e,r}var Xm=class Ri extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Ri.prototype)}static get[Symbol.species](){return Ri}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Ri(...t[0].concat(this)):new Ri(...t.concat(this))}};function $m(e){return ut(e)?on(e,()=>{}):e}function es(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function Xx(e){return typeof e=="boolean"}var Zx=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new Xm;return r&&(Xx(r)?a.push(Bm):a.push(Gm(r.extraArgument))),a},Ii="RTK_autoBatch",to=()=>e=>({payload:e,meta:{[Ii]:!0}}),Qm=e=>t=>{setTimeout(t,e)},Jx=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(i),clearTimeout(a),r())},i=e(o),a=setTimeout(o,t)},eC=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,a=!1,s=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?Jx(window.requestAnimationFrame,100):Qm(10):e.type==="callback"?e.queueNotification:Qm(e.timeout),u=()=>{a=!1,i&&(i=!1,s.forEach(h=>h()))};return Object.assign({},n,{subscribe(h){let v=()=>o&&h(),C=n.subscribe(v);return s.add(h),()=>{C(),s.delete(h)}},dispatch(h){try{return o=!h?.meta?.[Ii],i=!o,i&&(a||(a=!0,c(u))),n.dispatch(h)}finally{o=!0}}})},tC=e=>function(r){let{autoBatch:n=!0}=r??{},o=new Xm(e);return n&&o.push(eC(typeof n=="object"?n:void 0)),o};function Zm(e){let t=Zx(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:a=void 0,enhancers:s=void 0}=e||{},c;if(typeof r=="function")c=r;else if(Ht(r))c=Yn(r);else throw new Error(mt(1));let u;typeof n=="function"?u=n(t):u=t();let h=pi;o&&(h=Kx({trace:!1,...(typeof o=="object"&&o)}));let v=wm(...u),C=tC(v),g=typeof s=="function"?s(C):C(),y=h(...g);return Ul(c,a,y)}function Jm(e){let t={},r=[],n,o={addCase(i,a){let s=typeof i=="string"?i:i.type;if(!s)throw new Error(mt(28));if(s in t)throw new Error(mt(29));return t[s]=a,o},addAsyncThunk(i,a){return a.pending&&(t[i.pending.type]=a.pending),a.rejected&&(t[i.rejected.type]=a.rejected),a.fulfilled&&(t[i.fulfilled.type]=a.fulfilled),a.settled&&r.push({matcher:i.settled,reducer:a.settled}),o},addMatcher(i,a){return r.push({matcher:i,reducer:a}),o},addDefaultCase(i){return n=i,o}};return e(o),[t,r,n]}function rC(e){return typeof e=="function"}function Be(e,t){let[r,n,o]=Jm(t),i;if(rC(e))i=()=>$m(e());else{let s=$m(e);i=()=>s}function a(s=i(),c){let u=[r[c.type],...n.filter(({matcher:h})=>h(c)).map(({reducer:h})=>h)];return u.filter(h=>!!h).length===0&&(u=[o]),u.reduce((h,v)=>{if(v)if(ft(h)){let g=v(h,c);return g===void 0?h:g}else{if(ut(h))return on(h,C=>v(C,c));{let C=v(h,c);if(C===void 0){if(h===null)return h;throw Error("A case reducer on a non-draftable value must not return undefined")}return C}}return h},s)}return a.getInitialState=i,a}var eg=(e,t)=>Yx(e)?e.match(t):e(t);function zt(...e){return t=>e.some(r=>eg(r,t))}function eo(...e){return t=>e.every(r=>eg(r,t))}function os(e,t){if(!e||!e.meta)return!1;let r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function Ti(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function is(...e){return e.length===0?t=>os(t,["pending"]):Ti(e)?zt(...e.map(t=>t.pending)):is()(e[0])}function sn(...e){return e.length===0?t=>os(t,["rejected"]):Ti(e)?zt(...e.map(t=>t.rejected)):sn()(e[0])}function _i(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?eo(sn(...e),t):Ti(e)?eo(sn(...e),t):_i()(e[0])}function cr(...e){return e.length===0?t=>os(t,["fulfilled"]):Ti(e)?zt(...e.map(t=>t.fulfilled)):cr()(e[0])}function as(...e){return e.length===0?t=>os(t,["pending","fulfilled","rejected"]):Ti(e)?zt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):as()(e[0])}var nC="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",ki=(e=21)=>{let t="",r=e;for(;r--;)t+=nC[Math.random()*64|0];return t},oC=["name","message","stack","code"],ed=class{constructor(e,t){ae(this,"payload");ae(this,"meta");ae(this,"_type");this.payload=e,this.meta=t}},Hm=class{constructor(e,t){ae(this,"payload");ae(this,"meta");ae(this,"_type");this.payload=e,this.meta=t}},iC=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of oC)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},zm="External signal was aborted",Ie=(()=>{function e(t,r,n){let o=O(t+"/fulfilled",(c,u,h,v)=>({payload:c,meta:{...(v||{}),arg:h,requestId:u,requestStatus:"fulfilled"}})),i=O(t+"/pending",(c,u,h)=>({payload:void 0,meta:{...(h||{}),arg:u,requestId:c,requestStatus:"pending"}})),a=O(t+"/rejected",(c,u,h,v,C)=>({payload:v,error:(n&&n.serializeError||iC)(c||"Rejected"),meta:{...(C||{}),arg:h,requestId:u,rejectedWithValue:!!v,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function s(c,{signal:u}={}){return(h,v,C)=>{let g=n?.idGenerator?n.idGenerator(c):ki(),y=new l.AbortController,S,E;function R(I){E=I,y.abort()}u&&(u.aborted?R(zm):u.addEventListener("abort",()=>R(zm),{once:!0}));let k=_asyncToGenerator(function*(){let I;try{let _=n?.condition?.(c,{getState:v,extra:C});if(sC(_)&&(_=yield _),_===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let D=new Promise((G,V)=>{S=()=>{V({name:"AbortError",message:E||"Aborted"})},y.signal.addEventListener("abort",S,{once:!0})});h(i(g,c,n?.getPendingMeta?.({requestId:g,arg:c},{getState:v,extra:C}))),I=yield Promise.race([D,Promise.resolve(r(c,{dispatch:h,getState:v,extra:C,requestId:g,signal:y.signal,abort:R,rejectWithValue:(G,V)=>new ed(G,V),fulfillWithValue:(G,V)=>new Hm(G,V)})).then(G=>{if(G instanceof ed)throw G;return G instanceof Hm?o(G.payload,g,c,G.meta):o(G,g,c)})])}catch(_){I=_ instanceof ed?a(null,g,c,_.payload,_.meta):a(_,g,c)}finally{S&&y.signal.removeEventListener("abort",S)}return n&&!n.dispatchConditionRejection&&a.match(I)&&I.meta.condition||h(I),I})();return Object.assign(k,{abort:R,requestId:g,arg:c,unwrap(){return k.then(aC)}})}}return Object.assign(s,{pending:i,rejected:a,fulfilled:o,settled:zt(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function aC(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function sC(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var tg=Symbol.for("rtk-slice-createasyncthunk"),Tq={[tg]:Ie};function cC(e,t){return`${e}/${t}`}function uC({creators:e}={}){let t=e?.asyncThunk?.[tg];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(mt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(dC()):n.reducers)||{},s=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(I,T){let _=typeof I=="string"?I:I.type;if(!_)throw new Error(mt(12));if(_ in c.sliceCaseReducersByType)throw new Error(mt(13));return c.sliceCaseReducersByType[_]=T,u},addMatcher(I,T){return c.sliceMatchers.push({matcher:I,reducer:T}),u},exposeAction(I,T){return c.actionCreators[I]=T,u},exposeCaseReducer(I,T){return c.sliceCaseReducersByName[I]=T,u}};s.forEach(I=>{let T=a[I],_={reducerName:I,type:cC(o,I),createNotation:typeof n.reducers=="function"};fC(T)?gC(_,T,u,t):pC(_,T,u)});function h(){let[I={},T=[],_=void 0]=typeof n.extraReducers=="function"?Jm(n.extraReducers):[n.extraReducers],D={...I,...c.sliceCaseReducersByType};return Be(n.initialState,G=>{for(let V in D)G.addCase(V,D[V]);for(let V of c.sliceMatchers)G.addMatcher(V.matcher,V.reducer);for(let V of T)G.addMatcher(V.matcher,V.reducer);_&&G.addDefaultCase(_)})}let v=I=>I,C=new Map,g=new WeakMap,y;function S(I,T){return y||(y=h()),y(I,T)}function E(){return y||(y=h()),y.getInitialState()}function R(I,T=!1){function _(G){let V=G[I];return typeof V>"u"&&T&&(V=es(g,_,E)),V}function D(G=v){let V=es(C,T,()=>new WeakMap);return es(V,G,()=>{let j={};for(let[L,q]of Object.entries(n.selectors??{}))j[L]=lC(q,G,()=>es(g,G,E),T);return j})}return{reducerPath:I,getSelectors:D,get selectors(){return D(_)},selectSlice:_}}let k={name:o,reducer:S,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:E,...R(i),injectInto(I,{reducerPath:T,..._}={}){let D=T??i;return I.inject({reducerPath:D,reducer:S},_),{...k,...R(D,!0)}}};return k}}function lC(e,t,r,n){function o(i,...a){let s=t(i);return typeof s>"u"&&n&&(s=r()),e(s,...a)}return o.unwrapped=e,o}var cn=uC();function dC(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function pC({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!mC(n))throw new Error(mt(17));i=n.reducer,a=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?O(e,a):O(e))}function fC(e){return e._reducerDefinitionType==="asyncThunk"}function mC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function gC({type:e,reducerName:t},r,n,o){if(!o)throw new Error(mt(18));let{payloadCreator:i,fulfilled:a,pending:s,rejected:c,settled:u,options:h}=r,v=o(e,i,h);n.exposeAction(t,v),a&&n.addCase(v.fulfilled,a),s&&n.addCase(v.pending,s),c&&n.addCase(v.rejected,c),u&&n.addMatcher(v.settled,u),n.exposeCaseReducer(t,{fulfilled:a||ts,pending:s||ts,rejected:c||ts,settled:u||ts})}function ts(){}var hC="task",rg="listener",ng="completed",nd="cancelled",yC=`task-${nd}`,vC=`task-${ng}`,td=`${rg}-${nd}`,SC=`${rg}-${ng}`,ss=class{constructor(e){ae(this,"code");ae(this,"name","TaskAbortError");ae(this,"message");this.code=e,this.message=`${hC} ${nd} (reason: ${e})`}},od=(e,t)=>{if(typeof e!="function")throw new TypeError(mt(32))},rs=()=>{},og=(e,t=rs)=>(e.catch(t),e),ig=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),an=e=>{if(e.aborted)throw new ss(e.reason)};function ag(e,t){let r=rs;return new Promise((n,o)=>{let i=()=>o(new ss(e.reason));if(e.aborted){i();return}r=ig(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=rs})}var bC=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof ss?"cancelled":"rejected",error:r}}finally{t?.()}});return function bC(_x5,_x6){return _ref5.apply(this,arguments)}}(),ns=e=>t=>og(ag(e,t).then(r=>(an(e),r))),sg=e=>{let t=ns(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Jn}=Object,Wm={},cs="listenerMiddleware",wC=(e,t)=>{let r=n=>ig(e,()=>n.abort(e.reason));return(n,o)=>{od(n,"taskExecutor");let i=new l.AbortController;r(i);let a=bC(/*#__PURE__*/_asyncToGenerator(function*(){an(e),an(i.signal);let s=yield n({pause:ns(i.signal),delay:sg(i.signal),signal:i.signal});return an(i.signal),s}),()=>i.abort(vC));return o?.autoJoin&&t.push(a.catch(rs)),{result:ns(e)(a),cancel(){i.abort(yC)}}}},AC=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){an(t);let i=()=>{},s=[new Promise((c,u)=>{let h=e({predicate:n,effect:(v,C)=>{C.unsubscribe(),c([v,C.getState(),C.getOriginalState()])}});i=()=>{h(),u()}})];o!=null&&s.push(new Promise(c=>setTimeout(c,o,null)));try{let c=yield ag(t,Promise.race(s));return an(t),c}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>og(r(n,o))},cg=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=O(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(mt(21));return od(i,"options.listener"),{predicate:o,type:t,effect:i}},ug=Jn(e=>{let{type:t,predicate:r,effect:n}=cg(e);return{id:ki(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(mt(22))}}},{withTypes:()=>ug}),Km=(e,t)=>{let{type:r,effect:n,predicate:o}=cg(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},rd=e=>{e.pending.forEach(t=>{t.abort(td)})},xC=(e,t)=>()=>{for(let r of t.keys())rd(r);e.clear()},Ym=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},lg=Jn(O(`${cs}/add`),{withTypes:()=>lg}),CC=O(`${cs}/removeAll`),dg=Jn(O(`${cs}/remove`),{withTypes:()=>dg}),EC=(...e)=>{console.error(`${cs}/error`,...e)},pg=(e={})=>{let t=new Map,r=new Map,n=g=>{let y=r.get(g)??0;r.set(g,y+1)},o=g=>{let y=r.get(g)??1;y===1?r.delete(g):r.set(g,y-1)},{extra:i,onError:a=EC}=e;od(a,"onError");let s=g=>(g.unsubscribe=()=>t.delete(g.id),t.set(g.id,g),y=>{g.unsubscribe(),y?.cancelActive&&rd(g)}),c=g=>{let y=Km(t,g)??ug(g);return s(y)};Jn(c,{withTypes:()=>c});let u=g=>{let y=Km(t,g);return y&&(y.unsubscribe(),g.cancelActive&&rd(y)),!!y};Jn(u,{withTypes:()=>u});let h=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(g,y,S,E){let R=new l.AbortController,k=AC(c,R.signal),I=[];try{g.pending.add(R),n(g),yield Promise.resolve(g.effect(y,Jn({},S,{getOriginalState:E,condition:(T,_)=>k(T,_).then(Boolean),take:k,delay:sg(R.signal),pause:ns(R.signal),extra:i,signal:R.signal,fork:wC(R.signal,I),unsubscribe:g.unsubscribe,subscribe:()=>{t.set(g.id,g)},cancelActiveListeners:()=>{g.pending.forEach((T,_,D)=>{T!==R&&(T.abort(td),D.delete(T))})},cancel:()=>{R.abort(td),g.pending.delete(R)},throwIfCancelled:()=>{an(R.signal)}})))}catch(T){T instanceof ss||Ym(a,T,{raisedBy:"effect"})}finally{yield Promise.all(I),R.abort(SC),o(g),g.pending.delete(R)}});return function h(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),v=xC(t,r);return{middleware:g=>y=>S=>{if(!fi(S))return y(S);if(lg.match(S))return c(S.payload);if(CC.match(S)){v();return}if(dg.match(S))return u(S.payload);let E=g.getState(),R=()=>{if(E===Wm)throw new Error(mt(23));return E},k;try{if(k=y(S),t.size>0){let I=g.getState(),T=Array.from(t.values());for(let _ of T){let D=!1;try{D=_.predicate(S,I,E)}catch(G){D=!1,Ym(a,G,{raisedBy:"predicate"})}D&&h(_,S,g,R)}}}finally{E=Wm}return k},startListening:c,stopListening:u,clearListeners:v}};function mt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}m();d();f();p();var Y=new z({required:!0,emptyAllowed:!1}),rt=new z({required:!1,emptyAllowed:!1}),nt=new z({required:!0,emptyAllowed:!0}),Uq=new z({required:!1,emptyAllowed:!0}),us=new Se({each:Y,required:!0}),fg=new z({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),mg=new z({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Vq=new z({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),ur=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),Tt=(e,t)=>{if("required"in t)return{payload:new ht({value:t}).validate({value:e}).value};let o=new ne({options:{required:!0},values:t}).validate(e);if(o)throw new si(o);return{payload:e}},B=(e,t)=>{try{return Tt(e,t)}catch(r){return{payload:e,error:ur(r)}}},gg=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return yg(e,t,r,o,"Controller initialization error")},hg=(e,t,r,n)=>{let o=`Check the options of ${n}`;return yg(e,t,r,o,"Controller initialization error")},yg=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};m();d();f();p();var ro="3.55.4",vg=["@coveo/atomic","@coveo/quantic"];var id=()=>rt,Sg=()=>Y,Er=O("configuration/updateBasicConfiguration",e=>B(e,{accessToken:rt,environment:new z({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:rt})),Wt=O("configuration/updateSearchConfiguration",e=>B(e,{proxyBaseUrl:new z({required:!1,url:!0}),pipeline:new z({required:!1,emptyAllowed:!0}),searchHub:rt,timezone:rt,locale:rt,authenticationProviders:new Se({required:!1,each:Y})})),RC={enabled:new fe({default:!0}),originContext:id(),originLevel2:id(),originLevel3:id(),proxyBaseUrl:new z({required:!1,url:!0}),runtimeEnvironment:new De,anonymous:new fe({default:!1}),deviceId:rt,userDisplayName:rt,documentLocation:rt,trackingId:mg,analyticsMode:new z({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new ne({options:{required:!1},values:vg.reduce((e,t)=>(e[t]=fg,e),{})})},no=O("configuration/updateAnalyticsConfiguration",e=>B(e,RC)),oo=O("configuration/analytics/disable"),io=O("configuration/analytics/enable"),ls=O("configuration/analytics/originlevel2",e=>B(e,{originLevel2:Sg()})),ds=O("configuration/analytics/originlevel3",e=>B(e,{originLevel3:Sg()})),bg=O("knowledge/setAgentId",e=>B(e,new z({required:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var wg={q:new z,enableQuerySyntax:new fe,aq:new z,cq:new z,firstResult:new oe({min:0}),numberOfResults:new oe({min:0}),sortCriteria:new z,f:new ne,fExcluded:new ne,cf:new ne,nf:new ne,mnf:new ne,df:new ne,debug:new fe,sf:new ne,tab:new z,af:new ne};var Rr=O("searchParameters/restore",e=>B(e,wg)),Ag=O("searchParameters/restoreTab",e=>B(e,Y));m();d();f();p();var ps=O("debug/enable"),fs=O("debug/disable");m();d();f();p();var ms=()=>!1;var gs=Be(ms(),e=>{e.addCase(ps,()=>!0).addCase(fs,()=>!1).addCase(Rr,(t,r)=>r.payload.debug??t)});m();d();f();p();var ao=O("pipeline/set",e=>B(e,new z({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();var IC=O("history/undo"),TC=O("history/redo"),Kt=O("history/snapshot"),Yj=Ie("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(IC()),yield t(vt())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),Xj=Ie("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(TC()),yield t(vt())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),vt=Ie("history/change",/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x15,_x16){return _ref1.apply(this,arguments)}}());m();d();f();p();var Ir=()=>"";var so=Be(Ir(),e=>{e.addCase(ao,(t,r)=>r.payload).addCase(vt.fulfilled,(t,r)=>r.payload?.pipeline??t).addCase(Wt,(t,r)=>r.payload.pipeline||t)});m();d();f();p();m();d();f();p();var hs=O("app/setError");m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function _C(){return typeof navigator<"u"}function xg(){try{return typeof localStorage<"u"}catch{return!1}}function Cg(){try{return typeof sessionStorage<"u"}catch{return!1}}function Eg(){return _C()&&navigator.cookieEnabled}m();d();f();p();var co=class e{static set(t,r,n){var o,i,a,s;n&&(i=new Date,i.setTime(i.getTime()+n)),s=window.location.hostname,s.indexOf(".")===-1?Rg(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],Rg(t,r,i,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function Rg(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function Ig(){return xg()?localStorage:Eg()?new ys:Cg()?sessionStorage:new ad}var ys=class e{getItem(t){return co.get(`${e.prefix}${t}`)}removeItem(t){co.erase(`${e.prefix}${t}`)}setItem(t,r,n){co.set(`${e.prefix}${t}`,r,n)}};ys.prefix="coveo_";var ad=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var vs="__coveo.analytics.history",kC=20,OC=1e3*60,PC=75,Ss=class{constructor(t){this.store=t||Ig()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _this9=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this9.cropQueryElement(_this9.stripEmptyQuery(t));let r=yield _this9.getHistoryWithInternalTimeAsync();r!=null?_this9.isValidEntry(t)&&_this9.setHistory([t].concat(r)):_this9.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this0=this;return _asyncToGenerator(function*(){let t=yield _this0.getHistoryWithInternalTimeAsync();return _this0.stripEmptyQueries(_this0.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(vs);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this1=this;return _asyncToGenerator(function*(){try{let t=yield _this1.store.getItem(vs);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(vs,JSON.stringify(t.slice(0,kC)))}catch{}}clear(){try{this.store.removeItem(vs)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,PC)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>OC:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var un=class un extends Ss{static getInstance(t){return un.instance||(un.instance=new un(t)),un.instance}constructor(t){super(t)}};ae(un,"instance",null);var gt=un;m();d();f();p();m();d();f();p();var uo=$e(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${ro}`));m();d();f();p();m();d();f();p();function lr(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function U(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(h){try{u(n.next(h))}catch(v){a(v)}}function c(h){try{u(n.throw(h))}catch(v){a(v)}}function u(h){h.done?i(h.value):o(h.value).then(s,c)}u((n=n.apply(e,t||[])).next())})}var Ae;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(Ae||(Ae={}));function ud(){return typeof window<"u"}function Ad(){return typeof navigator<"u"}function lo(){return typeof document<"u"}function ld(){try{return typeof localStorage<"u"}catch{return!1}}function NC(){try{return typeof sessionStorage<"u"}catch{return!1}}function Ug(){return Ad()&&navigator.cookieEnabled}var FC=[Ae.click,Ae.custom,Ae.search,Ae.view],DC=(e,t)=>FC.indexOf(e)!==-1?Object.assign({language:lo()?document.documentElement.lang:"unknown",userAgent:Ad()?navigator.userAgent:"unknown"},t):t,Pi=class e{static set(t,r,n){var o,i,a,s;n&&(i=new Date,i.setTime(i.getTime()+n)),s=window.location.hostname,s.indexOf(".")===-1?Tg(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],Tg(t,r,i,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function Tg(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function MC(){return ld()?localStorage:Ug()?new Ni:NC()?sessionStorage:new fo}var Ni=class e{getItem(t){return Pi.get(`${e.prefix}${t}`)}removeItem(t){Pi.erase(`${e.prefix}${t}`)}setItem(t,r,n){Pi.set(`${e.prefix}${t}`,r,n)}};Ni.prefix="coveo_";var dd=class{constructor(){this.cookieStorage=new Ni}getItem(t){return localStorage.getItem(t)||this.cookieStorage.getItem(t)}removeItem(t){this.cookieStorage.removeItem(t),localStorage.removeItem(t)}setItem(t,r){localStorage.setItem(t,r),this.cookieStorage.setItem(t,r,31556926e3)}},fo=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},bs="__coveo.analytics.history",qC=20,jC=1e3*60,LC=75,As=class{constructor(t){this.store=t||MC()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){return U(this,void 0,void 0,function*(){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=yield this.getHistoryWithInternalTimeAsync();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])})}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){return U(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(bs);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return U(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(bs);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(bs,JSON.stringify(t.slice(0,qC)))}catch{}}clear(){try{this.store.removeItem(bs)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,LC)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>jC:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var UC=(e,t)=>U(void 0,void 0,void 0,function*(){return e===Ae.view?(yield VC(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),VC=e=>U(void 0,void 0,void 0,function*(){let t=new As,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),BC=/^(?:[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 xs(e){return typeof e=="string"&&BC.test(e)}function _g(e){if(!xs(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var ot=[];for(let e=0;e<256;++e)ot.push((e+256).toString(16).slice(1));function Vg(e,t=0){return(ot[e[t+0]]+ot[e[t+1]]+ot[e[t+2]]+ot[e[t+3]]+"-"+ot[e[t+4]]+ot[e[t+5]]+"-"+ot[e[t+6]]+ot[e[t+7]]+"-"+ot[e[t+8]]+ot[e[t+9]]+"-"+ot[e[t+10]]+ot[e[t+11]]+ot[e[t+12]]+ot[e[t+13]]+ot[e[t+14]]+ot[e[t+15]]).toLowerCase()}var GC=new Uint8Array(16);function $C(){return crypto.getRandomValues(GC)}function QC(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}var HC="6ba7b810-9dad-11d1-80b4-00c04fd430c8",zC="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function WC(e,t,r,n,o,i){let a=typeof r=="string"?QC(r):r,s=typeof n=="string"?_g(n):n;if(typeof n=="string"&&(n=_g(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+a.length);return c.set(s),c.set(a,s.length),c=t(c),c[6]=c[6]&15|e,c[8]=c[8]&63|128,Vg(c)}function ln(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():KC(e,t,r)}function KC(e,t,r){e=e||{};let n=e.random??e.rng?.()??$C();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return Vg(n)}function YC(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function sd(e,t){return e<<t|e>>>32-t}function XC(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,i=Math.ceil(o/16),a=new Array(i);for(let s=0;s<i;++s){let c=new Uint32Array(16);for(let u=0;u<16;++u)c[u]=e[s*64+u*4]<<24|e[s*64+u*4+1]<<16|e[s*64+u*4+2]<<8|e[s*64+u*4+3];a[s]=c}a[i-1][14]=(e.length-1)*8/2**32,a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=(e.length-1)*8&4294967295;for(let s=0;s<i;++s){let c=new Uint32Array(80);for(let y=0;y<16;++y)c[y]=a[s][y];for(let y=16;y<80;++y)c[y]=sd(c[y-3]^c[y-8]^c[y-14]^c[y-16],1);let u=r[0],h=r[1],v=r[2],C=r[3],g=r[4];for(let y=0;y<80;++y){let S=Math.floor(y/20),E=sd(u,5)+YC(S,h,v,C)+g+t[S]+c[y]>>>0;g=C,C=v,v=sd(h,30)>>>0,h=u,u=E}r[0]=r[0]+u>>>0,r[1]=r[1]+h>>>0,r[2]=r[2]+v>>>0,r[3]=r[3]+C>>>0,r[4]=r[4]+g>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function Cs(e,t,r,n){return WC(80,XC,e,t)}Cs.DNS=HC;Cs.URL=zC;var Bg="2.33.0",kg=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Oi={pageview:"pageview",event:"event"},Es=class{constructor({client:t,uuidGenerator:r=ln}){this.client=t,this.uuidGenerator=r}},pd=class extends Es{constructor({client:t,uuidGenerator:r=ln}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=kg(window.location),this.lastReferrer=lo()?document.referrer:"",this.addHooks()}getApi(t){return t==="setAction"?this.setAction:null}setAction(t,r){this.action=t,this.actionData=r}clearData(){this.clearPluginData(),this.action=void 0,this.actionData={}}getLocationInformation(t,r){return Object.assign({hitType:t},this.getNextValues(t,r))}updateLocationInformation(t,r){this.updateLocationForNextPageView(t,r)}getDefaultContextInformation(t){let r={title:lo()?document.title:"",encoding:lo()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},i={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},i),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:i}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=i,t===Oi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===Oi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Oi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Oi.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=o=>o.replace(/^\/?(.*)$/,"/$1");return`${(o=>o.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return kg(window.location)}},Tr=class e{constructor(t,r){if(!xs(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(r/1e3)}toString(){return this.clientId.replace(/-/g,"")+"."+this.creationDate.toString()}get expired(){let t=Math.floor(Date.now()/1e3)-this.creationDate;return t<0||t>e.expirationTime}validate(t,r){return!this.expired&&this.matchReferrer(t,r)}matchReferrer(t,r){try{let n=new URL(t);return r.some(o=>new RegExp(o.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(n.host))}catch{return!1}}static fromString(t){let r=t.split(".");if(r.length!==2)return null;let[n,o]=r;if(n.length!==32||isNaN(parseInt(o)))return null;let i=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return xs(i)?new e(i,Number.parseInt(o)*1e3):null}};Tr.cvo_cid="cvo_cid";Tr.expirationTime=120;var fd=class extends Es{constructor({client:t,uuidGenerator:r=ln}){super({client:t,uuidGenerator:r})}getApi(t){switch(t){case"decorate":return this.decorate;case"acceptFrom":return this.acceptFrom;default:return null}}decorate(t){return U(this,void 0,void 0,function*(){if(!this.client.getCurrentVisitorId)throw new Error("Could not retrieve current clientId");try{let r=new URL(t),n=yield this.client.getCurrentVisitorId();return r.searchParams.set(Tr.cvo_cid,new Tr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};fd.Id="link";var kt=Object.keys;function ws(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var cd=128,Gg=192,Og=224,Pg=240;function ZC(e){return(e&248)===Pg?4:(e&Pg)===Og?3:(e&Og)===Gg?2:1}function JC(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&cd)!=cd)break;if(r-=3,(n&Gg)!=cd){t-r>=ZC(n)*3&&(r=t);break}}return e.substring(0,r)}var md={id:"svc_ticket_id",subject:"svc_ticket_subject",description:"svc_ticket_description",category:"svc_ticket_category",productId:"svc_ticket_product_id",custom:"svc_ticket_custom"},eE=kt(md).map(e=>md[e]),tE=[...eE].join("|"),rE=new RegExp(`^(${tE}$)`),nE={svcAction:"svc_action",svcActionData:"svc_action_data"},oE=e=>kt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=md[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),iE=e=>rE.test(e),aE=[iE],Ng={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Fg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},lt={action:"pa",list:"pal",listSource:"pls"},Rs={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},sE=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],gd={id:"quoteId",affiliation:"quoteAffiliation"},hd={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},cE={add:lt,bookmark_add:lt,bookmark_remove:lt,click:lt,checkout:lt,checkout_option:lt,detail:lt,impression:lt,remove:lt,refund:Object.assign(Object.assign({},lt),Rs),purchase:Object.assign(Object.assign({},lt),Rs),quickview:lt,quote:Object.assign(Object.assign({},lt),gd),review:Object.assign(Object.assign({},lt),hd)},uE=kt(Ng).map(e=>Ng[e]),lE=kt(Fg).map(e=>Fg[e]),dE=kt(lt).map(e=>lt[e]),pE=kt(Rs).map(e=>Rs[e]),fE=kt(hd).map(e=>hd[e]),mE=kt(gd).map(e=>gd[e]),gE=[...uE,"custom"].join("|"),hE=[...lE,"custom"].join("|"),$g="(pr[0-9]+)",Qg="(il[0-9]+pi[0-9]+)",yE=new RegExp(`^${$g}(${gE})$`),vE=new RegExp(`^(${Qg}(${hE}))|(il[0-9]+nm)$`),SE=new RegExp(`^(${dE.join("|")})$`),bE=new RegExp(`^(${pE.join("|")})$`),wE=new RegExp(`^${$g}custom$`),AE=new RegExp(`^${Qg}custom$`),xE=new RegExp(`^(${[...sE,...fE,...mE].join("|")})$`),CE=e=>yE.test(e),EE=e=>vE.test(e),RE=e=>SE.test(e),IE=e=>bE.test(e),TE=e=>xE.test(e),_E=[EE,CE,RE,IE,TE],kE=[wE,AE],OE={anonymizeIp:"aip"},PE={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},NE={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},FE=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],DE=Object.assign(Object.assign(Object.assign(Object.assign({},OE),PE),NE),FE.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),yd=Object.assign(Object.assign({},DE),nE),ME=e=>{let t=!!e.action&&cE[e.action]||{};return kt(e).reduce((r,n)=>{let o=t[n]||yd[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},qE=kt(yd).map(e=>yd[e]),jE=e=>qE.indexOf(e)!==-1,LE=e=>e==="custom",UE=e=>[..._E,...aE,jE,LE].some(t=>t(e)),VE=e=>kt(e).reduce((t,r)=>{let n=BE(r);return n?Object.assign(Object.assign({},t),GE(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),BE=e=>{let t;return[...kE].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},GE=(e,t)=>kt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),vd=class{constructor(t){this.opts=t}sendEvent(t,r){return U(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:o}=this.opts,i=yield this.getQueryParamsForEventType(t),{url:a,payload:s}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),c=this.encodeForEventType(t,s),u=new Blob([c],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(a,u)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return U(this,void 0,void 0,function*(){let o=t,i=r;if(n){let a=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:s,body:c}=a;o=s||t;try{i=JSON.parse(c)}catch(u){console.error("Unable to process the request body as a JSON string",u)}}return{payload:i,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return U(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(i=>!!i).join("&")})}isEventTypeLegacy(t){return[Ae.click,Ae.custom,Ae.search,Ae.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let o=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(o=`access_token=${encodeURIComponent(n)}&${o}`),o}},Sd=class{sendEvent(t,r){return U(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){return Promise.resolve()})}},Dg=w.fetch,Is=class{constructor(t){this.opts=t}sendEvent(t,r){return U(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:i}=this.opts,a=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",s={url:`${n}/analytics/${t}${a}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},c=Object.assign(Object.assign({},s),i?yield i(s,"analyticsFetch"):{}),{url:u}=c,h=lr(c,["url"]),v;try{v=yield Dg(u,h)}catch(C){console.error("An error has occurred when sending the event.",C);return}if(v.ok){let C=yield v.json();return C.visitorId&&o.setCurrentVisitorId(C.visitorId),C}else{try{v.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,v,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield Dg(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[Ae.click,Ae.custom,Ae.search,Ae.view].indexOf(t)!==-1}getVisitorIdParam(){return U(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,r=yield t.getCurrentVisitorId();return r?`?visitor=${r}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},bd=class{constructor(t,r){ld()&&Ug()?this.storage=new dd:ld()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new fo),this.client=new Is(t),this.beaconClient=new vd(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:i}of n)this.beaconClient.sendEvent(o,i)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},wd=class{constructor(t,r){this.storage=r||new fo,this.client=new Is(t)}getClientDependingOnEventType(t){return this.client}},Ts=class{constructor(){this.storage=new fo,this.client=new Sd}getClientDependingOnEventType(t){return this.client}},$E="xx",QE=e=>e?.startsWith($E)||!1,HE=`
|
|
27
|
+
`;return new fi(r)}var fi=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},yt=class{constructor(e){ue(this,"definition");this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let i=this.definition[o].validate(r[o]);i&&n.push(`${o}: ${i}`)}if(n.length)throw Hw(n,t);return r}get default(){let e={};for(let t in this.definition){let r=this.definition[t].default;r!==void 0&&(e[t]=r)}return e}},qe=class{constructor(e={}){ue(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&ce(e)?"value is required.":null}get default(){return this.baseConfig.default instanceof Function?this.baseConfig.default():this.baseConfig.default}get required(){return this.baseConfig.required===!0}};function Je(e){return e===void 0}function zw(e){return e===null}function ce(e){return Je(e)||zw(e)}var me=class{constructor(e={}){ue(this,"value");this.value=new qe(e)}validate(e){let t=this.value.validate(e);return t||(Ww(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function Ww(e){return Je(e)||sm(e)}function sm(e){return typeof e=="boolean"}var oe=class{constructor(e={}){ue(this,"config");ue(this,"value");this.config=e,this.value=new qe(e)}validate(e){let t=this.value.validate(e);return t||(Kw(e)?e<this.config.min?`minimum value of ${this.config.min} not respected.`:e>this.config.max?`maximum value of ${this.config.max} not respected.`:null:"value is not a number.")}get default(){return this.value.default}get required(){return this.value.required}};function Kw(e){return Je(e)||cm(e)}function cm(e){return typeof e=="number"&&!Number.isNaN(e)}var Yw=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,z=class{constructor(e={}){ue(this,"value");ue(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new qe(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:i}=this.config,a=this.value.validate(e);if(a)return a;if(Je(e))return null;if(!Fa(e))return"value is not a string.";if(!t&&!e.length)return"value is an empty string.";if(r)try{new URL(e)}catch{return"value is not a valid URL."}return n&&!n.test(e)?`value did not match provided regex ${n}`:o&&!o.includes(e)?`value should be one of: ${o.join(", ")}.`:i&&!(Yw.test(e)&&new Date(e).toString()!=="Invalid Date")?"value is not a valid ISO8601 date string":null}get default(){return this.value.default}get required(){return this.value.required}};function Fa(e){return Object.prototype.toString.call(e)==="[object String]"}var ne=class{constructor(e={}){ue(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Je(e))return this.config.options.required?"value is required and is currently undefined":null;if(!um(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ce(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],i=n.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function um(e){return e!==void 0&&typeof e=="object"}var Ae=class{constructor(e={}){ue(this,"config");ue(this,"value");this.config=e,this.value=new qe(this.config)}validate(e){if(!ce(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ce(e))return null;if(this.config.max!==void 0&&e.length>this.config.max)return`value contains more than ${this.config.max}`;if(this.config.min!==void 0&&e.length<this.config.min)return`value contains less than ${this.config.min}`;if(this.config.each!==void 0){let r="";return e.forEach(n=>{this.config.each.required&&ce(n)&&(r=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(n,this.config.each);o!==null&&(r+=` ${o}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return sm(e)||Fa(e)||cm(e)||um(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function lm(e){return Array.isArray(e)}var Ll=class{constructor(e){ue(this,"config");ue(this,"value");this.config=e,this.value=new qe(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Je(e)||Object.values(this.config.enum).find(n=>n===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();f();p();function dm(e){return Array.isArray(e)}function Da(e){return e.trim()===""}var Xw=new Set(["1",1,"yes",!0]);function ql(){if(typeof navigator>"u"||typeof window>"u")return!1;let e=navigator,t=window;return[e.globalPrivacyControl,e.doNotTrack,e.msDoNotTrack,t.doNotTrack].some(r=>Xw.has(r))}function pm(e){let t={};for(let[r,n]of e)t[r]=n;return t}function mi(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Ma(e,t,r={}){let n;return(...o)=>{let i=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,o)},t),i)return e.apply(void 0,o)}}function Zw(e){if(Da(e.openingDelimiter)||Da(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(ce(e.content)||Da(e.content))return e.content;if(e.highlights.length===0)return Yn(e.content);let t=e.content.length,r="",n=0;for(let o=0;o<e.highlights.length;o++){let i=e.highlights[o],a=i.offset,s=a+i.length;if(s>t)break;r+=Yn(e.content.slice(n,a)),r+=e.openingDelimiter,r+=Yn(e.content.slice(a,s)),r+=e.closingDelimiter,n=s}return n!==t&&(r+=Yn(e.content.slice(n))),r}function Jw(e,t){return e=Yn(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?jl(n,t.notMatchDelimiters):o?jl(o,t.exactMatchDelimiters):i?jl(i,t.correctionDelimiters):r)}function jl(e,t){return t?t.open+e+t.close:e}function Yn(e){let t={"&":"&","<":"<",">":">","\"":""","'":"'","`":"`"},r=`(?:${Object.keys(t).join("|")})`,n=RegExp(r),o=RegExp(r,"g");return n.test(e)?e.replace(o,i=>t[i]):e}m();d();f();p();var Cm=jt(bm(),1);m();d();f();p();var Ht=new Error("Failed to load reducers."),Xn=class extends Error{constructor(){super(),this.name="UnauthorizedTokenError",this.message="The token being used to perform the request is unauthorized. It may be expired or invalid."}},rn=class extends Error{constructor(r,n){super();ue(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};m();d();f();p();function Am(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function wm(e){return typeof e!="object"||!e?!1:Object.values(e).every(Ex)}function Ex(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function xm(e){return e===429}var Ut=class e{static call(t){return _asyncToGenerator(function*(){let r=Rx(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:i,...a}=o,s=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let u=yield C(i,a);if(xm(u.status))throw u;return u});return function s(){return _ref.apply(this,arguments)}}();try{let u=yield(0,Cm.backOff)(s,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(c){let g=c&&xm(c.status);return g&&(n.info("Platform retrying request"),yield new Promise(v=>setTimeout(v,1e3))),g});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(u.status){case 419:case 401:throw n.info("Platform renewing token"),new Xn;case 404:throw new rn(i,u.status);default:return n.info({response:u,requestInfo:o},"Platform response"),u}}catch(u){return u.message==="Failed to fetch"?new rn(i):u}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:s,...u}=t,c=mi(u);try{let g=yield o(t,n,a);return{...t,...g}}catch(g){i.error(g,"Platform request preprocessing failed. Returning default request options.")}return c})()}};function _t(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Zn(e,t,r="prod"){return e??_t(t,r)}function xr(e,t="prod"){return`${_t(e,t)}/rest/search/v2`}function qa(e,t="prod"){return`${_t(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function Rx(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,s=e.method==="POST"||e.method==="PUT",u=Ix(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(s&&{body:u}),signal:a}}function Ix(e,t){return t==="application/x-www-form-urlencoded"?wm(e)?Am(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();var ja=e=>e;m();d();f();p();m();d();f();p();function Ua(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function zt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Ua(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Ua(),extendedResults:{},searchAction:void 0}}m();d();f();p();function Cr(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Er=e=>{let{response:t}=e;return t.body?Tx(e):_x(t)},Tx=e=>Ox(e)?Px(e):kx(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},_x=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function kx(e){return e.body.statusCode!==void 0}function Ox(e){return e.body.exception!==void 0}var Px=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();var Rr=class{constructor(){ue(this,"currentAbortController",null)}enqueue(t,r){var _this=this;return _asyncToGenerator(function*(){let n=_this.currentAbortController;_this.currentAbortController=new l.AbortController;let o=_this.currentAbortController;n&&(r.warnOnAbort&&r.logger.warn("Cancelling current pending search query"),n.abort());try{return yield t(o?.signal??null)}finally{_this.currentAbortController===o&&(_this.currentAbortController=null)}})()}};m();d();f();p();m();d();f();p();var yi=class{constructor(t){ue(this,"_basePath");ue(this,"_params",{});this._basePath=t}addParam(t,r){this._params={...this.params,[t]:r}}get basePath(){return this._basePath}get params(){return this._params}get hasParams(){return Object.entries(this._params).length}get href(){return this.hasParams?`${this.basePath}?${Object.entries(this.params).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}`:this.basePath}};m();d();f();p();function Em(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var sr=(e,t,r,n)=>{let o=new yi(`${e.url}${n}`);return o.addParam("organizationId",e.organizationId),e.authentication&&o.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:o.href,origin:"searchApiFetch"}};var Rm=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Ut.call({...sr(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Cr(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Em(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return Nx(a)?{success:a}:{error:Er({response:r,body:a})}});return function Rm(_x3,_x4){return _ref3.apply(this,arguments)}}();function Nx(e){return typeof e=="string"}m();d();f();p();function Fx(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function Dx(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Va(e,t){if(t&&e.name==="AbortError")return{error:Dx(e)};if(e instanceof rn)return{error:Fx(e)};throw e}var Ga=class{constructor(t){ue(this,"options",t);ue(this,"apiCallsQueues",{unknown:new Rr,mainSearch:new Rr,facetValues:new Rr,foldingCollection:new Rr,instantResults:new Rr})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json","/plan"),requestParams:Cr(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return Va(r);let n=yield r.json();return Lx(n)?{success:n}:{error:Er({response:r,body:n})}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:Cr(t),..._this3.options});if(r instanceof Error)return Va(r);let n=yield r.json(),o={response:r,body:n};return Mx(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:Er(o)}})()}search(t,r){var _this4=this;return _asyncToGenerator(function*(){let n=r?.origin??"unknown",o=yield _this4.apiCallsQueues[n].enqueue(s=>Ut.call({...sr(t,"POST","application/json",""),requestParams:Cr(t),requestMetadata:{method:"search",origin:r?.origin},..._this4.options,signal:s??void 0}),{logger:_this4.options.logger,warnOnAbort:!r?.disableAbortWarning});if(o instanceof Error)return Va(o,r?.disableAbortWarning);let i=yield o.json(),a={response:o,body:i};return Im(i)?(a.body=Tm(i),{success:(yield _this4.options.postprocessSearchResponseMiddleware(a)).body}):{error:Er(a)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json","/facet"),requestParams:Cr(t),requestMetadata:{method:"facetSearch"},..._this5.options});if(r instanceof Error)throw r;let n=yield r.json(),o={response:r,body:n};return(yield _this5.options.postprocessFacetSearchResponseMiddleware(o)).body})()}recommendations(t){var _this6=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json",""),requestParams:Cr(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if(Im(n)){let o={response:r,body:n};return o.body=Tm(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:Er({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return Rm(t,{..._this7.options})})()}fieldDescriptions(t){var _this8=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},..._this8.options});if(r instanceof Error)throw r;let n=yield r.json();return qx(n)?{success:n}:{error:Er({response:r,body:n})}})()}},Ba=e=>e.success!==void 0,vt=e=>e.error!==void 0;function Im(e){return e.results!==void 0}function Tm(e){let t=Ua();return ce(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function Mx(e){return e.completions!==void 0}function Lx(e){return e.preprocessingOutput!==void 0}function qx(e){return e.fields!==void 0}m();d();f();p();var _m=e=>e,km=e=>e,Om=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();function et(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var jx=typeof Symbol=="function"&&Symbol.observable||"@@observable",Pm=jx,Kl=()=>Math.random().toString(36).substring(7).split("").join("."),Ux={INIT:`@@redux/INIT${Kl()}`,REPLACE:`@@redux/REPLACE${Kl()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Kl()}`},$a=Ux;function Wt(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Yl(e,t,r){if(typeof e!="function")throw new Error(et(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(et(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(et(1));return r(Yl)(e,t)}let n=e,o=t,i=new Map,a=i,s=0,u=!1;function c(){a===i&&(a=new Map,i.forEach((x,I)=>{a.set(I,x)}))}function g(){if(u)throw new Error(et(3));return o}function v(x){if(typeof x!="function")throw new Error(et(4));if(u)throw new Error(et(5));let I=!0;c();let _=s++;return a.set(_,x),function(){if(I){if(u)throw new Error(et(6));I=!1,c(),a.delete(_),i=null}}}function R(x){if(!Wt(x))throw new Error(et(7));if(typeof x.type>"u")throw new Error(et(8));if(typeof x.type!="string")throw new Error(et(17));if(u)throw new Error(et(9));try{u=!0,o=n(o,x)}finally{u=!1}return(i=a).forEach(_=>{_()}),x}function h(x){if(typeof x!="function")throw new Error(et(10));n=x,R({type:$a.REPLACE})}function y(){let x=v;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(et(11));function _(){let P=I;P.next&&P.next(g())}return _(),{unsubscribe:x(_)}},[Pm](){return this}}}return R({type:$a.INIT}),{dispatch:R,subscribe:v,getState:g,replaceReducer:h,[Pm]:y}}function Vx(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:$a.INIT})>"u")throw new Error(et(12));if(typeof r(void 0,{type:$a.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(et(13))})}function Jn(e){let t=Object.keys(e),r={};for(let a=0;a<t.length;a++){let s=t[a];typeof e[s]=="function"&&(r[s]=e[s])}let n=Object.keys(r),o,i;try{Vx(r)}catch(a){i=a}return function(s={},u){if(i)throw i;let c=!1,g={};for(let v=0;v<n.length;v++){let R=n[v],h=r[R],y=s[R],b=h(y,u);if(typeof b>"u"){let x=u&&u.type;throw new Error(et(14))}g[R]=b,c=c||b!==y}return c=c||n.length!==Object.keys(s).length,c?g:s}}function vi(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Nm(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(et(15))},a={getState:o.getState,dispatch:(u,...c)=>i(u,...c)},s=e.map(u=>u(a));return i=vi(...s)(o.dispatch),{...o,dispatch:i}}}function Si(e){return Wt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var id=Symbol.for("immer-nothing"),bi=Symbol.for("immer-draftable"),Ke=Symbol.for("immer-state");function tt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ct=Object,on=Ct.getPrototypeOf,Ai="constructor",Ri="prototype",Jl="configurable",Wa="enumerable",Ha="writable",wi="value",mt=e=>!!e&&!!e[Ke];function lt(e){return e?Vm(e)||Ti(e)||!!e[bi]||!!e[Ai]?.[bi]||_i(e)||ki(e):!1}var Gx=Ct[Ri][Ai].toString(),Fm=new WeakMap;function Vm(e){if(!e||!to(e))return!1;let t=on(e);if(t===null||t===Ct[Ri])return!0;let r=Ct.hasOwnProperty.call(t,Ai)&&t[Ai];if(r===Object)return!0;if(!nn(r))return!1;let n=Fm.get(r);return n===void 0&&(n=Function.toString.call(r),Fm.set(r,n)),n===Gx}function Gm(e){return mt(e)||tt(15,e),e[Ke].base_}function Ii(e,t,r=!0){an(e)===0?(r?Reflect.ownKeys(e):Ct.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function an(e){let t=e[Ke];return t?t.type_:Ti(e)?1:_i(e)?2:ki(e)?3:0}var eo=(e,t,r=an(e))=>r===2?e.has(t):Ct[Ri].hasOwnProperty.call(e,t),cr=(e,t,r=an(e))=>r===2?e.get(t):e[t],Ka=(e,t,r,n=an(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function Bx(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ti=Array.isArray,_i=e=>e instanceof Map,ki=e=>e instanceof Set,to=e=>typeof e=="object",nn=e=>typeof e=="function",Xl=e=>typeof e=="boolean";function $x(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Qx=e=>to(e)?e?.[Ke]:null,ur=e=>e.copy_||e.base_;var ad=e=>e.modified_?e.copy_:e.base_;function ed(e,t){if(_i(e))return new Map(e);if(ki(e))return new Set(e);if(Ti(e))return Array[Ri].slice.call(e);let r=Vm(e);if(t===!0||t==="class_only"&&!r){let n=Ct.getOwnPropertyDescriptors(e);delete n[Ke];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],s=n[a];s[Ha]===!1&&(s[Ha]=!0,s[Jl]=!0),(s.get||s.set)&&(n[a]={[Jl]:!0,[Ha]:!0,[Wa]:s[Wa],[wi]:e[a]})}return Ct.create(on(e),n)}else{let n=on(e);if(n!==null&&r)return{...e};let o=Ct.create(n);return Ct.assign(o,e)}}function sd(e,t=!1){return ts(e)||mt(e)||!lt(e)||(an(e)>1&&Ct.defineProperties(e,{set:Qa,add:Qa,clear:Qa,delete:Qa}),Ct.freeze(e),t&&Ii(e,(r,n)=>{sd(n,!0)},!1)),e}function Hx(){tt(2)}var Qa={[wi]:Hx};function ts(e){return e===null||!to(e)?!0:Ct.isFrozen(e)}var Ya="MapSet",Xa="Patches",Dm="ArrayMethods",Za={};function sn(e){let t=Za[e];return t||tt(0,e),t}var Mm=e=>!!Za[e];function zx(e,t){Za[e]||(Za[e]=t)}var xi,Bm=()=>xi,Wx=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Mm(Ya)?sn(Ya):void 0,arrayMethodsPlugin_:Mm(Dm)?sn(Dm):void 0});function Lm(e,t){t&&(e.patchPlugin_=sn(Xa),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function td(e){rd(e),e.drafts_.forEach(Kx),e.drafts_=null}function rd(e){e===xi&&(xi=e.parent_)}var qm=e=>xi=Wx(xi,e);function Kx(e){let t=e[Ke];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function jm(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[Ke].modified_&&(td(t),tt(4)),lt(e)&&(e=Um(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[Ke].base_,e,t)}else e=Um(t,r);return Yx(t,e,!0),td(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==id?e:void 0}function Um(e,t){if(ts(t))return t;let r=t[Ke];if(!r)return Ja(t,e.handledSet_,e);if(!rs(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){let{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);Hm(r,e)}return r.copy_}function Yx(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&sd(t,r)}function $m(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var rs=(e,t)=>e.scope_===t,Xx=[];function Qm(e,t,r,n){let o=ur(e),i=e.type_;if(n!==void 0&&cr(o,n,i)===t){Ka(o,n,r,i);return}if(!e.draftLocations_){let s=e.draftLocations_=new Map;Ii(o,(u,c)=>{if(mt(c)){let g=s.get(c)||[];g.push(u),s.set(c,g)}})}let a=e.draftLocations_.get(t)??Xx;for(let s of a)Ka(o,s,r,i)}function Zx(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!rs(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let a=ad(i);Qm(e,i.draft_??i,a,r),Hm(i,o)})}function Hm(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let o=n.getPath(e);o&&n.generatePatches_(e,o,t)}$m(e)}}function Jx(e,t,r){let{scope_:n}=e;if(mt(r)){let o=r[Ke];rs(o,n)&&o.callbacks_.push(function(){za(e);let a=ad(o);Qm(e,r,a,t)})}else lt(r)&&e.callbacks_.push(function(){let i=ur(e);e.type_===3?i.has(r)&&Ja(r,n.handledSet_,n):cr(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Ja(cr(e.copy_,t,e.type_),n.handledSet_,n)})}function Ja(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||mt(e)||t.has(e)||!lt(e)||ts(e)||(t.add(e),Ii(e,(n,o)=>{if(mt(o)){let i=o[Ke];if(rs(i,r)){let a=ad(i);Ka(e,n,a,e.type_),$m(i)}}else lt(o)&&Ja(o,t,r)})),e}function eC(e,t){let r=Ti(e),n={type_:r?1:0,scope_:t?t.scope_:Bm(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=n,i=es;r&&(o=[n],i=Ci);let{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,[s,n]}var es={get(e,t){if(t===Ke)return e;let r=e.scope_.arrayMethodsPlugin_,n=e.type_===1&&typeof t=="string";if(n&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let o=ur(e);if(!eo(o,t,e.type_))return rC(e,o,t);let i=o[t];if(e.finalized_||!lt(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&$x(t))return i;if(i===Zl(e.base_,t)||tC(e,t,i)){za(e);let a=e.type_===1?+t:t,s=od(e.scope_,i,e,a);return e.copy_[a]=s}return i},has(e,t){return t in ur(e)},ownKeys(e){return Reflect.ownKeys(ur(e))},set(e,t,r){let n=zm(ur(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Zl(ur(e),t),i=o?.[Ke];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(Bx(r,o)&&(r!==void 0||eo(e.base_,t,e.type_)))return!0;za(e),nd(e)}return e.copy_[t]===r&&(r!==void 0||eo(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Jx(e,t,r)),!0},deleteProperty(e,t){return za(e),Zl(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),nd(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=ur(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Ha]:!0,[Jl]:e.type_!==1||t!=="length",[Wa]:n[Wa],[wi]:r[t]}},defineProperty(){tt(11)},getPrototypeOf(e){return on(e.base_)},setPrototypeOf(){tt(12)}},Ci={};for(let e in es){let t=es[e];Ci[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Ci.deleteProperty=function(e,t){return Ci.set.call(this,e,t,void 0)};Ci.set=function(e,t,r){return es.set.call(this,e[0],t,r,e[0])};function Zl(e,t){let r=e[Ke];return(r?ur(r):e)[t]}function tC(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!lt(r)||r[Ke]?!1:e.baseRefs_.has(r)}function rC(e,t,r){let n=zm(t,r);return n?wi in n?n[wi]:n.get?.call(e.draft_):void 0}function zm(e,t){if(!(t in e))return;let r=on(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=on(r)}}function nd(e){e.modified_||(e.modified_=!0,e.parent_&&nd(e.parent_))}function za(e){e.copy_||(e.assigned_=new Map,e.copy_=ed(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var nC=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(nn(t)&&!nn(r)){let i=r;r=t;let a=this;return function(u=i,...c){return a.produce(u,g=>r.call(this,g,...c))}}nn(r)||tt(6),n!==void 0&&!nn(n)&&tt(7);let o;if(lt(t)){let i=qm(this),a=od(i,t,void 0),s=!0;try{o=r(a),s=!1}finally{s?td(i):rd(i)}return Lm(i,n),jm(o,i)}else if(!t||!to(t)){if(o=r(t),o===void 0&&(o=t),o===id&&(o=void 0),this.autoFreeze_&&sd(o,!0),n){let i=[],a=[];sn(Xa).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:a}),n(i,a)}return o}else tt(1,t)},this.produceWithPatches=(t,r)=>{if(nn(t))return(a,...s)=>this.produceWithPatches(a,u=>t(u,...s));let n,o;return[this.produce(t,r,(a,s)=>{n=a,o=s}),n,o]},Xl(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Xl(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Xl(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){lt(e)||tt(8),mt(e)&&(e=ns(e));let t=qm(this),r=od(t,e,void 0);return r[Ke].isManual_=!0,rd(t),r}finishDraft(e,t){let r=e&&e[Ke];(!r||!r.isManual_)&&tt(9);let{scope_:n}=r;return Lm(n,t),jm(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let o=t[r];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}r>-1&&(t=t.slice(r+1));let n=sn(Xa).applyPatches_;return mt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function od(e,t,r,n){let[o,i]=_i(t)?sn(Ya).proxyMap_(t,r):ki(t)?sn(Ya).proxySet_(t,r):eC(t,r);return(r?.scope_??Bm()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?Zx(r,i,n):i.callbacks_.push(function(u){u.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:c}=u;i.modified_&&c&&c.generatePatches_(i,[],u)}),o}function ns(e){return mt(e)||tt(10,e),Wm(e)}function Wm(e){if(!lt(e)||ts(e))return e;let t=e[Ke],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=ed(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=ed(e,!0);return Ii(r,(o,i)=>{Ka(r,o,Wm(i))},n),t&&(t.finalized_=!1),r}function Km(){function t(y,b=[]){if(y.key_!==void 0){let x=y.parent_.copy_??y.parent_.base_,I=Qx(cr(x,y.key_)),_=cr(x,y.key_);if(_===void 0||_!==y.draft_&&_!==y.base_&&_!==y.copy_||I!=null&&I.base_!==y.base_)return null;let T=y.parent_.type_===3,P;if(T){let A=y.parent_;P=Array.from(A.drafts_.keys()).indexOf(y.key_)}else P=y.key_;if(!(T&&x.size>P||eo(x,P)))return null;b.push(P)}if(y.parent_)return t(y.parent_,b);b.reverse();try{r(y.copy_,b)}catch{return null}return b}function r(y,b){let x=y;for(let I=0;I<b.length-1;I++){let _=b[I];if(x=cr(x,_),!to(x)||x===null)throw new Error(`Cannot resolve path at '${b.join("/")}'`)}return x}let n="replace",o="add",i="remove";function a(y,b,x){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:I,inversePatches_:_}=x;switch(y.type_){case 0:case 2:return u(y,b,I,_);case 1:return s(y,b,I,_);case 3:return c(y,b,I,_)}}function s(y,b,x,I){let{base_:_,assigned_:T}=y,P=y.copy_;P.length<_.length&&([_,P]=[P,_],[x,I]=[I,x]);let A=y.allIndicesReassigned_===!0;for(let O=0;O<_.length;O++){let k=P[O],N=_[O];if((A||T?.get(O.toString()))&&k!==N){let V=k?.[Ke];if(V&&V.modified_)continue;let j=b.concat([O]);x.push({op:n,path:j,value:h(k)}),I.push({op:n,path:j,value:h(N)})}}for(let O=_.length;O<P.length;O++){let k=b.concat([O]);x.push({op:o,path:k,value:h(P[O])})}for(let O=P.length-1;_.length<=O;--O){let k=b.concat([O]);I.push({op:i,path:k})}}function u(y,b,x,I){let{base_:_,copy_:T,type_:P}=y;Ii(y.assigned_,(A,O)=>{let k=cr(_,A,P),N=cr(T,A,P),M=O?eo(_,A)?n:o:i;if(k===N&&M===n)return;let V=b.concat(A);x.push(M===i?{op:M,path:V}:{op:M,path:V,value:h(N)}),I.push(M===o?{op:i,path:V}:M===i?{op:o,path:V,value:h(k)}:{op:n,path:V,value:h(k)})})}function c(y,b,x,I){let{base_:_,copy_:T}=y,P=0;_.forEach(A=>{if(!T.has(A)){let O=b.concat([P]);x.push({op:i,path:O,value:A}),I.unshift({op:o,path:O,value:A})}P++}),P=0,T.forEach(A=>{if(!_.has(A)){let O=b.concat([P]);x.push({op:o,path:O,value:A}),I.unshift({op:i,path:O,value:A})}P++})}function g(y,b,x){let{patches_:I,inversePatches_:_}=x;I.push({op:n,path:[],value:b===id?void 0:b}),_.push({op:n,path:[],value:y})}function v(y,b){return b.forEach(x=>{let{path:I,op:_}=x,T=y;for(let k=0;k<I.length-1;k++){let N=an(T),M=I[k];typeof M!="string"&&typeof M!="number"&&(M=""+M),(N===0||N===1)&&(M==="__proto__"||M===Ai)&&tt(19),nn(T)&&M===Ri&&tt(19),T=cr(T,M),(T===null||!to(T))&&tt(18,I.join("/"))}let P=an(T),A=R(x.value),O=I[I.length-1];switch(_){case n:switch(P){case 2:return T.set(O,A);case 3:tt(16);default:return T[O]=A}case o:switch(P){case 1:return O==="-"?T.push(A):T.splice(O,0,A);case 2:return T.set(O,A);case 3:return T.add(A);default:return T[O]=A}case i:switch(P){case 1:return T.splice(O,1);case 2:return T.delete(O);case 3:return T.delete(x.value);default:return delete T[O]}default:tt(17,_)}}),y}function R(y){if(!lt(y))return y;if(Ti(y))return y.map(R);if(_i(y))return new Map(Array.from(y.entries()).map(([x,I])=>[x,R(I)]));if(ki(y))return new Set(Array.from(y).map(R));let b=Object.create(on(y));for(let x in y)b[x]=R(y[x]);return eo(y,bi)&&(b[bi]=y[bi]),b}function h(y){return mt(y)?R(y):y}zx(Xa,{applyPatches_:v,generatePatches_:a,generateReplacementPatches_:g,getPath:t})}var oC=w.Iterator,ML=typeof oC?.from=="function";var Ei=new nC,cn=Ei.produce,cd=Ei.produceWithPatches.bind(Ei);var ud=Ei.applyPatches.bind(Ei);m();d();f();p();var iC=class{constructor(e){this.value=e}deref(){return this.value}},aC=()=>typeof WeakRef>"u"?iC:WeakRef,Xm=aC(),sC=0,os=1;function Oi(){return{s:sC,v:void 0,o:null,p:null}}function cC(e){return e instanceof Xm?e.deref():e}function ro(e,t={}){let r=Oi(),{resultEqualityCheck:n,maxSize:o}=t,i=o!==void 0;if(i&&(!Number.isInteger(o)||o<1))throw new TypeError(`maxSize must be a positive integer, received: ${o}`);let a=null,s=0,u,c=0,g=!1;function v(){s>=o&&(a=r,r=Oi(),s=0)}function R(){let h=r,{length:y}=arguments;for(let I=0,_=y;I<_;I++){let T=arguments[I];if(typeof T=="function"||typeof T=="object"&&T!==null){let P=h.o;P===null&&(h.o=P=new WeakMap);let A=P.get(T);A===void 0?(h=Oi(),P.set(T,h)):h=A}else{let P=h.p;P===null&&(h.p=P=new Map);let A=P.get(T);A===void 0?(h=Oi(),P.set(T,h),s++):h=A}}if(h.s===os)return h.v;if(a!==null){let I=a;for(let _=0,T=y;_<T;_++){let P=arguments[_],A;if(typeof P=="function"||typeof P=="object"&&P!==null){let O=I.o;A=O!==null?O.get(P):void 0}else{let O=I.p;A=O!==null?O.get(P):void 0}if(A===void 0){I=null;break}I=A}if(I!==null&&I.s===os){let _=h;return _.s=os,_.v=I.v,v(),I.v}}let b=h,x=e.apply(null,arguments);if(c++,n){let I=cC(u);I!=null&&n(I,x)&&(x=I,c!==0&&c--),u=typeof x=="object"&&x!==null||typeof x=="function"?new Xm(x):x}return b.s=os,b.v=x,i&&v(),x}return R.clearCache=()=>{r=Oi(),a=null,s=0,R.resetResultsCount()},R.resultsCount=()=>c,R.resetResultsCount=()=>{c=0},R}var ld=Symbol("NOT_FOUND");function uC(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function lC(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){let r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var Ym=e=>Array.isArray(e)?e:[e];function dC(e){let t=Array.isArray(e[0])?e[0]:e;return lC(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function is(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,a=0,s,u={},c=o.pop();typeof c=="object"&&(u=c,c=o.pop()),uC(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);let g={...r,...u},{memoize:v,memoizeOptions:R=[],argsMemoize:h=ro,argsMemoizeOptions:y=[]}=g,b=Ym(R),x=Ym(y),I=dC(o),_=v(function(){return i++,c.apply(null,arguments)},...b),T=!0,P=h(function(){a++;let{length:O}=I,k=new Array(O);for(let N=0;N<O;N++)k[N]=I[N].apply(null,arguments);return s=_.apply(null,k),s},...x);return Object.assign(P,{resultFunc:c,memoizedResultFunc:_,dependencies:I,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>s,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var ze=is(ro);function pC(e){let t;return{get(r){return t&&e(t.key,r)?t.value:ld},put(r,n){t={key:r,value:n}},findMatchingEntry(r,n){let o=t;return o!==void 0&&n(o.value,r)?o:void 0},clear(){t=void 0}}}function fC(e,t){let r=[];function n(s){let u=r.findIndex(c=>t(c.key,s));if(u>-1){let c=r[u];return u>0&&(r.splice(u,1),r.unshift(c)),c.value}return ld}function o(s,u){r.unshift({key:s,value:u}),r.length>e&&r.pop()}function i(s,u){let c=r,{length:g}=c;for(let v=0;v<g;v++){let R=c[v];if(u(R.value,s))return R}}function a(){r=[]}return{get:n,put:o,findMatchingEntry:i,clear:a}}var mC=(e,t)=>e===t;function gC(e){return function(r,n){if(r===null||n===null||r.length!==n.length)return!1;let{length:o}=r;for(let i=0;i<o;i++)if(!e(r[i],n[i]))return!1;return!0}}function dd(e,t){let r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:n=mC,maxSize:o=1,resultEqualityCheck:i}=r,a=gC(n),s=0,u=o<=1?pC(a):fC(o,a);function c(){let g=u.get(arguments);if(g===ld){if(g=e.apply(null,arguments),s++,i){let v=u.findMatchingEntry(g,i);v&&(g=v.value,s!==0&&s--)}u.put(arguments,g)}return g}return c.clearCache=()=>{u.clear(),c.resetResultsCount()},c.resultsCount=()=>s,c.resetResultsCount=()=>{s=0},c}m();d();f();p();function Zm(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var Jm=Zm(),eg=Zm;var hC=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?vi:vi.apply(null,arguments)},iq=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},yC=e=>e&&typeof e.match=="function";function L(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(gt(0));return{type:e,payload:o.payload,...("meta"in o&&{meta:o.meta}),...("error"in o&&{error:o.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Si(n)&&n.type===e,r}var cg=class Pi extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Pi.prototype)}static get[Symbol.species](){return Pi}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Pi(...t[0].concat(this)):new Pi(...t.concat(this))}};function tg(e){return lt(e)?cn(e,()=>{}):e}function as(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function vC(e){return typeof e=="boolean"}var SC=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new cg;return r&&(vC(r)?a.push(Jm):a.push(eg(r.extraArgument))),a},Ni="RTK_autoBatch",io=()=>e=>({payload:e,meta:{[Ni]:!0}}),rg=e=>t=>{setTimeout(t,e)},bC=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(i),clearTimeout(a),r())},i=e(o),a=setTimeout(o,t)},AC=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,a=!1,s=new Set,u=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?bC(window.requestAnimationFrame,100):rg(10):e.type==="callback"?e.queueNotification:rg(e.timeout),c=()=>{a=!1,i&&(i=!1,s.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let v=()=>o&&g(),R=n.subscribe(v);return s.add(g),()=>{R(),s.delete(g)}},dispatch(g){try{return o=!g?.meta?.[Ni],i=!o,i&&(a||(a=!0,u(c))),n.dispatch(g)}finally{o=!0}}})},wC=e=>function(r){let{autoBatch:n=!0}=r??{},o=new cg(e);return n&&o.push(AC(typeof n=="object"?n:void 0)),o};function ug(e){let t=SC(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:a=void 0,enhancers:s=void 0}=e||{},u;if(typeof r=="function")u=r;else if(Wt(r))u=Jn(r);else throw new Error(gt(1));let c;typeof n=="function"?c=n(t):c=t();let g=vi;o&&(g=hC({trace:!1,...(typeof o=="object"&&o)}));let v=Nm(...c),R=wC(v),h=typeof s=="function"?s(R):R(),y=g(...h);return Yl(u,a,y)}function lg(e){let t={},r=[],n,o={addCase(i,a){let s=typeof i=="string"?i:i.type;if(!s)throw new Error(gt(28));if(s in t)throw new Error(gt(29));return t[s]=a,o},addAsyncThunk(i,a){return a.pending&&(t[i.pending.type]=a.pending),a.rejected&&(t[i.rejected.type]=a.rejected),a.fulfilled&&(t[i.fulfilled.type]=a.fulfilled),a.settled&&r.push({matcher:i.settled,reducer:a.settled}),o},addMatcher(i,a){return r.push({matcher:i,reducer:a}),o},addDefaultCase(i){return n=i,o}};return e(o),[t,r,n]}function xC(e){return typeof e=="function"}function Be(e,t){let[r,n,o]=lg(t),i;if(xC(e))i=()=>tg(e());else{let s=tg(e);i=()=>s}function a(s=i(),u){let c=[r[u.type],...n.filter(({matcher:g})=>g(u)).map(({reducer:g})=>g)];return c.filter(g=>!!g).length===0&&(c=[o]),c.reduce((g,v)=>{if(v)if(mt(g)){let h=v(g,u);return h===void 0?g:h}else{if(lt(g))return cn(g,R=>v(R,u));{let R=v(g,u);if(R===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return R}}return g},s)}return a.getInitialState=i,a}var dg=(e,t)=>yC(e)?e.match(t):e(t);function Kt(...e){return t=>e.some(r=>dg(r,t))}function oo(...e){return t=>e.every(r=>dg(r,t))}function ls(e,t){if(!e||!e.meta)return!1;let r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function Fi(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function ds(...e){return e.length===0?t=>ls(t,["pending"]):Fi(e)?Kt(...e.map(t=>t.pending)):ds()(e[0])}function ln(...e){return e.length===0?t=>ls(t,["rejected"]):Fi(e)?Kt(...e.map(t=>t.rejected)):ln()(e[0])}function Di(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?oo(ln(...e),t):Fi(e)?oo(ln(...e),t):Di()(e[0])}function lr(...e){return e.length===0?t=>ls(t,["fulfilled"]):Fi(e)?Kt(...e.map(t=>t.fulfilled)):lr()(e[0])}function ps(...e){return e.length===0?t=>ls(t,["pending","fulfilled","rejected"]):Fi(e)?Kt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):ps()(e[0])}var CC="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Mi=(e=21)=>{let t="",r=e;for(;r--;)t+=CC[Math.random()*64|0];return t},EC=["name","message","stack","code"],pd=class{constructor(e,t){ue(this,"payload");ue(this,"meta");ue(this,"_type");this.payload=e,this.meta=t}},ng=class{constructor(e,t){ue(this,"payload");ue(this,"meta");ue(this,"_type");this.payload=e,this.meta=t}},RC=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of EC)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},og="External signal was aborted",ke=(()=>{function e(t,r,n){let o=L(t+"/fulfilled",(u,c,g,v)=>({payload:u,meta:{...(v||{}),arg:g,requestId:c,requestStatus:"fulfilled"}})),i=L(t+"/pending",(u,c,g)=>({payload:void 0,meta:{...(g||{}),arg:c,requestId:u,requestStatus:"pending"}})),a=L(t+"/rejected",(u,c,g,v,R)=>({payload:v,error:(n&&n.serializeError||RC)(u||"Rejected"),meta:{...(R||{}),arg:g,requestId:c,rejectedWithValue:!!v,requestStatus:"rejected",aborted:u?.name==="AbortError",condition:u?.name==="ConditionError"}}));function s(u,{signal:c}={}){return(g,v,R)=>{let h=n?.idGenerator?n.idGenerator(u):Mi(),y=new l.AbortController,b,x;function I(T){x=T,y.abort()}c&&(c.aborted?I(og):c.addEventListener("abort",()=>I(og),{once:!0}));let _=_asyncToGenerator(function*(){let T;try{let A=n?.condition?.(u,{getState:v,extra:R});if(TC(A)&&(A=yield A),A===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let O=new Promise((k,N)=>{b=()=>{N({name:"AbortError",message:x||"Aborted"})},y.signal.addEventListener("abort",b,{once:!0})});g(i(h,u,n?.getPendingMeta?.({requestId:h,arg:u},{getState:v,extra:R}))),T=yield Promise.race([O,Promise.resolve(r(u,{dispatch:g,getState:v,extra:R,requestId:h,signal:y.signal,abort:I,rejectWithValue:(k,N)=>new pd(k,N),fulfillWithValue:(k,N)=>new ng(k,N)})).then(k=>{if(k instanceof pd)throw k;return k instanceof ng?o(k.payload,h,u,k.meta):o(k,h,u)})])}catch(A){T=A instanceof pd?a(null,h,u,A.payload,A.meta):a(A,h,u)}finally{b&&y.signal.removeEventListener("abort",b)}return n&&!n.dispatchConditionRejection&&a.match(T)&&T.meta.condition||g(T),T})();return Object.assign(_,{abort:I,requestId:h,arg:u,unwrap(){return _.then(IC)}})}}return Object.assign(s,{pending:i,rejected:a,fulfilled:o,settled:Kt(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function IC(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function TC(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var pg=Symbol.for("rtk-slice-createasyncthunk"),sq={[pg]:ke};function _C(e,t){return`${e}/${t}`}function kC({creators:e}={}){let t=e?.asyncThunk?.[pg];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(gt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(PC()):n.reducers)||{},s=Object.keys(a),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(T,P){let A=typeof T=="string"?T:T.type;if(!A)throw new Error(gt(12));if(A in u.sliceCaseReducersByType)throw new Error(gt(13));return u.sliceCaseReducersByType[A]=P,c},addMatcher(T,P){return u.sliceMatchers.push({matcher:T,reducer:P}),c},exposeAction(T,P){return u.actionCreators[T]=P,c},exposeCaseReducer(T,P){return u.sliceCaseReducersByName[T]=P,c}};s.forEach(T=>{let P=a[T],A={reducerName:T,type:_C(o,T),createNotation:typeof n.reducers=="function"};FC(P)?MC(A,P,c,t):NC(A,P,c)});function g(){let[T={},P=[],A=void 0]=typeof n.extraReducers=="function"?lg(n.extraReducers):[n.extraReducers],O={...T,...u.sliceCaseReducersByType};return Be(n.initialState,k=>{for(let N in O)k.addCase(N,O[N]);for(let N of u.sliceMatchers)k.addMatcher(N.matcher,N.reducer);for(let N of P)k.addMatcher(N.matcher,N.reducer);A&&k.addDefaultCase(A)})}let v=T=>T,R=new Map,h=new WeakMap,y;function b(T,P){return y||(y=g()),y(T,P)}function x(){return y||(y=g()),y.getInitialState()}function I(T,P=!1){function A(k){let N=k[T];return typeof N>"u"&&P&&(N=as(h,A,x)),N}function O(k=v){let N=as(R,P,()=>new WeakMap);return as(N,k,()=>{let M={};for(let[V,j]of Object.entries(n.selectors??{}))M[V]=OC(j,k,()=>as(h,k,x),P);return M})}return{reducerPath:T,getSelectors:O,get selectors(){return O(A)},selectSlice:A}}let _={name:o,reducer:b,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:x,...I(i),injectInto(T,{reducerPath:P,...A}={}){let O=P??i;return T.inject({reducerPath:O,reducer:b},A),{..._,...I(O,!0)}}};return _}}function OC(e,t,r,n){function o(i,...a){let s=t(i);return typeof s>"u"&&n&&(s=r()),e(s,...a)}return o.unwrapped=e,o}var dn=kC();function PC(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function NC({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!DC(n))throw new Error(gt(17));i=n.reducer,a=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?L(e,a):L(e))}function FC(e){return e._reducerDefinitionType==="asyncThunk"}function DC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function MC({type:e,reducerName:t},r,n,o){if(!o)throw new Error(gt(18));let{payloadCreator:i,fulfilled:a,pending:s,rejected:u,settled:c,options:g}=r,v=o(e,i,g);n.exposeAction(t,v),a&&n.addCase(v.fulfilled,a),s&&n.addCase(v.pending,s),u&&n.addCase(v.rejected,u),c&&n.addMatcher(v.settled,c),n.exposeCaseReducer(t,{fulfilled:a||ss,pending:s||ss,rejected:u||ss,settled:c||ss})}function ss(){}var LC="task",fg="listener",mg="completed",gd="cancelled",qC=`task-${gd}`,jC=`task-${mg}`,fd=`${fg}-${gd}`,UC=`${fg}-${mg}`,fs=class{constructor(e){ue(this,"code");ue(this,"name","TaskAbortError");ue(this,"message");this.code=e,this.message=`${LC} ${gd} (reason: ${e})`}},hd=(e,t)=>{if(typeof e!="function")throw new TypeError(gt(32))},cs=()=>{},gg=(e,t=cs)=>(e.catch(t),e),hg=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),un=e=>{if(e.aborted)throw new fs(e.reason)};function yg(e,t){let r=cs;return new Promise((n,o)=>{let i=()=>o(new fs(e.reason));if(e.aborted){i();return}r=hg(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=cs})}var VC=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof fs?"cancelled":"rejected",error:r}}finally{t?.()}});return function VC(_x5,_x6){return _ref5.apply(this,arguments)}}(),us=e=>t=>gg(yg(e,t).then(r=>(un(e),r))),vg=e=>{let t=us(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:no}=Object,ig={},ms="listenerMiddleware",GC=(e,t)=>{let r=n=>hg(e,()=>n.abort(e.reason));return(n,o)=>{hd(n,"taskExecutor");let i=new l.AbortController;r(i);let a=VC(/*#__PURE__*/_asyncToGenerator(function*(){un(e),un(i.signal);let s=yield n({pause:us(i.signal),delay:vg(i.signal),signal:i.signal});return un(i.signal),s}),()=>i.abort(jC));return o?.autoJoin&&t.push(a.catch(cs)),{result:us(e)(a),cancel(){i.abort(qC)}}}},BC=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){un(t);let i=()=>{},s=[new Promise((u,c)=>{let g=e({predicate:n,effect:(v,R)=>{R.unsubscribe(),u([v,R.getState(),R.getOriginalState()])}});i=()=>{g(),c()}})];o!=null&&s.push(new Promise(u=>setTimeout(u,o,null)));try{let u=yield yg(t,Promise.race(s));return un(t),u}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>gg(r(n,o))},Sg=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=L(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(gt(21));return hd(i,"options.listener"),{predicate:o,type:t,effect:i}},bg=no(e=>{let{type:t,predicate:r,effect:n}=Sg(e);return{id:Mi(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(gt(22))}}},{withTypes:()=>bg}),ag=(e,t)=>{let{type:r,effect:n,predicate:o}=Sg(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},md=e=>{e.pending.forEach(t=>{t.abort(fd)})},$C=(e,t)=>()=>{for(let r of t.keys())md(r);e.clear()},sg=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Ag=no(L(`${ms}/add`),{withTypes:()=>Ag}),QC=L(`${ms}/removeAll`),wg=no(L(`${ms}/remove`),{withTypes:()=>wg}),HC=(...e)=>{console.error(`${ms}/error`,...e)},xg=(e={})=>{let t=new Map,r=new Map,n=h=>{let y=r.get(h)??0;r.set(h,y+1)},o=h=>{let y=r.get(h)??1;y===1?r.delete(h):r.set(h,y-1)},{extra:i,onError:a=HC}=e;hd(a,"onError");let s=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&md(h)}),u=h=>{let y=ag(t,h)??bg(h);return s(y)};no(u,{withTypes:()=>u});let c=h=>{let y=ag(t,h);return y&&(y.unsubscribe(),h.cancelActive&&md(y)),!!y};no(c,{withTypes:()=>c});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,b,x){let I=new l.AbortController,_=BC(u,I.signal),T=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(y,no({},b,{getOriginalState:x,condition:(P,A)=>_(P,A).then(Boolean),take:_,delay:vg(I.signal),pause:us(I.signal),extra:i,signal:I.signal,fork:GC(I.signal,T),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((P,A,O)=>{P!==I&&(P.abort(fd),O.delete(P))})},cancel:()=>{I.abort(fd),h.pending.delete(I)},throwIfCancelled:()=>{un(I.signal)}})))}catch(P){P instanceof fs||sg(a,P,{raisedBy:"effect"})}finally{yield Promise.all(T),I.abort(UC),o(h),h.pending.delete(I)}});return function g(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),v=$C(t,r);return{middleware:h=>y=>b=>{if(!Si(b))return y(b);if(Ag.match(b))return u(b.payload);if(QC.match(b)){v();return}if(wg.match(b))return c(b.payload);let x=h.getState(),I=()=>{if(x===ig)throw new Error(gt(23));return x},_;try{if(_=y(b),t.size>0){let T=h.getState(),P=Array.from(t.values());for(let A of P){let O=!1;try{O=A.predicate(b,T,x)}catch(k){O=!1,sg(a,k,{raisedBy:"predicate"})}O&&g(A,b,h,I)}}}finally{x=ig}return _},startListening:u,stopListening:c,clearListeners:v}};function gt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}m();d();f();p();var Y=new z({required:!0,emptyAllowed:!1}),rt=new z({required:!1,emptyAllowed:!1}),nt=new z({required:!0,emptyAllowed:!0}),Sq=new z({required:!1,emptyAllowed:!0}),gs=new Ae({each:Y,required:!0}),Cg=new z({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Eg=new z({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),bq=new z({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),dr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),kt=(e,t)=>{if("required"in t)return{payload:new yt({value:t}).validate({value:e}).value};let o=new ne({options:{required:!0},values:t}).validate(e);if(o)throw new fi(o);return{payload:e}},B=(e,t)=>{try{return kt(e,t)}catch(r){return{payload:e,error:dr(r)}}},Rg=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return Tg(e,t,r,o,"Controller initialization error")},Ig=(e,t,r,n)=>{let o=`Check the options of ${n}`;return Tg(e,t,r,o,"Controller initialization error")},Tg=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};m();d();f();p();var ao="3.57.0",_g=["@coveo/atomic","@coveo/quantic"];var yd=()=>rt,kg=()=>Y,Ir=L("configuration/updateBasicConfiguration",e=>B(e,{accessToken:rt,environment:new z({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:rt})),Yt=L("configuration/updateSearchConfiguration",e=>B(e,{proxyBaseUrl:new z({required:!1,url:!0}),pipeline:new z({required:!1,emptyAllowed:!0}),searchHub:rt,timezone:rt,locale:rt,authenticationProviders:new Ae({required:!1,each:Y})})),zC={enabled:new me({default:!0}),originContext:yd(),originLevel2:yd(),originLevel3:yd(),proxyBaseUrl:new z({required:!1,url:!0}),runtimeEnvironment:new qe,anonymous:new me({default:!1}),deviceId:rt,userDisplayName:rt,documentLocation:rt,trackingId:Eg,analyticsMode:new z({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new ne({options:{required:!1},values:_g.reduce((e,t)=>(e[t]=Cg,e),{})})},so=L("configuration/updateAnalyticsConfiguration",e=>B(e,zC)),co=L("configuration/analytics/disable"),uo=L("configuration/analytics/enable"),hs=L("configuration/analytics/originlevel2",e=>B(e,{originLevel2:kg()})),ys=L("configuration/analytics/originlevel3",e=>B(e,{originLevel3:kg()})),Og=L("knowledge/setAgentId",e=>B(e,new z({required:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var Pg={q:new z,enableQuerySyntax:new me,aq:new z,cq:new z,firstResult:new oe({min:0}),numberOfResults:new oe({min:0}),sortCriteria:new z,f:new ne,fExcluded:new ne,cf:new ne,nf:new ne,mnf:new ne,df:new ne,debug:new me,sf:new ne,tab:new z,af:new ne};var Tr=L("searchParameters/restore",e=>B(e,Pg)),Ng=L("searchParameters/restoreTab",e=>B(e,Y));m();d();f();p();var vs=L("debug/enable"),Ss=L("debug/disable");m();d();f();p();var bs=()=>!1;var As=Be(bs(),e=>{e.addCase(vs,()=>!0).addCase(Ss,()=>!1).addCase(Tr,(t,r)=>r.payload.debug??t)});m();d();f();p();var lo=L("pipeline/set",e=>B(e,new z({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();var WC=L("history/undo"),KC=L("history/redo"),Xt=L("history/snapshot"),_j=ke("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(WC()),yield t(St())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),kj=ke("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(KC()),yield t(St())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),St=ke("history/change",/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x15,_x16){return _ref1.apply(this,arguments)}}());m();d();f();p();var _r=()=>"";var po=Be(_r(),e=>{e.addCase(lo,(t,r)=>r.payload).addCase(St.fulfilled,(t,r)=>r.payload?.pipeline??t).addCase(Yt,(t,r)=>r.payload.pipeline||t)});m();d();f();p();m();d();f();p();var ws=L("app/setError");m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function YC(){return typeof navigator<"u"}function Fg(){try{return typeof localStorage<"u"}catch{return!1}}function Dg(){try{return typeof sessionStorage<"u"}catch{return!1}}function Mg(){return YC()&&navigator.cookieEnabled}m();d();f();p();var fo=class e{static set(t,r,n){var o,i,a,s;n&&(i=new Date,i.setTime(i.getTime()+n)),s=window.location.hostname,s.indexOf(".")===-1?Lg(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],Lg(t,r,i,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function Lg(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function qg(){return Fg()?localStorage:Mg()?new xs:Dg()?sessionStorage:new vd}var xs=class e{getItem(t){return fo.get(`${e.prefix}${t}`)}removeItem(t){fo.erase(`${e.prefix}${t}`)}setItem(t,r,n){fo.set(`${e.prefix}${t}`,r,n)}};xs.prefix="coveo_";var vd=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var Cs="__coveo.analytics.history",XC=20,ZC=1e3*60,JC=75,Es=class{constructor(t){this.store=t||qg()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _this9=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this9.cropQueryElement(_this9.stripEmptyQuery(t));let r=yield _this9.getHistoryWithInternalTimeAsync();r!=null?_this9.isValidEntry(t)&&_this9.setHistory([t].concat(r)):_this9.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this0=this;return _asyncToGenerator(function*(){let t=yield _this0.getHistoryWithInternalTimeAsync();return _this0.stripEmptyQueries(_this0.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(Cs);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this1=this;return _asyncToGenerator(function*(){try{let t=yield _this1.store.getItem(Cs);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(Cs,JSON.stringify(t.slice(0,XC)))}catch{}}clear(){try{this.store.removeItem(Cs)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,JC)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>ZC:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var pn=class pn extends Es{static getInstance(t){return pn.instance||(pn.instance=new pn(t)),pn.instance}constructor(t){super(t)}};ue(pn,"instance",null);var ht=pn;m();d();f();p();m();d();f();p();var mo=ze(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${ao}`));m();d();f();p();m();d();f();p();function pr(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function G(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(g){try{c(n.next(g))}catch(v){a(v)}}function u(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})}var Ce;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(Ce||(Ce={}));function Ad(){return typeof window<"u"}function Fd(){return typeof navigator<"u"}function go(){return typeof document<"u"}function wd(){try{return typeof localStorage<"u"}catch{return!1}}function eE(){try{return typeof sessionStorage<"u"}catch{return!1}}function Xg(){return Fd()&&navigator.cookieEnabled}var tE=[Ce.click,Ce.custom,Ce.search,Ce.view],rE=(e,t)=>tE.indexOf(e)!==-1?Object.assign({language:go()?document.documentElement.lang:"unknown",userAgent:Fd()?navigator.userAgent:"unknown"},t):t,qi=class e{static set(t,r,n){var o,i,a,s;n&&(i=new Date,i.setTime(i.getTime()+n)),s=window.location.hostname,s.indexOf(".")===-1?jg(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],jg(t,r,i,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function jg(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function nE(){return wd()?localStorage:Xg()?new ji:eE()?sessionStorage:new yo}var ji=class e{getItem(t){return qi.get(`${e.prefix}${t}`)}removeItem(t){qi.erase(`${e.prefix}${t}`)}setItem(t,r,n){qi.set(`${e.prefix}${t}`,r,n)}};ji.prefix="coveo_";var xd=class{constructor(){this.cookieStorage=new ji}getItem(t){return localStorage.getItem(t)||this.cookieStorage.getItem(t)}removeItem(t){this.cookieStorage.removeItem(t),localStorage.removeItem(t)}setItem(t,r){localStorage.setItem(t,r),this.cookieStorage.setItem(t,r,31556926e3)}},yo=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Rs="__coveo.analytics.history",oE=20,iE=1e3*60,aE=75,Ts=class{constructor(t){this.store=t||nE()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){return G(this,void 0,void 0,function*(){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=yield this.getHistoryWithInternalTimeAsync();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])})}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){return G(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(Rs);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return G(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(Rs);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Rs,JSON.stringify(t.slice(0,oE)))}catch{}}clear(){try{this.store.removeItem(Rs)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,aE)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>iE:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var sE=(e,t)=>G(void 0,void 0,void 0,function*(){return e===Ce.view?(yield cE(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),cE=e=>G(void 0,void 0,void 0,function*(){let t=new Ts,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),uE=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function _s(e){return typeof e=="string"&&uE.test(e)}function Ug(e){if(!_s(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var ot=[];for(let e=0;e<256;++e)ot.push((e+256).toString(16).slice(1));function Zg(e,t=0){return(ot[e[t+0]]+ot[e[t+1]]+ot[e[t+2]]+ot[e[t+3]]+"-"+ot[e[t+4]]+ot[e[t+5]]+"-"+ot[e[t+6]]+ot[e[t+7]]+"-"+ot[e[t+8]]+ot[e[t+9]]+"-"+ot[e[t+10]]+ot[e[t+11]]+ot[e[t+12]]+ot[e[t+13]]+ot[e[t+14]]+ot[e[t+15]]).toLowerCase()}var lE=new Uint8Array(16);function dE(){return crypto.getRandomValues(lE)}function pE(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}var fE="6ba7b810-9dad-11d1-80b4-00c04fd430c8",mE="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function gE(e,t,r,n,o,i){let a=typeof r=="string"?pE(r):r,s=typeof n=="string"?Ug(n):n;if(typeof n=="string"&&(n=Ug(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+a.length);return u.set(s),u.set(a,s.length),u=t(u),u[6]=u[6]&15|e,u[8]=u[8]&63|128,Zg(u)}function fn(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():hE(e,t,r)}function hE(e,t,r){e=e||{};let n=e.random??e.rng?.()??dE();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return Zg(n)}function yE(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function Sd(e,t){return e<<t|e>>>32-t}function vE(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,i=Math.ceil(o/16),a=new Array(i);for(let s=0;s<i;++s){let u=new Uint32Array(16);for(let c=0;c<16;++c)u[c]=e[s*64+c*4]<<24|e[s*64+c*4+1]<<16|e[s*64+c*4+2]<<8|e[s*64+c*4+3];a[s]=u}a[i-1][14]=(e.length-1)*8/2**32,a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=(e.length-1)*8&4294967295;for(let s=0;s<i;++s){let u=new Uint32Array(80);for(let y=0;y<16;++y)u[y]=a[s][y];for(let y=16;y<80;++y)u[y]=Sd(u[y-3]^u[y-8]^u[y-14]^u[y-16],1);let c=r[0],g=r[1],v=r[2],R=r[3],h=r[4];for(let y=0;y<80;++y){let b=Math.floor(y/20),x=Sd(c,5)+yE(b,g,v,R)+h+t[b]+u[y]>>>0;h=R,R=v,v=Sd(g,30)>>>0,g=c,c=x}r[0]=r[0]+c>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+v>>>0,r[3]=r[3]+R>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function ks(e,t,r,n){return gE(80,vE,e,t)}ks.DNS=fE;ks.URL=mE;var Jg="2.33.0",Vg=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Li={pageview:"pageview",event:"event"},Os=class{constructor({client:t,uuidGenerator:r=fn}){this.client=t,this.uuidGenerator=r}},Cd=class extends Os{constructor({client:t,uuidGenerator:r=fn}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=Vg(window.location),this.lastReferrer=go()?document.referrer:"",this.addHooks()}getApi(t){return t==="setAction"?this.setAction:null}setAction(t,r){this.action=t,this.actionData=r}clearData(){this.clearPluginData(),this.action=void 0,this.actionData={}}getLocationInformation(t,r){return Object.assign({hitType:t},this.getNextValues(t,r))}updateLocationInformation(t,r){this.updateLocationForNextPageView(t,r)}getDefaultContextInformation(t){let r={title:go()?document.title:"",encoding:go()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},i={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},i),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:i}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=i,t===Li.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===Li.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Li.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Li.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=o=>o.replace(/^\/?(.*)$/,"/$1");return`${(o=>o.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return Vg(window.location)}},kr=class e{constructor(t,r){if(!_s(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(r/1e3)}toString(){return this.clientId.replace(/-/g,"")+"."+this.creationDate.toString()}get expired(){let t=Math.floor(Date.now()/1e3)-this.creationDate;return t<0||t>e.expirationTime}validate(t,r){return!this.expired&&this.matchReferrer(t,r)}matchReferrer(t,r){try{let n=new URL(t);return r.some(o=>new RegExp(o.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(n.host))}catch{return!1}}static fromString(t){let r=t.split(".");if(r.length!==2)return null;let[n,o]=r;if(n.length!==32||isNaN(parseInt(o)))return null;let i=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return _s(i)?new e(i,Number.parseInt(o)*1e3):null}};kr.cvo_cid="cvo_cid";kr.expirationTime=120;var Ed=class extends Os{constructor({client:t,uuidGenerator:r=fn}){super({client:t,uuidGenerator:r})}getApi(t){switch(t){case"decorate":return this.decorate;case"acceptFrom":return this.acceptFrom;default:return null}}decorate(t){return G(this,void 0,void 0,function*(){if(!this.client.getCurrentVisitorId)throw new Error("Could not retrieve current clientId");try{let r=new URL(t),n=yield this.client.getCurrentVisitorId();return r.searchParams.set(kr.cvo_cid,new kr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Ed.Id="link";var Pt=Object.keys;function Is(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var bd=128,eh=192,Gg=224,Bg=240;function SE(e){return(e&248)===Bg?4:(e&Bg)===Gg?3:(e&Gg)===eh?2:1}function bE(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&bd)!=bd)break;if(r-=3,(n&eh)!=bd){t-r>=SE(n)*3&&(r=t);break}}return e.substring(0,r)}var Rd={id:"svc_ticket_id",subject:"svc_ticket_subject",description:"svc_ticket_description",category:"svc_ticket_category",productId:"svc_ticket_product_id",custom:"svc_ticket_custom"},AE=Pt(Rd).map(e=>Rd[e]),wE=[...AE].join("|"),xE=new RegExp(`^(${wE}$)`),CE={svcAction:"svc_action",svcActionData:"svc_action_data"},EE=e=>Pt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=Rd[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),RE=e=>xE.test(e),IE=[RE],$g={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Qg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},dt={action:"pa",list:"pal",listSource:"pls"},Ps={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},TE=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Id={id:"quoteId",affiliation:"quoteAffiliation"},Td={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},_E={add:dt,bookmark_add:dt,bookmark_remove:dt,click:dt,checkout:dt,checkout_option:dt,detail:dt,impression:dt,remove:dt,refund:Object.assign(Object.assign({},dt),Ps),purchase:Object.assign(Object.assign({},dt),Ps),quickview:dt,quote:Object.assign(Object.assign({},dt),Id),review:Object.assign(Object.assign({},dt),Td)},kE=Pt($g).map(e=>$g[e]),OE=Pt(Qg).map(e=>Qg[e]),PE=Pt(dt).map(e=>dt[e]),NE=Pt(Ps).map(e=>Ps[e]),FE=Pt(Td).map(e=>Td[e]),DE=Pt(Id).map(e=>Id[e]),ME=[...kE,"custom"].join("|"),LE=[...OE,"custom"].join("|"),th="(pr[0-9]+)",rh="(il[0-9]+pi[0-9]+)",qE=new RegExp(`^${th}(${ME})$`),jE=new RegExp(`^(${rh}(${LE}))|(il[0-9]+nm)$`),UE=new RegExp(`^(${PE.join("|")})$`),VE=new RegExp(`^(${NE.join("|")})$`),GE=new RegExp(`^${th}custom$`),BE=new RegExp(`^${rh}custom$`),$E=new RegExp(`^(${[...TE,...FE,...DE].join("|")})$`),QE=e=>qE.test(e),HE=e=>jE.test(e),zE=e=>UE.test(e),WE=e=>VE.test(e),KE=e=>$E.test(e),YE=[HE,QE,zE,WE,KE],XE=[GE,BE],ZE={anonymizeIp:"aip"},JE={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},eR={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},tR=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],rR=Object.assign(Object.assign(Object.assign(Object.assign({},ZE),JE),eR),tR.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),_d=Object.assign(Object.assign({},rR),CE),nR=e=>{let t=!!e.action&&_E[e.action]||{};return Pt(e).reduce((r,n)=>{let o=t[n]||_d[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},oR=Pt(_d).map(e=>_d[e]),iR=e=>oR.indexOf(e)!==-1,aR=e=>e==="custom",sR=e=>[...YE,...IE,iR,aR].some(t=>t(e)),cR=e=>Pt(e).reduce((t,r)=>{let n=uR(r);return n?Object.assign(Object.assign({},t),lR(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),uR=e=>{let t;return[...XE].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},lR=(e,t)=>Pt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),kd=class{constructor(t){this.opts=t}sendEvent(t,r){return G(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:o}=this.opts,i=yield this.getQueryParamsForEventType(t),{url:a,payload:s}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),u=this.encodeForEventType(t,s),c=new Blob([u],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(a,c)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return G(this,void 0,void 0,function*(){let o=t,i=r;if(n){let a=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:s,body:u}=a;o=s||t;try{i=JSON.parse(u)}catch(c){console.error("Unable to process the request body as a JSON string",c)}}return{payload:i,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return G(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(i=>!!i).join("&")})}isEventTypeLegacy(t){return[Ce.click,Ce.custom,Ce.search,Ce.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let o=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(o=`access_token=${encodeURIComponent(n)}&${o}`),o}},Od=class{sendEvent(t,r){return G(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return G(this,void 0,void 0,function*(){return Promise.resolve()})}},Hg=w.fetch,Ns=class{constructor(t){this.opts=t}sendEvent(t,r){return G(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:i}=this.opts,a=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",s={url:`${n}/analytics/${t}${a}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},u=Object.assign(Object.assign({},s),i?yield i(s,"analyticsFetch"):{}),{url:c}=u,g=pr(u,["url"]),v;try{v=yield Hg(c,g)}catch(R){console.error("An error has occurred when sending the event.",R);return}if(v.ok){let R=yield v.json();return R.visitorId&&o.setCurrentVisitorId(R.visitorId),R}else{try{v.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,v,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return G(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield Hg(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[Ce.click,Ce.custom,Ce.search,Ce.view].indexOf(t)!==-1}getVisitorIdParam(){return G(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,r=yield t.getCurrentVisitorId();return r?`?visitor=${r}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},Pd=class{constructor(t,r){wd()&&Xg()?this.storage=new xd:wd()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new yo),this.client=new Ns(t),this.beaconClient=new kd(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:i}of n)this.beaconClient.sendEvent(o,i)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},Nd=class{constructor(t,r){this.storage=r||new yo,this.client=new Ns(t)}getClientDependingOnEventType(t){return this.client}},Fs=class{constructor(){this.storage=new yo,this.client=new Od}getClientDependingOnEventType(t){return this.client}},dR="xx",pR=e=>e?.startsWith(dR)||!1,fR=`
|
|
28
28
|
We've detected you're using React Native but have not provided the corresponding runtime,
|
|
29
29
|
for an optimal experience please use the "coveo.analytics/react-native" subpackage.
|
|
30
30
|
Follow the Readme on how to set it up: https://github.com/coveo/coveo.analytics.js#using-react-native
|
|
31
|
-
`;function zE(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var WE=["1",1,"yes",!0];function KE(){let e=[];return ud()&&e.push(window.doNotTrack),Ad()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>WE.indexOf(t)!==-1)}function _s(e){return e===!0?!1:KE()}var Hg="v15",zg={default:"https://analytics.cloud.coveo.com/rest/ua"};function YE(e=zg.default,t=Hg,r=!1){if(e=e.replace(/\/$/,""),r)return`${e}/${t}`;let n=e.endsWith("/rest")||e.endsWith("/rest/ua");return`${e}${n?"":"/rest"}/${t}`}var XE="38824e1f-37f5-42d3-8372-a4b8fa9df946",Yt=class{get defaultOptions(){return{endpoint:zg.default,isCustomEndpoint:!1,token:"",version:Hg,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Bg}constructor(t){if(this.acceptedLinkReferrers=[],!t)throw new Error("You have to pass options to this constructor");this.options=Object.assign(Object.assign({},this.defaultOptions),t),this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[UC,DC].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};let r={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};_s(this.options.disableBrowserPrivacySignals)?this.runtime=new Ts:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(Ae.view,{newEventType:Ae.view,addClientIdParameter:!0}),this.addEventTypeMapping(Ae.click,{newEventType:Ae.click,addClientIdParameter:!0}),this.addEventTypeMapping(Ae.custom,{newEventType:Ae.custom,addClientIdParameter:!0}),this.addEventTypeMapping(Ae.search,{newEventType:Ae.search,addClientIdParameter:!0})}initRuntime(t){return ud()&&lo()?new bd(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(zE()&&console.warn(HE),new wd(t))}get storage(){return this.runtime.storage}determineVisitorId(){return U(this,void 0,void 0,function*(){try{return ud()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||ln()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),ln()}})}getCurrentVisitorId(){return U(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return U(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return U(this,void 0,void 0,function*(){if(xs(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(Cs(t,Cs(r,XE)))}})}getParameters(t,...r){return U(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return U(this,void 0,void 0,function*(){let n=yield this.resolveParameters(t,...r);return yield this.resolvePayloadForParameters(t,n)})}get currentVisitorId(){return typeof(this.visitorId||this.storage.getItem("visitorId"))!="string"&&this.setCurrentVisitorId(ln()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(_s(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(Tr.cvo_cid);if(r==null)return null;let n=Tr.fromString(r);return!n||!lo()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return U(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:i=!1,addClientIdParameter:a=!1}=this.eventTypeMapping[t]||{};return yield[g=>n.length>0?this.parseVariableArgumentsPayload(n,g):g[0],g=>U(this,void 0,void 0,function*(){return Object.assign(Object.assign({},g),{visitorId:o?yield this.getCurrentVisitorId():""})}),g=>U(this,void 0,void 0,function*(){return a?Object.assign(Object.assign({},g),{clientId:yield this.getCurrentVisitorId()}):g}),g=>i?this.ensureAnonymousUserWhenUsingApiKey(g):g,g=>this.beforeSendHooks.reduce((y,S)=>U(this,void 0,void 0,function*(){let E=yield y;return yield S(t,E)}),g)].reduce((g,y)=>U(this,void 0,void 0,function*(){let S=yield g;return yield y(S)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return U(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[v=>this.setTrackingIdIfTrackingIdNotPresent(v),v=>this.removeEmptyPayloadValues(v,t),v=>this.validateParams(v,t),v=>n?ME(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,C)=>U(this,void 0,void 0,function*(){let g=yield v;return yield C(g)}),Promise.resolve(r))})}makeEvent(t,...r){return U(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},o=yield this.resolveParameters(t,...r),i=yield this.resolvePayloadForParameters(t,o);return{eventType:n,payload:i,log:a=>U(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},i),a)}),yield Promise.all(this.afterSendHooks.map(s=>s(t,Object.assign(Object.assign({},o),a)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return U(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return U(this,void 0,void 0,function*(){let t=this.bufferedRequests.shift();if(t){let{eventType:r,payload:n}=t;return this.runtime.getClientDependingOnEventType(r).sendEvent(r,n)}})}clear(){this.storage.removeItem("visitorId"),new As().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Ae.search,t)})}sendSearchEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=lr(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Ae.click,t)})}sendClickEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=lr(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Ae.custom,t)})}sendCustomEvent(t){return U(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=lr(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Ae.view,t)})}sendViewEvent(t){return U(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return U(this,void 0,void 0,function*(){let r=yield(yield A(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return U(this,void 0,void 0,function*(){return yield(yield A(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,r){this.eventTypeMapping[t]=r}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(r=>typeof r=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,r){let n={};for(let o=0,i=r.length;o<i;o++){let a=r[o];if(typeof a=="string")n[t[o]]=a;else if(typeof a=="object")return Object.assign(Object.assign({},n),a)}return n}isKeyAllowedEmpty(t,r){return({[Ae.search]:["queryText"]}[t]||[]).indexOf(r)!==-1}removeEmptyPayloadValues(t,r){let n=o=>typeof o<"u"&&o!==null&&o!=="";return Object.keys(t).filter(o=>this.isKeyAllowedEmpty(r,o)||n(t[o])).reduce((o,i)=>Object.assign(Object.assign({},o),{[i]:t[i]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(UE(n))return!0;console.log(n,"is not processed by coveoua")}).reduce((n,o)=>Object.assign(Object.assign({},n),{[o]:t[o]}),{})}processCustomParameters(t){let{custom:r}=t,n=lr(t,["custom"]),o={};r&&ws(r)&&(o=this.lowercaseKeys(r));let i=VE(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=lr(t,["custom"]);if(r&&ws(r)){let o=this.lowercaseKeys(r);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},o),t.customData)})}else return t}lowercaseKeys(t){let r=Object.keys(t),n={};return r.forEach(o=>{n[o.toLowerCase()]=t[o]}),n}validateParams(t,r){let{anonymizeIp:n}=t,o=lr(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==Ae.view||r==Ae.click||r==Ae.search||r==Ae.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==Ae.view&&(o.location=this.limit(o.location,1024)),(r=="pageview"||r=="event")&&(o.referrer=this.limit(o.referrer,2048),o.location=this.limit(o.location,2048),o.page=this.limit(o.page,2048)),o}ensureAnonymousUserWhenUsingApiKey(t){let{userId:r}=t,n=lr(t,["userId"]);return QE(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=lr(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&ws(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&ws(n.customData)&&(n.customData.hasOwnProperty("context_website")||n.customData.hasOwnProperty("siteName"))&&(n.trackingId=n.customData.context_website||n.customData.siteName),n)}limit(t,r){return typeof t=="string"?JC(t,r):t}get baseUrl(){return YE(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},dr;(function(e){e.contextChanged="contextChanged",e.expandToFullUI="expandToFullUI",e.openUserActions="openUserActions",e.showPrecedingSessions="showPrecedingSessions",e.showFollowingSessions="showFollowingSessions",e.clickViewedDocument="clickViewedDocument",e.clickPageView="clickPageView",e.createArticle="createArticle"})(dr||(dr={}));var $;(function(e){e.interfaceLoad="interfaceLoad",e.interfaceChange="interfaceChange",e.didyoumeanAutomatic="didyoumeanAutomatic",e.didyoumeanClick="didyoumeanClick",e.resultsSort="resultsSort",e.searchboxSubmit="searchboxSubmit",e.searchboxClear="searchboxClear",e.searchboxAsYouType="searchboxAsYouType",e.breadcrumbFacet="breadcrumbFacet",e.breadcrumbResetAll="breadcrumbResetAll",e.documentQuickview="documentQuickview",e.documentOpen="documentOpen",e.omniboxAnalytics="omniboxAnalytics",e.omniboxFromLink="omniboxFromLink",e.searchFromLink="searchFromLink",e.triggerNotify="notify",e.triggerExecute="execute",e.triggerQuery="query",e.undoTriggerQuery="undoQuery",e.triggerRedirect="redirect",e.pagerResize="pagerResize",e.pagerNumber="pagerNumber",e.pagerNext="pagerNext",e.pagerPrevious="pagerPrevious",e.pagerScrolling="pagerScrolling",e.staticFilterClearAll="staticFilterClearAll",e.staticFilterSelect="staticFilterSelect",e.staticFilterDeselect="staticFilterDeselect",e.facetClearAll="facetClearAll",e.facetSearch="facetSearch",e.facetSelect="facetSelect",e.facetSelectAll="facetSelectAll",e.facetDeselect="facetDeselect",e.facetExclude="facetExclude",e.facetUnexclude="facetUnexclude",e.facetUpdateSort="facetUpdateSort",e.facetShowMore="showMoreFacetResults",e.facetShowLess="showLessFacetResults",e.queryError="query",e.queryErrorBack="errorBack",e.queryErrorClear="errorClearQuery",e.queryErrorRetry="errorRetry",e.recommendation="recommendation",e.recommendationInterfaceLoad="recommendationInterfaceLoad",e.recommendationOpen="recommendationOpen",e.likeSmartSnippet="likeSmartSnippet",e.dislikeSmartSnippet="dislikeSmartSnippet",e.expandSmartSnippet="expandSmartSnippet",e.collapseSmartSnippet="collapseSmartSnippet",e.openSmartSnippetFeedbackModal="openSmartSnippetFeedbackModal",e.closeSmartSnippetFeedbackModal="closeSmartSnippetFeedbackModal",e.sendSmartSnippetReason="sendSmartSnippetReason",e.expandSmartSnippetSuggestion="expandSmartSnippetSuggestion",e.collapseSmartSnippetSuggestion="collapseSmartSnippetSuggestion",e.showMoreSmartSnippetSuggestion="showMoreSmartSnippetSuggestion",e.showLessSmartSnippetSuggestion="showLessSmartSnippetSuggestion",e.openSmartSnippetSource="openSmartSnippetSource",e.openSmartSnippetSuggestionSource="openSmartSnippetSuggestionSource",e.openSmartSnippetInlineLink="openSmartSnippetInlineLink",e.openSmartSnippetSuggestionInlineLink="openSmartSnippetSuggestionInlineLink",e.recentQueryClick="recentQueriesClick",e.clearRecentQueries="clearRecentQueries",e.recentResultClick="recentResultClick",e.clearRecentResults="clearRecentResults",e.noResultsBack="noResultsBack",e.showMoreFoldedResults="showMoreFoldedResults",e.showLessFoldedResults="showLessFoldedResults",e.copyToClipboard="copyToClipboard",e.caseSendEmail="Case.SendEmail",e.feedItemTextPost="FeedItem.TextPost",e.caseAttach="caseAttach",e.caseDetach="caseDetach",e.retryGeneratedAnswer="retryGeneratedAnswer",e.likeGeneratedAnswer="likeGeneratedAnswer",e.dislikeGeneratedAnswer="dislikeGeneratedAnswer",e.openGeneratedAnswerSource="openGeneratedAnswerSource",e.generatedAnswerOpenInlineLink="generatedAnswerOpenInlineLink",e.generatedAnswerStreamEnd="generatedAnswerStreamEnd",e.generatedAnswerSourceHover="generatedAnswerSourceHover",e.generatedAnswerCopyToClipboard="generatedAnswerCopyToClipboard",e.generatedAnswerHideAnswers="generatedAnswerHideAnswers",e.generatedAnswerShowAnswers="generatedAnswerShowAnswers",e.generatedAnswerExpand="generatedAnswerExpand",e.generatedAnswerCollapse="generatedAnswerCollapse",e.generatedAnswerFeedbackSubmit="generatedAnswerFeedbackSubmit",e.rephraseGeneratedAnswer="rephraseGeneratedAnswer",e.generatedAnswerFeedbackSubmitV2="generatedAnswerFeedbackSubmitV2",e.generatedAnswerCitationClick="generatedAnswerCitationClick",e.generatedAnswerFollowupOpenSource="generatedAnswerFollowupOpenSource",e.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})($||($={}));var Mg={[$.triggerNotify]:"queryPipelineTriggers",[$.triggerExecute]:"queryPipelineTriggers",[$.triggerQuery]:"queryPipelineTriggers",[$.triggerRedirect]:"queryPipelineTriggers",[$.queryErrorBack]:"errors",[$.queryErrorClear]:"errors",[$.queryErrorRetry]:"errors",[$.pagerNext]:"getMoreResults",[$.pagerPrevious]:"getMoreResults",[$.pagerNumber]:"getMoreResults",[$.pagerResize]:"getMoreResults",[$.pagerScrolling]:"getMoreResults",[$.facetSearch]:"facet",[$.facetShowLess]:"facet",[$.facetShowMore]:"facet",[$.recommendation]:"recommendation",[$.likeSmartSnippet]:"smartSnippet",[$.dislikeSmartSnippet]:"smartSnippet",[$.expandSmartSnippet]:"smartSnippet",[$.collapseSmartSnippet]:"smartSnippet",[$.openSmartSnippetFeedbackModal]:"smartSnippet",[$.closeSmartSnippetFeedbackModal]:"smartSnippet",[$.sendSmartSnippetReason]:"smartSnippet",[$.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.clearRecentQueries]:"recentQueries",[$.recentResultClick]:"recentlyClickedDocuments",[$.clearRecentResults]:"recentlyClickedDocuments",[$.showLessFoldedResults]:"folding",[$.caseDetach]:"case",[$.likeGeneratedAnswer]:"generatedAnswer",[$.dislikeGeneratedAnswer]:"generatedAnswer",[$.openGeneratedAnswerSource]:"generatedAnswer",[$.generatedAnswerOpenInlineLink]:"generatedAnswer",[$.generatedAnswerFollowupOpenSource]:"generatedAnswer",[$.generatedAnswerStreamEnd]:"generatedAnswer",[$.generatedAnswerSourceHover]:"generatedAnswer",[$.generatedAnswerCopyToClipboard]:"generatedAnswer",[$.generatedAnswerHideAnswers]:"generatedAnswer",[$.generatedAnswerShowAnswers]:"generatedAnswer",[$.generatedAnswerExpand]:"generatedAnswer",[$.generatedAnswerCollapse]:"generatedAnswer",[$.generatedAnswerFeedbackSubmit]:"generatedAnswer",[$.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[dr.expandToFullUI]:"interface",[dr.openUserActions]:"User Actions",[dr.showPrecedingSessions]:"User Actions",[dr.showFollowingSessions]:"User Actions",[dr.clickViewedDocument]:"User Actions",[dr.clickPageView]:"User Actions",[dr.createArticle]:"createArticle"},mo=class{constructor(){this.runtime=new Ts,this.currentVisitorId=""}getPayload(){return Promise.resolve()}getParameters(){return Promise.resolve()}makeEvent(t){return Promise.resolve({eventType:t,payload:null,log:()=>Promise.resolve()})}sendEvent(){return Promise.resolve()}makeSearchEvent(){return this.makeEvent(Ae.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(Ae.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(Ae.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(Ae.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return Bg}};function ZE(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function JE(e){return e.map(t=>t.replace(/;/g,""))}function Wg(e){let r=e.join(";");return r.length<=256?r:Wg(e.slice(1))}var qg=e=>{let t=JE(e),r=ZE(t);return Wg(r)};function jg(e){let t=typeof e.partialQueries=="string"?e.partialQueries:qg(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:qg(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var ks=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||_s(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new mo:new Yt(t)}disable(){this.coveoAnalyticsClient=new mo}enable(){this.coveoAnalyticsClient=new Yt(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent($.interfaceLoad)}logInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent($.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent($.recommendation)}logRecommendation(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent($.recommendationOpen,t,r)}logRecommendationOpen(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent($.staticFilterClearAll,t)}logStaticFilterClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent($.staticFilterSelect,t)}logStaticFilterSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent($.staticFilterDeselect,t)}logStaticFilterDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent($.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return U(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent($.interfaceChange,t)}logInterfaceChange(t){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent($.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent($.didyoumeanClick)}logDidYouMeanClick(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent($.resultsSort,t)}logResultsSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent($.searchboxSubmit)}logSearchboxSubmit(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent($.searchboxClear)}logSearchboxClear(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent($.searchboxAsYouType)}logSearchboxAsYouType(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent($.breadcrumbFacet,t)}logBreadcrumbFacet(t){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent($.breadcrumbResetAll)}logBreadcrumbResetAll(){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent($.documentQuickview,t,r)}logDocumentQuickview(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent($.documentOpen,t,r)}logDocumentOpen(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent($.omniboxAnalytics,jg(t))}logOmniboxAnalytics(t){return U(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent($.omniboxFromLink,jg(t))}logOmniboxFromLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent($.searchFromLink)}logSearchFromLink(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent($.triggerNotify,t)}logTriggerNotify(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent($.triggerExecute,t)}logTriggerExecute(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent($.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent($.undoTriggerQuery,t)}logUndoTriggerQuery(t){return U(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent($.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent($.pagerResize,t)}logPagerResize(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent($.pagerNumber,t)}logPagerNumber(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent($.pagerNext,t)}logPagerNext(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent($.pagerPrevious,t)}logPagerPrevious(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent($.pagerScrolling)}logPagerScrolling(){return U(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent($.facetClearAll,t)}logFacetClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent($.facetSearch,t)}logFacetSearch(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent($.facetSelect,t)}logFacetSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent($.facetDeselect,t)}logFacetDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent($.facetExclude,t)}logFacetExclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent($.facetUnexclude,t)}logFacetUnexclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent($.facetSelectAll,t)}logFacetSelectAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent($.facetUpdateSort,t)}logFacetUpdateSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent($.facetShowMore,t)}logFacetShowMore(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent($.facetShowLess,t)}logFacetShowLess(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent($.queryError,t)}logQueryError(t){return U(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorBack);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorBack)})}})}logQueryErrorBack(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorRetry);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorRetry)})}})}logQueryErrorRetry(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorClear);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorClear)})}})}logQueryErrorClear(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent($.likeSmartSnippet)}logLikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent($.dislikeSmartSnippet)}logDislikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent($.expandSmartSnippet)}logExpandSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent($.collapseSmartSnippet)}logCollapseSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent($.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent($.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent($.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent($.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent($.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent($.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent($.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent($.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent($.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent($.copyToClipboard,t,r)}logCopyToClipboard(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent($.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent($.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent($.recentQueryClick)}logRecentQueryClick(){return U(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent($.clearRecentQueries)}logClearRecentQueries(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent($.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent($.clearRecentResults)}logClearRecentResults(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent($.noResultsBack)}logNoResultsBack(){return U(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent($.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent($.showLessFoldedResults)}logShowLessFoldedResults(){return U(this,void 0,void 0,function*(){return(yield this.makeShowLessFoldedResults()).log({searchUID:this.provider.getSearchUID()})})}makeEventDescription(t,r){var n;return{actionCause:r,customData:(n=t.payload)===null||n===void 0?void 0:n.customData}}makeCustomEvent(t,r){return U(this,arguments,void 0,function*(n,o,i=Mg[n]){this.coveoAnalyticsClient.getParameters;let a=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),s=Object.assign(Object.assign({},yield this.getBaseEventRequest(a)),{eventType:i,eventValue:n}),c=yield this.coveoAnalyticsClient.makeCustomEvent(s);return{description:this.makeEventDescription(c,n),log:({searchUID:u})=>c.log({lastSearchQueryUid:u})}})}logCustomEvent(t,r){return U(this,arguments,void 0,function*(n,o,i=Mg[n]){return(yield this.makeCustomEvent(n,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return U(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),i=Object.assign(Object.assign({},yield this.getBaseEventRequest(o)),{eventType:r,eventValue:t}),a=yield this.coveoAnalyticsClient.makeCustomEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:s})=>a.log({lastSearchQueryUid:s})}})}logCustomEventWithType(t,r,n){return U(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return U(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),o=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(o,t),log:({searchUID:i})=>o.log({searchQueryUid:i})}})}makeClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){let i=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),a=yield this.coveoAnalyticsClient.makeClickEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:s})=>a.log({searchQueryUid:s})}})}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return U(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.getOrigins()),this.getSplitTestRun()),{customData:r,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,r;return{originContext:(r=(t=this.provider).getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof Yt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getSplitTestRun(){let t=this.provider.getSplitTestRunName?this.provider.getSplitTestRunName():"",r=this.provider.getSplitTestRunVersion?this.provider.getSplitTestRunVersion():"";return Object.assign(Object.assign({},t&&{splitTestRunName:t}),r&&{splitTestRunVersion:r})}makeLikeGeneratedAnswer(t){return this.makeCustomEvent($.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent($.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent($.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent($.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent($.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent($.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent($.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent($.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent($.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent($.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent($.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent($.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent($.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent($.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent($.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent($.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return U(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent($.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Os=Object.assign({},Oi),Lg=Object.keys(Os).map(e=>Os[e]),po=class extends pd{constructor({client:t,uuidGenerator:r=ln}){super({client:t,uuidGenerator:r}),this.ticket={}}getApi(t){let r=super.getApi(t);return r!==null?r:t==="setTicket"?this.setTicket:null}addHooks(){this.addHooksForEvent(),this.addHooksForPageView(),this.addHooksForSVCEvents()}setTicket(t){this.ticket=t}clearPluginData(){this.ticket={}}addHooksForSVCEvents(){this.client.registerBeforeSendEventHook((t,...[r])=>Lg.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Lg.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Os.pageview,{newEventType:Ae.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Os.event,{newEventType:Ae.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,r){var n;let o=Object.assign(Object.assign(Object.assign(Object.assign({},this.getLocationInformation(t,r)),this.getDefaultContextInformation(t)),this.action?{svcAction:this.action}:{}),Object.keys((n=this.actionData)!==null&&n!==void 0?n:{}).length>0?{svcActionData:this.actionData}:{}),i=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},i),o),r)}getTicketPayload(){return oE(this.ticket)}};po.Id="svc";var Ps;(function(e){e.click="click",e.flowStart="flowStart"})(Ps||(Ps={}));var _t;(function(e){e.enterInterface="ticket_create_start",e.fieldUpdate="ticket_field_update",e.fieldSuggestionClick="ticket_classification_click",e.documentSuggestionClick="documentSuggestionClick",e.documentSuggestionQuickview="documentSuggestionQuickview",e.suggestionRate="suggestion_rate",e.nextCaseStep="ticket_next_stage",e.caseCancelled="ticket_cancel",e.caseSolved="ticket_cancel",e.caseCreated="ticket_create"})(_t||(_t={}));var Ns;(function(e){e.quit="Quit",e.solved="Solved"})(Ns||(Ns={}));var Fs=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!_s(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new Yt(t):new mo,this.svc=new po({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new mo,this.svc=new po({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Yt(this.options),this.svc=new po({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(_t.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(_t.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(_t.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(_t.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(_t.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(_t.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(_t.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(_t.caseCancelled,{reason:Ns.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(_t.caseSolved,{reason:Ns.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(_t.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Ps.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Ps.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){var r,n;let o=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:o,language:(r=this.provider)===null||r===void 0?void 0:r.getLanguage(),anonymous:(n=this.provider)===null||n===void 0?void 0:n.getIsAnonymous(),clientId:yield this.getClientId()})})}getClientId(){return this.coveoAnalyticsClient instanceof Yt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,o,i;return{originContext:(r=(t=this.provider)===null||t===void 0?void 0:t.getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:(n=this.provider)===null||n===void 0?void 0:n.getOriginLevel1(),originLevel2:(o=this.provider)===null||o===void 0?void 0:o.getOriginLevel2(),originLevel3:(i=this.provider)===null||i===void 0?void 0:i.getOriginLevel3()}}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){var i,a;let s=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:(a=(i=this.provider)===null||i===void 0?void 0:i.getSearchUID())!==null&&a!==void 0?a:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(s)})}};var Kg=e=>new Yt(e).getCurrentVisitorId(),Fi=(e,t)=>typeof t=="function"?(...r)=>{let n=ci(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,Di=(e,t)=>(...r)=>{let n=ci(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function Ds(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function Yg(e){let{activeValue:t,ancestryMap:r}=eR(e);return t?tR(t,r):[]}function eR(e){let t=[...e],r=new Map;for(;t.length>0;){let n=t.shift();if(n.state==="selected")return{activeValue:n,ancestryMap:r};if(r)for(let o of n.children)r.set(o,n);t.unshift(...n.children)}return{}}function tR(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var rR=(e,t)=>e.categoryFacetSet[t]?.request;var Ed=(e,t)=>{let r=rR(e,t);return Yg(r?.currentValues??[])};m();d();f();p();function Ms(){return{}}m();d();f();p();function qs(){return{}}m();d();f();p();function js(){return{}}m();d();f();p();function Ls(){return{}}function Rd(e){return{facetSet:e.facetSet??Ls(),categoryFacetSet:e.categoryFacetSet??Ms(),dateFacetSet:e.dateFacetSet??qs(),numericFacetSet:e.numericFacetSet??js(),automaticFacetSet:e.automaticFacetSet??Ds()}}var Id=e=>{let t=[];return iR(e).forEach((r,n)=>{let o=fR(e,r.facetId),i=dR(r,n+1);if(oR(r)){if(!!!Ed(e,r.facetId).length)return;t.push({...i,...uR(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((a,s)=>{if(a.state==="idle")return;let c=Xg(a,s+1,o),u=nR(r)?Zg(a):sR(a);t.push({...i,...c,...u})})}),aR(e).forEach((r,n)=>{let o=lR(r,n+1);r.values.forEach((i,a)=>{if(i.state==="idle")return;let s=Xg(i,a+1,"specific"),c=Zg(i);t.push({...o,...s,...c})})}),t},nR=e=>e.type==="specific",oR=e=>e.type==="hierarchical",iR=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),aR=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),Xg=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),sR=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),Zg=e=>({displayValue:e.value,value:e.value}),cR=(e,t)=>Ed(e,t).map(n=>n.value).join(";"),uR=(e,t)=>{let n=cR(e,t);return{value:n,valuePosition:1,displayValue:n}},lR=(e,t)=>({title:Jg(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),dR=(e,t)=>({title:Jg(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),Jg=(e,t)=>`${e}_${t}`,pR=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,fR=(e,t)=>{let r=pR(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var Td=e=>e.configuration.search.locale,eh=e=>e.configuration.search.timezone,th=e=>e.configuration.accessToken,rh=e=>e.configuration.organizationId,nh=e=>e.configuration.environment,Us=e=>e.configuration?.knowledge?.agentId,oh=e=>e.configuration.knowledge.debugAgentSession;var Me=e=>{if(mR(e)||_d(e))return e.generatedAnswer?.answerId;if(gR(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},mR=e=>"answer"in e&&"generatedAnswer"in e&&!se(e.generatedAnswer?.answerConfigurationId),_d=e=>{let t=Us(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},gR=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",kd=e=>e.generatedAnswer?.fieldsToIncludeInCitations,_r=e=>e.followUpAnswers?.conversationId,hR=e=>e.generatedAnswer?.citations,yR=e=>e.followUpAnswers?.followUpAnswers,vR=$e(yR,e=>e?.flatMap(t=>t.citations)),SR=(e,t)=>t,go=$e(hR,vR,SR,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));m();d();f();p();var Ct=()=>({q:"",enableQuerySyntax:!1});m();d();f();p();m();d();f();p();var ih=(r=>(r.Ascending="ascending",r.Descending="descending",r))(ih||{}),ah=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(ah||{}),Od=e=>{if(Zf(e))return e.map(t=>Od(t)).join(",");switch(e.by){case"relevancy":case"qre":case"nosort":return e.by;case"date":return`date ${e.order}`;case"field":return`@${e.field} ${e.order}`;default:return""}},sh=()=>({by:"relevancy"});var $1=new ne({values:{by:new Il({enum:ah,required:!0}),order:new Il({enum:ih}),field:new z}});function Vs(){return Od(sh())}m();d();f();p();m();d();f();p();var ho=()=>"default";var bR=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},pr=class{constructor(t){ae(this,"getState",t);ae(this,"state");this.state=t()}getLanguage(){return bR(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[i,a]of Object.entries(n)){let s=`context_${i}`;o[s]=a}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=ro),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||ho()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};var Mi=class Mi extends pr{constructor(){super(...arguments);ae(this,"getFacetRequest",r=>this.state.facetSet?.[r]?.request||this.state.categoryFacetSet?.[r]?.request||this.state.dateFacetSet?.[r]?.request||this.state.numericFacetSet?.[r]?.request||this.state.automaticFacetSet?.set[r]?.response)}getFacetState(){return Id(Rd(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Mi.fallbackPipelineName}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.resultURIs,numberOfResults:this.numberOfResults}}getSearchUID(){let r=this.getState();return r.search?.searchResponseId||r.search?.response.searchUid||Qt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Mi.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=Me(r);return o&&(n.generativeQuestionAnsweringId=o),n}getFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetValue:n,facetTitle:`${i}_${r}`}}getFacetClearAllMetadata(r){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetTitle:`${o}_${r}`}}getFacetUpdateSortMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,criteria:n,facetTitle:`${i}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${i}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??Vs()}}getStaticFilterToggleMetadata(r,n){return{...this.getBaseMetadata(),staticFilterId:r,staticFilterValue:n}}getStaticFilterClearAllMetadata(r){return{...this.getBaseMetadata(),staticFilterId:r}}getUndoTriggerQueryMetadata(r){return{...this.getBaseMetadata(),undoneQuery:r}}getCategoryBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:i,categoryFacetPath:n,categoryFacetTitle:`${i}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let o=this.state.querySuggest?.[r],i=o.completions.map(u=>u.expression),a=o.partialQueries.length-1,s=o.partialQueries[a]||"",c=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(n),partialQuery:s,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:i.length>0?i:"",querySuggestResponseId:c}}getInterfaceChangeMetadata(){return{...this.getBaseMetadata(),interfaceChangeTo:this.state.configuration.analytics.originLevel2}}getOmniboxFromLinkMetadata(r){return{...this.getBaseMetadata(),...r}}getGeneratedAnswerMetadata(){let r=this.getState(),n={};return r.generatedAnswer?.isVisible!==void 0&&(n.showGeneratedAnswer=r.generatedAnswer.isVisible),n}get resultURIs(){return this.results?.map(r=>({documentUri:r.uri,documentUriHash:r.raw.urihash}))}get results(){return this.state.search?.response.results}get queryText(){return this.state.query?.q||Ct().q}get responseTime(){return this.state.search?.duration||Qt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Qt().response.totalCountFiltered}};ae(Mi,"fallbackPipelineName","default");var kr=Mi,ch=({logger:e,getState:t,analyticsClientMiddleware:r=(a,s)=>s,preprocessRequest:n,provider:o,disableBrowserPrivacySignals:i})=>{let a=t(),s=a.configuration.accessToken,c=a.configuration.analytics.apiBaseUrl??It(a.configuration.organizationId,a.configuration.environment,"analytics"),u=a.configuration.analytics.runtimeEnvironment,h=a.configuration.analytics.enabled,v=new ks({token:s,endpoint:c,runtimeEnvironment:u,disableBrowserPrivacySignals:i,preprocessRequest:Fi(e,n),beforeSendHooks:[Di(e,r),(C,g)=>(e.info({...g,type:C,endpoint:c,token:s},"Analytics request"),g)]},o);return h||v.disable(),v},Pd=()=>{let t=gt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};var Bs=/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield Kg(e),clientTimestamp:new Date().toISOString(),documentReferrer:e.originLevel3,originContext:e.originContext,...(t&&{actionCause:t.actionCause,customData:t.customData}),...(t&&!r&&{customData:t.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.documentLocation&&{documentLocation:e.documentLocation}),...(e.deviceId&&{deviceId:e.deviceId}),...(Pd()&&{pageId:Pd()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:uo(e)})}}});return function Bs(_x17,_x18){return _ref10.apply(this,arguments)}}();m();d();f();p();m();d();f();p();m();d();f();p();var yo=()=>({duration:0,error:null,isLoading:!1,id:"Recommendation",recommendations:[],searchUid:"",splitTestRun:"",pipeline:""});var qi=class extends pr{getPipeline(){return this.state.pipeline||this.state.recommendation?.pipeline||"default"}getSearchEventRequestPayload(){return{queryText:Ct().q,responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getSearchUID(){return this.getState().recommendation?.searchUid||yo().searchUid}getSplitTestRunName(){return this.state.recommendation?.splitTestRun}getSplitTestRunVersion(){let t=!!this.getSplitTestRunName(),r=this.state.recommendation?.pipeline||this.state.pipeline||"default";return t?r:void 0}get responseTime(){return this.state.recommendation?.duration||yo().duration}mapResultsToAnalyticsDocument(){return this.state.recommendation?.recommendations.map(t=>({documentUri:t.uri,documentUriHash:t.raw.urihash}))}get numberOfResults(){return this.state.recommendation?.recommendations.length||yo().recommendations.length}};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function uh(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}m();d();f();p();m();d();f();p();m();d();f();p();var lh=/^(?:[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 wR(e){return typeof e=="string"&&lh.test(e)}var Nd=wR;m();d();f();p();var it=[];for(let e=0;e<256;++e)it.push((e+256).toString(16).slice(1));function dh(e,t=0){return(it[e[t+0]]+it[e[t+1]]+it[e[t+2]]+it[e[t+3]]+"-"+it[e[t+4]]+it[e[t+5]]+"-"+it[e[t+6]]+it[e[t+7]]+"-"+it[e[t+8]]+it[e[t+9]]+"-"+it[e[t+10]]+it[e[t+11]]+it[e[t+12]]+it[e[t+13]]+it[e[t+14]]+it[e[t+15]]).toLowerCase()}m();d();f();p();var AR=new Uint8Array(16);function Fd(){return crypto.getRandomValues(AR)}m();d();f();p();function xR(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():CR(e,t,r)}function CR(e,t,r){e=e||{};let n=e.random??e.rng?.()??Fd();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return dh(n)}var Dd=xR;function ER(_x19){return _ER.apply(this,arguments)}function _ER(){_ER=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:i,mode:a}=e;if(a!=="disabled")return n.call(r),t.send(o,i,r)});return _ER.apply(this,arguments)}var yh="2.1.3",Md=128,vh=192,ph=224,fh=240,RR=248;function IR(e){return(e&RR)===fh?4:(e&fh)===ph?3:(e&ph)===vh?2:1}function TR(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&Md)!=Md)break;if(r-=3,(n&vh)!=Md){t-r>=IR(n)*3&&(r=t);break}}return e.substring(0,r)}function _R(e){let{trackingId:t}=e;return{trackingId:t}}function kR(e){return(e.source||[]).concat([`relay@${yh}`])}function Sh(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,a=_R(t),s=r.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:kR(t),clientId:s,userAgent:i(),referrer:mh(n()),location:mh(o())})}function mh(e){return e!==null?TR(e,1024):null}function OR(e,t,r,n){return{...t,meta:Sh(e,r,n)}}var PR="*";function NR(){let e=[];function t({type:c,callback:u}){return e.findIndex(h=>h.type===c&&h.callback===u)}function r(c,u){return c.type==="*"||u===c.type}function n(c){return t(c)<0&&e.push(c),()=>s(c.type,c.callback)}function o(c){e.forEach(u=>{if(r(u,c.meta.type))try{u.callback(c)}catch(h){console.error(h)}})}function i(c){if(c===PR)e.length=0;else for(let u=e.length-1;u>=0;u--)e[u].type===c&&e.splice(u,1)}function a(c){let u=t(c);u>=0&&e.splice(u,1)}function s(c,u){u?a({type:c,callback:u}):i(c)}return{add:n,call:o,remove:s}}function gh({url:e,token:t,trackingId:r,...n}){return Object.freeze({url:e,token:t,trackingId:r,...(!!n.mode&&{mode:n.mode}),...(!!n.source&&{source:n.source}),...(!!n.environment&&{environment:n.environment})})}function FR(e){let t=gh(e);return{get:()=>t,update:r=>{t=gh({...t,...r})}}}var qd=DR();function DR(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,o=document.cookie.split(";");for(let i of o){let a=i.replace(/^\s+/,"");if(a.lastIndexOf(n,0)===0)return a.substring(n.length,a.length)}return null},setItem(r,n,o){let i=t(window.location.hostname),a=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,s=i?`;domain=${i}`:"";document.cookie=`${e}${r}=${n}${a}${s};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function MR(){return{getItem(e){return qd.getItem(e)||localStorage.getItem(e)},removeItem(e){qd.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),qd.setItem(e,t,31556952e3)}}}var hh="visitorId";function qR(){let e=document.referrer;return e===""?null:e}function jd(){let e=MR();return{runtime:"browser",send:function(){var _ref11=_asyncToGenerator(function*(t,r,n){let o=A(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});uh().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let a=yield o;if(a?.ok){let s;try{s=yield a.json()}catch{return}for(let c of s.events)if(!c.accepted)throw new Error(`Received event was rejected for processing: ${c.errorMessage}`)}else throw new Error(`Error ${a.status}: Failed to send the event(s).`)});return function send(_x20,_x21,_x22){return _ref11.apply(this,arguments)}}(),getReferrer:()=>qR(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(hh);if(t&&Nd(t))return t;let r=Dd();return e.setItem(hh,r),r}}}function jR(){try{let e="__storage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return e instanceof DOMException&&e.name==="QuotaExceededError"&&localStorage&&localStorage.length!==0}}function LR(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function UR(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=LR();return t&&r?{...r,runtime:"custom"}:t&&VR()&&jR()?jd():n}function VR(){try{return typeof window=="object"}catch{return!1}}function BR(e){return{get:()=>Object.freeze(UR(e))}}function bh(e){let t=FR(e),r=NR(),n=BR(t);return{emit:function(){var _ref12=_asyncToGenerator(function*(o,i){let a=t.get(),s=n.get(),c=OR(o,i,a,s);return ER({config:a,environment:s,event:c,listenerManager:r})});return function emit(_x23,_x24){return _ref12.apply(this,arguments)}}(),getMeta:o=>Sh(o,t.get(),n.get()),on:(o,i)=>r.add({type:o,callback:i}),off:(o,i)=>r.remove(o,i),updateConfig:o=>t.update(o),version:yh}}m();d();f();p();function wh(){return typeof window<"u"&&typeof document<"u"}var ji=$e(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>uo(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},a,s)=>{let c=$R(s);return bh({mode:i?"emit":"disabled",url:o??Na(e,t),token:r,trackingId:n??null,source:a,environment:c})}),GR={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref13=_asyncToGenerator(function*(){});return function send(){return _ref13.apply(this,arguments)}}()},$R=e=>{if(!e)return;let t=e();return{...(wh()?jd():GR),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();var Li=class extends pr{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Ah=({logger:e,getState:t,analyticsClientMiddleware:r=(a,s)=>s,preprocessRequest:n,provider:o=new Li(t),disableBrowserPrivacySignals:i})=>{let a=t(),s=a.configuration.accessToken,c=a.configuration.analytics.apiBaseUrl??It(a.configuration.organizationId,a.configuration.environment,"analytics"),u=a.configuration.analytics.runtimeEnvironment,h=a.configuration.analytics.enabled,v=new Fs({enableAnalytics:h,token:s,endpoint:c,runtimeEnvironment:u,disableBrowserPrivacySignals:i,preprocessRequest:Fi(e,n),beforeSendHooks:[Di(e,r),(C,g)=>(e.info({...g,type:C,endpoint:c,token:s},"Analytics request"),g)]},o);return h||v.disable(),v};m();d();f();p();m();d();f();p();function Ch(e,t){return{...new kr(t).getBaseMetadata(),actionCause:e,type:e}}function QR(e){return Object.assign(e,{instantlyCallable:!0})}function HR(e,t){let r=i=>{let a=Ie(e,i);return QR(Object.assign(a,{type:a.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(i,{getState:a,extra:s}){let{analyticsClientMiddleware:c,preprocessRequest:u,logger:h,disableBrowserPrivacySignals:v}=s;return yield(yield t({getState:a,analyticsClientMiddleware:c,preprocessRequest:u,logger:h,disableBrowserPrivacySignals:v})).log({state:a(),extra:s})});return function(_x25,_x26){return _ref14.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref15=_asyncToGenerator(function*({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:c,disableBrowserPrivacySignals:u}){let{description:h,log:v}=yield t({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:c,disableBrowserPrivacySignals:u});return{description:h,action:r(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(C,{getState:g,extra:y}){return yield v({state:g(),extra:y})});return function(_x28,_x29){return _ref16.apply(this,arguments)}}())}});return function prepare(_x27){return _ref15.apply(this,arguments)}}()}),n}var Eh=(e,t,r)=>{function n(...o){let i=o.length===1?{...o[0],__legacy__getBuilder:t(o[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:r}:{prefix:o[0],__legacy__getBuilder:t(o[1]),__legacy__provider:o[2],analyticsConfigurator:e,providerClass:r};return KR(i)}return n},zR=e=>e.configuration.analytics.analyticsMode==="legacy",WR=e=>e.configuration.analytics.analyticsMode==="next",KR=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:a})=>(r??(r=s=>new a(s)),HR(e,/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*({getState:s,analyticsClientMiddleware:c,preprocessRequest:u,logger:h,disableBrowserPrivacySignals:v}){let C=[],g={log:function(){var _ref18=_asyncToGenerator(function*({state:k}){for(let I of C)yield I(k)});return function log(_x31){return _ref18.apply(this,arguments)}}()},y=s(),S=i({getState:s,logger:h,analyticsClientMiddleware:c,preprocessRequest:u,disableBrowserPrivacySignals:v,provider:r(s)}),E=yield t(S,s());g.description=E?.description,C.push(/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(k){zR(k)&&(yield YR(E,r,k,h,S.coveoAnalyticsClient))});return function(_x32){return _ref19.apply(this,arguments)}}());let{emit:R}=ji(y);return C.push(/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(k){if(WR(k)&&o&&n){let I=n(k);yield nI(R,o,I)}});return function(_x33){return _ref20.apply(this,arguments)}}()),g});return function(_x30){return _ref17.apply(this,arguments)}}()));function YR(_x34,_x35,_x36,_x37,_x38){return _YR.apply(this,arguments)}function _YR(){_YR=_asyncToGenerator(function*(e,t,r,n,o){t(()=>r);let i=yield e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:o,response:i},"Analytics response")});return _YR.apply(this,arguments)}var XR=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref21=_asyncToGenerator(function*(i){r(n,o)});return function log(_x39){return _ref21.apply(this,arguments)}}()}),Pe=Eh(e=>ch({...e,provider:e.provider||new kr(e.getState)}),e=>e,kr),WB=Eh(Ah,XR("caseAssist"),Li);var Ld=(e,t)=>{let r=t.recommendation?.recommendations.findIndex(({uniqueId:n})=>e.uniqueId===n)||0;return ZR(e,r,t)},Rh=(e,t)=>({sourceName:Th(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Ir()}),Ih=(e,t)=>({sourceName:Th(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Ir()});function Th(e){let t=e.source;return se(t)?"unknown":t}var _h=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function ZR(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:tI(e),...(xh(e)?{documentCategory:xh(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:rI(e),queryPipeline:r.pipeline||Ir()}}function xh(e){return e.raw?.objecttype||void 0}var Gs=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||""}),kh={urihash:new z,sourcetype:new z,permanentid:new z},Oh={uniqueId:Y,raw:new ne({values:kh}),title:Y,uri:Y,clickUri:Y,rankingModifier:new z({required:!1,emptyAllowed:!0})};function JR(e){return Object.assign({},...Object.keys(kh).map(t=>({[t]:e[t]})))}function eI(e){return Object.assign({},...Object.keys(Oh).map(t=>({[t]:e[t]})),{raw:JR(e.raw)})}function tI(e){let t=e.raw.author;return se(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function rI(e){let t=e.raw.source;return se(t)?"unknown":t}var Ud=e=>new ht(Oh).validate(eI(e));function nI(_x40,_x41,_x42){return _nI.apply(this,arguments)}function _nI(){_nI=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _nI.apply(this,arguments)}m();d();f();p();var Ph=()=>Pe("analytics/recommendation/update",e=>e.makeRecommendationInterfaceLoad(),e=>new qi(e)),Nh=()=>({actionCause:"recommendationInterfaceLoad"}),Qs=e=>Pe({prefix:"analytics/recommendation/open",__legacy__getBuilder:(t,r)=>(Ud(e),t.makeRecommendationOpen(Ld(e,r),Gs(e))),__legacy__provider:t=>new qi(t),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=Ld(e,t),n=Gs(e);return{responseId:e.searchUid??"",position:r.documentPosition,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.documentTitle,author:r.documentAuthor,url:r.documentUrl}}}});var vo=O("recommendation/set",e=>B(e,{id:Y})),Or=Ie("recommendation/get",/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=Date.now(),a=yield oI(o),s=yield n.recommendations(a),c=Date.now()-i;return yt(s)?r(s.error):{recommendations:s.success.results,analyticsAction:Ph(),duration:c,searchUid:s.success.searchUid,splitTestRun:s.success.splitTestRun,pipeline:s.success.pipeline}});return function(_x43,_x44){return _ref22.apply(this,arguments)}}()),oI=/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??wr(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?gt.getInstance().getHistory():[],...(e.advancedSearchQueries&&{aq:e.advancedSearchQueries.aq,cq:e.advancedSearchQueries.cq}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.context&&{context:e.context.contextValues}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.configuration.analytics.enabled&&(yield iI(e,Nh()))),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}),...(e.pagination&&{numberOfResults:e.pagination.numberOfResults})}});return function oI(_x45){return _ref23.apply(this,arguments)}}(),iI=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t){let r=e.configuration.analytics.analyticsMode==="legacy"?void 0:{actionCause:t.actionCause,type:t.actionCause};return yield Bs(e.configuration.analytics,r)});return function iI(_x46,_x47){return _ref24.apply(this,arguments)}}();var So=Be(yo(),e=>{e.addCase(vo,(t,r)=>{t.id=r.payload.id}).addCase(Or.rejected,(t,r)=>{t.error=r.payload?r.payload:null,t.isLoading=!1}).addCase(Or.fulfilled,(t,r)=>{t.error=null,t.recommendations=r.payload.recommendations.map(n=>({...n,searchUid:r.payload.searchUid})),t.duration=r.payload.duration,t.isLoading=!1,t.searchUid=r.payload.searchUid,t.splitTestRun=r.payload.splitTestRun,t.pipeline=r.payload.pipeline}).addCase(Or.pending,t=>{t.isLoading=!0}).addCase(hs,(t,r)=>{t.error=r.payload,t.isLoading=!1})});m();d();f();p();var bo=O("searchHub/set",e=>B(e,new z({required:!0,emptyAllowed:!0})));m();d();f();p();var wo=Be(ho(),e=>{e.addCase(bo,(t,r)=>r.payload).addCase(vt.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Wt,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Fh=class extends Error{constructor(t){super(t[0].message);ae(this,"issues");this.name="SchemaError",this.issues=t}};var mr="uninitialized",Gd="pending",Vi="fulfilled",Bi="rejected";function Dh(e){return{status:e,isUninitialized:e===mr,isLoading:e===Gd,isSuccess:e===Vi,isError:e===Bi}}var Mh=Ht;function Yh(e,t){if(e===t||!(Mh(e)&&Mh(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),o=r.length===n.length,i=Array.isArray(t)?[]:{};for(let a of r)i[a]=Yh(e[a],t[a]),o&&(o=e[a]===i[a]);return o?e:i}function $d(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function aI(e){return new RegExp("(^|:)//").test(e)}function sI(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Wd(e){return e!=null}function qh(e){return[...(e?.values()??[])].filter(Wd)}function cI(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var uI=e=>e.replace(/\/$/,""),lI=e=>e.replace(/^\//,"");function dI(e,t){if(!e)return t;if(!t)return e;if(aI(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=uI(e),t=lI(t),`${e}${r}${t}`}function Ws(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var Qd=()=>new Map,pI=e=>{let t=new l.AbortController;return setTimeout(()=>{let r="signal timed out",n="TimeoutError";t.abort(typeof DOMException<"u"?new DOMException(r,n):Object.assign(new Error(r),{name:n}))},e),t.signal},fI=(...e)=>{for(let r of e)if(r.aborted)return l.AbortSignal.abort(r.reason);let t=new l.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},jh=(...e)=>A(...e),mI=e=>e.status>=200&&e.status<=299,gI=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Lh(e){if(!Ht(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var hI=e=>typeof e=="object"&&(Ht(e)||Array.isArray(e)||typeof e.toJSON=="function");function Xh({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=jh,paramsSerializer:n,isJsonContentType:o=gI,jsonContentType:i="application/json",jsonReplacer:a,timeout:s,responseHandler:c,validateStatus:u,...h}={}){return typeof A>"u"&&r===jh&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(C,g,y){let{getState:S,extra:E,endpoint:R,forced:k,type:I}=g,T,{url:_,headers:D=new x(h.headers),params:G=void 0,responseHandler:V=c??"json",validateStatus:j=u??mI,timeout:L=s,...q}=typeof C=="string"?{url:C}:C,P={...h,signal:L?fI(g.signal,pI(L)):g.signal,...q};D=new x(Lh(D)),P.headers=(yield t(D,{getState:S,arg:C,extra:E,endpoint:R,forced:k,type:I,extraOptions:y}))||D;let N=hI(P.body);if(P.body!=null&&!N&&typeof P.body!="string"&&P.headers.delete("content-type"),!P.headers.has("content-type")&&N&&P.headers.set("content-type",i),N&&o(P.headers)&&(P.body=JSON.stringify(P.body,a)),P.headers.has("accept")||(V==="json"?P.headers.set("accept","application/json"):V==="text"&&P.headers.set("accept","text/plain, text/html, */*")),G){let te=~_.indexOf("?")?"&":"?",ue=n?n(G):new URLSearchParams(Lh(G));_+=te+ue}_=dI(e,_);let F=new Request(_,P);T={request:new Request(_,P)};let Q;try{Q=yield r(F)}catch(te){return{error:{status:(te instanceof Error||typeof DOMException<"u"&&te instanceof DOMException)&&te.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(te)},meta:T}}let Z=Q.clone();T.response=Z;let X,W="";try{let te;if(yield Promise.all([v(Q,V).then(ue=>X=ue,ue=>te=ue),Z.text().then(ue=>W=ue,()=>{})]),te)throw te}catch(te){return{error:{status:"PARSING_ERROR",originalStatus:Q.status,data:W,error:String(te)},meta:T}}return j(Q,X)?{data:X,meta:T}:{error:{status:Q.status,data:X},meta:T}});return function(_x48,_x49,_x50){return _ref25.apply(this,arguments)}}());function v(_x51,_x52){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(C,g){if(typeof g=="function")return g(C);if(g==="content-type"&&(g=o(C.headers)?"json":"text"),g==="json"){let y=yield C.text();return y.length?JSON.parse(y):null}return C.text()});return _v2.apply(this,arguments)}}var Ao=class{constructor(e,t=void 0){ae(this,"value");ae(this,"meta");this.value=e,this.meta=t}};function yI(){return _yI.apply(this,arguments)}function _yI(){_yI=_asyncToGenerator(function*(e=0,t=5,r){let n=Math.min(e,t),o=~~((Math.random()+.4)*(300<<n));yield new Promise((i,a)=>{let s=setTimeout(()=>i(),o);if(r){let c=()=>{clearTimeout(s),a(new Error("Aborted"))};r.aborted?(clearTimeout(s),a(new Error("Aborted"))):r.addEventListener("abort",c,{once:!0})}})});return _yI.apply(this,arguments)}function Zh(e,t){throw Object.assign(new Ao({error:e,meta:t}),{throwImmediately:!0})}function Vd(e){e.aborted&&Zh({status:"CUSTOM_ERROR",error:"Aborted"})}var Uh={},vI=(e,t)=>(/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(r,n,o){let i=[5,(t||Uh).maxRetries,(o||Uh).maxRetries].filter(h=>h!==void 0),[a]=i.slice(-1),c={maxRetries:a,backoff:yI,retryCondition:(h,v,{attempt:C})=>C<=a,...t,...o},u=0;for(;;){Vd(n.signal);try{let h=yield e(r,n,o);if(h.error)throw new Ao(h);return h}catch(h){if(u++,h.throwImmediately){if(h instanceof Ao)return h.value;throw h}if(h instanceof Ao){if(!c.retryCondition(h.value.error,r,{attempt:u,baseQueryApi:n,extraOptions:o}))return h.value}else if(u>c.maxRetries)return{error:h};Vd(n.signal);try{yield c.backoff(u,c.maxRetries,n.signal)}catch(v){throw Vd(n.signal),v}}}});return function(_x53,_x54,_x55){return _ref26.apply(this,arguments)}}()),Jh=Object.assign(vI,{fail:Zh}),Ys="__rtkq/",SI="online",bI="offline";var ey="focused";var Kd=O(`${Ys}${ey}`),ty=O(`${Ys}un${ey}`),Yd=O(`${Ys}${SI}`),ry=O(`${Ys}${bI}`);var Qi="query",ny="mutation",oy="infinitequery";function Xs(e){return e.type===Qi}function wI(e){return e.type===ny}function Zs(e){return e.type===oy}function Ks(e){return Xs(e)||Zs(e)}function Xd(e,t,r,n,o,i){let a=AI(e)?e(t,r,n,o):e;return a?$d(a,Wd,s=>i(iy(s))):[]}function AI(e){return typeof e=="function"}function iy(e){return typeof e=="string"?{type:e}:e}function xI(e,t){return e.catch(t)}var xo=(e,t)=>e.endpointDefinitions[t],Gi=Symbol("forceQueryFn"),Hd=e=>typeof e[Gi]=="function";function CI({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:a}){let s=_=>a(_)?.runningQueries,c=_=>a(_)?.runningMutations,{unsubscribeQueryResult:u,removeMutationResult:h,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:k,buildInitiateInfiniteQuery:I,buildInitiateMutation:T,getRunningQueryThunk:C,getRunningMutationThunk:g,getRunningQueriesThunk:y,getRunningMutationsThunk:S};function C(_,D){return G=>{let V=xo(i,_),j=e({queryArgs:D,endpointDefinition:V,endpointName:_});return s(G)?.get(j)}}function g(_,D){return G=>c(G)?.get(D)}function y(){return _=>qh(s(_))}function S(){return _=>qh(c(_))}function E(_){}function R(_,D){let G=(V,{subscribe:j=!0,forceRefetch:L,subscriptionOptions:q,[Gi]:P,...N}={})=>(F,H)=>{let Q=e({queryArgs:V,endpointDefinition:D,endpointName:_}),Z,X={...N,type:Qi,subscribe:j,forceRefetch:L,subscriptionOptions:q,endpointName:_,originalArgs:V,queryCacheKey:Q,[Gi]:P};if(Xs(D))Z=t(X);else{let{direction:me,initialPageParam:be,refetchCachedPages:he}=N;Z=r({...X,direction:me,initialPageParam:be,refetchCachedPages:he})}let W=o.endpoints[_].select(V),te=F(Z),ue=W(H());let{requestId:Ee,abort:je}=te,ke=ue.requestId!==Ee,Ne=s(F)?.get(Q),Fe=()=>W(H()),ge=Object.assign(P?te.then(Fe):ke&&!Ne?Promise.resolve(ue):Promise.all([Ne,te]).then(Fe),{arg:V,requestId:Ee,subscriptionOptions:q,queryCacheKey:Q,abort:je,unwrap(){return _asyncToGenerator(function*(){let me=yield ge;if(me.isError)throw me.error;return me.data})()},refetch:me=>F(G(V,{subscribe:!1,forceRefetch:!0,...me})),unsubscribe(){j&&F(u({queryCacheKey:Q,requestId:Ee}))},updateSubscriptionOptions(me){ge.subscriptionOptions=me,F(v({endpointName:_,requestId:Ee,queryCacheKey:Q,options:me}))}});if(!Ne&&!ke&&!P){let me=s(F);me.set(Q,ge),ge.then(()=>{me.delete(Q)})}return ge};return G}function k(_,D){return R(_,D)}function I(_,D){return R(_,D)}function T(_){return(D,{track:G=!0,fixedCacheKey:V}={})=>(j,L)=>{let q=n({type:"mutation",endpointName:_,originalArgs:D,track:G,fixedCacheKey:V}),P=j(q);let{requestId:N,abort:F,unwrap:H}=P,Q=xI(P.unwrap().then(te=>({data:te})),te=>({error:te})),Z=()=>{j(h({requestId:N,fixedCacheKey:V}))},X=Object.assign(Q,{arg:P.arg,requestId:N,abort:F,unwrap:H,reset:Z}),W=c(j);return W.set(N,X),X.then(()=>{W.delete(N)}),V&&(W.set(V,X),X.then(()=>{W.get(V)===X&&W.delete(V)})),X}}}var ay=class extends Fh{constructor(t,r,n,o){super(t);ae(this,"value");ae(this,"schemaName");ae(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},dn=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function pn(_x56,_x57,_x58,_x59){return _pn.apply(this,arguments)}function _pn(){_pn=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new ay(o.issues,t,r,n);return o.value});return _pn.apply(this,arguments)}function Vh(e){return e}var Ui=(e={})=>({...e,[Ii]:!0});function EI({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:a,onSchemaFailure:s,catchSchemaFailure:c,skipSchemaValidation:u}){let h=(q,P,N,F)=>(H,Q)=>{let Z=r[q],X=n({queryArgs:P,endpointDefinition:Z,endpointName:q});if(H(o.internalActions.queryResultPatched({queryCacheKey:X,patches:N})),!F)return;let W=o.endpoints[q].select(P)(Q()),te=Xd(Z.providesTags,W.data,void 0,P,{},i);H(o.internalActions.updateProvidedBy([{queryCacheKey:X,providedTags:te}]))};function v(q,P,N=0){let F=[P,...q];return N&&F.length>N?F.slice(0,-1):F}function C(q,P,N=0){let F=[...q,P];return N&&F.length>N?F.slice(1):F}let g=(q,P,N,F=!0)=>(H,Q)=>{let X=o.endpoints[q].select(P)(Q()),W={patches:[],inversePatches:[],undo:()=>H(o.util.patchQueryData(q,P,W.inversePatches,F))};if(X.status===mr)return W;let te;if("data"in X)if(ut(X.data)){let[ue,Ee,je]=Zl(X.data,N);W.patches.push(...Ee),W.inversePatches.push(...je),te=ue}else te=N(X.data),W.patches.push({op:"replace",path:[],value:te}),W.inversePatches.push({op:"replace",path:[],value:X.data});return W.patches.length===0||H(o.util.patchQueryData(q,P,W.patches,F)),W},y=(q,P,N)=>F=>F(o.endpoints[q].initiate(P,{subscribe:!1,forceRefetch:!0,[Gi]:()=>({data:N})})),S=(q,P)=>q.query&&q[P]?q[P]:Vh,E=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(q,{signal:P,abort:N,rejectWithValue:F,fulfillWithValue:H,dispatch:Q,getState:Z,extra:X}){let W=r[q.endpointName],{metaSchema:te,skipSchemaValidation:ue=u}=W,Ee=q.type===Qi;try{let je=Vh,ke={signal:P,abort:N,dispatch:Q,getState:Z,extra:X,endpoint:q.endpointName,type:q.type,forced:Ee?R(q,Z()):void 0,queryCacheKey:Ee?q.queryCacheKey:void 0},Ne=Ee?q[Gi]:void 0,Fe,ge=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(be,he,He,Ke){if(he==null&&be.pages.length)return Promise.resolve({data:be});let Dt={queryArg:q.originalArgs,pageParam:he},At=yield me(Dt),Gt=Ke?v:C;return{data:{pages:Gt(be.pages,At.data,He),pageParams:Gt(be.pageParams,he,He)},meta:At.meta}});return function ge(_x62,_x63,_x64,_x65){return _ref28.apply(this,arguments)}}();function me(_x66){return _me.apply(this,arguments)}function _me(){_me=_asyncToGenerator(function*(be){let he,{extraOptions:He,argSchema:Ke,rawResponseSchema:Dt,responseSchema:At}=W;if(Ke&&!dn(ue,"arg")&&(be=yield pn(Ke,be,"argSchema",{})),Ne?he=Ne():W.query?(je=S(W,"transformResponse"),he=yield t(W.query(be),ke,He)):he=yield W.queryFn(be,ke,He,Mt=>t(Mt,ke,He)),typeof process<"u",he.error)throw new Ao(he.error,he.meta);let{data:Gt}=he;Dt&&!dn(ue,"rawResponse")&&(Gt=yield pn(Dt,he.data,"rawResponseSchema",he.meta));let Rt=yield je(Gt,he.meta,be);return At&&!dn(ue,"response")&&(Rt=yield pn(At,Rt,"responseSchema",he.meta)),{...he,data:Rt}});return _me.apply(this,arguments)}if(Ee&&"infiniteQueryOptions"in W){let{infiniteQueryOptions:be}=W,{maxPages:he=1/0}=be,He=q.refetchCachedPages??be.refetchCachedPages??!0,Ke,Dt={pages:[],pageParams:[]},At=a.selectQueryEntry(Z(),q.queryCacheKey)?.data,Rt=R(q,Z())&&!q.direction||!At?Dt:At;if("direction"in q&&q.direction&&Rt.pages.length){let Mt=q.direction==="backward",Ca=(Mt?sy:zd)(be,Rt,q.originalArgs);Ke=yield ge(Rt,Ca,he,Mt)}else{let{initialPageParam:Mt=be.initialPageParam}=q,ti=At?.pageParams??[],Ca=ti[0]??Mt,Xw=ti.length;if(Ke=yield ge(Rt,Ca,he),Ne&&(Ke={data:Ke.data.pages[0]}),He)for(let Nf=1;Nf<Xw;Nf++){let Zw=zd(be,Ke.data,q.originalArgs);Ke=yield ge(Ke.data,Zw,he)}}Fe=Ke}else Fe=yield me(q.originalArgs);return te&&!dn(ue,"meta")&&Fe.meta&&(Fe.meta=yield pn(te,Fe.meta,"metaSchema",Fe.meta)),H(Fe.data,Ui({fulfilledTimeStamp:Date.now(),baseQueryMeta:Fe.meta}))}catch(je){let ke=je;if(ke instanceof Ao){let Ne=S(W,"transformErrorResponse"),{rawErrorResponseSchema:Fe,errorResponseSchema:ge}=W,{value:me,meta:be}=ke;try{Fe&&!dn(ue,"rawErrorResponse")&&(me=yield pn(Fe,me,"rawErrorResponseSchema",be)),te&&!dn(ue,"meta")&&(be=yield pn(te,be,"metaSchema",be));let he=yield Ne(me,be,q.originalArgs);return ge&&!dn(ue,"errorResponse")&&(he=yield pn(ge,he,"errorResponseSchema",be)),F(he,Ui({baseQueryMeta:be}))}catch(he){ke=he}}try{if(ke instanceof ay){let Ne={endpoint:q.endpointName,arg:q.originalArgs,type:q.type,queryCacheKey:Ee?q.queryCacheKey:void 0};W.onSchemaFailure?.(ke,Ne),s?.(ke,Ne);let{catchSchemaFailure:Fe=c}=W;if(Fe)return F(Fe(ke,Ne),Ui({baseQueryMeta:ke._bqMeta}))}}catch(Ne){ke=Ne}throw typeof process<"u",console.error(ke),ke}});return function E(_x60,_x61){return _ref27.apply(this,arguments)}}();function R(q,P){let N=a.selectQueryEntry(P,q.queryCacheKey),F=a.selectConfig(P).refetchOnMountOrArgChange,H=N?.fulfilledTimeStamp,Q=q.forceRefetch??(q.subscribe&&F);return Q?Q===!0||(Number(new Date)-Number(H))/1e3>=Q:!1}let k=()=>Ie(`${e}/executeQuery`,E,{getPendingMeta({arg:P}){let N=r[P.endpointName];return Ui({startedTimeStamp:Date.now(),...(Zs(N)?{direction:P.direction}:{})})},condition(P,{getState:N}){let F=N(),H=a.selectQueryEntry(F,P.queryCacheKey),Q=H?.fulfilledTimeStamp,Z=P.originalArgs,X=H?.originalArgs,W=r[P.endpointName],te=P.direction;return Hd(P)?!0:H?.status==="pending"?!1:R(P,F)||Xs(W)&&W?.forceRefetch?.({currentArg:Z,previousArg:X,endpointState:H,state:F})?!0:!(Q&&!te)},dispatchConditionRejection:!0}),I=k(),T=k(),_=Ie(`${e}/executeMutation`,E,{getPendingMeta(){return Ui({startedTimeStamp:Date.now()})}}),D=q=>"force"in q,G=q=>"ifOlderThan"in q,V=(q,P,N={})=>(F,H)=>{let Q=D(N)&&N.force,Z=G(N)&&N.ifOlderThan,X=(te=!0)=>{let ue={forceRefetch:te,subscribe:!1};return o.endpoints[q].initiate(P,ue)},W=o.endpoints[q].select(P)(H());if(Q)F(X());else if(Z){let te=W?.fulfilledTimeStamp;if(!te){F(X());return}(Number(new Date)-Number(new Date(te)))/1e3>=Z&&F(X())}else F(X(!1))};function j(q){return P=>P?.meta?.arg?.endpointName===q}function L(q,P){return{matchPending:eo(is(q),j(P)),matchFulfilled:eo(cr(q),j(P)),matchRejected:eo(sn(q),j(P))}}return{queryThunk:I,mutationThunk:_,infiniteQueryThunk:T,prefetch:V,updateQueryData:g,upsertQueryData:y,patchQueryData:h,buildMatchThunkActions:L}}function zd(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function sy(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function cy(e,t,r,n){return Xd(r[e.meta.arg.endpointName][t],cr(e)?e.payload:void 0,_i(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function Bh(e){return ft(e)?Za(e):e}function Hs(e,t,r){let n=e[t];n&&r(n)}function $i(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function Gh(e,t,r){let n=e[$i(t)];n&&r(n)}var zs={};function RI({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:a,hasRehydrationInfo:s},assertTagType:c,config:u}){let h=O(`${e}/resetApiState`);function v(j,L,q,P){var N;j[N=L.queryCacheKey]??(j[N]={status:mr,endpointName:L.endpointName}),Hs(j,L.queryCacheKey,F=>{F.status=Gd,F.requestId=q&&F.requestId?F.requestId:P.requestId,L.originalArgs!==void 0&&(F.originalArgs=L.originalArgs),F.startedTimeStamp=P.startedTimeStamp;let H=o[P.arg.endpointName];Zs(H)&&"direction"in L&&(F.direction=L.direction)})}function C(j,L,q,P){Hs(j,L.arg.queryCacheKey,N=>{if(N.requestId!==L.requestId&&!P)return;let{merge:F}=o[L.arg.endpointName];if(N.status=Vi,F){if(N.data!==void 0){let{fulfilledTimeStamp:H,arg:Q,baseQueryMeta:Z,requestId:X}=L,W=on(N.data,te=>F(te,q,{arg:Q.originalArgs,baseQueryMeta:Z,fulfilledTimeStamp:H,requestId:X}));N.data=W}else N.data=q;}else N.data=o[L.arg.endpointName].structuralSharing??!0?Yh(ft(N.data)?km(N.data):N.data,q):q;delete N.error,N.fulfilledTimeStamp=L.fulfilledTimeStamp})}let g=cn({name:`${e}/queries`,initialState:zs,reducers:{removeQueryResult:{reducer(j,{payload:{queryCacheKey:L}}){delete j[L]},prepare:to()},cacheEntriesUpserted:{reducer(j,L){for(let q of L.payload){let{queryDescription:P,value:N}=q;v(j,P,!0,{arg:P,requestId:L.meta.requestId,startedTimeStamp:L.meta.timestamp}),C(j,{arg:P,requestId:L.meta.requestId,fulfilledTimeStamp:L.meta.timestamp,baseQueryMeta:{}},N,!0)}},prepare:j=>({payload:j.map(P=>{let{endpointName:N,arg:F,value:H}=P,Q=o[N];return{queryDescription:{type:Qi,endpointName:N,originalArgs:P.arg,queryCacheKey:n({queryArgs:F,endpointDefinition:Q,endpointName:N})},value:H}}),meta:{[Ii]:!0,requestId:ki(),timestamp:Date.now()}})},queryResultPatched:{reducer(j,{payload:{queryCacheKey:L,patches:q}}){Hs(j,L,P=>{P.data=Jl(P.data,q.concat())})},prepare:to()}},extraReducers(j){j.addCase(t.pending,(L,{meta:q,meta:{arg:P}})=>{let N=Hd(P);v(L,P,N,q)}).addCase(t.fulfilled,(L,{meta:q,payload:P})=>{let N=Hd(q.arg);C(L,q,P,N)}).addCase(t.rejected,(L,{meta:{condition:q,arg:P,requestId:N},error:F,payload:H})=>{Hs(L,P.queryCacheKey,Q=>{if(!q){if(Q.requestId!==N)return;Q.status=Bi,Q.error=H??F}})}).addMatcher(s,(L,q)=>{let{queries:P}=a(q);for(let[N,F]of Object.entries(P))(F?.status===Vi||F?.status===Bi)&&(L[N]=F)})}}),y=cn({name:`${e}/mutations`,initialState:zs,reducers:{removeMutationResult:{reducer(j,{payload:L}){let q=$i(L);q in j&&delete j[q]},prepare:to()}},extraReducers(j){j.addCase(r.pending,(L,{meta:q,meta:{requestId:P,arg:N,startedTimeStamp:F}})=>{N.track&&(L[$i(q)]={requestId:P,status:Gd,endpointName:N.endpointName,startedTimeStamp:F})}).addCase(r.fulfilled,(L,{payload:q,meta:P})=>{P.arg.track&&Gh(L,P,N=>{N.requestId===P.requestId&&(N.status=Vi,N.data=q,N.fulfilledTimeStamp=P.fulfilledTimeStamp)})}).addCase(r.rejected,(L,{payload:q,error:P,meta:N})=>{N.arg.track&&Gh(L,N,F=>{F.requestId===N.requestId&&(F.status=Bi,F.error=q??P)})}).addMatcher(s,(L,q)=>{let{mutations:P}=a(q);for(let[N,F]of Object.entries(P))(F?.status===Vi||F?.status===Bi)&&N!==F?.requestId&&(L[N]=F)})}}),S={tags:{},keys:{}},E=cn({name:`${e}/invalidation`,initialState:S,reducers:{updateProvidedBy:{reducer(j,L){var q,P,N;for(let{queryCacheKey:F,providedTags:H}of L.payload){R(j,F);for(let{type:Q,id:Z}of H){let X=(P=(q=j.tags)[Q]??(q[Q]={}))[N=Z||"__internal_without_id"]??(P[N]=[]);X.includes(F)||X.push(F)}j.keys[F]=H}},prepare:to()}},extraReducers(j){j.addCase(g.actions.removeQueryResult,(L,{payload:{queryCacheKey:q}})=>{R(L,q)}).addMatcher(s,(L,q)=>{var N,F,H;let{provided:P}=a(q);for(let[Q,Z]of Object.entries(P.tags??{}))for(let[X,W]of Object.entries(Z)){let te=(F=(N=L.tags)[Q]??(N[Q]={}))[H=X||"__internal_without_id"]??(F[H]=[]);for(let ue of W)te.includes(ue)||te.push(ue),L.keys[ue]=P.keys[ue]}}).addMatcher(zt(cr(t),_i(t)),(L,q)=>{k(L,[q])}).addMatcher(g.actions.cacheEntriesUpserted.match,(L,q)=>{let P=q.payload.map(({queryDescription:N,value:F})=>({type:"UNKNOWN",payload:F,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:N}}));k(L,P)})}});function R(j,L){let q=Bh(j.keys[L]??[]);for(let P of q){let N=P.type,F=P.id??"__internal_without_id",H=j.tags[N]?.[F];H&&(j.tags[N][F]=Bh(H).filter(Q=>Q!==L))}delete j.keys[L]}function k(j,L){let q=L.map(P=>{let N=cy(P,"providesTags",o,c),{queryCacheKey:F}=P.meta.arg;return{queryCacheKey:F,providedTags:N}});E.caseReducers.updateProvidedBy(j,E.actions.updateProvidedBy(q))}let I=cn({name:`${e}/subscriptions`,initialState:zs,reducers:{updateSubscriptionOptions(j,L){},unsubscribeQueryResult(j,L){},internal_getRTKQSubscriptions(){}}}),T=cn({name:`${e}/internalSubscriptions`,initialState:zs,reducers:{subscriptionsUpdated:{reducer(j,L){return Jl(j,L.payload)},prepare:to()}}}),_=cn({name:`${e}/config`,initialState:{online:cI(),focused:sI(),middlewareRegistered:!1,...u},reducers:{middlewareRegistered(j,{payload:L}){j.middlewareRegistered=j.middlewareRegistered==="conflict"||i!==L?"conflict":!0}},extraReducers:j=>{j.addCase(Yd,L=>{L.online=!0}).addCase(ry,L=>{L.online=!1}).addCase(Kd,L=>{L.focused=!0}).addCase(ty,L=>{L.focused=!1}).addMatcher(s,L=>({...L}))}}),D=Yn({queries:g.reducer,mutations:y.reducer,provided:E.reducer,subscriptions:T.reducer,config:_.reducer}),G=(j,L)=>D(h.match(L)?void 0:j,L),V={..._.actions,...g.actions,...I.actions,...T.actions,...y.actions,...E.actions,resetApiState:h};return{reducer:G,actions:V}}var Bd=Symbol.for("RTKQ/skipToken"),uy={status:mr},$h=on(uy,()=>{}),Qh=on(uy,()=>{});function II({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=I=>$h,o=I=>Qh;return{buildQuerySelector:C,buildInfiniteQuerySelector:g,buildMutationSelector:y,selectInvalidatedBy:S,selectCachedArgsForQuery:E,selectApiState:a,selectQueries:s,selectMutations:u,selectQueryEntry:c,selectConfig:h};function i(I){return{...I,...Dh(I.status)}}function a(I){return I[t]}function s(I){return a(I)?.queries}function c(I,T){return s(I)?.[T]}function u(I){return a(I)?.mutations}function h(I){return a(I)?.config}function v(I,T,_){return D=>{if(D===Bd)return r(n,_);let G=e({queryArgs:D,endpointDefinition:T,endpointName:I});return r(j=>c(j,G)??$h,_)}}function C(I,T){return v(I,T,i)}function g(I,T){let{infiniteQueryOptions:_}=T;function D(G){let V={...G,...Dh(G.status)},{isLoading:j,isError:L,direction:q}=V,P=q==="forward",N=q==="backward";return{...V,hasNextPage:R(_,V.data,V.originalArgs),hasPreviousPage:k(_,V.data,V.originalArgs),isFetchingNextPage:j&&P,isFetchingPreviousPage:j&&N,isFetchNextPageError:L&&P,isFetchPreviousPageError:L&&N}}return v(I,T,D)}function y(){return I=>{let T;return typeof I=="object"?T=$i(I)??Bd:T=I,r(T===Bd?o:G=>a(G)?.mutations?.[T]??Qh,i)}}function S(I,T){let _=I[t],D=new Set,G=$d(T,Wd,iy);for(let V of G){let j=_.provided.tags[V.type];if(!j)continue;let L=(V.id!==void 0?j[V.id]:Object.values(j).flat())??[];for(let q of L)D.add(q)}return Array.from(D.values()).flatMap(V=>{let j=_.queries[V];return j?{queryCacheKey:V,endpointName:j.endpointName,originalArgs:j.originalArgs}:[]})}function E(I,T){return $d(Object.values(s(I)),_=>_?.endpointName===T&&_.status!==mr,_=>_.originalArgs)}function R(I,T,_){return T?zd(I,T,_)!=null:!1}function k(I,T,_){return!T||!I.getPreviousPageParam?!1:sy(I,T,_)!=null}}var Hh=WeakMap?new WeakMap:void 0,zh=({endpointName:e,queryArgs:t})=>{let r="",n=Hh?.get(t);if(typeof n=="string")r=n;else{let o=JSON.stringify(t,(i,a)=>(a=typeof a=="bigint"?{$bigint:a.toString()}:a,a=Ht(a)?Object.keys(a).sort().reduce((s,c)=>(s[c]=a[c],s),{}):a,a));Ht(t)&&Hh?.set(t,o),r=o}return`${e}(${r})`};function TI(...e){return function(r){let n=Ei(u=>r.extractRehydrationInfo?.(u,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(u){let h=zh;if("serializeQueryArgs"in u.endpointDefinition){let v=u.endpointDefinition.serializeQueryArgs;h=C=>{let g=v(C);return typeof g=="string"?g:zh({...C,queryArgs:g})}}else r.serializeQueryArgs&&(h=r.serializeQueryArgs);return h(u)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(u){u()},apiUid:ki(),extractRehydrationInfo:n,hasRehydrationInfo:Ei(u=>n(u)!=null)},a={injectEndpoints:c,enhanceEndpoints({addTagTypes:u,endpoints:h}){if(u)for(let v of u)o.tagTypes.includes(v)||o.tagTypes.push(v);if(h)for(let[v,C]of Object.entries(h))typeof C=="function"?C(xo(i,v)):Object.assign(xo(i,v)||{},C);return a}},s=e.map(u=>u.init(a,o,i));function c(u){let h=u.endpoints({query:v=>({...v,type:Qi}),mutation:v=>({...v,type:ny}),infiniteQuery:v=>({...v,type:oy})});for(let[v,C]of Object.entries(h)){if(u.overrideExisting!==!0&&v in i.endpointDefinitions){if(u.overrideExisting==="throw")throw new Error(mt(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[v]=C;for(let g of s)g.injectEndpoint(v,C)}return a}return a.injectEndpoints({endpoints:r.endpoints})}}function fr(e,...t){return Object.assign(e,...t)}var _I=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,i=null,a=null,{updateSubscriptionOptions:s,unsubscribeQueryResult:c}=e.internalActions,u=(S,E)=>{if(s.match(E)){let{queryCacheKey:k,requestId:I,options:T}=E.payload,_=S.get(k);return _?.has(I)&&_.set(I,T),!0}if(c.match(E)){let{queryCacheKey:k,requestId:I}=E.payload,T=S.get(k);return T&&T.delete(I),!0}if(e.internalActions.removeQueryResult.match(E))return S.delete(E.payload.queryCacheKey),!0;if(t.pending.match(E)){let{meta:{arg:k,requestId:I}}=E,T=Ws(S,k.queryCacheKey,Qd);return k.subscribe&&T.set(I,k.subscriptionOptions??T.get(I)??{}),!0}let R=!1;if(t.rejected.match(E)){let{meta:{condition:k,arg:I,requestId:T}}=E;if(k&&I.subscribe){let _=Ws(S,I.queryCacheKey,Qd);_.set(T,I.subscriptionOptions??_.get(T)??{}),R=!0}}return R},h=()=>r.currentSubscriptions,g={getSubscriptions:h,getSubscriptionCount:S=>h().get(S)?.size??0,isRequestSubscribed:(S,E)=>!!h()?.get(S)?.get(E)};function y(S){return JSON.parse(JSON.stringify(Object.fromEntries([...S].map(([E,R])=>[E,Object.fromEntries(R)]))))}return(S,E)=>{if(i||(i=y(r.currentSubscriptions)),e.util.resetApiState.match(S))return i={},r.currentSubscriptions.clear(),a=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(S))return[!1,g];let R=u(r.currentSubscriptions,S),k=!0;if(R){a||(a=setTimeout(()=>{let _=y(r.currentSubscriptions),[,D]=Zl(i,()=>_);E.next(e.internalActions.subscriptionsUpdated(D)),i=_,a=null},500));let I=typeof S.type=="string"&&!!S.type.startsWith(o),T=t.rejected.match(S)&&S.meta.condition&&!!S.meta.arg.subscribe;k=!I&&!T}return[k,!1]}},kI=2147483647/1e3-1,OI=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:a},getRunningQueryThunk:s,mwApi:c})=>{let{removeQueryResult:u,unsubscribeQueryResult:h,cacheEntriesUpserted:v}=t.internalActions,C=zt(h.match,r.fulfilled,r.rejected,v.match);function g(I){let T=o.currentSubscriptions.get(I);return T?T.size>0:!1}let y={};function S(I){for(let T of I.values())T?.abort?.()}let E=(I,T)=>{let _=T.getState(),D=a(_);if(C(I)){let G;if(v.match(I))G=I.payload.map(V=>V.queryDescription.queryCacheKey);else{let{queryCacheKey:V}=h.match(I)?I.payload:I.meta.arg;G=[V]}R(G,T,D)}if(t.util.resetApiState.match(I)){for(let[G,V]of Object.entries(y))V&&clearTimeout(V),delete y[G];S(o.runningQueries),S(o.runningMutations)}if(n.hasRehydrationInfo(I)){let{queries:G}=n.extractRehydrationInfo(I);R(Object.keys(G),T,D)}};function R(I,T,_){let D=T.getState();for(let G of I){let V=i(D,G);V?.endpointName&&k(G,V.endpointName,T,_)}}function k(I,T,_,D){let V=xo(n,T)?.keepUnusedDataFor??D.keepUnusedDataFor;if(V===1/0)return;let j=Math.max(0,Math.min(V,kI));if(!g(I)){let L=y[I];L&&clearTimeout(L),y[I]=setTimeout(()=>{if(!g(I)){let q=i(_.getState(),I);q?.endpointName&&_.dispatch(s(q.endpointName,q.originalArgs))?.abort(),_.dispatch(u({queryCacheKey:I}))}delete y[I]},j*1e3)}}return E},Wh=new Error("Promise never resolved before cacheEntryRemoved."),PI=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:a,selectApiState:s}})=>{let c=as(n),u=as(o),h=cr(n,o),v={},{removeQueryResult:C,removeMutationResult:g,cacheEntriesUpserted:y}=e.internalActions;function S(_,D,G){let V=v[_];V?.valueResolved&&(V.valueResolved({data:D,meta:G}),delete V.valueResolved)}function E(_){let D=v[_];D&&(delete v[_],D.cacheEntryRemoved())}function R(_){let{arg:D,requestId:G}=_.meta,{endpointName:V,originalArgs:j}=D;return[V,j,G]}let k=(_,D,G)=>{let V=I(_);function j(L,q,P,N){let F=a(G,q),H=a(D.getState(),q);!F&&H&&T(L,N,q,D,P)}if(n.pending.match(_)){let[L,q,P]=R(_);j(L,V,P,q)}else if(y.match(_))for(let{queryDescription:L,value:q}of _.payload){let{endpointName:P,originalArgs:N,queryCacheKey:F}=L;j(P,F,_.meta.requestId,N),S(F,q,{})}else if(o.pending.match(_)){if(D.getState()[t].mutations[V]){let[q,P,N]=R(_);T(q,P,V,D,N)}}else if(h(_))S(V,_.payload,_.meta.baseQueryMeta);else if(C.match(_)||g.match(_))E(V);else if(e.util.resetApiState.match(_))for(let L of Object.keys(v))E(L)};function I(_){return c(_)?_.meta.arg.queryCacheKey:u(_)?_.meta.arg.fixedCacheKey??_.meta.requestId:C.match(_)?_.payload.queryCacheKey:g.match(_)?$i(_.payload):""}function T(_,D,G,V,j){let L=xo(r,_),q=L?.onCacheEntryAdded;if(!q)return;let P={},N=new Promise(W=>{P.cacheEntryRemoved=W}),F=Promise.race([new Promise(W=>{P.valueResolved=W}),N.then(()=>{throw Wh})]);F.catch(()=>{}),v[G]=P;let H=e.endpoints[_].select(Ks(L)?D:G),Q=V.dispatch((W,te,ue)=>ue),Z={...V,getCacheEntry:()=>H(V.getState()),requestId:j,extra:Q,updateCachedData:Ks(L)?W=>V.dispatch(e.util.updateQueryData(_,D,W)):void 0,cacheDataLoaded:F,cacheEntryRemoved:N},X=q(D,Z);Promise.resolve(X).catch(W=>{if(W!==Wh)throw W})}return k},NI=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},FI=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:a,refetchQuery:s,internalState:c})=>{let{removeQueryResult:u}=i.internalActions,h=zt(cr(n),_i(n)),v=zt(cr(o,n),sn(o,n)),C=[],g=0,y=(R,k)=>{(o.pending.match(R)||n.pending.match(R))&&g++,v(R)&&(g=Math.max(0,g-1)),h(R)?E(cy(R,"invalidatesTags",r,a),k):v(R)?E([],k):i.util.invalidateTags.match(R)&&E(Xd(R.payload,void 0,void 0,void 0,void 0,a),k)};function S(){return g>0}function E(R,k){let I=k.getState(),T=I[e];if(C.push(...R),T.config.invalidationBehavior==="delayed"&&S())return;let _=C;if(C=[],_.length===0)return;let D=i.util.selectInvalidatedBy(I,_);t.batch(()=>{let G=Array.from(D.values());for(let{queryCacheKey:V}of G){let j=T.queries[V],L=Ws(c.currentSubscriptions,V,Qd);j&&(L.size===0?k.dispatch(u({queryCacheKey:V})):j.status!==mr&&k.dispatch(s(j)))}})}return y},DI=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:a}=o,s=new Set,c=null,u=(E,R)=>{(r.internalActions.updateSubscriptionOptions.match(E)||r.internalActions.unsubscribeQueryResult.match(E))&&h(E.payload.queryCacheKey,R),(t.pending.match(E)||t.rejected.match(E)&&E.meta.condition)&&h(E.meta.arg.queryCacheKey,R),(t.fulfilled.match(E)||t.rejected.match(E)&&!E.meta.condition)&&v(E.meta.arg,R),r.util.resetApiState.match(E)&&(y(),c&&(clearTimeout(c),c=null),s.clear())};function h(E,R){s.add(E),c||(c=setTimeout(()=>{for(let k of s)C({queryCacheKey:k},R);s.clear(),c=null},0))}function v({queryCacheKey:E},R){let k=R.getState()[e],I=k.queries[E],T=a.get(E);if(!I||I.status===mr)return;let{lowestPollingInterval:_,skipPollingIfUnfocused:D}=S(T);if(!Number.isFinite(_))return;let G=i.get(E);G?.timeout&&(clearTimeout(G.timeout),G.timeout=void 0);let V=Date.now()+_;i.set(E,{nextPollTimestamp:V,pollingInterval:_,timeout:setTimeout(()=>{(k.config.focused||!D)&&R.dispatch(n(I)),v({queryCacheKey:E},R)},_)})}function C({queryCacheKey:E},R){let I=R.getState()[e].queries[E],T=a.get(E);if(!I||I.status===mr)return;let{lowestPollingInterval:_}=S(T);if(!Number.isFinite(_)){g(E);return}let D=i.get(E),G=Date.now()+_;(!D||G<D.nextPollTimestamp)&&v({queryCacheKey:E},R)}function g(E){let R=i.get(E);R?.timeout&&clearTimeout(R.timeout),i.delete(E)}function y(){for(let E of i.keys())g(E)}function S(E=new Map){let R=!1,k=Number.POSITIVE_INFINITY;for(let I of E.values())I.pollingInterval&&(k=Math.min(I.pollingInterval,k),R=I.skipPollingIfUnfocused||R);return{lowestPollingInterval:k,skipPollingIfUnfocused:R}}return u},MI=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=is(r,n),i=sn(r,n),a=cr(r,n),s={};return(u,h)=>{if(o(u)){let{requestId:v,arg:{endpointName:C,originalArgs:g}}=u.meta,y=xo(t,C),S=y?.onQueryStarted;if(S){let E={},R=new Promise((_,D)=>{E.resolve=_,E.reject=D});R.catch(()=>{}),s[v]=E;let k=e.endpoints[C].select(Ks(y)?g:v),I=h.dispatch((_,D,G)=>G),T={...h,getCacheEntry:()=>k(h.getState()),requestId:v,extra:I,updateCachedData:Ks(y)?_=>h.dispatch(e.util.updateQueryData(C,g,_)):void 0,queryFulfilled:R};S(g,T)}}else if(a(u)){let{requestId:v,baseQueryMeta:C}=u.meta;s[v]?.resolve({data:u.payload,meta:C}),delete s[v]}else if(i(u)){let{requestId:v,rejectedWithValue:C,baseQueryMeta:g}=u.meta;s[v]?.reject({error:u.payload??u.error,isUnhandledError:!C,meta:g}),delete s[v]}}},qI=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,a=(c,u)=>{Kd.match(c)&&s(u,"refetchOnFocus"),Yd.match(c)&&s(u,"refetchOnReconnect")};function s(c,u){let h=c.getState()[e],v=h.queries,C=o.currentSubscriptions;t.batch(()=>{for(let g of C.keys()){let y=v[g],S=C.get(g);if(!S||!y)continue;let E=[...S.values()];(E.some(k=>k[u]===!0)||E.every(k=>k[u]===void 0)&&h.config[u])&&(S.size===0?c.dispatch(i({queryCacheKey:g})):y.status!==mr&&c.dispatch(n(y)))}})}return a};function jI(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:a}=o,s={invalidateTags:O(`${t}/invalidateTags`)},c=C=>C.type.startsWith(`${t}/`),u=[NI,OI,FI,DI,PI,MI];return{middleware:C=>{let g=!1,y=i(C.dispatch),S={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:c,mwApi:C},E=u.map(I=>I(S)),R=_I(S),k=qI(S);return I=>T=>{if(!fi(T))return I(T);g||(g=!0,C.dispatch(n.internalActions.middlewareRegistered(a)));let _={...C,next:I},D=C.getState(),[G,V]=R(T,_,D),j;if(G?j=I(T):j=V,C.getState()[t]&&(k(T,_,D),c(T)||o.hasRehydrationInfo(T)))for(let L of E)L(T,_,D);return j}},actions:s};function v(C){return e.api.endpoints[C.endpointName].initiate(C.originalArgs,{subscribe:!1,forceRefetch:!0})}}var Kh=Symbol(),LI=({createSelector:e=$e}={})=>({name:Kh,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:a,refetchOnMountOrArgChange:s,refetchOnFocus:c,refetchOnReconnect:u,invalidationBehavior:h,onSchemaFailure:v,catchSchemaFailure:C,skipSchemaValidation:g},y){qm();let S=ge=>(typeof process<"u",ge);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:Yd,onOffline:ry,onFocus:Kd,onFocusLost:ty},util:{}});let E=II({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:R,selectCachedArgsForQuery:k,buildQuerySelector:I,buildInfiniteQuerySelector:T,buildMutationSelector:_}=E;fr(t.util,{selectInvalidatedBy:R,selectCachedArgsForQuery:k});let{queryThunk:D,infiniteQueryThunk:G,mutationThunk:V,patchQueryData:j,updateQueryData:L,upsertQueryData:q,prefetch:P,buildMatchThunkActions:N}=EI({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:S,selectors:E,onSchemaFailure:v,catchSchemaFailure:C,skipSchemaValidation:g}),{reducer:F,actions:H}=RI({context:y,queryThunk:D,infiniteQueryThunk:G,mutationThunk:V,serializeQueryArgs:i,reducerPath:o,assertTagType:S,config:{refetchOnFocus:c,refetchOnReconnect:u,refetchOnMountOrArgChange:s,keepUnusedDataFor:a,reducerPath:o,invalidationBehavior:h}});fr(t.util,{patchQueryData:j,updateQueryData:L,upsertQueryData:q,prefetch:P,resetApiState:H.resetApiState,upsertQueryEntries:H.cacheEntriesUpserted}),fr(t.internalActions,H);let Q=new WeakMap,Z=ge=>Ws(Q,ge,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:X,buildInitiateInfiniteQuery:W,buildInitiateMutation:te,getRunningMutationThunk:ue,getRunningMutationsThunk:Ee,getRunningQueriesThunk:je,getRunningQueryThunk:ke}=CI({queryThunk:D,mutationThunk:V,infiniteQueryThunk:G,api:t,serializeQueryArgs:i,context:y,getInternalState:Z});fr(t.util,{getRunningMutationThunk:ue,getRunningMutationsThunk:Ee,getRunningQueryThunk:ke,getRunningQueriesThunk:je});let{middleware:Ne,actions:Fe}=jI({reducerPath:o,context:y,queryThunk:D,mutationThunk:V,infiniteQueryThunk:G,api:t,assertTagType:S,selectors:E,getRunningQueryThunk:ke,getInternalState:Z});return fr(t.util,Fe),fr(t,{reducer:F,middleware:Ne}),{name:Kh,injectEndpoint(ge,me){var He;let he=(He=t.endpoints)[ge]??(He[ge]={});Xs(me)&&fr(he,{name:ge,select:I(ge,me),initiate:X(ge,me)},N(D,ge)),wI(me)&&fr(he,{name:ge,select:_(),initiate:te(ge)},N(V,ge)),Zs(me)&&fr(he,{name:ge,select:T(ge,me),initiate:W(ge,me)},N(D,ge))}}}}),ly=TI(LI());m();d();f();p();m();d();f();p();var fn=e=>e.query,dy=e=>e.query?.enableQuerySyntax;var I3=$e(e=>fn(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,r,n,o)=>({q:e,requestId:t,cannotAnswer:r,analyticsMode:n,actionCause:o})),UI=$e(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();var Js=e=>{if(e==="yes")return!0;if(e==="no")return!1},VI=()=>Pe("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function BI(e,t){return Pe({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??Me(n),i=go(n,e);if(!o||!i)return null;let a=_r(n);return r.makeGeneratedAnswerCitationClick(Rh(i,n),{generativeQuestionAnsweringId:o,citationId:i.id,documentId:_h(i),...(a&&{conversationId:a})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=go(r,e);return{answerId:t??Me(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function GI(e,t,r){return Pe({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let i=r??Me(o),a=go(o,e);if(!i||!a)return null;let s=_r(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:i,permanentId:a.permanentid,citationId:a.id,citationHoverTimeMs:t,...(s&&{conversationId:s})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=go(n,e);return{answerId:r??Me(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function $I(e,t){return Pe({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function QI(e){return Pe({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??Me(r);if(!n)return null;let o=_r(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Me(t)??"",action:"like"})})}function HI(e){return Pe({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??Me(r);if(!n)return null;let o=_r(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Me(t)??"",action:"dislike"})})}var zI=e=>Pe({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Me(r);return n?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Me(t),{helpful:n,readable:o,documented:i,hallucinationFree:a,correctTopic:s,documentUrl:c,details:u}=e;return{answerId:r??"",helpful:n,details:{readable:Js(o),documented:Js(i),correctTopic:Js(s),hallucinationFree:Js(a)},additionalNotes:u,correctAnswerUrl:c}}}),Zd=(e,t,r)=>Pe({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let i=t??Me(o);if(!i)return null;let a=_r(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:r,...(a&&{conversationId:a})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Me(n)??"",answerGenerated:e??!1})}),Co=e=>Pe({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Me(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),WI=()=>Pe({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Me(t);return r?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Me(e)??"",action:"show"})}),KI=()=>Pe({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Me(t);return r?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Me(e)??"",action:"hide"})}),YI=()=>Pe({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Me(t);return r?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Me(e)??"",action:"expand"})}),XI=()=>Pe({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Me(t);return r?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Me(e)??"",action:"collapse"})});function ZI(e){return Pe({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??Me(r);if(!n)return null;let o=_r(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Me(t)??"",action:"copyToClipboard"})})}function JI(e,t){return Pe({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=go(n,e);if(!o)return null;let i=_r(n);return i?r.makeGeneratedAnswerFollowupOpenSource({...Ih(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:i}):null}})}var ec={logCopyGeneratedAnswer:ZI,logGeneratedAnswerHideAnswers:KI,logGeneratedAnswerShowAnswers:WI,logGeneratedAnswerStreamEnd:Zd,logGeneratedAnswerFeedback:zI,logDislikeGeneratedAnswer:HI,logLikeGeneratedAnswer:QI,logGeneratedAnswerOpenInlineLink:$I,logHoverCitation:GI,logOpenGeneratedAnswerSource:BI,logOpenGeneratedAnswerFollowUpSource:JI,logRetryGeneratedAnswer:VI,logGeneratedAnswerExpand:YI,logGeneratedAnswerCollapse:XI};m();d();f();p();m();d();f();p();var py=$e(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:o}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(o&&{lq:o})}});m();d();f();p();var Hi=(e,t,r)=>({analytics:{clientId:t.clientId,clientTimestamp:new Date().toISOString(),documentReferrer:t.referrer,documentLocation:t.location,originContext:e.originContext,...(r&&{actionCause:r.actionCause}),...(r&&{customData:r.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.deviceId&&{deviceId:e.deviceId}),...(e.trackingId&&{trackingId:e.trackingId}),capture:t.capture??t.clientId!=="",source:uo(e)}});m();d();f();p();var Jd=e=>e.context;m();d();f();p();var ep=e=>e.pipeline;m();d();f();p();m();d();f();p();var zi=qt(tc(),1),vy=qt(fy(),1);m();d();f();p();var rc=qt(tc(),1),gy=qt(my(),1);rc.default.extend(gy.default);var hy="YYYY/MM/DD@HH:mm:ss",eT="1401-01-01";function Eo(e,t){let r=(0,rc.default)(e,t);return!r.isValid()&&!t?(0,rc.default)(e,hy):r}function nc(e){return e.format(hy)}function yy(e,t){let r=Eo(e,t);if(!r.isValid()){let n=". Please provide a date format string in the configuration options. See https://day.js.org/docs/en/parse/string-format for more information.",o=` with the format "${t}"`;throw new Error(`Could not parse the provided date "${e}"${t?o:n}`)}sp(r)}function sp(e){if(e.isBefore(eT))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}zi.default.extend(vy.default);var Sy=["past","now","next"],by=["minute","hour","day","week","month","quarter","year"],tT=e=>{let t=e==="now";return{amount:new oe({required:!t,min:1}),unit:new z({required:!t,constrainTo:by}),period:new z({required:!0,constrainTo:Sy})}};function cp(e){if(typeof e=="string"&&!Pr(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?Ey(e):e;new ht(tT(t.period)).validate(t);let r=Ay(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);sp(r)}function wy(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function Ay(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,zi.default)().subtract(r,n);case"next":return(0,zi.default)().add(r,n);case"now":return(0,zi.default)()}}function Wi(e){return nc(Ay(Ey(e)))}function xy(e){return e.toLocaleLowerCase().split("-")}function Pr(e){let[t,r,n]=xy(e);if(t==="now")return!0;if(!Sy.includes(t)||!by.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function Cy(e){return!!e&&typeof e=="object"&&"period"in e}function Ey(e){let[t,r,n]=xy(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function Ry(e){return e.type==="dateRange"}function Iy(e){return`start${e}`}function Ty(e){return`end${e}`}var up=()=>({dateFacetValueMap:{}});function rT(e,t,r){let n=e.start,o=e.end;return Pr(n)&&(n=Wi(n),r.dateFacetValueMap[t][Iy(n)]=e.start),Pr(o)&&(o=Wi(o),r.dateFacetValueMap[t][Ty(o)]=e.end),{...e,start:n,end:o}}function lp(e,t){if(Ry(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>rT(o,r,t))}}return e}function Nr(e){let t=up();return{request:{...e,facets:e.facets?.map(n=>lp(n,t))},mappings:t}}function nT(e,t,r){return{...e,start:r.dateFacetValueMap[t][Iy(e.start)]||e.start,end:r.dateFacetValueMap[t][Ty(e.end)]||e.end}}function oT(e,t){return e.facetId in t.dateFacetValueMap}function iT(e,t){return oT(e,t)?{...e,values:e.values.map(r=>nT(r,e.facetId,t))}:e}function oc(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>iT(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function Fr(e){return Object.values(e).map(t=>t.request)}function dp(e,t){let r={};e.forEach(i=>{r[i.facetId]=i});let n=[];t.forEach(i=>{i in r&&(n.push(r[i]),delete r[i])});let o=Object.values(r);return[...n,...o]}function _y(e){return Fr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var pp={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function aT(e){return Fr(e).map(t=>{let r=pp[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function sT(e){return[...aT(e.facetSet??{}),..._y(e.numericFacetSet??{}),..._y(e.dateFacetSet??{}),...Fr(e.categoryFacetSet??{})]}function cT(e){return sT(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function ic(e){return dp(cT(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();var Dr=/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??wr(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:gt.getInstance().getHistory()}),...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&(yield Bs(e.configuration.analytics,t))),...(e.excerptLength&&!se(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function Dr(_x67,_x68){return _ref29.apply(this,arguments)}}();m();d();f();p();var Ro=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??wr(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&&Hi(e.configuration.analytics,t,r)),...(e.excerptLength&&!se(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});m();d();f();p();var ky=$e(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o}));var Mr=/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t,r){let n=mp(e),o=uT(e),i=lT(e),a=e.configuration.analytics.analyticsMode==="legacy"?yield Dr(e,r):Ro(e,t,r);return Nr({...a,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(n&&{cq:n}),...(o.length&&{facets:o}),...(e.pagination&&{numberOfResults:fp(e),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:i}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Mr(_x69,_x70,_x71){return _ref30.apply(this,arguments)}}();function fp(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function uT(e){return dp(pT(e),e.facetOrder??[])}function lT(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(dT).filter(r=>r.currentValues.length>0):void 0}function dT(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function pT(e){return fT(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function fT(e){return[...mT(e.facetSet??{}),...Oy(e.numericFacetSet??{}),...Oy(e.dateFacetSet??{}),...Fr(e.categoryFacetSet??{})]}function mT(e){return Fr(e).map(t=>{let r=pp[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function Oy(e){return Fr(e).map(t=>{let r=t.currentValues,n=r.some(({state:i})=>i!=="idle"),o=r.some(i=>i.previousState);return t.generateAutomaticRanges&&!n&&!o?{...t,currentValues:[]}:t})}function mp(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=ky(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();f();p();m();d();f();p();var Ki=(e,t)=>{let r=e;return se(r[t])?se(e.raw[t])?null:e.raw[t]:r[t]},gT=e=>t=>e.every(r=>!se(Ki(t,r))),hT=e=>t=>e.every(r=>se(Ki(t,r))),yT=(e,t)=>r=>{let n=Py(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},vT=(e,t)=>r=>{let n=Py(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},Py=(e,t)=>{let r=Ki(t,e);return Jf(r)?r:[r]},Ny={getResultProperty:Ki,fieldsMustBeDefined:gT,fieldsMustNotBeDefined:hT,fieldMustMatch:yT,fieldMustNotMatch:vT};var gp=$e(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var hp=e=>e.searchHub;m();d();f();p();var ac=$e(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),cH=$e(e=>e,e=>{let t=ac(e);return t&&e?e[t].expression:""});m();d();f();p();var Fy=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var Dy=e=>e.excerptLength?.length;m();d();f();p();var My=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var qy=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};m();d();f();p();var jy=e=>e.sortCriteria;var Ly=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Kn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function Ly(_x72){return _ref31.apply(this,arguments)}}(),Uy=(e,t)=>{let r=fn(e)?.q,{aq:n,cq:o,dq:i,lq:a}=Gy(e),s=Jd(e),c=Hi(e.configuration.analytics,t,{actionCause:gp(e)}),u=hp(e),h=ep(e),v=kd(e)??[],C=By(e),g=ac(e.tabSet)||"default",y=Td(e),S=eh(e),E=t.referrer||"",R=My(e),k=jy(e),I=ST(e),T=Dy(e),_=qy(e),D=Fy(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(a&&{lq:a}),...(e.query&&{enableQuerySyntax:dy(e)}),...(s?.contextValues&&{context:s.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(u?.length&&{searchHub:u}),...(h?.length&&{pipeline:h}),...(C.length&&{facets:C}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(e.pagination&&{numberOfResults:fp(e),firstResult:e.pagination.firstResult}),tab:g,locale:y,timezone:S,...(e.debug!==void 0&&{debug:e.debug}),referrer:E,...I,...(_??{}),...(T&&{excerptLength:T}),...(D&&{dictionaryFieldContext:D}),sortCriteria:k,...(R&&{facetOptions:R}),...c,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Vy=(e,t)=>{let r=fn(e)?.q,n=By(e),o=Hi(e.configuration.analytics,t,{actionCause:gp(e)}),i=Td(e),a=ac(e.tabSet)||"default",s=t.referrer,{aq:c,cq:u}=Gy(e),h=hp(e),v=ep(e),C=Jd(e),g=kd(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:g,...(h?.length&&{searchHub:h}),...(v?.length&&{pipeline:v}),...(C?.contextValues&&{context:C.contextValues}),...(c&&{aq:c}),...(u&&{cq:u}),tab:a,referrer:s,...o,locale:i}},By=e=>ic(e)?.map(t=>lp(t,up())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),ST=e=>({actionsHistory:e.configuration.analytics.enabled?gt.getInstance().getHistory():[]}),Gy=e=>{let t=py(e),r=mp(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var sc=["searching","thinking","answering"];function cc(e){return e.toLowerCase()}var uc=["search","generic"];m();d();f();p();var $y=["text/plain","text/markdown"];var Io=new z({required:!0}),Qy=new z,To=new fe({required:!0}),yp={id:Io,title:Io,uri:Io,permanentid:Io,clickUri:Qy},lc=new z({required:!0,constrainTo:$y}),Hy=new z({required:!0,constrainTo:sc}),zy=e=>({...e,name:cc(e.name)}),T4=O("generatedAnswer/setIsVisible",e=>B(e,To)),dc=O("generatedAnswer/setAnswerId",e=>B(e,Y)),_4=O("generatedAnswer/setAnswerGenerationMode",e=>B(e,new z({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),k4=O("generatedAnswer/setIsEnabled",e=>B(e,To)),Xi=O("generatedAnswer/updateMessage",e=>B(e,{textDelta:Io})),Zi=O("generatedAnswer/updateCitations",e=>B(e,{citations:new Se({required:!0,each:new ne({values:yp})})})),Ji=O("generatedAnswer/updateError",e=>B(e,{message:Qy,code:new oe({min:0})})),pc=O("generatedAnswer/resetAnswer"),O4=O("generatedAnswer/like"),P4=O("generatedAnswer/dislike"),N4=O("generatedAnswer/feedbackModal/open"),F4=O("generatedAnswer/expand"),D4=O("generatedAnswer/collapse"),M4=O("generatedAnswer/setId",e=>B(e,{id:new z({required:!0})})),q4=O("generatedAnswer/feedbackModal/close"),j4=O("generatedAnswer/sendFeedback"),qr=O("generatedAnswer/setIsLoading",e=>B(e,To)),Yi=O("generatedAnswer/setIsStreaming",e=>B(e,To)),ea=O("generatedAnswer/setAnswerContentFormat",e=>B(e,lc)),L4=O("generatedAnswer/updateResponseFormat",e=>B(e,{contentFormat:new Se({each:lc,default:["text/plain"]})})),U4=O("knowledge/updateAnswerConfigurationId",e=>B(e,Io)),V4=O("generatedAnswer/registerFieldsToIncludeInCitations",e=>B(e,us)),vp=O("generatedAnswer/setIsAnswerGenerated",e=>B(e,To)),ta=O("generatedAnswer/setCannotAnswer",e=>B(e,To)),bT=O("generatedAnswer/setAnswerApiQueryParams",e=>B(e,new ne({}))),Wy=O("generatedAnswer/startStep",e=>B(zy(e),{name:Hy,startedAt:new oe({min:0,required:!0})})),Ky=O("generatedAnswer/finishStep",e=>B(zy(e),{name:Hy,finishedAt:new oe({min:0,required:!0})})),Yy=O("generatedAnswer/startToolCall",e=>B(e,{toolCallName:Y,startedAt:new oe({min:0,required:!0}),toolCallId:Y})),Xy=O("generatedAnswer/finishToolCall",e=>B(e,{finishedAt:new oe({min:0,required:!0}),toolCallId:Y})),fc=O("generatedAnswer/toolCallArgs",e=>B(e,{toolCallId:Y,args:new ne({options:{required:!0}}),type:new z({required:!0,constrainTo:uc})})),B4=Ie("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:i}=t,{generatedAnswerAnalyticsClient:a}=o,{search:s}=i(),{queryExecuted:c}=s,{setAbortControllerRef:u}=e,h=yield Ly(r),v=(y,S)=>{switch(y){case"genqa.headerMessageType":{let E=JSON.parse(S);n(ea(E.contentFormat));break}case"genqa.messageType":n(Xi(JSON.parse(S)));break;case"genqa.citationsType":n(Zi(JSON.parse(S)));break;case"genqa.endOfStreamType":{let E=JSON.parse(S).answerGenerated,{answerId:R,answer:k}=i().generatedAnswer,T=c.length!==0&&!E,_=!k?.trim();n(ta(T)),n(Yi(!1)),n(vp(E)),n((a??ec).logGeneratedAnswerStreamEnd(E,R,E?_:void 0)),n(Co());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${y}"`)}};n(qr(!0));let C=y=>y.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,g=o.streamingClient?.streamGeneratedAnswer(h,{write:y=>{C(h)&&(n(qr(!1)),y.payload&&y.payloadType&&v(y.payloadType,y.payload))},abort:y=>{C(h)&&n(Ji(y))},close:()=>{C(h)&&n(Yi(!1))},resetAnswer:()=>{C(h)&&n(pc())}});g?u(g):n(qr(!1))});return function(_x73,_x74){return _ref32.apply(this,arguments)}}()),G4=Ie("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(pc());let i=t();if(i.generatedAnswer.isEnabled===!1){o.warn("[WARNING] The generateAnswer action was dispatched while the generated answer is disabled. No answer will be generated. Enable the generated answer before dispatching generateAnswer.");return}if(i.generatedAnswer.answerConfigurationId){let a=Uy(i,n);r(bT(a)),yield r(Zy(a))}else o.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.")});return function(_x75,_x76){return _ref33.apply(this,arguments)}}());m();d();f();p();m();d();f();p();function ev(_x77,_x78){return _ev.apply(this,arguments)}function _ev(){_ev=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _ev.apply(this,arguments)}function tv(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=AT(t,a);let s=t.length,c=0;for(;r<s;){o&&(t[r]===10&&(c=++r),o=!1);let u=-1;for(;r<s&&u===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-c);break;case 13:o=!0,u=r;break;case 10:u=r;break}if(u===-1)break;e(t.subarray(c,u),n),c=r,n=-1}c===s?t=void 0:c!==0&&(t=t.subarray(c),r-=c)}}function rv(e,t,r){let n=Jy(),o=new TextDecoder;return function(a,s){if(a.length===0)r?.(n),n=Jy();else if(s>0){let c=o.decode(a.subarray(0,s)),u=s+(a[s+1]===32?2:1),h=o.decode(a.subarray(u));switch(c){case"data":n.data=n.data?`${n.data}
|
|
32
|
-
${h}`:h;break;case"event":n.event=h;break;case"id":e(n.id=h);break;case"retry":wT(h,n,t);break}}}}function wT(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function AT(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function Jy(){return{data:"",event:"",id:"",retry:void 0}}var Sp="text/event-stream",xT=1e3,nv="last-event-id";function ov(){return typeof window<"u"}function iv(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:a,openWhenHidden:s,fetch:c,...u}){return new Promise((h,v)=>{let C={...r};C.accept||(C.accept=Sp);let g;function y(){g?.abort(),document.hidden||T()}!s&&ov()&&document.addEventListener("visibilitychange",y);let S=xT,E;function R(){ov()&&document.removeEventListener("visibilitychange",y),clearTimeout(E),g?.abort()}t?.addEventListener("abort",()=>{R(),h()});let k=c??A,I=n??CT;function T(){return _T2.apply(this,arguments)}function _T2(){_T2=_asyncToGenerator(function*(){g=l.AbortController?new l.AbortController:null;try{let _=yield k(e,{...u,headers:C,signal:g?.signal});yield I(_),yield ev(_.body,tv(rv(D=>{D?C[nv]=D:delete C[nv]},D=>{S=D},o))),i?.(),R(),h()}catch(_){if(!g?.signal?.aborted)try{let D=a?.(_)??S;clearTimeout(E),E=setTimeout(T,D)}catch(D){R(),v(D)}}});return _T2.apply(this,arguments)}T()})}function CT(e){let t=e.headers.get("content-type");if(!t?.startsWith(Sp))throw new Error(`Expected content-type to be ${Sp}, Actual: ${t}`)}m();d();f();p();var ET=/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:i,organizationId:a}=n.configuration,s=n.generatedAnswer.answerConfigurationId,c={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let u=Kn(n.configuration.search?.apiBaseUrl,a,i);return Xh({baseUrl:`${u}/rest/organizations/${a}/answer/v1/configs/${s}`,fetchFn:function(){var _ref35=_asyncToGenerator(function*(h){if(h instanceof String)throw new Error("The provided 'request' must be a Request object.");let v=h.url,C={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(g=>{C[g]=h[g]}),C.duplex="half",C.body=yield h.text(),A(v,C)});return function fetchFn(_x82){return _ref35.apply(this,arguments)}}()})(c,{...t,signal:null},r)}catch(u){return{error:u}}});return function ET(_x79,_x80,_x81){return _ref34.apply(this,arguments)}}(),av=ly({reducerPath:"answer",baseQuery:Jh(ET,{maxRetries:3}),endpoints:()=>({})});var RT=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},IT=(e,t)=>{let{textDelta:r}=t;if(typeof r!="string")return;let n=e.answer;!n?.trim()&&!r.trim()||(delete e.error,e.answer=n?.trim()?n.concat(r):r)},TT=(e,t)=>{delete e.error,e.citations=t.citations},_T=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},kT=(e,t)=>{let r=t.errorMessage||"Unknown error occurred";e.error={message:r,code:t.code},e.isStreaming=!1,e.isLoading=!1,console.error(`Generated answer error: ${r} (code: ${t.code})`)},OT=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&kT(t,o);let i=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":i.contentFormat&&(RT(t,i),r(ea(i.contentFormat)));break;case"genqa.messageType":typeof i.textDelta=="string"&&(IT(t,i),r(Xi({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(TT(t,i),r(Zi({citations:i.citations})));break;case"genqa.endOfStreamType":{_T(t,i);let a=t.answerId,s=i.answerGenerated??!1,c=s?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(s,a,c)),r(Co());break}}},PT=(e,t,r,n)=>{if(!e||!t||!r)throw new Error("Missing required parameters for answer endpoint");let o=`/rest/organizations/${t}`,i=n?`insight/v1/configs/${n}/answer`:"answer/v1/configs";return`${e}${o}/${i}/${r}/generate`},bp=av.injectEndpoints({overrideExisting:!0,endpoints:e=>({getAnswer:e.query({queryFn:()=>({data:{contentFormat:void 0,answer:void 0,citations:void 0,error:void 0,generated:!1,isStreaming:!0,isLoading:!0}}),serializeQueryArgs:({endpointName:t,queryArgs:r})=>{let{analytics:n,...o}=r;return`${t}(${JSON.stringify(o)})`},onCacheEntryAdded(_x83,_x84){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:i,extra:a}){yield n;let{configuration:s,generatedAnswer:c,insightConfiguration:u}=r(),{generatedAnswerAnalyticsClient:h}=a,{organizationId:v,environment:C,accessToken:g}=s,y=Kn(s.search.apiBaseUrl,v,C),S=PT(y,v,c.answerConfigurationId,u?.insightId);yield iv(S,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${g}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},openWhenHidden:!0,fetch:A,onopen:function(){var _ref36=_asyncToGenerator(function*(E){let R=E.headers.get("x-answer-id");R&&o(k=>{k.answerId=R,i(dc(R))})});return function onopen(_x85){return _ref36.apply(this,arguments)}}(),onmessage:E=>{o(R=>{OT(E,R,i,h??ec)})},onerror:E=>{throw E},onclose:()=>{o(E=>{i(ta(!E.generated))})}})}).apply(this,arguments)}})})}),Zy=e=>bp.endpoints.getAnswer.initiate(e);m();d();f();p();var sv=Be(ro,e=>e);m();d();f();p();function NT(e){let t=e.payload?.analyticsAction;return cv(e)&&!se(t)}function cv(e){return"type"in e}var uv=e=>t=>r=>{let n;NT(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return cv(r)&&(r.type==="search/executeSearch/fullfilled"&&n===void 0&&console.error("No analytics action associated with search:",r),r.type==="recommendation/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with recommendation:",r),r.type==="productRecommendations/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with product recommendation:",r)),n!==void 0&&e.dispatch(n),o};m();d();f();p();m();d();f();p();m();d();f();p();var Uz=O("tab/register",e=>{let t=new ne({values:{id:Y,expression:nt}});return B(e,t)}),mc=O("tab/updateActiveTab",e=>B(e,Y));m();d();f();p();var gc=qt(tc(),1),pv=qt(lv(),1),fv=qt(dv(),1);gc.default.extend(fv.default);gc.default.extend(pv.default);var mv=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:gc.default.tz.guess(),authenticationProviders:[]},analytics:{enabled:!0,originContext:"Search",originLevel2:"default",originLevel3:"default",anonymous:!1,deviceId:"",userDisplayName:"",documentLocation:"",analyticsMode:"next",source:{}},knowledge:{answerConfigurationId:"",agentId:void 0},environment:"prod"});m();d();f();p();var FT=/(^|; )Coveo-Pendragon=([^;]*)/,DT=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function gv(){return typeof window>"u"?!1:FT.exec(document.cookie)?.pop()||null}function hv(){return typeof window>"u"?!1:DT.test(document.cookie)}var yv=Be(mv(),e=>e.addCase(Er,(t,r)=>{MT(t,r.payload)}).addCase(Wt,(t,r)=>{qT(t,r.payload)}).addCase(no,(t,r)=>{jT(t,r.payload)}).addCase(oo,t=>{t.analytics.enabled=!1}).addCase(io,t=>{t.analytics.enabled=!0}).addCase(ls,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(ds,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(mc,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Ag,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Rr,(t,r)=>{se(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(bg,(t,{payload:r})=>{LT(t,r)}));function MT(e,t){se(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",se(t.organizationId)||(e.organizationId=t.organizationId)}function qT(e,t){se(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),se(t.locale)||(e.search.locale=t.locale),se(t.timezone)||(e.search.timezone=t.timezone),se(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function jT(e,t){se(t.enabled)||(e.analytics.enabled=t.enabled),se(t.originContext)||(e.analytics.originContext=t.originContext),se(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),se(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),se(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),se(t.trackingId)||(e.analytics.trackingId=t.trackingId),se(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),se(t.source)||(e.analytics.source=t.source);try{let r=gv();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}se(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),se(t.anonymous)||(e.analytics.anonymous=t.anonymous),se(t.deviceId)||(e.analytics.deviceId=t.deviceId),se(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),se(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function LT(e,t){e.knowledge.agentId=t;try{hv()&&(e.knowledge.debugAgentSession=!0)}catch{}}var Lt=yv;m();d();f();p();function UT(e){return e.instantlyCallable}var vv=()=>e=>t=>e(UT(t)?t():t);m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var at=[];for(let e=0;e<256;++e)at.push((e+256).toString(16).slice(1));function Sv(e,t=0){return(at[e[t+0]]+at[e[t+1]]+at[e[t+2]]+at[e[t+3]]+"-"+at[e[t+4]]+at[e[t+5]]+"-"+at[e[t+6]]+at[e[t+7]]+"-"+at[e[t+8]]+at[e[t+9]]+"-"+at[e[t+10]]+at[e[t+11]]+at[e[t+12]]+at[e[t+13]]+at[e[t+14]]+at[e[t+15]]).toLowerCase()}m();d();f();p();var Ep,VT=new Uint8Array(16);function Rp(){if(!Ep){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ep=crypto.getRandomValues.bind(crypto)}return Ep(VT)}m();d();f();p();m();d();f();p();var BT=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ip={randomUUID:BT};function GT(e,t,r){if(Ip.randomUUID&&!t&&!e)return Ip.randomUUID();e=e||{};let n=e.random??e.rng?.()??Rp();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return Sv(n)}var jr=GT;m();d();f();p();m();d();f();p();var b={};ni(b,{BRAND:()=>g0,DIRTY:()=>gn,EMPTY_PATH:()=>zT,INVALID:()=>de,NEVER:()=>J0,OK:()=>dt,ParseStatus:()=>st,Schema:()=>we,ZodAny:()=>Vr,ZodArray:()=>vr,ZodBigInt:()=>yn,ZodBoolean:()=>vn,ZodBranded:()=>na,ZodCatch:()=>_n,ZodDate:()=>Sn,ZodDefault:()=>Tn,ZodDiscriminatedUnion:()=>vc,ZodEffects:()=>Nt,ZodEnum:()=>Rn,ZodError:()=>St,ZodFirstPartyTypeKind:()=>pe,ZodFunction:()=>bc,ZodIntersection:()=>xn,ZodIssueCode:()=>K,ZodLazy:()=>Cn,ZodLiteral:()=>En,ZodMap:()=>Fo,ZodNaN:()=>Mo,ZodNativeEnum:()=>In,ZodNever:()=>Ut,ZodNull:()=>wn,ZodNullable:()=>Jt,ZodNumber:()=>hn,ZodObject:()=>bt,ZodOptional:()=>Ot,ZodParsedType:()=>re,ZodPipeline:()=>oa,ZodPromise:()=>Br,ZodReadonly:()=>kn,ZodRecord:()=>Sc,ZodSchema:()=>we,ZodSet:()=>Do,ZodString:()=>Ur,ZodSymbol:()=>Po,ZodTransformer:()=>Nt,ZodTuple:()=>Zt,ZodType:()=>we,ZodUndefined:()=>bn,ZodUnion:()=>An,ZodUnknown:()=>yr,ZodVoid:()=>No,addIssueToContext:()=>ee,any:()=>C0,array:()=>T0,bigint:()=>S0,boolean:()=>kv,coerce:()=>Z0,custom:()=>Iv,date:()=>b0,datetimeRegex:()=>Ev,defaultErrorMap:()=>gr,discriminatedUnion:()=>P0,effect:()=>$0,enum:()=>V0,function:()=>j0,getErrorMap:()=>_o,getParsedType:()=>Xt,instanceof:()=>y0,intersection:()=>N0,isAborted:()=>hc,isAsync:()=>ko,isDirty:()=>yc,isValid:()=>Lr,late:()=>h0,lazy:()=>L0,literal:()=>U0,makeIssue:()=>ra,map:()=>M0,nan:()=>v0,nativeEnum:()=>B0,never:()=>R0,null:()=>x0,nullable:()=>H0,number:()=>_v,object:()=>_0,objectUtil:()=>Tp,oboolean:()=>X0,onumber:()=>Y0,optional:()=>Q0,ostring:()=>K0,pipeline:()=>W0,preprocess:()=>z0,promise:()=>G0,quotelessJson:()=>$T,record:()=>D0,set:()=>q0,setErrorMap:()=>HT,strictObject:()=>k0,string:()=>Tv,symbol:()=>w0,transformer:()=>$0,tuple:()=>F0,undefined:()=>A0,union:()=>O0,unknown:()=>E0,util:()=>Ce,void:()=>I0});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Ce;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ce||(Ce={}));var Tp;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Tp||(Tp={}));var re=Ce.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Xt=e=>{switch(typeof e){case"undefined":return re.undefined;case"string":return re.string;case"number":return Number.isNaN(e)?re.nan:re.number;case"boolean":return re.boolean;case"function":return re.function;case"bigint":return re.bigint;case"symbol":return re.symbol;case"object":return Array.isArray(e)?re.array:e===null?re.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?re.promise:typeof Map<"u"&&e instanceof Map?re.map:typeof Set<"u"&&e instanceof Set?re.set:typeof Date<"u"&&e instanceof Date?re.date:re.object;default:return re.unknown}};var K=Ce.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"]),$T=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),St=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ce.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};St.create=e=>new St(e);var QT=(e,t)=>{let r;switch(e.code){case K.invalid_type:e.received===re.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case K.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ce.jsonStringifyReplacer)}`;break;case K.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ce.joinValues(e.keys,", ")}`;break;case K.invalid_union:r="Invalid input";break;case K.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ce.joinValues(e.options)}`;break;case K.invalid_enum_value:r=`Invalid enum value. Expected ${Ce.joinValues(e.options)}, received '${e.received}'`;break;case K.invalid_arguments:r="Invalid function arguments";break;case K.invalid_return_type:r="Invalid function return type";break;case K.invalid_date:r="Invalid date";break;case K.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Ce.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case K.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case K.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case K.custom:r="Invalid input";break;case K.invalid_intersection_types:r="Intersection results could not be merged";break;case K.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case K.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ce.assertNever(e)}return{message:r}},gr=QT;var bv=gr;function HT(e){bv=e}function _o(){return bv}m();d();f();p();var ra=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...(o.path||[])],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}},zT=[];function ee(e,t){let r=_o(),n=ra({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===gr?void 0:gr].filter(o=>!!o)});e.common.issues.push(n)}var st=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return de;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let o of r){let i=yield o.key,a=yield o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return de;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},de=Object.freeze({status:"aborted"}),gn=e=>({status:"dirty",value:e}),dt=e=>({status:"valid",value:e}),hc=e=>e.status==="aborted",yc=e=>e.status==="dirty",Lr=e=>e.status==="valid",ko=e=>typeof Promise<"u"&&e instanceof Promise;m();d();f();p();m();d();f();p();var ie;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ie||(ie={}));var Pt=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},wv=(e,t)=>{if(Lr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new St(e.common.issues);return this._error=r,this._error}}};function ye(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}var we=class{get description(){return this._def.description}_getType(t){return Xt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Xt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new st,ctx:{common:t.parent.common,data:t.data,parsedType:Xt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(ko(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Xt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return wv(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Xt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Lr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Lr(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this10=this;return _asyncToGenerator(function*(){let n=yield _this10.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this11=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this11._def.errorMap,parent:null,data:t,parsedType:Xt(t)},o=_this11._parse({data:t,path:n.path,parent:n}),i=yield ko(o)?o:Promise.resolve(o);return wv(n,i)})()}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:K.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new Nt({schema:this,typeName:pe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Ot.create(this,this._def)}nullable(){return Jt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return vr.create(this)}promise(){return Br.create(this,this._def)}or(t){return An.create([this,t],this._def)}and(t){return xn.create(this,t,this._def)}transform(t){return new Nt({...ye(this._def),schema:this,typeName:pe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Tn({...ye(this._def),innerType:this,defaultValue:r,typeName:pe.ZodDefault})}brand(){return new na({typeName:pe.ZodBranded,type:this,...ye(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new _n({...ye(this._def),innerType:this,catchValue:r,typeName:pe.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return oa.create(this,t)}readonly(){return kn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},WT=/^c[^\s-]{8,}$/i,KT=/^[0-9a-z]+$/,YT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,XT=/^[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,ZT=/^[a-z0-9_-]{21}$/i,JT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,e0=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,t0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,r0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_p,n0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,o0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,i0=/^(([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]))$/,a0=/^(([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])$/,s0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,c0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,xv="((\\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])))",u0=new RegExp(`^${xv}$`);function Cv(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function l0(e){return new RegExp(`^${Cv(e)}$`)}function Ev(e){let t=`${xv}T${Cv(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function d0(e,t){return!!((t==="v4"||!t)&&n0.test(e)||(t==="v6"||!t)&&i0.test(e))}function p0(e,t){if(!JT.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function f0(e,t){return!!((t==="v4"||!t)&&o0.test(e)||(t==="v6"||!t)&&a0.test(e))}var Ur=class e extends we{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==re.string){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:re.string,received:i.parsedType}),de}let n=new st,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?ee(o,{code:K.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&ee(o,{code:K.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")t0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"email",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")_p||(_p=new RegExp(r0,"u")),_p.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"emoji",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")XT.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"uuid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")ZT.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"nanoid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")WT.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cuid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")KT.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cuid2",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")YT.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"ulid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ee(o,{validation:"url",code:K.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"regex",code:K.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Ev(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?u0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?l0(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?e0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"duration",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?d0(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"ip",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?p0(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"jwt",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?f0(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cidr",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?s0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"base64",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?c0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"base64url",code:K.invalid_string,message:i.message}),n.dirty()):Ce.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:K.invalid_string,...ie.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ie.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ie.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ie.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ie.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ie.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ie.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ie.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ie.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ie.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ie.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ie.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ie.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ie.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...ie.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...ie.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ie.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ie.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ie.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ie.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ie.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ie.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ie.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ie.errToObj(r)})}nonempty(t){return this.min(1,ie.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Ur.create=e=>new Ur({checks:[],typeName:pe.ZodString,coerce:e?.coerce??!1,...ye(e)});function m0(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var hn=class e extends we{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==re.number){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:re.number,received:i.parsedType}),de}let n,o=new st;for(let i of this._def.checks)i.kind==="int"?Ce.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{code:K.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?m0(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{code:K.not_finite,message:i.message}),o.dirty()):Ce.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ie.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ie.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ie.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ie.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ie.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ie.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ie.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ie.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ie.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ie.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ie.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ie.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ie.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ie.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ce.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};hn.create=e=>new hn({checks:[],typeName:pe.ZodNumber,coerce:e?.coerce||!1,...ye(e)});var yn=class e extends we{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==re.bigint)return this._getInvalidInput(t);let n,o=new st;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ce.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return ee(r,{code:K.invalid_type,expected:re.bigint,received:r.parsedType}),de}gte(t,r){return this.setLimit("min",t,!0,ie.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ie.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ie.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ie.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ie.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ie.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ie.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ie.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ie.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ie.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};yn.create=e=>new yn({checks:[],typeName:pe.ZodBigInt,coerce:e?.coerce??!1,...ye(e)});var vn=class extends we{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==re.boolean){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.boolean,received:n.parsedType}),de}return dt(t.data)}};vn.create=e=>new vn({typeName:pe.ZodBoolean,coerce:e?.coerce||!1,...ye(e)});var Sn=class e extends we{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==re.date){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:re.date,received:i.parsedType}),de}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_date}),de}let n=new st,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Ce.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:ie.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ie.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Sn.create=e=>new Sn({checks:[],coerce:e?.coerce||!1,typeName:pe.ZodDate,...ye(e)});var Po=class extends we{_parse(t){if(this._getType(t)!==re.symbol){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.symbol,received:n.parsedType}),de}return dt(t.data)}};Po.create=e=>new Po({typeName:pe.ZodSymbol,...ye(e)});var bn=class extends we{_parse(t){if(this._getType(t)!==re.undefined){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.undefined,received:n.parsedType}),de}return dt(t.data)}};bn.create=e=>new bn({typeName:pe.ZodUndefined,...ye(e)});var wn=class extends we{_parse(t){if(this._getType(t)!==re.null){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.null,received:n.parsedType}),de}return dt(t.data)}};wn.create=e=>new wn({typeName:pe.ZodNull,...ye(e)});var Vr=class extends we{constructor(){super(...arguments),this._any=!0}_parse(t){return dt(t.data)}};Vr.create=e=>new Vr({typeName:pe.ZodAny,...ye(e)});var yr=class extends we{constructor(){super(...arguments),this._unknown=!0}_parse(t){return dt(t.data)}};yr.create=e=>new yr({typeName:pe.ZodUnknown,...ye(e)});var Ut=class extends we{_parse(t){let r=this._getOrReturnCtx(t);return ee(r,{code:K.invalid_type,expected:re.never,received:r.parsedType}),de}};Ut.create=e=>new Ut({typeName:pe.ZodNever,...ye(e)});var No=class extends we{_parse(t){if(this._getType(t)!==re.undefined){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.void,received:n.parsedType}),de}return dt(t.data)}};No.create=e=>new No({typeName:pe.ZodVoid,...ye(e)});var vr=class e extends we{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==re.array)return ee(r,{code:K.invalid_type,expected:re.array,received:r.parsedType}),de;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(ee(r,{code:a?K.too_big:K.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(ee(r,{code:K.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(ee(r,{code:K.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new Pt(r,a,r.path,s)))).then(a=>st.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Pt(r,a,r.path,s)));return st.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:ie.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ie.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ie.toString(r)}})}nonempty(t){return this.min(1,t)}};vr.create=(e,t)=>new vr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:pe.ZodArray,...ye(t)});function Oo(e){if(e instanceof bt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Ot.create(Oo(n))}return new bt({...e._def,shape:()=>t})}else return e instanceof vr?new vr({...e._def,type:Oo(e.element)}):e instanceof Ot?Ot.create(Oo(e.unwrap())):e instanceof Jt?Jt.create(Oo(e.unwrap())):e instanceof Zt?Zt.create(e.items.map(t=>Oo(t))):e}var bt=class e extends we{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Ce.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==re.object){let u=this._getOrReturnCtx(t);return ee(u,{code:K.invalid_type,expected:re.object,received:u.parsedType}),de}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Ut&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let h=i[u],v=o.data[u];c.push({key:{status:"valid",value:u},value:h._parse(new Pt(o,v,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof Ut){let u=this._def.unknownKeys;if(u==="passthrough")for(let h of s)c.push({key:{status:"valid",value:h},value:{status:"valid",value:o.data[h]}});else if(u==="strict")s.length>0&&(ee(o,{code:K.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let h of s){let v=o.data[h];c.push({key:{status:"valid",value:h},value:u._parse(new Pt(o,v,o.path,h)),alwaysSet:h in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let u=[];for(let h of c){let v=yield h.key,C=yield h.value;u.push({key:v,value:C,alwaysSet:h.alwaysSet})}return u})).then(u=>st.mergeObjectSync(n,u)):st.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return ie.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ie.errToObj(t).message??o}:{message:o}}}:{})})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:pe.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Ce.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Ce.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Oo(this)}partial(t){let r={};for(let n of Ce.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Ce.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Ot;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Rv(Ce.objectKeys(this.shape))}};bt.create=(e,t)=>new bt({shape:()=>e,unknownKeys:"strip",catchall:Ut.create(),typeName:pe.ZodObject,...ye(t)});bt.strictCreate=(e,t)=>new bt({shape:()=>e,unknownKeys:"strict",catchall:Ut.create(),typeName:pe.ZodObject,...ye(t)});bt.lazycreate=(e,t)=>new bt({shape:e,unknownKeys:"strip",catchall:Ut.create(),typeName:pe.ZodObject,...ye(t)});var An=class extends we{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new St(s.ctx.common.issues));return ee(r,{code:K.invalid_union,unionErrors:a}),de}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(i){let a={...r,common:{...r.common,issues:[]},parent:null};return{result:yield i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}});return function(_x86){return _ref38.apply(this,arguments)}}())).then(o);{let i,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},h=c._parseSync({data:r.data,path:r.path,parent:u});if(h.status==="valid")return h;h.status==="dirty"&&!i&&(i={result:h,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new St(c));return ee(r,{code:K.invalid_union,unionErrors:s}),de}}get options(){return this._def.options}};An.create=(e,t)=>new An({options:e,typeName:pe.ZodUnion,...ye(t)});var hr=e=>e instanceof Cn?hr(e.schema):e instanceof Nt?hr(e.innerType()):e instanceof En?[e.value]:e instanceof Rn?e.options:e instanceof In?Ce.objectValues(e.enum):e instanceof Tn?hr(e._def.innerType):e instanceof bn?[void 0]:e instanceof wn?[null]:e instanceof Ot?[void 0,...hr(e.unwrap())]:e instanceof Jt?[null,...hr(e.unwrap())]:e instanceof na||e instanceof kn?hr(e.unwrap()):e instanceof _n?hr(e._def.innerType):[],vc=class e extends we{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==re.object)return ee(r,{code:K.invalid_type,expected:re.object,received:r.parsedType}),de;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(ee(r,{code:K.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),de)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=hr(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:pe.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...ye(n)})}};function kp(e,t){let r=Xt(e),n=Xt(t);if(e===t)return{valid:!0,data:e};if(r===re.object&&n===re.object){let o=Ce.objectKeys(t),i=Ce.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let c=kp(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===re.array&&n===re.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],c=kp(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===re.date&&n===re.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var xn=class extends we{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(hc(i)||hc(a))return de;let s=kp(i.value,a.value);return s.valid?((yc(i)||yc(a))&&r.dirty(),{status:r.value,value:s.data}):(ee(n,{code:K.invalid_intersection_types}),de)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};xn.create=(e,t,r)=>new xn({left:e,right:t,typeName:pe.ZodIntersection,...ye(r)});var Zt=class e extends we{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==re.array)return ee(n,{code:K.invalid_type,expected:re.array,received:n.parsedType}),de;if(n.data.length<this._def.items.length)return ee(n,{code:K.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),de;!this._def.rest&&n.data.length>this._def.items.length&&(ee(n,{code:K.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new Pt(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>st.mergeArray(r,a)):st.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Zt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zt({items:e,typeName:pe.ZodTuple,rest:null,...ye(t)})};var Sc=class e extends we{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==re.object)return ee(n,{code:K.invalid_type,expected:re.object,received:n.parsedType}),de;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Pt(n,s,n.path,s)),value:a._parse(new Pt(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?st.mergeObjectAsync(r,o):st.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof we?new e({keyType:t,valueType:r,typeName:pe.ZodRecord,...ye(n)}):new e({keyType:Ur.create(),valueType:t,typeName:pe.ZodRecord,...ye(r)})}},Fo=class extends we{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==re.map)return ee(n,{code:K.invalid_type,expected:re.map,received:n.parsedType}),de;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new Pt(n,s,n.path,[u,"key"])),value:i._parse(new Pt(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let c of a){let u=yield c.key,h=yield c.value;if(u.status==="aborted"||h.status==="aborted")return de;(u.status==="dirty"||h.status==="dirty")&&r.dirty(),s.set(u.value,h.value)}return{status:r.value,value:s}}))}else{let s=new Map;for(let c of a){let u=c.key,h=c.value;if(u.status==="aborted"||h.status==="aborted")return de;(u.status==="dirty"||h.status==="dirty")&&r.dirty(),s.set(u.value,h.value)}return{status:r.value,value:s}}}};Fo.create=(e,t,r)=>new Fo({valueType:t,keyType:e,typeName:pe.ZodMap,...ye(r)});var Do=class e extends we{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==re.set)return ee(n,{code:K.invalid_type,expected:re.set,received:n.parsedType}),de;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ee(n,{code:K.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(ee(n,{code:K.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let u=new Set;for(let h of c){if(h.status==="aborted")return de;h.status==="dirty"&&r.dirty(),u.add(h.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>i._parse(new Pt(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:ie.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ie.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Do.create=(e,t)=>new Do({valueType:e,minSize:null,maxSize:null,typeName:pe.ZodSet,...ye(t)});var bc=class e extends we{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==re.function)return ee(r,{code:K.invalid_type,expected:re.function,received:r.parsedType}),de;function n(s,c){return ra({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,_o(),gr].filter(u=>!!u),issueData:{code:K.invalid_arguments,argumentsError:c}})}function o(s,c){return ra({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,_o(),gr].filter(u=>!!u),issueData:{code:K.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Br){let s=this;return dt(/*#__PURE__*/_asyncToGenerator(function*(...c){let u=new St([]),h=yield s._def.args.parseAsync(c,i).catch(g=>{throw u.addIssue(n(c,g)),u}),v=yield Reflect.apply(a,this,h);return yield s._def.returns._def.type.parseAsync(v,i).catch(g=>{throw u.addIssue(o(v,g)),u})}))}else{let s=this;return dt(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new St([n(c,u.error)]);let h=Reflect.apply(a,this,u.data),v=s._def.returns.safeParse(h,i);if(!v.success)throw new St([o(h,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Zt.create(t).rest(yr.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Zt.create([]).rest(yr.create()),returns:r||yr.create(),typeName:pe.ZodFunction,...ye(n)})}},Cn=class extends we{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Cn.create=(e,t)=>new Cn({getter:e,typeName:pe.ZodLazy,...ye(t)});var En=class extends we{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return ee(r,{received:r.data,code:K.invalid_literal,expected:this._def.value}),de}return{status:"valid",value:t.data}}get value(){return this._def.value}};En.create=(e,t)=>new En({value:e,typeName:pe.ZodLiteral,...ye(t)});function Rv(e,t){return new Rn({values:e,typeName:pe.ZodEnum,...ye(t)})}var Rn=class e extends we{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return ee(r,{expected:Ce.joinValues(n),received:r.parsedType,code:K.invalid_type}),de}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return ee(r,{received:r.data,code:K.invalid_enum_value,options:n}),de}return dt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Rn.create=Rv;var In=class extends we{_parse(t){let r=Ce.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==re.string&&n.parsedType!==re.number){let o=Ce.objectValues(r);return ee(n,{expected:Ce.joinValues(o),received:n.parsedType,code:K.invalid_type}),de}if(this._cache||(this._cache=new Set(Ce.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Ce.objectValues(r);return ee(n,{received:n.data,code:K.invalid_enum_value,options:o}),de}return dt(t.data)}get enum(){return this._def.values}};In.create=(e,t)=>new In({values:e,typeName:pe.ZodNativeEnum,...ye(t)});var Br=class extends we{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==re.promise&&r.common.async===!1)return ee(r,{code:K.invalid_type,expected:re.promise,received:r.parsedType}),de;let n=r.parsedType===re.promise?r.data:Promise.resolve(r.data);return dt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Br.create=(e,t)=>new Br({type:e,typeName:pe.ZodPromise,...ye(t)});var Nt=class extends we{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===pe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this12=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{ee(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(/*#__PURE__*/function(){var _ref41=_asyncToGenerator(function*(s){if(r.value==="aborted")return de;let c=yield _this12._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?de:c.status==="dirty"?gn(c.value):r.value==="dirty"?gn(c.value):c});return function(_x87){return _ref41.apply(this,arguments)}}());{if(r.value==="aborted")return de;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?de:s.status==="dirty"?gn(s.value):r.value==="dirty"?gn(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?de:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?de:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Lr(a))return de;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Lr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):de);Ce.assertNever(o)}};Nt.create=(e,t,r)=>new Nt({schema:e,typeName:pe.ZodEffects,effect:t,...ye(r)});Nt.createWithPreprocess=(e,t,r)=>new Nt({schema:t,effect:{type:"preprocess",transform:e},typeName:pe.ZodEffects,...ye(r)});var Ot=class extends we{_parse(t){return this._getType(t)===re.undefined?dt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ot.create=(e,t)=>new Ot({innerType:e,typeName:pe.ZodOptional,...ye(t)});var Jt=class extends we{_parse(t){return this._getType(t)===re.null?dt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Jt.create=(e,t)=>new Jt({innerType:e,typeName:pe.ZodNullable,...ye(t)});var Tn=class extends we{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===re.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Tn.create=(e,t)=>new Tn({innerType:e,typeName:pe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ye(t)});var _n=class extends we{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ko(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new St(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new St(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};_n.create=(e,t)=>new _n({innerType:e,typeName:pe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ye(t)});var Mo=class extends we{_parse(t){if(this._getType(t)!==re.nan){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.nan,received:n.parsedType}),de}return{status:"valid",value:t.data}}};Mo.create=e=>new Mo({typeName:pe.ZodNaN,...ye(e)});var g0=Symbol("zod_brand"),na=class extends we{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},oa=class e extends we{_parse(t){var _this13=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let i=yield _this13._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?de:i.status==="dirty"?(r.dirty(),gn(i.value)):_this13._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?de:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:pe.ZodPipeline})}},kn=class extends we{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Lr(o)&&(o.value=Object.freeze(o.value)),o);return ko(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};kn.create=(e,t)=>new kn({innerType:e,typeName:pe.ZodReadonly,...ye(t)});function Av(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Iv(e,t={},r){return e?Vr.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=Av(t,n),c=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:c})}});if(!i){let a=Av(t,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):Vr.create()}var h0={object:bt.lazycreate},pe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(pe||(pe={}));var y0=(e,t={message:`Input not instance of ${e.name}`})=>Iv(r=>r instanceof e,t),Tv=Ur.create,_v=hn.create,v0=Mo.create,S0=yn.create,kv=vn.create,b0=Sn.create,w0=Po.create,A0=bn.create,x0=wn.create,C0=Vr.create,E0=yr.create,R0=Ut.create,I0=No.create,T0=vr.create,_0=bt.create,k0=bt.strictCreate,O0=An.create,P0=vc.create,N0=xn.create,F0=Zt.create,D0=Sc.create,M0=Fo.create,q0=Do.create,j0=bc.create,L0=Cn.create,U0=En.create,V0=Rn.create,B0=In.create,G0=Br.create,$0=Nt.create,Q0=Ot.create,H0=Jt.create,z0=Nt.createWithPreprocess,W0=oa.create,K0=()=>Tv().optional(),Y0=()=>_v().optional(),X0=()=>kv().optional(),Z0={string:e=>Ur.create({...e,coerce:!0}),number:e=>hn.create({...e,coerce:!0}),boolean:e=>vn.create({...e,coerce:!0}),bigint:e=>yn.create({...e,coerce:!0}),date:e=>Sn.create({...e,coerce:!0})};var J0=de;var e_=b.object({name:b.string(),arguments:b.string()}),t_=b.object({id:b.string(),type:b.literal("function"),function:e_,encryptedValue:b.string().optional()}),wc=b.object({id:b.string(),role:b.string(),content:b.string().optional(),name:b.string().optional(),encryptedValue:b.string().optional()}),r_=b.object({type:b.literal("text"),text:b.string()}),n_=b.object({type:b.literal("data"),value:b.string(),mimeType:b.string()}),o_=b.object({type:b.literal("url"),value:b.string(),mimeType:b.string().optional()}),Ac=b.discriminatedUnion("type",[n_,o_]),i_=b.object({type:b.literal("image"),source:Ac,metadata:b.unknown().optional()}),a_=b.object({type:b.literal("audio"),source:Ac,metadata:b.unknown().optional()}),s_=b.object({type:b.literal("video"),source:Ac,metadata:b.unknown().optional()}),c_=b.object({type:b.literal("document"),source:Ac,metadata:b.unknown().optional()});var Ov=b.object({type:b.literal("binary"),mimeType:b.string(),id:b.string().optional(),url:b.string().optional(),data:b.string().optional(),filename:b.string().optional()}),Pv=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:b.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},y8=Ov.superRefine((e,t)=>{Pv(e,t)}),u_=b.discriminatedUnion("type",[r_,i_,a_,s_,c_,Ov]),l_=u_.superRefine((e,t)=>{e.type==="binary"&&Pv(e,t)}),d_=wc.extend({role:b.literal("developer"),content:b.string()}),p_=wc.extend({role:b.literal("system"),content:b.string()}),f_=wc.extend({role:b.literal("assistant"),content:b.string().optional(),toolCalls:b.array(t_).optional()}),m_=wc.extend({role:b.literal("user"),content:b.union([b.string(),b.array(l_)])}),g_=b.object({id:b.string(),content:b.string(),role:b.literal("tool"),toolCallId:b.string(),error:b.string().optional(),encryptedValue:b.string().optional()}),h_=b.object({id:b.string(),role:b.literal("activity"),activityType:b.string(),content:b.record(b.any())}),y_=b.object({id:b.string(),role:b.literal("reasoning"),content:b.string(),encryptedValue:b.string().optional()}),Nv=b.discriminatedUnion("role",[d_,p_,f_,m_,g_,h_,y_]),v8=b.union([b.literal("developer"),b.literal("system"),b.literal("assistant"),b.literal("user"),b.literal("tool"),b.literal("activity"),b.literal("reasoning")]),v_=b.object({description:b.string(),value:b.string()}),Fv=b.object({name:b.string(),description:b.string(),parameters:b.any(),metadata:b.record(b.any()).optional()}),S_=b.object({id:b.string(),reason:b.string(),message:b.string().optional(),toolCallId:b.string().optional(),responseSchema:b.record(b.any()).optional(),expiresAt:b.string().optional(),metadata:b.record(b.any()).optional()}),b_=b.object({interruptId:b.string(),status:b.enum(["resolved","cancelled"]),payload:b.any().optional()}),w_=b.object({threadId:b.string(),runId:b.string(),parentRunId:b.string().optional(),state:b.any(),messages:b.array(Nv),tools:b.array(Fv),context:b.array(v_),forwardedProps:b.any(),resume:b.array(b_).optional()}),A_=b.any(),Le=class extends Error{constructor(e){super(e)}},Op=class extends Le{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},x_=b.object({name:b.string(),description:b.string().optional()}),C_=b.object({name:b.string().optional(),type:b.string().optional(),description:b.string().optional(),version:b.string().optional(),provider:b.string().optional(),documentationUrl:b.string().optional(),metadata:b.record(b.unknown()).optional()}),E_=b.object({streaming:b.boolean().optional(),websocket:b.boolean().optional(),httpBinary:b.boolean().optional(),pushNotifications:b.boolean().optional(),resumable:b.boolean().optional()}),R_=b.object({supported:b.boolean().optional(),items:b.array(Fv).optional(),parallelCalls:b.boolean().optional(),clientProvided:b.boolean().optional()}),I_=b.object({structuredOutput:b.boolean().optional(),supportedMimeTypes:b.array(b.string()).optional()}),T_=b.object({snapshots:b.boolean().optional(),deltas:b.boolean().optional(),memory:b.boolean().optional(),persistentState:b.boolean().optional()}),__=b.object({supported:b.boolean().optional(),delegation:b.boolean().optional(),handoffs:b.boolean().optional(),subAgents:b.array(x_).optional()}),k_=b.object({supported:b.boolean().optional(),streaming:b.boolean().optional(),encrypted:b.boolean().optional()}),O_=b.object({image:b.boolean().optional(),audio:b.boolean().optional(),video:b.boolean().optional(),pdf:b.boolean().optional(),file:b.boolean().optional()}),P_=b.object({image:b.boolean().optional(),audio:b.boolean().optional()}),N_=b.object({input:O_.optional(),output:P_.optional()}),F_=b.object({codeExecution:b.boolean().optional(),sandboxed:b.boolean().optional(),maxIterations:b.number().optional(),maxExecutionTime:b.number().optional()}),D_=b.object({supported:b.boolean().optional(),approvals:b.boolean().optional(),interventions:b.boolean().optional(),feedback:b.boolean().optional(),interrupts:b.boolean().optional(),approveWithEdits:b.boolean().optional()}),S8=b.object({identity:C_.optional(),transport:E_.optional(),tools:R_.optional(),output:I_.optional(),state:T_.optional(),multiAgent:__.optional(),reasoning:k_.optional(),multimodal:N_.optional(),execution:F_.optional(),humanInTheLoop:D_.optional(),custom:b.record(b.unknown()).optional()}),Dv=b.union([b.literal("developer"),b.literal("system"),b.literal("assistant"),b.literal("user")]),M=function(e){return e.TEXT_MESSAGE_START="TEXT_MESSAGE_START",e.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",e.TEXT_MESSAGE_END="TEXT_MESSAGE_END",e.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",e.TOOL_CALL_START="TOOL_CALL_START",e.TOOL_CALL_ARGS="TOOL_CALL_ARGS",e.TOOL_CALL_END="TOOL_CALL_END",e.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",e.TOOL_CALL_RESULT="TOOL_CALL_RESULT",e.THINKING_START="THINKING_START",e.THINKING_END="THINKING_END",e.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",e.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",e.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",e.STATE_SNAPSHOT="STATE_SNAPSHOT",e.STATE_DELTA="STATE_DELTA",e.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",e.ACTIVITY_SNAPSHOT="ACTIVITY_SNAPSHOT",e.ACTIVITY_DELTA="ACTIVITY_DELTA",e.RAW="RAW",e.CUSTOM="CUSTOM",e.RUN_STARTED="RUN_STARTED",e.RUN_FINISHED="RUN_FINISHED",e.RUN_ERROR="RUN_ERROR",e.STEP_STARTED="STEP_STARTED",e.STEP_FINISHED="STEP_FINISHED",e.REASONING_START="REASONING_START",e.REASONING_MESSAGE_START="REASONING_MESSAGE_START",e.REASONING_MESSAGE_CONTENT="REASONING_MESSAGE_CONTENT",e.REASONING_MESSAGE_END="REASONING_MESSAGE_END",e.REASONING_MESSAGE_CHUNK="REASONING_MESSAGE_CHUNK",e.REASONING_END="REASONING_END",e.REASONING_ENCRYPTED_VALUE="REASONING_ENCRYPTED_VALUE",e}({}),Te=b.object({type:b.nativeEnum(M),timestamp:b.number().optional(),rawEvent:b.any().optional()}).passthrough(),M_=Te.extend({type:b.literal(M.TEXT_MESSAGE_START),messageId:b.string(),role:Dv.default("assistant"),name:b.string().optional()}),Mv=Te.extend({type:b.literal(M.TEXT_MESSAGE_CONTENT),messageId:b.string(),delta:b.string()}),q_=Te.extend({type:b.literal(M.TEXT_MESSAGE_END),messageId:b.string()}),j_=Te.extend({type:b.literal(M.TEXT_MESSAGE_CHUNK),messageId:b.string().optional(),role:Dv.optional(),delta:b.string().optional(),name:b.string().optional()}),L_=Te.extend({type:b.literal(M.THINKING_TEXT_MESSAGE_START)}),U_=Mv.omit({messageId:!0,type:!0}).extend({type:b.literal(M.THINKING_TEXT_MESSAGE_CONTENT)}),V_=Te.extend({type:b.literal(M.THINKING_TEXT_MESSAGE_END)}),B_=Te.extend({type:b.literal(M.TOOL_CALL_START),toolCallId:b.string(),toolCallName:b.string(),parentMessageId:b.string().nullable().optional().transform(e=>e??void 0)}),G_=Te.extend({type:b.literal(M.TOOL_CALL_ARGS),toolCallId:b.string(),delta:b.string()}),$_=Te.extend({type:b.literal(M.TOOL_CALL_END),toolCallId:b.string()}),Q_=Te.extend({messageId:b.string(),type:b.literal(M.TOOL_CALL_RESULT),toolCallId:b.string(),content:b.string(),role:b.literal("tool").optional()}),H_=Te.extend({type:b.literal(M.TOOL_CALL_CHUNK),toolCallId:b.string().optional(),toolCallName:b.string().optional(),parentMessageId:b.string().nullable().optional().transform(e=>e??void 0),delta:b.string().optional()}),z_=Te.extend({type:b.literal(M.THINKING_START),title:b.string().optional()}),W_=Te.extend({type:b.literal(M.THINKING_END)}),K_=Te.extend({type:b.literal(M.STATE_SNAPSHOT),snapshot:A_}),Y_=Te.extend({type:b.literal(M.STATE_DELTA),delta:b.array(b.any())}),X_=Te.extend({type:b.literal(M.MESSAGES_SNAPSHOT),messages:b.array(Nv)}),Z_=Te.extend({type:b.literal(M.ACTIVITY_SNAPSHOT),messageId:b.string(),activityType:b.string(),content:b.record(b.any()),replace:b.boolean().optional().default(!0)}),J_=Te.extend({type:b.literal(M.ACTIVITY_DELTA),messageId:b.string(),activityType:b.string(),patch:b.array(b.any())}),ek=Te.extend({type:b.literal(M.RAW),event:b.any(),source:b.string().optional()}),tk=Te.extend({type:b.literal(M.CUSTOM),name:b.string(),value:b.any()}),rk=Te.extend({type:b.literal(M.RUN_STARTED),threadId:b.string(),runId:b.string(),parentRunId:b.string().optional(),input:w_.optional()}),nk=b.object({type:b.literal("success")}).strict(),ok=b.object({type:b.literal("interrupt"),interrupts:b.array(S_).min(1)}).strict(),ik=b.discriminatedUnion("type",[nk,ok]),qv=b.object({provider:b.string().optional(),model:b.string().optional(),inputTokens:b.number().int().nonnegative().optional(),outputTokens:b.number().int().nonnegative().optional(),totalTokens:b.number().int().nonnegative().optional(),reasoningTokens:b.number().int().nonnegative().optional(),cachedInputTokens:b.number().int().nonnegative().optional()}),ak=Te.extend({type:b.literal(M.RUN_FINISHED),threadId:b.string(),runId:b.string(),result:b.any().optional(),outcome:ik.nullable().optional().transform(e=>e??void 0),usage:b.array(qv).optional()}),sk=Te.extend({type:b.literal(M.RUN_ERROR),message:b.string(),code:b.string().optional(),usage:b.array(qv).optional()}),ck=Te.extend({type:b.literal(M.STEP_STARTED),stepName:b.string()}),uk=Te.extend({type:b.literal(M.STEP_FINISHED),stepName:b.string()}),lk=b.union([b.literal("tool-call"),b.literal("message")]),dk=Te.extend({type:b.literal(M.REASONING_START),messageId:b.string()}),pk=Te.extend({type:b.literal(M.REASONING_MESSAGE_START),messageId:b.string(),role:b.literal("reasoning")}),fk=Te.extend({type:b.literal(M.REASONING_MESSAGE_CONTENT),messageId:b.string(),delta:b.string()}),mk=Te.extend({type:b.literal(M.REASONING_MESSAGE_END),messageId:b.string()}),gk=Te.extend({type:b.literal(M.REASONING_MESSAGE_CHUNK),messageId:b.string().optional(),delta:b.string().optional()}),hk=Te.extend({type:b.literal(M.REASONING_END),messageId:b.string()}),yk=Te.extend({type:b.literal(M.REASONING_ENCRYPTED_VALUE),subtype:lk,entityId:b.string(),encryptedValue:b.string()}),xc=b.discriminatedUnion("type",[M_,Mv,q_,j_,z_,W_,L_,U_,V_,B_,G_,$_,H_,Q_,K_,Y_,X_,Z_,J_,ek,tk,rk,ak,sk,ck,uk,dk,pk,fk,mk,gk,hk,yk]);m();d();f();p();var Pp={};ni(Pp,{JsonPatchError:()=>Qe,_areEquals:()=>sa,applyOperation:()=>On,applyPatch:()=>kc,applyReducer:()=>Ak,deepClone:()=>bk,getValueByPointer:()=>Tc,validate:()=>Lv,validator:()=>_c});m();d();f();p();m();d();f();p();var vk=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),Sk=Object.prototype.hasOwnProperty;function Ec(e,t){return Sk.call(e,t)}function Rc(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var o in e)Ec(e,o)&&n.push(o);return n}function ct(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Ic(e){for(var t=0,r=e.length,n;t<r;){if(n=e.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0}function er(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function ia(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Cc(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Cc(e[t]))return!0}else if(typeof e=="object"){for(var n=Rc(e),o=n.length,i=0;i<o;i++)if(Cc(e[n[i]]))return!0}}return!1}function jv(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
|
|
33
|
-
`)}var aa=function(e){vk(t,e);function t(r,n,o,i,a){var s=this.constructor,c=e.call(this,jv(r,{name:n,index:o,operation:i,tree:a}))||this;return c.name=n,c.index=o,c.operation=i,c.tree=a,Object.setPrototypeOf(c,s.prototype),c.message=jv(r,{name:n,index:o,operation:i,tree:a}),c}return t}(Error);var Qe=aa,bk=ct,qo={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=Tc(r,this.path);n&&(n=ct(n));var o=On(r,{op:"remove",path:this.from}).removed;return On(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Tc(r,this.from);return On(r,{op:"add",path:this.path,value:ct(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:sa(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},wk={add:function(e,t,r){return Ic(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:qo.move,copy:qo.copy,test:qo.test,_get:qo._get};function Tc(e,t){if(t=="")return e;var r={op:"_get",path:t};return On(e,r),r.value}function On(e,t,r,n,o,i){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),i===void 0&&(i=0),r&&(typeof r=="function"?r(t,0,e,t.path):_c(t,0)),t.path===""){var a={newDocument:e};if(t.op==="add")return a.newDocument=t.value,a;if(t.op==="replace")return a.newDocument=t.value,a.removed=e,a;if(t.op==="move"||t.op==="copy")return a.newDocument=Tc(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=sa(e,t.value),a.test===!1)throw new Qe("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a.newDocument=e,a}else{if(t.op==="remove")return a.removed=e,a.newDocument=null,a;if(t.op==="_get")return t.value=e,a;if(r)throw new Qe("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{n||(e=ct(e));var s=t.path||"",c=s.split("/"),u=e,h=1,v=c.length,C=void 0,g=void 0,y=void 0;for(typeof r=="function"?y=r:y=_c;;){if(g=c[h],g&&g.indexOf("~")!=-1&&(g=ia(g)),o&&(g=="__proto__"||g=="prototype"&&h>0&&c[h-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&C===void 0&&(u[g]===void 0?C=c.slice(0,h).join("/"):h==v-1&&(C=t.path),C!==void 0&&y(t,0,e,C)),h++,Array.isArray(u)){if(g==="-")g=u.length;else{if(r&&!Ic(g))throw new Qe("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,t,e);Ic(g)&&(g=~~g)}if(h>=v){if(r&&t.op==="add"&&g>u.length)throw new Qe("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);var a=wk[t.op].call(t,u,g,e);if(a.test===!1)throw new Qe("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(h>=v){var a=qo[t.op].call(t,u,g,e);if(a.test===!1)throw new Qe("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(u=u[g],r&&h<v&&(!u||typeof u!="object"))throw new Qe("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function kc(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new Qe("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=ct(e));for(var i=new Array(t.length),a=0,s=t.length;a<s;a++)i[a]=On(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function Ak(e,t,r){var n=On(e,t);if(n.test===!1)throw new Qe("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function _c(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Qe("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(qo[e.op]){if(typeof e.path!="string")throw new Qe("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Qe("Operation `path` property must start with \"/\"","OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new Qe("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new Qe("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&Cc(e.value))throw new Qe("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var o=e.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new Qe("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new Qe("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var a={op:"_get",path:e.from,value:void 0},s=Lv([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new Qe("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Qe("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function Lv(e,t,r){try{if(!Array.isArray(e))throw new Qe("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)kc(ct(t),ct(e),r||!0);else{r=r||_c;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof Qe)return o;throw o}}function sa(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),o,i,a;if(r&&n){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!sa(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var s=Object.keys(e);if(i=s.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(s[o]))return!1;for(o=i;o--!==0;)if(a=s[o],!sa(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var Mp={};ni(Mp,{compare:()=>kk,generate:()=>Np,observe:()=>_k,unobserve:()=>Tk});m();d();f();p();var Fp=new WeakMap,xk=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),Ck=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function Ek(e){return Fp.get(e)}function Rk(e,t){return e.observers.get(t)}function Ik(e,t){e.observers.delete(t.callback)}function Tk(e,t){t.unobserve()}function _k(e,t){var r=[],n,o=Ek(e);if(!o)o=new xk(e),Fp.set(e,o);else{var i=Rk(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=ct(e),t){n.callback=t,n.next=null;var a=function(){Np(n)},s=function(){clearTimeout(n.next),n.next=setTimeout(a)};typeof window<"u"&&(window.addEventListener("mouseup",s),window.addEventListener("keyup",s),window.addEventListener("mousedown",s),window.addEventListener("keydown",s),window.addEventListener("change",s))}return n.patches=r,n.object=e,n.unobserve=function(){Np(n),clearTimeout(n.next),Ik(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",s),window.removeEventListener("keyup",s),window.removeEventListener("mousedown",s),window.removeEventListener("keydown",s),window.removeEventListener("change",s))},o.observers.set(t,new Ck(t,n)),n}function Np(e,t){t===void 0&&(t=!1);var r=Fp.get(e.object);Dp(r.value,e.object,e.patches,"",t),e.patches.length&&kc(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Dp(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=Rc(t),a=Rc(e),s=!1,c=!1,u=a.length-1;u>=0;u--){var h=a[u],v=e[h];if(Ec(t,h)&&!(t[h]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var C=t[h];typeof v=="object"&&v!=null&&typeof C=="object"&&C!=null&&Array.isArray(v)===Array.isArray(C)?Dp(v,C,r,n+"/"+er(h),o):v!==C&&(s=!0,o&&r.push({op:"test",path:n+"/"+er(h),value:ct(v)}),r.push({op:"replace",path:n+"/"+er(h),value:ct(C)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+er(h),value:ct(v)}),r.push({op:"remove",path:n+"/"+er(h)}),c=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),s=!0)}if(!(!c&&i.length==a.length))for(var u=0;u<i.length;u++){var h=i[u];!Ec(e,h)&&t[h]!==void 0&&r.push({op:"add",path:n+"/"+er(h),value:ct(t[h])})}}}function kk(e,t,r){r===void 0&&(r=!1);var n=[];return Dp(e,t,n,"",r),n}var Oc=Object.assign({},Pp,Mp,{JsonPatchError:aa,deepClone:ct,escapePathComponent:er,unescapePathComponent:ia});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var qp=function(e,t){return qp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},qp(e,t)};function tr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");qp(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Uv(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(h){try{u(n.next(h))}catch(v){a(v)}}function c(h){try{u(n.throw(h))}catch(v){a(v)}}function u(h){h.done?i(h.value):o(h.value).then(s,c)}u((n=n.apply(e,t||[])).next())})}function Pc(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(r=0)),r;)try{if(n=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],o=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Sr(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function jo(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-->0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function Lo(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function Pn(e){return this instanceof Pn?(this.v=e,this):new Pn(e)}function Vv(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(g){return function(y){return Promise.resolve(y).then(g,v)}}function s(g,y){n[g]&&(o[g]=function(S){return new Promise(function(E,R){i.push([g,S,E,R])>1||c(g,S)})},y&&(o[g]=y(o[g])))}function c(g,y){try{u(n[g](y))}catch(S){C(i[0][3],S)}}function u(g){g.value instanceof Pn?Promise.resolve(g.value.v).then(h,v):C(i[0][2],g)}function h(g){c("next",g)}function v(g){c("throw",g)}function C(g,y){g(y),i.shift(),i.length&&c(i[0][0],i[0][1])}}function Bv(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Sr=="function"?Sr(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(s,c){a=e[i](a),o(s,c,a.done,a.value)})}}function o(i,a,s,c){Promise.resolve(c).then(function(u){i({value:u,done:s})},a)}}m();d();f();p();function xe(e){return typeof e=="function"}m();d();f();p();m();d();f();p();m();d();f();p();function Uo(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Nc=Uo(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
31
|
+
`;function mR(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var gR=["1",1,"yes",!0];function hR(){let e=[];return Ad()&&e.push(window.doNotTrack),Fd()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>gR.indexOf(t)!==-1)}function Ds(e){return e===!0?!1:hR()}var nh="v15",oh={default:"https://analytics.cloud.coveo.com/rest/ua"};function yR(e=oh.default,t=nh,r=!1){if(e=e.replace(/\/$/,""),r)return`${e}/${t}`;let n=e.endsWith("/rest")||e.endsWith("/rest/ua");return`${e}${n?"":"/rest"}/${t}`}var vR="38824e1f-37f5-42d3-8372-a4b8fa9df946",Zt=class{get defaultOptions(){return{endpoint:oh.default,isCustomEndpoint:!1,token:"",version:nh,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Jg}constructor(t){if(this.acceptedLinkReferrers=[],!t)throw new Error("You have to pass options to this constructor");this.options=Object.assign(Object.assign({},this.defaultOptions),t),this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[sE,rE].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};let r={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};Ds(this.options.disableBrowserPrivacySignals)?this.runtime=new Fs:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(Ce.view,{newEventType:Ce.view,addClientIdParameter:!0}),this.addEventTypeMapping(Ce.click,{newEventType:Ce.click,addClientIdParameter:!0}),this.addEventTypeMapping(Ce.custom,{newEventType:Ce.custom,addClientIdParameter:!0}),this.addEventTypeMapping(Ce.search,{newEventType:Ce.search,addClientIdParameter:!0})}initRuntime(t){return Ad()&&go()?new Pd(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(mR()&&console.warn(fR),new Nd(t))}get storage(){return this.runtime.storage}determineVisitorId(){return G(this,void 0,void 0,function*(){try{return Ad()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||fn()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),fn()}})}getCurrentVisitorId(){return G(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return G(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return G(this,void 0,void 0,function*(){if(_s(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(ks(t,ks(r,vR)))}})}getParameters(t,...r){return G(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return G(this,void 0,void 0,function*(){let n=yield this.resolveParameters(t,...r);return yield this.resolvePayloadForParameters(t,n)})}get currentVisitorId(){return typeof(this.visitorId||this.storage.getItem("visitorId"))!="string"&&this.setCurrentVisitorId(fn()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(Ds(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(kr.cvo_cid);if(r==null)return null;let n=kr.fromString(r);return!n||!go()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return G(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:i=!1,addClientIdParameter:a=!1}=this.eventTypeMapping[t]||{};return yield[h=>n.length>0?this.parseVariableArgumentsPayload(n,h):h[0],h=>G(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>G(this,void 0,void 0,function*(){return a?Object.assign(Object.assign({},h),{clientId:yield this.getCurrentVisitorId()}):h}),h=>i?this.ensureAnonymousUserWhenUsingApiKey(h):h,h=>this.beforeSendHooks.reduce((y,b)=>G(this,void 0,void 0,function*(){let x=yield y;return yield b(t,x)}),h)].reduce((h,y)=>G(this,void 0,void 0,function*(){let b=yield h;return yield y(b)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return G(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[v=>this.setTrackingIdIfTrackingIdNotPresent(v),v=>this.removeEmptyPayloadValues(v,t),v=>this.validateParams(v,t),v=>n?nR(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,R)=>G(this,void 0,void 0,function*(){let h=yield v;return yield R(h)}),Promise.resolve(r))})}makeEvent(t,...r){return G(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},o=yield this.resolveParameters(t,...r),i=yield this.resolvePayloadForParameters(t,o);return{eventType:n,payload:i,log:a=>G(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},i),a)}),yield Promise.all(this.afterSendHooks.map(s=>s(t,Object.assign(Object.assign({},o),a)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return G(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return G(this,void 0,void 0,function*(){let t=this.bufferedRequests.shift();if(t){let{eventType:r,payload:n}=t;return this.runtime.getClientDependingOnEventType(r).sendEvent(r,n)}})}clear(){this.storage.removeItem("visitorId"),new Ts().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(Ce.search,t)})}sendSearchEvent(t){return G(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=pr(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(Ce.click,t)})}sendClickEvent(t){return G(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=pr(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(Ce.custom,t)})}sendCustomEvent(t){return G(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=pr(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(Ce.view,t)})}sendViewEvent(t){return G(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return G(this,void 0,void 0,function*(){let r=yield(yield C(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return G(this,void 0,void 0,function*(){return yield(yield C(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,r){this.eventTypeMapping[t]=r}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(r=>typeof r=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,r){let n={};for(let o=0,i=r.length;o<i;o++){let a=r[o];if(typeof a=="string")n[t[o]]=a;else if(typeof a=="object")return Object.assign(Object.assign({},n),a)}return n}isKeyAllowedEmpty(t,r){return({[Ce.search]:["queryText"]}[t]||[]).indexOf(r)!==-1}removeEmptyPayloadValues(t,r){let n=o=>typeof o<"u"&&o!==null&&o!=="";return Object.keys(t).filter(o=>this.isKeyAllowedEmpty(r,o)||n(t[o])).reduce((o,i)=>Object.assign(Object.assign({},o),{[i]:t[i]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(sR(n))return!0;console.log(n,"is not processed by coveoua")}).reduce((n,o)=>Object.assign(Object.assign({},n),{[o]:t[o]}),{})}processCustomParameters(t){let{custom:r}=t,n=pr(t,["custom"]),o={};r&&Is(r)&&(o=this.lowercaseKeys(r));let i=cR(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=pr(t,["custom"]);if(r&&Is(r)){let o=this.lowercaseKeys(r);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},o),t.customData)})}else return t}lowercaseKeys(t){let r=Object.keys(t),n={};return r.forEach(o=>{n[o.toLowerCase()]=t[o]}),n}validateParams(t,r){let{anonymizeIp:n}=t,o=pr(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==Ce.view||r==Ce.click||r==Ce.search||r==Ce.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==Ce.view&&(o.location=this.limit(o.location,1024)),(r=="pageview"||r=="event")&&(o.referrer=this.limit(o.referrer,2048),o.location=this.limit(o.location,2048),o.page=this.limit(o.page,2048)),o}ensureAnonymousUserWhenUsingApiKey(t){let{userId:r}=t,n=pr(t,["userId"]);return pR(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=pr(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Is(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Is(n.customData)&&(n.customData.hasOwnProperty("context_website")||n.customData.hasOwnProperty("siteName"))&&(n.trackingId=n.customData.context_website||n.customData.siteName),n)}limit(t,r){return typeof t=="string"?bE(t,r):t}get baseUrl(){return yR(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},fr;(function(e){e.contextChanged="contextChanged",e.expandToFullUI="expandToFullUI",e.openUserActions="openUserActions",e.showPrecedingSessions="showPrecedingSessions",e.showFollowingSessions="showFollowingSessions",e.clickViewedDocument="clickViewedDocument",e.clickPageView="clickPageView",e.createArticle="createArticle"})(fr||(fr={}));var $;(function(e){e.interfaceLoad="interfaceLoad",e.interfaceChange="interfaceChange",e.didyoumeanAutomatic="didyoumeanAutomatic",e.didyoumeanClick="didyoumeanClick",e.resultsSort="resultsSort",e.searchboxSubmit="searchboxSubmit",e.searchboxClear="searchboxClear",e.searchboxAsYouType="searchboxAsYouType",e.breadcrumbFacet="breadcrumbFacet",e.breadcrumbResetAll="breadcrumbResetAll",e.documentQuickview="documentQuickview",e.documentOpen="documentOpen",e.omniboxAnalytics="omniboxAnalytics",e.omniboxFromLink="omniboxFromLink",e.searchFromLink="searchFromLink",e.triggerNotify="notify",e.triggerExecute="execute",e.triggerQuery="query",e.undoTriggerQuery="undoQuery",e.triggerRedirect="redirect",e.pagerResize="pagerResize",e.pagerNumber="pagerNumber",e.pagerNext="pagerNext",e.pagerPrevious="pagerPrevious",e.pagerScrolling="pagerScrolling",e.staticFilterClearAll="staticFilterClearAll",e.staticFilterSelect="staticFilterSelect",e.staticFilterDeselect="staticFilterDeselect",e.facetClearAll="facetClearAll",e.facetSearch="facetSearch",e.facetSelect="facetSelect",e.facetSelectAll="facetSelectAll",e.facetDeselect="facetDeselect",e.facetExclude="facetExclude",e.facetUnexclude="facetUnexclude",e.facetUpdateSort="facetUpdateSort",e.facetShowMore="showMoreFacetResults",e.facetShowLess="showLessFacetResults",e.queryError="query",e.queryErrorBack="errorBack",e.queryErrorClear="errorClearQuery",e.queryErrorRetry="errorRetry",e.recommendation="recommendation",e.recommendationInterfaceLoad="recommendationInterfaceLoad",e.recommendationOpen="recommendationOpen",e.likeSmartSnippet="likeSmartSnippet",e.dislikeSmartSnippet="dislikeSmartSnippet",e.expandSmartSnippet="expandSmartSnippet",e.collapseSmartSnippet="collapseSmartSnippet",e.openSmartSnippetFeedbackModal="openSmartSnippetFeedbackModal",e.closeSmartSnippetFeedbackModal="closeSmartSnippetFeedbackModal",e.sendSmartSnippetReason="sendSmartSnippetReason",e.expandSmartSnippetSuggestion="expandSmartSnippetSuggestion",e.collapseSmartSnippetSuggestion="collapseSmartSnippetSuggestion",e.showMoreSmartSnippetSuggestion="showMoreSmartSnippetSuggestion",e.showLessSmartSnippetSuggestion="showLessSmartSnippetSuggestion",e.openSmartSnippetSource="openSmartSnippetSource",e.openSmartSnippetSuggestionSource="openSmartSnippetSuggestionSource",e.openSmartSnippetInlineLink="openSmartSnippetInlineLink",e.openSmartSnippetSuggestionInlineLink="openSmartSnippetSuggestionInlineLink",e.recentQueryClick="recentQueriesClick",e.clearRecentQueries="clearRecentQueries",e.recentResultClick="recentResultClick",e.clearRecentResults="clearRecentResults",e.noResultsBack="noResultsBack",e.showMoreFoldedResults="showMoreFoldedResults",e.showLessFoldedResults="showLessFoldedResults",e.copyToClipboard="copyToClipboard",e.caseSendEmail="Case.SendEmail",e.feedItemTextPost="FeedItem.TextPost",e.caseAttach="caseAttach",e.caseDetach="caseDetach",e.retryGeneratedAnswer="retryGeneratedAnswer",e.likeGeneratedAnswer="likeGeneratedAnswer",e.dislikeGeneratedAnswer="dislikeGeneratedAnswer",e.openGeneratedAnswerSource="openGeneratedAnswerSource",e.generatedAnswerOpenInlineLink="generatedAnswerOpenInlineLink",e.generatedAnswerStreamEnd="generatedAnswerStreamEnd",e.generatedAnswerSourceHover="generatedAnswerSourceHover",e.generatedAnswerCopyToClipboard="generatedAnswerCopyToClipboard",e.generatedAnswerHideAnswers="generatedAnswerHideAnswers",e.generatedAnswerShowAnswers="generatedAnswerShowAnswers",e.generatedAnswerExpand="generatedAnswerExpand",e.generatedAnswerCollapse="generatedAnswerCollapse",e.generatedAnswerFeedbackSubmit="generatedAnswerFeedbackSubmit",e.rephraseGeneratedAnswer="rephraseGeneratedAnswer",e.generatedAnswerFeedbackSubmitV2="generatedAnswerFeedbackSubmitV2",e.generatedAnswerCitationClick="generatedAnswerCitationClick",e.generatedAnswerFollowupOpenSource="generatedAnswerFollowupOpenSource",e.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})($||($={}));var zg={[$.triggerNotify]:"queryPipelineTriggers",[$.triggerExecute]:"queryPipelineTriggers",[$.triggerQuery]:"queryPipelineTriggers",[$.triggerRedirect]:"queryPipelineTriggers",[$.queryErrorBack]:"errors",[$.queryErrorClear]:"errors",[$.queryErrorRetry]:"errors",[$.pagerNext]:"getMoreResults",[$.pagerPrevious]:"getMoreResults",[$.pagerNumber]:"getMoreResults",[$.pagerResize]:"getMoreResults",[$.pagerScrolling]:"getMoreResults",[$.facetSearch]:"facet",[$.facetShowLess]:"facet",[$.facetShowMore]:"facet",[$.recommendation]:"recommendation",[$.likeSmartSnippet]:"smartSnippet",[$.dislikeSmartSnippet]:"smartSnippet",[$.expandSmartSnippet]:"smartSnippet",[$.collapseSmartSnippet]:"smartSnippet",[$.openSmartSnippetFeedbackModal]:"smartSnippet",[$.closeSmartSnippetFeedbackModal]:"smartSnippet",[$.sendSmartSnippetReason]:"smartSnippet",[$.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.clearRecentQueries]:"recentQueries",[$.recentResultClick]:"recentlyClickedDocuments",[$.clearRecentResults]:"recentlyClickedDocuments",[$.showLessFoldedResults]:"folding",[$.caseDetach]:"case",[$.likeGeneratedAnswer]:"generatedAnswer",[$.dislikeGeneratedAnswer]:"generatedAnswer",[$.openGeneratedAnswerSource]:"generatedAnswer",[$.generatedAnswerOpenInlineLink]:"generatedAnswer",[$.generatedAnswerFollowupOpenSource]:"generatedAnswer",[$.generatedAnswerStreamEnd]:"generatedAnswer",[$.generatedAnswerSourceHover]:"generatedAnswer",[$.generatedAnswerCopyToClipboard]:"generatedAnswer",[$.generatedAnswerHideAnswers]:"generatedAnswer",[$.generatedAnswerShowAnswers]:"generatedAnswer",[$.generatedAnswerExpand]:"generatedAnswer",[$.generatedAnswerCollapse]:"generatedAnswer",[$.generatedAnswerFeedbackSubmit]:"generatedAnswer",[$.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[fr.expandToFullUI]:"interface",[fr.openUserActions]:"User Actions",[fr.showPrecedingSessions]:"User Actions",[fr.showFollowingSessions]:"User Actions",[fr.clickViewedDocument]:"User Actions",[fr.clickPageView]:"User Actions",[fr.createArticle]:"createArticle"},vo=class{constructor(){this.runtime=new Fs,this.currentVisitorId=""}getPayload(){return Promise.resolve()}getParameters(){return Promise.resolve()}makeEvent(t){return Promise.resolve({eventType:t,payload:null,log:()=>Promise.resolve()})}sendEvent(){return Promise.resolve()}makeSearchEvent(){return this.makeEvent(Ce.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(Ce.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(Ce.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(Ce.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return Jg}};function SR(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function bR(e){return e.map(t=>t.replace(/;/g,""))}function ih(e){let r=e.join(";");return r.length<=256?r:ih(e.slice(1))}var Wg=e=>{let t=bR(e),r=SR(t);return ih(r)};function Kg(e){let t=typeof e.partialQueries=="string"?e.partialQueries:Wg(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:Wg(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Ms=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Ds(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new vo:new Zt(t)}disable(){this.coveoAnalyticsClient=new vo}enable(){this.coveoAnalyticsClient=new Zt(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent($.interfaceLoad)}logInterfaceLoad(){return G(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent($.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return G(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent($.recommendation)}logRecommendation(){return G(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent($.recommendationOpen,t,r)}logRecommendationOpen(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent($.staticFilterClearAll,t)}logStaticFilterClearAll(t){return G(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent($.staticFilterSelect,t)}logStaticFilterSelect(t){return G(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent($.staticFilterDeselect,t)}logStaticFilterDeselect(t){return G(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent($.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return G(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent($.interfaceChange,t)}logInterfaceChange(t){return G(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent($.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return G(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent($.didyoumeanClick)}logDidYouMeanClick(){return G(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent($.resultsSort,t)}logResultsSort(t){return G(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent($.searchboxSubmit)}logSearchboxSubmit(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent($.searchboxClear)}logSearchboxClear(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent($.searchboxAsYouType)}logSearchboxAsYouType(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent($.breadcrumbFacet,t)}logBreadcrumbFacet(t){return G(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent($.breadcrumbResetAll)}logBreadcrumbResetAll(){return G(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent($.documentQuickview,t,r)}logDocumentQuickview(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent($.documentOpen,t,r)}logDocumentOpen(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent($.omniboxAnalytics,Kg(t))}logOmniboxAnalytics(t){return G(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent($.omniboxFromLink,Kg(t))}logOmniboxFromLink(t){return G(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent($.searchFromLink)}logSearchFromLink(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent($.triggerNotify,t)}logTriggerNotify(t){return G(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent($.triggerExecute,t)}logTriggerExecute(t){return G(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent($.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return G(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent($.undoTriggerQuery,t)}logUndoTriggerQuery(t){return G(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent($.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return G(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent($.pagerResize,t)}logPagerResize(t){return G(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent($.pagerNumber,t)}logPagerNumber(t){return G(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent($.pagerNext,t)}logPagerNext(t){return G(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent($.pagerPrevious,t)}logPagerPrevious(t){return G(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent($.pagerScrolling)}logPagerScrolling(){return G(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent($.facetClearAll,t)}logFacetClearAll(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent($.facetSearch,t)}logFacetSearch(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent($.facetSelect,t)}logFacetSelect(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent($.facetDeselect,t)}logFacetDeselect(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent($.facetExclude,t)}logFacetExclude(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent($.facetUnexclude,t)}logFacetUnexclude(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent($.facetSelectAll,t)}logFacetSelectAll(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent($.facetUpdateSort,t)}logFacetUpdateSort(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent($.facetShowMore,t)}logFacetShowMore(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent($.facetShowLess,t)}logFacetShowLess(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent($.queryError,t)}logQueryError(t){return G(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return G(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorBack);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorBack)})}})}logQueryErrorBack(){return G(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return G(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorRetry);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorRetry)})}})}logQueryErrorRetry(){return G(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return G(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorClear);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorClear)})}})}logQueryErrorClear(){return G(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent($.likeSmartSnippet)}logLikeSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent($.dislikeSmartSnippet)}logDislikeSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent($.expandSmartSnippet)}logExpandSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent($.collapseSmartSnippet)}logCollapseSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent($.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent($.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return G(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent($.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent($.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return G(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent($.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return G(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent($.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return G(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent($.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return G(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent($.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent($.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent($.copyToClipboard,t,r)}logCopyToClipboard(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent($.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent($.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent($.recentQueryClick)}logRecentQueryClick(){return G(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent($.clearRecentQueries)}logClearRecentQueries(){return G(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent($.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent($.clearRecentResults)}logClearRecentResults(){return G(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent($.noResultsBack)}logNoResultsBack(){return G(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent($.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent($.showLessFoldedResults)}logShowLessFoldedResults(){return G(this,void 0,void 0,function*(){return(yield this.makeShowLessFoldedResults()).log({searchUID:this.provider.getSearchUID()})})}makeEventDescription(t,r){var n;return{actionCause:r,customData:(n=t.payload)===null||n===void 0?void 0:n.customData}}makeCustomEvent(t,r){return G(this,arguments,void 0,function*(n,o,i=zg[n]){this.coveoAnalyticsClient.getParameters;let a=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),s=Object.assign(Object.assign({},yield this.getBaseEventRequest(a)),{eventType:i,eventValue:n}),u=yield this.coveoAnalyticsClient.makeCustomEvent(s);return{description:this.makeEventDescription(u,n),log:({searchUID:c})=>u.log({lastSearchQueryUid:c})}})}logCustomEvent(t,r){return G(this,arguments,void 0,function*(n,o,i=zg[n]){return(yield this.makeCustomEvent(n,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return G(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),i=Object.assign(Object.assign({},yield this.getBaseEventRequest(o)),{eventType:r,eventValue:t}),a=yield this.coveoAnalyticsClient.makeCustomEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:s})=>a.log({lastSearchQueryUid:s})}})}logCustomEventWithType(t,r,n){return G(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return G(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),o=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(o,t),log:({searchUID:i})=>o.log({searchQueryUid:i})}})}makeClickEvent(t,r,n,o){return G(this,void 0,void 0,function*(){let i=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),a=yield this.coveoAnalyticsClient.makeClickEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:s})=>a.log({searchQueryUid:s})}})}logClickEvent(t,r,n,o){return G(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return G(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return G(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.getOrigins()),this.getSplitTestRun()),{customData:r,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,r;return{originContext:(r=(t=this.provider).getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof Zt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getSplitTestRun(){let t=this.provider.getSplitTestRunName?this.provider.getSplitTestRunName():"",r=this.provider.getSplitTestRunVersion?this.provider.getSplitTestRunVersion():"";return Object.assign(Object.assign({},t&&{splitTestRunName:t}),r&&{splitTestRunVersion:r})}makeLikeGeneratedAnswer(t){return this.makeCustomEvent($.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return G(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent($.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return G(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent($.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return G(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent($.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent($.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent($.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent($.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent($.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent($.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent($.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent($.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent($.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent($.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent($.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent($.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return G(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent($.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return G(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent($.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Ls=Object.assign({},Li),Yg=Object.keys(Ls).map(e=>Ls[e]),ho=class extends Cd{constructor({client:t,uuidGenerator:r=fn}){super({client:t,uuidGenerator:r}),this.ticket={}}getApi(t){let r=super.getApi(t);return r!==null?r:t==="setTicket"?this.setTicket:null}addHooks(){this.addHooksForEvent(),this.addHooksForPageView(),this.addHooksForSVCEvents()}setTicket(t){this.ticket=t}clearPluginData(){this.ticket={}}addHooksForSVCEvents(){this.client.registerBeforeSendEventHook((t,...[r])=>Yg.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Yg.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Ls.pageview,{newEventType:Ce.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Ls.event,{newEventType:Ce.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,r){var n;let o=Object.assign(Object.assign(Object.assign(Object.assign({},this.getLocationInformation(t,r)),this.getDefaultContextInformation(t)),this.action?{svcAction:this.action}:{}),Object.keys((n=this.actionData)!==null&&n!==void 0?n:{}).length>0?{svcActionData:this.actionData}:{}),i=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},i),o),r)}getTicketPayload(){return EE(this.ticket)}};ho.Id="svc";var qs;(function(e){e.click="click",e.flowStart="flowStart"})(qs||(qs={}));var Ot;(function(e){e.enterInterface="ticket_create_start",e.fieldUpdate="ticket_field_update",e.fieldSuggestionClick="ticket_classification_click",e.documentSuggestionClick="documentSuggestionClick",e.documentSuggestionQuickview="documentSuggestionQuickview",e.suggestionRate="suggestion_rate",e.nextCaseStep="ticket_next_stage",e.caseCancelled="ticket_cancel",e.caseSolved="ticket_cancel",e.caseCreated="ticket_create"})(Ot||(Ot={}));var js;(function(e){e.quit="Quit",e.solved="Solved"})(js||(js={}));var Us=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!Ds(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new Zt(t):new vo,this.svc=new ho({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new vo,this.svc=new ho({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Zt(this.options),this.svc=new ho({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(Ot.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(Ot.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(Ot.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(Ot.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(Ot.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(Ot.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(Ot.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(Ot.caseCancelled,{reason:js.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(Ot.caseSolved,{reason:js.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(Ot.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",qs.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",qs.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return G(this,void 0,void 0,function*(){var r,n;let o=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:o,language:(r=this.provider)===null||r===void 0?void 0:r.getLanguage(),anonymous:(n=this.provider)===null||n===void 0?void 0:n.getIsAnonymous(),clientId:yield this.getClientId()})})}getClientId(){return this.coveoAnalyticsClient instanceof Zt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,o,i;return{originContext:(r=(t=this.provider)===null||t===void 0?void 0:t.getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:(n=this.provider)===null||n===void 0?void 0:n.getOriginLevel1(),originLevel2:(o=this.provider)===null||o===void 0?void 0:o.getOriginLevel2(),originLevel3:(i=this.provider)===null||i===void 0?void 0:i.getOriginLevel3()}}logClickEvent(t,r,n,o){return G(this,void 0,void 0,function*(){var i,a;let s=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:(a=(i=this.provider)===null||i===void 0?void 0:i.getSearchUID())!==null&&a!==void 0?a:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(s)})}};var ah=e=>new Zt(e).getCurrentVisitorId(),Ui=(e,t)=>typeof t=="function"?(...r)=>{let n=mi(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,Vi=(e,t)=>(...r)=>{let n=mi(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function Vs(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function sh(e){let{activeValue:t,ancestryMap:r}=AR(e);return t?wR(t,r):[]}function AR(e){let t=[...e],r=new Map;for(;t.length>0;){let n=t.shift();if(n.state==="selected")return{activeValue:n,ancestryMap:r};if(r)for(let o of n.children)r.set(o,n);t.unshift(...n.children)}return{}}function wR(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var xR=(e,t)=>e.categoryFacetSet[t]?.request;var Ld=(e,t)=>{let r=xR(e,t);return sh(r?.currentValues??[])};m();d();f();p();function Gs(){return{}}m();d();f();p();function Bs(){return{}}m();d();f();p();function $s(){return{}}m();d();f();p();function Qs(){return{}}function qd(e){return{facetSet:e.facetSet??Qs(),categoryFacetSet:e.categoryFacetSet??Gs(),dateFacetSet:e.dateFacetSet??Bs(),numericFacetSet:e.numericFacetSet??$s(),automaticFacetSet:e.automaticFacetSet??Vs()}}var jd=e=>{let t=[];return RR(e).forEach((r,n)=>{let o=FR(e,r.facetId),i=PR(r,n+1);if(ER(r)){if(!!!Ld(e,r.facetId).length)return;t.push({...i,...kR(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((a,s)=>{if(a.state==="idle")return;let u=ch(a,s+1,o),c=CR(r)?uh(a):TR(a);t.push({...i,...u,...c})})}),IR(e).forEach((r,n)=>{let o=OR(r,n+1);r.values.forEach((i,a)=>{if(i.state==="idle")return;let s=ch(i,a+1,"specific"),u=uh(i);t.push({...o,...s,...u})})}),t},CR=e=>e.type==="specific",ER=e=>e.type==="hierarchical",RR=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),IR=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),ch=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),TR=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),uh=e=>({displayValue:e.value,value:e.value}),_R=(e,t)=>Ld(e,t).map(n=>n.value).join(";"),kR=(e,t)=>{let n=_R(e,t);return{value:n,valuePosition:1,displayValue:n}},OR=(e,t)=>({title:lh(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),PR=(e,t)=>({title:lh(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),lh=(e,t)=>`${e}_${t}`,NR=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,FR=(e,t)=>{let r=NR(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var Ud=e=>e.configuration.search.locale,dh=e=>e.configuration.search.timezone,ph=e=>e.configuration.accessToken,fh=e=>e.configuration.organizationId,mh=e=>e.configuration.environment,Hs=e=>e.configuration?.knowledge?.agentId,gh=e=>e.configuration.knowledge.debugAgentSession;var je=e=>{if(DR(e)||Vd(e))return e.generatedAnswer?.answerId;if(MR(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},DR=e=>"answer"in e&&"generatedAnswer"in e&&!ce(e.generatedAnswer?.answerConfigurationId),Vd=e=>{let t=Hs(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},MR=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Gd=e=>e.generatedAnswer?.fieldsToIncludeInCitations,Or=e=>e.followUpAnswers?.conversationId,LR=e=>e.generatedAnswer?.citations,qR=e=>e.followUpAnswers?.followUpAnswers,jR=ze(qR,e=>e?.flatMap(t=>t.citations)),UR=(e,t)=>t,So=ze(LR,jR,UR,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));m();d();f();p();var Et=()=>({q:"",enableQuerySyntax:!1});m();d();f();p();m();d();f();p();var hh=(r=>(r.Ascending="ascending",r.Descending="descending",r))(hh||{}),yh=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(yh||{}),Bd=e=>{if(lm(e))return e.map(t=>Bd(t)).join(",");switch(e.by){case"relevancy":case"qre":case"nosort":return e.by;case"date":return`date ${e.order}`;case"field":return`@${e.field} ${e.order}`;default:return""}},vh=()=>({by:"relevancy"});var xV=new ne({values:{by:new Ll({enum:yh,required:!0}),order:new Ll({enum:hh}),field:new z}});function zs(){return Bd(vh())}m();d();f();p();m();d();f();p();var bo=()=>"default";var VR=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},mr=class{constructor(t){ue(this,"getState",t);ue(this,"state");this.state=t()}getLanguage(){return VR(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[i,a]of Object.entries(n)){let s=`context_${i}`;o[s]=a}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=ao),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||bo()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};var Gi=class Gi extends mr{constructor(){super(...arguments);ue(this,"getFacetRequest",r=>this.state.facetSet?.[r]?.request||this.state.categoryFacetSet?.[r]?.request||this.state.dateFacetSet?.[r]?.request||this.state.numericFacetSet?.[r]?.request||this.state.automaticFacetSet?.set[r]?.response)}getFacetState(){return jd(qd(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Gi.fallbackPipelineName}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.resultURIs,numberOfResults:this.numberOfResults}}getSearchUID(){let r=this.getState();return r.search?.searchResponseId||r.search?.response.searchUid||zt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Gi.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=je(r);return o&&(n.generativeQuestionAnsweringId=o),n}getFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetValue:n,facetTitle:`${i}_${r}`}}getFacetClearAllMetadata(r){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetTitle:`${o}_${r}`}}getFacetUpdateSortMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,criteria:n,facetTitle:`${i}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${i}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??zs()}}getStaticFilterToggleMetadata(r,n){return{...this.getBaseMetadata(),staticFilterId:r,staticFilterValue:n}}getStaticFilterClearAllMetadata(r){return{...this.getBaseMetadata(),staticFilterId:r}}getUndoTriggerQueryMetadata(r){return{...this.getBaseMetadata(),undoneQuery:r}}getCategoryBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:i,categoryFacetPath:n,categoryFacetTitle:`${i}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let o=this.state.querySuggest?.[r],i=o.completions.map(c=>c.expression),a=o.partialQueries.length-1,s=o.partialQueries[a]||"",u=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(n),partialQuery:s,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:i.length>0?i:"",querySuggestResponseId:u}}getInterfaceChangeMetadata(){return{...this.getBaseMetadata(),interfaceChangeTo:this.state.configuration.analytics.originLevel2}}getOmniboxFromLinkMetadata(r){return{...this.getBaseMetadata(),...r}}getGeneratedAnswerMetadata(){let r=this.getState(),n={};return r.generatedAnswer?.isVisible!==void 0&&(n.showGeneratedAnswer=r.generatedAnswer.isVisible),n}get resultURIs(){return this.results?.map(r=>({documentUri:r.uri,documentUriHash:r.raw.urihash}))}get results(){return this.state.search?.response.results}get queryText(){return this.state.query?.q||Et().q}get responseTime(){return this.state.search?.duration||zt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||zt().response.totalCountFiltered}};ue(Gi,"fallbackPipelineName","default");var Pr=Gi,Sh=({logger:e,getState:t,analyticsClientMiddleware:r=(a,s)=>s,preprocessRequest:n,provider:o,disableBrowserPrivacySignals:i})=>{let a=t(),s=a.configuration.accessToken,u=a.configuration.analytics.apiBaseUrl??_t(a.configuration.organizationId,a.configuration.environment,"analytics"),c=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,v=new Ms({token:s,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:Ui(e,n),beforeSendHooks:[Vi(e,r),(R,h)=>(e.info({...h,type:R,endpoint:u,token:s},"Analytics request"),h)]},o);return g||v.disable(),v},$d=()=>{let t=ht.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};var Ws=/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield ah(e),clientTimestamp:new Date().toISOString(),documentReferrer:e.originLevel3,originContext:e.originContext,...(t&&{actionCause:t.actionCause,customData:t.customData}),...(t&&!r&&{customData:t.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.documentLocation&&{documentLocation:e.documentLocation}),...(e.deviceId&&{deviceId:e.deviceId}),...($d()&&{pageId:$d()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:mo(e)})}}});return function Ws(_x17,_x18){return _ref10.apply(this,arguments)}}();m();d();f();p();m();d();f();p();m();d();f();p();var Ao=()=>({duration:0,error:null,isLoading:!1,id:"Recommendation",recommendations:[],searchUid:"",splitTestRun:"",pipeline:""});var Bi=class extends mr{getPipeline(){return this.state.pipeline||this.state.recommendation?.pipeline||"default"}getSearchEventRequestPayload(){return{queryText:Et().q,responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getSearchUID(){return this.getState().recommendation?.searchUid||Ao().searchUid}getSplitTestRunName(){return this.state.recommendation?.splitTestRun}getSplitTestRunVersion(){let t=!!this.getSplitTestRunName(),r=this.state.recommendation?.pipeline||this.state.pipeline||"default";return t?r:void 0}get responseTime(){return this.state.recommendation?.duration||Ao().duration}mapResultsToAnalyticsDocument(){return this.state.recommendation?.recommendations.map(t=>({documentUri:t.uri,documentUriHash:t.raw.urihash}))}get numberOfResults(){return this.state.recommendation?.recommendations.length||Ao().recommendations.length}};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function bh(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}m();d();f();p();m();d();f();p();m();d();f();p();var Ah=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function GR(e){return typeof e=="string"&&Ah.test(e)}var Qd=GR;m();d();f();p();var it=[];for(let e=0;e<256;++e)it.push((e+256).toString(16).slice(1));function wh(e,t=0){return(it[e[t+0]]+it[e[t+1]]+it[e[t+2]]+it[e[t+3]]+"-"+it[e[t+4]]+it[e[t+5]]+"-"+it[e[t+6]]+it[e[t+7]]+"-"+it[e[t+8]]+it[e[t+9]]+"-"+it[e[t+10]]+it[e[t+11]]+it[e[t+12]]+it[e[t+13]]+it[e[t+14]]+it[e[t+15]]).toLowerCase()}m();d();f();p();var BR=new Uint8Array(16);function Hd(){return crypto.getRandomValues(BR)}m();d();f();p();function $R(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():QR(e,t,r)}function QR(e,t,r){e=e||{};let n=e.random??e.rng?.()??Hd();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return wh(n)}var zd=$R;function HR(_x19){return _HR.apply(this,arguments)}function _HR(){_HR=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:i,mode:a}=e;if(a!=="disabled")return n.call(r),t.send(o,i,r)});return _HR.apply(this,arguments)}var Th="2.1.3",Wd=128,_h=192,xh=224,Ch=240,zR=248;function WR(e){return(e&zR)===Ch?4:(e&Ch)===xh?3:(e&xh)===_h?2:1}function KR(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&Wd)!=Wd)break;if(r-=3,(n&_h)!=Wd){t-r>=WR(n)*3&&(r=t);break}}return e.substring(0,r)}function YR(e){let{trackingId:t}=e;return{trackingId:t}}function XR(e){return(e.source||[]).concat([`relay@${Th}`])}function kh(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,a=YR(t),s=r.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:XR(t),clientId:s,userAgent:i(),referrer:Eh(n()),location:Eh(o())})}function Eh(e){return e!==null?KR(e,1024):null}function ZR(e,t,r,n){return{...t,meta:kh(e,r,n)}}var JR="*";function eI(){let e=[];function t({type:u,callback:c}){return e.findIndex(g=>g.type===u&&g.callback===c)}function r(u,c){return u.type==="*"||c===u.type}function n(u){return t(u)<0&&e.push(u),()=>s(u.type,u.callback)}function o(u){e.forEach(c=>{if(r(c,u.meta.type))try{c.callback(u)}catch(g){console.error(g)}})}function i(u){if(u===JR)e.length=0;else for(let c=e.length-1;c>=0;c--)e[c].type===u&&e.splice(c,1)}function a(u){let c=t(u);c>=0&&e.splice(c,1)}function s(u,c){c?a({type:u,callback:c}):i(u)}return{add:n,call:o,remove:s}}function Rh({url:e,token:t,trackingId:r,...n}){return Object.freeze({url:e,token:t,trackingId:r,...(!!n.mode&&{mode:n.mode}),...(!!n.source&&{source:n.source}),...(!!n.environment&&{environment:n.environment})})}function tI(e){let t=Rh(e);return{get:()=>t,update:r=>{t=Rh({...t,...r})}}}var Kd=rI();function rI(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,o=document.cookie.split(";");for(let i of o){let a=i.replace(/^\s+/,"");if(a.lastIndexOf(n,0)===0)return a.substring(n.length,a.length)}return null},setItem(r,n,o){let i=t(window.location.hostname),a=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,s=i?`;domain=${i}`:"";document.cookie=`${e}${r}=${n}${a}${s};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function nI(){return{getItem(e){return Kd.getItem(e)||localStorage.getItem(e)},removeItem(e){Kd.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Kd.setItem(e,t,31556952e3)}}}var Ih="visitorId";function oI(){let e=document.referrer;return e===""?null:e}function Yd(){let e=nI();return{runtime:"browser",send:function(){var _ref11=_asyncToGenerator(function*(t,r,n){let o=C(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});bh().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let a=yield o;if(a?.ok){let s;try{s=yield a.json()}catch{return}for(let u of s.events)if(!u.accepted)throw new Error(`Received event was rejected for processing: ${u.errorMessage}`)}else throw new Error(`Error ${a.status}: Failed to send the event(s).`)});return function send(_x20,_x21,_x22){return _ref11.apply(this,arguments)}}(),getReferrer:()=>oI(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(Ih);if(t&&Qd(t))return t;let r=zd();return e.setItem(Ih,r),r}}}function iI(){try{let e="__storage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return e instanceof DOMException&&e.name==="QuotaExceededError"&&localStorage&&localStorage.length!==0}}function aI(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function sI(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=aI();return t&&r?{...r,runtime:"custom"}:t&&cI()&&iI()?Yd():n}function cI(){try{return typeof window=="object"}catch{return!1}}function uI(e){return{get:()=>Object.freeze(sI(e))}}function Oh(e){let t=tI(e),r=eI(),n=uI(t);return{emit:function(){var _ref12=_asyncToGenerator(function*(o,i){let a=t.get(),s=n.get(),u=ZR(o,i,a,s);return HR({config:a,environment:s,event:u,listenerManager:r})});return function emit(_x23,_x24){return _ref12.apply(this,arguments)}}(),getMeta:o=>kh(o,t.get(),n.get()),on:(o,i)=>r.add({type:o,callback:i}),off:(o,i)=>r.remove(o,i),updateConfig:o=>t.update(o),version:Th}}m();d();f();p();function Ph(){return typeof window<"u"&&typeof document<"u"}var lI=50,dI=is({memoize:dd,memoizeOptions:{maxSize:lI}}),$i=dI(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>mo(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},a,s)=>{let u=fI(s);return Oh({mode:i?"emit":"disabled",url:o??qa(e,t),token:r,trackingId:n??null,source:a,environment:u})}),pI={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref13=_asyncToGenerator(function*(){});return function send(){return _ref13.apply(this,arguments)}}()},fI=e=>{if(!e)return;let t=e();return{...(Ph()?Yd():pI),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();var Qi=class extends mr{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Nh=({logger:e,getState:t,analyticsClientMiddleware:r=(a,s)=>s,preprocessRequest:n,provider:o=new Qi(t),disableBrowserPrivacySignals:i})=>{let a=t(),s=a.configuration.accessToken,u=a.configuration.analytics.apiBaseUrl??_t(a.configuration.organizationId,a.configuration.environment,"analytics"),c=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,v=new Us({enableAnalytics:g,token:s,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:Ui(e,n),beforeSendHooks:[Vi(e,r),(R,h)=>(e.info({...h,type:R,endpoint:u,token:s},"Analytics request"),h)]},o);return g||v.disable(),v};m();d();f();p();m();d();f();p();function Dh(e,t){return{...new Pr(t).getBaseMetadata(),actionCause:e,type:e}}function mI(e){return Object.assign(e,{instantlyCallable:!0})}function gI(e,t){let r=i=>{let a=ke(e,i);return mI(Object.assign(a,{type:a.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(i,{getState:a,extra:s}){let{analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:v}=s;return yield(yield t({getState:a,analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:v})).log({state:a(),extra:s})});return function(_x25,_x26){return _ref14.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref15=_asyncToGenerator(function*({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:u,disableBrowserPrivacySignals:c}){let{description:g,log:v}=yield t({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:u,disableBrowserPrivacySignals:c});return{description:g,action:r(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(R,{getState:h,extra:y}){return yield v({state:h(),extra:y})});return function(_x28,_x29){return _ref16.apply(this,arguments)}}())}});return function prepare(_x27){return _ref15.apply(this,arguments)}}()}),n}var Mh=(e,t,r)=>{function n(...o){let i=o.length===1?{...o[0],__legacy__getBuilder:t(o[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:r}:{prefix:o[0],__legacy__getBuilder:t(o[1]),__legacy__provider:o[2],analyticsConfigurator:e,providerClass:r};return vI(i)}return n},hI=e=>e.configuration.analytics.analyticsMode==="legacy",yI=e=>e.configuration.analytics.analyticsMode==="next",vI=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:a})=>(r??(r=s=>new a(s)),gI(e,/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*({getState:s,analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:v}){let R=[],h={log:function(){var _ref18=_asyncToGenerator(function*({state:_}){for(let T of R)yield T(_)});return function log(_x31){return _ref18.apply(this,arguments)}}()},y=s(),b=i({getState:s,logger:g,analyticsClientMiddleware:u,preprocessRequest:c,disableBrowserPrivacySignals:v,provider:r(s)}),x=yield t(b,s());h.description=x?.description,R.push(/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(_){hI(_)&&(yield SI(x,r,_,g,b.coveoAnalyticsClient))});return function(_x32){return _ref19.apply(this,arguments)}}());let{emit:I}=$i(y);return R.push(/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(_){if(yI(_)&&o&&n){let T=n(_);yield RI(I,o,T)}});return function(_x33){return _ref20.apply(this,arguments)}}()),h});return function(_x30){return _ref17.apply(this,arguments)}}()));function SI(_x34,_x35,_x36,_x37,_x38){return _SI.apply(this,arguments)}function _SI(){_SI=_asyncToGenerator(function*(e,t,r,n,o){t(()=>r);let i=yield e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:o,response:i},"Analytics response")});return _SI.apply(this,arguments)}var bI=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref21=_asyncToGenerator(function*(i){r(n,o)});return function log(_x39){return _ref21.apply(this,arguments)}}()}),De=Mh(e=>Sh({...e,provider:e.provider||new Pr(e.getState)}),e=>e,Pr),IB=Mh(Nh,bI("caseAssist"),Qi);var Xd=(e,t)=>{let r=t.recommendation?.recommendations.findIndex(({uniqueId:n})=>e.uniqueId===n)||0;return AI(e,r,t)},Lh=(e,t)=>({sourceName:jh(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||_r()}),qh=(e,t)=>({sourceName:jh(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||_r()});function jh(e){let t=e.source;return ce(t)?"unknown":t}var Uh=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function AI(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:CI(e),...(Fh(e)?{documentCategory:Fh(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:EI(e),queryPipeline:r.pipeline||_r()}}function Fh(e){return e.raw?.objecttype||void 0}var Ks=e=>(e.raw.permanentid||console.warn("Missing field permanentid on result. This might cause many issues with your Coveo deployment. See https://docs.coveo.com/en/1913 and https://docs.coveo.com/en/1640 for more information.",e),{contentIDKey:"permanentid",contentIDValue:e.raw.permanentid||""}),Vh={urihash:new z,sourcetype:new z,permanentid:new z},Gh={uniqueId:Y,raw:new ne({values:Vh}),title:Y,uri:Y,clickUri:Y,rankingModifier:new z({required:!1,emptyAllowed:!0})};function wI(e){return Object.assign({},...Object.keys(Vh).map(t=>({[t]:e[t]})))}function xI(e){return Object.assign({},...Object.keys(Gh).map(t=>({[t]:e[t]})),{raw:wI(e.raw)})}function CI(e){let t=e.raw.author;return ce(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function EI(e){let t=e.raw.source;return ce(t)?"unknown":t}var Zd=e=>new yt(Gh).validate(xI(e));function RI(_x40,_x41,_x42){return _RI.apply(this,arguments)}function _RI(){_RI=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _RI.apply(this,arguments)}m();d();f();p();var Bh=()=>De("analytics/recommendation/update",e=>e.makeRecommendationInterfaceLoad(),e=>new Bi(e)),$h=()=>({actionCause:"recommendationInterfaceLoad"}),Xs=e=>De({prefix:"analytics/recommendation/open",__legacy__getBuilder:(t,r)=>(Zd(e),t.makeRecommendationOpen(Xd(e,r),Ks(e))),__legacy__provider:t=>new Bi(t),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=Xd(e,t),n=Ks(e);return{responseId:e.searchUid??"",position:r.documentPosition,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.documentTitle,author:r.documentAuthor,url:r.documentUrl}}}});var wo=L("recommendation/set",e=>B(e,{id:Y})),Nr=ke("recommendation/get",/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=Date.now(),a=yield II(o),s=yield n.recommendations(a),u=Date.now()-i;return vt(s)?r(s.error):{recommendations:s.success.results,analyticsAction:Bh(),duration:u,searchUid:s.success.searchUid,splitTestRun:s.success.splitTestRun,pipeline:s.success.pipeline}});return function(_x43,_x44){return _ref22.apply(this,arguments)}}()),II=/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??xr(e.configuration.organizationId,e.configuration.environment),recommendation:e.recommendation.id,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,locale:e.configuration.search.locale,actionsHistory:e.configuration.analytics.enabled?ht.getInstance().getHistory():[],...(e.advancedSearchQueries&&{aq:e.advancedSearchQueries.aq,cq:e.advancedSearchQueries.cq}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.context&&{context:e.context.contextValues}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.configuration.analytics.enabled&&(yield TI(e,$h()))),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}),...(e.pagination&&{numberOfResults:e.pagination.numberOfResults})}});return function II(_x45){return _ref23.apply(this,arguments)}}(),TI=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t){let r=e.configuration.analytics.analyticsMode==="legacy"?void 0:{actionCause:t.actionCause,type:t.actionCause};return yield Ws(e.configuration.analytics,r)});return function TI(_x46,_x47){return _ref24.apply(this,arguments)}}();var xo=Be(Ao(),e=>{e.addCase(wo,(t,r)=>{t.id=r.payload.id}).addCase(Nr.rejected,(t,r)=>{t.error=r.payload?r.payload:null,t.isLoading=!1}).addCase(Nr.fulfilled,(t,r)=>{t.error=null,t.recommendations=r.payload.recommendations.map(n=>({...n,searchUid:r.payload.searchUid})),t.duration=r.payload.duration,t.isLoading=!1,t.searchUid=r.payload.searchUid,t.splitTestRun=r.payload.splitTestRun,t.pipeline=r.payload.pipeline}).addCase(Nr.pending,t=>{t.isLoading=!0}).addCase(ws,(t,r)=>{t.error=r.payload,t.isLoading=!1})});m();d();f();p();var Co=L("searchHub/set",e=>B(e,new z({required:!0,emptyAllowed:!0})));m();d();f();p();var Eo=Be(bo(),e=>{e.addCase(Co,(t,r)=>r.payload).addCase(St.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Yt,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Qh=class extends Error{constructor(t){super(t[0].message);ue(this,"issues");this.name="SchemaError",this.issues=t}};var hr="uninitialized",tp="pending",zi="fulfilled",Wi="rejected";function Hh(e){return{status:e,isUninitialized:e===hr,isLoading:e===tp,isSuccess:e===zi,isError:e===Wi}}var zh=Wt;function sy(e,t){if(e===t||!(zh(e)&&zh(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),o=r.length===n.length,i=Array.isArray(t)?[]:{};for(let a of r)i[a]=sy(e[a],t[a]),o&&(o=e[a]===i[a]);return o?e:i}function rp(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function _I(e){return new RegExp("(^|:)//").test(e)}function kI(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function ap(e){return e!=null}function Wh(e){return[...(e?.values()??[])].filter(ap)}function OI(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var PI=e=>e.replace(/\/$/,""),NI=e=>e.replace(/^\//,"");function FI(e,t){if(!e)return t;if(!t)return e;if(_I(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=PI(e),t=NI(t),`${e}${r}${t}`}function ec(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var np=()=>new Map,DI=e=>{let t=new l.AbortController;return setTimeout(()=>{let r="signal timed out",n="TimeoutError";t.abort(typeof DOMException<"u"?new DOMException(r,n):Object.assign(new Error(r),{name:n}))},e),t.signal},MI=(...e)=>{for(let r of e)if(r.aborted)return l.AbortSignal.abort(r.reason);let t=new l.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},Kh=(...e)=>C(...e),LI=e=>e.status>=200&&e.status<=299,qI=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Yh(e){if(!Wt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var jI=e=>typeof e=="object"&&(Wt(e)||Array.isArray(e)||typeof e.toJSON=="function");function cy({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=Kh,paramsSerializer:n,isJsonContentType:o=qI,jsonContentType:i="application/json",jsonReplacer:a,timeout:s,responseHandler:u,validateStatus:c,...g}={}){return typeof C>"u"&&r===Kh&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(R,h,y){let{getState:b,extra:x,endpoint:I,forced:_,type:T}=h,P,{url:A,headers:O=new E(g.headers),params:k=void 0,responseHandler:N=u??"json",validateStatus:M=c??LI,timeout:V=s,...j}=typeof R=="string"?{url:R}:R,D={...g,signal:V?MI(h.signal,DI(V)):h.signal,...j};O=new E(Yh(O)),D.headers=(yield t(O,{getState:b,arg:R,extra:x,endpoint:I,forced:_,type:T,extraOptions:y}))||O;let q=jI(D.body);if(D.body!=null&&!q&&typeof D.body!="string"&&D.headers.delete("content-type"),!D.headers.has("content-type")&&q&&D.headers.set("content-type",i),q&&o(D.headers)&&(D.body=JSON.stringify(D.body,a)),D.headers.has("accept")||(N==="json"?D.headers.set("accept","application/json"):N==="text"&&D.headers.set("accept","text/plain, text/html, */*")),k){let te=~A.indexOf("?")?"&":"?",le=n?n(k):new URLSearchParams(Yh(k));A+=te+le}A=FI(e,A);let U=new Request(A,D);P={request:new Request(A,D)};let Q;try{Q=yield r(U)}catch(te){return{error:{status:(te instanceof Error||typeof DOMException<"u"&&te instanceof DOMException)&&te.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(te)},meta:P}}let J=Q.clone();P.response=J;let X,W="";try{let te;if(yield Promise.all([v(Q,N).then(le=>X=le,le=>te=le),J.text().then(le=>W=le,()=>{})]),te)throw te}catch(te){return{error:{status:"PARSING_ERROR",originalStatus:Q.status,data:W,error:String(te)},meta:P}}return M(Q,X)?{data:X,meta:P}:{error:{status:Q.status,data:X},meta:P}});return function(_x48,_x49,_x50){return _ref25.apply(this,arguments)}}());function v(_x51,_x52){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(R,h){if(typeof h=="function")return h(R);if(h==="content-type"&&(h=o(R.headers)?"json":"text"),h==="json"){let y=yield R.text();return y.length?JSON.parse(y):null}return R.text()});return _v2.apply(this,arguments)}}var Ro=class{constructor(e,t=void 0){ue(this,"value");ue(this,"meta");this.value=e,this.meta=t}};function UI(){return _UI.apply(this,arguments)}function _UI(){_UI=_asyncToGenerator(function*(e=0,t=5,r){let n=Math.min(e,t),o=~~((Math.random()+.4)*(300<<n));yield new Promise((i,a)=>{let s=setTimeout(()=>i(),o);if(r){let u=()=>{clearTimeout(s),a(new Error("Aborted"))};r.aborted?(clearTimeout(s),a(new Error("Aborted"))):r.addEventListener("abort",u,{once:!0})}})});return _UI.apply(this,arguments)}function uy(e,t){throw Object.assign(new Ro({error:e,meta:t}),{throwImmediately:!0})}function Jd(e){e.aborted&&uy({status:"CUSTOM_ERROR",error:"Aborted"})}var Xh={},VI=(e,t)=>(/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(r,n,o){let i=[5,(t||Xh).maxRetries,(o||Xh).maxRetries].filter(g=>g!==void 0),[a]=i.slice(-1),u={maxRetries:a,backoff:UI,retryCondition:(g,v,{attempt:R})=>R<=a,...t,...o},c=0;for(;;){Jd(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Ro(g);return g}catch(g){if(c++,g.throwImmediately){if(g instanceof Ro)return g.value;throw g}if(g instanceof Ro){if(!u.retryCondition(g.value.error,r,{attempt:c,baseQueryApi:n,extraOptions:o}))return g.value}else if(c>u.maxRetries)return{error:g};Jd(n.signal);try{yield u.backoff(c,u.maxRetries,n.signal)}catch(v){throw Jd(n.signal),v}}}});return function(_x53,_x54,_x55){return _ref26.apply(this,arguments)}}()),ly=Object.assign(VI,{fail:uy}),rc="__rtkq/",GI="online",BI="offline";var dy="focused";var sp=L(`${rc}${dy}`),py=L(`${rc}un${dy}`),cp=L(`${rc}${GI}`),fy=L(`${rc}${BI}`);var Xi="query",my="mutation",gy="infinitequery";function nc(e){return e.type===Xi}function $I(e){return e.type===my}function oc(e){return e.type===gy}function tc(e){return nc(e)||oc(e)}function up(e,t,r,n,o,i){let a=QI(e)?e(t,r,n,o):e;return a?rp(a,ap,s=>i(hy(s))):[]}function QI(e){return typeof e=="function"}function hy(e){return typeof e=="string"?{type:e}:e}function HI(e,t){return e.catch(t)}var Io=(e,t)=>e.endpointDefinitions[t],Ki=Symbol("forceQueryFn"),op=e=>typeof e[Ki]=="function";function zI({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:a}){let s=A=>a(A)?.runningQueries,u=A=>a(A)?.runningMutations,{unsubscribeQueryResult:c,removeMutationResult:g,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:_,buildInitiateInfiniteQuery:T,buildInitiateMutation:P,getRunningQueryThunk:R,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:b};function R(A,O){return k=>{let N=Io(i,A),M=e({queryArgs:O,endpointDefinition:N,endpointName:A});return s(k)?.get(M)}}function h(A,O){return k=>u(k)?.get(O)}function y(){return A=>Wh(s(A))}function b(){return A=>Wh(u(A))}function x(A){}function I(A,O){let k=(N,{subscribe:M=!0,forceRefetch:V,subscriptionOptions:j,[Ki]:D,...q}={})=>(U,H)=>{let Q=e({queryArgs:N,endpointDefinition:O,endpointName:A}),J,X={...q,type:Xi,subscribe:M,forceRefetch:V,subscriptionOptions:j,endpointName:A,originalArgs:N,queryCacheKey:Q,[Ki]:D};if(nc(O))J=t(X);else{let{direction:ge,initialPageParam:we,refetchCachedPages:Se}=q;J=r({...X,direction:ge,initialPageParam:we,refetchCachedPages:Se})}let W=o.endpoints[A].select(N),te=U(J),le=W(H());let{requestId:_e,abort:Ve}=te,Fe=le.requestId!==_e,Me=s(U)?.get(Q),Le=()=>W(H()),ve=Object.assign(D?te.then(Le):Fe&&!Me?Promise.resolve(le):Promise.all([Me,te]).then(Le),{arg:N,requestId:_e,subscriptionOptions:j,queryCacheKey:Q,abort:Ve,unwrap(){return _asyncToGenerator(function*(){let ge=yield ve;if(ge.isError)throw ge.error;return ge.data})()},refetch:ge=>U(k(N,{subscribe:!1,forceRefetch:!0,...ge})),unsubscribe(){M&&U(c({queryCacheKey:Q,requestId:_e}))},updateSubscriptionOptions(ge){ve.subscriptionOptions=ge,U(v({endpointName:A,requestId:_e,queryCacheKey:Q,options:ge}))}});if(!Me&&!Fe&&!D){let ge=s(U);ge.set(Q,ve),ve.then(()=>{ge.delete(Q)})}return ve};return k}function _(A,O){return I(A,O)}function T(A,O){return I(A,O)}function P(A){return(O,{track:k=!0,fixedCacheKey:N}={})=>(M,V)=>{let j=n({type:"mutation",endpointName:A,originalArgs:O,track:k,fixedCacheKey:N}),D=M(j);let{requestId:q,abort:U,unwrap:H}=D,Q=HI(D.unwrap().then(te=>({data:te})),te=>({error:te})),J=()=>{M(g({requestId:q,fixedCacheKey:N}))},X=Object.assign(Q,{arg:D.arg,requestId:q,abort:U,unwrap:H,reset:J}),W=u(M);return W.set(q,X),X.then(()=>{W.delete(q)}),N&&(W.set(N,X),X.then(()=>{W.get(N)===X&&W.delete(N)})),X}}}var yy=class extends Qh{constructor(t,r,n,o){super(t);ue(this,"value");ue(this,"schemaName");ue(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},mn=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function gn(_x56,_x57,_x58,_x59){return _gn.apply(this,arguments)}function _gn(){_gn=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new yy(o.issues,t,r,n);return o.value});return _gn.apply(this,arguments)}function Zh(e){return e}var Hi=(e={})=>({...e,[Ni]:!0});function WI({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:a,onSchemaFailure:s,catchSchemaFailure:u,skipSchemaValidation:c}){let g=(j,D,q,U)=>(H,Q)=>{let J=r[j],X=n({queryArgs:D,endpointDefinition:J,endpointName:j});if(H(o.internalActions.queryResultPatched({queryCacheKey:X,patches:q})),!U)return;let W=o.endpoints[j].select(D)(Q()),te=up(J.providesTags,W.data,void 0,D,{},i);H(o.internalActions.updateProvidedBy([{queryCacheKey:X,providedTags:te}]))};function v(j,D,q=0){let U=[D,...j];return q&&U.length>q?U.slice(0,-1):U}function R(j,D,q=0){let U=[...j,D];return q&&U.length>q?U.slice(1):U}let h=(j,D,q,U=!0)=>(H,Q)=>{let X=o.endpoints[j].select(D)(Q()),W={patches:[],inversePatches:[],undo:()=>H(o.util.patchQueryData(j,D,W.inversePatches,U))};if(X.status===hr)return W;let te;if("data"in X)if(lt(X.data)){let[le,_e,Ve]=cd(X.data,q);W.patches.push(..._e),W.inversePatches.push(...Ve),te=le}else te=q(X.data),W.patches.push({op:"replace",path:[],value:te}),W.inversePatches.push({op:"replace",path:[],value:X.data});return W.patches.length===0||H(o.util.patchQueryData(j,D,W.patches,U)),W},y=(j,D,q)=>U=>U(o.endpoints[j].initiate(D,{subscribe:!1,forceRefetch:!0,[Ki]:()=>({data:q})})),b=(j,D)=>j.query&&j[D]?j[D]:Zh,x=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(j,{signal:D,abort:q,rejectWithValue:U,fulfillWithValue:H,dispatch:Q,getState:J,extra:X}){let W=r[j.endpointName],{metaSchema:te,skipSchemaValidation:le=c}=W,_e=j.type===Xi;try{let Ve=Zh,Fe={signal:D,abort:q,dispatch:Q,getState:J,extra:X,endpoint:j.endpointName,type:j.type,forced:_e?I(j,J()):void 0,queryCacheKey:_e?j.queryCacheKey:void 0},Me=_e?j[Ki]:void 0,Le,ve=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(we,Se,He,Ye){if(Se==null&&we.pages.length)return Promise.resolve({data:we});let Lt={queryArg:j.originalArgs,pageParam:Se},xt=yield ge(Lt),Qt=Ye?v:R;return{data:{pages:Qt(we.pages,xt.data,He),pageParams:Qt(we.pageParams,Se,He)},meta:xt.meta}});return function ve(_x62,_x63,_x64,_x65){return _ref28.apply(this,arguments)}}();function ge(_x66){return _ge.apply(this,arguments)}function _ge(){_ge=_asyncToGenerator(function*(we){let Se,{extraOptions:He,argSchema:Ye,rawResponseSchema:Lt,responseSchema:xt}=W;if(Ye&&!mn(le,"arg")&&(we=yield gn(Ye,we,"argSchema",{})),Me?Se=Me():W.query?(Ve=b(W,"transformResponse"),Se=yield t(W.query(we),Fe,He)):Se=yield W.queryFn(we,Fe,He,qt=>t(qt,Fe,He)),typeof process<"u",Se.error)throw new Ro(Se.error,Se.meta);let{data:Qt}=Se;Lt&&!mn(le,"rawResponse")&&(Qt=yield gn(Lt,Se.data,"rawResponseSchema",Se.meta));let Tt=yield Ve(Qt,Se.meta,we);return xt&&!mn(le,"response")&&(Tt=yield gn(xt,Tt,"responseSchema",Se.meta)),{...Se,data:Tt}});return _ge.apply(this,arguments)}if(_e&&"infiniteQueryOptions"in W){let{infiniteQueryOptions:we}=W,{maxPages:Se=1/0}=we,He=j.refetchCachedPages??we.refetchCachedPages??!0,Ye,Lt={pages:[],pageParams:[]},xt=a.selectQueryEntry(J(),j.queryCacheKey)?.data,Tt=I(j,J())&&!j.direction||!xt?Lt:xt;if("direction"in j&&j.direction&&Tt.pages.length){let qt=j.direction==="backward",_a=(qt?vy:ip)(we,Tt,j.originalArgs);Ye=yield ve(Tt,_a,Se,qt)}else{let{initialPageParam:qt=we.initialPageParam}=j,si=xt?.pageParams??[],_a=si[0]??qt,hw=si.length;if(Ye=yield ve(Tt,_a,Se),Me&&(Ye={data:Ye.data.pages[0]}),He)for(let Qf=1;Qf<hw;Qf++){let yw=ip(we,Ye.data,j.originalArgs);Ye=yield ve(Ye.data,yw,Se)}}Le=Ye}else Le=yield ge(j.originalArgs);return te&&!mn(le,"meta")&&Le.meta&&(Le.meta=yield gn(te,Le.meta,"metaSchema",Le.meta)),H(Le.data,Hi({fulfilledTimeStamp:Date.now(),baseQueryMeta:Le.meta}))}catch(Ve){let Fe=Ve;if(Fe instanceof Ro){let Me=b(W,"transformErrorResponse"),{rawErrorResponseSchema:Le,errorResponseSchema:ve}=W,{value:ge,meta:we}=Fe;try{Le&&!mn(le,"rawErrorResponse")&&(ge=yield gn(Le,ge,"rawErrorResponseSchema",we)),te&&!mn(le,"meta")&&(we=yield gn(te,we,"metaSchema",we));let Se=yield Me(ge,we,j.originalArgs);return ve&&!mn(le,"errorResponse")&&(Se=yield gn(ve,Se,"errorResponseSchema",we)),U(Se,Hi({baseQueryMeta:we}))}catch(Se){Fe=Se}}try{if(Fe instanceof yy){let Me={endpoint:j.endpointName,arg:j.originalArgs,type:j.type,queryCacheKey:_e?j.queryCacheKey:void 0};W.onSchemaFailure?.(Fe,Me),s?.(Fe,Me);let{catchSchemaFailure:Le=u}=W;if(Le)return U(Le(Fe,Me),Hi({baseQueryMeta:Fe._bqMeta}))}}catch(Me){Fe=Me}throw typeof process<"u",console.error(Fe),Fe}});return function x(_x60,_x61){return _ref27.apply(this,arguments)}}();function I(j,D){let q=a.selectQueryEntry(D,j.queryCacheKey),U=a.selectConfig(D).refetchOnMountOrArgChange,H=q?.fulfilledTimeStamp,Q=j.forceRefetch??(j.subscribe&&U);return Q?Q===!0||(Number(new Date)-Number(H))/1e3>=Q:!1}let _=()=>ke(`${e}/executeQuery`,x,{getPendingMeta({arg:D}){let q=r[D.endpointName];return Hi({startedTimeStamp:Date.now(),...(oc(q)?{direction:D.direction}:{})})},condition(D,{getState:q}){let U=q(),H=a.selectQueryEntry(U,D.queryCacheKey),Q=H?.fulfilledTimeStamp,J=D.originalArgs,X=H?.originalArgs,W=r[D.endpointName],te=D.direction;return op(D)?!0:H?.status==="pending"?!1:I(D,U)||nc(W)&&W?.forceRefetch?.({currentArg:J,previousArg:X,endpointState:H,state:U})?!0:!(Q&&!te)},dispatchConditionRejection:!0}),T=_(),P=_(),A=ke(`${e}/executeMutation`,x,{getPendingMeta(){return Hi({startedTimeStamp:Date.now()})}}),O=j=>"force"in j,k=j=>"ifOlderThan"in j,N=(j,D,q={})=>(U,H)=>{let Q=O(q)&&q.force,J=k(q)&&q.ifOlderThan,X=(te=!0)=>{let le={forceRefetch:te,subscribe:!1};return o.endpoints[j].initiate(D,le)},W=o.endpoints[j].select(D)(H());if(Q)U(X());else if(J){let te=W?.fulfilledTimeStamp;if(!te){U(X());return}(Number(new Date)-Number(new Date(te)))/1e3>=J&&U(X())}else U(X(!1))};function M(j){return D=>D?.meta?.arg?.endpointName===j}function V(j,D){return{matchPending:oo(ds(j),M(D)),matchFulfilled:oo(lr(j),M(D)),matchRejected:oo(ln(j),M(D))}}return{queryThunk:T,mutationThunk:A,infiniteQueryThunk:P,prefetch:N,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:V}}function ip(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function vy(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function Sy(e,t,r,n){return up(r[e.meta.arg.endpointName][t],lr(e)?e.payload:void 0,Di(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function Jh(e){return mt(e)?ns(e):e}function Zs(e,t,r){let n=e[t];n&&r(n)}function Yi(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function ey(e,t,r){let n=e[Yi(t)];n&&r(n)}var Js={};function KI({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:a,hasRehydrationInfo:s},assertTagType:u,config:c}){let g=L(`${e}/resetApiState`);function v(M,V,j,D){var q;M[q=V.queryCacheKey]??(M[q]={status:hr,endpointName:V.endpointName}),Zs(M,V.queryCacheKey,U=>{U.status=tp,U.requestId=j&&U.requestId?U.requestId:D.requestId,V.originalArgs!==void 0&&(U.originalArgs=V.originalArgs),U.startedTimeStamp=D.startedTimeStamp;let H=o[D.arg.endpointName];oc(H)&&"direction"in V&&(U.direction=V.direction)})}function R(M,V,j,D){Zs(M,V.arg.queryCacheKey,q=>{if(q.requestId!==V.requestId&&!D)return;let{merge:U}=o[V.arg.endpointName];if(q.status=zi,U){if(q.data!==void 0){let{fulfilledTimeStamp:H,arg:Q,baseQueryMeta:J,requestId:X}=V,W=cn(q.data,te=>U(te,j,{arg:Q.originalArgs,baseQueryMeta:J,fulfilledTimeStamp:H,requestId:X}));q.data=W}else q.data=j;}else q.data=o[V.arg.endpointName].structuralSharing??!0?sy(mt(q.data)?Gm(q.data):q.data,j):j;delete q.error,q.fulfilledTimeStamp=V.fulfilledTimeStamp})}let h=dn({name:`${e}/queries`,initialState:Js,reducers:{removeQueryResult:{reducer(M,{payload:{queryCacheKey:V}}){delete M[V]},prepare:io()},cacheEntriesUpserted:{reducer(M,V){for(let j of V.payload){let{queryDescription:D,value:q}=j;v(M,D,!0,{arg:D,requestId:V.meta.requestId,startedTimeStamp:V.meta.timestamp}),R(M,{arg:D,requestId:V.meta.requestId,fulfilledTimeStamp:V.meta.timestamp,baseQueryMeta:{}},q,!0)}},prepare:M=>({payload:M.map(D=>{let{endpointName:q,arg:U,value:H}=D,Q=o[q];return{queryDescription:{type:Xi,endpointName:q,originalArgs:D.arg,queryCacheKey:n({queryArgs:U,endpointDefinition:Q,endpointName:q})},value:H}}),meta:{[Ni]:!0,requestId:Mi(),timestamp:Date.now()}})},queryResultPatched:{reducer(M,{payload:{queryCacheKey:V,patches:j}}){Zs(M,V,D=>{D.data=ud(D.data,j.concat())})},prepare:io()}},extraReducers(M){M.addCase(t.pending,(V,{meta:j,meta:{arg:D}})=>{let q=op(D);v(V,D,q,j)}).addCase(t.fulfilled,(V,{meta:j,payload:D})=>{let q=op(j.arg);R(V,j,D,q)}).addCase(t.rejected,(V,{meta:{condition:j,arg:D,requestId:q},error:U,payload:H})=>{Zs(V,D.queryCacheKey,Q=>{if(!j){if(Q.requestId!==q)return;Q.status=Wi,Q.error=H??U}})}).addMatcher(s,(V,j)=>{let{queries:D}=a(j);for(let[q,U]of Object.entries(D))(U?.status===zi||U?.status===Wi)&&(V[q]=U)})}}),y=dn({name:`${e}/mutations`,initialState:Js,reducers:{removeMutationResult:{reducer(M,{payload:V}){let j=Yi(V);j in M&&delete M[j]},prepare:io()}},extraReducers(M){M.addCase(r.pending,(V,{meta:j,meta:{requestId:D,arg:q,startedTimeStamp:U}})=>{q.track&&(V[Yi(j)]={requestId:D,status:tp,endpointName:q.endpointName,startedTimeStamp:U})}).addCase(r.fulfilled,(V,{payload:j,meta:D})=>{D.arg.track&&ey(V,D,q=>{q.requestId===D.requestId&&(q.status=zi,q.data=j,q.fulfilledTimeStamp=D.fulfilledTimeStamp)})}).addCase(r.rejected,(V,{payload:j,error:D,meta:q})=>{q.arg.track&&ey(V,q,U=>{U.requestId===q.requestId&&(U.status=Wi,U.error=j??D)})}).addMatcher(s,(V,j)=>{let{mutations:D}=a(j);for(let[q,U]of Object.entries(D))(U?.status===zi||U?.status===Wi)&&q!==U?.requestId&&(V[q]=U)})}}),b={tags:{},keys:{}},x=dn({name:`${e}/invalidation`,initialState:b,reducers:{updateProvidedBy:{reducer(M,V){var j,D,q;for(let{queryCacheKey:U,providedTags:H}of V.payload){I(M,U);for(let{type:Q,id:J}of H){let X=(D=(j=M.tags)[Q]??(j[Q]={}))[q=J||"__internal_without_id"]??(D[q]=[]);X.includes(U)||X.push(U)}M.keys[U]=H}},prepare:io()}},extraReducers(M){M.addCase(h.actions.removeQueryResult,(V,{payload:{queryCacheKey:j}})=>{I(V,j)}).addMatcher(s,(V,j)=>{var q,U,H;let{provided:D}=a(j);for(let[Q,J]of Object.entries(D.tags??{}))for(let[X,W]of Object.entries(J)){let te=(U=(q=V.tags)[Q]??(q[Q]={}))[H=X||"__internal_without_id"]??(U[H]=[]);for(let le of W)te.includes(le)||te.push(le),V.keys[le]=D.keys[le]}}).addMatcher(Kt(lr(t),Di(t)),(V,j)=>{_(V,[j])}).addMatcher(h.actions.cacheEntriesUpserted.match,(V,j)=>{let D=j.payload.map(({queryDescription:q,value:U})=>({type:"UNKNOWN",payload:U,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:q}}));_(V,D)})}});function I(M,V){let j=Jh(M.keys[V]??[]);for(let D of j){let q=D.type,U=D.id??"__internal_without_id",H=M.tags[q]?.[U];H&&(M.tags[q][U]=Jh(H).filter(Q=>Q!==V))}delete M.keys[V]}function _(M,V){let j=V.map(D=>{let q=Sy(D,"providesTags",o,u),{queryCacheKey:U}=D.meta.arg;return{queryCacheKey:U,providedTags:q}});x.caseReducers.updateProvidedBy(M,x.actions.updateProvidedBy(j))}let T=dn({name:`${e}/subscriptions`,initialState:Js,reducers:{updateSubscriptionOptions(M,V){},unsubscribeQueryResult(M,V){},internal_getRTKQSubscriptions(){}}}),P=dn({name:`${e}/internalSubscriptions`,initialState:Js,reducers:{subscriptionsUpdated:{reducer(M,V){return ud(M,V.payload)},prepare:io()}}}),A=dn({name:`${e}/config`,initialState:{online:OI(),focused:kI(),middlewareRegistered:!1,...c},reducers:{middlewareRegistered(M,{payload:V}){M.middlewareRegistered=M.middlewareRegistered==="conflict"||i!==V?"conflict":!0}},extraReducers:M=>{M.addCase(cp,V=>{V.online=!0}).addCase(fy,V=>{V.online=!1}).addCase(sp,V=>{V.focused=!0}).addCase(py,V=>{V.focused=!1}).addMatcher(s,V=>({...V}))}}),O=Jn({queries:h.reducer,mutations:y.reducer,provided:x.reducer,subscriptions:P.reducer,config:A.reducer}),k=(M,V)=>O(g.match(V)?void 0:M,V),N={...A.actions,...h.actions,...T.actions,...P.actions,...y.actions,...x.actions,resetApiState:g};return{reducer:k,actions:N}}var ep=Symbol.for("RTKQ/skipToken"),by={status:hr},ty=cn(by,()=>{}),ry=cn(by,()=>{});function YI({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=T=>ty,o=T=>ry;return{buildQuerySelector:R,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:b,selectCachedArgsForQuery:x,selectApiState:a,selectQueries:s,selectMutations:c,selectQueryEntry:u,selectConfig:g};function i(T){return{...T,...Hh(T.status)}}function a(T){return T[t]}function s(T){return a(T)?.queries}function u(T,P){return s(T)?.[P]}function c(T){return a(T)?.mutations}function g(T){return a(T)?.config}function v(T,P,A){return O=>{if(O===ep)return r(n,A);let k=e({queryArgs:O,endpointDefinition:P,endpointName:T});return r(M=>u(M,k)??ty,A)}}function R(T,P){return v(T,P,i)}function h(T,P){let{infiniteQueryOptions:A}=P;function O(k){let N={...k,...Hh(k.status)},{isLoading:M,isError:V,direction:j}=N,D=j==="forward",q=j==="backward";return{...N,hasNextPage:I(A,N.data,N.originalArgs),hasPreviousPage:_(A,N.data,N.originalArgs),isFetchingNextPage:M&&D,isFetchingPreviousPage:M&&q,isFetchNextPageError:V&&D,isFetchPreviousPageError:V&&q}}return v(T,P,O)}function y(){return T=>{let P;return typeof T=="object"?P=Yi(T)??ep:P=T,r(P===ep?o:k=>a(k)?.mutations?.[P]??ry,i)}}function b(T,P){let A=T[t],O=new Set,k=rp(P,ap,hy);for(let N of k){let M=A.provided.tags[N.type];if(!M)continue;let V=(N.id!==void 0?M[N.id]:Object.values(M).flat())??[];for(let j of V)O.add(j)}return Array.from(O.values()).flatMap(N=>{let M=A.queries[N];return M?{queryCacheKey:N,endpointName:M.endpointName,originalArgs:M.originalArgs}:[]})}function x(T,P){return rp(Object.values(s(T)),A=>A?.endpointName===P&&A.status!==hr,A=>A.originalArgs)}function I(T,P,A){return P?ip(T,P,A)!=null:!1}function _(T,P,A){return!P||!T.getPreviousPageParam?!1:vy(T,P,A)!=null}}var ny=WeakMap?new WeakMap:void 0,oy=({endpointName:e,queryArgs:t})=>{let r="",n=ny?.get(t);if(typeof n=="string")r=n;else{let o=JSON.stringify(t,(i,a)=>(a=typeof a=="bigint"?{$bigint:a.toString()}:a,a=Wt(a)?Object.keys(a).sort().reduce((s,u)=>(s[u]=a[u],s),{}):a,a));Wt(t)&&ny?.set(t,o),r=o}return`${e}(${r})`};function XI(...e){return function(r){let n=ro(c=>r.extractRehydrationInfo?.(c,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(c){let g=oy;if("serializeQueryArgs"in c.endpointDefinition){let v=c.endpointDefinition.serializeQueryArgs;g=R=>{let h=v(R);return typeof h=="string"?h:oy({...R,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(c)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(c){c()},apiUid:Mi(),extractRehydrationInfo:n,hasRehydrationInfo:ro(c=>n(c)!=null)},a={injectEndpoints:u,enhanceEndpoints({addTagTypes:c,endpoints:g}){if(c)for(let v of c)o.tagTypes.includes(v)||o.tagTypes.push(v);if(g)for(let[v,R]of Object.entries(g))typeof R=="function"?R(Io(i,v)):Object.assign(Io(i,v)||{},R);return a}},s=e.map(c=>c.init(a,o,i));function u(c){let g=c.endpoints({query:v=>({...v,type:Xi}),mutation:v=>({...v,type:my}),infiniteQuery:v=>({...v,type:gy})});for(let[v,R]of Object.entries(g)){if(c.overrideExisting!==!0&&v in i.endpointDefinitions){if(c.overrideExisting==="throw")throw new Error(gt(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[v]=R;for(let h of s)h.injectEndpoint(v,R)}return a}return a.injectEndpoints({endpoints:r.endpoints})}}function gr(e,...t){return Object.assign(e,...t)}var ZI=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,i=null,a=null,{updateSubscriptionOptions:s,unsubscribeQueryResult:u}=e.internalActions,c=(b,x)=>{if(s.match(x)){let{queryCacheKey:_,requestId:T,options:P}=x.payload,A=b.get(_);return A?.has(T)&&A.set(T,P),!0}if(u.match(x)){let{queryCacheKey:_,requestId:T}=x.payload,P=b.get(_);return P&&P.delete(T),!0}if(e.internalActions.removeQueryResult.match(x))return b.delete(x.payload.queryCacheKey),!0;if(t.pending.match(x)){let{meta:{arg:_,requestId:T}}=x,P=ec(b,_.queryCacheKey,np);return _.subscribe&&P.set(T,_.subscriptionOptions??P.get(T)??{}),!0}let I=!1;if(t.rejected.match(x)){let{meta:{condition:_,arg:T,requestId:P}}=x;if(_&&T.subscribe){let A=ec(b,T.queryCacheKey,np);A.set(P,T.subscriptionOptions??A.get(P)??{}),I=!0}}return I},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:b=>g().get(b)?.size??0,isRequestSubscribed:(b,x)=>!!g()?.get(b)?.get(x)};function y(b){return JSON.parse(JSON.stringify(Object.fromEntries([...b].map(([x,I])=>[x,Object.fromEntries(I)]))))}return(b,x)=>{if(i||(i=y(r.currentSubscriptions)),e.util.resetApiState.match(b))return i={},r.currentSubscriptions.clear(),a=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(b))return[!1,h];let I=c(r.currentSubscriptions,b),_=!0;if(I){a||(a=setTimeout(()=>{let A=y(r.currentSubscriptions),[,O]=cd(i,()=>A);x.next(e.internalActions.subscriptionsUpdated(O)),i=A,a=null},500));let T=typeof b.type=="string"&&!!b.type.startsWith(o),P=t.rejected.match(b)&&b.meta.condition&&!!b.meta.arg.subscribe;_=!T&&!P}return[_,!1]}},JI=2147483647/1e3-1,eT=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:a},getRunningQueryThunk:s,mwApi:u})=>{let{removeQueryResult:c,unsubscribeQueryResult:g,cacheEntriesUpserted:v}=t.internalActions,R=Kt(g.match,r.fulfilled,r.rejected,v.match);function h(T){let P=o.currentSubscriptions.get(T);return P?P.size>0:!1}let y={};function b(T){for(let P of T.values())P?.abort?.()}let x=(T,P)=>{let A=P.getState(),O=a(A);if(R(T)){let k;if(v.match(T))k=T.payload.map(N=>N.queryDescription.queryCacheKey);else{let{queryCacheKey:N}=g.match(T)?T.payload:T.meta.arg;k=[N]}I(k,P,O)}if(t.util.resetApiState.match(T)){for(let[k,N]of Object.entries(y))N&&clearTimeout(N),delete y[k];b(o.runningQueries),b(o.runningMutations)}if(n.hasRehydrationInfo(T)){let{queries:k}=n.extractRehydrationInfo(T);I(Object.keys(k),P,O)}};function I(T,P,A){let O=P.getState();for(let k of T){let N=i(O,k);N?.endpointName&&_(k,N.endpointName,P,A)}}function _(T,P,A,O){let N=Io(n,P)?.keepUnusedDataFor??O.keepUnusedDataFor;if(N===1/0)return;let M=Math.max(0,Math.min(N,JI));if(!h(T)){let V=y[T];V&&clearTimeout(V),y[T]=setTimeout(()=>{if(!h(T)){let j=i(A.getState(),T);j?.endpointName&&A.dispatch(s(j.endpointName,j.originalArgs))?.abort(),A.dispatch(c({queryCacheKey:T}))}delete y[T]},M*1e3)}}return x},iy=new Error("Promise never resolved before cacheEntryRemoved."),tT=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:a,selectApiState:s}})=>{let u=ps(n),c=ps(o),g=lr(n,o),v={},{removeQueryResult:R,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function b(A,O,k){let N=v[A];N?.valueResolved&&(N.valueResolved({data:O,meta:k}),delete N.valueResolved)}function x(A){let O=v[A];O&&(delete v[A],O.cacheEntryRemoved())}function I(A){let{arg:O,requestId:k}=A.meta,{endpointName:N,originalArgs:M}=O;return[N,M,k]}let _=(A,O,k)=>{let N=T(A);function M(V,j,D,q){let U=a(k,j),H=a(O.getState(),j);!U&&H&&P(V,q,j,O,D)}if(n.pending.match(A)){let[V,j,D]=I(A);M(V,N,D,j)}else if(y.match(A))for(let{queryDescription:V,value:j}of A.payload){let{endpointName:D,originalArgs:q,queryCacheKey:U}=V;M(D,U,A.meta.requestId,q),b(U,j,{})}else if(o.pending.match(A)){if(O.getState()[t].mutations[N]){let[j,D,q]=I(A);P(j,D,N,O,q)}}else if(g(A))b(N,A.payload,A.meta.baseQueryMeta);else if(R.match(A)||h.match(A))x(N);else if(e.util.resetApiState.match(A))for(let V of Object.keys(v))x(V)};function T(A){return u(A)?A.meta.arg.queryCacheKey:c(A)?A.meta.arg.fixedCacheKey??A.meta.requestId:R.match(A)?A.payload.queryCacheKey:h.match(A)?Yi(A.payload):""}function P(A,O,k,N,M){let V=Io(r,A),j=V?.onCacheEntryAdded;if(!j)return;let D={},q=new Promise(W=>{D.cacheEntryRemoved=W}),U=Promise.race([new Promise(W=>{D.valueResolved=W}),q.then(()=>{throw iy})]);U.catch(()=>{}),v[k]=D;let H=e.endpoints[A].select(tc(V)?O:k),Q=N.dispatch((W,te,le)=>le),J={...N,getCacheEntry:()=>H(N.getState()),requestId:M,extra:Q,updateCachedData:tc(V)?W=>N.dispatch(e.util.updateQueryData(A,O,W)):void 0,cacheDataLoaded:U,cacheEntryRemoved:q},X=j(O,J);Promise.resolve(X).catch(W=>{if(W!==iy)throw W})}return _},rT=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},nT=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:a,refetchQuery:s,internalState:u})=>{let{removeQueryResult:c}=i.internalActions,g=Kt(lr(n),Di(n)),v=Kt(lr(o,n),ln(o,n)),R=[],h=0,y=(I,_)=>{(o.pending.match(I)||n.pending.match(I))&&h++,v(I)&&(h=Math.max(0,h-1)),g(I)?x(Sy(I,"invalidatesTags",r,a),_):v(I)?x([],_):i.util.invalidateTags.match(I)&&x(up(I.payload,void 0,void 0,void 0,void 0,a),_)};function b(){return h>0}function x(I,_){let T=_.getState(),P=T[e];if(R.push(...I),P.config.invalidationBehavior==="delayed"&&b())return;let A=R;if(R=[],A.length===0)return;let O=i.util.selectInvalidatedBy(T,A);t.batch(()=>{let k=Array.from(O.values());for(let{queryCacheKey:N}of k){let M=P.queries[N],V=ec(u.currentSubscriptions,N,np);M&&(V.size===0?_.dispatch(c({queryCacheKey:N})):M.status!==hr&&_.dispatch(s(M)))}})}return y},oT=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:a}=o,s=new Set,u=null,c=(x,I)=>{(r.internalActions.updateSubscriptionOptions.match(x)||r.internalActions.unsubscribeQueryResult.match(x))&&g(x.payload.queryCacheKey,I),(t.pending.match(x)||t.rejected.match(x)&&x.meta.condition)&&g(x.meta.arg.queryCacheKey,I),(t.fulfilled.match(x)||t.rejected.match(x)&&!x.meta.condition)&&v(x.meta.arg,I),r.util.resetApiState.match(x)&&(y(),u&&(clearTimeout(u),u=null),s.clear())};function g(x,I){s.add(x),u||(u=setTimeout(()=>{for(let _ of s)R({queryCacheKey:_},I);s.clear(),u=null},0))}function v({queryCacheKey:x},I){let _=I.getState()[e],T=_.queries[x],P=a.get(x);if(!T||T.status===hr)return;let{lowestPollingInterval:A,skipPollingIfUnfocused:O}=b(P);if(!Number.isFinite(A))return;let k=i.get(x);k?.timeout&&(clearTimeout(k.timeout),k.timeout=void 0);let N=Date.now()+A;i.set(x,{nextPollTimestamp:N,pollingInterval:A,timeout:setTimeout(()=>{(_.config.focused||!O)&&I.dispatch(n(T)),v({queryCacheKey:x},I)},A)})}function R({queryCacheKey:x},I){let T=I.getState()[e].queries[x],P=a.get(x);if(!T||T.status===hr)return;let{lowestPollingInterval:A}=b(P);if(!Number.isFinite(A)){h(x);return}let O=i.get(x),k=Date.now()+A;(!O||k<O.nextPollTimestamp)&&v({queryCacheKey:x},I)}function h(x){let I=i.get(x);I?.timeout&&clearTimeout(I.timeout),i.delete(x)}function y(){for(let x of i.keys())h(x)}function b(x=new Map){let I=!1,_=Number.POSITIVE_INFINITY;for(let T of x.values())T.pollingInterval&&(_=Math.min(T.pollingInterval,_),I=T.skipPollingIfUnfocused||I);return{lowestPollingInterval:_,skipPollingIfUnfocused:I}}return c},iT=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=ds(r,n),i=ln(r,n),a=lr(r,n),s={};return(c,g)=>{if(o(c)){let{requestId:v,arg:{endpointName:R,originalArgs:h}}=c.meta,y=Io(t,R),b=y?.onQueryStarted;if(b){let x={},I=new Promise((A,O)=>{x.resolve=A,x.reject=O});I.catch(()=>{}),s[v]=x;let _=e.endpoints[R].select(tc(y)?h:v),T=g.dispatch((A,O,k)=>k),P={...g,getCacheEntry:()=>_(g.getState()),requestId:v,extra:T,updateCachedData:tc(y)?A=>g.dispatch(e.util.updateQueryData(R,h,A)):void 0,queryFulfilled:I};b(h,P)}}else if(a(c)){let{requestId:v,baseQueryMeta:R}=c.meta;s[v]?.resolve({data:c.payload,meta:R}),delete s[v]}else if(i(c)){let{requestId:v,rejectedWithValue:R,baseQueryMeta:h}=c.meta;s[v]?.reject({error:c.payload??c.error,isUnhandledError:!R,meta:h}),delete s[v]}}},aT=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,a=(u,c)=>{sp.match(u)&&s(c,"refetchOnFocus"),cp.match(u)&&s(c,"refetchOnReconnect")};function s(u,c){let g=u.getState()[e],v=g.queries,R=o.currentSubscriptions;t.batch(()=>{for(let h of R.keys()){let y=v[h],b=R.get(h);if(!b||!y)continue;let x=[...b.values()];(x.some(_=>_[c]===!0)||x.every(_=>_[c]===void 0)&&g.config[c])&&(b.size===0?u.dispatch(i({queryCacheKey:h})):y.status!==hr&&u.dispatch(n(y)))}})}return a};function sT(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:a}=o,s={invalidateTags:L(`${t}/invalidateTags`)},u=R=>R.type.startsWith(`${t}/`),c=[rT,eT,nT,oT,tT,iT];return{middleware:R=>{let h=!1,y=i(R.dispatch),b={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:u,mwApi:R},x=c.map(T=>T(b)),I=ZI(b),_=aT(b);return T=>P=>{if(!Si(P))return T(P);h||(h=!0,R.dispatch(n.internalActions.middlewareRegistered(a)));let A={...R,next:T},O=R.getState(),[k,N]=I(P,A,O),M;if(k?M=T(P):M=N,R.getState()[t]&&(_(P,A,O),u(P)||o.hasRehydrationInfo(P)))for(let V of x)V(P,A,O);return M}},actions:s};function v(R){return e.api.endpoints[R.endpointName].initiate(R.originalArgs,{subscribe:!1,forceRefetch:!0})}}var ay=Symbol(),cT=({createSelector:e=ze}={})=>({name:ay,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:a,refetchOnMountOrArgChange:s,refetchOnFocus:u,refetchOnReconnect:c,invalidationBehavior:g,onSchemaFailure:v,catchSchemaFailure:R,skipSchemaValidation:h},y){Km();let b=ve=>(typeof process<"u",ve);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:cp,onOffline:fy,onFocus:sp,onFocusLost:py},util:{}});let x=YI({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:_,buildQuerySelector:T,buildInfiniteQuerySelector:P,buildMutationSelector:A}=x;gr(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:_});let{queryThunk:O,infiniteQueryThunk:k,mutationThunk:N,patchQueryData:M,updateQueryData:V,upsertQueryData:j,prefetch:D,buildMatchThunkActions:q}=WI({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:b,selectors:x,onSchemaFailure:v,catchSchemaFailure:R,skipSchemaValidation:h}),{reducer:U,actions:H}=KI({context:y,queryThunk:O,infiniteQueryThunk:k,mutationThunk:N,serializeQueryArgs:i,reducerPath:o,assertTagType:b,config:{refetchOnFocus:u,refetchOnReconnect:c,refetchOnMountOrArgChange:s,keepUnusedDataFor:a,reducerPath:o,invalidationBehavior:g}});gr(t.util,{patchQueryData:M,updateQueryData:V,upsertQueryData:j,prefetch:D,resetApiState:H.resetApiState,upsertQueryEntries:H.cacheEntriesUpserted}),gr(t.internalActions,H);let Q=new WeakMap,J=ve=>ec(Q,ve,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:X,buildInitiateInfiniteQuery:W,buildInitiateMutation:te,getRunningMutationThunk:le,getRunningMutationsThunk:_e,getRunningQueriesThunk:Ve,getRunningQueryThunk:Fe}=zI({queryThunk:O,mutationThunk:N,infiniteQueryThunk:k,api:t,serializeQueryArgs:i,context:y,getInternalState:J});gr(t.util,{getRunningMutationThunk:le,getRunningMutationsThunk:_e,getRunningQueryThunk:Fe,getRunningQueriesThunk:Ve});let{middleware:Me,actions:Le}=sT({reducerPath:o,context:y,queryThunk:O,mutationThunk:N,infiniteQueryThunk:k,api:t,assertTagType:b,selectors:x,getRunningQueryThunk:Fe,getInternalState:J});return gr(t.util,Le),gr(t,{reducer:U,middleware:Me}),{name:ay,injectEndpoint(ve,ge){var He;let Se=(He=t.endpoints)[ve]??(He[ve]={});nc(ge)&&gr(Se,{name:ve,select:T(ve,ge),initiate:X(ve,ge)},q(O,ve)),$I(ge)&&gr(Se,{name:ve,select:A(),initiate:te(ve)},q(N,ve)),oc(ge)&&gr(Se,{name:ve,select:P(ve,ge),initiate:W(ve,ge)},q(O,ve))}}}}),Ay=XI(cT());m();d();f();p();m();d();f();p();var hn=e=>e.query,wy=e=>e.query?.enableQuerySyntax;var a$=ze(e=>hn(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,r,n,o)=>({q:e,requestId:t,cannotAnswer:r,analyticsMode:n,actionCause:o})),uT=ze(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();var ic=e=>{if(e==="yes")return!0;if(e==="no")return!1},lT=()=>De("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function dT(e,t){return De({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??je(n),i=So(n,e);if(!o||!i)return null;let a=Or(n);return r.makeGeneratedAnswerCitationClick(Lh(i,n),{generativeQuestionAnsweringId:o,citationId:i.id,documentId:Uh(i),...(a&&{conversationId:a})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=So(r,e);return{answerId:t??je(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function pT(e,t,r){return De({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let i=r??je(o),a=So(o,e);if(!i||!a)return null;let s=Or(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:i,permanentId:a.permanentid,citationId:a.id,citationHoverTimeMs:t,...(s&&{conversationId:s})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=So(n,e);return{answerId:r??je(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function fT(e,t){return De({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function mT(e){return De({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=Or(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"like"})})}function gT(e){return De({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=Or(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"dislike"})})}var hT=e=>De({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=je(r);return n?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=je(t),{helpful:n,readable:o,documented:i,hallucinationFree:a,correctTopic:s,documentUrl:u,details:c}=e;return{answerId:r??"",helpful:n,details:{readable:ic(o),documented:ic(i),correctTopic:ic(s),hallucinationFree:ic(a)},additionalNotes:c,correctAnswerUrl:u}}}),lp=(e,t,r)=>De({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let i=t??je(o);if(!i)return null;let a=Or(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:r,...(a&&{conversationId:a})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??je(n)??"",answerGenerated:e??!1})}),To=e=>De({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),yT=()=>De({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"show"})}),vT=()=>De({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"hide"})}),ST=()=>De({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"expand"})}),bT=()=>De({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"collapse"})});function AT(e){return De({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=Or(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"copyToClipboard"})})}function wT(e,t){return De({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=So(n,e);if(!o)return null;let i=Or(n);return i?r.makeGeneratedAnswerFollowupOpenSource({...qh(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:i}):null}})}var ac={logCopyGeneratedAnswer:AT,logGeneratedAnswerHideAnswers:vT,logGeneratedAnswerShowAnswers:yT,logGeneratedAnswerStreamEnd:lp,logGeneratedAnswerFeedback:hT,logDislikeGeneratedAnswer:gT,logLikeGeneratedAnswer:mT,logGeneratedAnswerOpenInlineLink:fT,logHoverCitation:pT,logOpenGeneratedAnswerSource:dT,logOpenGeneratedAnswerFollowUpSource:wT,logRetryGeneratedAnswer:lT,logGeneratedAnswerExpand:ST,logGeneratedAnswerCollapse:bT};m();d();f();p();m();d();f();p();var xy=ze(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:o}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(o&&{lq:o})}});m();d();f();p();var Zi=(e,t,r)=>({analytics:{clientId:t.clientId,clientTimestamp:new Date().toISOString(),documentReferrer:t.referrer,documentLocation:t.location,originContext:e.originContext,...(r&&{actionCause:r.actionCause}),...(r&&{customData:r.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.deviceId&&{deviceId:e.deviceId}),...(e.trackingId&&{trackingId:e.trackingId}),capture:t.capture??t.clientId!=="",source:mo(e)}});m();d();f();p();var dp=e=>e.context;m();d();f();p();var pp=e=>e.pipeline;m();d();f();p();m();d();f();p();var Ji=jt(sc(),1),_y=jt(Cy(),1);m();d();f();p();var cc=jt(sc(),1),Ry=jt(Ey(),1);cc.default.extend(Ry.default);var Iy="YYYY/MM/DD@HH:mm:ss",xT="1401-01-01";function _o(e,t){let r=(0,cc.default)(e,t);return!r.isValid()&&!t?(0,cc.default)(e,Iy):r}function uc(e){return e.format(Iy)}function Ty(e,t){let r=_o(e,t);if(!r.isValid()){let n=". Please provide a date format string in the configuration options. See https://day.js.org/docs/en/parse/string-format for more information.",o=` with the format "${t}"`;throw new Error(`Could not parse the provided date "${e}"${t?o:n}`)}Sp(r)}function Sp(e){if(e.isBefore(xT))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}Ji.default.extend(_y.default);var ky=["past","now","next"],Oy=["minute","hour","day","week","month","quarter","year"],CT=e=>{let t=e==="now";return{amount:new oe({required:!t,min:1}),unit:new z({required:!t,constrainTo:Oy}),period:new z({required:!0,constrainTo:ky})}};function bp(e){if(typeof e=="string"&&!Fr(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?My(e):e;new yt(CT(t.period)).validate(t);let r=Ny(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);Sp(r)}function Py(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function Ny(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Ji.default)().subtract(r,n);case"next":return(0,Ji.default)().add(r,n);case"now":return(0,Ji.default)()}}function ea(e){return uc(Ny(My(e)))}function Fy(e){return e.toLocaleLowerCase().split("-")}function Fr(e){let[t,r,n]=Fy(e);if(t==="now")return!0;if(!ky.includes(t)||!Oy.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function Dy(e){return!!e&&typeof e=="object"&&"period"in e}function My(e){let[t,r,n]=Fy(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function Ly(e){return e.type==="dateRange"}function qy(e){return`start${e}`}function jy(e){return`end${e}`}var Ap=()=>({dateFacetValueMap:{}});function ET(e,t,r){let n=e.start,o=e.end;return Fr(n)&&(n=ea(n),r.dateFacetValueMap[t][qy(n)]=e.start),Fr(o)&&(o=ea(o),r.dateFacetValueMap[t][jy(o)]=e.end),{...e,start:n,end:o}}function wp(e,t){if(Ly(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>ET(o,r,t))}}return e}function Dr(e){let t=Ap();return{request:{...e,facets:e.facets?.map(n=>wp(n,t))},mappings:t}}function RT(e,t,r){return{...e,start:r.dateFacetValueMap[t][qy(e.start)]||e.start,end:r.dateFacetValueMap[t][jy(e.end)]||e.end}}function IT(e,t){return e.facetId in t.dateFacetValueMap}function TT(e,t){return IT(e,t)?{...e,values:e.values.map(r=>RT(r,e.facetId,t))}:e}function lc(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>TT(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function Mr(e){return Object.values(e).map(t=>t.request)}function xp(e,t){let r={};e.forEach(i=>{r[i.facetId]=i});let n=[];t.forEach(i=>{i in r&&(n.push(r[i]),delete r[i])});let o=Object.values(r);return[...n,...o]}function Uy(e){return Mr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Cp={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function _T(e){return Mr(e).map(t=>{let r=Cp[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function kT(e){return[..._T(e.facetSet??{}),...Uy(e.numericFacetSet??{}),...Uy(e.dateFacetSet??{}),...Mr(e.categoryFacetSet??{})]}function OT(e){return kT(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function dc(e){return xp(OT(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();var Lr=/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??xr(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,...(e.configuration.analytics.enabled&&{actionsHistory:ht.getInstance().getHistory()}),...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&(yield Ws(e.configuration.analytics,t))),...(e.excerptLength&&!ce(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function Lr(_x67,_x68){return _ref29.apply(this,arguments)}}();m();d();f();p();var ko=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??xr(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:t.referrer,timezone:e.configuration.search.timezone,...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&Zi(e.configuration.analytics,t,r)),...(e.excerptLength&&!ce(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});m();d();f();p();var Vy=ze(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o}));var qr=/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t,r){let n=Rp(e),o=PT(e),i=NT(e),a=e.configuration.analytics.analyticsMode==="legacy"?yield Lr(e,r):ko(e,t,r);return Dr({...a,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(n&&{cq:n}),...(o.length&&{facets:o}),...(e.pagination&&{numberOfResults:Ep(e),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:i}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function qr(_x69,_x70,_x71){return _ref30.apply(this,arguments)}}();function Ep(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function PT(e){return xp(DT(e),e.facetOrder??[])}function NT(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(FT).filter(r=>r.currentValues.length>0):void 0}function FT(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function DT(e){return MT(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function MT(e){return[...LT(e.facetSet??{}),...Gy(e.numericFacetSet??{}),...Gy(e.dateFacetSet??{}),...Mr(e.categoryFacetSet??{})]}function LT(e){return Mr(e).map(t=>{let r=Cp[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function Gy(e){return Mr(e).map(t=>{let r=t.currentValues,n=r.some(({state:i})=>i!=="idle"),o=r.some(i=>i.previousState);return t.generateAutomaticRanges&&!n&&!o?{...t,currentValues:[]}:t})}function Rp(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=Vy(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();f();p();m();d();f();p();var ta=(e,t)=>{let r=e;return ce(r[t])?ce(e.raw[t])?null:e.raw[t]:r[t]},qT=e=>t=>e.every(r=>!ce(ta(t,r))),jT=e=>t=>e.every(r=>ce(ta(t,r))),UT=(e,t)=>r=>{let n=By(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},VT=(e,t)=>r=>{let n=By(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},By=(e,t)=>{let r=ta(t,e);return dm(r)?r:[r]},$y={getResultProperty:ta,fieldsMustBeDefined:qT,fieldsMustNotBeDefined:jT,fieldMustMatch:UT,fieldMustNotMatch:VT};var Ip=ze(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var Tp=e=>e.searchHub;m();d();f();p();var pc=ze(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),VH=ze(e=>e,e=>{let t=pc(e);return t&&e?e[t].expression:""});m();d();f();p();var Qy=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var Hy=e=>e.excerptLength?.length;m();d();f();p();var zy=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var Wy=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};m();d();f();p();var Ky=e=>e.sortCriteria;var Yy=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Zn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function Yy(_x72){return _ref31.apply(this,arguments)}}(),Xy=(e,t)=>{let r=hn(e)?.q,{aq:n,cq:o,dq:i,lq:a}=ev(e),s=dp(e),u=Zi(e.configuration.analytics,t,{actionCause:Ip(e)}),c=Tp(e),g=pp(e),v=Gd(e)??[],R=Jy(e),h=pc(e.tabSet)||"default",y=Ud(e),b=dh(e),x=t.referrer||"",I=zy(e),_=Ky(e),T=GT(e),P=Hy(e),A=Wy(e),O=Qy(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(a&&{lq:a}),...(e.query&&{enableQuerySyntax:wy(e)}),...(s?.contextValues&&{context:s.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(c?.length&&{searchHub:c}),...(g?.length&&{pipeline:g}),...(R.length&&{facets:R}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(e.pagination&&{numberOfResults:Ep(e),firstResult:e.pagination.firstResult}),tab:h,locale:y,timezone:b,...(e.debug!==void 0&&{debug:e.debug}),referrer:x,...T,...(A??{}),...(P&&{excerptLength:P}),...(O&&{dictionaryFieldContext:O}),sortCriteria:_,...(I&&{facetOptions:I}),...u,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Zy=(e,t)=>{let r=hn(e)?.q,n=Jy(e),o=Zi(e.configuration.analytics,t,{actionCause:Ip(e)}),i=Ud(e),a=pc(e.tabSet)||"default",s=t.referrer,{aq:u,cq:c}=ev(e),g=Tp(e),v=pp(e),R=dp(e),h=Gd(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(v?.length&&{pipeline:v}),...(R?.contextValues&&{context:R.contextValues}),...(u&&{aq:u}),...(c&&{cq:c}),tab:a,referrer:s,...o,locale:i}},Jy=e=>dc(e)?.map(t=>wp(t,Ap())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),GT=e=>({actionsHistory:e.configuration.analytics.enabled?ht.getInstance().getHistory():[]}),ev=e=>{let t=xy(e),r=Rp(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var fc=["searching","thinking","answering"];function mc(e){return e.toLowerCase()}var gc=["search","generic"];m();d();f();p();var tv=["text/plain","text/markdown"];var Oo=new z({required:!0}),rv=new z,Po=new me({required:!0}),_p={id:Oo,title:Oo,uri:Oo,permanentid:Oo,clickUri:rv},hc=new z({required:!0,constrainTo:tv}),nv=new z({required:!0,constrainTo:fc}),ov=e=>({...e,name:mc(e.name)}),sz=L("generatedAnswer/setIsVisible",e=>B(e,Po)),yc=L("generatedAnswer/setAnswerId",e=>B(e,Y)),cz=L("generatedAnswer/setAnswerGenerationMode",e=>B(e,new z({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),uz=L("generatedAnswer/setIsEnabled",e=>B(e,Po)),na=L("generatedAnswer/updateMessage",e=>B(e,{textDelta:Oo})),oa=L("generatedAnswer/updateCitations",e=>B(e,{citations:new Ae({required:!0,each:new ne({values:_p})})})),ia=L("generatedAnswer/updateError",e=>B(e,{message:rv,code:new oe({min:0})})),vc=L("generatedAnswer/resetAnswer"),lz=L("generatedAnswer/like"),dz=L("generatedAnswer/dislike"),pz=L("generatedAnswer/feedbackModal/open"),fz=L("generatedAnswer/expand"),mz=L("generatedAnswer/collapse"),gz=L("generatedAnswer/setId",e=>B(e,{id:new z({required:!0})})),hz=L("generatedAnswer/feedbackModal/close"),yz=L("generatedAnswer/sendFeedback"),jr=L("generatedAnswer/setIsLoading",e=>B(e,Po)),ra=L("generatedAnswer/setIsStreaming",e=>B(e,Po)),aa=L("generatedAnswer/setAnswerContentFormat",e=>B(e,hc)),vz=L("generatedAnswer/updateResponseFormat",e=>B(e,{contentFormat:new Ae({each:hc,default:["text/plain"]})})),Sz=L("knowledge/updateAnswerConfigurationId",e=>B(e,Oo)),bz=L("generatedAnswer/registerFieldsToIncludeInCitations",e=>B(e,gs)),kp=L("generatedAnswer/setIsAnswerGenerated",e=>B(e,Po)),sa=L("generatedAnswer/setCannotAnswer",e=>B(e,Po)),BT=L("generatedAnswer/setAnswerApiQueryParams",e=>B(e,new ne({}))),iv=L("generatedAnswer/startStep",e=>B(ov(e),{name:nv,startedAt:new oe({min:0,required:!0})})),av=L("generatedAnswer/finishStep",e=>B(ov(e),{name:nv,finishedAt:new oe({min:0,required:!0})})),sv=L("generatedAnswer/startToolCall",e=>B(e,{toolCallName:Y,startedAt:new oe({min:0,required:!0}),toolCallId:Y})),cv=L("generatedAnswer/finishToolCall",e=>B(e,{finishedAt:new oe({min:0,required:!0}),toolCallId:Y})),Sc=L("generatedAnswer/toolCallArgs",e=>B(e,{toolCallId:Y,args:new ne({options:{required:!0}}),type:new z({required:!0,constrainTo:gc})})),Az=ke("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:i}=t,{generatedAnswerAnalyticsClient:a}=o,{search:s}=i(),{queryExecuted:u}=s,{setAbortControllerRef:c}=e,g=yield Yy(r),v=(y,b)=>{switch(y){case"genqa.headerMessageType":{let x=JSON.parse(b);n(aa(x.contentFormat));break}case"genqa.messageType":n(na(JSON.parse(b)));break;case"genqa.citationsType":n(oa(JSON.parse(b)));break;case"genqa.endOfStreamType":{let x=JSON.parse(b).answerGenerated,{answerId:I,answer:_}=i().generatedAnswer,P=u.length!==0&&!x,A=!_?.trim();n(sa(P)),n(ra(!1)),n(kp(x)),n((a??ac).logGeneratedAnswerStreamEnd(x,I,x?A:void 0)),n(To());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${y}"`)}};n(jr(!0));let R=y=>y.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:y=>{R(g)&&(n(jr(!1)),y.payload&&y.payloadType&&v(y.payloadType,y.payload))},abort:y=>{R(g)&&n(ia(y))},close:()=>{R(g)&&n(ra(!1))},resetAnswer:()=>{R(g)&&n(vc())}});h?c(h):n(jr(!1))});return function(_x73,_x74){return _ref32.apply(this,arguments)}}()),wz=ke("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(vc());let i=t();if(i.generatedAnswer.isEnabled===!1){o.warn("[WARNING] The generateAnswer action was dispatched while the generated answer is disabled. No answer will be generated. Enable the generated answer before dispatching generateAnswer.");return}if(i.generatedAnswer.answerConfigurationId){let a=Xy(i,n);r(BT(a)),yield r(uv(a))}else o.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.")});return function(_x75,_x76){return _ref33.apply(this,arguments)}}());m();d();f();p();m();d();f();p();function dv(_x77,_x78){return _dv.apply(this,arguments)}function _dv(){_dv=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _dv.apply(this,arguments)}function pv(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=QT(t,a);let s=t.length,u=0;for(;r<s;){o&&(t[r]===10&&(u=++r),o=!1);let c=-1;for(;r<s&&c===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-u);break;case 13:o=!0,c=r;break;case 10:c=r;break}if(c===-1)break;e(t.subarray(u,c),n),u=r,n=-1}u===s?t=void 0:u!==0&&(t=t.subarray(u),r-=u)}}function fv(e,t,r){let n=lv(),o=new TextDecoder;return function(a,s){if(a.length===0)r?.(n),n=lv();else if(s>0){let u=o.decode(a.subarray(0,s)),c=s+(a[s+1]===32?2:1),g=o.decode(a.subarray(c));switch(u){case"data":n.data=n.data?`${n.data}
|
|
32
|
+
${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":$T(g,n,t);break}}}}function $T(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function QT(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function lv(){return{data:"",event:"",id:"",retry:void 0}}var Op="text/event-stream",HT=1e3,mv="last-event-id";function gv(){return typeof window<"u"}function hv(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:a,openWhenHidden:s,fetch:u,...c}){return new Promise((g,v)=>{let R={...r};R.accept||(R.accept=Op);let h;function y(){h?.abort(),document.hidden||P()}!s&&gv()&&document.addEventListener("visibilitychange",y);let b=HT,x;function I(){gv()&&document.removeEventListener("visibilitychange",y),clearTimeout(x),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let _=u??C,T=n??zT;function P(){return _P2.apply(this,arguments)}function _P2(){_P2=_asyncToGenerator(function*(){h=l.AbortController?new l.AbortController:null;try{let A=yield _(e,{...c,headers:R,signal:h?.signal});yield T(A),yield dv(A.body,pv(fv(O=>{O?R[mv]=O:delete R[mv]},O=>{b=O},o))),i?.(),I(),g()}catch(A){if(!h?.signal?.aborted)try{let O=a?.(A)??b;clearTimeout(x),x=setTimeout(P,O)}catch(O){I(),v(O)}}});return _P2.apply(this,arguments)}P()})}function zT(e){let t=e.headers.get("content-type");if(!t?.startsWith(Op))throw new Error(`Expected content-type to be ${Op}, Actual: ${t}`)}m();d();f();p();var WT=/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:i,organizationId:a}=n.configuration,s=n.generatedAnswer.answerConfigurationId,u={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let c=Zn(n.configuration.search?.apiBaseUrl,a,i);return cy({baseUrl:`${c}/rest/organizations/${a}/answer/v1/configs/${s}`,fetchFn:function(){var _ref35=_asyncToGenerator(function*(g){if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let v=g.url,R={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{R[h]=g[h]}),R.duplex="half",R.body=yield g.text(),C(v,R)});return function fetchFn(_x82){return _ref35.apply(this,arguments)}}()})(u,{...t,signal:null},r)}catch(c){return{error:c}}});return function WT(_x79,_x80,_x81){return _ref34.apply(this,arguments)}}(),yv=Ay({reducerPath:"answer",baseQuery:ly(WT,{maxRetries:3}),endpoints:()=>({})});var KT=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},YT=(e,t)=>{let{textDelta:r}=t;if(typeof r!="string")return;let n=e.answer;!n?.trim()&&!r.trim()||(delete e.error,e.answer=n?.trim()?n.concat(r):r)},XT=(e,t)=>{delete e.error,e.citations=t.citations},ZT=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},JT=(e,t)=>{let r=t.errorMessage||"Unknown error occurred";e.error={message:r,code:t.code},e.isStreaming=!1,e.isLoading=!1,console.error(`Generated answer error: ${r} (code: ${t.code})`)},e0=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&JT(t,o);let i=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":i.contentFormat&&(KT(t,i),r(aa(i.contentFormat)));break;case"genqa.messageType":typeof i.textDelta=="string"&&(YT(t,i),r(na({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(XT(t,i),r(oa({citations:i.citations})));break;case"genqa.endOfStreamType":{ZT(t,i);let a=t.answerId,s=i.answerGenerated??!1,u=s?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(s,a,u)),r(To());break}}},t0=(e,t,r,n)=>{if(!e||!t||!r)throw new Error("Missing required parameters for answer endpoint");let o=`/rest/organizations/${t}`,i=n?`insight/v1/configs/${n}/answer`:"answer/v1/configs";return`${e}${o}/${i}/${r}/generate`},Pp=yv.injectEndpoints({overrideExisting:!0,endpoints:e=>({getAnswer:e.query({queryFn:()=>({data:{contentFormat:void 0,answer:void 0,citations:void 0,error:void 0,generated:!1,isStreaming:!0,isLoading:!0}}),serializeQueryArgs:({endpointName:t,queryArgs:r})=>{let{analytics:n,...o}=r;return`${t}(${JSON.stringify(o)})`},onCacheEntryAdded(_x83,_x84){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:i,extra:a}){yield n;let{configuration:s,generatedAnswer:u,insightConfiguration:c}=r(),{generatedAnswerAnalyticsClient:g}=a,{organizationId:v,environment:R,accessToken:h}=s,y=Zn(s.search.apiBaseUrl,v,R),b=t0(y,v,u.answerConfigurationId,c?.insightId);yield hv(b,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${h}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},openWhenHidden:!0,fetch:C,onopen:function(){var _ref36=_asyncToGenerator(function*(x){let I=x.headers.get("x-answer-id");I&&o(_=>{_.answerId=I,i(yc(I))})});return function onopen(_x85){return _ref36.apply(this,arguments)}}(),onmessage:x=>{o(I=>{e0(x,I,i,g??ac)})},onerror:x=>{throw x},onclose:()=>{o(x=>{i(sa(!x.generated))})}})}).apply(this,arguments)}})})}),uv=e=>Pp.endpoints.getAnswer.initiate(e);m();d();f();p();var vv=Be(ao,e=>e);m();d();f();p();function r0(e){let t=e.payload?.analyticsAction;return Sv(e)&&!ce(t)}function Sv(e){return"type"in e}var bv=e=>t=>r=>{let n;r0(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return Sv(r)&&(r.type==="search/executeSearch/fullfilled"&&n===void 0&&console.error("No analytics action associated with search:",r),r.type==="recommendation/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with recommendation:",r),r.type==="productRecommendations/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with product recommendation:",r)),n!==void 0&&e.dispatch(n),o};m();d();f();p();m();d();f();p();m();d();f();p();var SW=L("tab/register",e=>{let t=new ne({values:{id:Y,expression:nt}});return B(e,t)}),bc=L("tab/updateActiveTab",e=>B(e,Y));m();d();f();p();var Ac=jt(sc(),1),xv=jt(Av(),1),Cv=jt(wv(),1);Ac.default.extend(Cv.default);Ac.default.extend(xv.default);var Ev=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:Ac.default.tz.guess(),authenticationProviders:[]},analytics:{enabled:!0,originContext:"Search",originLevel2:"default",originLevel3:"default",anonymous:!1,deviceId:"",userDisplayName:"",documentLocation:"",analyticsMode:"next",source:{}},knowledge:{answerConfigurationId:"",agentId:void 0},environment:"prod"});m();d();f();p();var n0=/(^|; )Coveo-Pendragon=([^;]*)/,o0=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function Rv(){return typeof window>"u"?!1:n0.exec(document.cookie)?.pop()||null}function Iv(){return typeof window>"u"?!1:o0.test(document.cookie)}var Tv=Be(Ev(),e=>e.addCase(Ir,(t,r)=>{i0(t,r.payload)}).addCase(Yt,(t,r)=>{a0(t,r.payload)}).addCase(so,(t,r)=>{s0(t,r.payload)}).addCase(co,t=>{t.analytics.enabled=!1}).addCase(uo,t=>{t.analytics.enabled=!0}).addCase(hs,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(ys,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(bc,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Ng,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Tr,(t,r)=>{ce(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Og,(t,{payload:r})=>{c0(t,r)}));function i0(e,t){ce(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ce(t.organizationId)||(e.organizationId=t.organizationId)}function a0(e,t){ce(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),ce(t.locale)||(e.search.locale=t.locale),ce(t.timezone)||(e.search.timezone=t.timezone),ce(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function s0(e,t){ce(t.enabled)||(e.analytics.enabled=t.enabled),ce(t.originContext)||(e.analytics.originContext=t.originContext),ce(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),ce(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),ce(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),ce(t.trackingId)||(e.analytics.trackingId=t.trackingId),ce(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),ce(t.source)||(e.analytics.source=t.source);try{let r=Rv();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}ce(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),ce(t.anonymous)||(e.analytics.anonymous=t.anonymous),ce(t.deviceId)||(e.analytics.deviceId=t.deviceId),ce(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),ce(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function c0(e,t){e.knowledge.agentId=t;try{Iv()&&(e.knowledge.debugAgentSession=!0)}catch{}}var Vt=Tv;m();d();f();p();function u0(e){return e.instantlyCallable}var _v=()=>e=>t=>e(u0(t)?t():t);m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var at=[];for(let e=0;e<256;++e)at.push((e+256).toString(16).slice(1));function kv(e,t=0){return(at[e[t+0]]+at[e[t+1]]+at[e[t+2]]+at[e[t+3]]+"-"+at[e[t+4]]+at[e[t+5]]+"-"+at[e[t+6]]+at[e[t+7]]+"-"+at[e[t+8]]+at[e[t+9]]+"-"+at[e[t+10]]+at[e[t+11]]+at[e[t+12]]+at[e[t+13]]+at[e[t+14]]+at[e[t+15]]).toLowerCase()}m();d();f();p();var Lp,l0=new Uint8Array(16);function qp(){if(!Lp){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Lp=crypto.getRandomValues.bind(crypto)}return Lp(l0)}m();d();f();p();m();d();f();p();var d0=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),jp={randomUUID:d0};function p0(e,t,r){if(jp.randomUUID&&!t&&!e)return jp.randomUUID();e=e||{};let n=e.random??e.rng?.()??qp();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return kv(n)}var Ur=p0;m();d();f();p();m();d();f();p();var S={};ui(S,{BRAND:()=>q0,DIRTY:()=>vn,EMPTY_PATH:()=>h0,INVALID:()=>pe,NEVER:()=>w_,OK:()=>pt,ParseStatus:()=>st,Schema:()=>xe,ZodAny:()=>Br,ZodArray:()=>br,ZodBigInt:()=>bn,ZodBoolean:()=>An,ZodBranded:()=>ua,ZodCatch:()=>Pn,ZodDate:()=>wn,ZodDefault:()=>On,ZodDiscriminatedUnion:()=>Cc,ZodEffects:()=>Dt,ZodEnum:()=>_n,ZodError:()=>bt,ZodFirstPartyTypeKind:()=>fe,ZodFunction:()=>Rc,ZodIntersection:()=>Rn,ZodIssueCode:()=>K,ZodLazy:()=>In,ZodLiteral:()=>Tn,ZodMap:()=>qo,ZodNaN:()=>Uo,ZodNativeEnum:()=>kn,ZodNever:()=>Gt,ZodNull:()=>Cn,ZodNullable:()=>tr,ZodNumber:()=>Sn,ZodObject:()=>At,ZodOptional:()=>Nt,ZodParsedType:()=>re,ZodPipeline:()=>la,ZodPromise:()=>$r,ZodReadonly:()=>Nn,ZodRecord:()=>Ec,ZodSchema:()=>xe,ZodSet:()=>jo,ZodString:()=>Gr,ZodSymbol:()=>Mo,ZodTransformer:()=>Dt,ZodTuple:()=>er,ZodType:()=>xe,ZodUndefined:()=>xn,ZodUnion:()=>En,ZodUnknown:()=>Sr,ZodVoid:()=>Lo,addIssueToContext:()=>ee,any:()=>z0,array:()=>X0,bigint:()=>G0,boolean:()=>Vv,coerce:()=>A_,custom:()=>qv,date:()=>B0,datetimeRegex:()=>Mv,defaultErrorMap:()=>yr,discriminatedUnion:()=>t_,effect:()=>f_,enum:()=>l_,function:()=>s_,getErrorMap:()=>No,getParsedType:()=>Jt,instanceof:()=>U0,intersection:()=>r_,isAborted:()=>wc,isAsync:()=>Fo,isDirty:()=>xc,isValid:()=>Vr,late:()=>j0,lazy:()=>c_,literal:()=>u_,makeIssue:()=>ca,map:()=>i_,nan:()=>V0,nativeEnum:()=>d_,never:()=>K0,null:()=>H0,nullable:()=>g_,number:()=>Uv,object:()=>Z0,objectUtil:()=>Up,oboolean:()=>b_,onumber:()=>S_,optional:()=>m_,ostring:()=>v_,pipeline:()=>y_,preprocess:()=>h_,promise:()=>p_,quotelessJson:()=>f0,record:()=>o_,set:()=>a_,setErrorMap:()=>g0,strictObject:()=>J0,string:()=>jv,symbol:()=>$0,transformer:()=>f_,tuple:()=>n_,undefined:()=>Q0,union:()=>e_,unknown:()=>W0,util:()=>Re,void:()=>Y0});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Re;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Re||(Re={}));var Up;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Up||(Up={}));var re=Re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Jt=e=>{switch(typeof e){case"undefined":return re.undefined;case"string":return re.string;case"number":return Number.isNaN(e)?re.nan:re.number;case"boolean":return re.boolean;case"function":return re.function;case"bigint":return re.bigint;case"symbol":return re.symbol;case"object":return Array.isArray(e)?re.array:e===null?re.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?re.promise:typeof Map<"u"&&e instanceof Map?re.map:typeof Set<"u"&&e instanceof Set?re.set:typeof Date<"u"&&e instanceof Date?re.date:re.object;default:return re.unknown}};var K=Re.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),f0=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),bt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,u=0;for(;u<a.path.length;){let c=a.path[u];u===a.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(r(a))):s[c]=s[c]||{_errors:[]},s=s[c],u++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};bt.create=e=>new bt(e);var m0=(e,t)=>{let r;switch(e.code){case K.invalid_type:e.received===re.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case K.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Re.jsonStringifyReplacer)}`;break;case K.unrecognized_keys:r=`Unrecognized key(s) in object: ${Re.joinValues(e.keys,", ")}`;break;case K.invalid_union:r="Invalid input";break;case K.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Re.joinValues(e.options)}`;break;case K.invalid_enum_value:r=`Invalid enum value. Expected ${Re.joinValues(e.options)}, received '${e.received}'`;break;case K.invalid_arguments:r="Invalid function arguments";break;case K.invalid_return_type:r="Invalid function return type";break;case K.invalid_date:r="Invalid date";break;case K.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Re.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case K.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case K.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case K.custom:r="Invalid input";break;case K.invalid_intersection_types:r="Intersection results could not be merged";break;case K.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case K.not_finite:r="Number must be finite";break;default:r=t.defaultError,Re.assertNever(e)}return{message:r}},yr=m0;var Ov=yr;function g0(e){Ov=e}function No(){return Ov}m();d();f();p();var ca=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...(o.path||[])],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",u=n.filter(c=>!!c).slice().reverse();for(let c of u)s=c(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}},h0=[];function ee(e,t){let r=No(),n=ca({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===yr?void 0:yr].filter(o=>!!o)});e.common.issues.push(n)}var st=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return pe;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let o of r){let i=yield o.key,a=yield o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return pe;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},pe=Object.freeze({status:"aborted"}),vn=e=>({status:"dirty",value:e}),pt=e=>({status:"valid",value:e}),wc=e=>e.status==="aborted",xc=e=>e.status==="dirty",Vr=e=>e.status==="valid",Fo=e=>typeof Promise<"u"&&e instanceof Promise;m();d();f();p();m();d();f();p();var ae;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ae||(ae={}));var Ft=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Pv=(e,t)=>{if(Vr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new bt(e.common.issues);return this._error=r,this._error}}};function be(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:u}=e;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:u??r??s.defaultError}},description:o}}var xe=class{get description(){return this._def.description}_getType(t){return Jt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Jt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new st,ctx:{common:t.parent.common,data:t.data,parsedType:Jt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Fo(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Jt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Pv(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Jt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Vr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Vr(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this10=this;return _asyncToGenerator(function*(){let n=yield _this10.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this11=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this11._def.errorMap,parent:null,data:t,parsedType:Jt(t)},o=_this11._parse({data:t,path:n.path,parent:n}),i=yield Fo(o)?o:Promise.resolve(o);return Pv(n,i)})()}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:K.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new Dt({schema:this,typeName:fe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Nt.create(this,this._def)}nullable(){return tr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return br.create(this)}promise(){return $r.create(this,this._def)}or(t){return En.create([this,t],this._def)}and(t){return Rn.create(this,t,this._def)}transform(t){return new Dt({...be(this._def),schema:this,typeName:fe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new On({...be(this._def),innerType:this,defaultValue:r,typeName:fe.ZodDefault})}brand(){return new ua({typeName:fe.ZodBranded,type:this,...be(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Pn({...be(this._def),innerType:this,catchValue:r,typeName:fe.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return la.create(this,t)}readonly(){return Nn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},y0=/^c[^\s-]{8,}$/i,v0=/^[0-9a-z]+$/,S0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,b0=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,A0=/^[a-z0-9_-]{21}$/i,w0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,x0=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,C0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,E0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Vp,R0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,I0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,T0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,_0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,k0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,O0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Fv="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",P0=new RegExp(`^${Fv}$`);function Dv(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function N0(e){return new RegExp(`^${Dv(e)}$`)}function Mv(e){let t=`${Fv}T${Dv(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function F0(e,t){return!!((t==="v4"||!t)&&R0.test(e)||(t==="v6"||!t)&&T0.test(e))}function D0(e,t){if(!w0.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function M0(e,t){return!!((t==="v4"||!t)&&I0.test(e)||(t==="v6"||!t)&&_0.test(e))}var Gr=class e extends xe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==re.string){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:re.string,received:i.parsedType}),pe}let n=new st,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?ee(o,{code:K.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&ee(o,{code:K.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")C0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"email",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Vp||(Vp=new RegExp(E0,"u")),Vp.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"emoji",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")b0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"uuid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")A0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"nanoid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")y0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cuid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")v0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cuid2",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")S0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"ulid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ee(o,{validation:"url",code:K.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"regex",code:K.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Mv(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?P0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?N0(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?x0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"duration",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?F0(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"ip",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?D0(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"jwt",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?M0(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cidr",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?k0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"base64",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?O0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"base64url",code:K.invalid_string,message:i.message}),n.dirty()):Re.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:K.invalid_string,...ae.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ae.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ae.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ae.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ae.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ae.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ae.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ae.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ae.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ae.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ae.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ae.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ae.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ae.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...ae.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...ae.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ae.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ae.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ae.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ae.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ae.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ae.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ae.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ae.errToObj(r)})}nonempty(t){return this.min(1,ae.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Gr.create=e=>new Gr({checks:[],typeName:fe.ZodString,coerce:e?.coerce??!1,...be(e)});function L0(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var Sn=class e extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==re.number){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:re.number,received:i.parsedType}),pe}let n,o=new st;for(let i of this._def.checks)i.kind==="int"?Re.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{code:K.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?L0(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{code:K.not_finite,message:i.message}),o.dirty()):Re.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ae.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ae.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ae.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ae.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ae.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ae.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ae.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ae.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ae.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ae.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ae.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ae.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ae.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ae.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Re.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Sn.create=e=>new Sn({checks:[],typeName:fe.ZodNumber,coerce:e?.coerce||!1,...be(e)});var bn=class e extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==re.bigint)return this._getInvalidInput(t);let n,o=new st;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Re.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return ee(r,{code:K.invalid_type,expected:re.bigint,received:r.parsedType}),pe}gte(t,r){return this.setLimit("min",t,!0,ae.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ae.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ae.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ae.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ae.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ae.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ae.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ae.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ae.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ae.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};bn.create=e=>new bn({checks:[],typeName:fe.ZodBigInt,coerce:e?.coerce??!1,...be(e)});var An=class extends xe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==re.boolean){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.boolean,received:n.parsedType}),pe}return pt(t.data)}};An.create=e=>new An({typeName:fe.ZodBoolean,coerce:e?.coerce||!1,...be(e)});var wn=class e extends xe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==re.date){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:re.date,received:i.parsedType}),pe}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_date}),pe}let n=new st,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Re.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:ae.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ae.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};wn.create=e=>new wn({checks:[],coerce:e?.coerce||!1,typeName:fe.ZodDate,...be(e)});var Mo=class extends xe{_parse(t){if(this._getType(t)!==re.symbol){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.symbol,received:n.parsedType}),pe}return pt(t.data)}};Mo.create=e=>new Mo({typeName:fe.ZodSymbol,...be(e)});var xn=class extends xe{_parse(t){if(this._getType(t)!==re.undefined){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.undefined,received:n.parsedType}),pe}return pt(t.data)}};xn.create=e=>new xn({typeName:fe.ZodUndefined,...be(e)});var Cn=class extends xe{_parse(t){if(this._getType(t)!==re.null){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.null,received:n.parsedType}),pe}return pt(t.data)}};Cn.create=e=>new Cn({typeName:fe.ZodNull,...be(e)});var Br=class extends xe{constructor(){super(...arguments),this._any=!0}_parse(t){return pt(t.data)}};Br.create=e=>new Br({typeName:fe.ZodAny,...be(e)});var Sr=class extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return pt(t.data)}};Sr.create=e=>new Sr({typeName:fe.ZodUnknown,...be(e)});var Gt=class extends xe{_parse(t){let r=this._getOrReturnCtx(t);return ee(r,{code:K.invalid_type,expected:re.never,received:r.parsedType}),pe}};Gt.create=e=>new Gt({typeName:fe.ZodNever,...be(e)});var Lo=class extends xe{_parse(t){if(this._getType(t)!==re.undefined){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.void,received:n.parsedType}),pe}return pt(t.data)}};Lo.create=e=>new Lo({typeName:fe.ZodVoid,...be(e)});var br=class e extends xe{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==re.array)return ee(r,{code:K.invalid_type,expected:re.array,received:r.parsedType}),pe;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(ee(r,{code:a?K.too_big:K.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(ee(r,{code:K.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(ee(r,{code:K.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new Ft(r,a,r.path,s)))).then(a=>st.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Ft(r,a,r.path,s)));return st.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:ae.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ae.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ae.toString(r)}})}nonempty(t){return this.min(1,t)}};br.create=(e,t)=>new br({type:e,minLength:null,maxLength:null,exactLength:null,typeName:fe.ZodArray,...be(t)});function Do(e){if(e instanceof At){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Nt.create(Do(n))}return new At({...e._def,shape:()=>t})}else return e instanceof br?new br({...e._def,type:Do(e.element)}):e instanceof Nt?Nt.create(Do(e.unwrap())):e instanceof tr?tr.create(Do(e.unwrap())):e instanceof er?er.create(e.items.map(t=>Do(t))):e}var At=class e extends xe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Re.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==re.object){let c=this._getOrReturnCtx(t);return ee(c,{code:K.invalid_type,expected:re.object,received:c.parsedType}),pe}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Gt&&this._def.unknownKeys==="strip"))for(let c in o.data)a.includes(c)||s.push(c);let u=[];for(let c of a){let g=i[c],v=o.data[c];u.push({key:{status:"valid",value:c},value:g._parse(new Ft(o,v,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Gt){let c=this._def.unknownKeys;if(c==="passthrough")for(let g of s)u.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(c==="strict")s.length>0&&(ee(o,{code:K.unrecognized_keys,keys:s}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let g of s){let v=o.data[g];u.push({key:{status:"valid",value:g},value:c._parse(new Ft(o,v,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let c=[];for(let g of u){let v=yield g.key,R=yield g.value;c.push({key:v,value:R,alwaysSet:g.alwaysSet})}return c})).then(c=>st.mergeObjectSync(n,c)):st.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(t){return ae.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ae.errToObj(t).message??o}:{message:o}}}:{})})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:fe.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Re.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Re.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Do(this)}partial(t){let r={};for(let n of Re.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Re.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Nt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Lv(Re.objectKeys(this.shape))}};At.create=(e,t)=>new At({shape:()=>e,unknownKeys:"strip",catchall:Gt.create(),typeName:fe.ZodObject,...be(t)});At.strictCreate=(e,t)=>new At({shape:()=>e,unknownKeys:"strict",catchall:Gt.create(),typeName:fe.ZodObject,...be(t)});At.lazycreate=(e,t)=>new At({shape:e,unknownKeys:"strip",catchall:Gt.create(),typeName:fe.ZodObject,...be(t)});var En=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new bt(s.ctx.common.issues));return ee(r,{code:K.invalid_union,unionErrors:a}),pe}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(i){let a={...r,common:{...r.common,issues:[]},parent:null};return{result:yield i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}});return function(_x86){return _ref38.apply(this,arguments)}}())).then(o);{let i,a=[];for(let u of n){let c={...r,common:{...r.common,issues:[]},parent:null},g=u._parseSync({data:r.data,path:r.path,parent:c});if(g.status==="valid")return g;g.status==="dirty"&&!i&&(i={result:g,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(u=>new bt(u));return ee(r,{code:K.invalid_union,unionErrors:s}),pe}}get options(){return this._def.options}};En.create=(e,t)=>new En({options:e,typeName:fe.ZodUnion,...be(t)});var vr=e=>e instanceof In?vr(e.schema):e instanceof Dt?vr(e.innerType()):e instanceof Tn?[e.value]:e instanceof _n?e.options:e instanceof kn?Re.objectValues(e.enum):e instanceof On?vr(e._def.innerType):e instanceof xn?[void 0]:e instanceof Cn?[null]:e instanceof Nt?[void 0,...vr(e.unwrap())]:e instanceof tr?[null,...vr(e.unwrap())]:e instanceof ua||e instanceof Nn?vr(e.unwrap()):e instanceof Pn?vr(e._def.innerType):[],Cc=class e extends xe{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==re.object)return ee(r,{code:K.invalid_type,expected:re.object,received:r.parsedType}),pe;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(ee(r,{code:K.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=vr(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:fe.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...be(n)})}};function Gp(e,t){let r=Jt(e),n=Jt(t);if(e===t)return{valid:!0,data:e};if(r===re.object&&n===re.object){let o=Re.objectKeys(t),i=Re.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let u=Gp(e[s],t[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===re.array&&n===re.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],u=Gp(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===re.date&&n===re.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Rn=class extends xe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(wc(i)||wc(a))return pe;let s=Gp(i.value,a.value);return s.valid?((xc(i)||xc(a))&&r.dirty(),{status:r.value,value:s.data}):(ee(n,{code:K.invalid_intersection_types}),pe)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Rn.create=(e,t,r)=>new Rn({left:e,right:t,typeName:fe.ZodIntersection,...be(r)});var er=class e extends xe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==re.array)return ee(n,{code:K.invalid_type,expected:re.array,received:n.parsedType}),pe;if(n.data.length<this._def.items.length)return ee(n,{code:K.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pe;!this._def.rest&&n.data.length>this._def.items.length&&(ee(n,{code:K.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let u=this._def.items[s]||this._def.rest;return u?u._parse(new Ft(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>st.mergeArray(r,a)):st.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};er.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new er({items:e,typeName:fe.ZodTuple,rest:null,...be(t)})};var Ec=class e extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==re.object)return ee(n,{code:K.invalid_type,expected:re.object,received:n.parsedType}),pe;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Ft(n,s,n.path,s)),value:a._parse(new Ft(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?st.mergeObjectAsync(r,o):st.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof xe?new e({keyType:t,valueType:r,typeName:fe.ZodRecord,...be(n)}):new e({keyType:Gr.create(),valueType:t,typeName:fe.ZodRecord,...be(r)})}},qo=class extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==re.map)return ee(n,{code:K.invalid_type,expected:re.map,received:n.parsedType}),pe;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],c)=>({key:o._parse(new Ft(n,s,n.path,[c,"key"])),value:i._parse(new Ft(n,u,n.path,[c,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let u of a){let c=yield u.key,g=yield u.value;if(c.status==="aborted"||g.status==="aborted")return pe;(c.status==="dirty"||g.status==="dirty")&&r.dirty(),s.set(c.value,g.value)}return{status:r.value,value:s}}))}else{let s=new Map;for(let u of a){let c=u.key,g=u.value;if(c.status==="aborted"||g.status==="aborted")return pe;(c.status==="dirty"||g.status==="dirty")&&r.dirty(),s.set(c.value,g.value)}return{status:r.value,value:s}}}};qo.create=(e,t,r)=>new qo({valueType:t,keyType:e,typeName:fe.ZodMap,...be(r)});var jo=class e extends xe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==re.set)return ee(n,{code:K.invalid_type,expected:re.set,received:n.parsedType}),pe;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ee(n,{code:K.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(ee(n,{code:K.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(u){let c=new Set;for(let g of u){if(g.status==="aborted")return pe;g.status==="dirty"&&r.dirty(),c.add(g.value)}return{status:r.value,value:c}}let s=[...n.data.values()].map((u,c)=>i._parse(new Ft(n,u,n.path,c)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:ae.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ae.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};jo.create=(e,t)=>new jo({valueType:e,minSize:null,maxSize:null,typeName:fe.ZodSet,...be(t)});var Rc=class e extends xe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==re.function)return ee(r,{code:K.invalid_type,expected:re.function,received:r.parsedType}),pe;function n(s,u){return ca({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,No(),yr].filter(c=>!!c),issueData:{code:K.invalid_arguments,argumentsError:u}})}function o(s,u){return ca({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,No(),yr].filter(c=>!!c),issueData:{code:K.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof $r){let s=this;return pt(/*#__PURE__*/_asyncToGenerator(function*(...u){let c=new bt([]),g=yield s._def.args.parseAsync(u,i).catch(h=>{throw c.addIssue(n(u,h)),c}),v=yield Reflect.apply(a,this,g);return yield s._def.returns._def.type.parseAsync(v,i).catch(h=>{throw c.addIssue(o(v,h)),c})}))}else{let s=this;return pt(function(...u){let c=s._def.args.safeParse(u,i);if(!c.success)throw new bt([n(u,c.error)]);let g=Reflect.apply(a,this,c.data),v=s._def.returns.safeParse(g,i);if(!v.success)throw new bt([o(g,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:er.create(t).rest(Sr.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||er.create([]).rest(Sr.create()),returns:r||Sr.create(),typeName:fe.ZodFunction,...be(n)})}},In=class extends xe{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};In.create=(e,t)=>new In({getter:e,typeName:fe.ZodLazy,...be(t)});var Tn=class extends xe{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return ee(r,{received:r.data,code:K.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:t.data}}get value(){return this._def.value}};Tn.create=(e,t)=>new Tn({value:e,typeName:fe.ZodLiteral,...be(t)});function Lv(e,t){return new _n({values:e,typeName:fe.ZodEnum,...be(t)})}var _n=class e extends xe{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return ee(r,{expected:Re.joinValues(n),received:r.parsedType,code:K.invalid_type}),pe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return ee(r,{received:r.data,code:K.invalid_enum_value,options:n}),pe}return pt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};_n.create=Lv;var kn=class extends xe{_parse(t){let r=Re.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==re.string&&n.parsedType!==re.number){let o=Re.objectValues(r);return ee(n,{expected:Re.joinValues(o),received:n.parsedType,code:K.invalid_type}),pe}if(this._cache||(this._cache=new Set(Re.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Re.objectValues(r);return ee(n,{received:n.data,code:K.invalid_enum_value,options:o}),pe}return pt(t.data)}get enum(){return this._def.values}};kn.create=(e,t)=>new kn({values:e,typeName:fe.ZodNativeEnum,...be(t)});var $r=class extends xe{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==re.promise&&r.common.async===!1)return ee(r,{code:K.invalid_type,expected:re.promise,received:r.parsedType}),pe;let n=r.parsedType===re.promise?r.data:Promise.resolve(r.data);return pt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};$r.create=(e,t)=>new $r({type:e,typeName:fe.ZodPromise,...be(t)});var Dt=class extends xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===fe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this12=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{ee(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(/*#__PURE__*/function(){var _ref41=_asyncToGenerator(function*(s){if(r.value==="aborted")return pe;let u=yield _this12._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?pe:u.status==="dirty"?vn(u.value):r.value==="dirty"?vn(u.value):u});return function(_x87){return _ref41.apply(this,arguments)}}());{if(r.value==="aborted")return pe;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?pe:s.status==="dirty"?vn(s.value):r.value==="dirty"?vn(s.value):s}}if(o.type==="refinement"){let a=s=>{let u=o.refinement(s,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?pe:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?pe:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Vr(a))return pe;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Vr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):pe);Re.assertNever(o)}};Dt.create=(e,t,r)=>new Dt({schema:e,typeName:fe.ZodEffects,effect:t,...be(r)});Dt.createWithPreprocess=(e,t,r)=>new Dt({schema:t,effect:{type:"preprocess",transform:e},typeName:fe.ZodEffects,...be(r)});var Nt=class extends xe{_parse(t){return this._getType(t)===re.undefined?pt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Nt.create=(e,t)=>new Nt({innerType:e,typeName:fe.ZodOptional,...be(t)});var tr=class extends xe{_parse(t){return this._getType(t)===re.null?pt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};tr.create=(e,t)=>new tr({innerType:e,typeName:fe.ZodNullable,...be(t)});var On=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===re.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};On.create=(e,t)=>new On({innerType:e,typeName:fe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...be(t)});var Pn=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Fo(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new bt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Pn.create=(e,t)=>new Pn({innerType:e,typeName:fe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...be(t)});var Uo=class extends xe{_parse(t){if(this._getType(t)!==re.nan){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:re.nan,received:n.parsedType}),pe}return{status:"valid",value:t.data}}};Uo.create=e=>new Uo({typeName:fe.ZodNaN,...be(e)});var q0=Symbol("zod_brand"),ua=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},la=class e extends xe{_parse(t){var _this13=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let i=yield _this13._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?pe:i.status==="dirty"?(r.dirty(),vn(i.value)):_this13._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?pe:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:fe.ZodPipeline})}},Nn=class extends xe{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Vr(o)&&(o.value=Object.freeze(o.value)),o);return Fo(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Nn.create=(e,t)=>new Nn({innerType:e,typeName:fe.ZodReadonly,...be(t)});function Nv(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function qv(e,t={},r){return e?Br.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=Nv(t,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=Nv(t,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):Br.create()}var j0={object:At.lazycreate},fe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(fe||(fe={}));var U0=(e,t={message:`Input not instance of ${e.name}`})=>qv(r=>r instanceof e,t),jv=Gr.create,Uv=Sn.create,V0=Uo.create,G0=bn.create,Vv=An.create,B0=wn.create,$0=Mo.create,Q0=xn.create,H0=Cn.create,z0=Br.create,W0=Sr.create,K0=Gt.create,Y0=Lo.create,X0=br.create,Z0=At.create,J0=At.strictCreate,e_=En.create,t_=Cc.create,r_=Rn.create,n_=er.create,o_=Ec.create,i_=qo.create,a_=jo.create,s_=Rc.create,c_=In.create,u_=Tn.create,l_=_n.create,d_=kn.create,p_=$r.create,f_=Dt.create,m_=Nt.create,g_=tr.create,h_=Dt.createWithPreprocess,y_=la.create,v_=()=>jv().optional(),S_=()=>Uv().optional(),b_=()=>Vv().optional(),A_={string:e=>Gr.create({...e,coerce:!0}),number:e=>Sn.create({...e,coerce:!0}),boolean:e=>An.create({...e,coerce:!0}),bigint:e=>bn.create({...e,coerce:!0}),date:e=>wn.create({...e,coerce:!0})};var w_=pe;var x_=S.record(S.any()),Fn=x_.optional();function Gv(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var C_=S.object({name:S.string(),arguments:S.string()}),E_=S.object({id:S.string(),type:S.literal("function"),function:C_,encryptedValue:S.string().optional(),metadata:Fn}),Ic=S.object({id:S.string(),role:S.string(),content:S.string().optional(),name:S.string().optional(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Fn}),R_=S.object({type:S.literal("text"),text:S.string()}),I_=S.object({type:S.literal("data"),value:S.string(),mimeType:S.string()}),T_=S.object({type:S.literal("url"),value:S.string(),mimeType:S.string().optional()}),Tc=S.discriminatedUnion("type",[I_,T_]),__=S.object({type:S.literal("image"),source:Tc,metadata:S.unknown().optional()}),k_=S.object({type:S.literal("audio"),source:Tc,metadata:S.unknown().optional()}),O_=S.object({type:S.literal("video"),source:Tc,metadata:S.unknown().optional()}),P_=S.object({type:S.literal("document"),source:Tc,metadata:S.unknown().optional()});var Bv=S.object({type:S.literal("binary"),mimeType:S.string(),id:S.string().optional(),url:S.string().optional(),data:S.string().optional(),filename:S.string().optional()}),$v=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:S.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},Y8=Bv.superRefine((e,t)=>{$v(e,t)}),N_=S.discriminatedUnion("type",[R_,__,k_,O_,P_,Bv]),F_=N_.superRefine((e,t)=>{e.type==="binary"&&$v(e,t)}),D_=Ic.extend({role:S.literal("developer"),content:S.string()}),M_=Ic.extend({role:S.literal("system"),content:S.string()}),L_=Ic.extend({role:S.literal("assistant"),content:S.string().optional(),toolCalls:S.array(E_).optional()}),q_=Ic.extend({role:S.literal("user"),content:S.union([S.string(),S.array(F_)])}),j_=S.object({id:S.string(),content:S.string(),role:S.literal("tool"),toolCallId:S.string(),error:S.string().optional(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Fn}),U_=S.object({id:S.string(),role:S.literal("activity"),activityType:S.string(),content:S.record(S.any()),subagentRunId:S.string().optional(),metadata:Fn}),V_=S.object({id:S.string(),role:S.literal("reasoning"),content:S.string(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Fn}),Qv=S.discriminatedUnion("role",[D_,M_,L_,q_,j_,U_,V_]),X8=S.union([S.literal("developer"),S.literal("system"),S.literal("assistant"),S.literal("user"),S.literal("tool"),S.literal("activity"),S.literal("reasoning")]),G_=S.object({description:S.string(),value:S.string()}),Hv=S.object({name:S.string(),description:S.string(),parameters:S.any(),metadata:S.record(S.any()).optional()}),B_=S.object({id:S.string(),reason:S.string(),message:S.string().optional(),toolCallId:S.string().optional(),responseSchema:S.record(S.any()).optional(),expiresAt:S.string().optional(),metadata:S.record(S.any()).optional(),subagentRunId:S.string().optional()}),$_=S.object({interruptId:S.string(),status:S.enum(["resolved","cancelled"]),payload:S.any().optional(),metadata:Fn}),Q_=S.object({threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),state:S.any().transform(e=>e??void 0),messages:S.array(Qv),tools:S.array(Hv),context:S.array(G_),forwardedProps:S.any(),resume:S.array($_).optional()}),H_=S.any(),he=class extends Error{constructor(e){super(e)}},Bp=class extends he{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},z_=S.object({name:S.string(),description:S.string().optional()}),W_=S.object({name:S.string().optional(),type:S.string().optional(),description:S.string().optional(),version:S.string().optional(),provider:S.string().optional(),documentationUrl:S.string().optional(),metadata:S.record(S.unknown()).optional()}),K_=S.object({streaming:S.boolean().optional(),websocket:S.boolean().optional(),httpBinary:S.boolean().optional(),pushNotifications:S.boolean().optional(),resumable:S.boolean().optional()}),Y_=S.object({supported:S.boolean().optional(),items:S.array(Hv).optional(),parallelCalls:S.boolean().optional(),clientProvided:S.boolean().optional()}),X_=S.object({structuredOutput:S.boolean().optional(),supportedMimeTypes:S.array(S.string()).optional()}),Z_=S.object({snapshots:S.boolean().optional(),deltas:S.boolean().optional(),memory:S.boolean().optional(),persistentState:S.boolean().optional()}),J_=S.object({supported:S.boolean().optional(),delegation:S.boolean().optional(),handoffs:S.boolean().optional(),subAgents:S.array(z_).optional()}),ek=S.object({supported:S.boolean().optional(),streaming:S.boolean().optional(),encrypted:S.boolean().optional()}),tk=S.object({image:S.boolean().optional(),audio:S.boolean().optional(),video:S.boolean().optional(),pdf:S.boolean().optional(),file:S.boolean().optional()}),rk=S.object({image:S.boolean().optional(),audio:S.boolean().optional()}),nk=S.object({input:tk.optional(),output:rk.optional()}),ok=S.object({codeExecution:S.boolean().optional(),sandboxed:S.boolean().optional(),maxIterations:S.number().optional(),maxExecutionTime:S.number().optional()}),ik=S.object({supported:S.boolean().optional(),approvals:S.boolean().optional(),interventions:S.boolean().optional(),feedback:S.boolean().optional(),interrupts:S.boolean().optional(),approveWithEdits:S.boolean().optional()}),Z8=S.object({identity:W_.optional(),transport:K_.optional(),tools:Y_.optional(),output:X_.optional(),state:Z_.optional(),multiAgent:J_.optional(),reasoning:ek.optional(),multimodal:nk.optional(),execution:ok.optional(),humanInTheLoop:ik.optional(),custom:S.record(S.unknown()).optional()}),zv=S.union([S.literal("developer"),S.literal("system"),S.literal("assistant"),S.literal("user")]),F=function(e){return e.TEXT_MESSAGE_START="TEXT_MESSAGE_START",e.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",e.TEXT_MESSAGE_END="TEXT_MESSAGE_END",e.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",e.TOOL_CALL_START="TOOL_CALL_START",e.TOOL_CALL_ARGS="TOOL_CALL_ARGS",e.TOOL_CALL_END="TOOL_CALL_END",e.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",e.TOOL_CALL_RESULT="TOOL_CALL_RESULT",e.THINKING_START="THINKING_START",e.THINKING_END="THINKING_END",e.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",e.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",e.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",e.STATE_SNAPSHOT="STATE_SNAPSHOT",e.STATE_DELTA="STATE_DELTA",e.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",e.ACTIVITY_SNAPSHOT="ACTIVITY_SNAPSHOT",e.ACTIVITY_DELTA="ACTIVITY_DELTA",e.RAW="RAW",e.CUSTOM="CUSTOM",e.RUN_STARTED="RUN_STARTED",e.RUN_FINISHED="RUN_FINISHED",e.RUN_ERROR="RUN_ERROR",e.STEP_STARTED="STEP_STARTED",e.STEP_FINISHED="STEP_FINISHED",e.REASONING_START="REASONING_START",e.REASONING_MESSAGE_START="REASONING_MESSAGE_START",e.REASONING_MESSAGE_CONTENT="REASONING_MESSAGE_CONTENT",e.REASONING_MESSAGE_END="REASONING_MESSAGE_END",e.REASONING_MESSAGE_CHUNK="REASONING_MESSAGE_CHUNK",e.REASONING_END="REASONING_END",e.REASONING_ENCRYPTED_VALUE="REASONING_ENCRYPTED_VALUE",e.SUBAGENT_STARTED="SUBAGENT_STARTED",e.SUBAGENT_FINISHED="SUBAGENT_FINISHED",e.SUBAGENT_ERROR="SUBAGENT_ERROR",e}({}),Ie=S.object({type:S.nativeEnum(F),timestamp:S.number().optional(),rawEvent:S.any().optional(),metadata:Fn}).passthrough(),ak=Ie.extend({type:S.literal(F.TEXT_MESSAGE_START),messageId:S.string(),role:zv.default("assistant"),name:S.string().optional(),subagentRunId:S.string().optional()}),Wv=Ie.extend({type:S.literal(F.TEXT_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),sk=Ie.extend({type:S.literal(F.TEXT_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),ck=Ie.extend({type:S.literal(F.TEXT_MESSAGE_CHUNK),messageId:S.string().optional(),role:zv.optional(),delta:S.string().optional(),name:S.string().optional(),subagentRunId:S.string().optional()}),uk=Ie.extend({type:S.literal(F.THINKING_TEXT_MESSAGE_START)}),lk=Wv.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:S.literal(F.THINKING_TEXT_MESSAGE_CONTENT)}),dk=Ie.extend({type:S.literal(F.THINKING_TEXT_MESSAGE_END)}),pk=Ie.extend({type:S.literal(F.TOOL_CALL_START),toolCallId:S.string(),toolCallName:S.string(),parentMessageId:S.string().nullable().optional().transform(e=>e??void 0),subagentRunId:S.string().optional()}),fk=Ie.extend({type:S.literal(F.TOOL_CALL_ARGS),toolCallId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),mk=Ie.extend({type:S.literal(F.TOOL_CALL_END),toolCallId:S.string(),subagentRunId:S.string().optional()}),gk=Ie.extend({messageId:S.string(),type:S.literal(F.TOOL_CALL_RESULT),toolCallId:S.string(),content:S.string(),role:S.literal("tool").optional(),subagentRunId:S.string().optional()}),hk=Ie.extend({type:S.literal(F.TOOL_CALL_CHUNK),toolCallId:S.string().optional(),toolCallName:S.string().optional(),parentMessageId:S.string().nullable().optional().transform(e=>e??void 0),delta:S.string().optional(),subagentRunId:S.string().optional()}),yk=Ie.extend({type:S.literal(F.THINKING_START),title:S.string().optional()}),vk=Ie.extend({type:S.literal(F.THINKING_END)}),Sk=Ie.extend({type:S.literal(F.STATE_SNAPSHOT),snapshot:H_,subagentRunId:S.string().optional()}),bk=Ie.extend({type:S.literal(F.STATE_DELTA),delta:S.array(S.any()),subagentRunId:S.string().optional()}),Ak=Ie.extend({type:S.literal(F.MESSAGES_SNAPSHOT),messages:S.array(Qv)}),wk=Ie.extend({type:S.literal(F.ACTIVITY_SNAPSHOT),messageId:S.string(),activityType:S.string(),content:S.record(S.any()),replace:S.boolean().optional().default(!0),subagentRunId:S.string().optional()}),xk=Ie.extend({type:S.literal(F.ACTIVITY_DELTA),messageId:S.string(),activityType:S.string(),patch:S.array(S.any()),subagentRunId:S.string().optional()}),Ck=Ie.extend({type:S.literal(F.RAW),event:S.any(),source:S.string().optional(),subagentRunId:S.string().optional()}),Ek=Ie.extend({type:S.literal(F.CUSTOM),name:S.string(),value:S.any(),subagentRunId:S.string().optional()}),Rk=Ie.extend({type:S.literal(F.RUN_STARTED),threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),input:Q_.optional()}),Ik=S.object({type:S.literal("success")}).strict(),Tk=S.object({type:S.literal("interrupt"),interrupts:S.array(B_).min(1)}).strict(),_k=S.discriminatedUnion("type",[Ik,Tk]),Kv=S.object({provider:S.string().optional(),model:S.string().optional(),inputTokens:S.number().int().nonnegative().optional(),outputTokens:S.number().int().nonnegative().optional(),totalTokens:S.number().int().nonnegative().optional(),reasoningTokens:S.number().int().nonnegative().optional(),cachedInputTokens:S.number().int().nonnegative().optional()}),kk=Ie.extend({type:S.literal(F.RUN_FINISHED),threadId:S.string(),runId:S.string(),result:S.any().optional(),outcome:_k.nullable().optional().transform(e=>e??void 0),usage:S.array(Kv).optional()}),Ok=Ie.extend({type:S.literal(F.RUN_ERROR),message:S.string(),code:S.string().optional(),usage:S.array(Kv).optional()}),Pk=Ie.extend({type:S.literal(F.STEP_STARTED),stepName:S.string(),subagentRunId:S.string().optional()}),Nk=Ie.extend({type:S.literal(F.STEP_FINISHED),stepName:S.string(),subagentRunId:S.string().optional()}),Fk=S.union([S.literal("tool-call"),S.literal("message")]),Dk=Ie.extend({type:S.literal(F.REASONING_START),messageId:S.string(),subagentRunId:S.string().optional()}),Mk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_START),messageId:S.string(),role:S.literal("reasoning"),subagentRunId:S.string().optional()}),Lk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),qk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),jk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_CHUNK),messageId:S.string().optional(),delta:S.string().optional(),subagentRunId:S.string().optional()}),Uk=Ie.extend({type:S.literal(F.REASONING_END),messageId:S.string(),subagentRunId:S.string().optional()}),Vk=Ie.extend({type:S.literal(F.REASONING_ENCRYPTED_VALUE),subtype:Fk,entityId:S.string(),encryptedValue:S.string(),subagentRunId:S.string().optional()}),Gk=Ie.extend({type:S.literal(F.SUBAGENT_STARTED),subagentRunId:S.string(),name:S.string(),description:S.string().optional(),parentSubagentRunId:S.string().optional(),parentToolCallId:S.string().optional(),parentMessageId:S.string().optional()}),Bk=S.object({type:S.literal("success")}).strict(),$k=S.object({type:S.literal("suspended"),interruptIds:S.array(S.string()).optional()}).strict(),Qk=S.discriminatedUnion("type",[Bk,$k]),Hk=Ie.extend({type:S.literal(F.SUBAGENT_FINISHED),subagentRunId:S.string(),result:S.any().optional(),outcome:Qk.optional()}),zk=Ie.extend({type:S.literal(F.SUBAGENT_ERROR),subagentRunId:S.string(),message:S.string(),code:S.string().optional()}),_c=S.discriminatedUnion("type",[ak,Wv,sk,ck,yk,vk,uk,lk,dk,pk,fk,mk,hk,gk,Sk,bk,Ak,wk,xk,Ck,Ek,Rk,kk,Ok,Pk,Nk,Dk,Mk,Lk,qk,jk,Uk,Vk,Gk,Hk,zk]);m();d();f();p();var $p={};ui($p,{JsonPatchError:()=>$e,_areEquals:()=>fa,applyOperation:()=>Dn,applyPatch:()=>Mc,applyReducer:()=>Zk,deepClone:()=>Yk,getValueByPointer:()=>Fc,validate:()=>Xv,validator:()=>Dc});m();d();f();p();m();d();f();p();var Wk=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),Kk=Object.prototype.hasOwnProperty;function Oc(e,t){return Kk.call(e,t)}function Pc(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var o in e)Oc(e,o)&&n.push(o);return n}function ct(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Nc(e){for(var t=0,r=e.length,n;t<r;){if(n=e.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0}function rr(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function da(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function kc(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(kc(e[t]))return!0}else if(typeof e=="object"){for(var n=Pc(e),o=n.length,i=0;i<o;i++)if(kc(e[n[i]]))return!0}}return!1}function Yv(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
|
|
33
|
+
`)}var pa=function(e){Wk(t,e);function t(r,n,o,i,a){var s=this.constructor,u=e.call(this,Yv(r,{name:n,index:o,operation:i,tree:a}))||this;return u.name=n,u.index=o,u.operation=i,u.tree=a,Object.setPrototypeOf(u,s.prototype),u.message=Yv(r,{name:n,index:o,operation:i,tree:a}),u}return t}(Error);var $e=pa,Yk=ct,Vo={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=Fc(r,this.path);n&&(n=ct(n));var o=Dn(r,{op:"remove",path:this.from}).removed;return Dn(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Fc(r,this.from);return Dn(r,{op:"add",path:this.path,value:ct(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:fa(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},Xk={add:function(e,t,r){return Nc(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:Vo.move,copy:Vo.copy,test:Vo.test,_get:Vo._get};function Fc(e,t){if(t=="")return e;var r={op:"_get",path:t};return Dn(e,r),r.value}function Dn(e,t,r,n,o,i){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),i===void 0&&(i=0),r&&(typeof r=="function"?r(t,0,e,t.path):Dc(t,0)),t.path===""){var a={newDocument:e};if(t.op==="add")return a.newDocument=t.value,a;if(t.op==="replace")return a.newDocument=t.value,a.removed=e,a;if(t.op==="move"||t.op==="copy")return a.newDocument=Fc(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=fa(e,t.value),a.test===!1)throw new $e("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a.newDocument=e,a}else{if(t.op==="remove")return a.removed=e,a.newDocument=null,a;if(t.op==="_get")return t.value=e,a;if(r)throw new $e("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{n||(e=ct(e));var s=t.path||"",u=s.split("/"),c=e,g=1,v=u.length,R=void 0,h=void 0,y=void 0;for(typeof r=="function"?y=r:y=Dc;;){if(h=u[g],h&&h.indexOf("~")!=-1&&(h=da(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&u[g-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&R===void 0&&(c[h]===void 0?R=u.slice(0,g).join("/"):g==v-1&&(R=t.path),R!==void 0&&y(t,0,e,R)),g++,Array.isArray(c)){if(h==="-")h=c.length;else{if(r&&!Nc(h))throw new $e("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,t,e);Nc(h)&&(h=~~h)}if(g>=v){if(r&&t.op==="add"&&h>c.length)throw new $e("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);var a=Xk[t.op].call(t,c,h,e);if(a.test===!1)throw new $e("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(g>=v){var a=Vo[t.op].call(t,c,h,e);if(a.test===!1)throw new $e("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(c=c[h],r&&g<v&&(!c||typeof c!="object"))throw new $e("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function Mc(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new $e("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=ct(e));for(var i=new Array(t.length),a=0,s=t.length;a<s;a++)i[a]=Dn(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function Zk(e,t,r){var n=Dn(e,t);if(n.test===!1)throw new $e("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Dc(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new $e("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Vo[e.op]){if(typeof e.path!="string")throw new $e("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new $e("Operation `path` property must start with \"/\"","OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new $e("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new $e("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&kc(e.value))throw new $e("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var o=e.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new $e("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new $e("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var a={op:"_get",path:e.from,value:void 0},s=Xv([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new $e("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new $e("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function Xv(e,t,r){try{if(!Array.isArray(e))throw new $e("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Mc(ct(t),ct(e),r||!0);else{r=r||Dc;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof $e)return o;throw o}}function fa(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),o,i,a;if(r&&n){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!fa(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var s=Object.keys(e);if(i=s.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(s[o]))return!1;for(o=i;o--!==0;)if(a=s[o],!fa(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var Wp={};ui(Wp,{compare:()=>aO,generate:()=>Qp,observe:()=>iO,unobserve:()=>oO});m();d();f();p();var Hp=new WeakMap,Jk=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),eO=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function tO(e){return Hp.get(e)}function rO(e,t){return e.observers.get(t)}function nO(e,t){e.observers.delete(t.callback)}function oO(e,t){t.unobserve()}function iO(e,t){var r=[],n,o=tO(e);if(!o)o=new Jk(e),Hp.set(e,o);else{var i=rO(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=ct(e),t){n.callback=t,n.next=null;var a=function(){Qp(n)},s=function(){clearTimeout(n.next),n.next=setTimeout(a)};typeof window<"u"&&(window.addEventListener("mouseup",s),window.addEventListener("keyup",s),window.addEventListener("mousedown",s),window.addEventListener("keydown",s),window.addEventListener("change",s))}return n.patches=r,n.object=e,n.unobserve=function(){Qp(n),clearTimeout(n.next),nO(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",s),window.removeEventListener("keyup",s),window.removeEventListener("mousedown",s),window.removeEventListener("keydown",s),window.removeEventListener("change",s))},o.observers.set(t,new eO(t,n)),n}function Qp(e,t){t===void 0&&(t=!1);var r=Hp.get(e.object);zp(r.value,e.object,e.patches,"",t),e.patches.length&&Mc(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function zp(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=Pc(t),a=Pc(e),s=!1,u=!1,c=a.length-1;c>=0;c--){var g=a[c],v=e[g];if(Oc(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var R=t[g];typeof v=="object"&&v!=null&&typeof R=="object"&&R!=null&&Array.isArray(v)===Array.isArray(R)?zp(v,R,r,n+"/"+rr(g),o):v!==R&&(s=!0,o&&r.push({op:"test",path:n+"/"+rr(g),value:ct(v)}),r.push({op:"replace",path:n+"/"+rr(g),value:ct(R)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+rr(g),value:ct(v)}),r.push({op:"remove",path:n+"/"+rr(g)}),u=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),s=!0)}if(!(!u&&i.length==a.length))for(var c=0;c<i.length;c++){var g=i[c];!Oc(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+rr(g),value:ct(t[g])})}}}function aO(e,t,r){r===void 0&&(r=!1);var n=[];return zp(e,t,n,"",r),n}var Lc=Object.assign({},$p,Wp,{JsonPatchError:pa,deepClone:ct,escapePathComponent:rr,unescapePathComponent:da});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Kp=function(e,t){return Kp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},Kp(e,t)};function nr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Kp(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Zv(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(g){try{c(n.next(g))}catch(v){a(v)}}function u(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})}function qc(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Ar(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Go(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-->0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function Bo(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function Mn(e){return this instanceof Mn?(this.v=e,this):new Mn(e)}function Jv(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(h){return function(y){return Promise.resolve(y).then(h,v)}}function s(h,y){n[h]&&(o[h]=function(b){return new Promise(function(x,I){i.push([h,b,x,I])>1||u(h,b)})},y&&(o[h]=y(o[h])))}function u(h,y){try{c(n[h](y))}catch(b){R(i[0][3],b)}}function c(h){h.value instanceof Mn?Promise.resolve(h.value.v).then(g,v):R(i[0][2],h)}function g(h){u("next",h)}function v(h){u("throw",h)}function R(h,y){h(y),i.shift(),i.length&&u(i[0][0],i[0][1])}}function eS(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Ar=="function"?Ar(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(s,u){a=e[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(c){i({value:c,done:s})},a)}}m();d();f();p();function Ee(e){return typeof e=="function"}m();d();f();p();m();d();f();p();m();d();f();p();function $o(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var jc=$o(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
34
34
|
`+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
|
|
35
|
-
`):"",this.name="UnsubscriptionError",this.errors=r}});m();d();f();p();function ca(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Vo=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=Sr(a),c=s.next();!c.done;c=s.next()){var u=c.value;u.remove(this)}}catch(S){t={error:S}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}else a.remove(this);var h=this.initialTeardown;if(xe(h))try{h()}catch(S){i=S instanceof Nc?S.errors:[S]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var C=Sr(v),g=C.next();!g.done;g=C.next()){var y=g.value;try{Gv(y)}catch(S){i=i??[],S instanceof Nc?i=Lo(Lo([],jo(i)),jo(S.errors)):i.push(S)}}}catch(S){n={error:S}}finally{try{g&&!g.done&&(o=C.return)&&o.call(C)}finally{if(n)throw n.error}}}if(i)throw new Nc(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Gv(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&ca(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&ca(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var jp=Vo.EMPTY;function Fc(e){return e instanceof Vo||e&&"closed"in e&&xe(e.remove)&&xe(e.add)&&xe(e.unsubscribe)}function Gv(e){xe(e)?e():e.unsubscribe()}m();d();f();p();var Vt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var Bo={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Bo.delegate;return o?.setTimeout?o.setTimeout.apply(o,Lo([e,t],jo(r))):setTimeout.apply(void 0,Lo([e,t],jo(r)))},clearTimeout:function(e){var t=Bo.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Dc(e){Bo.setTimeout(function(){var t=Vt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function ua(){}m();d();f();p();var $v=function(){return Lp("C",void 0,void 0)}();function Qv(e){return Lp("E",void 0,e)}function Hv(e){return Lp("N",e,void 0)}function Lp(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var Nn=null;function Go(e){if(Vt.useDeprecatedSynchronousErrorHandling){var t=!Nn;if(t&&(Nn={errorThrown:!1,error:null}),e(),t){var r=Nn,n=r.errorThrown,o=r.error;if(Nn=null,n)throw o}}else e()}function zv(e){Vt.useDeprecatedSynchronousErrorHandling&&Nn&&(Nn.errorThrown=!0,Nn.error=e)}var la=function(e){tr(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Fc(r)&&r.add(n)):n.destination=Fk,n}return t.create=function(r,n,o){return new qc(r,n,o)},t.prototype.next=function(r){this.isStopped?Vp(Hv(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Vp(Qv(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Vp($v,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Vo);var Ok=Function.prototype.bind;function Up(e,t){return Ok.call(e,t)}var Pk=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Mc(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Mc(n)}else Mc(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Mc(r)}},e}(),qc=function(e){tr(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(xe(r)||!r)a={next:r??void 0,error:n??void 0,complete:o??void 0};else{var s;i&&Vt.useDeprecatedNextContext?(s=Object.create(r),s.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&Up(r.next,s),error:r.error&&Up(r.error,s),complete:r.complete&&Up(r.complete,s)}):a=r}return i.destination=new Pk(a),i}return t}(la);function Mc(e){Vt.useDeprecatedSynchronousErrorHandling?zv(e):Dc(e)}function Nk(e){throw e}function Vp(e,t){var r=Vt.onStoppedNotification;r&&Bo.setTimeout(function(){return r(e,t)})}var Fk={closed:!0,next:ua,error:Nk,complete:ua};m();d();f();p();var $o=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function Qo(e){return e}function jc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Bp(e)}function Bp(e){return e.length===0?Qo:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var Ue=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var o=this,i=Mk(t)?t:new qc(t,r,n);return Go(function(){var a=o,s=a.operator,c=a.source;i.add(s?s.call(i,c):c?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=Wv(r),new r(function(o,i){var a=new qc({next:function(s){try{t(s)}catch(c){i(c),a.unsubscribe()}},error:i,complete:o});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[$o]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Bp(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=Wv(t),new t(function(n,o){var i;r.subscribe(function(a){return i=a},function(a){return o(a)},function(){return n(i)})})},e.create=function(t){return new e(t)},e}();function Wv(e){var t;return(t=e??Vt.Promise)!==null&&t!==void 0?t:Promise}function Dk(e){return e&&xe(e.next)&&xe(e.error)&&xe(e.complete)}function Mk(e){return e&&e instanceof la||Dk(e)&&Fc(e)}m();d();f();p();function qk(e){return xe(e?.lift)}function ze(e){return function(t){if(qk(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}m();d();f();p();function Ye(e,t,r,n,o){return new jk(e,t,r,n,o)}var jk=function(e){tr(t,e);function t(r,n,o,i,a,s){var c=e.call(this,r)||this;return c.onFinalize=a,c.shouldUnsubscribe=s,c._next=n?function(u){try{n(u)}catch(h){r.error(h)}}:e.prototype._next,c._error=i?function(u){try{i(u)}catch(h){r.error(h)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=o?function(){try{o()}catch(u){r.error(u)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(la);m();d();f();p();m();d();f();p();var Kv=Uo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var rr=function(e){tr(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new Yv(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new Kv},t.prototype.next=function(r){var n=this;Go(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=Sr(n.currentObservers),s=a.next();!s.done;s=a.next()){var c=s.value;c.next(r)}}catch(u){o={error:u}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;Go(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},t.prototype.complete=function(){var r=this;Go(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,a=o.isStopped,s=o.observers;return i||a?jp:(this.currentObservers=null,s.push(r),new Vo(function(){n.currentObservers=null,ca(s,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,a=n.isStopped;o?r.error(i):a&&r.complete()},t.prototype.asObservable=function(){var r=new Ue;return r.source=this,r},t.create=function(r,n){return new Yv(r,n)},t}(Ue);var Yv=function(e){tr(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:jp},t}(rr);m();d();f();p();m();d();f();p();var Gp={now:function(){return(Gp.delegate||Date).now()},delegate:void 0};var Lc=function(e){tr(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=Gp);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,a=n._infiniteTimeWindow,s=n._timestampProvider,c=n._windowTime;o||(i.push(r),!a&&i.push(s.now()+c)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,i=o._infiniteTimeWindow,a=o._buffer,s=a.slice(),c=0;c<s.length&&!r.closed;c+=i?1:2)r.next(s[c]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,i=r._buffer,a=r._infiniteTimeWindow,s=(a?1:2)*n;if(n<1/0&&s<i.length&&i.splice(0,i.length-s),!a){for(var c=o.now(),u=0,h=1;h<i.length&&i[h]<=c;h+=2)u=h;u&&i.splice(0,u+1)}},t}(rr);m();d();f();p();var Uc=new Ue(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function Xv(e){return e&&xe(e.schedule)}function Lk(e){return e[e.length-1]}function Zv(e){return Xv(Lk(e))?e.pop():void 0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Vc=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function Bc(e){return xe(e?.then)}m();d();f();p();function Gc(e){return xe(e[$o])}m();d();f();p();function $c(e){return Symbol.asyncIterator&&xe(e?.[Symbol.asyncIterator])}m();d();f();p();function Qc(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}m();d();f();p();m();d();f();p();function Uk(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Hc=Uk();function zc(e){return xe(e?.[Hc])}m();d();f();p();function Wc(e){return Vv(this,arguments,function(){var r,n,o,i;return Pc(this,function(a){switch(a.label){case 0:r=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Pn(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,Pn(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Pn(o)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function Kc(e){return xe(e?.getReader)}function Xe(e){if(e instanceof Ue)return e;if(e!=null){if(Gc(e))return Vk(e);if(Vc(e))return Bk(e);if(Bc(e))return Gk(e);if($c(e))return Jv(e);if(zc(e))return $k(e);if(Kc(e))return Qk(e)}throw Qc(e)}function Vk(e){return new Ue(function(t){var r=e[$o]();if(xe(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Bk(e){return new Ue(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function Gk(e){return new Ue(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Dc)})}function $k(e){return new Ue(function(t){var r,n;try{for(var o=Sr(e),i=o.next();!i.done;i=o.next()){var a=i.value;if(t.next(a),t.closed)return}}catch(s){r={error:s}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function Jv(e){return new Ue(function(t){Hk(e,t).catch(function(r){return t.error(r)})})}function Qk(e){return Jv(Wc(e))}function Hk(e,t){var r,n,o,i;return Uv(this,void 0,void 0,function(){var a,s;return Pc(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=Bv(e),c.label=1;case 1:return[4,r.next()];case 2:if(n=c.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=c.sent(),o={error:s},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}m();d();f();p();m();d();f();p();function Ft(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!o)return i}function Yc(e,t){return t===void 0&&(t=0),ze(function(r,n){r.subscribe(Ye(n,function(o){return Ft(n,e,function(){return n.next(o)},t)},function(){return Ft(n,e,function(){return n.complete()},t)},function(o){return Ft(n,e,function(){return n.error(o)},t)}))})}m();d();f();p();function Xc(e,t){return t===void 0&&(t=0),ze(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function eS(e,t){return Xe(e).pipe(Xc(t),Yc(t))}m();d();f();p();function tS(e,t){return Xe(e).pipe(Xc(t),Yc(t))}m();d();f();p();function rS(e,t){return new Ue(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}m();d();f();p();function nS(e,t){return new Ue(function(r){var n;return Ft(r,t,function(){n=e[Hc](),Ft(r,t,function(){var o,i,a;try{o=n.next(),i=o.value,a=o.done}catch(s){r.error(s);return}a?r.complete():r.next(i)},0,!0)}),function(){return xe(n?.return)&&n.return()}})}m();d();f();p();function Zc(e,t){if(!e)throw new Error("Iterable cannot be null");return new Ue(function(r){Ft(r,t,function(){var n=e[Symbol.asyncIterator]();Ft(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}m();d();f();p();function oS(e,t){return Zc(Wc(e),t)}function iS(e,t){if(e!=null){if(Gc(e))return eS(e,t);if(Vc(e))return rS(e,t);if(Bc(e))return tS(e,t);if($c(e))return Zc(e,t);if(zc(e))return nS(e,t);if(Kc(e))return oS(e,t)}throw Qc(e)}function Fn(e,t){return t?iS(e,t):Xe(e)}function Ge(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Zv(e);return Fn(e,r)}m();d();f();p();function Ve(e,t){var r=xe(e)?e:function(){return e},n=function(o){return o.error(r())};return new Ue(t?function(o){return t.schedule(n,0,o)}:n)}m();d();f();p();m();d();f();p();var aS=Uo(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Jc(e,t){var r=typeof t=="object";return new Promise(function(n,o){var i=!1,a;e.subscribe({next:function(s){a=s,i=!0},error:o,complete:function(){i?n(a):r?n(t.defaultValue):o(new aS)}})})}m();d();f();p();function Dn(e,t){return ze(function(r,n){var o=0;r.subscribe(Ye(n,function(i){n.next(e.call(t,i,o++))}))})}m();d();f();p();m();d();f();p();m();d();f();p();function sS(e,t,r,n,o,i,a,s){var c=[],u=0,h=0,v=!1,C=function(){v&&!c.length&&!u&&t.complete()},g=function(S){return u<n?y(S):c.push(S)},y=function(S){i&&t.next(S),u++;var E=!1;Xe(r(S,h++)).subscribe(Ye(t,function(R){o?.(R),i?g(R):t.next(R)},function(){E=!0},void 0,function(){if(E)try{u--;for(var R=function(){var k=c.shift();a?Ft(t,a,function(){return y(k)}):y(k)};c.length&&u<n;)R();C()}catch(k){t.error(k)}}))};return e.subscribe(Ye(t,g,function(){v=!0,C()})),function(){s?.()}}function wt(e,t,r){return r===void 0&&(r=1/0),xe(t)?wt(function(n,o){return Dn(function(i,a){return t(n,i,o,a)})(Xe(e(n,o)))},r):(typeof t=="number"&&(r=t),ze(function(n,o){return sS(n,o,e,r)}))}function $p(e){return e===void 0&&(e=1/0),wt(Qo,e)}m();d();f();p();function eu(e){return new Ue(function(t){Xe(e()).subscribe(t)})}m();d();f();p();function da(e){return ze(function(t,r){var n=null,o=!1,i;n=t.subscribe(Ye(r,void 0,void 0,function(a){i=Xe(e(a,da(e)(t))),n?(n.unsubscribe(),n=null,i.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(r))})}m();d();f();p();function tu(e,t){return xe(t)?wt(e,t,1):wt(e,1)}m();d();f();p();function Qp(e){return ze(function(t,r){var n=!1;t.subscribe(Ye(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}m();d();f();p();function Mn(e){return ze(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function Hp(e,t){return ze(function(r,n){var o=null,i=0,a=!1,s=function(){return a&&!o&&n.complete()};r.subscribe(Ye(n,function(c){o?.unsubscribe();var u=0,h=i++;Xe(e(c,h)).subscribe(o=Ye(n,function(v){return n.next(t?t(c,v,h,u++):v)},function(){o=null,s()}))},function(){a=!0,s()}))})}m();d();f();p();function ru(e){return ze(function(t,r){Xe(e).subscribe(Ye(r,function(){return r.complete()},ua)),!r.closed&&t.subscribe(r)})}m();d();f();p();function zp(e,t,r){var n=xe(e)||t||r?{next:e,error:t,complete:r}:e;return n?ze(function(o,i){var a;(a=n.subscribe)===null||a===void 0||a.call(n);var s=!0;o.subscribe(Ye(i,function(c){var u;(u=n.next)===null||u===void 0||u.call(n,c),i.next(c)},function(){var c;s=!1,(c=n.complete)===null||c===void 0||c.call(n),i.complete()},function(c){var u;s=!1,(u=n.error)===null||u===void 0||u.call(n,c),i.error(c)},function(){var c,u;s&&((c=n.unsubscribe)===null||c===void 0||c.call(n)),(u=n.finalize)===null||u===void 0||u.call(n)}))}):Qo}m();d();f();p();m();d();f();p();function cS(e){return` \r
|
|
36
|
-
`.indexOf(e)>=0}function nu(e){for(var t=["topLevel"],r=0,n,o,i,a=function(k){return t.push(k)},s=function(k){return t[t.length-1]=k},c=function(k){n==null&&(n=r,o=t.length,i=k)},u=function(k){k===i&&(n=void 0,o=void 0,i=void 0)},h=function(){return t.pop()},v=function(){return r--},C=function(k){if("0"<=k&&k<="9"){a("number");return}switch(k){case"\"":a("string");return;case"-":a("numberNeedsDigit");return;case"t":a("true");return;case"f":a("false");return;case"n":a("null");return;case"[":a("arrayNeedsValue");return;case"{":a("objectNeedsKey");return}},g=e.length;r<g;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":C(y);break;case"string":switch(y){case"\"":h();break;case"\\":c("stringEscape"),a("stringEscaped");break}break;case"stringEscaped":y==="u"?a("stringUnicode"):(u("stringEscape"),h());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(u("stringEscape"),h());break;case"number":y==="."?s("numberNeedsDigit"):y==="e"||y==="E"?s("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),h());break;case"numberNeedsDigit":s("number");break;case"numberNeedsExponent":s(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),h());break;case"arrayNeedsValue":y==="]"?h():cS(y)||(u("collectionItem"),s("arrayNeedsComma"),C(y));break;case"arrayNeedsComma":y==="]"?h():y===","&&(c("collectionItem"),s("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?h():y==="\""&&(c("collectionItem"),s("objectNeedsColon"),a("string"));break;case"objectNeedsColon":y===":"&&s("objectNeedsValue");break;case"objectNeedsValue":cS(y)||(u("collectionItem"),s("objectNeedsComma"),C(y));break;case"objectNeedsComma":y==="}"?h():y===","&&(c("collectionItem"),s("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var S=[n!=null?e.slice(0,n):e],E=function(k){return S.push(k.slice(e.length-e.lastIndexOf(k[0])))},R=t.length-1;R>=0;R--)switch(t[R]){case"string":S.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":S.push("0");break;case"true":E("true");break;case"false":E("false");break;case"null":E("null");break;case"arrayNeedsValue":case"arrayNeedsComma":S.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":S.push("}");break}return S.join("")}m();d();f();p();m();d();f();p();m();d();f();p();function lS(){let e=this.buf,t=this.pos,r=0,n=0;for(let i=0;i<28;i+=7){let a=e[t++];if(r|=(a&127)<<i,(a&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}let o=e[t++];if(r|=(o&15)<<28,n=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}for(let i=3;i<=31;i+=7){let a=e[t++];if(n|=(a&127)<<i,(a&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}throw new Error("invalid varint")}var ou=4294967296;function Wp(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(a,s){let c=Number(e.slice(a,s));o*=r,n=n*r+c,n>=ou&&(o=o+(n/ou|0),n=n%ou)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?pS(n,o):Yp(n,o)}function dS(e,t){let r=Yp(e,t),n=r.hi&2147483648;n&&(r=pS(r.lo,r.hi));let o=Kp(r.lo,r.hi);return n?"-"+o:o}function Kp(e,t){if({lo:e,hi:t}=zk(e,t),t<=2097151)return String(ou*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,i=r+n*6777216+o*6710656,a=n+o*8147497,s=o*2,c=1e7;return i>=c&&(a+=Math.floor(i/c),i%=c),a>=c&&(s+=Math.floor(a/c),a%=c),s.toString()+uS(a)+uS(i)}function zk(e,t){return{lo:e>>>0,hi:t>>>0}}function Yp(e,t){return{lo:e|0,hi:t|0}}function pS(e,t){return t=~t,e?e=~e+1:t+=1,Yp(e,t)}var uS=e=>{let t=String(e);return"0000000".slice(t.length)+t};function fS(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)===0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();f();p();var Bt=Wk();function Wk(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!w.Deno||!!w.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){let s=typeof a=="bigint"?a:BigInt(a);if(s>n||s<r)throw new Error(`invalid int64: ${a}`);return s},uParse(a){let s=typeof a=="bigint"?a:BigInt(a);if(s>i||s<o)throw new Error(`invalid uint64: ${a}`);return s},enc(a){return e.setBigInt64(0,this.parse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(a){return e.setBigInt64(0,this.uParse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(a,s){return e.setInt32(0,a,!0),e.setInt32(4,s,!0),e.getBigInt64(0,!0)},uDec(a,s){return e.setInt32(0,a,!0),e.setInt32(4,s,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),mS(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),gS(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),mS(r),Wp(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),gS(r),Wp(r)},dec(r,n){return dS(r,n)},uDec(r,n){return Kp(r,n)}}}function mS(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function gS(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var Xp;function Kk(e){var t;Xp=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:Jp(e.encodeUtf8.bind(e))})}function Zp(){if(!Xp){let e=w;if(!e.TextEncoder||!e.TextDecoder)throw new Error("encoding API missing: install TextEncoder and TextDecoder on globalThis");let t=new e.TextEncoder,r=new e.TextDecoder,n,o={encodeUtf8(a){return t.encode(a)},decodeUtf8(a,s){return s?(n||(n=new e.TextDecoder("utf-8",{fatal:!0})),n.decode(a)):r.decode(a)},checkUtf8(a){try{return encodeURIComponent(a),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let i=String.prototype.isWellFormed;i&&(o.checkUtf8=a=>i.call(a)),Kk(o)}return Xp}function Jp(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var Gr;(function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"})(Gr||(Gr={}));var Yk=34028234663852886e22,Xk=-34028234663852886e22,Zk=4294967295,Jk=2147483647,eO=-2147483648,ve=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?Jp(t):Zp().encodeUtf8Into,this.buffer=yS,this.viewCache=rO,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||tO;for(;n<r;)n*=2;let o=new Uint8Array(n);this.pos>0&&o.set(this.buffer),this.buffer=o}}view(){let t=this.buffer,r=this.viewCache;if(r.byteLength===t.byteLength)return r;let n=new DataView(t.buffer);return this.viewCache=n,n}finish(){let t=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],t}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(pa),this.buffer[this.pos++]=0,this}join(){let t=this.stackPos.pop();if(t===void 0)throw new Error("invalid state, fork stack empty");let r=this.pos-t-pa,n=ef(r);return n>pa&&(this.ensureCapacity(n-pa),this.buffer.copyWithin(t+n,t+pa,this.pos)),this.pos=t,this.uint32(r),this.pos+=r,this}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if(hS(t),this.ensureCapacity(5),t<128)return this.buffer[this.pos++]=t,this;for(;t>127;)this.buffer[this.pos++]=t&127|128,t>>>=7;return this.buffer[this.pos++]=t,this}int32(t){if(tf(t),t>=0)return this.uint32(t);this.ensureCapacity(10);for(let r=0;r<9;r++)this.buffer[this.pos++]=t&127|128,t>>=7;return this.buffer[this.pos++]=1,this}bool(t){return this.ensureCapacity(1),this.buffer[this.pos++]=t?1:0,this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){typeof t!="string"&&(t=String(t));let r=t.length;if(r<=vS){this.ensureCapacity(r+1);let c=this.buffer,u=this.pos;c[u++]=r;let h=0;for(;h<r;h++){let v=t.charCodeAt(h);if(v>127)break;c[u++]=v}if(h==r)return this.pos=u,this}this.ensureCapacity(r*3+5);let n=ef(r),o=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(t,o.subarray(i+n)),s=ef(a);return s!=n&&o.copyWithin(i+s,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(t){return nO(t),this.ensureCapacity(4),this.view().setFloat32(this.pos,t,!0),this.pos+=4,this}double(t){return this.ensureCapacity(8),this.view().setFloat64(this.pos,t,!0),this.pos+=8,this}fixed32(t){return hS(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return tf(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return tf(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=Bt.enc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}fixed64(t){let r=Bt.uEnc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}int64(t){let r=Bt.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=Bt.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return this.writeVarint64(o,i)}uint64(t){let r=Bt.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let s=0;s<28;s=s+7){let c=t>>>s,u=!(!(c>>>7)&&r==0);if(n[o++]=(u?c|128:c)&255,!u)return this.pos=o,this}let i=t>>>28&15|(r&7)<<4,a=r>>3!=0;if(n[o++]=(a?i|128:i)&255,!a)return this.pos=o,this;for(let s=3;s<31;s=s+7){let c=r>>>s,u=!!(c>>>7);if(n[o++]=(u?c|128:c)&255,!u)return this.pos=o,this}return n[o++]=r>>>31&1,this.pos=o,this}},tO=128,pa=1,yS=new Uint8Array(0),rO=new DataView(yS.buffer),vS=32;function ef(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var J=class{constructor(t,r=Zp().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=lS,this.uint32=fS,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.pos,r=this.uint32(),n=this.pos-t;if(n>5||n==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=r>>>3,i=r&7;if(o<=0||i>5)throw new Error("illegal tag: field no "+o+" wire type "+i);return[o,i]}skip(t,r,n=100){let o=this.pos;switch(t){case Gr.Varint:for(;this.buf[this.pos++]&128;);break;case Gr.Bit64:this.pos+=4;case Gr.Bit32:this.pos+=4;break;case Gr.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Gr.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[a,s]=this.tag();if(s===Gr.EndGroup){if(r!==void 0&&a!==r)throw new Error("invalid end group tag");break}this.skip(s,a,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return this.varint64(),Bt.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Bt.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,r=this.varint64Hi,n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Bt.dec(t,r)}bool(){let t=this.buf[this.pos];return t<128?(this.pos++,t!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Bt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Bt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){let r=this.bytes(),n=r.length;if(n<=vS){let o=new Array(n);for(let i=0;i<n;i++){let a=r[i];if(a>127)return this.decodeUtf8(r,t);o[i]=a}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(r,t)}};function tf(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>Jk||e<eO)throw new Error("invalid int32: "+e)}function hS(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>Zk||e<0)throw new Error("invalid uint32: "+e)}function nO(e){if(typeof e=="string"){let t=e;if(e=Number(e),Number.isNaN(e)&&t!=="NaN")throw new Error("invalid float32: "+t)}else if(typeof e!="number")throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>Yk||e<Xk))throw new Error("invalid float32: "+e)}var oO=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function rf(){return{fields:{}}}var fa={encode(e,t=new ve){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&af.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=rf();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=af.decode(r,r.uint32());a.value!==void 0&&(o.fields[a.key]=a.value);continue}}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return fa.fromPartial(e??{})},fromPartial(e){let t=rf();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=rf();if(e!==void 0)for(let r of Object.keys(e))t.fields[r]=e[r];return t},unwrap(e){let t={};if(e.fields)for(let r of Object.keys(e.fields))t[r]=e.fields[r];return t}};function SS(){return{key:"",value:void 0}}var af={encode(e,t=new ve){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&ce.encode(ce.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=SS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=r.string();continue;case 2:if(i!==18)break;o.value=ce.unwrap(ce.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return af.fromPartial(e??{})},fromPartial(e){let t=SS();return t.key=e.key??"",t.value=e.value??void 0,t}};function nf(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var ce={encode(e,t=new ve){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&fa.encode(fa.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&ma.encode(ma.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=nf();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.nullValue=r.int32();continue;case 2:if(i!==17)break;o.numberValue=r.double();continue;case 3:if(i!==26)break;o.stringValue=r.string();continue;case 4:if(i!==32)break;o.boolValue=r.bool();continue;case 5:if(i!==42)break;o.structValue=fa.unwrap(fa.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=ma.unwrap(ma.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ce.fromPartial(e??{})},fromPartial(e){let t=nf();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=nf();if(e===null)t.nullValue=oO.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(w.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new w.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function of(){return{values:[]}}var ma={encode(e,t=new ve){for(let r of e.values)ce.encode(ce.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=of();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(ce.unwrap(ce.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ma.fromPartial(e??{})},fromPartial(e){let t=of();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=of();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&w.Array.isArray(e.values)?e.values:e}},iO=function(e){return e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.REPLACE=2]="REPLACE",e[e.MOVE=3]="MOVE",e[e.COPY=4]="COPY",e[e.TEST=5]="TEST",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function bS(){return{op:0,path:"",from:void 0,value:void 0}}var au={encode(e,t=new ve){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&ce.encode(ce.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=bS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.op=r.int32();continue;case 2:if(i!==18)break;o.path=r.string();continue;case 3:if(i!==26)break;o.from=r.string();continue;case 4:if(i!==34)break;o.value=ce.unwrap(ce.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return au.fromPartial(e??{})},fromPartial(e){let t=bS();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function wS(){return{id:"",type:"",function:void 0}}var su={encode(e,t=new ve){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&cu.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=wS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.type=r.string();continue;case 3:if(i!==26)break;o.function=cu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return su.fromPartial(e??{})},fromPartial(e){let t=wS();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?cu.fromPartial(e.function):void 0,t}};function AS(){return{name:"",arguments:""}}var cu={encode(e,t=new ve){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=AS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.name=r.string();continue;case 2:if(i!==18)break;o.arguments=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return cu.fromPartial(e??{})},fromPartial(e){let t=AS();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function xS(){return{value:"",mimeType:""}}var uu={encode(e,t=new ve){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==""&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=xS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return uu.fromPartial(e??{})},fromPartial(e){let t=xS();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function CS(){return{value:"",mimeType:void 0}}var lu={encode(e,t=new ve){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=CS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return lu.fromPartial(e??{})},fromPartial(e){let t=CS();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function ES(){return{data:void 0,url:void 0}}var Et={encode(e,t=new ve){return e.data!==void 0&&uu.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&lu.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=ES();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=uu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=lu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Et.fromPartial(e??{})},fromPartial(e){let t=ES();return t.data=e.data!==void 0&&e.data!==null?uu.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?lu.fromPartial(e.url):void 0,t}};function RS(){return{text:""}}var du={encode(e,t=new ve){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=RS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return du.fromPartial(e??{})},fromPartial(e){let t=RS();return t.text=e.text??"",t}};function IS(){return{source:void 0,metadata:void 0}}var pu={encode(e,t=new ve){return e.source!==void 0&&Et.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ce.encode(ce.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=IS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Et.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ce.unwrap(ce.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return pu.fromPartial(e??{})},fromPartial(e){let t=IS();return t.source=e.source!==void 0&&e.source!==null?Et.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function TS(){return{source:void 0,metadata:void 0}}var fu={encode(e,t=new ve){return e.source!==void 0&&Et.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ce.encode(ce.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=TS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Et.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ce.unwrap(ce.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return fu.fromPartial(e??{})},fromPartial(e){let t=TS();return t.source=e.source!==void 0&&e.source!==null?Et.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function _S(){return{source:void 0,metadata:void 0}}var mu={encode(e,t=new ve){return e.source!==void 0&&Et.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ce.encode(ce.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=_S();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Et.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ce.unwrap(ce.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return mu.fromPartial(e??{})},fromPartial(e){let t=_S();return t.source=e.source!==void 0&&e.source!==null?Et.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function kS(){return{source:void 0,metadata:void 0}}var gu={encode(e,t=new ve){return e.source!==void 0&&Et.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ce.encode(ce.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=kS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Et.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ce.unwrap(ce.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return gu.fromPartial(e??{})},fromPartial(e){let t=kS();return t.source=e.source!==void 0&&e.source!==null?Et.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function OS(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var hu={encode(e,t=new ve){return e.text!==void 0&&du.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&pu.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&fu.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&mu.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&gu.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=OS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=du.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=pu.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=fu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=mu.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=gu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return hu.fromPartial(e??{})},fromPartial(e){let t=OS();return t.text=e.text!==void 0&&e.text!==null?du.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?pu.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?fu.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?mu.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?gu.fromPartial(e.document):void 0,t}};function PS(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var yu={encode(e,t=new ve){e.id!==""&&t.uint32(10).string(e.id),e.role!==""&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let r of e.toolCalls)su.encode(r,t.uint32(42).fork()).join();e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error);for(let r of e.contentParts)hu.encode(r,t.uint32(66).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=PS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.role=r.string();continue;case 3:if(i!==26)break;o.content=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue;case 5:if(i!==42)break;o.toolCalls.push(su.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.toolCallId=r.string();continue;case 7:if(i!==58)break;o.error=r.string();continue;case 8:if(i!==66)break;o.contentParts.push(hu.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return yu.fromPartial(e??{})},fromPartial(e){let t=PS();return t.id=e.id??"",t.role=e.role??"",t.content=e.content??void 0,t.name=e.name??void 0,t.toolCalls=e.toolCalls?.map(r=>su.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>hu.fromPartial(r))||[],t}};function NS(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0}}var vu={encode(e,t=new ve){return e.id!==""&&t.uint32(10).string(e.id),e.reason!==""&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&ce.encode(ce.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&ce.encode(ce.wrap(e.metadata),t.uint32(58).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=NS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.reason=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.toolCallId=r.string();continue;case 5:if(i!==42)break;o.responseSchema=ce.unwrap(ce.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.expiresAt=r.string();continue;case 7:if(i!==58)break;o.metadata=ce.unwrap(ce.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vu.fromPartial(e??{})},fromPartial(e){let t=NS();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}},aO=function(e){return e[e.TEXT_MESSAGE_START=0]="TEXT_MESSAGE_START",e[e.TEXT_MESSAGE_CONTENT=1]="TEXT_MESSAGE_CONTENT",e[e.TEXT_MESSAGE_END=2]="TEXT_MESSAGE_END",e[e.TOOL_CALL_START=3]="TOOL_CALL_START",e[e.TOOL_CALL_ARGS=4]="TOOL_CALL_ARGS",e[e.TOOL_CALL_END=5]="TOOL_CALL_END",e[e.STATE_SNAPSHOT=6]="STATE_SNAPSHOT",e[e.STATE_DELTA=7]="STATE_DELTA",e[e.MESSAGES_SNAPSHOT=8]="MESSAGES_SNAPSHOT",e[e.RAW=9]="RAW",e[e.CUSTOM=10]="CUSTOM",e[e.RUN_STARTED=11]="RUN_STARTED",e[e.RUN_FINISHED=12]="RUN_FINISHED",e[e.RUN_ERROR=13]="RUN_ERROR",e[e.STEP_STARTED=14]="STEP_STARTED",e[e.STEP_FINISHED=15]="STEP_FINISHED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function FS(){return{type:0,timestamp:void 0,rawEvent:void 0}}var le={encode(e,t=new ve){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&ce.encode(ce.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=FS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.type=r.int32();continue;case 2:if(i!==16)break;o.timestamp=Ho(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=ce.unwrap(ce.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return le.fromPartial(e??{})},fromPartial(e){let t=FS();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function DS(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var Su={encode(e,t=new ve){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=DS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Su.fromPartial(e??{})},fromPartial(e){let t=DS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function MS(){return{baseEvent:void 0,messageId:"",delta:""}}var bu={encode(e,t=new ve){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=MS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return bu.fromPartial(e??{})},fromPartial(e){let t=MS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function qS(){return{baseEvent:void 0,messageId:""}}var wu={encode(e,t=new ve){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=qS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return wu.fromPartial(e??{})},fromPartial(e){let t=qS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function jS(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var Au={encode(e,t=new ve){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=jS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Au.fromPartial(e??{})},fromPartial(e){let t=jS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function LS(){return{baseEvent:void 0,toolCallId:"",delta:""}}var xu={encode(e,t=new ve){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=LS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xu.fromPartial(e??{})},fromPartial(e){let t=LS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function US(){return{baseEvent:void 0,toolCallId:""}}var Cu={encode(e,t=new ve){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=US();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Cu.fromPartial(e??{})},fromPartial(e){let t=US();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function VS(){return{baseEvent:void 0,snapshot:void 0}}var Eu={encode(e,t=new ve){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&ce.encode(ce.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=VS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=ce.unwrap(ce.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Eu.fromPartial(e??{})},fromPartial(e){let t=VS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function BS(){return{baseEvent:void 0,delta:[]}}var Ru={encode(e,t=new ve){e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)au.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=BS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(au.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ru.fromPartial(e??{})},fromPartial(e){let t=BS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>au.fromPartial(r))||[],t}};function GS(){return{baseEvent:void 0,messages:[]}}var Iu={encode(e,t=new ve){e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)yu.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=GS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(yu.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Iu.fromPartial(e??{})},fromPartial(e){let t=GS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>yu.fromPartial(r))||[],t}};function $S(){return{baseEvent:void 0,event:void 0,source:void 0}}var Tu={encode(e,t=new ve){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&ce.encode(ce.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=$S();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=ce.unwrap(ce.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.source=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Tu.fromPartial(e??{})},fromPartial(e){let t=$S();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function QS(){return{baseEvent:void 0,name:"",value:void 0}}var _u={encode(e,t=new ve){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&ce.encode(ce.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=QS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=ce.unwrap(ce.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return _u.fromPartial(e??{})},fromPartial(e){let t=QS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function HS(){return{baseEvent:void 0,threadId:"",runId:""}}var ku={encode(e,t=new ve){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=HS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ku.fromPartial(e??{})},fromPartial(e){let t=HS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function zS(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var qn={encode(e,t=new ve){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=zS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.provider=r.string();continue;case 2:if(i!==18)break;o.model=r.string();continue;case 3:if(i!==24)break;o.inputTokens=Ho(r.int64());continue;case 4:if(i!==32)break;o.outputTokens=Ho(r.int64());continue;case 5:if(i!==40)break;o.totalTokens=Ho(r.int64());continue;case 6:if(i!==48)break;o.reasoningTokens=Ho(r.int64());continue;case 7:if(i!==56)break;o.cachedInputTokens=Ho(r.int64());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return qn.fromPartial(e??{})},fromPartial(e){let t=zS();return t.provider=e.provider??void 0,t.model=e.model??void 0,t.inputTokens=e.inputTokens??void 0,t.outputTokens=e.outputTokens??void 0,t.totalTokens=e.totalTokens??void 0,t.reasoningTokens=e.reasoningTokens??void 0,t.cachedInputTokens=e.cachedInputTokens??void 0,t}};function WS(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var Ou={encode(e,t=new ve){e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&ce.encode(ce.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)vu.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)qn.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=WS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue;case 4:if(i!==34)break;o.result=ce.unwrap(ce.decode(r,r.uint32()));continue;case 5:if(i!==42)break;o.outcome=r.string();continue;case 6:if(i!==50)break;o.interrupts.push(vu.decode(r,r.uint32()));continue;case 7:if(i!==58)break;o.usage.push(qn.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ou.fromPartial(e??{})},fromPartial(e){let t=WS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interrupts=e.interrupts?.map(r=>vu.fromPartial(r))||[],t.usage=e.usage?.map(r=>qn.fromPartial(r))||[],t}};function KS(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var Pu={encode(e,t=new ve){e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message);for(let r of e.usage)qn.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=KS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.code=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.usage.push(qn.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Pu.fromPartial(e??{})},fromPartial(e){let t=KS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>qn.fromPartial(r))||[],t}};function YS(){return{baseEvent:void 0,stepName:""}}var Nu={encode(e,t=new ve){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=YS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Nu.fromPartial(e??{})},fromPartial(e){let t=YS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function XS(){return{baseEvent:void 0,stepName:""}}var Fu={encode(e,t=new ve){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=XS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Fu.fromPartial(e??{})},fromPartial(e){let t=XS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function ZS(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var Du={encode(e,t=new ve){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=ZS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.delta=r.string();continue;case 5:if(i!==42)break;o.name=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Du.fromPartial(e??{})},fromPartial(e){let t=ZS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t}};function JS(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var Mu={encode(e,t=new ve){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=JS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue;case 5:if(i!==42)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Mu.fromPartial(e??{})},fromPartial(e){let t=JS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function eb(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0}}var tb={encode(e,t=new ve){return e.textMessageStart!==void 0&&Su.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&bu.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&wu.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Au.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&xu.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Cu.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Eu.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Ru.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Iu.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Tu.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&_u.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&ku.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Ou.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Pu.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Nu.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Fu.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Du.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Mu.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=eb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=Su.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=bu.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=wu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=Au.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=xu.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=Cu.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=Eu.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Ru.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=Iu.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Tu.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=_u.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=ku.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Ou.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=Pu.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Nu.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=Fu.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=Du.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Mu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return tb.fromPartial(e??{})},fromPartial(e){let t=eb();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Su.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?bu.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?wu.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Au.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?xu.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Cu.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Eu.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Ru.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Iu.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Tu.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?_u.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?ku.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Ou.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Pu.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Nu.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Fu.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Du.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Mu.fromPartial(e.toolCallChunk):void 0,t}};function Ho(e){let t=w.Number(e.toString());if(t>w.Number.MAX_SAFE_INTEGER)throw new w.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<w.Number.MIN_SAFE_INTEGER)throw new w.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var rb=e=>e&&typeof e=="object"?e:void 0;var iu=e=>{let t=rb(e);if(t){if(t.data){let r=t.data;return{type:"data",value:r.value,mimeType:r.mimeType}}if(t.url){let r=t.url;return{type:"url",value:r.value,mimeType:r.mimeType}}}},sO=e=>{let t=rb(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:iu(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:iu(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:iu(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:iu(r.source),metadata:r.metadata}}}};function nb(e){let t=tb.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=aO[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,delete r.baseEvent,r.type===M.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;if(o.role==="user"&&Array.isArray(o.contentParts)){let i=o.contentParts.map(a=>sO(a)).filter(a=>a!==void 0);i.length>0&&(o.content=i)}Array.isArray(o.contentParts)&&o.contentParts.length===0&&(o.contentParts=void 0),o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===M.RUN_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,i=Array.isArray(n.interrupts)?n.interrupts:[];delete n.interrupts,o==="interrupt"?n.outcome={type:"interrupt",interrupts:i}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if((r.type===M.RUN_FINISHED||r.type===M.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===M.STATE_DELTA)for(let n of r.delta)n.op=iO[n.op].toLowerCase(),Object.keys(n).forEach(o=>{n[o]===void 0&&delete n[o]});return Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n]}),xc.parse(r)}var sf="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var uO=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,cf=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(uO);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},ob=e=>e==="*"||e==="x"||e==="X",ib=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},lO=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],dO=(e,t)=>{if(ob(e)||ob(t))return 0;let[r,n]=lO(ib(e),ib(t));return r>n?1:r<n?-1:0},uf=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=dO(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var ga=(e,t)=>{let r=cf(e),n=cf(t),o=r.pop(),i=n.pop(),a=uf(r,n);return a!==0?a:o&&i?uf(o.split("."),i.split(".")):o||i?o?-1:1:0};var Re=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function ha(){return jr()}function pf(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&pf(t);return e}var ab=512*1024;function sb(e,t,r){let n=0,o=[e,t],i=new WeakSet;for(;o.length>0;){let a=o.pop();if(typeof a=="string"){if(n+=a.length,n>r)return!0}else if(typeof a=="object"&&a){if(i.has(a))continue;if(i.add(a),Array.isArray(a))for(let s=0;s<a.length;s++)o.push(a[s]);else{let s=Object.keys(a);for(let c=0;c<s.length;c++){let u=s[c];if(n+=u.length,n>r)return!0;o.push(a[u])}}}}return!1}function Oe(_x88,_x89,_x90,_x91){return _Oe.apply(this,arguments)}function _Oe(){_Oe=_asyncToGenerator(function*(e,t,r,n){let o=typeof process<"u"&&process.env!==void 0,i=o&&!!process.env.VITEST_WORKER_ID,a=o&&!!process.env.VITEST_WORKER_ID,s=a&&!sb(t,r,ab),c=s?Re(t):t,u=s?Re(r):r,h=!1,v=!1,C;for(let g of e)try{s&&(pf(c),pf(u));let y=yield n(g,c,u);if(y===void 0)continue;let S=!1;if(y.messages!==void 0&&y.messages!==c&&(c=Re(y.messages),h=!0,S=!0),y.state!==void 0&&y.state!==u&&(u=Re(y.state),v=!0,S=!0),s&&S&&sb(c,u,ab)&&(s=!1),C=y.stopPropagation,C===!0)break}catch(y){if(a&&y instanceof TypeError){if(i)throw y;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",y)}else i||console.error("Subscriber error:",y);continue}return{...(h?{messages:Object.isFrozen(c)?Re(c):c}:{}),...(v?{state:Object.isFrozen(u)?Re(u):u}:{}),...(C===void 0?{}:{stopPropagation:C})}});return _Oe.apply(this,arguments)}function qu(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,r=e.lifecycle??!0,n=e.verbose??!1;return{enabled:t||r,events:t,lifecycle:r,verbose:n}}function ya(e){if(e instanceof ff)return e;if(e===!0)return new ff(qu(!0))}var ff=class{constructor(e){this.config=e}event(e,t,r,n){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof r=="string"?r:JSON.stringify(r)):console.debug(`[${e}] ${t}`,n??r))}lifecycle(e,t,r){this.config.lifecycle&&(r?console.debug(`[${e}] ${t}`,r):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function lf(e){return e.enabled?new ff(e):void 0}function pO(e,t,r){if(t){let o=e.find(a=>a.id===t);if(o?.role==="assistant")return o;o&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${o.role}' message, not assistant \u2014 falling back to toolCallId`);let i={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(i),i}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}var fb=(e,t,r,n,o)=>{let i=ya(o),a=Re(r.messages),s=Re(e.state),c={},u=v=>{v.messages!==void 0&&(a=v.messages,c.messages=v.messages),v.state!==void 0&&(s=v.state,c.state=v.state)},h=()=>{let v=Re(c);return c={},v.messages!==void 0||v.state!==void 0?Ge(v):Uc};return t.pipe(tu(/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(v){let C=yield Oe(n,a,s,(g,y,S)=>g.onEvent?.({event:v,agent:r,input:e,messages:y,state:S}));if(u(C),C.stopPropagation===!0?i?.event("APPLY","Event dropped:",v,{type:v.type,reason:"stopPropagation by subscriber"}):i?.event("APPLY","Event applied:",v,{type:v.type,subscribers:n.length}),C.stopPropagation===!0)return h();switch(v.type){case M.TEXT_MESSAGE_START:{let g=yield Oe(n,a,s,(y,S,E)=>y.onTextMessageStartEvent?.({event:v,messages:S,state:E,agent:r,input:e}));if(u(g),g.stopPropagation!==!0){let{messageId:y,role:S="assistant",name:E}=v;if(!a.find(R=>R.id===y)){let R={id:y,role:S,content:"",...(E!==void 0&&{name:E})};a.push(R),u({messages:a})}}return h()}case M.TEXT_MESSAGE_CONTENT:{let{messageId:g,delta:y}=v,S=a.find(R=>R.id===g);if(!S)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${g}'`),h();let E=yield Oe(n,a,s,(R,k,I)=>R.onTextMessageContentEvent?.({event:v,messages:k,state:I,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}));return u(E),E.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${y}`,u({messages:a})),h()}case M.TEXT_MESSAGE_END:{let{messageId:g}=v,y=a.find(S=>S.id===g);return y?(u(yield Oe(n,a,s,(S,E,R)=>S.onTextMessageEndEvent?.({event:v,messages:E,state:R,agent:r,input:e,textMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(S=>{S.onNewMessage?.({message:y,messages:a,state:s,agent:r,input:e})})),h()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${g}'`),h())}case M.TOOL_CALL_START:{let g=yield Oe(n,a,s,(y,S,E)=>y.onToolCallStartEvent?.({event:v,messages:S,state:E,agent:r,input:e}));if(u(g),g.stopPropagation!==!0){let{toolCallId:y,toolCallName:S,parentMessageId:E}=v,R=a.find(I=>I.toolCalls?.some(T=>T.id===y))?.toolCalls?.find(I=>I.id===y);if(R)return R.function.name!==S&&(console.warn(`TOOL_CALL_START: tool call '${y}' already exists with name '${R.function.name}' \u2014 updating it to '${S}'`),R.function.name=S,u({messages:a})),h();let k=pO(a,E,y);k.toolCalls??(k.toolCalls=[]),k.toolCalls.push({id:y,type:"function",function:{name:S,arguments:""}}),u({messages:a})}return h()}case M.TOOL_CALL_ARGS:{let{toolCallId:g,delta:y}=v,S=a.find(k=>k.toolCalls?.some(I=>I.id===g));if(!S)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${g}'`),h();let E=S.toolCalls?.find(k=>k.id===g);if(!E)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${g}'`),h();let R=yield Oe(n,a,s,(k,I,T)=>{let _=E.function.arguments,D=E.function.name,G={};try{G=nu(_)}catch{}return k.onToolCallArgsEvent?.({event:v,messages:I,state:T,agent:r,input:e,toolCallBuffer:_,toolCallName:D,partialToolCallArgs:G})});return u(R),R.stopPropagation!==!0&&(E.function.arguments+=y,u({messages:a})),h()}case M.TOOL_CALL_END:{let{toolCallId:g}=v,y=a.find(E=>E.toolCalls?.some(R=>R.id===g));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${g}'`),h();let S=y.toolCalls?.find(E=>E.id===g);return S?(u(yield Oe(n,a,s,(E,R,k)=>{let I=S.function.arguments,T=S.function.name,_={};try{_=JSON.parse(I)}catch{}return E.onToolCallEndEvent?.({event:v,messages:R,state:k,agent:r,input:e,toolCallName:T,toolCallArgs:_})})),yield Promise.all(n.map(E=>{E.onNewToolCall?.({toolCall:S,messages:a,state:s,agent:r,input:e})})),h()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${g}'`),h())}case M.TOOL_CALL_RESULT:{let g=yield Oe(n,a,s,(y,S,E)=>y.onToolCallResultEvent?.({event:v,messages:S,state:E,agent:r,input:e}));if(u(g),g.stopPropagation!==!0){let{messageId:y,toolCallId:S,content:E,role:R}=v,k={id:y,toolCallId:S,role:R||"tool",content:E},I=a.findIndex(T=>T.role==="assistant"&&T.toolCalls?.some(_=>_.id===S));if(I===-1)a.push(k);else{let T=I+1;for(;T<a.length&&a[T].role==="tool";)T++;a.splice(T,0,k)}yield Promise.all(n.map(T=>{T.onNewMessage?.({message:k,messages:a,state:s,agent:r,input:e})})),u({messages:a})}return h()}case M.STATE_SNAPSHOT:{let g=yield Oe(n,a,s,(y,S,E)=>y.onStateSnapshotEvent?.({event:v,messages:S,state:E,agent:r,input:e}));if(u(g),g.stopPropagation!==!0){let{snapshot:y}=v;s=y,u({state:s})}return h()}case M.STATE_DELTA:{let g=yield Oe(n,a,s,(y,S,E)=>y.onStateDeltaEvent?.({event:v,messages:S,state:E,agent:r,input:e}));if(u(g),g.stopPropagation!==!0){let{delta:y}=v;try{s=Oc.applyPatch(s,y,!0,!1).newDocument,u({state:s})}catch(S){let E=S instanceof Error?S.message:String(S);console.warn(`Failed to apply state patch:
|
|
35
|
+
`):"",this.name="UnsubscriptionError",this.errors=r}});m();d();f();p();function ma(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Qo=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=Ar(a),u=s.next();!u.done;u=s.next()){var c=u.value;c.remove(this)}}catch(b){t={error:b}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}else a.remove(this);var g=this.initialTeardown;if(Ee(g))try{g()}catch(b){i=b instanceof jc?b.errors:[b]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var R=Ar(v),h=R.next();!h.done;h=R.next()){var y=h.value;try{tS(y)}catch(b){i=i??[],b instanceof jc?i=Bo(Bo([],Go(i)),Go(b.errors)):i.push(b)}}}catch(b){n={error:b}}finally{try{h&&!h.done&&(o=R.return)&&o.call(R)}finally{if(n)throw n.error}}}if(i)throw new jc(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)tS(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&ma(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&ma(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Yp=Qo.EMPTY;function Uc(e){return e instanceof Qo||e&&"closed"in e&&Ee(e.remove)&&Ee(e.add)&&Ee(e.unsubscribe)}function tS(e){Ee(e)?e():e.unsubscribe()}m();d();f();p();var Bt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var Ho={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Ho.delegate;return o?.setTimeout?o.setTimeout.apply(o,Bo([e,t],Go(r))):setTimeout.apply(void 0,Bo([e,t],Go(r)))},clearTimeout:function(e){var t=Ho.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Vc(e){Ho.setTimeout(function(){var t=Bt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function ga(){}m();d();f();p();var rS=function(){return Xp("C",void 0,void 0)}();function nS(e){return Xp("E",void 0,e)}function oS(e){return Xp("N",e,void 0)}function Xp(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var Ln=null;function zo(e){if(Bt.useDeprecatedSynchronousErrorHandling){var t=!Ln;if(t&&(Ln={errorThrown:!1,error:null}),e(),t){var r=Ln,n=r.errorThrown,o=r.error;if(Ln=null,n)throw o}}else e()}function iS(e){Bt.useDeprecatedSynchronousErrorHandling&&Ln&&(Ln.errorThrown=!0,Ln.error=e)}var ha=function(e){nr(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Uc(r)&&r.add(n)):n.destination=lO,n}return t.create=function(r,n,o){return new Bc(r,n,o)},t.prototype.next=function(r){this.isStopped?Jp(oS(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Jp(nS(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Jp(rS,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Qo);var sO=Function.prototype.bind;function Zp(e,t){return sO.call(e,t)}var cO=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Gc(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Gc(n)}else Gc(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Gc(r)}},e}(),Bc=function(e){nr(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(Ee(r)||!r)a={next:r??void 0,error:n??void 0,complete:o??void 0};else{var s;i&&Bt.useDeprecatedNextContext?(s=Object.create(r),s.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&Zp(r.next,s),error:r.error&&Zp(r.error,s),complete:r.complete&&Zp(r.complete,s)}):a=r}return i.destination=new cO(a),i}return t}(ha);function Gc(e){Bt.useDeprecatedSynchronousErrorHandling?iS(e):Vc(e)}function uO(e){throw e}function Jp(e,t){var r=Bt.onStoppedNotification;r&&Ho.setTimeout(function(){return r(e,t)})}var lO={closed:!0,next:ga,error:uO,complete:ga};m();d();f();p();var Wo=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function Ko(e){return e}function $c(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ef(e)}function ef(e){return e.length===0?Ko:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var Ge=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var o=this,i=pO(t)?t:new Bc(t,r,n);return zo(function(){var a=o,s=a.operator,u=a.source;i.add(s?s.call(i,u):u?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=aS(r),new r(function(o,i){var a=new Bc({next:function(s){try{t(s)}catch(u){i(u),a.unsubscribe()}},error:i,complete:o});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[Wo]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return ef(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=aS(t),new t(function(n,o){var i;r.subscribe(function(a){return i=a},function(a){return o(a)},function(){return n(i)})})},e.create=function(t){return new e(t)},e}();function aS(e){var t;return(t=e??Bt.Promise)!==null&&t!==void 0?t:Promise}function dO(e){return e&&Ee(e.next)&&Ee(e.error)&&Ee(e.complete)}function pO(e){return e&&e instanceof ha||dO(e)&&Uc(e)}m();d();f();p();function fO(e){return Ee(e?.lift)}function Qe(e){return function(t){if(fO(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}m();d();f();p();function We(e,t,r,n,o){return new mO(e,t,r,n,o)}var mO=function(e){nr(t,e);function t(r,n,o,i,a,s){var u=e.call(this,r)||this;return u.onFinalize=a,u.shouldUnsubscribe=s,u._next=n?function(c){try{n(c)}catch(g){r.error(g)}}:e.prototype._next,u._error=i?function(c){try{i(c)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=o?function(){try{o()}catch(c){r.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,u}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(ha);m();d();f();p();m();d();f();p();var sS=$o(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var or=function(e){nr(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new cS(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new sS},t.prototype.next=function(r){var n=this;zo(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=Ar(n.currentObservers),s=a.next();!s.done;s=a.next()){var u=s.value;u.next(r)}}catch(c){o={error:c}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;zo(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},t.prototype.complete=function(){var r=this;zo(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,a=o.isStopped,s=o.observers;return i||a?Yp:(this.currentObservers=null,s.push(r),new Qo(function(){n.currentObservers=null,ma(s,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,a=n.isStopped;o?r.error(i):a&&r.complete()},t.prototype.asObservable=function(){var r=new Ge;return r.source=this,r},t.create=function(r,n){return new cS(r,n)},t}(Ge);var cS=function(e){nr(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Yp},t}(or);m();d();f();p();m();d();f();p();var tf={now:function(){return(tf.delegate||Date).now()},delegate:void 0};var Qc=function(e){nr(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=tf);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,a=n._infiniteTimeWindow,s=n._timestampProvider,u=n._windowTime;o||(i.push(r),!a&&i.push(s.now()+u)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,i=o._infiniteTimeWindow,a=o._buffer,s=a.slice(),u=0;u<s.length&&!r.closed;u+=i?1:2)r.next(s[u]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,i=r._buffer,a=r._infiniteTimeWindow,s=(a?1:2)*n;if(n<1/0&&s<i.length&&i.splice(0,i.length-s),!a){for(var u=o.now(),c=0,g=1;g<i.length&&i[g]<=u;g+=2)c=g;c&&i.splice(0,c+1)}},t}(or);m();d();f();p();var Hc=new Ge(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function uS(e){return e&&Ee(e.schedule)}function gO(e){return e[e.length-1]}function lS(e){return uS(gO(e))?e.pop():void 0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var zc=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function Wc(e){return Ee(e?.then)}m();d();f();p();function Kc(e){return Ee(e[Wo])}m();d();f();p();function Yc(e){return Symbol.asyncIterator&&Ee(e?.[Symbol.asyncIterator])}m();d();f();p();function Xc(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}m();d();f();p();m();d();f();p();function hO(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Zc=hO();function Jc(e){return Ee(e?.[Zc])}m();d();f();p();function eu(e){return Jv(this,arguments,function(){var r,n,o,i;return qc(this,function(a){switch(a.label){case 0:r=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Mn(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,Mn(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Mn(o)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function tu(e){return Ee(e?.getReader)}function Xe(e){if(e instanceof Ge)return e;if(e!=null){if(Kc(e))return yO(e);if(zc(e))return vO(e);if(Wc(e))return SO(e);if(Yc(e))return dS(e);if(Jc(e))return bO(e);if(tu(e))return AO(e)}throw Xc(e)}function yO(e){return new Ge(function(t){var r=e[Wo]();if(Ee(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function vO(e){return new Ge(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function SO(e){return new Ge(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Vc)})}function bO(e){return new Ge(function(t){var r,n;try{for(var o=Ar(e),i=o.next();!i.done;i=o.next()){var a=i.value;if(t.next(a),t.closed)return}}catch(s){r={error:s}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function dS(e){return new Ge(function(t){wO(e,t).catch(function(r){return t.error(r)})})}function AO(e){return dS(eu(e))}function wO(e,t){var r,n,o,i;return Zv(this,void 0,void 0,function(){var a,s;return qc(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),r=eS(e),u.label=1;case 1:return[4,r.next()];case 2:if(n=u.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=u.sent(),o={error:s},[3,11];case 6:return u.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}m();d();f();p();m();d();f();p();function Mt(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!o)return i}function ru(e,t){return t===void 0&&(t=0),Qe(function(r,n){r.subscribe(We(n,function(o){return Mt(n,e,function(){return n.next(o)},t)},function(){return Mt(n,e,function(){return n.complete()},t)},function(o){return Mt(n,e,function(){return n.error(o)},t)}))})}m();d();f();p();function nu(e,t){return t===void 0&&(t=0),Qe(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function pS(e,t){return Xe(e).pipe(nu(t),ru(t))}m();d();f();p();function fS(e,t){return Xe(e).pipe(nu(t),ru(t))}m();d();f();p();function mS(e,t){return new Ge(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}m();d();f();p();function gS(e,t){return new Ge(function(r){var n;return Mt(r,t,function(){n=e[Zc](),Mt(r,t,function(){var o,i,a;try{o=n.next(),i=o.value,a=o.done}catch(s){r.error(s);return}a?r.complete():r.next(i)},0,!0)}),function(){return Ee(n?.return)&&n.return()}})}m();d();f();p();function ou(e,t){if(!e)throw new Error("Iterable cannot be null");return new Ge(function(r){Mt(r,t,function(){var n=e[Symbol.asyncIterator]();Mt(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}m();d();f();p();function hS(e,t){return ou(eu(e),t)}function yS(e,t){if(e!=null){if(Kc(e))return pS(e,t);if(zc(e))return mS(e,t);if(Wc(e))return fS(e,t);if(Yc(e))return ou(e,t);if(Jc(e))return gS(e,t);if(tu(e))return hS(e,t)}throw Xc(e)}function qn(e,t){return t?yS(e,t):Xe(e)}function Oe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=lS(e);return qn(e,r)}m();d();f();p();function de(e,t){var r=Ee(e)?e:function(){return e},n=function(o){return o.error(r())};return new Ge(t?function(o){return t.schedule(n,0,o)}:n)}m();d();f();p();m();d();f();p();var vS=$o(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function iu(e,t){var r=typeof t=="object";return new Promise(function(n,o){var i=!1,a;e.subscribe({next:function(s){a=s,i=!0},error:o,complete:function(){i?n(a):r?n(t.defaultValue):o(new vS)}})})}m();d();f();p();function Qr(e,t){return Qe(function(r,n){var o=0;r.subscribe(We(n,function(i){n.next(e.call(t,i,o++))}))})}m();d();f();p();m();d();f();p();m();d();f();p();function SS(e,t,r,n,o,i,a,s){var u=[],c=0,g=0,v=!1,R=function(){v&&!u.length&&!c&&t.complete()},h=function(b){return c<n?y(b):u.push(b)},y=function(b){i&&t.next(b),c++;var x=!1;Xe(r(b,g++)).subscribe(We(t,function(I){o?.(I),i?h(I):t.next(I)},function(){x=!0},void 0,function(){if(x)try{c--;for(var I=function(){var _=u.shift();a?Mt(t,a,function(){return y(_)}):y(_)};u.length&&c<n;)I();R()}catch(_){t.error(_)}}))};return e.subscribe(We(t,h,function(){v=!0,R()})),function(){s?.()}}function wt(e,t,r){return r===void 0&&(r=1/0),Ee(t)?wt(function(n,o){return Qr(function(i,a){return t(n,i,o,a)})(Xe(e(n,o)))},r):(typeof t=="number"&&(r=t),Qe(function(n,o){return SS(n,o,e,r)}))}function rf(e){return e===void 0&&(e=1/0),wt(Ko,e)}m();d();f();p();function au(e){return new Ge(function(t){Xe(e()).subscribe(t)})}m();d();f();p();function nf(e,t){return Qe(function(r,n){var o=0;r.subscribe(We(n,function(i){return e.call(t,i,o++)&&n.next(i)}))})}m();d();f();p();function ya(e){return Qe(function(t,r){var n=null,o=!1,i;n=t.subscribe(We(r,void 0,void 0,function(a){i=Xe(e(a,ya(e)(t))),n?(n.unsubscribe(),n=null,i.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(r))})}m();d();f();p();function su(e,t){return Ee(t)?wt(e,t,1):wt(e,1)}m();d();f();p();function of(e){return Qe(function(t,r){var n=!1;t.subscribe(We(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}m();d();f();p();function jn(e){return Qe(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function af(e,t){return Qe(function(r,n){var o=null,i=0,a=!1,s=function(){return a&&!o&&n.complete()};r.subscribe(We(n,function(u){o?.unsubscribe();var c=0,g=i++;Xe(e(u,g)).subscribe(o=We(n,function(v){return n.next(t?t(u,v,g,c++):v)},function(){o=null,s()}))},function(){a=!0,s()}))})}m();d();f();p();function cu(e){return Qe(function(t,r){Xe(e).subscribe(We(r,function(){return r.complete()},ga)),!r.closed&&t.subscribe(r)})}m();d();f();p();function uu(e,t,r){var n=Ee(e)||t||r?{next:e,error:t,complete:r}:e;return n?Qe(function(o,i){var a;(a=n.subscribe)===null||a===void 0||a.call(n);var s=!0;o.subscribe(We(i,function(u){var c;(c=n.next)===null||c===void 0||c.call(n,u),i.next(u)},function(){var u;s=!1,(u=n.complete)===null||u===void 0||u.call(n),i.complete()},function(u){var c;s=!1,(c=n.error)===null||c===void 0||c.call(n,u),i.error(u)},function(){var u,c;s&&((u=n.unsubscribe)===null||u===void 0||u.call(n)),(c=n.finalize)===null||c===void 0||c.call(n)}))}):Ko}m();d();f();p();m();d();f();p();function bS(e){return` \r
|
|
36
|
+
`.indexOf(e)>=0}function lu(e){for(var t=["topLevel"],r=0,n,o,i,a=function(_){return t.push(_)},s=function(_){return t[t.length-1]=_},u=function(_){n==null&&(n=r,o=t.length,i=_)},c=function(_){_===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},R=function(_){if("0"<=_&&_<="9"){a("number");return}switch(_){case"\"":a("string");return;case"-":a("numberNeedsDigit");return;case"t":a("true");return;case"f":a("false");return;case"n":a("null");return;case"[":a("arrayNeedsValue");return;case"{":a("objectNeedsKey");return}},h=e.length;r<h;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":R(y);break;case"string":switch(y){case"\"":g();break;case"\\":u("stringEscape"),a("stringEscaped");break}break;case"stringEscaped":y==="u"?a("stringUnicode"):(c("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(c("stringEscape"),g());break;case"number":y==="."?s("numberNeedsDigit"):y==="e"||y==="E"?s("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),g());break;case"numberNeedsDigit":s("number");break;case"numberNeedsExponent":s(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),g());break;case"arrayNeedsValue":y==="]"?g():bS(y)||(c("collectionItem"),s("arrayNeedsComma"),R(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(u("collectionItem"),s("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(u("collectionItem"),s("objectNeedsColon"),a("string"));break;case"objectNeedsColon":y===":"&&s("objectNeedsValue");break;case"objectNeedsValue":bS(y)||(c("collectionItem"),s("objectNeedsComma"),R(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(u("collectionItem"),s("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var b=[n!=null?e.slice(0,n):e],x=function(_){return b.push(_.slice(e.length-e.lastIndexOf(_[0])))},I=t.length-1;I>=0;I--)switch(t[I]){case"string":b.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":b.push("0");break;case"true":x("true");break;case"false":x("false");break;case"null":x("null");break;case"arrayNeedsValue":case"arrayNeedsComma":b.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":b.push("}");break}return b.join("")}m();d();f();p();m();d();f();p();m();d();f();p();function wS(){let e=this.buf,t=this.pos,r=0,n=0;for(let i=0;i<28;i+=7){let a=e[t++];if(r|=(a&127)<<i,(a&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}let o=e[t++];if(r|=(o&15)<<28,n=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}for(let i=3;i<=31;i+=7){let a=e[t++];if(n|=(a&127)<<i,(a&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}throw new Error("invalid varint")}var du=4294967296;function sf(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(a,s){let u=Number(e.slice(a,s));o*=r,n=n*r+u,n>=du&&(o=o+(n/du|0),n=n%du)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?CS(n,o):uf(n,o)}function xS(e,t){let r=uf(e,t),n=r.hi&2147483648;n&&(r=CS(r.lo,r.hi));let o=cf(r.lo,r.hi);return n?"-"+o:o}function cf(e,t){if({lo:e,hi:t}=xO(e,t),t<=2097151)return String(du*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,i=r+n*6777216+o*6710656,a=n+o*8147497,s=o*2,u=1e7;return i>=u&&(a+=Math.floor(i/u),i%=u),a>=u&&(s+=Math.floor(a/u),a%=u),s.toString()+AS(a)+AS(i)}function xO(e,t){return{lo:e>>>0,hi:t>>>0}}function uf(e,t){return{lo:e|0,hi:t|0}}function CS(e,t){return t=~t,e?e=~e+1:t+=1,uf(e,t)}var AS=e=>{let t=String(e);return"0000000".slice(t.length)+t};function ES(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)===0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();f();p();var $t=CO();function CO(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!w.Deno||!!w.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){let s=typeof a=="bigint"?a:BigInt(a);if(s>n||s<r)throw new Error(`invalid int64: ${a}`);return s},uParse(a){let s=typeof a=="bigint"?a:BigInt(a);if(s>i||s<o)throw new Error(`invalid uint64: ${a}`);return s},enc(a){return e.setBigInt64(0,this.parse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(a){return e.setBigInt64(0,this.uParse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(a,s){return e.setInt32(0,a,!0),e.setInt32(4,s,!0),e.getBigInt64(0,!0)},uDec(a,s){return e.setInt32(0,a,!0),e.setInt32(4,s,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),RS(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),IS(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),RS(r),sf(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),IS(r),sf(r)},dec(r,n){return xS(r,n)},uDec(r,n){return cf(r,n)}}}function RS(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function IS(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var lf;function EO(e){var t;lf=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:pf(e.encodeUtf8.bind(e))})}function df(){if(!lf){let e=w;if(!e.TextEncoder||!e.TextDecoder)throw new Error("encoding API missing: install TextEncoder and TextDecoder on globalThis");let t=new e.TextEncoder,r=new e.TextDecoder,n,o={encodeUtf8(a){return t.encode(a)},decodeUtf8(a,s){return s?(n||(n=new e.TextDecoder("utf-8",{fatal:!0})),n.decode(a)):r.decode(a)},checkUtf8(a){try{return encodeURIComponent(a),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let i=String.prototype.isWellFormed;i&&(o.checkUtf8=a=>i.call(a)),EO(o)}return lf}function pf(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var Hr;(function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"})(Hr||(Hr={}));var RO=34028234663852886e22,IO=-34028234663852886e22,TO=4294967295,_O=2147483647,kO=-2147483648,ye=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?pf(t):df().encodeUtf8Into,this.buffer=_S,this.viewCache=PO,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||OO;for(;n<r;)n*=2;let o=new Uint8Array(n);this.pos>0&&o.set(this.buffer),this.buffer=o}}view(){let t=this.buffer,r=this.viewCache;if(r.byteLength===t.byteLength)return r;let n=new DataView(t.buffer);return this.viewCache=n,n}finish(){let t=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],t}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(va),this.buffer[this.pos++]=0,this}join(){let t=this.stackPos.pop();if(t===void 0)throw new Error("invalid state, fork stack empty");let r=this.pos-t-va,n=ff(r);return n>va&&(this.ensureCapacity(n-va),this.buffer.copyWithin(t+n,t+va,this.pos)),this.pos=t,this.uint32(r),this.pos+=r,this}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if(TS(t),this.ensureCapacity(5),t<128)return this.buffer[this.pos++]=t,this;for(;t>127;)this.buffer[this.pos++]=t&127|128,t>>>=7;return this.buffer[this.pos++]=t,this}int32(t){if(mf(t),t>=0)return this.uint32(t);this.ensureCapacity(10);for(let r=0;r<9;r++)this.buffer[this.pos++]=t&127|128,t>>=7;return this.buffer[this.pos++]=1,this}bool(t){return this.ensureCapacity(1),this.buffer[this.pos++]=t?1:0,this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){typeof t!="string"&&(t=String(t));let r=t.length;if(r<=kS){this.ensureCapacity(r+1);let u=this.buffer,c=this.pos;u[c++]=r;let g=0;for(;g<r;g++){let v=t.charCodeAt(g);if(v>127)break;u[c++]=v}if(g==r)return this.pos=c,this}this.ensureCapacity(r*3+5);let n=ff(r),o=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(t,o.subarray(i+n)),s=ff(a);return s!=n&&o.copyWithin(i+s,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(t){return NO(t),this.ensureCapacity(4),this.view().setFloat32(this.pos,t,!0),this.pos+=4,this}double(t){return this.ensureCapacity(8),this.view().setFloat64(this.pos,t,!0),this.pos+=8,this}fixed32(t){return TS(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return mf(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return mf(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=$t.enc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}fixed64(t){let r=$t.uEnc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}int64(t){let r=$t.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=$t.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return this.writeVarint64(o,i)}uint64(t){let r=$t.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let s=0;s<28;s=s+7){let u=t>>>s,c=!(!(u>>>7)&&r==0);if(n[o++]=(c?u|128:u)&255,!c)return this.pos=o,this}let i=t>>>28&15|(r&7)<<4,a=r>>3!=0;if(n[o++]=(a?i|128:i)&255,!a)return this.pos=o,this;for(let s=3;s<31;s=s+7){let u=r>>>s,c=!!(u>>>7);if(n[o++]=(c?u|128:u)&255,!c)return this.pos=o,this}return n[o++]=r>>>31&1,this.pos=o,this}},OO=128,va=1,_S=new Uint8Array(0),PO=new DataView(_S.buffer),kS=32;function ff(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var Z=class{constructor(t,r=df().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=wS,this.uint32=ES,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.pos,r=this.uint32(),n=this.pos-t;if(n>5||n==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=r>>>3,i=r&7;if(o<=0||i>5)throw new Error("illegal tag: field no "+o+" wire type "+i);return[o,i]}skip(t,r,n=100){let o=this.pos;switch(t){case Hr.Varint:for(;this.buf[this.pos++]&128;);break;case Hr.Bit64:this.pos+=4;case Hr.Bit32:this.pos+=4;break;case Hr.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Hr.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[a,s]=this.tag();if(s===Hr.EndGroup){if(r!==void 0&&a!==r)throw new Error("invalid end group tag");break}this.skip(s,a,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return this.varint64(),$t.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),$t.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,r=this.varint64Hi,n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,$t.dec(t,r)}bool(){let t=this.buf[this.pos];return t<128?(this.pos++,t!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return $t.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return $t.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){let r=this.bytes(),n=r.length;if(n<=kS){let o=new Array(n);for(let i=0;i<n;i++){let a=r[i];if(a>127)return this.decodeUtf8(r,t);o[i]=a}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(r,t)}};function mf(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>_O||e<kO)throw new Error("invalid int32: "+e)}function TS(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>TO||e<0)throw new Error("invalid uint32: "+e)}function NO(e){if(typeof e=="string"){let t=e;if(e=Number(e),Number.isNaN(e)&&t!=="NaN")throw new Error("invalid float32: "+t)}else if(typeof e!="number")throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>RO||e<IO))throw new Error("invalid float32: "+e)}var FO=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function gf(){return{fields:{}}}var ut={encode(e,t=new ye){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&vf.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=gf();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=vf.decode(r,r.uint32());a.value!==void 0&&(o.fields[a.key]=a.value);continue}}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ut.fromPartial(e??{})},fromPartial(e){let t=gf();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=gf();if(e!==void 0)for(let r of Object.keys(e))t.fields[r]=e[r];return t},unwrap(e){let t={};if(e.fields)for(let r of Object.keys(e.fields))t[r]=e.fields[r];return t}};function OS(){return{key:"",value:void 0}}var vf={encode(e,t=new ye){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&se.encode(se.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=OS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=r.string();continue;case 2:if(i!==18)break;o.value=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vf.fromPartial(e??{})},fromPartial(e){let t=OS();return t.key=e.key??"",t.value=e.value??void 0,t}};function hf(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var se={encode(e,t=new ye){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&ut.encode(ut.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Sa.encode(Sa.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=hf();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.nullValue=r.int32();continue;case 2:if(i!==17)break;o.numberValue=r.double();continue;case 3:if(i!==26)break;o.stringValue=r.string();continue;case 4:if(i!==32)break;o.boolValue=r.bool();continue;case 5:if(i!==42)break;o.structValue=ut.unwrap(ut.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=Sa.unwrap(Sa.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return se.fromPartial(e??{})},fromPartial(e){let t=hf();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=hf();if(e===null)t.nullValue=FO.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(w.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new w.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function yf(){return{values:[]}}var Sa={encode(e,t=new ye){for(let r of e.values)se.encode(se.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=yf();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(se.unwrap(se.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Sa.fromPartial(e??{})},fromPartial(e){let t=yf();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=yf();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&w.Array.isArray(e.values)?e.values:e}},DO=function(e){return e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.REPLACE=2]="REPLACE",e[e.MOVE=3]="MOVE",e[e.COPY=4]="COPY",e[e.TEST=5]="TEST",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function PS(){return{op:0,path:"",from:void 0,value:void 0}}var fu={encode(e,t=new ye){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&se.encode(se.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=PS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.op=r.int32();continue;case 2:if(i!==18)break;o.path=r.string();continue;case 3:if(i!==26)break;o.from=r.string();continue;case 4:if(i!==34)break;o.value=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return fu.fromPartial(e??{})},fromPartial(e){let t=PS();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function NS(){return{id:"",type:"",function:void 0,metadata:void 0}}var mu={encode(e,t=new ye){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&gu.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&ut.encode(ut.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=NS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.type=r.string();continue;case 3:if(i!==26)break;o.function=gu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.metadata=ut.unwrap(ut.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return mu.fromPartial(e??{})},fromPartial(e){let t=NS();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?gu.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function FS(){return{name:"",arguments:""}}var gu={encode(e,t=new ye){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=FS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.name=r.string();continue;case 2:if(i!==18)break;o.arguments=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return gu.fromPartial(e??{})},fromPartial(e){let t=FS();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function DS(){return{value:"",mimeType:""}}var hu={encode(e,t=new ye){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==""&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=DS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return hu.fromPartial(e??{})},fromPartial(e){let t=DS();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function MS(){return{value:"",mimeType:void 0}}var yu={encode(e,t=new ye){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=MS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return yu.fromPartial(e??{})},fromPartial(e){let t=MS();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function LS(){return{data:void 0,url:void 0}}var Rt={encode(e,t=new ye){return e.data!==void 0&&hu.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&yu.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=LS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=hu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=yu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Rt.fromPartial(e??{})},fromPartial(e){let t=LS();return t.data=e.data!==void 0&&e.data!==null?hu.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?yu.fromPartial(e.url):void 0,t}};function qS(){return{text:""}}var vu={encode(e,t=new ye){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=qS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vu.fromPartial(e??{})},fromPartial(e){let t=qS();return t.text=e.text??"",t}};function jS(){return{source:void 0,metadata:void 0}}var Su={encode(e,t=new ye){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=jS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Su.fromPartial(e??{})},fromPartial(e){let t=jS();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function US(){return{source:void 0,metadata:void 0}}var bu={encode(e,t=new ye){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=US();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return bu.fromPartial(e??{})},fromPartial(e){let t=US();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function VS(){return{source:void 0,metadata:void 0}}var Au={encode(e,t=new ye){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=VS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Au.fromPartial(e??{})},fromPartial(e){let t=VS();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function GS(){return{source:void 0,metadata:void 0}}var wu={encode(e,t=new ye){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=GS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=se.unwrap(se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return wu.fromPartial(e??{})},fromPartial(e){let t=GS();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function BS(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var xu={encode(e,t=new ye){return e.text!==void 0&&vu.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Su.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&bu.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Au.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&wu.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=BS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=vu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=Su.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=bu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=Au.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=wu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xu.fromPartial(e??{})},fromPartial(e){let t=BS();return t.text=e.text!==void 0&&e.text!==null?vu.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Su.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?bu.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Au.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?wu.fromPartial(e.document):void 0,t}};function $S(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var Cu={encode(e,t=new ye){e.id!==""&&t.uint32(10).string(e.id),e.role!==""&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let r of e.toolCalls)mu.encode(r,t.uint32(42).fork()).join();e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error);for(let r of e.contentParts)xu.encode(r,t.uint32(66).fork()).join();return e.metadata!==void 0&&ut.encode(ut.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=$S();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.role=r.string();continue;case 3:if(i!==26)break;o.content=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue;case 5:if(i!==42)break;o.toolCalls.push(mu.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.toolCallId=r.string();continue;case 7:if(i!==58)break;o.error=r.string();continue;case 8:if(i!==66)break;o.contentParts.push(xu.decode(r,r.uint32()));continue;case 9:if(i!==74)break;o.metadata=ut.unwrap(ut.decode(r,r.uint32()));continue;case 10:if(i!==82)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Cu.fromPartial(e??{})},fromPartial(e){let t=$S();return t.id=e.id??"",t.role=e.role??"",t.content=e.content??void 0,t.name=e.name??void 0,t.toolCalls=e.toolCalls?.map(r=>mu.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>xu.fromPartial(r))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function QS(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var Eu={encode(e,t=new ye){return e.id!==""&&t.uint32(10).string(e.id),e.reason!==""&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&se.encode(se.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=QS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.reason=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.toolCallId=r.string();continue;case 5:if(i!==42)break;o.responseSchema=se.unwrap(se.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.expiresAt=r.string();continue;case 7:if(i!==58)break;o.metadata=se.unwrap(se.decode(r,r.uint32()));continue;case 8:if(i!==66)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Eu.fromPartial(e??{})},fromPartial(e){let t=QS();return t.id=e.id??"",t.reason=e.reason??"",t.message=e.message??void 0,t.toolCallId=e.toolCallId??void 0,t.responseSchema=e.responseSchema??void 0,t.expiresAt=e.expiresAt??void 0,t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}},MO=function(e){return e[e.TEXT_MESSAGE_START=0]="TEXT_MESSAGE_START",e[e.TEXT_MESSAGE_CONTENT=1]="TEXT_MESSAGE_CONTENT",e[e.TEXT_MESSAGE_END=2]="TEXT_MESSAGE_END",e[e.TOOL_CALL_START=3]="TOOL_CALL_START",e[e.TOOL_CALL_ARGS=4]="TOOL_CALL_ARGS",e[e.TOOL_CALL_END=5]="TOOL_CALL_END",e[e.STATE_SNAPSHOT=6]="STATE_SNAPSHOT",e[e.STATE_DELTA=7]="STATE_DELTA",e[e.MESSAGES_SNAPSHOT=8]="MESSAGES_SNAPSHOT",e[e.RAW=9]="RAW",e[e.CUSTOM=10]="CUSTOM",e[e.RUN_STARTED=11]="RUN_STARTED",e[e.RUN_FINISHED=12]="RUN_FINISHED",e[e.RUN_ERROR=13]="RUN_ERROR",e[e.STEP_STARTED=14]="STEP_STARTED",e[e.STEP_FINISHED=15]="STEP_FINISHED",e[e.SUBAGENT_STARTED=16]="SUBAGENT_STARTED",e[e.SUBAGENT_FINISHED=17]="SUBAGENT_FINISHED",e[e.SUBAGENT_ERROR=18]="SUBAGENT_ERROR",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function HS(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var ie={encode(e,t=new ye){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&se.encode(se.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&ut.encode(ut.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=HS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.type=r.int32();continue;case 2:if(i!==16)break;o.timestamp=Yo(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=se.unwrap(se.decode(r,r.uint32()));continue;case 4:if(i!==34)break;o.metadata=ut.unwrap(ut.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ie.fromPartial(e??{})},fromPartial(e){let t=HS();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t.metadata=e.metadata??void 0,t}};function zS(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0,subagentRunId:void 0}}var Ru={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=zS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue;case 5:if(i!==42)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ru.fromPartial(e??{})},fromPartial(e){let t=zS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function WS(){return{baseEvent:void 0,messageId:"",delta:"",subagentRunId:void 0}}var Iu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=WS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue;case 4:if(i!==34)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Iu.fromPartial(e??{})},fromPartial(e){let t=WS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function KS(){return{baseEvent:void 0,messageId:"",subagentRunId:void 0}}var Tu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=KS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Tu.fromPartial(e??{})},fromPartial(e){let t=KS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function YS(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0,subagentRunId:void 0}}var _u={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=YS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue;case 5:if(i!==42)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return _u.fromPartial(e??{})},fromPartial(e){let t=YS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function XS(){return{baseEvent:void 0,toolCallId:"",delta:"",subagentRunId:void 0}}var ku={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=XS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue;case 4:if(i!==34)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ku.fromPartial(e??{})},fromPartial(e){let t=XS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function ZS(){return{baseEvent:void 0,toolCallId:"",subagentRunId:void 0}}var Ou={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=ZS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ou.fromPartial(e??{})},fromPartial(e){let t=ZS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function JS(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var Pu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&se.encode(se.wrap(e.snapshot),t.uint32(18).fork()).join(),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=JS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=se.unwrap(se.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Pu.fromPartial(e??{})},fromPartial(e){let t=JS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function eb(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var Nu={encode(e,t=new ye){e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)fu.encode(r,t.uint32(18).fork()).join();return e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=eb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(fu.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Nu.fromPartial(e??{})},fromPartial(e){let t=eb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>fu.fromPartial(r))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function tb(){return{baseEvent:void 0,messages:[]}}var Fu={encode(e,t=new ye){e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Cu.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=tb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(Cu.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Fu.fromPartial(e??{})},fromPartial(e){let t=tb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Cu.fromPartial(r))||[],t}};function rb(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var Du={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&se.encode(se.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=rb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=se.unwrap(se.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.source=r.string();continue;case 4:if(i!==34)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Du.fromPartial(e??{})},fromPartial(e){let t=rb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function nb(){return{baseEvent:void 0,name:"",value:void 0,subagentRunId:void 0}}var Mu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&se.encode(se.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=nb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=se.unwrap(se.decode(r,r.uint32()));continue;case 4:if(i!==34)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Mu.fromPartial(e??{})},fromPartial(e){let t=nb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function ob(){return{baseEvent:void 0,threadId:"",runId:""}}var Lu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=ob();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Lu.fromPartial(e??{})},fromPartial(e){let t=ob();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function ib(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var Un={encode(e,t=new ye){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=ib();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.provider=r.string();continue;case 2:if(i!==18)break;o.model=r.string();continue;case 3:if(i!==24)break;o.inputTokens=Yo(r.int64());continue;case 4:if(i!==32)break;o.outputTokens=Yo(r.int64());continue;case 5:if(i!==40)break;o.totalTokens=Yo(r.int64());continue;case 6:if(i!==48)break;o.reasoningTokens=Yo(r.int64());continue;case 7:if(i!==56)break;o.cachedInputTokens=Yo(r.int64());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Un.fromPartial(e??{})},fromPartial(e){let t=ib();return t.provider=e.provider??void 0,t.model=e.model??void 0,t.inputTokens=e.inputTokens??void 0,t.outputTokens=e.outputTokens??void 0,t.totalTokens=e.totalTokens??void 0,t.reasoningTokens=e.reasoningTokens??void 0,t.cachedInputTokens=e.cachedInputTokens??void 0,t}};function ab(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var qu={encode(e,t=new ye){e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&se.encode(se.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)Eu.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)Un.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=ab();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue;case 4:if(i!==34)break;o.result=se.unwrap(se.decode(r,r.uint32()));continue;case 5:if(i!==42)break;o.outcome=r.string();continue;case 6:if(i!==50)break;o.interrupts.push(Eu.decode(r,r.uint32()));continue;case 7:if(i!==58)break;o.usage.push(Un.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return qu.fromPartial(e??{})},fromPartial(e){let t=ab();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interrupts=e.interrupts?.map(r=>Eu.fromPartial(r))||[],t.usage=e.usage?.map(r=>Un.fromPartial(r))||[],t}};function sb(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var ju={encode(e,t=new ye){e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message);for(let r of e.usage)Un.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=sb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.code=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.usage.push(Un.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ju.fromPartial(e??{})},fromPartial(e){let t=sb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>Un.fromPartial(r))||[],t}};function cb(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Uu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=cb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Uu.fromPartial(e??{})},fromPartial(e){let t=cb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function ub(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Vu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=ub();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Vu.fromPartial(e??{})},fromPartial(e){let t=ub();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function lb(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var Gu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=lb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.delta=r.string();continue;case 5:if(i!==42)break;o.name=r.string();continue;case 6:if(i!==50)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Gu.fromPartial(e??{})},fromPartial(e){let t=lb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function db(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var Bu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=db();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue;case 5:if(i!==42)break;o.delta=r.string();continue;case 6:if(i!==50)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Bu.fromPartial(e??{})},fromPartial(e){let t=db();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function pb(){return{baseEvent:void 0,subagentRunId:"",name:"",description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var $u={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.name!==""&&t.uint32(26).string(e.name),e.description!==void 0&&t.uint32(34).string(e.description),e.parentSubagentRunId!==void 0&&t.uint32(42).string(e.parentSubagentRunId),e.parentToolCallId!==void 0&&t.uint32(50).string(e.parentToolCallId),e.parentMessageId!==void 0&&t.uint32(58).string(e.parentMessageId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=pb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=r.string();continue;case 3:if(i!==26)break;o.name=r.string();continue;case 4:if(i!==34)break;o.description=r.string();continue;case 5:if(i!==42)break;o.parentSubagentRunId=r.string();continue;case 6:if(i!==50)break;o.parentToolCallId=r.string();continue;case 7:if(i!==58)break;o.parentMessageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return $u.fromPartial(e??{})},fromPartial(e){let t=pb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.name=e.name??"",t.description=e.description??void 0,t.parentSubagentRunId=e.parentSubagentRunId??void 0,t.parentToolCallId=e.parentToolCallId??void 0,t.parentMessageId=e.parentMessageId??void 0,t}};function fb(){return{baseEvent:void 0,subagentRunId:"",result:void 0,outcome:"",interruptIds:[]}}var Qu={encode(e,t=new ye){e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&se.encode(se.wrap(e.result),t.uint32(26).fork()).join(),e.outcome!==""&&t.uint32(34).string(e.outcome);for(let r of e.interruptIds)t.uint32(42).string(r);return t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=fb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=r.string();continue;case 3:if(i!==26)break;o.result=se.unwrap(se.decode(r,r.uint32()));continue;case 4:if(i!==34)break;o.outcome=r.string();continue;case 5:if(i!==42)break;o.interruptIds.push(r.string());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Qu.fromPartial(e??{})},fromPartial(e){let t=fb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interruptIds=e.interruptIds?.map(r=>r)||[],t}};function mb(){return{baseEvent:void 0,subagentRunId:"",message:"",code:void 0}}var Hu={encode(e,t=new ye){return e.baseEvent!==void 0&&ie.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.message!==""&&t.uint32(26).string(e.message),e.code!==void 0&&t.uint32(34).string(e.code),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=mb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ie.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.code=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Hu.fromPartial(e??{})},fromPartial(e){let t=mb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ie.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.message=e.message??"",t.code=e.code??void 0,t}};function gb(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0,subagentStarted:void 0,subagentFinished:void 0,subagentError:void 0}}var hb={encode(e,t=new ye){return e.textMessageStart!==void 0&&Ru.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Iu.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Tu.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&_u.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&ku.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Ou.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Pu.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Nu.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Fu.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Du.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Mu.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Lu.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&qu.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&ju.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Uu.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Vu.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Gu.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Bu.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&$u.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&Qu.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&Hu.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=gb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=Ru.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=Iu.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=Tu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=_u.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=ku.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=Ou.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=Pu.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Nu.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=Fu.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Du.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Mu.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Lu.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=qu.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=ju.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Uu.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=Vu.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=Gu.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Bu.decode(r,r.uint32());continue;case 19:if(i!==154)break;o.subagentStarted=$u.decode(r,r.uint32());continue;case 20:if(i!==162)break;o.subagentFinished=Qu.decode(r,r.uint32());continue;case 21:if(i!==170)break;o.subagentError=Hu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return hb.fromPartial(e??{})},fromPartial(e){let t=gb();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Ru.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Iu.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Tu.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?_u.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?ku.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Ou.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Pu.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Nu.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Fu.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Du.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Mu.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Lu.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?qu.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?ju.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Uu.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Vu.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Gu.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Bu.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?$u.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?Qu.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?Hu.fromPartial(e.subagentError):void 0,t}};function Yo(e){let t=w.Number(e.toString());if(t>w.Number.MAX_SAFE_INTEGER)throw new w.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<w.Number.MIN_SAFE_INTEGER)throw new w.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var yb=e=>e&&typeof e=="object"?e:void 0;var pu=e=>{let t=yb(e);if(t){if(t.data){let r=t.data;return{type:"data",value:r.value,mimeType:r.mimeType}}if(t.url){let r=t.url;return{type:"url",value:r.value,mimeType:r.mimeType}}}},LO=e=>{let t=yb(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:pu(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:pu(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:pu(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:pu(r.source),metadata:r.metadata}}}};function vb(e){let t=hb.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=MO[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.baseEvent.metadata!==void 0&&(r.metadata=r.baseEvent.metadata),delete r.baseEvent,r.type===F.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;if(o.role==="user"&&Array.isArray(o.contentParts)){let i=o.contentParts.map(a=>LO(a)).filter(a=>a!==void 0);i.length>0&&(o.content=i)}Array.isArray(o.contentParts)&&o.contentParts.length===0&&(o.contentParts=void 0),o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===F.RUN_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,i=Array.isArray(n.interrupts)?n.interrupts:[];delete n.interrupts,o==="interrupt"?n.outcome={type:"interrupt",interrupts:i}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if(r.type===F.SUBAGENT_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,i=Array.isArray(n.interruptIds)?n.interruptIds:[];delete n.interruptIds,o==="suspended"?n.outcome={type:"suspended",...(i.length>0&&{interruptIds:i})}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if((r.type===F.RUN_FINISHED||r.type===F.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===F.STATE_DELTA)for(let n of r.delta)n.op=DO[n.op].toLowerCase(),Object.keys(n).forEach(o=>{n[o]===void 0&&delete n[o]});return Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n]}),_c.parse(r)}var Sf="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var jO=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,bf=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(jO);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Sb=e=>e==="*"||e==="x"||e==="X",bb=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},UO=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],VO=(e,t)=>{if(Sb(e)||Sb(t))return 0;let[r,n]=UO(bb(e),bb(t));return r>n?1:r<n?-1:0},Af=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=VO(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Xo=(e,t)=>{let r=bf(e),n=bf(t),o=r.pop(),i=n.pop(),a=Af(r,n);return a!==0?a:o&&i?Af(o.split("."),i.split(".")):o||i?o?-1:1:0};var Te=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function ba(){return Ur()}function Cf(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&Cf(t);return e}var Ab=512*1024;function wb(e,t,r){let n=0,o=[e,t],i=new WeakSet;for(;o.length>0;){let a=o.pop();if(typeof a=="string"){if(n+=a.length,n>r)return!0}else if(typeof a=="object"&&a){if(i.has(a))continue;if(i.add(a),Array.isArray(a))for(let s=0;s<a.length;s++)o.push(a[s]);else{let s=Object.keys(a);for(let u=0;u<s.length;u++){let c=s[u];if(n+=c.length,n>r)return!0;o.push(a[c])}}}}return!1}function Pe(_x88,_x89,_x90,_x91){return _Pe.apply(this,arguments)}function _Pe(){_Pe=_asyncToGenerator(function*(e,t,r,n){let o=typeof process<"u"&&process.env!==void 0,i=o&&!!process.env.VITEST_WORKER_ID,a=o&&!!process.env.VITEST_WORKER_ID,s=a&&!wb(t,r,Ab),u=s?Te(t):t,c=s?Te(r):r,g=!1,v=!1,R;for(let h of e)try{s&&(Cf(u),Cf(c));let y=yield n(h,u,c);if(y===void 0)continue;let b=!1;if(y.messages!==void 0&&y.messages!==u&&(u=Te(y.messages),g=!0,b=!0),y.state!==void 0&&y.state!==c&&(c=Te(y.state),v=!0,b=!0),s&&b&&wb(u,c,Ab)&&(s=!1),R=y.stopPropagation,R===!0)break}catch(y){if(a&&y instanceof TypeError){if(i)throw y;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",y)}else i||console.error("Subscriber error:",y);continue}return{...(g?{messages:Object.isFrozen(u)?Te(u):u}:{}),...(v?{state:Object.isFrozen(c)?Te(c):c}:{}),...(R===void 0?{}:{stopPropagation:R})}});return _Pe.apply(this,arguments)}function zu(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,r=e.lifecycle??!0,n=e.verbose??!1;return{enabled:t||r,events:t,lifecycle:r,verbose:n}}function Aa(e){if(e instanceof Ef)return e;if(e===!0)return new Ef(zu(!0))}var Ef=class{constructor(e){this.config=e}event(e,t,r,n){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof r=="string"?r:JSON.stringify(r)):console.debug(`[${e}] ${t}`,n??r))}lifecycle(e,t,r){this.config.lifecycle&&(r?console.debug(`[${e}] ${t}`,r):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function wf(e){return e.enabled?new Ef(e):void 0}function GO(e,t,r){if(t){let o=e.find(a=>a.id===t);if(o?.role==="assistant")return o;o&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${o.role}' message, not assistant \u2014 falling back to toolCallId`);let i={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(i),i}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}function It(e,t){return!e||t.metadata===void 0?!1:(e.metadata=Gv(e.metadata,Te(t.metadata)),!0)}var Pb=(e,t,r,n,o)=>{let i=Aa(o),a=Te(r.messages),s=Te(e.state),u={},c=v=>{v.messages!==void 0&&(a=v.messages,u.messages=v.messages),v.state!==void 0&&(s=v.state,u.state=v.state)},g=()=>{let v=Te(u);return u={},v.messages!==void 0||v.state!==void 0?Oe(v):Hc};return t.pipe(su(/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(v){let R=yield Pe(n,a,s,(h,y,b)=>h.onEvent?.({event:v,agent:r,input:e,messages:y,state:b}));if(c(R),R.stopPropagation===!0?i?.event("APPLY","Event dropped:",v,{type:v.type,reason:"stopPropagation by subscriber"}):i?.event("APPLY","Event applied:",v,{type:v.type,subscribers:n.length}),R.stopPropagation===!0)return g();switch(v.type){case F.TEXT_MESSAGE_START:{let h=yield Pe(n,a,s,(y,b,x)=>y.onTextMessageStartEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,role:b="assistant",name:x,subagentRunId:I}=v,_=a.find(A=>A.id===y);if(_?.role==="activity")return console.warn(`TEXT_MESSAGE_START: Message '${y}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let T=_;if(!T){let A={id:y,role:b,content:"",...(x!==void 0&&{name:x}),...(I!=null&&{subagentRunId:I})};a.push(A),T=A}let P=It(T,v);(!_||P)&&c({messages:a})}return g()}case F.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,b=a.find(I=>I.id===h);if(!b)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();if(b.role==="activity")return console.warn(`TEXT_MESSAGE_CONTENT: Message '${h}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let x=yield Pe(n,a,s,(I,_,T)=>I.onTextMessageContentEvent?.({event:v,messages:_,state:T,agent:r,input:e,textMessageBuffer:typeof b.content=="string"?b.content:""}));return c(x),x.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${y}`,It(b,v),c({messages:a})),g()}case F.TEXT_MESSAGE_END:{let{messageId:h}=v,y=a.find(x=>x.id===h);if(!y)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g();if(y.role==="activity")return console.warn(`TEXT_MESSAGE_END: Message '${h}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let b=yield Pe(n,a,s,(x,I,_)=>x.onTextMessageEndEvent?.({event:v,messages:I,state:_,agent:r,input:e,textMessageBuffer:typeof y.content=="string"?y.content:""}));return c(b),b.stopPropagation!==!0&&It(y,v)&&c({messages:a}),yield Promise.all(n.map(x=>{x.onNewMessage?.({message:y,messages:a,state:s,agent:r,input:e})})),g()}case F.TOOL_CALL_START:{let h=yield Pe(n,a,s,(y,b,x)=>y.onToolCallStartEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:b,parentMessageId:x,subagentRunId:I}=v,_=a.find(O=>O.toolCalls?.some(k=>k.id===y))?.toolCalls?.find(O=>O.id===y);if(_){let O=_.function.name!==b;return O&&(console.warn(`TOOL_CALL_START: tool call '${y}' already exists with name '${_.function.name}' \u2014 updating it to '${b}'`),_.function.name=b),(It(_,v)||O)&&c({messages:a}),g()}let T=new Set(a.map(O=>O.id)),P=GO(a,x,y);!T.has(P.id)&&I!=null&&P.subagentRunId===void 0&&(P.subagentRunId=I),P.toolCalls??(P.toolCalls=[]);let A={id:y,type:"function",function:{name:b,arguments:""}};P.toolCalls.push(A),It(A,v),c({messages:a})}return g()}case F.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=v,b=a.find(_=>_.toolCalls?.some(T=>T.id===h));if(!b)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let x=b.toolCalls?.find(_=>_.id===h);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=yield Pe(n,a,s,(_,T,P)=>{let A=x.function.arguments,O=x.function.name,k={};try{k=lu(A)}catch{}return _.onToolCallArgsEvent?.({event:v,messages:T,state:P,agent:r,input:e,toolCallBuffer:A,toolCallName:O,partialToolCallArgs:k})});return c(I),I.stopPropagation!==!0&&(x.function.arguments+=y,It(x,v),c({messages:a})),g()}case F.TOOL_CALL_END:{let{toolCallId:h}=v,y=a.find(I=>I.toolCalls?.some(_=>_.id===h));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let b=y.toolCalls?.find(I=>I.id===h);if(!b)return console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g();let x=yield Pe(n,a,s,(I,_,T)=>{let P=b.function.arguments,A=b.function.name,O={};try{O=JSON.parse(P)}catch{}return I.onToolCallEndEvent?.({event:v,messages:_,state:T,agent:r,input:e,toolCallName:A,toolCallArgs:O})});return c(x),x.stopPropagation!==!0&&It(b,v)&&c({messages:a}),yield Promise.all(n.map(I=>{I.onNewToolCall?.({toolCall:b,messages:a,state:s,agent:r,input:e})})),g()}case F.TOOL_CALL_RESULT:{let h=yield Pe(n,a,s,(y,b,x)=>y.onToolCallResultEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:b,content:x,role:I,subagentRunId:_}=v,T={id:y,toolCallId:b,role:I||"tool",content:x,...(_!=null&&{subagentRunId:_})};It(T,v);let P=a.findIndex(A=>A.role==="assistant"&&A.toolCalls?.some(O=>O.id===b));if(P===-1)a.push(T);else{let A=P+1;for(;A<a.length&&a[A].role==="tool";)A++;a.splice(A,0,T)}yield Promise.all(n.map(A=>{A.onNewMessage?.({message:T,messages:a,state:s,agent:r,input:e})})),c({messages:a})}return g()}case F.STATE_SNAPSHOT:{let h=yield Pe(n,a,s,(y,b,x)=>y.onStateSnapshotEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{snapshot:y}=v;s=y,c({state:s})}return g()}case F.STATE_DELTA:{let h=yield Pe(n,a,s,(y,b,x)=>y.onStateDeltaEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{delta:y}=v;try{s=Lc.applyPatch(s,y,!0,!1).newDocument,c({state:s})}catch(b){let x=b instanceof Error?b.message:String(b);console.warn(`Failed to apply state patch:
|
|
37
37
|
Current state: ${JSON.stringify(s,null,2)}
|
|
38
38
|
Patch operations: ${JSON.stringify(y,null,2)}
|
|
39
|
-
Error: ${E}`)}}return h()}case M.MESSAGES_SNAPSHOT:{let g=yield Oe(n,a,s,(y,S,E)=>y.onMessagesSnapshotEvent?.({event:v,messages:S,state:E,agent:r,input:e}));if(u(g),g.stopPropagation!==!0){let{messages:y}=v,S=new Map(y.map(T=>[T.id,T])),E=y.some(T=>T.role==="activity"),R=y.some(T=>T.role==="reasoning"),k=T=>T.role==="activity"&&!E||T.role==="reasoning"&&!R;a=a.filter(T=>k(T)||S.has(T.id)).map(T=>k(T)?T:S.get(T.id));let I=new Set(a.map(T=>T.id));for(let T of y)I.has(T.id)||a.push(T);u({messages:a})}return h()}case M.ACTIVITY_SNAPSHOT:{let g=v,y=a.findIndex(I=>I.id===g.messageId),S=y>=0?a[y]:void 0,E=S?.role==="activity"?S:void 0,R=g.replace??!0,k=yield Oe(n,a,s,(I,T,_)=>I.onActivitySnapshotEvent?.({event:g,messages:T,state:_,agent:r,input:e,activityMessage:E,existingMessage:S}));if(u(k),k.stopPropagation!==!0){let I={id:g.messageId,role:"activity",activityType:g.activityType,content:Re(g.content)},T;y===-1?(a.push(I),T=I):E?R&&(a[y]={...E,activityType:g.activityType,content:Re(g.content)}):R&&(a[y]=I,T=I),u({messages:a}),T&&(yield Promise.all(n.map(_=>_.onNewMessage?.({message:T,messages:a,state:s,agent:r,input:e}))))}return h()}case M.ACTIVITY_DELTA:{let g=v,y=a.findIndex(k=>k.id===g.messageId);if(y===-1)return h();let S=a[y];if(S.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${g.messageId}' is not an activity message`),h();let E=S,R=yield Oe(n,a,s,(k,I,T)=>k.onActivityDeltaEvent?.({event:g,messages:I,state:T,agent:r,input:e,activityMessage:E}));if(u(R),R.stopPropagation!==!0)try{let k=Re(E.content??{}),I=Oc.applyPatch(k,g.patch??[],!0,!1).newDocument;a[y]={...E,content:Re(I),activityType:g.activityType},u({messages:a})}catch(k){let I=k instanceof Error?k.message:String(k);console.warn(`Failed to apply activity patch for '${g.messageId}': ${I}`)}return h()}case M.RAW:return u(yield Oe(n,a,s,(g,y,S)=>g.onRawEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),h();case M.CUSTOM:return u(yield Oe(n,a,s,(g,y,S)=>g.onCustomEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),h();case M.RUN_STARTED:{let g=yield Oe(n,a,s,(y,S,E)=>y.onRunStartedEvent?.({event:v,messages:S,state:E,agent:r,input:e}));if(u(g),g.stopPropagation!==!0){let y=v;if(y.input?.messages){for(let S of y.input.messages)a.find(E=>E.id===S.id)||a.push(S);u({messages:a})}}return h()}case M.RUN_FINISHED:{let g=v,y=g.outcome?.type==="interrupt"?{event:g,outcome:"interrupt",interrupts:g.outcome.interrupts}:{event:g,outcome:"success",result:g.result},S=yield Oe(n,a,s,(E,R,k)=>E.onRunFinishedEvent?.({...y,messages:R,state:k,agent:r,input:e}));return u(S),S.stopPropagation!==!0&&(r.pendingInterrupts=y.outcome==="interrupt"?[...y.interrupts]:[]),h()}case M.RUN_ERROR:return u(yield Oe(n,a,s,(g,y,S)=>g.onRunErrorEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),h();case M.STEP_STARTED:return u(yield Oe(n,a,s,(g,y,S)=>g.onStepStartedEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),h();case M.STEP_FINISHED:return u(yield Oe(n,a,s,(g,y,S)=>g.onStepFinishedEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),h();case M.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case M.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case M.THINKING_START:return h();case M.THINKING_END:return h();case M.THINKING_TEXT_MESSAGE_START:return h();case M.THINKING_TEXT_MESSAGE_CONTENT:return h();case M.THINKING_TEXT_MESSAGE_END:return h();case M.REASONING_START:return u(yield Oe(n,a,s,(g,y,S)=>g.onReasoningStartEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),h();case M.REASONING_MESSAGE_START:{let g=yield Oe(n,a,s,(y,S,E)=>y.onReasoningMessageStartEvent?.({event:v,messages:S,state:E,agent:r,input:e}));if(u(g),g.stopPropagation!==!0){let{messageId:y}=v;if(!a.find(S=>S.id===y)){let S={id:y,role:"reasoning",content:""};a.push(S),u({messages:a})}}return h()}case M.REASONING_MESSAGE_CONTENT:{let{messageId:g,delta:y}=v,S=a.find(R=>R.id===g);if(!S)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${g}'`),h();let E=yield Oe(n,a,s,(R,k,I)=>R.onReasoningMessageContentEvent?.({event:v,messages:k,state:I,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}));return u(E),E.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${y}`,u({messages:a})),h()}case M.REASONING_MESSAGE_END:{let{messageId:g}=v,y=a.find(S=>S.id===g);return y?(u(yield Oe(n,a,s,(S,E,R)=>S.onReasoningMessageEndEvent?.({event:v,messages:E,state:R,agent:r,input:e,reasoningMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(S=>{S.onNewMessage?.({message:y,messages:a,state:s,agent:r,input:e})})),h()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${g}'`),h())}case M.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case M.REASONING_END:return u(yield Oe(n,a,s,(g,y,S)=>g.onReasoningEndEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),h();case M.REASONING_ENCRYPTED_VALUE:{let{subtype:g,entityId:y,encryptedValue:S}=v,E=yield Oe(n,a,s,(R,k,I)=>R.onReasoningEncryptedValueEvent?.({event:v,messages:k,state:I,agent:r,input:e}));if(u(E),E.stopPropagation!==!0){let R=!1;if(g==="tool-call"){for(let k of a)if(k.role==="assistant"&&k.toolCalls){let I=k.toolCalls.find(T=>T.id===y);if(I){I.encryptedValue=S,R=!0;break}}}else{let k=a.find(I=>I.id===y);k?.role!=="activity"&&k&&(k.encryptedValue=S,R=!0)}R&&(c.messages=a)}return h()}}return v.type,h()});return function(_x92){return _ref43.apply(this,arguments)}}()),$p(),n.length>0?Qp({}):v=>v)},df=e=>t=>{let r=ya(e),n=new Map,o=new Map,i=!1,a=!1,s=!1,c=new Map,u=!1,h=!1,v=!1,C=()=>{n.clear(),o.clear(),c.clear(),u=!1,h=!1,i=!1,a=!1,v=!0};return t.pipe(wt(g=>{let y=g.type;if(r?.event("VERIFY","Event:",g,{type:g.type}),a)return Ve(()=>new Le(`Cannot send event type '${y}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(i&&y!==M.RUN_ERROR&&y!==M.RUN_STARTED)return Ve(()=>new Le(`Cannot send event type '${y}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(s){if(y===M.RUN_STARTED){if(v&&!i)return Ve(()=>new Le("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));i&&C()}}else if(s=!0,y!==M.RUN_STARTED&&y!==M.RUN_ERROR)return Ve(()=>new Le("First event must be 'RUN_STARTED'"));switch(y){case M.TEXT_MESSAGE_START:{let S=g.messageId;return n.has(S)?Ve(()=>new Le(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${S}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(n.set(S,!0),Ge(g))}case M.TEXT_MESSAGE_CONTENT:{let S=g.messageId;return n.has(S)?Ge(g):Ve(()=>new Le(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${S}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case M.TEXT_MESSAGE_END:{let S=g.messageId;return n.has(S)?(n.delete(S),Ge(g)):Ve(()=>new Le(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${S}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case M.TOOL_CALL_START:{let S=g.toolCallId;return o.has(S)?Ve(()=>new Le(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${S}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(o.set(S,!0),Ge(g))}case M.TOOL_CALL_ARGS:{let S=g.toolCallId;return o.has(S)?Ge(g):Ve(()=>new Le(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${S}'. Start a tool call with 'TOOL_CALL_START' first.`))}case M.TOOL_CALL_END:{let S=g.toolCallId;return o.has(S)?(o.delete(S),Ge(g)):Ve(()=>new Le(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${S}'. A 'TOOL_CALL_START' event must be sent first.`))}case M.STEP_STARTED:{let S=g.stepName;return c.has(S)?Ve(()=>new Le(`Step "${S}" is already active for 'STEP_STARTED'`)):(c.set(S,!0),Ge(g))}case M.STEP_FINISHED:{let S=g.stepName;return c.has(S)?(c.delete(S),Ge(g)):Ve(()=>new Le(`Cannot send 'STEP_FINISHED' for step "${S}" that was not started`))}case M.RUN_STARTED:return v=!0,Ge(g);case M.RUN_FINISHED:if(c.size>0){let S=Array.from(c.keys()).join(", ");return Ve(()=>new Le(`Cannot send 'RUN_FINISHED' while steps are still active: ${S}`))}if(n.size>0){let S=Array.from(n.keys()).join(", ");return Ve(()=>new Le(`Cannot send 'RUN_FINISHED' while text messages are still active: ${S}`))}if(o.size>0){let S=Array.from(o.keys()).join(", ");return Ve(()=>new Le(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${S}`))}return i=!0,Ge(g);case M.RUN_ERROR:return a=!0,Ge(g);case M.CUSTOM:return Ge(g);case M.THINKING_TEXT_MESSAGE_START:return u?h?Ve(()=>new Le("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(h=!0,Ge(g)):Ve(()=>new Le("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case M.THINKING_TEXT_MESSAGE_CONTENT:return h?Ge(g):Ve(()=>new Le("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case M.THINKING_TEXT_MESSAGE_END:return h?(h=!1,Ge(g)):Ve(()=>new Le("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case M.THINKING_START:return u?Ve(()=>new Le("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(u=!0,Ge(g));case M.THINKING_END:return u?(u=!1,Ge(g)):Ve(()=>new Le("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Ge(g)}}))},jn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),fO=e=>eu(()=>Fn(e())).pipe(Hp(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return Fn(t.text()).pipe(wt(i=>{let a=i;if(o.includes("application/json"))try{a=JSON.parse(i)}catch{}let s=Error(`HTTP ${t.status}: ${typeof a=="string"?a:JSON.stringify(a)}`);return s.status=t.status,s.payload=a,Ve(()=>s)}))}let r={type:jn.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new Ue(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:a}=yield n.read();if(i)break;let s={type:jn.DATA,data:a};o.next(s)}o.complete()}catch(i){o.error(i)}})(),()=>{n.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):Ve(()=>Error("Failed to getReader() from response"))})),mO=(e,t)=>{let r=ya(t),n=new rr,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:s=>{if(s.type!==jn.HEADERS&&s.type===jn.DATA&&s.data){let c=o.decode(s.data,{stream:!0});i+=c;let u=i.split(/\n\n/);i=u.pop()||"";for(let h of u)a(h)}},error:s=>n.error(s),complete:()=>{i&&(i+=o.decode(),a(i)),n.complete()}});function a(s){let c=s.split(`
|
|
40
|
-
`),
|
|
41
|
-
`),v=JSON.parse(
|
|
42
|
-
`)},_O=(e,t,r)=>n=>{let o={},i=!0,a=!0,s="",c=null,u=null,h=[],v={},C=g=>{typeof g=="object"&&g&&("messages"in g&&delete g.messages,o=g)};return n.pipe(wt(g=>{switch(g.type){case M.TEXT_MESSAGE_START:{let y=g;return[{type:qe.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case M.TEXT_MESSAGE_CONTENT:{let y=g;return[{type:qe.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case M.TEXT_MESSAGE_END:{let y=g;return[{type:qe.enum.TextMessageEnd,messageId:y.messageId}]}case M.TOOL_CALL_START:{let y=g;return h.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),a=!0,v[y.toolCallId]=y.toolCallName,[{type:qe.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case M.TOOL_CALL_ARGS:{let y=g,S=h.find(R=>R.id===y.toolCallId);if(!S)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];S.function.arguments+=y.delta;let E=!1;if(u){let R=u.find(k=>k.tool==S.function.name);if(R)try{let k=JSON.parse(nu(S.function.arguments));R.tool_argument&&R.tool_argument in k?(C({...o,[R.state_key]:k[R.tool_argument]}),E=!0):R.tool_argument||(C({...o,[R.state_key]:k}),E=!0)}catch{}}return[{type:qe.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(E?[{type:qe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]:[])]}case M.TOOL_CALL_END:{let y=g;return[{type:qe.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case M.TOOL_CALL_RESULT:{let y=g;return[{type:qe.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:v[y.toolCallId]||"unknown"}]}case M.RAW:return[];case M.CUSTOM:{let y=g;switch(y.name){case"Exit":i=!1;break;case"PredictState":u=y.value;break}return[{type:qe.enum.MetaEvent,name:y.name,value:y.value}]}case M.STATE_SNAPSHOT:return C(g.snapshot),[{type:qe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}];case M.STATE_DELTA:{let y=g,S=Oc.applyPatch(o,y.delta,!0,!1);return S?(C(S.newDocument),[{type:qe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]):[]}case M.MESSAGES_SNAPSHOT:return c=g.messages,[{type:qe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(c?{messages:c}:{})}),active:!0}];case M.RUN_STARTED:return[];case M.RUN_FINISHED:return c&&(o.messages=c),Object.keys(o).length===0?[]:[{type:qe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(c?{messages:kO(c)}:{})}),active:!1}];case M.RUN_ERROR:{let y=g;return[{type:qe.enum.RunError,message:y.message,code:y.code}]}case M.STEP_STARTED:return s=g.stepName,h=[],u=null,[{type:qe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case M.STEP_FINISHED:return h=[],u=null,[{type:qe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function kO(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=TO(r.content);if(n){let o={id:r.id,role:r.role,content:n};t.push(o)}if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0)for(let o of r.toolCalls){let i={id:o.id,name:o.function.name,arguments:JSON.parse(o.function.arguments),parentMessageId:r.id};t.push(i)}}else if(r.role==="tool"){let n="unknown";for(let i of e)if(i.role==="assistant"&&i.toolCalls?.length){for(let a of i.toolCalls)if(a.id===r.toolCallId){n=a.function.name;break}}let o={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(o)}return t}var ju=e=>t=>{let r=ya(e),n,o,i,a,s=()=>{if(!n||a!=="text")throw Error("No text message to close");let v={type:M.TEXT_MESSAGE_END,messageId:n.messageId};return a=void 0,n=void 0,r?.event("TRANSFORM","TEXT_MESSAGE_END",v,{messageId:v.messageId}),v},c=()=>{if(!o||a!=="tool")throw Error("No tool call to close");let v={type:M.TOOL_CALL_END,toolCallId:o.toolCallId};return a=void 0,o=void 0,r?.event("TRANSFORM","TOOL_CALL_END",v,{toolCallId:v.toolCallId}),v},u=()=>{if(!i||a!=="reasoning")throw Error("No reasoning message to close");let v={type:M.REASONING_MESSAGE_END,messageId:i.messageId};return a=void 0,i=void 0,r?.event("TRANSFORM","REASONING_MESSAGE_END",v,{messageId:v.messageId}),v},h=()=>a==="text"?[s()]:a==="tool"?[c()]:a==="reasoning"?[u()]:[];return t.pipe(wt(v=>{switch(v.type){case M.TEXT_MESSAGE_START:case M.TEXT_MESSAGE_CONTENT:case M.TEXT_MESSAGE_END:case M.TOOL_CALL_START:case M.TOOL_CALL_ARGS:case M.TOOL_CALL_END:case M.TOOL_CALL_RESULT:case M.STATE_SNAPSHOT:case M.STATE_DELTA:case M.MESSAGES_SNAPSHOT:case M.CUSTOM:case M.RUN_STARTED:case M.RUN_FINISHED:case M.RUN_ERROR:case M.STEP_STARTED:case M.STEP_FINISHED:case M.THINKING_START:case M.THINKING_END:case M.THINKING_TEXT_MESSAGE_START:case M.THINKING_TEXT_MESSAGE_CONTENT:case M.THINKING_TEXT_MESSAGE_END:case M.REASONING_START:case M.REASONING_MESSAGE_START:case M.REASONING_MESSAGE_CONTENT:case M.REASONING_MESSAGE_END:case M.REASONING_END:return[...h(),v];case M.RAW:case M.ACTIVITY_SNAPSHOT:case M.ACTIVITY_DELTA:case M.REASONING_ENCRYPTED_VALUE:return[v];case M.TEXT_MESSAGE_CHUNK:{let C=v,g=[];if((a!=="text"||C.messageId!==void 0&&C.messageId!==n?.messageId)&&g.push(...h()),a!=="text"){if(C.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");n={messageId:C.messageId,name:C.name},a="text";let y={type:M.TEXT_MESSAGE_START,messageId:C.messageId,role:C.role||"assistant",...(C.name!==void 0&&{name:C.name})};g.push(y),r?.event("TRANSFORM","TEXT_MESSAGE_START",y,{messageId:C.messageId})}if(C.delta!==void 0){let y={type:M.TEXT_MESSAGE_CONTENT,messageId:n.messageId,delta:C.delta};g.push(y),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",y,{messageId:n.messageId})}return g}case M.TOOL_CALL_CHUNK:{let C=v,g=[];if((a!=="tool"||C.toolCallId!==void 0&&C.toolCallId!==o?.toolCallId)&&g.push(...h()),a!=="tool"){if(C.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(C.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");o={toolCallId:C.toolCallId,toolCallName:C.toolCallName,parentMessageId:C.parentMessageId},a="tool";let y={type:M.TOOL_CALL_START,toolCallId:C.toolCallId,toolCallName:C.toolCallName,parentMessageId:C.parentMessageId};g.push(y),r?.event("TRANSFORM","TOOL_CALL_START",y,{toolCallId:C.toolCallId,toolCallName:C.toolCallName})}if(C.delta!==void 0){let y={type:M.TOOL_CALL_ARGS,toolCallId:o.toolCallId,delta:C.delta};g.push(y),r?.event("TRANSFORM","TOOL_CALL_ARGS",y,{toolCallId:o.toolCallId})}return g}case M.REASONING_MESSAGE_CHUNK:{let C=v,g=[];if((a!=="reasoning"||C.messageId&&C.messageId!==i?.messageId)&&g.push(...h()),a!=="reasoning"){if(C.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");i={messageId:C.messageId},a="reasoning";let y={type:M.REASONING_MESSAGE_START,messageId:C.messageId};g.push(y),r?.event("TRANSFORM","REASONING_MESSAGE_START",y,{messageId:C.messageId})}if(C.delta!==void 0){let y={type:M.REASONING_MESSAGE_CONTENT,messageId:i.messageId,delta:C.delta};g.push(y),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",y,{messageId:i.messageId})}return g}}return v.type,[]}),Mn(()=>{h()}))};function OO(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var Lu=class{runNext(e,t){return t.run(e).pipe(ju(!1))}runNextWithState(e,t){let r=Re(e.messages||[]),n=Re(e.state||{}),o=new Lc;return fb(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(tu(/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(a=>setTimeout(a,0)),{event:i,messages:Re(r),state:Re(n)}});return function(_x93){return _ref45.apply(this,arguments)}}()))}},PO=class extends Lu{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function NO(e){let t=e.content;if(Array.isArray(t)){let r=t.filter(n=>typeof n=="object"&&!!n&&"type"in n&&n.type==="text"&&typeof n.text=="string").map(n=>n.text).join("");return{...e,content:r}}return typeof t=="string"?e:{...e,content:""}}var FO=class extends Lu{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(NO)};return this.runNext(o,t)}},cb="THINKING_START",ub="THINKING_END",lb="THINKING_TEXT_MESSAGE_START",db="THINKING_TEXT_MESSAGE_CONTENT",pb="THINKING_TEXT_MESSAGE_END",DO=class extends Lu{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<"u"&&process.env!==void 0&&process.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(Dn(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case cb:{this.currentReasoningId=ha();let{title:t,...r}=e;return this.warnAboutTransformation(cb,M.REASONING_START),{...r,type:M.REASONING_START,messageId:this.currentReasoningId}}case lb:return this.currentMessageId=ha(),this.warnAboutTransformation(lb,M.REASONING_MESSAGE_START),{...e,type:M.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case db:{let{delta:t,...r}=e;return this.warnAboutTransformation(db,M.REASONING_MESSAGE_CONTENT),{...r,type:M.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??ha(),delta:t}}case pb:{let t=this.currentMessageId??ha();return this.warnAboutTransformation(pb,M.REASONING_MESSAGE_END),{...e,type:M.REASONING_MESSAGE_END,messageId:t}}case ub:{let t=this.currentReasoningId??ha();return this.warnAboutTransformation(ub,M.REASONING_END),{...e,type:M.REASONING_END,messageId:t}}default:return e}}};function MO(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function qO(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function jO(e){let t=MO(e.mimeType);return e.data?{type:t,source:{type:"data",value:e.data,mimeType:e.mimeType},...(e.filename?{metadata:{filename:e.filename}}:{})}:e.url?{type:t,source:{type:"url",value:e.url,mimeType:e.mimeType},...(e.filename?{metadata:{filename:e.filename}}:{})}:e}function LO(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>qO(n)?jO(n):n);return{...e,content:r}}var UO=class extends Lu{run(e,t){let r={...e,messages:e.messages.map(LO)};return this.runNext(r,t)}},VO="0.0.58",BO=class{get maxVersion(){return VO}get debug(){return this._debug}set debug(e){this._debug=qu(e),this._debugLogger=lf(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?lf(qu(!0)):void 0:this._debugLogger=e}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:i}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??jr(),this.messages=Re(n??[]),this.state=Re(o??{}),this._debug=qu(i),this._debugLogger=lf(this._debug),ga(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new FO),ga(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new DO),ga(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new UO)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(r=>typeof r=="function"?new PO(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this14=this;return _asyncToGenerator(function*(){try{_this14.isRunning=!0,_this14.agentId=_this14.agentId??jr();let r=_this14.prepareRunAgentInput(e);_this14.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this14.agentId,threadId:_this14.threadId});let n,o=new Set(_this14.messages.map(c=>c.id)),i=[{onRunFinishedEvent:c=>{c.outcome==="success"&&(n=c.result)}},..._this14.subscribers,t??{}];yield _this14.onInitialize(r,i),_this14.activeRunDetach$=new rr;let a;_this14.activeRunCompletionPromise=new Promise(c=>{a=c}),yield Jc(jc(()=>_this14.middlewares.length===0?_this14.run(r):_this14.middlewares.reduceRight((c,u)=>({run:h=>u.run(h,c),get messages(){return c.messages},get state(){return c.state}}),_this14).run(r),ju(_this14.debugLogger),df(_this14.debugLogger),c=>c.pipe(ru(_this14.activeRunDetach$)),c=>_this14.apply(r,c,i),c=>_this14.processApplyEvents(r,c,i),da(c=>(_this14.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this14.agentId,error:c instanceof Error?c.message:String(c)}),_this14.isRunning=!1,_this14.onError(r,c,i))),Mn(()=>{_this14.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this14.agentId,threadId:_this14.threadId}),_this14.isRunning=!1,_this14.onFinalize(r,i),a?.(),a=void 0,_this14.activeRunCompletionPromise=void 0,_this14.activeRunDetach$=void 0}))(Ge(null)));let s=Re(_this14.messages).filter(c=>!o.has(c.id));return{result:n,newMessages:s}}finally{_this14.isRunning=!1}})()}connect(e){throw new Op}connectAgent(e,t){var _this15=this;return _asyncToGenerator(function*(){try{_this15.isRunning=!0,_this15.agentId=_this15.agentId??jr();let r=_this15.prepareRunAgentInput(e),n,o=new Set(_this15.messages.map(c=>c.id)),i=[{onRunFinishedEvent:c=>{c.outcome==="success"&&(n=c.result)}},..._this15.subscribers,t??{}];yield _this15.onInitialize(r,i),_this15.activeRunDetach$=new rr;let a;_this15.activeRunCompletionPromise=new Promise(c=>{a=c}),yield Jc(jc(()=>eu(()=>_this15.connect(r)),ju(_this15.debugLogger),df(_this15.debugLogger),c=>c.pipe(ru(_this15.activeRunDetach$)),c=>_this15.apply(r,c,i),c=>_this15.processApplyEvents(r,c,i),da(c=>(_this15.isRunning=!1,c instanceof Op?Uc:_this15.onError(r,c,i))),Mn(()=>{_this15.isRunning=!1,_this15.onFinalize(r,i),a?.(),a=void 0,_this15.activeRunCompletionPromise=void 0,_this15.activeRunDetach$=void 0}))(Ge(null)),{defaultValue:void 0});let s=Re(_this15.messages).filter(c=>!o.has(c.id));return{result:n,newMessages:s}}finally{_this15.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this16=this;return _asyncToGenerator(function*(){if(!_this16.activeRunDetach$)return;let e=_this16.activeRunCompletionPromise??Promise.resolve();_this16.activeRunDetach$.next(),_this16.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return fb(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(zp(n=>{n.messages&&(this.messages=n.messages,r.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,r.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Re(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||jr(),tools:Re(e?.tools??[]),context:Re(e?.context??[]),forwardedProps:Re(e?.forwardedProps??{}),state:Re(this.state),messages:t,...(e?.resume===void 0?{}:{resume:Re(e.resume)})}}onInitialize(e,t){var _this17=this;return _asyncToGenerator(function*(){if(_this17.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(i=>i.interruptId)),o=_this17.pendingInterrupts.map(i=>i.id).filter(i=>!n.has(i));if(o.length>0)throw new Le(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let i of _this17.pendingInterrupts)if(OO(i))throw new Le(`Interrupt ${i.id} expired at ${i.expiresAt}`)}let r=yield Oe(t,_this17.messages,_this17.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this17,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this17.messages=r.messages,e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17,input:e})})),r.state&&(_this17.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this17.state,messages:_this17.messages,agent:_this17,input:e})})))})()}onError(e,t,r){return Fn(Oe(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(Dn(n=>{let o=n;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,r.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,r.forEach(i=>{i.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),o.stopPropagation!==!0){let i=String(t);if(!(t.name==="AbortError"||t.message==="Fetch is aborted"||t.message==="signal is aborted without reason"||t.message==="component unmounted"||i==="component unmounted"))throw console.error("Agent execution failed:",t),t}return{}}))}onFinalize(e,t){var _this18=this;return _asyncToGenerator(function*(){let r=yield Oe(t,_this18.messages,_this18.state,(n,o,i)=>n.onRunFinalized?.({messages:o,state:i,agent:_this18,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this18.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this18.messages,state:_this18.state,agent:_this18,input:e})})),r.state!==void 0&&(_this18.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this18.state,messages:_this18.messages,agent:_this18,input:e})})))})()}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=Re(this.messages),e.state=Re(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Re(this.pendingInterrupts),e}addMessage(e){var _this19=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this19.subscribers)yield t.onNewMessage?.({message:e,messages:_this19.messages,state:_this19.state,agent:_this19});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this19.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this19.messages,state:_this19.state,agent:_this19});for(let t of _this19.subscribers)yield t.onMessagesChanged?.({messages:_this19.messages,state:_this19.state,agent:_this19})})()}addMessages(e){var _this20=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this20.subscribers)yield r.onNewMessage?.({message:t,messages:_this20.messages,state:_this20.state,agent:_this20});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this20.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this20.messages,state:_this20.state,agent:_this20})}for(let t of _this20.subscribers)yield t.onMessagesChanged?.({messages:_this20.messages,state:_this20.state,agent:_this20})})()}setMessages(e){var _this21=this;this.messages=Re(e),_asyncToGenerator(function*(){for(let t of _this21.subscribers)yield t.onMessagesChanged?.({messages:_this21.messages,state:_this21.state,agent:_this21})})()}setState(e){var _this22=this;this.state=Re(e),_asyncToGenerator(function*(){for(let t of _this22.subscribers)yield t.onStateChanged?.({messages:_this22.messages,state:_this22.state,agent:_this22})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??jr();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:o=>n.run(o,r),get messages(){return r.messages},get state(){return r.state}}),this).run(t)).pipe(ju(this.debugLogger),df(this.debugLogger),_O(this.threadId,t.runId,this.agentId),r=>r.pipe(Dn(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}},mb=class extends BO{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(e),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new l.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new l.AbortController,this.url=e.url,this.headers=Re(e.headers??{}),this.fetch=e.fetch??((t,r)=>A(t,r))}run(e){return hO(fO(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Re(this.headers??{}),e.fetch=this.fetch;let t=new l.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};m();d();f();p();var gb=(e,t,r)=>{let n=It(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let i=`/api/v1/organizations/${t}/agents`;return`${n}${i}/${o}`};var mf=class extends mb{requestInit(t){let{params:r,accessToken:n,recordDebugSession:o}=t.forwardedProps||{},i={...r,...(o&&{recordDebugSession:!0})};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream, application/json"},body:JSON.stringify(i),signal:this.abortController.signal}}},hb=(e,t,r)=>new mf({url:`${gb(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var GO=new z({required:!0}),yb=new z({required:!0,constrainTo:sc}),vb=e=>({...e,name:cc(e.name)}),Sb=O("followUpAnswers/setIsEnabled",e=>B(e,new fe({required:!0}))),bb=O("followUpAnswers/setFollowUpAnswersConversationId",e=>B(e,Y)),wb=O("followUpAnswers/setFollowUpAnswersConversationToken",e=>B(e,Y)),Ab=O("followUpAnswers/clearFollowUpAnswersConversationToken"),_re=O("followUpAnswers/createFollowUpAnswer",e=>B(e,{question:Y})),kre=O("followUpAnswers/setActiveFollowUpAnswerId",e=>B(e,Y)),Ore=O("followUpAnswers/setFollowUpAnswerContentFormat",e=>B(e,{contentFormat:lc,answerId:Y})),Pre=O("followUpAnswers/setFollowUpIsLoading",e=>B(e,{isLoading:new fe({required:!0}),answerId:Y})),Nre=O("followUpAnswers/setFollowUpIsStreaming",e=>B(e,{isStreaming:new fe({required:!0}),answerId:Y})),Fre=O("followUpAnswers/followUpMessageChunkReceived",e=>B(e,{textDelta:GO,answerId:Y})),Dre=O("followUpAnswers/followUpCitationsReceived",e=>B(e,{citations:new Se({required:!0,each:new ne({values:yp})}),answerId:Y})),Mre=O("followUpAnswers/followUpCompleted",e=>B(e,{answerId:Y,cannotAnswer:new fe({required:!1})})),qre=O("followUpAnswers/followUpFailed",e=>B(e,{message:new z,code:new oe({min:0}),answerId:Y})),jre=O("followUpAnswers/activeFollowUpStartFailed",e=>B(e,{message:new z})),Lre=O("followUpAnswers/likeFollowUp",e=>B(e,{answerId:Y})),Ure=O("followUpAnswers/dislikeFollowUp",e=>B(e,{answerId:Y})),Vre=O("followUpAnswers/submitFollowUpFeedback",e=>B(e,{answerId:Y})),xb=O("followUpAnswers/resetFollowUpAnswers"),Bre=O("followUpAnswers/stepStarted",e=>B(vb(e),{answerId:Y,name:yb,startedAt:new oe({min:0,required:!0})})),Gre=O("followUpAnswers/stepFinished",e=>B(vb(e),{answerId:Y,name:yb,finishedAt:new oe({min:0,required:!0})})),$re=O("followUpAnswers/startToolCall",e=>B(e,{answerId:Y,toolCallName:Y,startedAt:new oe({min:0,required:!0}),toolCallId:Y})),Qre=O("followUpAnswers/finishToolCall",e=>B(e,{answerId:Y,finishedAt:new oe({min:0,required:!0}),toolCallId:Y})),Hre=O("followUpAnswers/toolCallArgs",e=>B(e,{answerId:Y,toolCallId:Y,args:new ne({options:{required:!0}}),type:new z({required:!0,constrainTo:uc})}));m();d();f();p();var $O={"KNOWLEDGE:SSE_MAX_DURATION_EXCEEDED":1e3,"KNOWLEDGE:SSE_FOLLOW_UP_NOT_SUPPORTED":1001,"KNOWLEDGE:NOT_FOUND":1002,"KNOWLEDGE:SSE_MODELS_NOT_AVAILABLE":1003,"KNOWLEDGE:SSE_INTERNAL_ERROR":1004,"KNOWLEDGE:SSE_TURN_LIMIT_REACHED":1005};function Cb(e){return e?$O[e]??1004:1004}var Eb=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(dc(n.runId)),e(qr(!1)),e(Yi(!0)),e(bb(n.threadId)),e(Ab())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(Wy({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(Ky({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onToolCallStartEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:i,toolCallId:a,timestamp:s}=n;e(Yy({toolCallId:a,toolCallName:i,startedAt:s??Date.now()}))},onToolCallEndEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,timestamp:a}=n;e(Xy({toolCallId:i,finishedAt:a??Date.now()}))},onToolCallArgsEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,delta:a}=n;try{let s=JSON.parse(a);typeof s?.q=="string"?e(fc({toolCallId:i,args:s,type:"search"})):e(fc({toolCallId:i,args:{raw:a},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${a}`),e(fc({toolCallId:i,args:{raw:a},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(Xi({textDelta:n.delta})))},onCustomEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{name:i,value:a}=n;switch(i){case"header":{a?.contentFormat&&e(ea(a.contentFormat)),typeof a?.followUpEnabled=="boolean"&&e(Sb(a.followUpEnabled)),a?.conversationToken&&e(wb(a.conversationToken));return}case"citations":{e(Zi({citations:a.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=Cb(n.code);e(Ji({message:n.message,code:i}))},onRunFinishedEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=n.result?.completionReason==="ANSWERED",a=i?!r:void 0;e(vp(i)),e(ta(!i)),e(Yi(!1)),e(Zd(i,t,a)),e(Co())}}};var Rb=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _ref50=_asyncToGenerator(function*(n,o,i){t();let a=Us(n),s=rh(n),c=nh(n),u=th(n),h=oh(n),v=hb(a,s,c);e=v;let C=Eb(o),g=Vy(n,i());try{o(qr(!0)),yield v.runAgent({forwardedProps:{params:g,accessToken:u,recordDebugSession:h}},C)}catch(y){o(qr(!1)),o(Ji({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});return function run(_x94,_x95,_x96){return _ref50.apply(this,arguments)}}(),abortRun:t}};m();d();f();p();m();d();f();p();var Uu=O("breadcrumb/deselectAll"),Ib=O("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var Tb=O("facet/updateFacetAutoSelection",e=>B(e,{allow:new fe({required:!0})}));m();d();f();p();m();d();f();p();var Vu=class extends kr{constructor(r){super(r);ae(this,"getState",r)}get activeInstantResultQuery(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].q;return null}get activeInstantResultCache(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].cache[o];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??Ct().q}get responseTime(){return this.activeInstantResultCache?.duration??Qt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??Qt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var _b=()=>Pe("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Vu(e)),kb=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var gf={id:Y},QO={...gf,q:nt},roe=O("instantResults/register",e=>B(e,gf)),Bu=O("instantResults/updateQuery",e=>B(e,QO)),noe=O("instantResults/clearExpired",e=>B(e,gf));m();d();f();p();var Gu=new oe({required:!0,min:0}),$u=O("pagination/registerNumberOfResults",e=>B(e,Gu)),Qu=O("pagination/updateNumberOfResults",e=>B(e,Gu)),Hu=O("pagination/registerPage",e=>B(e,Gu)),zo=O("pagination/updatePage",e=>B(e,Gu)),zu=O("pagination/nextPage"),Wu=O("pagination/previousPage");m();d();f();p();var Wo=O("query/updateQuery",e=>B(e,{q:new z,enableQuerySyntax:new fe}));m();d();f();p();m();d();f();p();m();d();f();p();var $r=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var hf=()=>Pe("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),Qr=e=>Pe("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||Ct().q,aq:r.advancedSearchQueries?.aq||$r().aq,cq:r.advancedSearchQueries?.cq||$r().cq,dq:r.advancedSearchQueries?.dq||$r().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();var Voe=O("didYouMean/enable"),Boe=O("didYouMean/disable"),Goe=O("didYouMean/automaticCorrections/disable"),$oe=O("didYouMean/automaticCorrections/enable"),Ku=O("didYouMean/correction",e=>B(e,Y)),Qoe=O("didYouMean/automaticCorrections/mode",e=>B(e,new z({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var yf=()=>Pe("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var Ob=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function Yu(){return{contextValues:{}}}m();d();f();p();function Xu(){return{contextValues:{}}}m();d();f();p();function Pb(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function Nb(){return[]}m();d();f();p();function va(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function Fb(){return{}}m();d();f();p();function Db(){return{}}m();d();f();p();function Mb(){return{}}function nr(e){return{context:e.context||Yu(),dictionaryFieldContext:e.dictionaryFieldContext||Xu(),facetSet:e.facetSet||Ls(),numericFacetSet:e.numericFacetSet||js(),dateFacetSet:e.dateFacetSet||qs(),categoryFacetSet:e.categoryFacetSet||Ms(),automaticFacetSet:e.automaticFacetSet??Ds(),pagination:e.pagination||va(),query:e.query||Ct(),tabSet:e.tabSet||Mb(),advancedSearchQueries:e.advancedSearchQueries||$r(),staticFilterSet:e.staticFilterSet||Db(),querySet:e.querySet||Fb(),sortCriteria:e.sortCriteria||Vs(),pipeline:e.pipeline||Ir(),searchHub:e.searchHub||ho(),facetOptions:e.facetOptions||Pb(),facetOrder:e.facetOrder??Nb(),debug:e.debug??ms()}}m();d();f();p();var yae=new ne({values:{undoneQuery:nt},options:{required:!0}}),qb=()=>Pe("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var Zu=O("trigger/query/ignore",e=>B(e,new z({emptyAllowed:!0,required:!0}))),Ju=O("trigger/query/modification",e=>B(e,new ne({values:{originalQuery:rt,modification:rt}})));m();d();f();p();var Hr=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=WO(e),n=ic(e),o=HO(e),i=yield Dr(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Nr({...i,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(r&&{cq:r}),...(n.length&&{facets:n}),...(e.pagination&&{numberOfResults:a(),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:o}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Hr(_x97,_x98){return _ref51.apply(this,arguments)}}();function HO(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(zO).filter(r=>r.currentValues.length>0):void 0}function zO(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function WO(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=KO(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function KO(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o})}var zr=class{constructor(t,r=n=>{this.dispatch(Wo({q:n}))}){ae(this,"config",t);ae(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x99,_x100){var _this23=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=oc(yield _this23.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this23.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.processQueryErrorOrContinue(t)??(yield _this24.processQueryCorrectionsOrContinue(t))??(yield _this24.processQueryTriggersOrContinue(t))??_this24.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return yt(t.response)?(this.dispatch(Qr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this25=this;return _asyncToGenerator(function*(){let r=_this25.getState(),n=_this25.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:c}=n;if(!o||!i)return null;let u=a.length===0&&s&&s.length!==0,h=!se(c)&&!se(c.correctedQuery);if(!u&&!h)return null;let C=u?yield _this25.processLegacyDidYouMeanAutoCorrection(t):_this25.processModernDidYouMeanAutoCorrection(t);return _this25.dispatch(Kt(nr(_this25.getState()))),C})()}processLegacyDidYouMeanAutoCorrection(t){var _this26=this;return _asyncToGenerator(function*(){let r=_this26.getCurrentQuery(),n=_this26.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this26.automaticallyRetryQueryWithCorrection(o);return yt(i.response)?(_this26.dispatch(Qr(i.response.error)),_this26.rejectWithValue(i.response.error)):(_this26.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this26.dispatch(Kt(nr(_this26.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:yf()})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o,analyticsAction:yf()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let r=this.getState(),n=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,r,n),this.extra)}processQueryTriggersOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this27.getState().triggers?.queryModification.queryToIgnore===n)return _this27.dispatch(Zu("")),null;_this27.analyticsAction&&(yield _this27.dispatch(_this27.analyticsAction));let i=_this27.getCurrentQuery(),a=yield _this27.automaticallyRetryQueryWithTriggerModification(n);return yt(a.response)?(_this27.dispatch(Qr(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(Kt(nr(_this27.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:qb()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??Ct().enableQuerySyntax},search:{...Qt(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Kt(nr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return ja(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this28=this;return _asyncToGenerator(function*(){_this28.onUpdateQueryForCorrection(t);let r=yield _this28.fetchFromAPI(yield Hr(_this28.getState()),{origin:"mainSearch"});return _this28.dispatch(Ku(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this29=this;return _asyncToGenerator(function*(){return _this29.dispatch(Ju({newQuery:t,originalQuery:_this29.getCurrentQuery()})),_this29.onUpdateQueryForCorrection(t),yield _this29.fetchFromAPI(yield Hr(_this29.getState()),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get analyticsAction(){return this.config.analyticsAction}get rejectWithValue(){return this.config.rejectWithValue}};var yse=Ie("search/executeSearch",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield el(r,t,e)});return function(_x101,_x102){return _ref52.apply(this,arguments)}}()),vse=Ie("search/fetchPage",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Sf(r,t,e)});return function(_x103,_x104){return _ref53.apply(this,arguments)}}()),Sse=Ie("search/fetchMoreResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();return yield bf(t,r)});return function(_x105,_x106){return _ref54.apply(this,arguments)}}()),bse=Ie("search/fetchFacetValues",/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t){let r=t.getState();return yield JO(t,e,r)});return function(_x107,_x108){return _ref55.apply(this,arguments)}}()),wse=Ie("search/fetchInstantResults",/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){return vf(e,t)});return function(_x109,_x110){return _ref56.apply(this,arguments)}}()),YO=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=yield Hr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function YO(_x111,_x112){return _ref57.apply(this,arguments)}}(),XO=/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t,r){let n=yield Dr(e);return Nr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function XO(_x113,_x114,_x115){return _ref58.apply(this,arguments)}}(),ZO=/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=yield Hr(e,t);return r.request.numberOfResults=0,r});return function ZO(_x116,_x117){return _ref59.apply(this,arguments)}}(),jb=e=>{e.configuration.analytics.enabled&>.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function vf(_x118,_x119){return _vf.apply(this,arguments)}function _vf(){_vf=_asyncToGenerator(function*(e,t){B(e,{id:Y,q:Y,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new zr({...t,analyticsAction:_b()},u=>{t.dispatch(Bu({q:u,id:e.id}))}),a=yield XO(o,r,n),s=yield i.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),c=yield i.process(s);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,analyticsAction:c.analyticsAction,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return _vf.apply(this,arguments)}function Sf(_x120,_x121,_x122){return _Sf.apply(this,arguments)}function _Sf(){_Sf=_asyncToGenerator(function*(e,t,r){jb(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new zr({...t,analyticsAction:r}),c=yield Hr(e,a),u=yield s.fetchFromAPI(c,{origin:"mainSearch"});return yield s.process(u)});return _Sf.apply(this,arguments)}function bf(_x123,_x124){return _bf.apply(this,arguments)}function _bf(){_bf=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield hf().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new zr({...e,analyticsAction:hf()}),s=yield YO(t,i),c=yield a.fetchFromAPI(s,{origin:"mainSearch"});return yield a.process(c)});return _bf.apply(this,arguments)}function JO(_x125,_x126,_x127){return _JO.apply(this,arguments)}function _JO(){_JO=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=e.extra,{description:a}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new zr({...e,analyticsAction:t}),c=yield ZO(r,a),u=yield s.fetchFromAPI(c,{origin:"facetValues"});return yield s.process(u)});return _JO.apply(this,arguments)}function el(_x128,_x129,_x130){return _el.apply(this,arguments)}function _el(){_el=_asyncToGenerator(function*(e,t,r){jb(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=yield Hr(e,a),c=new zr({...t,analyticsAction:r}),u=yield c.fetchFromAPI(s,{origin:"mainSearch"});return yield c.process(u)});return _el.apply(this,arguments)}m();d();f();p();var Wr=class{constructor(t,r=n=>{this.dispatch(Wo({q:n}))}){ae(this,"config",t);ae(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x131,_x132){var _this30=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=oc(yield _this30.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this30.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.processQueryErrorOrContinue(t)??(yield _this31.processQueryCorrectionsOrContinue(t))??(yield _this31.processQueryTriggersOrContinue(t))??_this31.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return yt(t.response)?(this.dispatch(Qr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this32=this;return _asyncToGenerator(function*(){let r=_this32.getState(),n=_this32.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:c}=n;if(!o)return null;if(!i)return!se(c)&&!se(c.correctedQuery)?_this32.processModernDidYouMeanAutoCorrection(t):null;let u=a.length===0&&s&&s.length!==0,h=!se(c)&&!se(c.correctedQuery);if(!u&&!h)return null;let C=u?yield _this32.processLegacyDidYouMeanAutoCorrection(t):_this32.processModernDidYouMeanAutoCorrection(t);return _this32.dispatch(Kt(nr(_this32.getState()))),C})()}processLegacyDidYouMeanAutoCorrection(t){var _this33=this;return _asyncToGenerator(function*(){let r=_this33.getCurrentQuery(),n=_this33.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this33.automaticallyRetryQueryWithCorrection(o);return yt(i.response)?(_this33.dispatch(Qr(i.response.error)),_this33.rejectWithValue(i.response.error)):(_this33.dispatch(Kt(nr(_this33.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o}}processQueryTriggersOrContinue(t){var _this34=this;return _asyncToGenerator(function*(){let r=_this34.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this34.getState().triggers?.queryModification.queryToIgnore===n)return _this34.dispatch(Zu("")),null;let i=_this34.getCurrentQuery(),a=yield _this34.automaticallyRetryQueryWithTriggerModification(n);return yt(a.response)?(_this34.dispatch(Qr(a.response.error)),_this34.rejectWithValue(a.response.error)):(_this34.dispatch(Kt(nr(_this34.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Kt(nr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return ja(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this35=this;return _asyncToGenerator(function*(){_this35.onUpdateQueryForCorrection(t);let r=_this35.getState(),{actionCause:n}=Ob(),o=yield _this35.fetchFromAPI(yield Mr(r,_this35.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this35.dispatch(Ku(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this36=this;return _asyncToGenerator(function*(){return _this36.dispatch(Ju({newQuery:t,originalQuery:_this36.getCurrentQuery()})),_this36.onUpdateQueryForCorrection(t),yield _this36.fetchFromAPI(yield Mr(_this36.getState(),_this36.extra.navigatorContext),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}};var sce=Ie("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;B(e,{q:new z,enableQuerySyntax:new fe,clearFilters:new fe}),e.clearFilters&&(r(Uu()),r(Ib())),r(Tb({allow:!0})),r(Wo({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(zo(1))}),cce=O("search/updateSearchAction"),tl=Ie("search/executeSearch",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return el(r,t,e.legacy);Ub(r);let n=e.next?Vb(e.next):void 0,o=yield Mr(r,t.extra.navigatorContext,n),i=new Wr({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x133,_x134){return _ref60.apply(this,arguments)}}()),Lb=Ie("search/fetchPage",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(Ub(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Sf(r,t,e.legacy);let n=new Wr({...t,analyticsAction:e.next}),o=yield Mr(r,t.extra.navigatorContext,e.next),i=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(i)});return function(_x135,_x136){return _ref61.apply(this,arguments)}}()),uce=Ie("search/fetchMoreResults",/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return bf(t,r);let n=Ch("browseResults",t.getState),o=new Wr({...t,analyticsAction:n}),i=yield eP(r,t.extra.navigatorContext,n),a=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(a)});return function(_x137,_x138){return _ref62.apply(this,arguments)}}()),lce=Ie("search/fetchFacetValues",/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return el(r,t,e.legacy);let n=new Wr({...t,analyticsAction:{}}),o=yield rP(r,t.extra.navigatorContext),i=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(i)});return function(_x139,_x140){return _ref63.apply(this,arguments)}}()),dce=Ie("search/fetchInstantResults",/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return vf(e,t);B(e,{id:Y,q:Y,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:n,maxResultsPerQuery:o}=e,i=Vb(kb()),a=yield tP(r,t.extra.navigatorContext,n,o,i),s=new Wr({...t,analyticsAction:i},h=>{t.dispatch(Bu({q:h,id:e.id}))}),c=yield s.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),u=yield s.process(c);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return function(_x141,_x142){return _ref64.apply(this,arguments)}}()),eP=/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t,r){let n=yield Mr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function eP(_x143,_x144,_x145){return _ref65.apply(this,arguments)}}(),tP=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(e,t,r,n,o){let i=Ro(e,t,o);return Nr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function tP(_x146,_x147,_x148,_x149,_x150){return _ref66.apply(this,arguments)}}(),rP=/*#__PURE__*/function(){var _ref67=_asyncToGenerator(function*(e,t,r){let n=yield Mr(e,t,r);return n.request.numberOfResults=0,n});return function rP(_x151,_x152,_x153){return _ref67.apply(this,arguments)}}(),Ub=e=>{e.configuration.analytics.enabled&>.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Vb=e=>({actionCause:e.actionCause,type:e.actionCause});var Bb=e=>{let t=pg({extra:e}),r=Rb();return t.startListening({actionCreator:tl.pending,effect:function(){var _ref68=_asyncToGenerator(function*(n,o){let i=o.getState();if(!_d(i)||(r.abortRun(),o.dispatch(pc()),o.dispatch(xb()),i.generatedAnswer.isEnabled===!1))return;let a=fn(i)?.q;!a||a.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});return function effect(_x154,_x155){return _ref68.apply(this,arguments)}}()}),t};m();d();f();p();var Gb=e=>()=>t=>r=>{let n=r;if(!n.error)return t(r);let o=n.error;if(n.payload?.ignored||e.error({error:o,action:r},`Action dispatch error ${n.type}`),n.error.name!=="SchemaValidationError")return t(r)},$b=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var wf=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:i}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:i}};m();d();f();p();function Qb(e,t){let r={...e},n,o=i=>(a,s)=>{let c=i(a,s);return n?n(c,s):c};return{get combinedReducer(){let i=em(Object.entries(t).filter(([a])=>!(a in r)).map(([a,s])=>[a,()=>s]));return o(Yn({...i,...r}))},containsAll(i){return Object.keys(i).every(s=>s in r)},add(i){Object.keys(i).filter(a=>!(a in r)).forEach(a=>{r[a]=i[a]})},addCrossReducer(i){n=i}}}m();d();f();p();m();d();f();p();function nP(e){if(!e||!oP(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),o=decodeURIComponent(n.split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(o)}catch{return null}}function Hb(e,t=60){if(!e)return!1;let r=nP(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function oP(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function Wb(e,t){let r=0,n=null,o=Oa(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(v,C=!1){let g=!n;g&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(S){if(!C)throw S;return null}})().finally(()=>{n=null}));let y=yield n;return g&&y&&v.dispatch(Er({accessToken:y})),y});return function i(_x156){return _ref69.apply(this,arguments)}}(),a=v=>{let C=sP(v.getState());return!!C&&Hb(C)},s=/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(v){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(v))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(C){e.warn(C,"Access token renewal failed. A retry will occur if necessary.")}});return function s(_x157){return _ref71.apply(this,arguments)}}(),c=/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(v,C,g){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),zb(v,C.error),C;!n&&(r++,o());try{yield i(v,!0)}catch(S){e.debug(S,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}v.dispatch(g)});return function c(_x158,_x159,_x160){return _ref72.apply(this,arguments)}}(),u=(v,C,g)=>aP(g)?t?c(v,g,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."),zb(v,g.error),g):g,h=(v,C,g)=>iP(g)?Promise.resolve(g).then(y=>u(v,C,y)):u(v,C,g);return v=>C=>g=>{if(!(typeof g=="function"))return C(g);let S=()=>h(v,g,C(g));return typeof t=="function"&&a(v)?s(v).then(S):S()}}function iP(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function aP(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Wn().name}function zb(e,t){e.dispatch(hs({status:401,statusCode:401,message:t.message,type:t.name}))}function sP(e){return e.configuration.accessToken}m();d();f();p();function Kb({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return Zm({reducer:e,preloadedState:t,devTools:{stateSanitizer:i=>i.history?{...i,history:"<<OMIT>>"}:i,name:o,shouldHotReload:!1},middleware:i=>i({thunk:{extraArgument:n}}).prepend(...r).concat($b(n.logger))})}function cP(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,disableBrowserPrivacySignals:o,...i}=r??{},a={...i,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})},s=a.analyticsMode!=="next",c=a.analyticsMode==="legacy"&&o===!0;return s&&Tl()&&!c?(t.info("Analytics disabled since doNotTrack is active."),{...a,enabled:!1}):(s&&Tl()&&c&&a.enabled!==!1&&t.warn("Browser privacy signals (Do Not Track and Global Privacy Control) are present but are being ignored because analytics.disableBrowserPrivacySignals is set to true. Legacy analytics events will be sent, and your integration is responsible for privacy compliance."),a)}function Yb(e,t){let r={...e.reducers,configuration:Lt,version:sv},n=uP({...e,reducers:r},t,Lt),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(Er({accessToken:o,environment:i,organizationId:a}));let s=cP(e.configuration,n.logger);return s&&n.dispatch(no(s)),n}function uP(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=Qb({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,s={...t,get relay(){return ji(u.state,o)},get navigatorContext(){return wf(this.relay,o)}},c=lP(e,s,i),u={addReducers(h){i.containsAll(h)||(i.add(h),c.replaceReducer(i.combinedReducer))},dispatch:c.dispatch,subscribe:c.subscribe,enableAnalytics(){c.dispatch(io())},disableAnalytics(){c.dispatch(oo())},get state(){return c.getState()},get relay(){return ji(this.state,o)},get navigatorContext(){return wf(this.relay,o)},logger:a,store:c};return u}function lP(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=dP(e,t.logger,()=>t.navigatorContext);return Kb({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function dP(e,t,r){let{renewAccessToken:n}=e.configuration,o=Wb(t,n),i=Bb({getNavigatorContext:r});return[vv,o,Gb(t),uv].concat(bp.middleware,i.middleware,e.middlewares||[])}m();d();f();p();var aw=qt(iw(),1);function sw(e){return(0,aw.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function cw(e,t){let r=_P(e),n=Tt,o=kP(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function _P(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function kP(e){return e.preprocessRequest||Fa}m();d();f();p();m();d();f();p();var uw={organizationId:Y,accessToken:Y,name:new z({required:!1,emptyAllowed:!1}),analytics:new ne({options:{required:!1},values:{enabled:new fe({required:!1}),originContext:new z({required:!1}),originLevel2:new z({required:!1}),originLevel3:new z({required:!1}),analyticsMode:new z({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new z({required:!1,url:!0}),trackingId:new z({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new fe({required:!1})}}),environment:new z({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function lw(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var dw=new ht({...uw,pipeline:new z({required:!1,emptyAllowed:!0}),searchHub:rt,locale:rt,timezone:rt});function If(){return{...lw(),searchHub:"default"}}var OP={debug:gs,pipeline:so,searchHub:wo,recommendation:So};function pw(e){let t=sw(e.loggerOptions);PP(e.configuration,t);let r=NP(e.configuration,t),n={...cw(e.configuration,t),apiClient:r},o={...e,reducers:OP},i=Yb(o,n),{pipeline:a,searchHub:s,timezone:c,locale:u,proxyBaseUrl:h}=e.configuration;return i.dispatch(Wt({timezone:c,locale:u,proxyBaseUrl:h})),se(a)||i.dispatch(ao(a)),se(s)||i.dispatch(bo(s)),{...i,get state(){return i.state}}}function PP(e,t){try{dw.validate(e)}catch(r){throw t.error(r,"Recommendation engine configuration error"),r}}function NP(e,t){return new qa({logger:t,preprocessRequest:e.preprocessRequest||Fa,postprocessSearchResponseMiddleware:e.preprocessSearchResponseMiddleware||ym,postprocessFacetSearchResponseMiddleware:vm,postprocessQuerySuggestResponseMiddleware:Sm})}m();d();f();p();m();d();f();p();m();d();f();p();var FP=new Se({each:Y,required:!0}),fw=(e,t)=>(B(e,Y),_a(t)?B(t,Y):B(t,FP),{payload:{contextKey:e,contextValue:t}}),Un=O("context/set",e=>{for(let[t,r]of Object.entries(e))fw(t,r);return{payload:e}}),Vn=O("context/add",e=>fw(e.contextKey,e.contextValue)),Bn=O("context/remove",e=>B(e,Y));m();d();f();p();var ol=Be(Yu(),e=>{e.addCase(Un,(t,r)=>{t.contextValues=r.payload}).addCase(Vn,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Bn,(t,r)=>{delete t.contextValues[r.payload]}).addCase(vt.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});m();d();f();p();function Yr(e){let t,r=new Map,n=()=>r.size===0,o=i=>{try{let a=JSON.stringify(i),s=t!==a;return t=a,s}catch(a){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",a),!0}};return{subscribe(i){i();let a=Symbol(),s;return n()&&(t=JSON.stringify(this.state),s=e.subscribe(()=>{o(this.state)&&r.forEach(c=>c())})),r.set(a,i),()=>{r.delete(a),n()&&s?.()}},get state(){return{}}}}m();d();f();p();var DP=["caseId","caseNumber"],MP={caseId:"caseContext",caseNumber:"caseContext"},ba=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${MP[t]} to set this value.}`)}};function Tf(e){return DP.includes(e)}var qP=new ht({values:new ne({options:{required:!1}})});function mw(e,t={}){if(!UP(e))throw $t;let r=Yr(e),{dispatch:n}=e,o=()=>e.state,i=gg(e,qP,t.initialState,"buildContext");return i.values&&n(Un(i.values)),{...r,get state(){return{values:o().context.contextValues}},set(a){n(Un(a))},...(o().configuration.analytics.analyticsMode==="legacy"?jP(n):LP(n))}}var jP=e=>({add(t,r){e(Vn({contextKey:t,contextValue:r}))},remove(t){e(Bn(t))}}),LP=e=>({add(t,r){if(Tf(t))throw new ba(t);e(Vn({contextKey:t,contextValue:r}))},remove(t){if(Tf(t))throw new ba(t);e(Bn(t))}});function UP(e){return e.addReducers({context:ol}),!0}function gw(e,t){return mw(e,t)}m();d();f();p();m();d();f();p();var Yo=O("dictionaryFieldContext/set",e=>{let t=new ne({options:{required:!0}}),r=B(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new Se({each:nt}),i=B(n,o).error;return i?{payload:e,error:i}:{payload:e}}),Xo=O("dictionaryFieldContext/add",e=>{let t=new ne({options:{required:!0},values:{field:nt,key:nt}});return B(e,t)}),Zo=O("dictionaryFieldContext/remove",e=>B(e,nt));m();d();f();p();var il=Be(Xu(),e=>{e.addCase(Yo,(t,r)=>{t.contextValues=r.payload}).addCase(Xo,(t,r)=>{let{field:n,key:o}=r.payload;t.contextValues[n]=o}).addCase(Zo,(t,r)=>{delete t.contextValues[r.payload]}).addCase(vt.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.dictionaryFieldContext.contextValues)})});function hw(e){if(!VP(e))throw $t;let t=Yr(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return{values:n().dictionaryFieldContext.contextValues}},set(o){r(Yo(o))},add(o,i){r(Xo({field:o,key:i}))},remove(o){r(Zo(o))}}}function VP(e){return e.addReducers({dictionaryFieldContext:il}),!0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var wa={value:Y,numberOfResults:new oe({min:0}),state:Y};m();d();f();p();var _e=Y;var QP=new oe({min:1,default:8,required:!1}),HP=new oe({min:1,max:20,default:5,required:!1}),zP={desiredCount:HP,numberOfValues:QP},vpe=O("automaticFacet/setOptions",e=>B(e,zP)),Spe=O("automaticFacet/deselectAll",e=>B(e,_e)),WP=Y,yw=O("automaticFacet/toggleSelectValue",e=>B(e,{field:WP,selection:new ne({values:wa})}));m();d();f();p();m();d();f();p();var KP={state:new De({required:!0}),numberOfResults:new oe({required:!0,min:0}),value:new z({required:!0,emptyAllowed:!0}),path:new Se({required:!0,each:Y}),moreValuesAvailable:new fe({required:!1})};function _f(e){e.children.forEach(t=>{_f(t)}),Tt({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},KP)}var Jo={facetId:_e,field:Y,tabs:new ne({options:{required:!1},values:{included:new Se({each:new z}),excluded:new Se({each:new z})}}),activeTab:new z({required:!1}),delimitingCharacter:new z({required:!1,emptyAllowed:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new De({required:!1}),basePath:new Se({required:!1,each:Y}),filterByBasePath:new fe({required:!1})};var qpe=O("categoryFacet/register",e=>B(e,Jo)),vw=O("categoryFacet/toggleSelectValue",e=>{try{return Tt(e.facetId,Y),_f(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:ur(t)}}}),Sw=O("categoryFacet/deselectAll",e=>B(e,Jo.facetId)),jpe=O("categoryFacet/updateNumberOfValues",e=>B(e,{facetId:Jo.facetId,numberOfValues:Jo.numberOfValues})),Lpe=O("categoryFacet/updateSortCriterion",e=>B(e,{facetId:Jo.facetId,criterion:new De})),Upe=O("categoryFacet/updateBasePath",e=>B(e,{facetId:Jo.facetId,basePath:new Se({each:Y})}));m();d();f();p();m();d();f();p();var Aa={facetId:_e,captions:new ne({options:{required:!1}}),numberOfValues:new oe({required:!1,min:1}),query:new z({required:!1,emptyAllowed:!0})};var YP={path:new Se({required:!0,each:Y}),displayValue:nt,rawValue:nt,count:new oe({required:!0,min:0})},bw=O("categoryFacet/selectSearchResult",e=>B(e,{facetId:_e,value:new ne({values:YP})})),ofe=O("categoryFacetSearch/register",e=>B(e,Aa));m();d();f();p();var ww={facetId:_e,value:new ne({values:{displayValue:nt,rawValue:nt,count:new oe({required:!0,min:0})}})},gfe=O("facetSearch/register",e=>B(e,Aa)),hfe=O("facetSearch/update",e=>B(e,Aa)),Aw=O("facetSearch/toggleSelectValue",e=>B(e,ww)),xw=O("facetSearch/toggleExcludeValue",e=>B(e,ww));m();d();f();p();m();d();f();p();var xfe=new z({regex:/^[a-zA-Z0-9-_]+$/}),Cfe=new z({required:!0}),Efe=new Se({each:new z}),Rfe=new z,Ife=new fe,Tfe=new fe,_fe=new oe({min:0}),XP=new oe({min:1}),kfe=new fe({required:!0}),ZP=new ne,JP=new z,eN={captions:ZP,numberOfValues:XP,query:JP},Ofe=new ne({values:eN}),Cw=new ne({options:{required:!1},values:{type:new z({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new Se({required:!0,max:25,each:new z({emptyAllowed:!1,required:!0})})}}),Pfe=new fe,Ew=new Se({min:1,max:25,required:!1,each:new z({emptyAllowed:!1,required:!0})});var tN={facetId:_e,field:new z({required:!0,emptyAllowed:!0}),tabs:new ne({options:{required:!1},values:{included:new Se({each:new z}),excluded:new Se({each:new z})}}),activeTab:new z({required:!1}),filterFacetCount:new fe({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new De({required:!1}),resultsMustMatch:new De({required:!1}),allowedValues:Cw,customSort:Ew},$fe=O("facet/register",e=>B(e,tN)),Rw=O("facet/toggleSelectValue",e=>B(e,{facetId:_e,selection:new ne({values:wa})})),Iw=O("facet/toggleExcludeValue",e=>B(e,{facetId:_e,selection:new ne({values:wa})})),al=O("facet/deselectAll",e=>B(e,_e)),Qfe=O("facet/updateSortCriterion",e=>B(e,{facetId:_e,criterion:new De({required:!0})})),Hfe=O("facet/updateNumberOfValues",e=>B(e,{facetId:_e,numberOfValues:new oe({required:!0,min:1})})),zfe=O("facet/updateIsFieldExpanded",e=>B(e,{facetId:_e,isFieldExpanded:new fe({required:!0})})),Wfe=O("facet/updateFreezeCurrentValues",e=>B(e,{facetId:_e,freezeCurrentValues:new fe({required:!0})}));m();d();f();p();m();d();f();p();function _w(e){let t=Tw(e.start,e),r=Tw(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function Tw(e,t){let{dateFormat:r}=t;return Cy(e)?(cp(e),wy(e)):typeof e=="string"&&Pr(e)?(cp(e),e):(yy(e,r),nc(Eo(e,r)))}m();d();f();p();var kw=O("rangeFacet/updateSortCriterion",e=>B(e,{facetId:_e,criterion:new De({required:!0})}));m();d();f();p();var sl={state:Y,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new fe({required:!0}),numberOfResults:new oe({required:!0,min:0})},cl={start:Y,end:Y,endInclusive:new fe({required:!0}),state:Y,numberOfResults:new oe({required:!0,min:0})};var rN={start:Y,end:Y,endInclusive:new fe({required:!0}),state:Y},nN={facetId:_e,field:Y,tabs:new ne({options:{required:!1},values:{included:new Se({each:new z}),excluded:new Se({each:new z})}}),activeTab:new z({required:!1}),currentValues:new Se({required:!1,each:new ne({values:rN})}),generateAutomaticRanges:new fe({required:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new De({required:!1}),rangeAlgorithm:new De({required:!1})};function Ow(e){return Pr(e)?Wi(e):e}function Pw(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=_w(t);if(Eo(Ow(r)).isAfter(Eo(Ow(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var Fme=O("dateFacet/register",e=>{try{return Tt(e,nN),Pw(e),{payload:e,error:null}}catch(t){return{payload:e,error:ur(t)}}}),Nw=O("dateFacet/toggleSelectValue",e=>B(e,{facetId:_e,selection:new ne({values:cl})})),Fw=O("dateFacet/toggleExcludeValue",e=>B(e,{facetId:_e,selection:new ne({values:cl})})),Dw=O("dateFacet/updateFacetValues",e=>{try{return Tt(e,{facetId:_e,values:new Se({each:new ne({values:cl})})}),Pw({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:ur(t)}}});m();d();f();p();var oN={state:Y,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new fe({required:!0})},iN={facetId:_e,field:Y,tabs:new ne({options:{required:!1},values:{included:new Se({each:new z}),excluded:new Se({each:new z})}}),activeTab:new z({required:!1}),currentValues:new Se({required:!1,each:new ne({values:oN})}),generateAutomaticRanges:new fe({required:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new De({required:!1}),rangeAlgorithm:new De({required:!1})};function Mw(e){e.currentValues&&e.currentValues.forEach(({start:t,end:r})=>{if(t>r)throw new Error(`The start value is greater than the end value for the numeric range ${t} to ${r}`)})}var zme=O("numericFacet/register",e=>{try{return B(e,iN),Mw(e),{payload:e,error:null}}catch(t){return{payload:e,error:ur(t)}}}),qw=O("numericFacet/toggleSelectValue",e=>B(e,{facetId:_e,selection:new ne({values:sl})})),jw=O("numericFacet/toggleExcludeValue",e=>B(e,{facetId:_e,selection:new ne({values:sl})})),Lw=O("numericFacet/updateFacetValues",e=>{try{return Tt(e,{facetId:_e,values:new Se({each:new ne({values:sl})})}),Mw({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:ur(t)}}});var Uw=Be(va(),e=>{e.addCase($u,(t,r)=>{let n=kf(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=xa(n,o)}).addCase(Qu,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(mc,t=>{t.firstResult=0}).addCase(Hu,(t,r)=>{let n=r.payload;t.firstResult=xa(n,t.numberOfResults)}).addCase(zo,(t,r)=>{let n=r.payload;t.firstResult=xa(n,t.numberOfResults)}).addCase(Wu,t=>{let r=kf(t),n=Math.max(r-1,1);t.firstResult=xa(n,t.numberOfResults)}).addCase(zu,t=>{let r=kf(t),n=sN(t),o=Math.min(r+1,n);t.firstResult=xa(o,t.numberOfResults)}).addCase(vt.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(Rr,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(tl.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Lb.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(al,t=>{pt(t)}).addCase(Fw,t=>{pt(t)}).addCase(Iw,t=>{pt(t)}).addCase(jw,t=>{pt(t)}).addCase(xw,t=>{pt(t)}).addCase(Rw,t=>{pt(t)}).addCase(Sw,t=>{pt(t)}).addCase(vw,t=>{pt(t)}).addCase(bw,t=>{pt(t)}).addCase(Nw,t=>{pt(t)}).addCase(qw,t=>{pt(t)}).addCase(Uu,t=>{pt(t)}).addCase(Dw,t=>{pt(t)}).addCase(Lw,t=>{pt(t)}).addCase(Aw,t=>{pt(t)}).addCase(yw,t=>{pt(t)})});function pt(e){e.firstResult=va().firstResult}function kf(e){let{firstResult:t,numberOfResults:r}=e;return cN(t,r)}function sN(e){let{totalCountFiltered:t,numberOfResults:r}=e;return uN(t,r)}function xa(e,t){return(e-1)*t}function cN(e,t){return Math.round(e/t)+1}function uN(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function Of(e){return e.addReducers({pagination:Uw}),{nextPage:zu,previousPage:Wu,registerNumberOfResults:$u,registerPage:Hu,updateNumberOfResults:Qu,updatePage:zo}}var lN=new ht({id:new z({emptyAllowed:!0,required:!1,default:""}),numberOfRecommendations:new oe({min:0})});function Vw(e,t={}){if(!dN(e))throw $t;let r=Yr(e),{dispatch:n}=e,o=()=>e.state,i=hg(e,lN,t.options,"buildRecommendationList");return i.id!==""&&n(vo({id:i.id})),i.numberOfRecommendations&&n(Of(e).updateNumberOfResults(i.numberOfRecommendations)),{...r,refresh(){n(Or())},get state(){let a=o();return{recommendations:a.recommendation.recommendations,error:a.recommendation.error,isLoading:a.recommendation.isLoading,searchResponseId:a.recommendation.searchUid}}}}function dN(e){return e.addReducers({recommendation:So,configuration:Lt}),!0}m();d();f();p();m();d();f();p();function Bw(e,t,r){if(!pN(e))throw $t;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:Oa(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function pN(e){return e.addReducers({configuration:Lt}),!0}function Gw(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(Qs(t.options.result)))};return Bw(e,t,()=>{n()})}m();d();f();p();m();d();f();p();m();d();f();p();var Xr=()=>new z({required:!1,emptyAllowed:!0}),ul=O("advancedSearchQueries/update",e=>B(e,{aq:Xr(),cq:Xr(),lq:Xr(),dq:Xr()})),ll=O("advancedSearchQueries/register",e=>B(e,{aq:Xr(),cq:Xr(),lq:Xr(),dq:Xr()}));var $w=Be($r(),e=>{e.addCase(ul,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Je(n)||(t.aq=n,t.aqWasSet=!0),Je(o)||(t.cq=o,t.cqWasSet=!0),Je(i)||(t.lq=i,t.lqWasSet=!0),Je(a)||(t.dq=a,t.dqWasSet=!0)}).addCase(ll,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Je(n)||(t.defaultFilters.aq=n,t.aqWasSet||(t.aq=n)),Je(o)||(t.defaultFilters.cq=o,t.cqWasSet||(t.cq=o)),Je(i)||(t.defaultFilters.lq=i,t.lqWasSet||(t.lq=i)),Je(a)||(t.defaultFilters.dq=a,t.dqWasSet||(t.dq=a))}).addCase(vt.fulfilled,(t,r)=>r.payload?.advancedSearchQueries??t).addCase(Rr,(t,r)=>{let{aq:n,cq:o}=r.payload;Je(n)||(t.aq=n,t.aqWasSet=!0),Je(o)||(t.cq=o,t.cqWasSet=!0)})});function fN(e){return e.addReducers({advancedSearchQueries:$w}),{updateAdvancedSearchQueries:ul,registerAdvancedSearchQueries:ll}}m();d();f();p();function mN(e){return e.addReducers({configuration:Lt}),{disableAnalytics:oo,enableAnalytics:io,setOriginLevel2:ls,setOriginLevel3:ds,updateAnalyticsConfiguration:no,updateBasicConfiguration:Er}}m();d();f();p();function gN(e){return e.addReducers({configuration:Lt,pipeline:so,searchHub:wo}),{updateSearchConfiguration:Wt}}m();d();f();p();function hN(e){return e.addReducers({context:ol}),{addContext:Vn,removeContext:Bn,setContext:Un}}m();d();f();p();function yN(e){return e.addReducers({debug:gs}),{disableDebug:fs,enableDebug:ps}}m();d();f();p();function vN(e){return e.addReducers({dictionaryFieldContext:il}),{addContext:Xo,removeContext:Zo,setContext:Yo}}m();d();f();p();m();d();f();p();m();d();f();p();var SN={collectionField:new z({emptyAllowed:!1,required:!1}),parentField:new z({emptyAllowed:!1,required:!1}),childField:new z({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new oe({min:0,required:!1})},Qw=O("folding/register",e=>B(e,SN)),hye=Ie("folding/loadCollection",/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),a=i.configuration.analytics.analyticsMode==="legacy"?yield Dr(i):Ro(i,o),s=yield n.search({...a,q:bN(i),enableQuerySyntax:!0,cq:`@${i.folding.fields.collection}="${e}"`,filterField:i.folding.fields.collection,childField:i.folding.fields.parent,parentField:i.folding.fields.child,filterFieldRange:100},{origin:"foldingCollection"});return yt(s)?r(s.error):{collectionId:e,results:s.success.results,searchUid:s.success.searchUid,rootResult:i.folding.collections[e].result}});return function(_x161,_x162){return _ref73.apply(this,arguments)}}());function bN(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}m();d();f();p();var Hw=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});m();d();f();p();var ei=O("fields/registerFieldsToInclude",e=>B(e,us)),dl=O("fields/fetchall/enable"),pl=O("fields/fetchall/disable"),fl=Ie("fields/fetchDescription",/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:i,environment:a,organizationId:s}=o.configuration,{apiBaseUrl:c}=o.configuration.search,u=yield t.apiClient.fieldDescriptions({accessToken:i,organizationId:s,url:c??wr(s,a)});return yt(u)?n(u.error):u.success.fields});return function(_x163,_x164){return _ref74.apply(this,arguments)}}());m();d();f();p();var ml=["author","language","urihash","objecttype","collection","source","permanentid"],Pf=[...ml,"date","filetype","parents"],zw=[...Pf,"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"],Ww=()=>({fieldsToInclude:ml,fetchAllFields:!1,fieldsDescription:[]});var gl=Be(Ww(),e=>e.addCase(ei,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(dl,t=>{t.fetchAllFields=!0}).addCase(pl,t=>{t.fetchAllFields=!1}).addCase(fl.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(Qw,(t,{payload:r})=>{let n=Hw().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));function wN(e){return e.addReducers({fields:gl}),{registerFieldsToInclude:ei,enableFetchAllFields:dl,disableFetchAllFields:pl,fetchFieldsDescription:fl}}m();d();f();p();function AN(e){return e.addReducers({pipeline:so}),{setPipeline:ao}}m();d();f();p();function xN(e){return e.addReducers({recommendation:So}),{getRecommendations:Or,setRecommendationId:vo}}m();d();f();p();function CN(e){return e.addReducers({}),{logRecommendationOpen:Qs}}m();d();f();p();m();d();f();p();var EN=new ht({content:new De({required:!0}),conditions:new De({required:!0}),priority:new oe({required:!1,default:0,min:0}),fields:new Se({required:!1,each:Y})});function Kw(){let e=[],t=r=>{let n=EN.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new si("Each template condition should be a function that takes a Result or Product as an argument and returns a boolean");return n};return{registerTemplates(...r){r.forEach(n=>{let o={...t(n),fields:n.fields||[]};e.push(o)}),e.sort((n,o)=>o.priority-n.priority)},selectTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.content:null},selectLinkTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.linkContent:null}}}function Yw(e){if(!RN(e))throw $t;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=Kw();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(ei(i))},selectTemplate:r,selectLinkTemplate:n}}function RN(e){return e.addReducers({fields:gl}),!0}m();d();f();p();function IN(e){return e.addReducers({searchHub:wo}),{setSearchHub:bo}}/**
|
|
39
|
+
Error: ${x}`)}}return g()}case F.MESSAGES_SNAPSHOT:{let h=yield Pe(n,a,s,(y,b,x)=>y.onMessagesSnapshotEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messages:y}=v,b=y.map(A=>{if(A.subagentRunId!==null)return A;let O={...A};return delete O.subagentRunId,O}),x=new Map(b.map(A=>[A.id,A])),I=b.some(A=>A.role==="activity"),_=b.some(A=>A.role==="reasoning"),T=A=>A.role==="activity"&&!I||A.role==="reasoning"&&!_;a=a.filter(A=>T(A)||x.has(A.id)).map(A=>T(A)?A:x.get(A.id));let P=new Set(a.map(A=>A.id));for(let A of b)P.has(A.id)||a.push(A);c({messages:a})}return g()}case F.ACTIVITY_SNAPSHOT:{let h=v,y=a.findIndex(T=>T.id===h.messageId),b=y>=0?a[y]:void 0,x=b?.role==="activity"?b:void 0,I=h.replace??!0,_=yield Pe(n,a,s,(T,P,A)=>T.onActivitySnapshotEvent?.({event:h,messages:P,state:A,agent:r,input:e,activityMessage:x,existingMessage:b}));if(c(_),_.stopPropagation!==!0){let T={id:h.messageId,role:"activity",activityType:h.activityType,content:Te(h.content),...(h.subagentRunId!=null&&{subagentRunId:h.subagentRunId})},P,A;y===-1?(a.push(T),P=T,A=T):x?(I&&(a[y]={...x,activityType:h.activityType,content:Te(h.content),subagentRunId:h.subagentRunId},h.subagentRunId??delete a[y].subagentRunId),A=a[y]):I&&(a[y]=T,P=T,A=T),It(A,h),c({messages:a}),P&&(yield Promise.all(n.map(O=>O.onNewMessage?.({message:P,messages:a,state:s,agent:r,input:e}))))}return g()}case F.ACTIVITY_DELTA:{let h=v,y=a.findIndex(_=>_.id===h.messageId);if(y===-1)return g();let b=a[y];if(b.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let x=b,I=yield Pe(n,a,s,(_,T,P)=>_.onActivityDeltaEvent?.({event:h,messages:T,state:P,agent:r,input:e,activityMessage:x}));if(c(I),I.stopPropagation!==!0)try{It(x,h)&&c({messages:a});let _=Te(x.content??{}),T=Lc.applyPatch(_,h.patch??[],!0,!1).newDocument;a[y]={...x,content:Te(T),activityType:h.activityType},c({messages:a})}catch(_){let T=_ instanceof Error?_.message:String(_);console.warn(`Failed to apply activity patch for '${h.messageId}': ${T}`)}return g()}case F.RAW:return c(yield Pe(n,a,s,(h,y,b)=>h.onRawEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.CUSTOM:return c(yield Pe(n,a,s,(h,y,b)=>h.onCustomEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.RUN_STARTED:{let h=yield Pe(n,a,s,(y,b,x)=>y.onRunStartedEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let y=v;if(y.input?.messages){for(let b of y.input.messages){let x=b;if(b.subagentRunId===null){let I={...b};delete I.subagentRunId,x=I}a.find(I=>I.id===x.id)||a.push(x)}c({messages:a})}}return g()}case F.RUN_FINISHED:{let h=v,y=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},b=yield Pe(n,a,s,(x,I,_)=>x.onRunFinishedEvent?.({...y,messages:I,state:_,agent:r,input:e}));return c(b),b.stopPropagation!==!0&&(r.pendingInterrupts=y.outcome==="interrupt"?y.interrupts.map(x=>{if(x.subagentRunId!==null)return x;let I={...x};return delete I.subagentRunId,I}):[]),g()}case F.RUN_ERROR:return c(yield Pe(n,a,s,(h,y,b)=>h.onRunErrorEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.STEP_STARTED:return c(yield Pe(n,a,s,(h,y,b)=>h.onStepStartedEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.STEP_FINISHED:return c(yield Pe(n,a,s,(h,y,b)=>h.onStepFinishedEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be transformed before being applied");case F.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be transformed before being applied");case F.THINKING_START:return g();case F.THINKING_END:return g();case F.THINKING_TEXT_MESSAGE_START:return g();case F.THINKING_TEXT_MESSAGE_CONTENT:return g();case F.THINKING_TEXT_MESSAGE_END:return g();case F.REASONING_START:return c(yield Pe(n,a,s,(h,y,b)=>h.onReasoningStartEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.REASONING_MESSAGE_START:{let h=yield Pe(n,a,s,(y,b,x)=>y.onReasoningMessageStartEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,subagentRunId:b}=v,x=a.find(T=>T.id===y),I=x;if(!I){let T={id:y,role:"reasoning",content:"",...(b!=null&&{subagentRunId:b})};a.push(T),I=T}let _=It(I,v);(!x||_)&&c({messages:a})}return g()}case F.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,b=a.find(I=>I.id===h);if(!b)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let x=yield Pe(n,a,s,(I,_,T)=>I.onReasoningMessageContentEvent?.({event:v,messages:_,state:T,agent:r,input:e,reasoningMessageBuffer:typeof b.content=="string"?b.content:""}));return c(x),x.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${y}`,It(b,v),c({messages:a})),g()}case F.REASONING_MESSAGE_END:{let{messageId:h}=v,y=a.find(x=>x.id===h);if(!y)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g();let b=yield Pe(n,a,s,(x,I,_)=>x.onReasoningMessageEndEvent?.({event:v,messages:I,state:_,agent:r,input:e,reasoningMessageBuffer:typeof y.content=="string"?y.content:""}));return c(b),b.stopPropagation!==!0&&It(y,v)&&c({messages:a}),yield Promise.all(n.map(x=>{x.onNewMessage?.({message:y,messages:a,state:s,agent:r,input:e})})),g()}case F.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case F.REASONING_END:return c(yield Pe(n,a,s,(h,y,b)=>h.onReasoningEndEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:y,encryptedValue:b}=v,x=yield Pe(n,a,s,(I,_,T)=>I.onReasoningEncryptedValueEvent?.({event:v,messages:_,state:T,agent:r,input:e}));if(c(x),x.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let _ of a)if(_.role==="assistant"&&_.toolCalls){let T=_.toolCalls.find(P=>P.id===y);if(T){T.encryptedValue=b,I=!0;break}}}else{let _=a.find(T=>T.id===y);_?.role!=="activity"&&_&&(_.encryptedValue=b,I=!0)}I&&(u.messages=a)}return g()}case F.SUBAGENT_STARTED:return c(yield Pe(n,a,s,(h,y,b)=>h.onSubagentStartedEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.SUBAGENT_FINISHED:return c(yield Pe(n,a,s,(h,y,b)=>h.onSubagentFinishedEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.SUBAGENT_ERROR:return c(yield Pe(n,a,s,(h,y,b)=>h.onSubagentErrorEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g()}return v.type,g()});return function(_x92){return _ref43.apply(this,arguments)}}()),rf(),n.length>0?of({}):v=>v)},xf=e=>t=>{let r=Aa(e),n=new Set,o=new Set,i=new Set,a={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},s=!1,u=!1,c=!1,g=new Map,v=A=>{let O=g.get(A);return O||(O=new Map,g.set(A,O)),O},R=()=>{for(let A of g.values())if(A.size>0)return!0;return!1},h=new Map,y=new Set,b=!1,x=!1,I=!1,_=()=>{n.clear(),o.clear(),i.clear(),a.message.clear(),a.toolCall.clear(),a.activity.clear(),a.reasoning.clear(),g.clear(),h.clear(),y.clear(),b=!1,x=!1,s=!1,u=!1,I=!0},T=(A,O)=>{let k=A??[];if(Array.isArray(k))for(let N of k){if(!N||typeof N.id!="string")continue;if(N.subagentRunId===null)return new he(`Cannot send a message (id '${N.id}') with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`);let M=N.role==="reasoning"?a.reasoning:N.role==="activity"?a.activity:a.message;(O||!M.has(N.id))&&M.set(N.id,{subagentRunId:N.subagentRunId});for(let V of N.toolCalls??[])V&&typeof V.id=="string"&&(O||!a.toolCall.has(V.id))&&a.toolCall.set(V.id,{subagentRunId:N.subagentRunId??void 0})}},P=(A,O,k,N,M)=>{if(O!==void 0&&k&&k.subagentRunId!==O)return new he(`Cannot send '${A}': subagentRunId '${O}' does not match the ${N} '${M}' opener's subagent '${k.subagentRunId??"(the parent agent)"}'.`)};return t.pipe(wt(A=>{let O=A.type;if(r?.event("VERIFY","Event:",A,{type:A.type}),u&&O!==F.RUN_STARTED)return de(()=>new he(`Cannot send event type '${O}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(s&&O!==F.RUN_ERROR&&O!==F.RUN_STARTED)return de(()=>new he(`Cannot send event type '${O}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(c){if(O===F.RUN_STARTED){if(I&&!s&&!u)return de(()=>new he("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));(s||u)&&_()}}else if(c=!0,O!==F.RUN_STARTED&&O!==F.RUN_ERROR)return de(()=>new he("First event must be 'RUN_STARTED'"));if(A.subagentRunId===null)return de(()=>new he(`Cannot send '${O}' with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`));if(O===F.SUBAGENT_STARTED||O===F.SUBAGENT_FINISHED||O===F.SUBAGENT_ERROR){let k=O===F.SUBAGENT_STARTED?["description","parentSubagentRunId","parentToolCallId","parentMessageId"]:O===F.SUBAGENT_FINISHED?["outcome"]:["code"];for(let M of k)if(A[M]===null)return de(()=>new he(`Cannot send '${O}' with '${M}: null'. The field is optional \u2014 omit it entirely.`));let N=A.outcome;if(N!=null&&N.type!=="success"&&N.type!=="suspended")return de(()=>new he(`Cannot send '${O}' with outcome type '${String(N.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(N&&N.interruptIds===null)return de(()=>new he(`Cannot send '${O}' with 'outcome.interruptIds: null'. The field is optional \u2014 omit it entirely.`));if(N&&Array.isArray(N.interruptIds)&&N.interruptIds.some(M=>typeof M!="string"))return de(()=>new he(`Cannot send '${O}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(O===F.RUN_FINISHED){let k=A.outcome;if(k?.type==="interrupt"&&Array.isArray(k.interrupts)){for(let N of k.interrupts)if(N&&N.subagentRunId===null)return de(()=>new he(`Cannot send 'RUN_FINISHED' with an interrupt (id '${N.id}') carrying 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`))}}switch(O){case F.TEXT_MESSAGE_START:{let k=A.messageId;if(n.has(k))return de(()=>new he(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${k}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let N=a.message.get(k);if(N){let M=P(O,A.subagentRunId,N,"message",k);if(M)return de(()=>M)}return n.add(k),N||a.message.set(k,{subagentRunId:A.subagentRunId}),Oe(A)}case F.TEXT_MESSAGE_CONTENT:{let k=A.messageId;if(!n.has(k))return de(()=>new he(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${k}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let N=P(O,A.subagentRunId,a.message.get(k),"message",k);return N?de(()=>N):Oe(A)}case F.TEXT_MESSAGE_END:{let k=A.messageId;if(!n.has(k))return de(()=>new he(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${k}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let N=P(O,A.subagentRunId,a.message.get(k),"message",k);return N?de(()=>N):(n.delete(k),Oe(A))}case F.TOOL_CALL_START:{let k=A.toolCallId;if(o.has(k))return de(()=>new he(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${k}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let N=A.parentMessageId,M=A.subagentRunId,V;if(N!==void 0){let D=a.message.get(N);if(D){if(M!==void 0&&M!==D.subagentRunId)return de(()=>new he(`Cannot send 'TOOL_CALL_START': subagentRunId '${M}' does not match its parent message '${N}' owner '${D.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`));V=D}}let j=a.toolCall.get(k);if(j){let D=P(O,M,j,"tool call",k);if(D)return de(()=>D);if(M===void 0&&V&&V.subagentRunId!==j.subagentRunId)return de(()=>new he(`Cannot send 'TOOL_CALL_START': tool call '${k}' is owned by '${j.subagentRunId??"(the parent agent)"}' but its parent message '${N}' is owned by '${V.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`))}return o.add(k),j||a.toolCall.set(k,M===void 0?V??{subagentRunId:void 0}:{subagentRunId:M}),Oe(A)}case F.TOOL_CALL_ARGS:{let k=A.toolCallId;if(!o.has(k))return de(()=>new he(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${k}'. Start a tool call with 'TOOL_CALL_START' first.`));let N=P(O,A.subagentRunId,a.toolCall.get(k),"tool call",k);return N?de(()=>N):Oe(A)}case F.TOOL_CALL_END:{let k=A.toolCallId;if(!o.has(k))return de(()=>new he(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${k}'. A 'TOOL_CALL_START' event must be sent first.`));let N=P(O,A.subagentRunId,a.toolCall.get(k),"tool call",k);return N?de(()=>N):(o.delete(k),Oe(A))}case F.STEP_STARTED:{let k=A.stepName,N=A.subagentRunId;return v(N).has(k)?de(()=>new he(`Step "${k}" is already active for 'STEP_STARTED'${N===void 0?"":` in subagent '${N}'`}`)):(v(N).set(k,!0),Oe(A))}case F.STEP_FINISHED:{let k=A.stepName,N=A.subagentRunId;if(!v(N).has(k)){let M,V=!1;for(let[j,D]of g)if(j!==N&&D.has(k)){M=j,V=!0;break}return de(V?()=>new he(`Cannot send 'STEP_FINISHED' for step "${k}" attributed to ${N===void 0?"the parent agent":`subagent '${N}'`}: that step is open under ${M===void 0?"the parent agent":`subagent '${M}'`}. A step must be finished by whoever started it.`):()=>new he(`Cannot send 'STEP_FINISHED' for step "${k}" that was not started`))}return v(N).delete(k),Oe(A)}case F.ACTIVITY_SNAPSHOT:{let k=A.messageId;return(!a.activity.has(k)||A.replace!==!1)&&a.activity.set(k,{subagentRunId:A.subagentRunId}),Oe(A)}case F.TOOL_CALL_RESULT:{let k=A.messageId;return typeof k=="string"&&a.message.set(k,{subagentRunId:A.subagentRunId}),Oe(A)}case F.REASONING_START:case F.REASONING_MESSAGE_START:{let k=A.messageId,N=a.reasoning.get(k);if(N){let M=P(O,A.subagentRunId,N,"reasoning message",k);if(M)return de(()=>M)}return i.add(k),N||a.reasoning.set(k,{subagentRunId:A.subagentRunId}),Oe(A)}case F.REASONING_MESSAGE_CONTENT:case F.REASONING_MESSAGE_END:case F.REASONING_END:{let k=A.messageId,N=P(O,A.subagentRunId,a.reasoning.get(k),"reasoning message",k);return N?de(()=>N):(O===F.REASONING_END&&i.delete(k),Oe(A))}case F.REASONING_ENCRYPTED_VALUE:{let k=A.entityId,N=A.subtype,M=N==="tool-call"?a.toolCall.get(k):N==="message"?a.message.get(k)??a.reasoning.get(k):a.reasoning.get(k),V=N==="tool-call"?"tool call":N==="message"?"message":"reasoning message",j=P(O,A.subagentRunId,M,V,k);return j?de(()=>j):Oe(A)}case F.ACTIVITY_DELTA:{let k=A.messageId,N=P(O,A.subagentRunId,a.activity.get(k),"activity",k);return N?de(()=>N):Oe(A)}case F.SUBAGENT_STARTED:{if(typeof A.subagentRunId!="string")return de(()=>new he("Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'."));if(typeof A.name!="string")return de(()=>new he("Cannot send 'SUBAGENT_STARTED' without a 'name'."));let k=A.subagentRunId,N=A.parentSubagentRunId;return h.has(k)?de(()=>new he(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):y.has(k)?de(()=>new he(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):N!==void 0&&!h.has(N)&&!y.has(N)?de(()=>new he(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${N}' has not been started in this run.`)):(h.set(k,!0),Oe(A))}case F.SUBAGENT_FINISHED:case F.SUBAGENT_ERROR:{if(typeof A.subagentRunId!="string")return de(()=>new he(`Cannot send '${O}' without a 'subagentRunId'.`));if(O===F.SUBAGENT_ERROR&&typeof A.message!="string")return de(()=>new he("Cannot send 'SUBAGENT_ERROR' without a 'message'."));let k=A.subagentRunId;return h.has(k)?(h.delete(k),y.add(k),Oe(A)):de(()=>new he(`Cannot send '${O}': no active subagent found with ID '${k}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case F.MESSAGES_SNAPSHOT:{let k=T(A.messages,!0);if(k)return de(()=>k)}return Oe(A);case F.RUN_STARTED:I=!0;{let k=T((A.input??{}).messages,!1);if(k)return de(()=>k)}return Oe(A);case F.RUN_FINISHED:if(R()){let k=[];for(let[M,V]of g)for(let j of V.keys())k.push(M===void 0?j:`${j} (subagent '${M}')`);let N=k.join(", ");return de(()=>new he(`Cannot send 'RUN_FINISHED' while steps are still active: ${N}`))}if(n.size>0){let k=Array.from(n.keys()).join(", ");return de(()=>new he(`Cannot send 'RUN_FINISHED' while text messages are still active: ${k}`))}if(o.size>0){let k=Array.from(o.keys()).join(", ");return de(()=>new he(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${k}`))}if(h.size>0){let k=Array.from(h.keys()).join(", ");return de(()=>new he(`Cannot send 'RUN_FINISHED' while subagents are still active: ${k}`))}return s=!0,Oe(A);case F.RUN_ERROR:return u=!0,Oe(A);case F.CUSTOM:return Oe(A);case F.THINKING_TEXT_MESSAGE_START:return b?x?de(()=>new he("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(x=!0,Oe(A)):de(()=>new he("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case F.THINKING_TEXT_MESSAGE_CONTENT:return x?Oe(A):de(()=>new he("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case F.THINKING_TEXT_MESSAGE_END:return x?(x=!1,Oe(A)):de(()=>new he("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case F.THINKING_START:return b?de(()=>new he("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(b=!0,Oe(A));case F.THINKING_END:return b?(b=!1,Oe(A)):de(()=>new he("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Oe(A)}}))},Vn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),BO=e=>au(()=>qn(e())).pipe(af(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return qn(t.text()).pipe(wt(i=>{let a=i;if(o.includes("application/json"))try{a=JSON.parse(i)}catch{}let s=Error(`HTTP ${t.status}: ${typeof a=="string"?a:JSON.stringify(a)}`);return s.status=t.status,s.payload=a,de(()=>s)}))}let r={type:Vn.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new Ge(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:a}=yield n.read();if(i)break;let s={type:Vn.DATA,data:a};o.next(s)}o.complete()}catch(i){o.error(i)}})(),()=>{n.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):de(()=>Error("Failed to getReader() from response"))})),$O=(e,t)=>{let r=Aa(t),n=new or,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:s=>{if(s.type!==Vn.HEADERS&&s.type===Vn.DATA&&s.data){let u=o.decode(s.data,{stream:!0});i+=u;let c=i.split(/\n\n/);i=c.pop()||"";for(let g of c)a(g)}},error:s=>n.error(s),complete:()=>{i&&(i+=o.decode(),a(i)),n.complete()}});function a(s){let u=s.split(`
|
|
40
|
+
`),c=[];for(let g of u)g.startsWith("data:")&&c.push(g.slice(5).replace(/^ /,""));if(c.length>0)try{let g=c.join(`
|
|
41
|
+
`),v=JSON.parse(g);r?.event("SSE","Event received:",v,{type:v.type}),n.next(v)}catch(g){n.error(g)}}return n.asObservable()},QO=e=>{let t=new or,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==Vn.HEADERS&&o.type===Vn.DATA&&o.data){let i=new Uint8Array(r.length+o.data.length);i.set(r,0),i.set(o.data,r.length),r=i,n()}},error:o=>t.error(o),complete:()=>{if(r.length>0)try{n()}catch{console.warn("Incomplete or invalid protocol buffer data at stream end")}t.complete()}});function n(){for(;r.length>=4;){let o=4+new DataView(r.buffer,r.byteOffset,4).getUint32(0,!1);if(r.length<o)break;try{let i=r.slice(4,o),a=vb(i);t.next(a),r=r.slice(o)}catch(i){let a=i instanceof Error?i.message:String(i);t.error(Error(`Failed to decode protocol buffer message: ${a}`));return}}}return t.asObservable()},HO=(e,t)=>{let r=Aa(t),n=new or,o=new Qc,i=!1;return e.subscribe({next:a=>{if(o.next(a),a.type===Vn.HEADERS&&!i){i=!0;let s=a.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:s,parser:s===Sf?"protobuf":"sse"}),s===Sf?QO(o).subscribe({next:u=>n.next(u),error:u=>n.error(u),complete:()=>n.complete()}):$O(o,r).subscribe({next:u=>{try{let c=_c.parse(u);r?.event("HTTP","Event validated:",c,{type:c.type,valid:!0}),n.next(c)}catch(c){r?.event("HTTP","Event invalid:",{json:u,error:String(c)}),n.error(c)}},error:u=>{if(u?.name==="AbortError"){n.next({type:F.RUN_ERROR,message:u.message||"Request aborted",code:"abort",rawEvent:u}),n.complete();return}return n.error(u)},complete:()=>n.complete()})}else i||n.error(Error("No headers event received before data events"))},error:a=>{o.error(a),n.error(a)},complete:()=>{o.complete()}}),n.asObservable()},Ue=S.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),zO=S.enum(["LangGraphInterruptEvent","PredictState","Exit"]),WO=S.object({type:S.literal(Ue.enum.TextMessageStart),messageId:S.string(),parentMessageId:S.string().optional(),role:S.string().optional()}),KO=S.object({type:S.literal(Ue.enum.TextMessageContent),messageId:S.string(),content:S.string()}),YO=S.object({type:S.literal(Ue.enum.TextMessageEnd),messageId:S.string()}),XO=S.object({type:S.literal(Ue.enum.ActionExecutionStart),actionExecutionId:S.string(),actionName:S.string(),parentMessageId:S.string().optional()}),ZO=S.object({type:S.literal(Ue.enum.ActionExecutionArgs),actionExecutionId:S.string(),args:S.string()}),JO=S.object({type:S.literal(Ue.enum.ActionExecutionEnd),actionExecutionId:S.string()}),eP=S.object({type:S.literal(Ue.enum.ActionExecutionResult),actionName:S.string(),actionExecutionId:S.string(),result:S.string()}),tP=S.object({type:S.literal(Ue.enum.AgentStateMessage),threadId:S.string(),agentName:S.string(),nodeName:S.string(),runId:S.string(),active:S.boolean(),role:S.string(),state:S.string(),running:S.boolean()}),rP=S.object({type:S.literal(Ue.enum.MetaEvent),name:zO,value:S.any()}),nP=S.object({type:S.literal(Ue.enum.RunError),message:S.string(),code:S.string().optional()});S.discriminatedUnion("type",[WO,KO,YO,XO,ZO,JO,eP,tP,rP,nP]),S.object({id:S.string(),role:S.string(),content:S.string(),parentMessageId:S.string().optional()}),S.object({id:S.string(),name:S.string(),arguments:S.any(),parentMessageId:S.string().optional()}),S.object({id:S.string(),result:S.any(),actionExecutionId:S.string(),actionName:S.string()});var oP=e=>{if(typeof e=="string")return e;if(!Array.isArray(e))return;let t=e.filter(r=>r.type==="text").map(r=>r.text).filter(r=>r.length>0);if(t.length!==0)return t.join(`
|
|
42
|
+
`)},iP=(e,t,r)=>n=>{let o={},i=!0,a=!0,s="",u=null,c=null,g=[],v={},R=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(wt(h=>{switch(h.type){case F.TEXT_MESSAGE_START:{let y=h;return[{type:Ue.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case F.TEXT_MESSAGE_CONTENT:{let y=h;return[{type:Ue.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case F.TEXT_MESSAGE_END:{let y=h;return[{type:Ue.enum.TextMessageEnd,messageId:y.messageId}]}case F.TOOL_CALL_START:{let y=h;return g.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),a=!0,v[y.toolCallId]=y.toolCallName,[{type:Ue.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case F.TOOL_CALL_ARGS:{let y=h,b=g.find(I=>I.id===y.toolCallId);if(!b)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];b.function.arguments+=y.delta;let x=!1;if(c){let I=c.find(_=>_.tool==b.function.name);if(I)try{let _=JSON.parse(lu(b.function.arguments));I.tool_argument&&I.tool_argument in _?(R({...o,[I.state_key]:_[I.tool_argument]}),x=!0):I.tool_argument||(R({...o,[I.state_key]:_}),x=!0)}catch{}}return[{type:Ue.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(x?[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]:[])]}case F.TOOL_CALL_END:{let y=h;return[{type:Ue.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case F.TOOL_CALL_RESULT:{let y=h;return[{type:Ue.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:v[y.toolCallId]||"unknown"}]}case F.RAW:return[];case F.CUSTOM:{let y=h;switch(y.name){case"Exit":i=!1;break;case"PredictState":c=y.value;break}return[{type:Ue.enum.MetaEvent,name:y.name,value:y.value}]}case F.STATE_SNAPSHOT:return R(h.snapshot),[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}];case F.STATE_DELTA:{let y=h,b=Lc.applyPatch(o,y.delta,!0,!1);return b?(R(b.newDocument),[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]):[]}case F.MESSAGES_SNAPSHOT:return u=h.messages,[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(u?{messages:u}:{})}),active:!0}];case F.RUN_STARTED:return[];case F.RUN_FINISHED:return u&&(o.messages=u),Object.keys(o).length===0?[]:[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(u?{messages:aP(u)}:{})}),active:!1}];case F.RUN_ERROR:{let y=h;return[{type:Ue.enum.RunError,message:y.message,code:y.code}]}case F.STEP_STARTED:return s=h.stepName,g=[],c=null,[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case F.STEP_FINISHED:return g=[],c=null,[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function aP(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=oP(r.content);if(n){let o={id:r.id,role:r.role,content:n};t.push(o)}if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0)for(let o of r.toolCalls){let i={id:o.id,name:o.function.name,arguments:JSON.parse(o.function.arguments),parentMessageId:r.id};t.push(i)}}else if(r.role==="tool"){let n="unknown";for(let i of e)if(i.role==="assistant"&&i.toolCalls?.length){for(let a of i.toolCalls)if(a.id===r.toolCallId){n=a.function.name;break}}let o={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(o)}return t}var sP=e=>e.kind==="tool"?e.fields.toolCallId:e.fields.messageId,cP=e=>e==="tool"?"toolCallId":"messageId",Zo=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},Wu=e=>t=>{let r=Aa(e),n=new Map,o=u=>{let c=n.get(u);if(!c)return[];switch(n.delete(u),c.kind){case"text":{let g={type:F.TEXT_MESSAGE_END,messageId:c.fields.messageId,...(c.fields.subagentRunId!=null&&{subagentRunId:c.fields.subagentRunId})};return r?.event("TRANSFORM","TEXT_MESSAGE_END",g,{messageId:g.messageId}),[g]}case"tool":{let g={type:F.TOOL_CALL_END,toolCallId:c.fields.toolCallId,...(c.fields.subagentRunId!=null&&{subagentRunId:c.fields.subagentRunId})};return r?.event("TRANSFORM","TOOL_CALL_END",g,{toolCallId:g.toolCallId}),[g]}case"reasoning":{let g={type:F.REASONING_MESSAGE_END,messageId:c.fields.messageId,...(c.fields.subagentRunId!=null&&{subagentRunId:c.fields.subagentRunId})};return r?.event("TRANSFORM","REASONING_MESSAGE_END",g,{messageId:g.messageId}),[g]}}},i=()=>[...n.keys()].flatMap(u=>o(u)),a=(u,c)=>{for(let[g,v]of n)if(v.kind===u&&sP(v)===c)return{owner:g}},s=(u,c,g,v,R)=>{if(c!==void 0){let y=a(u,c);if(y){if(g!==void 0&&g!==y.owner)throw Error(`Cannot continue ${R} '${c}': chunk subagentRunId '${g}' does not match the open stream's subagent '${y.owner??"(the parent agent)"}'.`);return y.owner}return g}if(g!==void 0)return g;if(n.get(void 0)?.kind===u)return;let h=[...n.entries()].filter(([,y])=>y.kind===u);if(h.length===1)return h[0][0];if(h.length>1)throw Error(`Ambiguous ${v}: it carries neither a ${cP(u)} nor a subagentRunId, but ${h.length} lanes have an open ${R}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(wt(u=>{switch(u.type){case F.TEXT_MESSAGE_START:case F.TEXT_MESSAGE_CONTENT:case F.TEXT_MESSAGE_END:case F.TOOL_CALL_START:case F.TOOL_CALL_ARGS:case F.TOOL_CALL_END:case F.TOOL_CALL_RESULT:case F.STATE_SNAPSHOT:case F.STATE_DELTA:case F.CUSTOM:case F.STEP_STARTED:case F.STEP_FINISHED:case F.THINKING_START:case F.THINKING_END:case F.THINKING_TEXT_MESSAGE_START:case F.THINKING_TEXT_MESSAGE_CONTENT:case F.THINKING_TEXT_MESSAGE_END:case F.REASONING_START:case F.REASONING_MESSAGE_START:case F.REASONING_MESSAGE_CONTENT:case F.REASONING_MESSAGE_END:case F.REASONING_END:return[...o(u.subagentRunId??void 0),u];case F.RUN_STARTED:case F.RUN_FINISHED:case F.RUN_ERROR:case F.MESSAGES_SNAPSHOT:return[...i(),u];case F.RAW:case F.ACTIVITY_SNAPSHOT:case F.ACTIVITY_DELTA:case F.REASONING_ENCRYPTED_VALUE:case F.SUBAGENT_STARTED:return[u];case F.SUBAGENT_FINISHED:case F.SUBAGENT_ERROR:{let c=u.subagentRunId;return c==null?[u]:[...o(c),u]}case F.TEXT_MESSAGE_CHUNK:{let c=u,g=s("text",c.messageId,c.subagentRunId??void 0,"TEXT_MESSAGE_CHUNK","text message"),v=n.get(g),R=[],h;if(v?.kind==="text"&&(c.messageId===void 0||c.messageId===v.fields.messageId))h=v.fields;else{if(R.push(...o(g)),c.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");h={messageId:c.messageId,name:c.name,subagentRunId:c.subagentRunId},n.set(g,{kind:"text",fields:h});let y=Zo({type:F.TEXT_MESSAGE_START,messageId:c.messageId,role:c.role||"assistant",...(c.name!==void 0&&{name:c.name}),...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);R.push(y),r?.event("TRANSFORM","TEXT_MESSAGE_START",y,{messageId:c.messageId})}if(c.delta!==void 0){let y=c.subagentRunId??h.subagentRunId,b=Zo({type:F.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:c.delta,...(y!=null&&{subagentRunId:y})},c);R.push(b),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",b,{messageId:h.messageId})}if(R.length===0&&c.metadata!==void 0){let y=c.subagentRunId??h.subagentRunId;R.push({type:F.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:c.metadata,...(y!=null&&{subagentRunId:y})})}return R}case F.TOOL_CALL_CHUNK:{let c=u,g=s("tool",c.toolCallId,c.subagentRunId??void 0,"TOOL_CALL_CHUNK","tool call"),v=n.get(g),R=[],h;if(v?.kind==="tool"&&(c.toolCallId===void 0||c.toolCallId===v.fields.toolCallId))h=v.fields;else{if(R.push(...o(g)),c.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(c.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");h={toolCallId:c.toolCallId,toolCallName:c.toolCallName,parentMessageId:c.parentMessageId,subagentRunId:c.subagentRunId},n.set(g,{kind:"tool",fields:h});let y=Zo({type:F.TOOL_CALL_START,toolCallId:c.toolCallId,toolCallName:c.toolCallName,parentMessageId:c.parentMessageId,...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);R.push(y),r?.event("TRANSFORM","TOOL_CALL_START",y,{toolCallId:c.toolCallId,toolCallName:c.toolCallName})}if(c.delta!==void 0){let y=c.subagentRunId??h.subagentRunId,b=Zo({type:F.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:c.delta,...(y!=null&&{subagentRunId:y})},c);R.push(b),r?.event("TRANSFORM","TOOL_CALL_ARGS",b,{toolCallId:h.toolCallId})}if(R.length===0&&c.metadata!==void 0){let y=c.subagentRunId??h.subagentRunId;R.push({type:F.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:"",metadata:c.metadata,...(y!=null&&{subagentRunId:y})})}return R}case F.REASONING_MESSAGE_CHUNK:{let c=u,g=s("reasoning",c.messageId,c.subagentRunId??void 0,"REASONING_MESSAGE_CHUNK","reasoning message"),v=n.get(g),R=[],h;if(v?.kind==="reasoning"&&(c.messageId===void 0||c.messageId===v.fields.messageId))h=v.fields;else{if(R.push(...o(g)),c.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");h={messageId:c.messageId,subagentRunId:c.subagentRunId},n.set(g,{kind:"reasoning",fields:h});let y=Zo({type:F.REASONING_MESSAGE_START,messageId:c.messageId,role:"reasoning",...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);R.push(y),r?.event("TRANSFORM","REASONING_MESSAGE_START",y,{messageId:c.messageId})}if(c.delta!==void 0){let y=c.subagentRunId??h.subagentRunId,b=Zo({type:F.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:c.delta,...(y!=null&&{subagentRunId:y})},c);R.push(b),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",b,{messageId:h.messageId})}if(R.length===0&&c.metadata!==void 0){let y=c.subagentRunId??h.subagentRunId;R.push({type:F.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:c.metadata,...(y!=null&&{subagentRunId:y})})}return R}}return u.type,[]}),jn(()=>{i()}))};function uP(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var wa=class{runNext(e,t){return t.run(e).pipe(Wu(!1))}runNextWithState(e,t){let r=Te(e.messages||[]),n=Te(e.state||{}),o=new Qc;return Pb(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(su(/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(a=>setTimeout(a,0)),{event:i,messages:Te(r),state:Te(n)}});return function(_x93){return _ref45.apply(this,arguments)}}()))}},lP=class extends wa{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function dP(e){let t=e.content;if(Array.isArray(t)){let r=t.filter(n=>typeof n=="object"&&!!n&&"type"in n&&n.type==="text"&&typeof n.text=="string").map(n=>n.text).join("");return{...e,content:r}}return typeof t=="string"?e:{...e,content:""}}var pP=class extends wa{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(dP)};return this.runNext(o,t)}},xb="THINKING_START",Cb="THINKING_END",Eb="THINKING_TEXT_MESSAGE_START",Rb="THINKING_TEXT_MESSAGE_CONTENT",Ib="THINKING_TEXT_MESSAGE_END",fP=class extends wa{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<"u"&&process.env!==void 0&&process.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(Qr(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case xb:{this.currentReasoningId=ba();let{title:t,...r}=e;return this.warnAboutTransformation(xb,F.REASONING_START),{...r,type:F.REASONING_START,messageId:this.currentReasoningId}}case Eb:return this.currentMessageId=ba(),this.warnAboutTransformation(Eb,F.REASONING_MESSAGE_START),{...e,type:F.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case Rb:{let{delta:t,...r}=e;return this.warnAboutTransformation(Rb,F.REASONING_MESSAGE_CONTENT),{...r,type:F.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??ba(),delta:t}}case Ib:{let t=this.currentMessageId??ba();return this.warnAboutTransformation(Ib,F.REASONING_MESSAGE_END),{...e,type:F.REASONING_MESSAGE_END,messageId:t}}case Cb:{let t=this.currentReasoningId??ba();return this.warnAboutTransformation(Cb,F.REASONING_END),{...e,type:F.REASONING_END,messageId:t}}default:return e}}};function mP(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function gP(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function hP(e){let t=mP(e.mimeType);return e.data?{type:t,source:{type:"data",value:e.data,mimeType:e.mimeType},...(e.filename?{metadata:{filename:e.filename}}:{})}:e.url?{type:t,source:{type:"url",value:e.url,mimeType:e.mimeType},...(e.filename?{metadata:{filename:e.filename}}:{})}:e}function yP(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>gP(n)?hP(n):n);return{...e,content:r}}var vP=class extends wa{run(e,t){let r={...e,messages:e.messages.map(yP)};return this.runNext(r,t)}},Tb="SUBAGENT_STARTED",_b="SUBAGENT_FINISHED",kb="SUBAGENT_ERROR";function Ku(e){if(e&&typeof e=="object"&&"subagentRunId"in e){let{subagentRunId:t,...r}=e;return r}return e}function Ob(e){return e.map(t=>Ku(t))}var SP=class extends wa{warnDroppedLifecycleEvent(e){typeof process<"u"&&process.env!==void 0&&process.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let r={...e,messages:(e.messages??[]).map(n=>Ku(n))};return this.runNext(r,t).pipe(uu(n=>{let o=n.type;(o===Tb||o===_b||o===kb)&&this.warnDroppedLifecycleEvent(o)}),nf(n=>{let o=n.type;return o!==Tb&&o!==_b&&o!==kb}),Qr(n=>{let o=Ku(n);if(o.type===F.MESSAGES_SNAPSHOT){let i=o;if(Array.isArray(i.messages))return{...i,messages:Ob(i.messages)}}if(o.type===F.RUN_FINISHED){let i=o;if(i.outcome&&Array.isArray(i.outcome.interrupts))return{...i,outcome:{...i.outcome,interrupts:i.outcome.interrupts.map(a=>Ku(a))}}}if(o.type===F.RUN_STARTED){let i=o;if(i.input&&Array.isArray(i.input.messages))return{...i,input:{...i.input,messages:Ob(i.input.messages)}}}return o}))}},bP="0.0.59",AP=class{get maxVersion(){return bP}get debug(){return this._debug}set debug(e){this._debug=zu(e),this._debugLogger=wf(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?wf(zu(!0)):void 0:this._debugLogger=e}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:i}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??Ur(),this.messages=Te(n??[]),this.state=Te(o??{}),this._debug=zu(i),this._debugLogger=wf(this._debug),Xo(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new pP),Xo(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new fP),Xo(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new vP),Xo(this.maxVersion,"0.0.57")<=0&&this.middlewares.unshift(new SP)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(r=>typeof r=="function"?new lP(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this14=this;return _asyncToGenerator(function*(){try{_this14.isRunning=!0,_this14.agentId=_this14.agentId??Ur();let r=_this14.prepareRunAgentInput(e);_this14.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this14.agentId,threadId:_this14.threadId});let n,o=new Set(_this14.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{u.outcome==="success"&&(n=u.result)}},..._this14.subscribers,t??{}];yield _this14.onInitialize(r,i),_this14.activeRunDetach$=new or;let a;_this14.activeRunCompletionPromise=new Promise(u=>{a=u}),yield iu($c(()=>_this14.middlewares.length===0?_this14.run(r):_this14.middlewares.reduceRight((u,c)=>({run:g=>c.run(g,u),get messages(){return u.messages},get state(){return u.state}}),_this14).run(r),Wu(_this14.debugLogger),xf(_this14.debugLogger),u=>u.pipe(cu(_this14.activeRunDetach$)),u=>_this14.apply(r,u,i),u=>_this14.processApplyEvents(r,u,i),ya(u=>(_this14.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this14.agentId,error:u instanceof Error?u.message:String(u)}),_this14.isRunning=!1,_this14.onError(r,u,i))),jn(()=>{_this14.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this14.agentId,threadId:_this14.threadId}),_this14.isRunning=!1,_this14.onFinalize(r,i),a?.(),a=void 0,_this14.activeRunCompletionPromise=void 0,_this14.activeRunDetach$=void 0}))(Oe(null)));let s=Te(_this14.messages).filter(u=>!o.has(u.id));return{result:n,newMessages:s}}finally{_this14.isRunning=!1}})()}connect(e){throw new Bp}connectAgent(e,t){var _this15=this;return _asyncToGenerator(function*(){try{_this15.isRunning=!0,_this15.agentId=_this15.agentId??Ur();let r=_this15.prepareRunAgentInput(e),n,o=new Set(_this15.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{u.outcome==="success"&&(n=u.result)}},..._this15.subscribers,t??{}];yield _this15.onInitialize(r,i),_this15.activeRunDetach$=new or;let a;_this15.activeRunCompletionPromise=new Promise(u=>{a=u}),yield iu($c(()=>au(()=>_this15.connect(r)),Wu(_this15.debugLogger),xf(_this15.debugLogger),u=>u.pipe(cu(_this15.activeRunDetach$)),u=>_this15.apply(r,u,i),u=>_this15.processApplyEvents(r,u,i),ya(u=>(_this15.isRunning=!1,u instanceof Bp?Hc:_this15.onError(r,u,i))),jn(()=>{_this15.isRunning=!1,_this15.onFinalize(r,i),a?.(),a=void 0,_this15.activeRunCompletionPromise=void 0,_this15.activeRunDetach$=void 0}))(Oe(null)),{defaultValue:void 0});let s=Te(_this15.messages).filter(u=>!o.has(u.id));return{result:n,newMessages:s}}finally{_this15.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this16=this;return _asyncToGenerator(function*(){if(!_this16.activeRunDetach$)return;let e=_this16.activeRunCompletionPromise??Promise.resolve();_this16.activeRunDetach$.next(),_this16.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return Pb(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(uu(n=>{n.messages&&(this.messages=n.messages,r.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,r.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Te(this.messages);for(let n of t)n.subagentRunId===null&&delete n.subagentRunId;let r=t.filter(n=>n.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Ur(),tools:Te(e?.tools??[]),context:Te(e?.context??[]),forwardedProps:Te(e?.forwardedProps??{}),state:Te(this.state),messages:r,...(e?.resume===void 0?{}:{resume:Te(e.resume)})}}onInitialize(e,t){var _this17=this;return _asyncToGenerator(function*(){if(_this17.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(i=>i.interruptId)),o=_this17.pendingInterrupts.map(i=>i.id).filter(i=>!n.has(i));if(o.length>0)throw new he(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let i of _this17.pendingInterrupts)if(uP(i))throw new he(`Interrupt ${i.id} expired at ${i.expiresAt}`)}let r=yield Pe(t,_this17.messages,_this17.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this17,input:e}));if(r.messages!==void 0||r.state!==void 0){if(r.messages){_this17.messages=r.messages;for(let n of r.messages)n.subagentRunId===null&&delete n.subagentRunId;e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17,input:e})})}r.state&&(_this17.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this17.state,messages:_this17.messages,agent:_this17,input:e})}))}})()}onError(e,t,r){return qn(Pe(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(Qr(n=>{let o=n;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,r.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,r.forEach(i=>{i.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),o.stopPropagation!==!0){let i=String(t);if(!(t.name==="AbortError"||t.message==="Fetch is aborted"||t.message==="signal is aborted without reason"||t.message==="component unmounted"||i==="component unmounted"))throw console.error("Agent execution failed:",t),t}return{}}))}onFinalize(e,t){var _this18=this;return _asyncToGenerator(function*(){let r=yield Pe(t,_this18.messages,_this18.state,(n,o,i)=>n.onRunFinalized?.({messages:o,state:i,agent:_this18,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this18.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this18.messages,state:_this18.state,agent:_this18,input:e})})),r.state!==void 0&&(_this18.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this18.state,messages:_this18.messages,agent:_this18,input:e})})))})()}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=Te(this.messages),e.state=Te(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Te(this.pendingInterrupts),e}addMessage(e){var _this19=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this19.subscribers)yield t.onNewMessage?.({message:e,messages:_this19.messages,state:_this19.state,agent:_this19});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this19.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this19.messages,state:_this19.state,agent:_this19});for(let t of _this19.subscribers)yield t.onMessagesChanged?.({messages:_this19.messages,state:_this19.state,agent:_this19})})()}addMessages(e){var _this20=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this20.subscribers)yield r.onNewMessage?.({message:t,messages:_this20.messages,state:_this20.state,agent:_this20});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this20.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this20.messages,state:_this20.state,agent:_this20})}for(let t of _this20.subscribers)yield t.onMessagesChanged?.({messages:_this20.messages,state:_this20.state,agent:_this20})})()}setMessages(e){var _this21=this;this.messages=Te(e),_asyncToGenerator(function*(){for(let t of _this21.subscribers)yield t.onMessagesChanged?.({messages:_this21.messages,state:_this21.state,agent:_this21})})()}setState(e){var _this22=this;this.state=Te(e),_asyncToGenerator(function*(){for(let t of _this22.subscribers)yield t.onStateChanged?.({messages:_this22.messages,state:_this22.state,agent:_this22})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Ur();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:o=>n.run(o,r),get messages(){return r.messages},get state(){return r.state}}),this).run(t)).pipe(Wu(this.debugLogger),xf(this.debugLogger),iP(this.threadId,t.runId,this.agentId),r=>r.pipe(Qr(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}};function wP(e){if(!Array.isArray(e.messages))return e;let t=!1,r=e.messages.map(n=>{if(n.subagentRunId===null){t=!0;let o={...n};return delete o.subagentRunId,o}return n});return t?{...e,messages:r}:e}var Nb=class extends AP{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(wP(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new l.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new l.AbortController,this.url=e.url,this.headers=Te(e.headers??{}),this.fetch=e.fetch??((t,r)=>C(t,r))}run(e){return HO(BO(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Te(this.headers??{}),e.fetch=this.fetch;let t=new l.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};m();d();f();p();var Fb=(e,t,r)=>{let n=_t(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let i=`/api/v1/organizations/${t}/agents`;return`${n}${i}/${o}`};var Rf=class extends Nb{requestInit(t){let{params:r,accessToken:n,recordDebugSession:o}=t.forwardedProps||{},i={...r,...(o&&{recordDebugSession:!0})};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream, application/json"},body:JSON.stringify(i),signal:this.abortController.signal}}},Db=(e,t,r)=>new Rf({url:`${Fb(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var xP=new z({required:!0}),Mb=new z({required:!0,constrainTo:fc}),Lb=e=>({...e,name:mc(e.name)}),qb=L("followUpAnswers/setIsEnabled",e=>B(e,new me({required:!0}))),jb=L("followUpAnswers/setFollowUpAnswersConversationId",e=>B(e,Y)),Ub=L("followUpAnswers/setFollowUpAnswersConversationToken",e=>B(e,Y)),Vb=L("followUpAnswers/clearFollowUpAnswersConversationToken"),hne=L("followUpAnswers/createFollowUpAnswer",e=>B(e,{question:Y})),yne=L("followUpAnswers/setActiveFollowUpAnswerId",e=>B(e,Y)),vne=L("followUpAnswers/setFollowUpAnswerContentFormat",e=>B(e,{contentFormat:hc,answerId:Y})),Sne=L("followUpAnswers/setFollowUpIsLoading",e=>B(e,{isLoading:new me({required:!0}),answerId:Y})),bne=L("followUpAnswers/setFollowUpIsStreaming",e=>B(e,{isStreaming:new me({required:!0}),answerId:Y})),Ane=L("followUpAnswers/followUpMessageChunkReceived",e=>B(e,{textDelta:xP,answerId:Y})),wne=L("followUpAnswers/followUpCitationsReceived",e=>B(e,{citations:new Ae({required:!0,each:new ne({values:_p})}),answerId:Y})),xne=L("followUpAnswers/followUpCompleted",e=>B(e,{answerId:Y,cannotAnswer:new me({required:!1})})),Cne=L("followUpAnswers/followUpFailed",e=>B(e,{message:new z,code:new oe({min:0}),answerId:Y})),Ene=L("followUpAnswers/activeFollowUpStartFailed",e=>B(e,{message:new z})),Rne=L("followUpAnswers/likeFollowUp",e=>B(e,{answerId:Y})),Ine=L("followUpAnswers/dislikeFollowUp",e=>B(e,{answerId:Y})),Tne=L("followUpAnswers/submitFollowUpFeedback",e=>B(e,{answerId:Y})),Gb=L("followUpAnswers/resetFollowUpAnswers"),_ne=L("followUpAnswers/stepStarted",e=>B(Lb(e),{answerId:Y,name:Mb,startedAt:new oe({min:0,required:!0})})),kne=L("followUpAnswers/stepFinished",e=>B(Lb(e),{answerId:Y,name:Mb,finishedAt:new oe({min:0,required:!0})})),One=L("followUpAnswers/startToolCall",e=>B(e,{answerId:Y,toolCallName:Y,startedAt:new oe({min:0,required:!0}),toolCallId:Y})),Pne=L("followUpAnswers/finishToolCall",e=>B(e,{answerId:Y,finishedAt:new oe({min:0,required:!0}),toolCallId:Y})),Nne=L("followUpAnswers/toolCallArgs",e=>B(e,{answerId:Y,toolCallId:Y,args:new ne({options:{required:!0}}),type:new z({required:!0,constrainTo:gc})}));m();d();f();p();var CP={"KNOWLEDGE:SSE_MAX_DURATION_EXCEEDED":1e3,"KNOWLEDGE:SSE_FOLLOW_UP_NOT_SUPPORTED":1001,"KNOWLEDGE:NOT_FOUND":1002,"KNOWLEDGE:SSE_MODELS_NOT_AVAILABLE":1003,"KNOWLEDGE:SSE_INTERNAL_ERROR":1004,"KNOWLEDGE:SSE_TURN_LIMIT_REACHED":1005};function Bb(e){return e?CP[e]??1004:1004}var $b=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(yc(n.runId)),e(jr(!1)),e(ra(!0)),e(jb(n.threadId)),e(Vb())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(iv({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(av({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onToolCallStartEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:i,toolCallId:a,timestamp:s}=n;e(sv({toolCallId:a,toolCallName:i,startedAt:s??Date.now()}))},onToolCallEndEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,timestamp:a}=n;e(cv({toolCallId:i,finishedAt:a??Date.now()}))},onToolCallArgsEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,delta:a}=n;try{let s=JSON.parse(a);typeof s?.q=="string"?e(Sc({toolCallId:i,args:s,type:"search"})):e(Sc({toolCallId:i,args:{raw:a},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${a}`),e(Sc({toolCallId:i,args:{raw:a},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(na({textDelta:n.delta})))},onCustomEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{name:i,value:a}=n;switch(i){case"header":{a?.contentFormat&&e(aa(a.contentFormat)),typeof a?.followUpEnabled=="boolean"&&e(qb(a.followUpEnabled)),a?.conversationToken&&e(Ub(a.conversationToken));return}case"citations":{e(oa({citations:a.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=Bb(n.code);e(ia({message:n.message,code:i}))},onRunFinishedEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=n.result?.completionReason==="ANSWERED",a=i?!r:void 0;e(kp(i)),e(sa(!i)),e(ra(!1)),e(lp(i,t,a)),e(To())}}};var Qb=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _ref50=_asyncToGenerator(function*(n,o,i){t();let a=Hs(n),s=fh(n),u=mh(n),c=ph(n),g=gh(n),v=Db(a,s,u);e=v;let R=$b(o),h=Zy(n,i());try{o(jr(!0)),yield v.runAgent({forwardedProps:{params:h,accessToken:c,recordDebugSession:g}},R)}catch(y){o(jr(!1)),o(ia({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});return function run(_x94,_x95,_x96){return _ref50.apply(this,arguments)}}(),abortRun:t}};m();d();f();p();m();d();f();p();var Yu=L("breadcrumb/deselectAll"),Hb=L("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var zb=L("facet/updateFacetAutoSelection",e=>B(e,{allow:new me({required:!0})}));m();d();f();p();m();d();f();p();var Xu=class extends Pr{constructor(r){super(r);ue(this,"getState",r)}get activeInstantResultQuery(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].q;return null}get activeInstantResultCache(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].cache[o];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??Et().q}get responseTime(){return this.activeInstantResultCache?.duration??zt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??zt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var Wb=()=>De("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Xu(e)),Kb=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var If={id:Y},EP={...If,q:nt},Boe=L("instantResults/register",e=>B(e,If)),Zu=L("instantResults/updateQuery",e=>B(e,EP)),$oe=L("instantResults/clearExpired",e=>B(e,If));m();d();f();p();var Ju=new oe({required:!0,min:0}),el=L("pagination/registerNumberOfResults",e=>B(e,Ju)),tl=L("pagination/updateNumberOfResults",e=>B(e,Ju)),rl=L("pagination/registerPage",e=>B(e,Ju)),Jo=L("pagination/updatePage",e=>B(e,Ju)),nl=L("pagination/nextPage"),ol=L("pagination/previousPage");m();d();f();p();var ei=L("query/updateQuery",e=>B(e,{q:new z,enableQuerySyntax:new me}));m();d();f();p();m();d();f();p();m();d();f();p();var zr=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var Tf=()=>De("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),Wr=e=>De("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||Et().q,aq:r.advancedSearchQueries?.aq||zr().aq,cq:r.advancedSearchQueries?.cq||zr().cq,dq:r.advancedSearchQueries?.dq||zr().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();var Tie=L("didYouMean/enable"),_ie=L("didYouMean/disable"),kie=L("didYouMean/automaticCorrections/disable"),Oie=L("didYouMean/automaticCorrections/enable"),il=L("didYouMean/correction",e=>B(e,Y)),Pie=L("didYouMean/automaticCorrections/mode",e=>B(e,new z({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var _f=()=>De("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var Yb=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function al(){return{contextValues:{}}}m();d();f();p();function sl(){return{contextValues:{}}}m();d();f();p();function Xb(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function Zb(){return[]}m();d();f();p();function xa(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function Jb(){return{}}m();d();f();p();function eA(){return{}}m();d();f();p();function tA(){return{}}function ir(e){return{context:e.context||al(),dictionaryFieldContext:e.dictionaryFieldContext||sl(),facetSet:e.facetSet||Qs(),numericFacetSet:e.numericFacetSet||$s(),dateFacetSet:e.dateFacetSet||Bs(),categoryFacetSet:e.categoryFacetSet||Gs(),automaticFacetSet:e.automaticFacetSet??Vs(),pagination:e.pagination||xa(),query:e.query||Et(),tabSet:e.tabSet||tA(),advancedSearchQueries:e.advancedSearchQueries||zr(),staticFilterSet:e.staticFilterSet||eA(),querySet:e.querySet||Jb(),sortCriteria:e.sortCriteria||zs(),pipeline:e.pipeline||_r(),searchHub:e.searchHub||bo(),facetOptions:e.facetOptions||Xb(),facetOrder:e.facetOrder??Zb(),debug:e.debug??bs()}}m();d();f();p();var ose=new ne({values:{undoneQuery:nt},options:{required:!0}}),rA=()=>De("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var cl=L("trigger/query/ignore",e=>B(e,new z({emptyAllowed:!0,required:!0}))),ul=L("trigger/query/modification",e=>B(e,new ne({values:{originalQuery:rt,modification:rt}})));m();d();f();p();var Kr=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=TP(e),n=dc(e),o=RP(e),i=yield Lr(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Dr({...i,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(r&&{cq:r}),...(n.length&&{facets:n}),...(e.pagination&&{numberOfResults:a(),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:o}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Kr(_x97,_x98){return _ref51.apply(this,arguments)}}();function RP(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(IP).filter(r=>r.currentValues.length>0):void 0}function IP(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function TP(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=_P(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function _P(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o})}var Yr=class{constructor(t,r=n=>{this.dispatch(ei({q:n}))}){ue(this,"config",t);ue(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x99,_x100){var _this23=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=lc(yield _this23.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this23.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.processQueryErrorOrContinue(t)??(yield _this24.processQueryCorrectionsOrContinue(t))??(yield _this24.processQueryTriggersOrContinue(t))??_this24.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return vt(t.response)?(this.dispatch(Wr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this25=this;return _asyncToGenerator(function*(){let r=_this25.getState(),n=_this25.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:u}=n;if(!o||!i)return null;let c=a.length===0&&s&&s.length!==0,g=!ce(u)&&!ce(u.correctedQuery);if(!c&&!g)return null;let R=c?yield _this25.processLegacyDidYouMeanAutoCorrection(t):_this25.processModernDidYouMeanAutoCorrection(t);return _this25.dispatch(Xt(ir(_this25.getState()))),R})()}processLegacyDidYouMeanAutoCorrection(t){var _this26=this;return _asyncToGenerator(function*(){let r=_this26.getCurrentQuery(),n=_this26.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this26.automaticallyRetryQueryWithCorrection(o);return vt(i.response)?(_this26.dispatch(Wr(i.response.error)),_this26.rejectWithValue(i.response.error)):(_this26.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this26.dispatch(Xt(ir(_this26.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:_f()})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o,analyticsAction:_f()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let r=this.getState(),n=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,r,n),this.extra)}processQueryTriggersOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this27.getState().triggers?.queryModification.queryToIgnore===n)return _this27.dispatch(cl("")),null;_this27.analyticsAction&&(yield _this27.dispatch(_this27.analyticsAction));let i=_this27.getCurrentQuery(),a=yield _this27.automaticallyRetryQueryWithTriggerModification(n);return vt(a.response)?(_this27.dispatch(Wr(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(Xt(ir(_this27.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:rA()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??Et().enableQuerySyntax},search:{...zt(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Xt(ir(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Ba(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this28=this;return _asyncToGenerator(function*(){_this28.onUpdateQueryForCorrection(t);let r=yield _this28.fetchFromAPI(yield Kr(_this28.getState()),{origin:"mainSearch"});return _this28.dispatch(il(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this29=this;return _asyncToGenerator(function*(){return _this29.dispatch(ul({newQuery:t,originalQuery:_this29.getCurrentQuery()})),_this29.onUpdateQueryForCorrection(t),yield _this29.fetchFromAPI(yield Kr(_this29.getState()),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get analyticsAction(){return this.config.analyticsAction}get rejectWithValue(){return this.config.rejectWithValue}};var oce=ke("search/executeSearch",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield ll(r,t,e)});return function(_x101,_x102){return _ref52.apply(this,arguments)}}()),ice=ke("search/fetchPage",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Of(r,t,e)});return function(_x103,_x104){return _ref53.apply(this,arguments)}}()),ace=ke("search/fetchMoreResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Pf(t,r)});return function(_x105,_x106){return _ref54.apply(this,arguments)}}()),sce=ke("search/fetchFacetValues",/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t){let r=t.getState();return yield NP(t,e,r)});return function(_x107,_x108){return _ref55.apply(this,arguments)}}()),cce=ke("search/fetchInstantResults",/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){return kf(e,t)});return function(_x109,_x110){return _ref56.apply(this,arguments)}}()),kP=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=yield Kr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function kP(_x111,_x112){return _ref57.apply(this,arguments)}}(),OP=/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t,r){let n=yield Lr(e);return Dr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function OP(_x113,_x114,_x115){return _ref58.apply(this,arguments)}}(),PP=/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=yield Kr(e,t);return r.request.numberOfResults=0,r});return function PP(_x116,_x117){return _ref59.apply(this,arguments)}}(),nA=e=>{e.configuration.analytics.enabled&&ht.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function kf(_x118,_x119){return _kf.apply(this,arguments)}function _kf(){_kf=_asyncToGenerator(function*(e,t){B(e,{id:Y,q:Y,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new Yr({...t,analyticsAction:Wb()},c=>{t.dispatch(Zu({q:c,id:e.id}))}),a=yield OP(o,r,n),s=yield i.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),u=yield i.process(s);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,analyticsAction:u.analyticsAction,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return _kf.apply(this,arguments)}function Of(_x120,_x121,_x122){return _Of.apply(this,arguments)}function _Of(){_Of=_asyncToGenerator(function*(e,t,r){nA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Yr({...t,analyticsAction:r}),u=yield Kr(e,a),c=yield s.fetchFromAPI(u,{origin:"mainSearch"});return yield s.process(c)});return _Of.apply(this,arguments)}function Pf(_x123,_x124){return _Pf.apply(this,arguments)}function _Pf(){_Pf=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield Tf().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new Yr({...e,analyticsAction:Tf()}),s=yield kP(t,i),u=yield a.fetchFromAPI(s,{origin:"mainSearch"});return yield a.process(u)});return _Pf.apply(this,arguments)}function NP(_x125,_x126,_x127){return _NP.apply(this,arguments)}function _NP(){_NP=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=e.extra,{description:a}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Yr({...e,analyticsAction:t}),u=yield PP(r,a),c=yield s.fetchFromAPI(u,{origin:"facetValues"});return yield s.process(c)});return _NP.apply(this,arguments)}function ll(_x128,_x129,_x130){return _ll.apply(this,arguments)}function _ll(){_ll=_asyncToGenerator(function*(e,t,r){nA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=yield Kr(e,a),u=new Yr({...t,analyticsAction:r}),c=yield u.fetchFromAPI(s,{origin:"mainSearch"});return yield u.process(c)});return _ll.apply(this,arguments)}m();d();f();p();var Xr=class{constructor(t,r=n=>{this.dispatch(ei({q:n}))}){ue(this,"config",t);ue(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x131,_x132){var _this30=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=lc(yield _this30.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this30.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.processQueryErrorOrContinue(t)??(yield _this31.processQueryCorrectionsOrContinue(t))??(yield _this31.processQueryTriggersOrContinue(t))??_this31.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return vt(t.response)?(this.dispatch(Wr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this32=this;return _asyncToGenerator(function*(){let r=_this32.getState(),n=_this32.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:u}=n;if(!o)return null;if(!i)return!ce(u)&&!ce(u.correctedQuery)?_this32.processModernDidYouMeanAutoCorrection(t):null;let c=a.length===0&&s&&s.length!==0,g=!ce(u)&&!ce(u.correctedQuery);if(!c&&!g)return null;let R=c?yield _this32.processLegacyDidYouMeanAutoCorrection(t):_this32.processModernDidYouMeanAutoCorrection(t);return _this32.dispatch(Xt(ir(_this32.getState()))),R})()}processLegacyDidYouMeanAutoCorrection(t){var _this33=this;return _asyncToGenerator(function*(){let r=_this33.getCurrentQuery(),n=_this33.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this33.automaticallyRetryQueryWithCorrection(o);return vt(i.response)?(_this33.dispatch(Wr(i.response.error)),_this33.rejectWithValue(i.response.error)):(_this33.dispatch(Xt(ir(_this33.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o}}processQueryTriggersOrContinue(t){var _this34=this;return _asyncToGenerator(function*(){let r=_this34.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this34.getState().triggers?.queryModification.queryToIgnore===n)return _this34.dispatch(cl("")),null;let i=_this34.getCurrentQuery(),a=yield _this34.automaticallyRetryQueryWithTriggerModification(n);return vt(a.response)?(_this34.dispatch(Wr(a.response.error)),_this34.rejectWithValue(a.response.error)):(_this34.dispatch(Xt(ir(_this34.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Xt(ir(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Ba(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this35=this;return _asyncToGenerator(function*(){_this35.onUpdateQueryForCorrection(t);let r=_this35.getState(),{actionCause:n}=Yb(),o=yield _this35.fetchFromAPI(yield qr(r,_this35.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this35.dispatch(il(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this36=this;return _asyncToGenerator(function*(){return _this36.dispatch(ul({newQuery:t,originalQuery:_this36.getCurrentQuery()})),_this36.onUpdateQueryForCorrection(t),yield _this36.fetchFromAPI(yield qr(_this36.getState(),_this36.extra.navigatorContext),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}};var Wce=ke("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;B(e,{q:new z,enableQuerySyntax:new me,clearFilters:new me}),e.clearFilters&&(r(Yu()),r(Hb())),r(zb({allow:!0})),r(ei({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(Jo(1))}),Kce=L("search/updateSearchAction"),dl=ke("search/executeSearch",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return ll(r,t,e.legacy);iA(r);let n=e.next?aA(e.next):void 0,o=yield qr(r,t.extra.navigatorContext,n),i=new Xr({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x133,_x134){return _ref60.apply(this,arguments)}}()),oA=ke("search/fetchPage",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(iA(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Of(r,t,e.legacy);let n=new Xr({...t,analyticsAction:e.next}),o=yield qr(r,t.extra.navigatorContext,e.next),i=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(i)});return function(_x135,_x136){return _ref61.apply(this,arguments)}}()),Yce=ke("search/fetchMoreResults",/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Pf(t,r);let n=Dh("browseResults",t.getState),o=new Xr({...t,analyticsAction:n}),i=yield FP(r,t.extra.navigatorContext,n),a=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(a)});return function(_x137,_x138){return _ref62.apply(this,arguments)}}()),Xce=ke("search/fetchFacetValues",/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return ll(r,t,e.legacy);let n=new Xr({...t,analyticsAction:{}}),o=yield MP(r,t.extra.navigatorContext),i=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(i)});return function(_x139,_x140){return _ref63.apply(this,arguments)}}()),Zce=ke("search/fetchInstantResults",/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return kf(e,t);B(e,{id:Y,q:Y,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:n,maxResultsPerQuery:o}=e,i=aA(Kb()),a=yield DP(r,t.extra.navigatorContext,n,o,i),s=new Xr({...t,analyticsAction:i},g=>{t.dispatch(Zu({q:g,id:e.id}))}),u=yield s.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),c=yield s.process(u);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return function(_x141,_x142){return _ref64.apply(this,arguments)}}()),FP=/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t,r){let n=yield qr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function FP(_x143,_x144,_x145){return _ref65.apply(this,arguments)}}(),DP=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(e,t,r,n,o){let i=ko(e,t,o);return Dr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function DP(_x146,_x147,_x148,_x149,_x150){return _ref66.apply(this,arguments)}}(),MP=/*#__PURE__*/function(){var _ref67=_asyncToGenerator(function*(e,t,r){let n=yield qr(e,t,r);return n.request.numberOfResults=0,n});return function MP(_x151,_x152,_x153){return _ref67.apply(this,arguments)}}(),iA=e=>{e.configuration.analytics.enabled&&ht.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},aA=e=>({actionCause:e.actionCause,type:e.actionCause});var sA=e=>{let t=xg({extra:e}),r=Qb();return t.startListening({actionCreator:dl.pending,effect:function(){var _ref68=_asyncToGenerator(function*(n,o){let i=o.getState();if(!Vd(i)||(r.abortRun(),o.dispatch(vc()),o.dispatch(Gb()),i.generatedAnswer.isEnabled===!1))return;let a=hn(i)?.q;!a||a.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});return function effect(_x154,_x155){return _ref68.apply(this,arguments)}}()}),t};m();d();f();p();var cA=e=>()=>t=>r=>{let n=r;if(!n.error)return t(r);let o=n.error;if(n.payload?.ignored||e.error({error:o,action:r},`Action dispatch error ${n.type}`),n.error.name!=="SchemaValidationError")return t(r)},uA=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var Nf=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:i}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:i}};m();d();f();p();function lA(e,t){let r={...e},n,o=i=>(a,s)=>{let u=i(a,s);return n?n(u,s):u};return{get combinedReducer(){let i=pm(Object.entries(t).filter(([a])=>!(a in r)).map(([a,s])=>[a,()=>s]));return o(Jn({...i,...r}))},containsAll(i){return Object.keys(i).every(s=>s in r)},add(i){Object.keys(i).filter(a=>!(a in r)).forEach(a=>{r[a]=i[a]})},addCrossReducer(i){n=i}}}m();d();f();p();m();d();f();p();function LP(e){if(!e||!qP(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),o=decodeURIComponent(n.split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(o)}catch{return null}}function dA(e,t=60){if(!e)return!1;let r=LP(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function qP(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function fA(e,t){let r=0,n=null,o=Ma(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(v,R=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(b){if(!R)throw b;return null}})().finally(()=>{n=null}));let y=yield n;return h&&y&&v.dispatch(Ir({accessToken:y})),y});return function i(_x156){return _ref69.apply(this,arguments)}}(),a=v=>{let R=VP(v.getState());return!!R&&dA(R)},s=/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(v){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(v))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(R){e.warn(R,"Access token renewal failed. A retry will occur if necessary.")}});return function s(_x157){return _ref71.apply(this,arguments)}}(),u=/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(v,R,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),pA(v,R.error),R;!n&&(r++,o());try{yield i(v,!0)}catch(b){e.debug(b,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}v.dispatch(h)});return function u(_x158,_x159,_x160){return _ref72.apply(this,arguments)}}(),c=(v,R,h)=>UP(h)?t?u(v,h,R):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),pA(v,h.error),h):h,g=(v,R,h)=>jP(h)?Promise.resolve(h).then(y=>c(v,R,y)):c(v,R,h);return v=>R=>h=>{if(!(typeof h=="function"))return R(h);let b=()=>g(v,h,R(h));return typeof t=="function"&&a(v)?s(v).then(b):b()}}function jP(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function UP(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Xn().name}function pA(e,t){e.dispatch(ws({status:401,statusCode:401,message:t.message,type:t.name}))}function VP(e){return e.configuration.accessToken}m();d();f();p();function mA({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return ug({reducer:e,preloadedState:t,devTools:{stateSanitizer:i=>i.history?{...i,history:"<<OMIT>>"}:i,name:o,shouldHotReload:!1},middleware:i=>i({thunk:{extraArgument:n}}).prepend(...r).concat(uA(n.logger))})}function GP(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,disableBrowserPrivacySignals:o,...i}=r??{},a={...i,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})},s=a.analyticsMode!=="next",u=a.analyticsMode==="legacy"&&o===!0;return s&&ql()&&!u?(t.info("Analytics disabled since doNotTrack is active."),{...a,enabled:!1}):(s&&ql()&&u&&a.enabled!==!1&&t.warn("Browser privacy signals (Do Not Track and Global Privacy Control) are present but are being ignored because analytics.disableBrowserPrivacySignals is set to true. Legacy analytics events will be sent, and your integration is responsible for privacy compliance."),a)}function gA(e,t){let r={...e.reducers,configuration:Vt,version:vv},n=BP({...e,reducers:r},t,Vt),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(Ir({accessToken:o,environment:i,organizationId:a}));let s=GP(e.configuration,n.logger);return s&&n.dispatch(so(s)),n}function BP(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=lA({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,s={...t,get relay(){return $i(c.state,o)},get navigatorContext(){return Nf(this.relay,o)}},u=$P(e,s,i),c={addReducers(g){i.containsAll(g)||(i.add(g),u.replaceReducer(i.combinedReducer))},dispatch:u.dispatch,subscribe:u.subscribe,enableAnalytics(){u.dispatch(uo())},disableAnalytics(){u.dispatch(co())},get state(){return u.getState()},get relay(){return $i(this.state,o)},get navigatorContext(){return Nf(this.relay,o)},logger:a,store:u};return c}function $P(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=QP(e,t.logger,()=>t.navigatorContext);return mA({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function QP(e,t,r){let{renewAccessToken:n}=e.configuration,o=fA(t,n),i=sA({getNavigatorContext:r});return[_v,o,cA(t),bv].concat(Pp.middleware,i.middleware,e.middlewares||[])}m();d();f();p();var EA=jt(CA(),1);function RA(e){return(0,EA.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function IA(e,t){let r=uN(e),n=kt,o=lN(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function uN(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function lN(e){return e.preprocessRequest||ja}m();d();f();p();m();d();f();p();var TA={organizationId:Y,accessToken:Y,name:new z({required:!1,emptyAllowed:!1}),analytics:new ne({options:{required:!1},values:{enabled:new me({required:!1}),originContext:new z({required:!1}),originLevel2:new z({required:!1}),originLevel3:new z({required:!1}),analyticsMode:new z({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new z({required:!1,url:!0}),trackingId:new z({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new me({required:!1})}}),environment:new z({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function _A(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var kA=new yt({...TA,pipeline:new z({required:!1,emptyAllowed:!0}),searchHub:rt,locale:rt,timezone:rt});function jf(){return{..._A(),searchHub:"default"}}var dN={debug:As,pipeline:po,searchHub:Eo,recommendation:xo};function OA(e){let t=RA(e.loggerOptions);pN(e.configuration,t);let r=fN(e.configuration,t),n={...IA(e.configuration,t),apiClient:r},o={...e,reducers:dN},i=gA(o,n),{pipeline:a,searchHub:s,timezone:u,locale:c,proxyBaseUrl:g}=e.configuration;return i.dispatch(Yt({timezone:u,locale:c,proxyBaseUrl:g})),ce(a)||i.dispatch(lo(a)),ce(s)||i.dispatch(Co(s)),{...i,get state(){return i.state}}}function pN(e,t){try{kA.validate(e)}catch(r){throw t.error(r,"Recommendation engine configuration error"),r}}function fN(e,t){return new Ga({logger:t,preprocessRequest:e.preprocessRequest||ja,postprocessSearchResponseMiddleware:e.preprocessSearchResponseMiddleware||_m,postprocessFacetSearchResponseMiddleware:km,postprocessQuerySuggestResponseMiddleware:Om})}m();d();f();p();m();d();f();p();m();d();f();p();var mN=new Ae({each:Y,required:!0}),PA=(e,t)=>(B(e,Y),Fa(t)?B(t,Y):B(t,mN),{payload:{contextKey:e,contextValue:t}}),Bn=L("context/set",e=>{for(let[t,r]of Object.entries(e))PA(t,r);return{payload:e}}),$n=L("context/add",e=>PA(e.contextKey,e.contextValue)),Qn=L("context/remove",e=>B(e,Y));m();d();f();p();var ml=Be(al(),e=>{e.addCase(Bn,(t,r)=>{t.contextValues=r.payload}).addCase($n,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Qn,(t,r)=>{delete t.contextValues[r.payload]}).addCase(St.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});m();d();f();p();function Jr(e){let t,r=new Map,n=()=>r.size===0,o=i=>{try{let a=JSON.stringify(i),s=t!==a;return t=a,s}catch(a){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",a),!0}};return{subscribe(i){i();let a=Symbol(),s;return n()&&(t=JSON.stringify(this.state),s=e.subscribe(()=>{o(this.state)&&r.forEach(u=>u())})),r.set(a,i),()=>{r.delete(a),n()&&s?.()}},get state(){return{}}}}m();d();f();p();var gN=["caseId","caseNumber"],hN={caseId:"caseContext",caseNumber:"caseContext"},Ea=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${hN[t]} to set this value.}`)}};function Uf(e){return gN.includes(e)}var yN=new yt({values:new ne({options:{required:!1}})});function NA(e,t={}){if(!bN(e))throw Ht;let r=Jr(e),{dispatch:n}=e,o=()=>e.state,i=Rg(e,yN,t.initialState,"buildContext");return i.values&&n(Bn(i.values)),{...r,get state(){return{values:o().context.contextValues}},set(a){n(Bn(a))},...(o().configuration.analytics.analyticsMode==="legacy"?vN(n):SN(n))}}var vN=e=>({add(t,r){e($n({contextKey:t,contextValue:r}))},remove(t){e(Qn(t))}}),SN=e=>({add(t,r){if(Uf(t))throw new Ea(t);e($n({contextKey:t,contextValue:r}))},remove(t){if(Uf(t))throw new Ea(t);e(Qn(t))}});function bN(e){return e.addReducers({context:ml}),!0}function FA(e,t){return NA(e,t)}m();d();f();p();m();d();f();p();var ri=L("dictionaryFieldContext/set",e=>{let t=new ne({options:{required:!0}}),r=B(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new Ae({each:nt}),i=B(n,o).error;return i?{payload:e,error:i}:{payload:e}}),ni=L("dictionaryFieldContext/add",e=>{let t=new ne({options:{required:!0},values:{field:nt,key:nt}});return B(e,t)}),oi=L("dictionaryFieldContext/remove",e=>B(e,nt));m();d();f();p();var gl=Be(sl(),e=>{e.addCase(ri,(t,r)=>{t.contextValues=r.payload}).addCase(ni,(t,r)=>{let{field:n,key:o}=r.payload;t.contextValues[n]=o}).addCase(oi,(t,r)=>{delete t.contextValues[r.payload]}).addCase(St.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.dictionaryFieldContext.contextValues)})});function DA(e){if(!AN(e))throw Ht;let t=Jr(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return{values:n().dictionaryFieldContext.contextValues}},set(o){r(ri(o))},add(o,i){r(ni({field:o,key:i}))},remove(o){r(oi(o))}}}function AN(e){return e.addReducers({dictionaryFieldContext:gl}),!0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Ra={value:Y,numberOfResults:new oe({min:0}),state:Y};m();d();f();p();var Ne=Y;var EN=new oe({min:1,default:8,required:!1}),RN=new oe({min:1,max:20,default:5,required:!1}),IN={desiredCount:RN,numberOfValues:EN},ife=L("automaticFacet/setOptions",e=>B(e,IN)),afe=L("automaticFacet/deselectAll",e=>B(e,Ne)),TN=Y,MA=L("automaticFacet/toggleSelectValue",e=>B(e,{field:TN,selection:new ne({values:Ra})}));m();d();f();p();m();d();f();p();var _N={state:new qe({required:!0}),numberOfResults:new oe({required:!0,min:0}),value:new z({required:!0,emptyAllowed:!0}),path:new Ae({required:!0,each:Y}),moreValuesAvailable:new me({required:!1})};function Vf(e){e.children.forEach(t=>{Vf(t)}),kt({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},_N)}var ii={facetId:Ne,field:Y,tabs:new ne({options:{required:!1},values:{included:new Ae({each:new z}),excluded:new Ae({each:new z})}}),activeTab:new z({required:!1}),delimitingCharacter:new z({required:!1,emptyAllowed:!0}),filterFacetCount:new me({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new qe({required:!1}),basePath:new Ae({required:!1,each:Y}),filterByBasePath:new me({required:!1})};var Cfe=L("categoryFacet/register",e=>B(e,ii)),LA=L("categoryFacet/toggleSelectValue",e=>{try{return kt(e.facetId,Y),Vf(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),qA=L("categoryFacet/deselectAll",e=>B(e,ii.facetId)),Efe=L("categoryFacet/updateNumberOfValues",e=>B(e,{facetId:ii.facetId,numberOfValues:ii.numberOfValues})),Rfe=L("categoryFacet/updateSortCriterion",e=>B(e,{facetId:ii.facetId,criterion:new qe})),Ife=L("categoryFacet/updateBasePath",e=>B(e,{facetId:ii.facetId,basePath:new Ae({each:Y})}));m();d();f();p();m();d();f();p();var Ia={facetId:Ne,captions:new ne({options:{required:!1}}),numberOfValues:new oe({required:!1,min:1}),query:new z({required:!1,emptyAllowed:!0})};var kN={path:new Ae({required:!0,each:Y}),displayValue:nt,rawValue:nt,count:new oe({required:!0,min:0})},jA=L("categoryFacet/selectSearchResult",e=>B(e,{facetId:Ne,value:new ne({values:kN})})),Qfe=L("categoryFacetSearch/register",e=>B(e,Ia));m();d();f();p();var UA={facetId:Ne,value:new ne({values:{displayValue:nt,rawValue:nt,count:new oe({required:!0,min:0})}})},rme=L("facetSearch/register",e=>B(e,Ia)),nme=L("facetSearch/update",e=>B(e,Ia)),VA=L("facetSearch/toggleSelectValue",e=>B(e,UA)),GA=L("facetSearch/toggleExcludeValue",e=>B(e,UA));m();d();f();p();m();d();f();p();var lme=new z({regex:/^[a-zA-Z0-9-_]+$/}),dme=new z({required:!0}),pme=new Ae({each:new z}),fme=new z,mme=new me,gme=new me,hme=new oe({min:0}),ON=new oe({min:1}),yme=new me({required:!0}),PN=new ne,NN=new z,FN={captions:PN,numberOfValues:ON,query:NN},vme=new ne({values:FN}),BA=new ne({options:{required:!1},values:{type:new z({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new Ae({required:!0,max:25,each:new z({emptyAllowed:!1,required:!0})})}}),Sme=new me,$A=new Ae({min:1,max:25,required:!1,each:new z({emptyAllowed:!1,required:!0})});var DN={facetId:Ne,field:new z({required:!0,emptyAllowed:!0}),tabs:new ne({options:{required:!1},values:{included:new Ae({each:new z}),excluded:new Ae({each:new z})}}),activeTab:new z({required:!1}),filterFacetCount:new me({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new qe({required:!1}),resultsMustMatch:new qe({required:!1}),allowedValues:BA,customSort:$A},Ome=L("facet/register",e=>B(e,DN)),QA=L("facet/toggleSelectValue",e=>B(e,{facetId:Ne,selection:new ne({values:Ra})})),HA=L("facet/toggleExcludeValue",e=>B(e,{facetId:Ne,selection:new ne({values:Ra})})),hl=L("facet/deselectAll",e=>B(e,Ne)),Pme=L("facet/updateSortCriterion",e=>B(e,{facetId:Ne,criterion:new qe({required:!0})})),Nme=L("facet/updateNumberOfValues",e=>B(e,{facetId:Ne,numberOfValues:new oe({required:!0,min:1})})),Fme=L("facet/updateIsFieldExpanded",e=>B(e,{facetId:Ne,isFieldExpanded:new me({required:!0})})),Dme=L("facet/updateFreezeCurrentValues",e=>B(e,{facetId:Ne,freezeCurrentValues:new me({required:!0})}));m();d();f();p();m();d();f();p();function WA(e){let t=zA(e.start,e),r=zA(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function zA(e,t){let{dateFormat:r}=t;return Dy(e)?(bp(e),Py(e)):typeof e=="string"&&Fr(e)?(bp(e),e):(Ty(e,r),uc(_o(e,r)))}m();d();f();p();var KA=L("rangeFacet/updateSortCriterion",e=>B(e,{facetId:Ne,criterion:new qe({required:!0})}));m();d();f();p();var yl={state:Y,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new me({required:!0}),numberOfResults:new oe({required:!0,min:0})},vl={start:Y,end:Y,endInclusive:new me({required:!0}),state:Y,numberOfResults:new oe({required:!0,min:0})};var MN={start:Y,end:Y,endInclusive:new me({required:!0}),state:Y},LN={facetId:Ne,field:Y,tabs:new ne({options:{required:!1},values:{included:new Ae({each:new z}),excluded:new Ae({each:new z})}}),activeTab:new z({required:!1}),currentValues:new Ae({required:!1,each:new ne({values:MN})}),generateAutomaticRanges:new me({required:!0}),filterFacetCount:new me({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new qe({required:!1}),rangeAlgorithm:new qe({required:!1})};function YA(e){return Fr(e)?ea(e):e}function XA(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=WA(t);if(_o(YA(r)).isAfter(_o(YA(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var Age=L("dateFacet/register",e=>{try{return kt(e,LN),XA(e),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),ZA=L("dateFacet/toggleSelectValue",e=>B(e,{facetId:Ne,selection:new ne({values:vl})})),JA=L("dateFacet/toggleExcludeValue",e=>B(e,{facetId:Ne,selection:new ne({values:vl})})),ew=L("dateFacet/updateFacetValues",e=>{try{return kt(e,{facetId:Ne,values:new Ae({each:new ne({values:vl})})}),XA({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}});m();d();f();p();var qN={state:Y,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new me({required:!0})},jN={facetId:Ne,field:Y,tabs:new ne({options:{required:!1},values:{included:new Ae({each:new z}),excluded:new Ae({each:new z})}}),activeTab:new z({required:!1}),currentValues:new Ae({required:!1,each:new ne({values:qN})}),generateAutomaticRanges:new me({required:!0}),filterFacetCount:new me({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new qe({required:!1}),rangeAlgorithm:new qe({required:!1})};function tw(e){e.currentValues&&e.currentValues.forEach(({start:t,end:r})=>{if(t>r)throw new Error(`The start value is greater than the end value for the numeric range ${t} to ${r}`)})}var Fge=L("numericFacet/register",e=>{try{return B(e,jN),tw(e),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),rw=L("numericFacet/toggleSelectValue",e=>B(e,{facetId:Ne,selection:new ne({values:yl})})),nw=L("numericFacet/toggleExcludeValue",e=>B(e,{facetId:Ne,selection:new ne({values:yl})})),ow=L("numericFacet/updateFacetValues",e=>{try{return kt(e,{facetId:Ne,values:new Ae({each:new ne({values:yl})})}),tw({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}});var iw=Be(xa(),e=>{e.addCase(el,(t,r)=>{let n=Gf(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=Ta(n,o)}).addCase(tl,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(bc,t=>{t.firstResult=0}).addCase(rl,(t,r)=>{let n=r.payload;t.firstResult=Ta(n,t.numberOfResults)}).addCase(Jo,(t,r)=>{let n=r.payload;t.firstResult=Ta(n,t.numberOfResults)}).addCase(ol,t=>{let r=Gf(t),n=Math.max(r-1,1);t.firstResult=Ta(n,t.numberOfResults)}).addCase(nl,t=>{let r=Gf(t),n=VN(t),o=Math.min(r+1,n);t.firstResult=Ta(o,t.numberOfResults)}).addCase(St.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(Tr,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(dl.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(oA.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(hl,t=>{ft(t)}).addCase(JA,t=>{ft(t)}).addCase(HA,t=>{ft(t)}).addCase(nw,t=>{ft(t)}).addCase(GA,t=>{ft(t)}).addCase(QA,t=>{ft(t)}).addCase(qA,t=>{ft(t)}).addCase(LA,t=>{ft(t)}).addCase(jA,t=>{ft(t)}).addCase(ZA,t=>{ft(t)}).addCase(rw,t=>{ft(t)}).addCase(Yu,t=>{ft(t)}).addCase(ew,t=>{ft(t)}).addCase(ow,t=>{ft(t)}).addCase(VA,t=>{ft(t)}).addCase(MA,t=>{ft(t)})});function ft(e){e.firstResult=xa().firstResult}function Gf(e){let{firstResult:t,numberOfResults:r}=e;return GN(t,r)}function VN(e){let{totalCountFiltered:t,numberOfResults:r}=e;return BN(t,r)}function Ta(e,t){return(e-1)*t}function GN(e,t){return Math.round(e/t)+1}function BN(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function Bf(e){return e.addReducers({pagination:iw}),{nextPage:nl,previousPage:ol,registerNumberOfResults:el,registerPage:rl,updateNumberOfResults:tl,updatePage:Jo}}var $N=new yt({id:new z({emptyAllowed:!0,required:!1,default:""}),numberOfRecommendations:new oe({min:0})});function aw(e,t={}){if(!QN(e))throw Ht;let r=Jr(e),{dispatch:n}=e,o=()=>e.state,i=Ig(e,$N,t.options,"buildRecommendationList");return i.id!==""&&n(wo({id:i.id})),i.numberOfRecommendations&&n(Bf(e).updateNumberOfResults(i.numberOfRecommendations)),{...r,refresh(){n(Nr())},get state(){let a=o();return{recommendations:a.recommendation.recommendations,error:a.recommendation.error,isLoading:a.recommendation.isLoading,searchResponseId:a.recommendation.searchUid}}}}function QN(e){return e.addReducers({recommendation:xo,configuration:Vt}),!0}m();d();f();p();m();d();f();p();function sw(e,t,r){if(!HN(e))throw Ht;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:Ma(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function HN(e){return e.addReducers({configuration:Vt}),!0}function cw(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(Xs(t.options.result)))};return sw(e,t,()=>{n()})}m();d();f();p();m();d();f();p();m();d();f();p();var en=()=>new z({required:!1,emptyAllowed:!0}),Sl=L("advancedSearchQueries/update",e=>B(e,{aq:en(),cq:en(),lq:en(),dq:en()})),bl=L("advancedSearchQueries/register",e=>B(e,{aq:en(),cq:en(),lq:en(),dq:en()}));var uw=Be(zr(),e=>{e.addCase(Sl,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Je(n)||(t.aq=n,t.aqWasSet=!0),Je(o)||(t.cq=o,t.cqWasSet=!0),Je(i)||(t.lq=i,t.lqWasSet=!0),Je(a)||(t.dq=a,t.dqWasSet=!0)}).addCase(bl,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Je(n)||(t.defaultFilters.aq=n,t.aqWasSet||(t.aq=n)),Je(o)||(t.defaultFilters.cq=o,t.cqWasSet||(t.cq=o)),Je(i)||(t.defaultFilters.lq=i,t.lqWasSet||(t.lq=i)),Je(a)||(t.defaultFilters.dq=a,t.dqWasSet||(t.dq=a))}).addCase(St.fulfilled,(t,r)=>r.payload?.advancedSearchQueries??t).addCase(Tr,(t,r)=>{let{aq:n,cq:o}=r.payload;Je(n)||(t.aq=n,t.aqWasSet=!0),Je(o)||(t.cq=o,t.cqWasSet=!0)})});function zN(e){return e.addReducers({advancedSearchQueries:uw}),{updateAdvancedSearchQueries:Sl,registerAdvancedSearchQueries:bl}}m();d();f();p();function WN(e){return e.addReducers({configuration:Vt}),{disableAnalytics:co,enableAnalytics:uo,setOriginLevel2:hs,setOriginLevel3:ys,updateAnalyticsConfiguration:so,updateBasicConfiguration:Ir}}m();d();f();p();function KN(e){return e.addReducers({configuration:Vt,pipeline:po,searchHub:Eo}),{updateSearchConfiguration:Yt}}m();d();f();p();function YN(e){return e.addReducers({context:ml}),{addContext:$n,removeContext:Qn,setContext:Bn}}m();d();f();p();function XN(e){return e.addReducers({debug:As}),{disableDebug:Ss,enableDebug:vs}}m();d();f();p();function ZN(e){return e.addReducers({dictionaryFieldContext:gl}),{addContext:ni,removeContext:oi,setContext:ri}}m();d();f();p();m();d();f();p();m();d();f();p();var JN={collectionField:new z({emptyAllowed:!1,required:!1}),parentField:new z({emptyAllowed:!1,required:!1}),childField:new z({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new oe({min:0,required:!1})},lw=L("folding/register",e=>B(e,JN)),nve=ke("folding/loadCollection",/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),a=i.configuration.analytics.analyticsMode==="legacy"?yield Lr(i):ko(i,o),s=yield n.search({...a,q:eF(i),enableQuerySyntax:!0,cq:`@${i.folding.fields.collection}="${e}"`,filterField:i.folding.fields.collection,childField:i.folding.fields.parent,parentField:i.folding.fields.child,filterFieldRange:100},{origin:"foldingCollection"});return vt(s)?r(s.error):{collectionId:e,results:s.success.results,searchUid:s.success.searchUid,rootResult:i.folding.collections[e].result}});return function(_x161,_x162){return _ref73.apply(this,arguments)}}());function eF(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}m();d();f();p();var dw=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});m();d();f();p();var ai=L("fields/registerFieldsToInclude",e=>B(e,gs)),Al=L("fields/fetchall/enable"),wl=L("fields/fetchall/disable"),xl=ke("fields/fetchDescription",/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:i,environment:a,organizationId:s}=o.configuration,{apiBaseUrl:u}=o.configuration.search,c=yield t.apiClient.fieldDescriptions({accessToken:i,organizationId:s,url:u??xr(s,a)});return vt(c)?n(c.error):c.success.fields});return function(_x163,_x164){return _ref74.apply(this,arguments)}}());m();d();f();p();var Cl=["author","language","urihash","objecttype","collection","source","permanentid"],$f=[...Cl,"date","filetype","parents"],pw=[...$f,"ec_price","ec_name","ec_description","ec_brand","ec_category","ec_item_group_id","ec_shortdesc","ec_thumbnails","ec_images","ec_promo_price","ec_in_stock","ec_rating"],fw=()=>({fieldsToInclude:Cl,fetchAllFields:!1,fieldsDescription:[]});var El=Be(fw(),e=>e.addCase(ai,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(Al,t=>{t.fetchAllFields=!0}).addCase(wl,t=>{t.fetchAllFields=!1}).addCase(xl.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(lw,(t,{payload:r})=>{let n=dw().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));function tF(e){return e.addReducers({fields:El}),{registerFieldsToInclude:ai,enableFetchAllFields:Al,disableFetchAllFields:wl,fetchFieldsDescription:xl}}m();d();f();p();function rF(e){return e.addReducers({pipeline:po}),{setPipeline:lo}}m();d();f();p();function nF(e){return e.addReducers({recommendation:xo}),{getRecommendations:Nr,setRecommendationId:wo}}m();d();f();p();function oF(e){return e.addReducers({}),{logRecommendationOpen:Xs}}m();d();f();p();m();d();f();p();var iF=new yt({content:new qe({required:!0}),conditions:new qe({required:!0}),priority:new oe({required:!1,default:0,min:0}),fields:new Ae({required:!1,each:Y})});function mw(){let e=[],t=r=>{let n=iF.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new fi("Each template condition should be a function that takes a Result or Product as an argument and returns a boolean");return n};return{registerTemplates(...r){r.forEach(n=>{let o={...t(n),fields:n.fields||[]};e.push(o)}),e.sort((n,o)=>o.priority-n.priority)},selectTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.content:null},selectLinkTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.linkContent:null}}}function gw(e){if(!aF(e))throw Ht;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=mw();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(ai(i))},selectTemplate:r,selectLinkTemplate:n}}function aF(e){return e.addReducers({fields:El}),!0}m();d();f();p();function sF(e){return e.addReducers({searchHub:Eo}),{setSearchHub:Co}}/**
|
|
43
43
|
* @license
|
|
44
44
|
*
|
|
45
45
|
* Copyright 2026 Coveo Solutions Inc.
|
|
@@ -72,4 +72,4 @@ fast-json-patch/module/duplex.mjs:
|
|
|
72
72
|
*)
|
|
73
73
|
*/if(__exports!=exports)module.exports=exports;return module.exports});
|
|
74
74
|
|
|
75
|
-
window.coveoQuanticVersion = '3.
|
|
75
|
+
window.coveoQuanticVersion = '3.45.1';
|