@coveo/quantic 3.40.0 → 3.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/force-app/main/default/labels/CustomLabels.labels-meta.xml +77 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerBody/__tests__/quanticGeneratedAnswerBody.test.js +341 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerBody/quanticGeneratedAnswerBody.js +148 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerBody/quanticGeneratedAnswerBody.js-meta.xml +5 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerBody/templates/answer.css +3 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerBody/templates/answer.html +53 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerBody/templates/cannotAnswer.html +7 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerBody/templates/error.html +7 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/quanticGeneratedAnswerStreamOfThought.test.js +348 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/quanticGeneratedAnswerStreamOfThought.css +17 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/quanticGeneratedAnswerStreamOfThought.js +163 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/quanticGeneratedAnswerStreamOfThought.js-meta.xml +5 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/templates/collapsedSummary.css +1 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/templates/collapsedSummary.html +32 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/templates/streamOfThought.css +1 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/templates/streamOfThought.html +65 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerThread/__tests__/quanticGeneratedAnswerThread.test.js +285 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerThread/quanticGeneratedAnswerThread.css +47 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerThread/quanticGeneratedAnswerThread.html +67 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerThread/quanticGeneratedAnswerThread.js +93 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerThread/quanticGeneratedAnswerThread.js-meta.xml +5 -0
- package/force-app/main/default/lwc/quanticThreadItem/quanticThreadItem.css +0 -4
- package/force-app/main/default/lwc/quanticThreadItem/quanticThreadItem.html +1 -1
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +6 -6
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/common/pagination.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/generated-answer/headless-core-generated-answer.d.ts +1 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/generated-answer/headless-core-interactive-citation.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/generated-answer/interactive-citation-analytics-client.d.ts +3 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/analytics/analytics-utils.d.ts +3 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-analytics-actions.d.ts +2 -0
- package/force-app/main/default/staticresources/coveoheadless/headless.js +17 -17
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +7 -7
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +14 -14
- package/package.json +2 -2
|
@@ -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 Dw=Object.create;var Jo=Object.defineProperty;var Mw=Object.getOwnPropertyDescriptor;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 l=r.next();return a=l.done,l},e:function(l){s=!0,i=l},f:function(){try{a||r.return==null||r.return()}finally{if(s)throw i}}}}function sl(){return sl=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=Yw(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},sl.apply(null,arguments)}function Vn(e){return Vn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vn(e)}function Ww(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&&cl(e,t)}function Pf(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Pf=function(){return!!e})()}function Kw(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 Hw(e)}function cl(e,t){return cl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},cl(e,t)}function Yw(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Vn(e))!==null;);return e}function Xw(e,t,r,n){var o=sl(Vn(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function Zw(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 Jw(e){var t=Zw(e,"string");return typeof t=="symbol"?t:t+""}function eA(e,t){if(e){if(typeof e=="string")return Tf(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)?Tf(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function tA(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 rA(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 Of=function(){function e(){ul(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return ll(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,l=i.length;s<l;s++)a();return!r.defaultPrevented}}}])}(),dl=function(e){function t(){var r;return ul(this,t),r=zw(this,t),r.listeners||Of.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 Ww(t,e),ll(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)),Xw(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 xa;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 xa;function i(){o.abort(this.reason),a()}function a(){var g=kf(n),v;try{for(g.s();!(v=g.n()).done;){var E=v.value;E.removeEventListener("abort",i)}}catch(h){g.e(h)}finally{g.f()}}var s=kf(n),l;try{for(s.s();!(l=s.n()).done;){var c=l.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}}])}(Of),xa=function(){function e(){ul(this,e),Object.defineProperty(this,"signal",{value:new dl,writable:!0,configurable:!0})}return ll(e,[{key:"abort",value:function(r){var n=rA(r),o=tA(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(xa.prototype[Symbol.toStringTag]="AbortController",dl.prototype[Symbol.toStringTag]="AbortSignal");function nA(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 oA(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(!nA({fetch:r,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s}))return{fetch:r,Request:l};var l=o;(l&&!l.prototype.hasOwnProperty("signal")||s)&&(l=function(E,h){var y;h&&h.signal&&(y=h.signal,delete h.signal);var S=new o(E,h);return y&&Object.defineProperty(S,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),S},l.prototype=o.prototype);var c=r,g=function(E,h){var y=l&&l.prototype.isPrototypeOf(E)?E.signal:h?h.signal:void 0;if(y){var S;try{S=new DOMException("Aborted","AbortError")}catch{S=new Error("Aborted"),S.name="AbortError"}if(y.aborted)return Promise.reject(S);var C=new Promise(function(R,T){y.addEventListener("abort",function(){return T(S)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([C,c(E,h)])}return c(E,h)};return{fetch:g,Request:l}}ti.AbortController=xa;ti.AbortSignal=dl;ti.abortableFetch=oA});var Nf,u,w,f=Un(()=>{"use strict";Nf=Mt(pl(),1),u=Mt(pl(),1),{fetch:w}=(0,Nf.abortableFetch)({fetch})});function fl(e){return typeof e!="string"||e in{}}function ml(){return Object.create(null)}function Ff(e){return typeof e=="string"&&!!e.trim()}function gl(e,t){var r=e.split(";").filter(Ff),n=r.shift(),o=iA(n),i=o.name,a=o.value;if(t=t?Object.assign({},Ca,t):Ca,fl(i))return null;try{a=t.decodeValues?decodeURIComponent(a):a}catch(l){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",l)}var s=ml();return s.name=i,s.value=a,r.forEach(function(l){var c=l.split("="),g=c.shift().trimLeft().toLowerCase();if(!fl(g)){var v=c.join("=");if(g==="expires")s.expires=new Date(v);else if(g==="max-age"){var E=parseInt(v,10);Number.isNaN(E)||(s.maxAge=E)}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 iA(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function Bn(e,t){if(t=t?Object.assign({},Ca,t):Ca,!e)return t.map?ml():[];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(Ff),n&&(e=e.map(Ea).flat()),t.map){var i=ml();return e.reduce(function(a,s){var l=gl(s,t);return l&&!fl(l.name)&&(a[l.name]=l),a},i)}else return e.map(function(a){return gl(a,t)}).filter(Boolean)}function Ea(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,i,a,s;function l(){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;l();)if(o=e.charAt(r),o===","){for(i=r,r+=1,l(),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 Ca,Df=Un(()=>{"use strict";m();d();f();p();Ca={decodeValues:!0,map:!1,silent:!1,split:"auto"};Bn.parseSetCookie=Bn;Bn.parse=Bn;Bn.parseString=gl;Bn.splitCookiesString=Ea});function ri(e){if(aA.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function hl(e){return e.replace(sA,"")}function ni(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||!cA(r))return!1}return!0}function cA(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function jf(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 aA,Mf,sA,qf,Gn,yl,Lf,x,Vf=Un(()=>{"use strict";m();d();f();p();Df();aA=/[^a-z0-9\-#$%&'*+.^_`|~]/i;Mf=[`
|
|
19
|
-
`,"\r","\t"," "],sA=new RegExp(`(^[${Mf.join("")}]|$[${Mf.join("")}])`,"g");Gn=Symbol("normalizedHeaders"),yl=Symbol("rawHeaderNames"),Lf=", ",x=class Uf{constructor(t){this[Gn]={},this[yl]=new Map,this[qf]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof Uf||typeof b.Headers<"u"&&t instanceof b.Headers?t.forEach((r,n)=>{this.append(n,r)},this):Array.isArray(t)?t.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(Lf):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(Lf):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[Gn]).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(!ni(t))throw new TypeError(`Invalid header name "${t}"`);return this[Gn].hasOwnProperty(ri(t))}get(t){if(!ni(t))throw TypeError(`Invalid header name "${t}"`);return this[Gn][ri(t)]??null}set(t,r){if(!ni(t)||!jf(r))return;let n=ri(t),o=hl(r);this[Gn][n]=hl(o),this[yl].set(n,t)}append(t,r){if(!ni(t)||!jf(r))return;let n=ri(t),o=hl(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!ni(t)||!this.has(t))return;let r=ri(t);delete this[Gn][r],this[yl].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===""?[""]:Ea(t)}}});var m=Un(()=>{"use strict";Vf()});var Kf=Ye(ai=>{"use strict";m();d();f();p();var _a=ai&&ai.__assign||function(){return _a=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},_a.apply(this,arguments)};Object.defineProperty(ai,"__esModule",{value:!0});var yA={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function vA(e){var t=_a(_a({},yA),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}ai.getSanitizedOptions=vA});var Yf=Ye(wl=>{"use strict";m();d();f();p();Object.defineProperty(wl,"__esModule",{value:!0});function SA(e){var t=Math.random()*e;return Math.round(t)}wl.fullJitter=SA});var Xf=Ye(Al=>{"use strict";m();d();f();p();Object.defineProperty(Al,"__esModule",{value:!0});function bA(e){return e}Al.noJitter=bA});var Zf=Ye(xl=>{"use strict";m();d();f();p();Object.defineProperty(xl,"__esModule",{value:!0});var wA=Yf(),AA=Xf();function xA(e){return e.jitter==="full"?wA.fullJitter:AA.noJitter}xl.JitterFactory=xA});var El=Ye(Cl=>{"use strict";m();d();f();p();Object.defineProperty(Cl,"__esModule",{value:!0});var CA=Zf(),EA=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=CA.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}();Cl.Delay=EA});var Jf=Ye(nr=>{"use strict";m();d();f();p();var RA=nr&&nr.__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)}}(),IA=nr&&nr.__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 l(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,l)}c((n=n.apply(e,t||[])).next())})},TA=nr&&nr.__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 l([c,g])}}function l(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(nr,"__esModule",{value:!0});var _A=El(),kA=function(e){RA(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return IA(this,void 0,void 0,function(){return TA(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}(_A.Delay);nr.SkipFirstDelay=kA});var em=Ye(si=>{"use strict";m();d();f();p();var OA=si&&si.__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(si,"__esModule",{value:!0});var PA=El(),NA=function(e){OA(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(PA.Delay);si.AlwaysDelay=NA});var tm=Ye(Rl=>{"use strict";m();d();f();p();Object.defineProperty(Rl,"__esModule",{value:!0});var FA=Jf(),DA=em();function MA(e,t){var r=jA(e);return r.setAttemptNumber(t),r}Rl.DelayFactory=MA;function jA(e){return e.delayFirstAttempt?new DA.AlwaysDelay(e):new FA.SkipFirstDelay(e)}});var rm=Ye(Kr=>{"use strict";m();d();f();p();var Il=Kr&&Kr.__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 l(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,l)}c((n=n.apply(e,t||[])).next())})},Tl=Kr&&Kr.__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 l([c,g])}}function l(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(Kr,"__esModule",{value:!0});var qA=Kf(),LA=tm();function UA(e,t){return t===void 0&&(t={}),Il(this,void 0,void 0,function(){var r,n;return Tl(this,function(o){switch(o.label){case 0:return r=qA.getSanitizedOptions(t),n=new VA(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}Kr.backOff=UA;var VA=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return Il(this,void 0,void 0,function(){var t,r;return Tl(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 Il(this,void 0,void 0,function(){var t;return Tl(this,function(r){switch(r.label){case 0:return t=LA.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var Ws=Ye((Kd,Yd)=>{"use strict";m();d();f();p();(function(e,t){typeof Kd=="object"&&typeof Yd<"u"?Yd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs=t()})(Kd,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",l="week",c="month",g="quarter",v="year",E="date",h="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,S=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(O){var P=["th","st","nd","rd"],F=O%100;return"["+O+(P[(F-20)%10]||P[F]||P[0])+"]"}},R=function(O,P,F){var H=String(O);return!H||H.length>=P?O:""+Array(P+1-H.length).join(F)+O},T={s:R,z:function(O){var P=-O.utcOffset(),F=Math.abs(P),H=Math.floor(F/60),Q=F%60;return(P<=0?"+":"-")+R(H,2,"0")+":"+R(Q,2,"0")},m:function O(P,F){if(P.date()<F.date())return-O(F,P);var H=12*(F.year()-P.year())+(F.month()-P.month()),Q=P.clone().add(H,c),X=F-Q<0,Y=P.clone().add(H+(X?-1:1),c);return+(-(H+(F-Q)/(X?Q-Y:Y-Q))||0)},a:function(O){return O<0?Math.ceil(O)||0:Math.floor(O)},p:function(O){return{M:c,y:v,w:l,d:s,D:E,h:a,m:i,s:o,ms:n,Q:g}[O]||String(O||"").toLowerCase().replace(/s$/,"")},u:function(O){return O===void 0}},I="en",k={};k[I]=C;var _="$isDayjsObject",D=function(O){return O instanceof V||!(!O||!O[_])},B=function O(P,F,H){var Q;if(!P)return I;if(typeof P=="string"){var X=P.toLowerCase();k[X]&&(Q=X),F&&(k[X]=F,Q=X);var Y=P.split("-");if(!Q&&Y.length>1)return O(Y[0])}else{var W=P.name;k[W]=P,Q=W}return!H&&Q&&(I=Q),Q||!H&&I},L=function(O,P){if(D(O))return O.clone();var F=typeof P=="object"?P:{};return F.date=O,F.args=arguments,new V(F)},q=T;q.l=B,q.i=D,q.w=function(O,P){return L(O,{locale:P.$L,utc:P.$u,x:P.$x,$offset:P.$offset})};var V=function(){function O(F){this.$L=B(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[_]=!0}var P=O.prototype;return P.parse=function(F){this.$d=function(H){var Q=H.date,X=H.utc;if(Q===null)return new Date(NaN);if(q.u(Q))return new Date;if(Q instanceof Date)return new Date(Q);if(typeof Q=="string"&&!/Z$/i.test(Q)){var Y=Q.match(y);if(Y){var W=Y[2]-1||0,te=(Y[7]||"0").substring(0,3);return X?new Date(Date.UTC(Y[1],W,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,te)):new Date(Y[1],W,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,te)}}return new Date(Q)}(F),this.init()},P.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()},P.$utils=function(){return q},P.isValid=function(){return this.$d.toString()!==h},P.isSame=function(F,H){var Q=L(F);return this.startOf(H)<=Q&&Q<=this.endOf(H)},P.isAfter=function(F,H){return L(F)<this.startOf(H)},P.isBefore=function(F,H){return this.endOf(H)<L(F)},P.$g=function(F,H,Q){return q.u(F)?this[H]:this.set(Q,F)},P.unix=function(){return Math.floor(this.valueOf()/1e3)},P.valueOf=function(){return this.$d.getTime()},P.startOf=function(F,H){var Q=this,X=!!q.u(H)||H,Y=q.p(F),W=function(ge,fe){var Se=q.w(Q.$u?Date.UTC(Q.$y,fe,ge):new Date(Q.$y,fe,ge),Q);return X?Se:Se.endOf(s)},te=function(ge,fe){return q.w(Q.toDate()[ge].apply(Q.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(fe)),Q)},se=this.$W,Ee=this.$M,Me=this.$D,ke="set"+(this.$u?"UTC":"");switch(Y){case v:return X?W(1,0):W(31,11);case c:return X?W(1,Ee):W(0,Ee+1);case l:var Pe=this.$locale().weekStart||0,Ne=(se<Pe?se+7:se)-Pe;return W(X?Me-Ne:Me+(6-Ne),Ee);case s:case E: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()}},P.endOf=function(F){return this.startOf(F,!1)},P.$set=function(F,H){var Q,X=q.p(F),Y="set"+(this.$u?"UTC":""),W=(Q={},Q[s]=Y+"Date",Q[E]=Y+"Date",Q[c]=Y+"Month",Q[v]=Y+"FullYear",Q[a]=Y+"Hours",Q[i]=Y+"Minutes",Q[o]=Y+"Seconds",Q[n]=Y+"Milliseconds",Q)[X],te=X===s?this.$D+(H-this.$W):H;if(X===c||X===v){var se=this.clone().set(E,1);se.$d[W](te),se.init(),this.$d=se.set(E,Math.min(this.$D,se.daysInMonth())).$d}else W&&this.$d[W](te);return this.init(),this},P.set=function(F,H){return this.clone().$set(F,H)},P.get=function(F){return this[q.p(F)]()},P.add=function(F,H){var Q,X=this;F=Number(F);var Y=q.p(H),W=function(Ee){var Me=L(X);return q.w(Me.date(Me.date()+Math.round(Ee*F)),X)};if(Y===c)return this.set(c,this.$M+F);if(Y===v)return this.set(v,this.$y+F);if(Y===s)return W(1);if(Y===l)return W(7);var te=(Q={},Q[i]=t,Q[a]=r,Q[o]=e,Q)[Y]||1,se=this.$d.getTime()+F*te;return q.w(se,this)},P.subtract=function(F,H){return this.add(-1*F,H)},P.format=function(F){var H=this,Q=this.$locale();if(!this.isValid())return Q.invalidDate||h;var X=F||"YYYY-MM-DDTHH:mm:ssZ",Y=q.z(this),W=this.$H,te=this.$m,se=this.$M,Ee=Q.weekdays,Me=Q.months,ke=Q.meridiem,Pe=function(fe,Se,he,$e){return fe&&(fe[Se]||fe(H,X))||he[Se].slice(0,$e)},Ne=function(fe){return q.s(W%12||12,fe,"0")},ge=ke||function(fe,Se,he){var $e=fe<12?"AM":"PM";return he?$e.toLowerCase():$e};return X.replace(S,function(fe,Se){return Se||function(he){switch(he){case"YY":return String(H.$y).slice(-2);case"YYYY":return q.s(H.$y,4,"0");case"M":return se+1;case"MM":return q.s(se+1,2,"0");case"MMM":return Pe(Q.monthsShort,se,Me,3);case"MMMM":return Pe(Me,se);case"D":return H.$D;case"DD":return q.s(H.$D,2,"0");case"d":return String(H.$W);case"dd":return Pe(Q.weekdaysMin,H.$W,Ee,2);case"ddd":return Pe(Q.weekdaysShort,H.$W,Ee,3);case"dddd":return Ee[H.$W];case"H":return String(W);case"HH":return q.s(W,2,"0");case"h":return Ne(1);case"hh":return Ne(2);case"a":return ge(W,te,!0);case"A":return ge(W,te,!1);case"m":return String(te);case"mm":return q.s(te,2,"0");case"s":return String(H.$s);case"ss":return q.s(H.$s,2,"0");case"SSS":return q.s(H.$ms,3,"0");case"Z":return Y}return null}(fe)||Y.replace(":","")})},P.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},P.diff=function(F,H,Q){var X,Y=this,W=q.p(H),te=L(F),se=(te.utcOffset()-this.utcOffset())*t,Ee=this-te,Me=function(){return q.m(Y,te)};switch(W){case v:X=Me()/12;break;case c:X=Me();break;case g:X=Me()/3;break;case l:X=(Ee-se)/6048e5;break;case s:X=(Ee-se)/864e5;break;case a:X=Ee/r;break;case i:X=Ee/t;break;case o:X=Ee/e;break;default:X=Ee}return Q?X:q.a(X)},P.daysInMonth=function(){return this.endOf(c).$D},P.$locale=function(){return k[this.$L]},P.locale=function(F,H){if(!F)return this.$L;var Q=this.clone(),X=B(F,H,!0);return X&&(Q.$L=X),Q},P.clone=function(){return q.w(this.$d,this)},P.toDate=function(){return new Date(this.valueOf())},P.toJSON=function(){return this.isValid()?this.toISOString():null},P.toISOString=function(){return this.$d.toISOString()},P.toString=function(){return this.$d.toUTCString()},O}(),j=V.prototype;return L.prototype=j,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",c],["$y",v],["$D",E]].forEach(function(O){j[O[1]]=function(P){return this.$g(P,O[0],O[1])}}),L.extend=function(O,P){return O.$i||(O(P,V,L),O.$i=!0),L},L.locale=B,L.isDayjs=D,L.unix=function(O){return L(1e3*O)},L.en=k[I],L.Ls=k,L.p={},L})});var iy=Ye((Xd,Zd)=>{"use strict";m();d();f();p();(function(e,t){typeof Xd=="object"&&typeof Zd<"u"?Zd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_quarterOfYear=t()})(Xd,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,l){return s=Number(s),this.$utils().p(l)===t?this.add(3*s,e):i.bind(this)(s,l)};var a=o.startOf;o.startOf=function(s,l){var c=this.$utils(),g=!!c.u(l)||l;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,l)}}})});var ay=Ye((Jd,ep)=>{"use strict";m();d();f();p();(function(e,t){typeof Jd=="object"&&typeof ep<"u"?ep.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_customParseFormat=t()})(Jd,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)},l=function(y){return function(S){this[y]=+S}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(S){if(!S||S==="Z")return 0;var C=S.match(/([+-]|\d\d)/g),R=60*C[1]+(+C[2]||0);return R===0?0:C[0]==="+"?-R:R}(y)}],g=function(y){var S=a[y];return S&&(S.indexOf?S:S.s.concat(S.f))},v=function(y,S){var C,R=a.meridiem;if(R){for(var T=1;T<=24;T+=1)if(y.indexOf(R(T,0,S))>-1){C=T>12;break}}else C=y===(S?"pm":"PM");return C},E={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,l("seconds")],ss:[o,l("seconds")],m:[o,l("minutes")],mm:[o,l("minutes")],H:[o,l("hours")],h:[o,l("hours")],HH:[o,l("hours")],hh:[o,l("hours")],D:[o,l("day")],DD:[n,l("day")],Do:[i,function(y){var S=a.ordinal,C=y.match(/\d+/);if(this.day=C[0],S)for(var R=1;R<=31;R+=1)S(R).replace(/\[|\]/g,"")===y&&(this.day=R)}],w:[o,l("week")],ww:[n,l("week")],M:[o,l("month")],MM:[n,l("month")],MMM:[i,function(y){var S=g("months"),C=(g("monthsShort")||S.map(function(R){return R.slice(0,3)})).indexOf(y)+1;if(C<1)throw new Error;this.month=C%12||C}],MMMM:[i,function(y){var S=g("months").indexOf(y)+1;if(S<1)throw new Error;this.month=S%12||S}],Y:[/[+-]?\d+/,l("year")],YY:[n,function(y){this.year=s(y)}],YYYY:[/\d{4}/,l("year")],Z:c,ZZ:c};function h(y){var S,C;S=y,C=a&&a.formats;for(var R=(y=S.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(L,q,V){var j=V&&V.toUpperCase();return q||C[V]||e[V]||C[j].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(O,P,F){return P||F.slice(1)})})).match(t),T=R.length,I=0;I<T;I+=1){var k=R[I],_=E[k],D=_&&_[0],B=_&&_[1];R[I]=B?{regex:D,parser:B}:k.replace(/^\[|\]$/g,"")}return function(L){for(var q={},V=0,j=0;V<T;V+=1){var O=R[V];if(typeof O=="string")j+=O.length;else{var P=O.regex,F=O.parser,H=L.slice(j),Q=P.exec(H)[0];F.call(q,Q),L=L.replace(Q,"")}}return function(X){var Y=X.afternoon;if(Y!==void 0){var W=X.hours;Y?W<12&&(X.hours+=12):W===12&&(X.hours=0),delete X.afternoon}}(q),q}}return function(y,S,C){C.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(s=y.parseTwoDigitYear);var R=S.prototype,T=R.parse;R.parse=function(I){var k=I.date,_=I.utc,D=I.args;this.$u=_;var B=D[1];if(typeof B=="string"){var L=D[2]===!0,q=D[3]===!0,V=L||q,j=D[2];q&&(j=D[2]),a=this.$locale(),!L&&j&&(a=C.Ls[j]),this.$d=function(H,Q,X,Y){try{if(["x","X"].indexOf(Q)>-1)return new Date((Q==="X"?1e3:1)*H);var W=h(Q)(H),te=W.year,se=W.month,Ee=W.day,Me=W.hours,ke=W.minutes,Pe=W.seconds,Ne=W.milliseconds,ge=W.zone,fe=W.week,Se=new Date,he=Ee||(te||se?1:Se.getDate()),$e=te||Se.getFullYear(),He=0;te&&!se||(He=se>0?se-1:Se.getMonth());var Ft,bt=Me||0,Bt=ke||0,Ct=Pe||0,Dt=Ne||0;return ge?new Date(Date.UTC($e,He,he,bt,Bt,Ct,Dt+60*ge.offset*1e3)):X?new Date(Date.UTC($e,He,he,bt,Bt,Ct,Dt)):(Ft=new Date($e,He,he,bt,Bt,Ct,Dt),fe&&(Ft=Y(Ft).week(fe).toDate()),Ft)}catch{return new Date("")}}(k,B,_,C),this.init(),j&&j!==!0&&(this.$L=this.locale(j).$L),V&&k!=this.format(B)&&(this.$d=new Date("")),a={}}else if(B instanceof Array)for(var O=B.length,P=1;P<=O;P+=1){D[1]=B[P-1];var F=C.apply(this,D);if(F.isValid()){this.$d=F.$d,this.$L=F.$L,this.init();break}P===O&&(this.$d=new Date(""))}else T.call(this,I)}}})});var ev=Ye((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 b<"u"?b:e||self).dayjs_plugin_timezone=t()})(gp,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,E){E===void 0&&(E={});var h=new Date(g),y=function(S,C){C===void 0&&(C={});var R=C.timeZoneName||"short",T=S+"|"+R,I=t[T];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[T]=I),I}(v,E);return y.formatToParts(h)},s=function(g,v){for(var E=a(g,v),h=[],y=0;y<E.length;y+=1){var S=E[y],C=S.type,R=S.value,T=e[C];T>=0&&(h[T]=parseInt(R,10))}var I=h[3],k=I===24?0:I,_=h[0]+"-"+h[1]+"-"+h[2]+" "+k+":"+h[4]+":"+h[5]+":000",D=+g;return(o.utc(_).valueOf()-(D-=D%1e3))/6e4},l=n.prototype;l.tz=function(g,v){g===void 0&&(g=i);var E,h=this.utcOffset(),y=this.toDate(),S=y.toLocaleString("en-US",{timeZone:g}),C=Math.round((y-new Date(S))/1e3/60),R=15*-Math.round(y.getTimezoneOffset()/15)-C;if(!Number(R))E=this.utcOffset(0,v);else if(E=o(S,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(R,!0),v){var T=E.utcOffset();E=E.add(h-T,"minute")}return E.$x.$timezone=g,E},l.offsetName=function(g){var v=this.$x.$timezone||o.tz.guess(),E=a(this.valueOf(),v,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return E&&E.value};var c=l.startOf;l.startOf=function(g,v){if(!this.$x||!this.$x.$timezone)return c.call(this,g,v);var E=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return c.call(E,g,v).tz(this.$x.$timezone,!0)},o.tz=function(g,v,E){var h=E&&v,y=E||v||i,S=s(+o(),y);if(typeof g!="string")return o(g).tz(y);var C=function(k,_,D){var B=k-60*_*1e3,L=s(B,D);if(_===L)return[B,_];var q=s(B-=60*(L-_)*1e3,D);return L===q?[B,L]:[k-60*Math.min(L,q)*1e3,Math.max(L,q)]}(o.utc(g,h).valueOf(),S,y),R=C[0],T=C[1],I=o(R).utcOffset(T);return I.$x.$timezone=y,I},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var tv=Ye((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 b<"u"?b:e||self).dayjs_plugin_utc=t()})(yp,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 l=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 l.call(this)};var c=a.utcOffset;a.utcOffset=function(h,y){var S=this.$utils().u;if(S(h))return this.$u?0:S(this.$offset)?c.call(this):this.$offset;if(typeof h=="string"&&(h=function(I){I===void 0&&(I="");var k=I.match(t);if(!k)return null;var _=(""+k[0]).match(r)||["-",0,0],D=_[0],B=60*+_[1]+ +_[2];return B===0?0:D==="+"?B:-B}(h),h===null))return this;var C=Math.abs(h)<=16?60*h:h;if(C===0)return this.utc(y);var R=this.clone();if(y)return R.$offset=C,R.$u=!1,R;var T=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(R=this.local().add(C+T,e)).$offset=C,R.$x.$localOffset=T,R};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 E=a.diff;a.diff=function(h,y,S){if(h&&this.$u===h.$u)return E.call(this,h,y,S);var C=this.local(),R=i(h).local();return E.call(C,R,y,S)}}})});var Fb=Ye((zce,Nb)=>{"use strict";m();d();f();p();function IO(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}Nb.exports=TO;function TO(e,t,r){var n=r&&r.stringify||IO,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 l=t.length;if(l===0)return e;for(var c="",g=1-o,v=-1,E=e&&e.length||0,h=0;h<E;){if(e.charCodeAt(h)===37&&h+1<E){switch(v=v>-1?v:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=l||t[g]==null)break;v<h&&(c+=e.slice(v,h)),c+=Number(t[g]),v=h+2,h++;break;case 105:if(g>=l||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>=l||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>=l)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<E&&(c+=e.slice(v)),c)}});var Vb=Ye((Zce,Wu)=>{"use strict";m();d();f();p();var Db=Fb();Wu.exports=Sr;var ha=GO().console||{},_O={mapHttpRequest:zu,mapHttpResponse:zu,wrapRequestSerializer:gf,wrapResponseSerializer:gf,wrapErrorSerializer:gf,req:zu,res:zu,err:jb,errWithCause:jb};function Hr(e,t){return e==="silent"?1/0:t.levels.values[e]}var vf=Symbol("pino.logFuncs"),hf=Symbol("pino.hierarchy"),kO={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function Mb(e,t){let r={logger:t,parent:e[hf]};t[hf]=r}function OO(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:ha[o]||ha[kO[o]||"log"]||Ho}),e[vf]=n}function PO(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function Sr(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||ha;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=PO(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 l=e.level||"info",c=Object.create(r);c.log||(c.log=Ho),OO(c,s,r),Mb({},c),Object.defineProperty(c,"levelVal",{get:v}),Object.defineProperty(c,"level",{get:E,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:UO(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Ho};c.levels=NO(e),c.level=l,c.isLevelEnabled=function(S){return this.levels.values[S]?this.levels.values[S]>=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=Ho,c.serializers=n,c._serialize=o,c._stdErrSerialize=i,c.child=function(...S){return y.call(this,g,...S)},t&&(c._logEvent=yf());function v(){return Hr(this.level,this)}function E(){return this._level}function h(S){if(S!=="silent"&&!this.levels.values[S])throw Error("unknown level "+S);this._level=S,Mn(this,g,c,"error"),Mn(this,g,c,"fatal"),Mn(this,g,c,"warn"),Mn(this,g,c,"info"),Mn(this,g,c,"debug"),Mn(this,g,c,"trace"),a.forEach(C=>{Mn(this,g,c,C)})}function y(S,C,R){if(!C)throw new Error("missing bindings for child Pino");R=R||{},o&&C.serializers&&(R.serializers=C.serializers);let T=R.serializers;if(o&&T){var I=Object.assign({},n,T),k=e.browser.serialize===!0?Object.keys(I):o;delete C.serializers,Sf([C],k,I,this._stdErrSerialize)}function _(B){this._childLevel=(B._childLevel|0)+1,this.bindings=C,I&&(this.serializers=I,this._serialize=k),t&&(this._logEvent=yf([].concat(B._logEvent.bindings,C)))}_.prototype=this;let D=new _(this);return Mb(this,D),D.child=function(...B){return y.call(this,S,...B)},D.level=R.level||this.level,S.onChild(D),D}return c}function NO(e){let t=e.customLevels||{},r=Object.assign({},Sr.levels.values,t),n=Object.assign({},Sr.levels.labels,FO(t));return{values:r,labels:n}}function FO(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}Sr.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"}};Sr.stdSerializers=_O;Sr.stdTimeFunctions=Object.assign({},{nullTime:Lb,epochTime:Ub,unixTime:VO,isoTime:BO});function DO(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[hf];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Mn(e,t,r,n){if(Object.defineProperty(e,n,{value:Hr(e.level,r)>Hr(n,r)?Ho:r[vf][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===Ho){if(!t.transmit)return;let i=t.transmit.level||e.level,a=Hr(i,r);if(Hr(n,r)<a)return}e[n]=jO(e,t,r,n);let o=DO(e);o.length!==0&&(e[n]=MO(o,e[n]))}function MO(e,t){return function(){return t.apply(this,[...e,...arguments])}}function jO(e,t,r,n){return function(o){return function(){let a=t.timestamp(),s=new Array(arguments.length),l=Object.getPrototypeOf&&Object.getPrototypeOf(this)===ha?ha:this;for(var c=0;c<s.length;c++)s[c]=arguments[c];var g=!1;if(t.serialize&&(Sf(s,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let v=qO(this,n,s,a,t);if(t.reportCaller&&v&&v.length>0&&v[0]&&typeof v[0]=="object")try{let E=qb();E&&(v[0].caller=E)}catch{}o.call(l,...v)}else{if(t.reportCaller)try{let v=qb();v&&s.push(v)}catch{}o.apply(l,s)}if(t.transmit){let v=t.transmit.level||e._level,E=Hr(v,r),h=Hr(n,r);if(h<E)return;LO(this,{ts:a,methodLevel:n,methodValue:h,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Hr(e._level,r)},s,g)}}}(e[vf][n])}function qO(e,t,r,n,o){let{level:i,log:a=v=>v}=o.formatters||{},s=r.slice(),l=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(l!==null&&typeof l=="object")for(;g--&&typeof s[0]=="object";)Object.assign(c,s.shift());return[a(c),...s]}else{if(l!==null&&typeof l=="object"){for(;g--&&typeof s[0]=="object";)Object.assign(c,s.shift());l=s.length?Db(s.shift(),s):void 0}else typeof l=="string"&&(l=Db(s.shift(),s));return l!==void 0&&(c[o.messageKey]=l),[a(c)]}}function Sf(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=Sr.stdSerializers.err(e[o]);else if(typeof e[o]=="object"&&!Array.isArray(e[o])&&t)for(let i in e[o])t.indexOf(i)>-1&&i in r&&(e[o][i]=r[i](e[o][i]))}function LO(e,t,r,n=!1){let o=t.send,i=t.ts,a=t.methodLevel,s=t.methodValue,l=t.val,c=e._logEvent.bindings;n||Sf(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,l),e._logEvent=yf(c)}function yf(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function jb(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 UO(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?Lb:Ub}function zu(){return{}}function gf(e){return e}function Ho(){}function Lb(){return!1}function Ub(){return Date.now()}function VO(){return Math.round(Date.now()/1e3)}function BO(){return new Date(Date.now()).toISOString()}function GO(){function e(t){return typeof t<"u"&&t}try{return typeof b<"u"?b:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),b)}catch{return e(self)||e(window)||e(this)||{}}}Wu.exports.default=Sr;Wu.exports.pino=Sr;function qb(){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 GP={};ei(GP,{DefaultFieldsToInclude:()=>Ef,EcommerceDefaultFieldsToInclude:()=>_w,HighlightUtils:()=>bl,MinimumFieldsToInclude:()=>il,ResultTemplatesHelpers:()=>Ey,buildContext:()=>Xb,buildController:()=>zr,buildDictionaryFieldContext:()=>Zb,buildInteractiveResult:()=>Ew,buildRecommendationEngine:()=>Wb,buildRecommendationList:()=>xw,buildResultTemplatesManager:()=>Pw,getAnalyticsNextApiBaseUrl:()=>ka,getOrganizationEndpoint:()=>Et,getSampleRecommendationEngineConfiguration:()=>bf,loadAdvancedSearchQueryActions:()=>TP,loadClickAnalyticsActions:()=>LP,loadConfigurationActions:()=>_P,loadContextActions:()=>OP,loadDebugActions:()=>PP,loadDictionaryFieldContextActions:()=>NP,loadFieldActions:()=>MP,loadPaginationActions:()=>Cf,loadPipelineActions:()=>
|
|
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 Dw=Object.create;var Jo=Object.defineProperty;var Mw=Object.getOwnPropertyDescriptor;var qw=Object.getOwnPropertyNames;var jw=Object.getPrototypeOf,Lw=Object.prototype.hasOwnProperty;var Uw=(e,t,r)=>t in e?Jo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Un=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ye=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ei=(e,t)=>{for(var r in t)Jo(e,r,{get:t[r],enumerable:!0})},If=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of qw(t))!Lw.call(e,o)&&o!==r&&Jo(e,o,{get:()=>t[o],enumerable:!(n=Mw(t,o))||n.enumerable});return e};var Mt=(e,t,r)=>(r=e!=null?Dw(jw(e)):{},If(t||!e||!e.__esModule?Jo(r,"default",{value:e,enumerable:!0}):r,e)),Vw=e=>If(Jo({},"__esModule",{value:!0}),e);var ie=(e,t,r)=>Uw(e,typeof t!="symbol"?t+"":t,r);var b,d=Un(()=>{"use strict";b=typeof globalThis<"u"?globalThis:window});function Aa(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Aa=function(t){return typeof t}:Aa=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Aa(e)}function $w(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=Qw.bind(this))}function Qw(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","*/*"),Bw(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):Gw(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var Bw,Gw,p=Un(()=>{"use strict";Bw=function(t){return typeof t=="string"},Gw=function(t){return t instanceof Blob};$w.call((typeof window>"u"?"undefined":Aa(window))==="object"?window:{})});var pl=Ye(ti=>{"use strict";m();d();f();p();Object.defineProperty(ti,"__esModule",{value:!0});function Tf(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 Hw(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zw(e,t,r){return t=Vn(t),Kw(e,Pf()?Reflect.construct(t,r||[],Vn(e).constructor):t.apply(e,r))}function ul(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _f(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,Jw(n.key),n)}}function ll(e,t,r){return t&&_f(e.prototype,t),r&&_f(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=eA(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(l){throw l},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 l=r.next();return a=l.done,l},e:function(l){s=!0,i=l},f:function(){try{a||r.return==null||r.return()}finally{if(s)throw i}}}}function sl(){return sl=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=Yw(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},sl.apply(null,arguments)}function Vn(e){return Vn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vn(e)}function Ww(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&&cl(e,t)}function Pf(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Pf=function(){return!!e})()}function Kw(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 Hw(e)}function cl(e,t){return cl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},cl(e,t)}function Yw(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Vn(e))!==null;);return e}function Xw(e,t,r,n){var o=sl(Vn(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function Zw(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 Jw(e){var t=Zw(e,"string");return typeof t=="symbol"?t:t+""}function eA(e,t){if(e){if(typeof e=="string")return Tf(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)?Tf(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function tA(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 rA(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 Of=function(){function e(){ul(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return ll(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,l=i.length;s<l;s++)a();return!r.defaultPrevented}}}])}(),dl=function(e){function t(){var r;return ul(this,t),r=zw(this,t),r.listeners||Of.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 Ww(t,e),ll(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)),Xw(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 xa;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 xa;function i(){o.abort(this.reason),a()}function a(){var g=kf(n),v;try{for(g.s();!(v=g.n()).done;){var E=v.value;E.removeEventListener("abort",i)}}catch(h){g.e(h)}finally{g.f()}}var s=kf(n),l;try{for(s.s();!(l=s.n()).done;){var c=l.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}}])}(Of),xa=function(){function e(){ul(this,e),Object.defineProperty(this,"signal",{value:new dl,writable:!0,configurable:!0})}return ll(e,[{key:"abort",value:function(r){var n=rA(r),o=tA(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(xa.prototype[Symbol.toStringTag]="AbortController",dl.prototype[Symbol.toStringTag]="AbortSignal");function nA(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 oA(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(!nA({fetch:r,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s}))return{fetch:r,Request:l};var l=o;(l&&!l.prototype.hasOwnProperty("signal")||s)&&(l=function(E,h){var y;h&&h.signal&&(y=h.signal,delete h.signal);var S=new o(E,h);return y&&Object.defineProperty(S,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),S},l.prototype=o.prototype);var c=r,g=function(E,h){var y=l&&l.prototype.isPrototypeOf(E)?E.signal:h?h.signal:void 0;if(y){var S;try{S=new DOMException("Aborted","AbortError")}catch{S=new Error("Aborted"),S.name="AbortError"}if(y.aborted)return Promise.reject(S);var C=new Promise(function(R,T){y.addEventListener("abort",function(){return T(S)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([C,c(E,h)])}return c(E,h)};return{fetch:g,Request:l}}ti.AbortController=xa;ti.AbortSignal=dl;ti.abortableFetch=oA});var Nf,u,w,f=Un(()=>{"use strict";Nf=Mt(pl(),1),u=Mt(pl(),1),{fetch:w}=(0,Nf.abortableFetch)({fetch})});function fl(e){return typeof e!="string"||e in{}}function ml(){return Object.create(null)}function Ff(e){return typeof e=="string"&&!!e.trim()}function gl(e,t){var r=e.split(";").filter(Ff),n=r.shift(),o=iA(n),i=o.name,a=o.value;if(t=t?Object.assign({},Ca,t):Ca,fl(i))return null;try{a=t.decodeValues?decodeURIComponent(a):a}catch(l){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",l)}var s=ml();return s.name=i,s.value=a,r.forEach(function(l){var c=l.split("="),g=c.shift().trimLeft().toLowerCase();if(!fl(g)){var v=c.join("=");if(g==="expires")s.expires=new Date(v);else if(g==="max-age"){var E=parseInt(v,10);Number.isNaN(E)||(s.maxAge=E)}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 iA(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function Bn(e,t){if(t=t?Object.assign({},Ca,t):Ca,!e)return t.map?ml():[];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(Ff),n&&(e=e.map(Ea).flat()),t.map){var i=ml();return e.reduce(function(a,s){var l=gl(s,t);return l&&!fl(l.name)&&(a[l.name]=l),a},i)}else return e.map(function(a){return gl(a,t)}).filter(Boolean)}function Ea(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,i,a,s;function l(){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;l();)if(o=e.charAt(r),o===","){for(i=r,r+=1,l(),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 Ca,Df=Un(()=>{"use strict";m();d();f();p();Ca={decodeValues:!0,map:!1,silent:!1,split:"auto"};Bn.parseSetCookie=Bn;Bn.parse=Bn;Bn.parseString=gl;Bn.splitCookiesString=Ea});function ri(e){if(aA.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function hl(e){return e.replace(sA,"")}function ni(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||!cA(r))return!1}return!0}function cA(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function qf(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 aA,Mf,sA,jf,Gn,yl,Lf,x,Vf=Un(()=>{"use strict";m();d();f();p();Df();aA=/[^a-z0-9\-#$%&'*+.^_`|~]/i;Mf=[`
|
|
19
|
+
`,"\r","\t"," "],sA=new RegExp(`(^[${Mf.join("")}]|$[${Mf.join("")}])`,"g");Gn=Symbol("normalizedHeaders"),yl=Symbol("rawHeaderNames"),Lf=", ",x=class Uf{constructor(t){this[Gn]={},this[yl]=new Map,this[jf]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof Uf||typeof b.Headers<"u"&&t instanceof b.Headers?t.forEach((r,n)=>{this.append(n,r)},this):Array.isArray(t)?t.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(Lf):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(Lf):n)})}[(jf=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[Gn]).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(!ni(t))throw new TypeError(`Invalid header name "${t}"`);return this[Gn].hasOwnProperty(ri(t))}get(t){if(!ni(t))throw TypeError(`Invalid header name "${t}"`);return this[Gn][ri(t)]??null}set(t,r){if(!ni(t)||!qf(r))return;let n=ri(t),o=hl(r);this[Gn][n]=hl(o),this[yl].set(n,t)}append(t,r){if(!ni(t)||!qf(r))return;let n=ri(t),o=hl(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!ni(t)||!this.has(t))return;let r=ri(t);delete this[Gn][r],this[yl].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===""?[""]:Ea(t)}}});var m=Un(()=>{"use strict";Vf()});var Kf=Ye(ai=>{"use strict";m();d();f();p();var _a=ai&&ai.__assign||function(){return _a=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},_a.apply(this,arguments)};Object.defineProperty(ai,"__esModule",{value:!0});var yA={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function vA(e){var t=_a(_a({},yA),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}ai.getSanitizedOptions=vA});var Yf=Ye(wl=>{"use strict";m();d();f();p();Object.defineProperty(wl,"__esModule",{value:!0});function SA(e){var t=Math.random()*e;return Math.round(t)}wl.fullJitter=SA});var Xf=Ye(Al=>{"use strict";m();d();f();p();Object.defineProperty(Al,"__esModule",{value:!0});function bA(e){return e}Al.noJitter=bA});var Zf=Ye(xl=>{"use strict";m();d();f();p();Object.defineProperty(xl,"__esModule",{value:!0});var wA=Yf(),AA=Xf();function xA(e){return e.jitter==="full"?wA.fullJitter:AA.noJitter}xl.JitterFactory=xA});var El=Ye(Cl=>{"use strict";m();d();f();p();Object.defineProperty(Cl,"__esModule",{value:!0});var CA=Zf(),EA=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=CA.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}();Cl.Delay=EA});var Jf=Ye(nr=>{"use strict";m();d();f();p();var RA=nr&&nr.__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)}}(),IA=nr&&nr.__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 l(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,l)}c((n=n.apply(e,t||[])).next())})},TA=nr&&nr.__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 l([c,g])}}function l(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(nr,"__esModule",{value:!0});var _A=El(),kA=function(e){RA(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return IA(this,void 0,void 0,function(){return TA(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}(_A.Delay);nr.SkipFirstDelay=kA});var em=Ye(si=>{"use strict";m();d();f();p();var OA=si&&si.__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(si,"__esModule",{value:!0});var PA=El(),NA=function(e){OA(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(PA.Delay);si.AlwaysDelay=NA});var tm=Ye(Rl=>{"use strict";m();d();f();p();Object.defineProperty(Rl,"__esModule",{value:!0});var FA=Jf(),DA=em();function MA(e,t){var r=qA(e);return r.setAttemptNumber(t),r}Rl.DelayFactory=MA;function qA(e){return e.delayFirstAttempt?new DA.AlwaysDelay(e):new FA.SkipFirstDelay(e)}});var rm=Ye(Kr=>{"use strict";m();d();f();p();var Il=Kr&&Kr.__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 l(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,l)}c((n=n.apply(e,t||[])).next())})},Tl=Kr&&Kr.__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 l([c,g])}}function l(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(Kr,"__esModule",{value:!0});var jA=Kf(),LA=tm();function UA(e,t){return t===void 0&&(t={}),Il(this,void 0,void 0,function(){var r,n;return Tl(this,function(o){switch(o.label){case 0:return r=jA.getSanitizedOptions(t),n=new VA(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}Kr.backOff=UA;var VA=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return Il(this,void 0,void 0,function(){var t,r;return Tl(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 Il(this,void 0,void 0,function(){var t;return Tl(this,function(r){switch(r.label){case 0:return t=LA.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var Ws=Ye((Kd,Yd)=>{"use strict";m();d();f();p();(function(e,t){typeof Kd=="object"&&typeof Yd<"u"?Yd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs=t()})(Kd,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",l="week",c="month",g="quarter",v="year",E="date",h="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,S=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(O){var P=["th","st","nd","rd"],F=O%100;return"["+O+(P[(F-20)%10]||P[F]||P[0])+"]"}},R=function(O,P,F){var H=String(O);return!H||H.length>=P?O:""+Array(P+1-H.length).join(F)+O},T={s:R,z:function(O){var P=-O.utcOffset(),F=Math.abs(P),H=Math.floor(F/60),Q=F%60;return(P<=0?"+":"-")+R(H,2,"0")+":"+R(Q,2,"0")},m:function O(P,F){if(P.date()<F.date())return-O(F,P);var H=12*(F.year()-P.year())+(F.month()-P.month()),Q=P.clone().add(H,c),X=F-Q<0,Y=P.clone().add(H+(X?-1:1),c);return+(-(H+(F-Q)/(X?Q-Y:Y-Q))||0)},a:function(O){return O<0?Math.ceil(O)||0:Math.floor(O)},p:function(O){return{M:c,y:v,w:l,d:s,D:E,h:a,m:i,s:o,ms:n,Q:g}[O]||String(O||"").toLowerCase().replace(/s$/,"")},u:function(O){return O===void 0}},I="en",k={};k[I]=C;var _="$isDayjsObject",D=function(O){return O instanceof V||!(!O||!O[_])},B=function O(P,F,H){var Q;if(!P)return I;if(typeof P=="string"){var X=P.toLowerCase();k[X]&&(Q=X),F&&(k[X]=F,Q=X);var Y=P.split("-");if(!Q&&Y.length>1)return O(Y[0])}else{var W=P.name;k[W]=P,Q=W}return!H&&Q&&(I=Q),Q||!H&&I},L=function(O,P){if(D(O))return O.clone();var F=typeof P=="object"?P:{};return F.date=O,F.args=arguments,new V(F)},j=T;j.l=B,j.i=D,j.w=function(O,P){return L(O,{locale:P.$L,utc:P.$u,x:P.$x,$offset:P.$offset})};var V=function(){function O(F){this.$L=B(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[_]=!0}var P=O.prototype;return P.parse=function(F){this.$d=function(H){var Q=H.date,X=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 Y=Q.match(y);if(Y){var W=Y[2]-1||0,te=(Y[7]||"0").substring(0,3);return X?new Date(Date.UTC(Y[1],W,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,te)):new Date(Y[1],W,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,te)}}return new Date(Q)}(F),this.init()},P.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()},P.$utils=function(){return j},P.isValid=function(){return this.$d.toString()!==h},P.isSame=function(F,H){var Q=L(F);return this.startOf(H)<=Q&&Q<=this.endOf(H)},P.isAfter=function(F,H){return L(F)<this.startOf(H)},P.isBefore=function(F,H){return this.endOf(H)<L(F)},P.$g=function(F,H,Q){return j.u(F)?this[H]:this.set(Q,F)},P.unix=function(){return Math.floor(this.valueOf()/1e3)},P.valueOf=function(){return this.$d.getTime()},P.startOf=function(F,H){var Q=this,X=!!j.u(H)||H,Y=j.p(F),W=function(ge,fe){var Se=j.w(Q.$u?Date.UTC(Q.$y,fe,ge):new Date(Q.$y,fe,ge),Q);return X?Se:Se.endOf(s)},te=function(ge,fe){return j.w(Q.toDate()[ge].apply(Q.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(fe)),Q)},se=this.$W,Ee=this.$M,Me=this.$D,ke="set"+(this.$u?"UTC":"");switch(Y){case v:return X?W(1,0):W(31,11);case c:return X?W(1,Ee):W(0,Ee+1);case l:var Pe=this.$locale().weekStart||0,Ne=(se<Pe?se+7:se)-Pe;return W(X?Me-Ne:Me+(6-Ne),Ee);case s:case E: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()}},P.endOf=function(F){return this.startOf(F,!1)},P.$set=function(F,H){var Q,X=j.p(F),Y="set"+(this.$u?"UTC":""),W=(Q={},Q[s]=Y+"Date",Q[E]=Y+"Date",Q[c]=Y+"Month",Q[v]=Y+"FullYear",Q[a]=Y+"Hours",Q[i]=Y+"Minutes",Q[o]=Y+"Seconds",Q[n]=Y+"Milliseconds",Q)[X],te=X===s?this.$D+(H-this.$W):H;if(X===c||X===v){var se=this.clone().set(E,1);se.$d[W](te),se.init(),this.$d=se.set(E,Math.min(this.$D,se.daysInMonth())).$d}else W&&this.$d[W](te);return this.init(),this},P.set=function(F,H){return this.clone().$set(F,H)},P.get=function(F){return this[j.p(F)]()},P.add=function(F,H){var Q,X=this;F=Number(F);var Y=j.p(H),W=function(Ee){var Me=L(X);return j.w(Me.date(Me.date()+Math.round(Ee*F)),X)};if(Y===c)return this.set(c,this.$M+F);if(Y===v)return this.set(v,this.$y+F);if(Y===s)return W(1);if(Y===l)return W(7);var te=(Q={},Q[i]=t,Q[a]=r,Q[o]=e,Q)[Y]||1,se=this.$d.getTime()+F*te;return j.w(se,this)},P.subtract=function(F,H){return this.add(-1*F,H)},P.format=function(F){var H=this,Q=this.$locale();if(!this.isValid())return Q.invalidDate||h;var X=F||"YYYY-MM-DDTHH:mm:ssZ",Y=j.z(this),W=this.$H,te=this.$m,se=this.$M,Ee=Q.weekdays,Me=Q.months,ke=Q.meridiem,Pe=function(fe,Se,he,$e){return fe&&(fe[Se]||fe(H,X))||he[Se].slice(0,$e)},Ne=function(fe){return j.s(W%12||12,fe,"0")},ge=ke||function(fe,Se,he){var $e=fe<12?"AM":"PM";return he?$e.toLowerCase():$e};return X.replace(S,function(fe,Se){return Se||function(he){switch(he){case"YY":return String(H.$y).slice(-2);case"YYYY":return j.s(H.$y,4,"0");case"M":return se+1;case"MM":return j.s(se+1,2,"0");case"MMM":return Pe(Q.monthsShort,se,Me,3);case"MMMM":return Pe(Me,se);case"D":return H.$D;case"DD":return j.s(H.$D,2,"0");case"d":return String(H.$W);case"dd":return Pe(Q.weekdaysMin,H.$W,Ee,2);case"ddd":return Pe(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 Ne(1);case"hh":return Ne(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 Y}return null}(fe)||Y.replace(":","")})},P.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},P.diff=function(F,H,Q){var X,Y=this,W=j.p(H),te=L(F),se=(te.utcOffset()-this.utcOffset())*t,Ee=this-te,Me=function(){return j.m(Y,te)};switch(W){case v:X=Me()/12;break;case c:X=Me();break;case g:X=Me()/3;break;case l:X=(Ee-se)/6048e5;break;case s:X=(Ee-se)/864e5;break;case a:X=Ee/r;break;case i:X=Ee/t;break;case o:X=Ee/e;break;default:X=Ee}return Q?X:j.a(X)},P.daysInMonth=function(){return this.endOf(c).$D},P.$locale=function(){return k[this.$L]},P.locale=function(F,H){if(!F)return this.$L;var Q=this.clone(),X=B(F,H,!0);return X&&(Q.$L=X),Q},P.clone=function(){return j.w(this.$d,this)},P.toDate=function(){return new Date(this.valueOf())},P.toJSON=function(){return this.isValid()?this.toISOString():null},P.toISOString=function(){return this.$d.toISOString()},P.toString=function(){return this.$d.toUTCString()},O}(),q=V.prototype;return L.prototype=q,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",c],["$y",v],["$D",E]].forEach(function(O){q[O[1]]=function(P){return this.$g(P,O[0],O[1])}}),L.extend=function(O,P){return O.$i||(O(P,V,L),O.$i=!0),L},L.locale=B,L.isDayjs=D,L.unix=function(O){return L(1e3*O)},L.en=k[I],L.Ls=k,L.p={},L})});var iy=Ye((Xd,Zd)=>{"use strict";m();d();f();p();(function(e,t){typeof Xd=="object"&&typeof Zd<"u"?Zd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_quarterOfYear=t()})(Xd,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,l){return s=Number(s),this.$utils().p(l)===t?this.add(3*s,e):i.bind(this)(s,l)};var a=o.startOf;o.startOf=function(s,l){var c=this.$utils(),g=!!c.u(l)||l;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,l)}}})});var ay=Ye((Jd,ep)=>{"use strict";m();d();f();p();(function(e,t){typeof Jd=="object"&&typeof ep<"u"?ep.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_customParseFormat=t()})(Jd,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)},l=function(y){return function(S){this[y]=+S}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(S){if(!S||S==="Z")return 0;var C=S.match(/([+-]|\d\d)/g),R=60*C[1]+(+C[2]||0);return R===0?0:C[0]==="+"?-R:R}(y)}],g=function(y){var S=a[y];return S&&(S.indexOf?S:S.s.concat(S.f))},v=function(y,S){var C,R=a.meridiem;if(R){for(var T=1;T<=24;T+=1)if(y.indexOf(R(T,0,S))>-1){C=T>12;break}}else C=y===(S?"pm":"PM");return C},E={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,l("seconds")],ss:[o,l("seconds")],m:[o,l("minutes")],mm:[o,l("minutes")],H:[o,l("hours")],h:[o,l("hours")],HH:[o,l("hours")],hh:[o,l("hours")],D:[o,l("day")],DD:[n,l("day")],Do:[i,function(y){var S=a.ordinal,C=y.match(/\d+/);if(this.day=C[0],S)for(var R=1;R<=31;R+=1)S(R).replace(/\[|\]/g,"")===y&&(this.day=R)}],w:[o,l("week")],ww:[n,l("week")],M:[o,l("month")],MM:[n,l("month")],MMM:[i,function(y){var S=g("months"),C=(g("monthsShort")||S.map(function(R){return R.slice(0,3)})).indexOf(y)+1;if(C<1)throw new Error;this.month=C%12||C}],MMMM:[i,function(y){var S=g("months").indexOf(y)+1;if(S<1)throw new Error;this.month=S%12||S}],Y:[/[+-]?\d+/,l("year")],YY:[n,function(y){this.year=s(y)}],YYYY:[/\d{4}/,l("year")],Z:c,ZZ:c};function h(y){var S,C;S=y,C=a&&a.formats;for(var R=(y=S.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(L,j,V){var q=V&&V.toUpperCase();return j||C[V]||e[V]||C[q].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(O,P,F){return P||F.slice(1)})})).match(t),T=R.length,I=0;I<T;I+=1){var k=R[I],_=E[k],D=_&&_[0],B=_&&_[1];R[I]=B?{regex:D,parser:B}:k.replace(/^\[|\]$/g,"")}return function(L){for(var j={},V=0,q=0;V<T;V+=1){var O=R[V];if(typeof O=="string")q+=O.length;else{var P=O.regex,F=O.parser,H=L.slice(q),Q=P.exec(H)[0];F.call(j,Q),L=L.replace(Q,"")}}return function(X){var Y=X.afternoon;if(Y!==void 0){var W=X.hours;Y?W<12&&(X.hours+=12):W===12&&(X.hours=0),delete X.afternoon}}(j),j}}return function(y,S,C){C.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(s=y.parseTwoDigitYear);var R=S.prototype,T=R.parse;R.parse=function(I){var k=I.date,_=I.utc,D=I.args;this.$u=_;var B=D[1];if(typeof B=="string"){var L=D[2]===!0,j=D[3]===!0,V=L||j,q=D[2];j&&(q=D[2]),a=this.$locale(),!L&&q&&(a=C.Ls[q]),this.$d=function(H,Q,X,Y){try{if(["x","X"].indexOf(Q)>-1)return new Date((Q==="X"?1e3:1)*H);var W=h(Q)(H),te=W.year,se=W.month,Ee=W.day,Me=W.hours,ke=W.minutes,Pe=W.seconds,Ne=W.milliseconds,ge=W.zone,fe=W.week,Se=new Date,he=Ee||(te||se?1:Se.getDate()),$e=te||Se.getFullYear(),He=0;te&&!se||(He=se>0?se-1:Se.getMonth());var Ft,bt=Me||0,Bt=ke||0,Ct=Pe||0,Dt=Ne||0;return ge?new Date(Date.UTC($e,He,he,bt,Bt,Ct,Dt+60*ge.offset*1e3)):X?new Date(Date.UTC($e,He,he,bt,Bt,Ct,Dt)):(Ft=new Date($e,He,he,bt,Bt,Ct,Dt),fe&&(Ft=Y(Ft).week(fe).toDate()),Ft)}catch{return new Date("")}}(k,B,_,C),this.init(),q&&q!==!0&&(this.$L=this.locale(q).$L),V&&k!=this.format(B)&&(this.$d=new Date("")),a={}}else if(B instanceof Array)for(var O=B.length,P=1;P<=O;P+=1){D[1]=B[P-1];var F=C.apply(this,D);if(F.isValid()){this.$d=F.$d,this.$L=F.$L,this.init();break}P===O&&(this.$d=new Date(""))}else T.call(this,I)}}})});var ev=Ye((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 b<"u"?b:e||self).dayjs_plugin_timezone=t()})(gp,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,E){E===void 0&&(E={});var h=new Date(g),y=function(S,C){C===void 0&&(C={});var R=C.timeZoneName||"short",T=S+"|"+R,I=t[T];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[T]=I),I}(v,E);return y.formatToParts(h)},s=function(g,v){for(var E=a(g,v),h=[],y=0;y<E.length;y+=1){var S=E[y],C=S.type,R=S.value,T=e[C];T>=0&&(h[T]=parseInt(R,10))}var I=h[3],k=I===24?0:I,_=h[0]+"-"+h[1]+"-"+h[2]+" "+k+":"+h[4]+":"+h[5]+":000",D=+g;return(o.utc(_).valueOf()-(D-=D%1e3))/6e4},l=n.prototype;l.tz=function(g,v){g===void 0&&(g=i);var E,h=this.utcOffset(),y=this.toDate(),S=y.toLocaleString("en-US",{timeZone:g}),C=Math.round((y-new Date(S))/1e3/60),R=15*-Math.round(y.getTimezoneOffset()/15)-C;if(!Number(R))E=this.utcOffset(0,v);else if(E=o(S,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(R,!0),v){var T=E.utcOffset();E=E.add(h-T,"minute")}return E.$x.$timezone=g,E},l.offsetName=function(g){var v=this.$x.$timezone||o.tz.guess(),E=a(this.valueOf(),v,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return E&&E.value};var c=l.startOf;l.startOf=function(g,v){if(!this.$x||!this.$x.$timezone)return c.call(this,g,v);var E=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return c.call(E,g,v).tz(this.$x.$timezone,!0)},o.tz=function(g,v,E){var h=E&&v,y=E||v||i,S=s(+o(),y);if(typeof g!="string")return o(g).tz(y);var C=function(k,_,D){var B=k-60*_*1e3,L=s(B,D);if(_===L)return[B,_];var j=s(B-=60*(L-_)*1e3,D);return L===j?[B,L]:[k-60*Math.min(L,j)*1e3,Math.max(L,j)]}(o.utc(g,h).valueOf(),S,y),R=C[0],T=C[1],I=o(R).utcOffset(T);return I.$x.$timezone=y,I},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var tv=Ye((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 b<"u"?b:e||self).dayjs_plugin_utc=t()})(yp,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 l=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 l.call(this)};var c=a.utcOffset;a.utcOffset=function(h,y){var S=this.$utils().u;if(S(h))return this.$u?0:S(this.$offset)?c.call(this):this.$offset;if(typeof h=="string"&&(h=function(I){I===void 0&&(I="");var k=I.match(t);if(!k)return null;var _=(""+k[0]).match(r)||["-",0,0],D=_[0],B=60*+_[1]+ +_[2];return B===0?0:D==="+"?B:-B}(h),h===null))return this;var C=Math.abs(h)<=16?60*h:h;if(C===0)return this.utc(y);var R=this.clone();if(y)return R.$offset=C,R.$u=!1,R;var T=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(R=this.local().add(C+T,e)).$offset=C,R.$x.$localOffset=T,R};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 E=a.diff;a.diff=function(h,y,S){if(h&&this.$u===h.$u)return E.call(this,h,y,S);var C=this.local(),R=i(h).local();return E.call(C,R,y,S)}}})});var Fb=Ye((Wce,Nb)=>{"use strict";m();d();f();p();function IO(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}Nb.exports=TO;function TO(e,t,r){var n=r&&r.stringify||IO,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 l=t.length;if(l===0)return e;for(var c="",g=1-o,v=-1,E=e&&e.length||0,h=0;h<E;){if(e.charCodeAt(h)===37&&h+1<E){switch(v=v>-1?v:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=l||t[g]==null)break;v<h&&(c+=e.slice(v,h)),c+=Number(t[g]),v=h+2,h++;break;case 105:if(g>=l||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>=l||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>=l)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<E&&(c+=e.slice(v)),c)}});var Vb=Ye((Jce,Wu)=>{"use strict";m();d();f();p();var Db=Fb();Wu.exports=Sr;var ha=GO().console||{},_O={mapHttpRequest:zu,mapHttpResponse:zu,wrapRequestSerializer:gf,wrapResponseSerializer:gf,wrapErrorSerializer:gf,req:zu,res:zu,err:qb,errWithCause:qb};function Hr(e,t){return e==="silent"?1/0:t.levels.values[e]}var vf=Symbol("pino.logFuncs"),hf=Symbol("pino.hierarchy"),kO={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function Mb(e,t){let r={logger:t,parent:e[hf]};t[hf]=r}function OO(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:ha[o]||ha[kO[o]||"log"]||Ho}),e[vf]=n}function PO(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function Sr(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||ha;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=PO(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 l=e.level||"info",c=Object.create(r);c.log||(c.log=Ho),OO(c,s,r),Mb({},c),Object.defineProperty(c,"levelVal",{get:v}),Object.defineProperty(c,"level",{get:E,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:UO(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Ho};c.levels=NO(e),c.level=l,c.isLevelEnabled=function(S){return this.levels.values[S]?this.levels.values[S]>=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=Ho,c.serializers=n,c._serialize=o,c._stdErrSerialize=i,c.child=function(...S){return y.call(this,g,...S)},t&&(c._logEvent=yf());function v(){return Hr(this.level,this)}function E(){return this._level}function h(S){if(S!=="silent"&&!this.levels.values[S])throw Error("unknown level "+S);this._level=S,Mn(this,g,c,"error"),Mn(this,g,c,"fatal"),Mn(this,g,c,"warn"),Mn(this,g,c,"info"),Mn(this,g,c,"debug"),Mn(this,g,c,"trace"),a.forEach(C=>{Mn(this,g,c,C)})}function y(S,C,R){if(!C)throw new Error("missing bindings for child Pino");R=R||{},o&&C.serializers&&(R.serializers=C.serializers);let T=R.serializers;if(o&&T){var I=Object.assign({},n,T),k=e.browser.serialize===!0?Object.keys(I):o;delete C.serializers,Sf([C],k,I,this._stdErrSerialize)}function _(B){this._childLevel=(B._childLevel|0)+1,this.bindings=C,I&&(this.serializers=I,this._serialize=k),t&&(this._logEvent=yf([].concat(B._logEvent.bindings,C)))}_.prototype=this;let D=new _(this);return Mb(this,D),D.child=function(...B){return y.call(this,S,...B)},D.level=R.level||this.level,S.onChild(D),D}return c}function NO(e){let t=e.customLevels||{},r=Object.assign({},Sr.levels.values,t),n=Object.assign({},Sr.levels.labels,FO(t));return{values:r,labels:n}}function FO(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}Sr.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"}};Sr.stdSerializers=_O;Sr.stdTimeFunctions=Object.assign({},{nullTime:Lb,epochTime:Ub,unixTime:VO,isoTime:BO});function DO(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[hf];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Mn(e,t,r,n){if(Object.defineProperty(e,n,{value:Hr(e.level,r)>Hr(n,r)?Ho:r[vf][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===Ho){if(!t.transmit)return;let i=t.transmit.level||e.level,a=Hr(i,r);if(Hr(n,r)<a)return}e[n]=qO(e,t,r,n);let o=DO(e);o.length!==0&&(e[n]=MO(o,e[n]))}function MO(e,t){return function(){return t.apply(this,[...e,...arguments])}}function qO(e,t,r,n){return function(o){return function(){let a=t.timestamp(),s=new Array(arguments.length),l=Object.getPrototypeOf&&Object.getPrototypeOf(this)===ha?ha:this;for(var c=0;c<s.length;c++)s[c]=arguments[c];var g=!1;if(t.serialize&&(Sf(s,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let v=jO(this,n,s,a,t);if(t.reportCaller&&v&&v.length>0&&v[0]&&typeof v[0]=="object")try{let E=jb();E&&(v[0].caller=E)}catch{}o.call(l,...v)}else{if(t.reportCaller)try{let v=jb();v&&s.push(v)}catch{}o.apply(l,s)}if(t.transmit){let v=t.transmit.level||e._level,E=Hr(v,r),h=Hr(n,r);if(h<E)return;LO(this,{ts:a,methodLevel:n,methodValue:h,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Hr(e._level,r)},s,g)}}}(e[vf][n])}function jO(e,t,r,n,o){let{level:i,log:a=v=>v}=o.formatters||{},s=r.slice(),l=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(l!==null&&typeof l=="object")for(;g--&&typeof s[0]=="object";)Object.assign(c,s.shift());return[a(c),...s]}else{if(l!==null&&typeof l=="object"){for(;g--&&typeof s[0]=="object";)Object.assign(c,s.shift());l=s.length?Db(s.shift(),s):void 0}else typeof l=="string"&&(l=Db(s.shift(),s));return l!==void 0&&(c[o.messageKey]=l),[a(c)]}}function Sf(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=Sr.stdSerializers.err(e[o]);else if(typeof e[o]=="object"&&!Array.isArray(e[o])&&t)for(let i in e[o])t.indexOf(i)>-1&&i in r&&(e[o][i]=r[i](e[o][i]))}function LO(e,t,r,n=!1){let o=t.send,i=t.ts,a=t.methodLevel,s=t.methodValue,l=t.val,c=e._logEvent.bindings;n||Sf(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,l),e._logEvent=yf(c)}function yf(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function qb(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 UO(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?Lb:Ub}function zu(){return{}}function gf(e){return e}function Ho(){}function Lb(){return!1}function Ub(){return Date.now()}function VO(){return Math.round(Date.now()/1e3)}function BO(){return new Date(Date.now()).toISOString()}function GO(){function e(t){return typeof t<"u"&&t}try{return typeof b<"u"?b:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),b)}catch{return e(self)||e(window)||e(this)||{}}}Wu.exports.default=Sr;Wu.exports.pino=Sr;function jb(){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 GP={};ei(GP,{DefaultFieldsToInclude:()=>Ef,EcommerceDefaultFieldsToInclude:()=>_w,HighlightUtils:()=>bl,MinimumFieldsToInclude:()=>il,ResultTemplatesHelpers:()=>Ey,buildContext:()=>Xb,buildController:()=>zr,buildDictionaryFieldContext:()=>Zb,buildInteractiveResult:()=>Ew,buildRecommendationEngine:()=>Wb,buildRecommendationList:()=>xw,buildResultTemplatesManager:()=>Pw,getAnalyticsNextApiBaseUrl:()=>ka,getOrganizationEndpoint:()=>Et,getSampleRecommendationEngineConfiguration:()=>bf,loadAdvancedSearchQueryActions:()=>TP,loadClickAnalyticsActions:()=>LP,loadConfigurationActions:()=>_P,loadContextActions:()=>OP,loadDebugActions:()=>PP,loadDictionaryFieldContextActions:()=>NP,loadFieldActions:()=>MP,loadPaginationActions:()=>Cf,loadPipelineActions:()=>qP,loadRecommendationActions:()=>jP,loadSearchConfigurationActions:()=>kP,loadSearchHubActions:()=>BP});module.exports=Vw(GP);m();d();f();p();var bl={};ei(bl,{escapeHtml:()=>$n,getHighlightedSuggestion:()=>hA,highlightString:()=>gA});m();d();f();p();m();d();f();p();function uA(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 oi(r)}var oi=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},mt=class{constructor(e){ie(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 uA(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}},Fe=class{constructor(e={}){ie(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 Xe(e){return e===void 0}function lA(e){return e===null}function ce(e){return Xe(e)||lA(e)}var me=class{constructor(e={}){ie(this,"value");this.value=new Fe(e)}validate(e){let t=this.value.validate(e);return t||(dA(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function dA(e){return Xe(e)||Bf(e)}function Bf(e){return typeof e=="boolean"}var oe=class{constructor(e={}){ie(this,"config");ie(this,"value");this.config=e,this.value=new Fe(e)}validate(e){let t=this.value.validate(e);return t||(pA(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 pA(e){return Xe(e)||Gf(e)}function Gf(e){return typeof e=="number"&&!Number.isNaN(e)}var fA=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,z=class{constructor(e={}){ie(this,"value");ie(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Fe(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(Xe(e))return null;if(!Ra(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&&!(fA.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 Ra(e){return Object.prototype.toString.call(e)==="[object String]"}var ne=class{constructor(e={}){ie(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Xe(e))return this.config.options.required?"value is required and is currently undefined":null;if(!$f(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ce(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],i=n.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function $f(e){return e!==void 0&&typeof e=="object"}var ve=class{constructor(e={}){ie(this,"config");ie(this,"value");this.config=e,this.value=new Fe(this.config)}validate(e){if(!ce(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ce(e))return null;if(this.config.max!==void 0&&e.length>this.config.max)return`value contains more than ${this.config.max}`;if(this.config.min!==void 0&&e.length<this.config.min)return`value contains less than ${this.config.min}`;if(this.config.each!==void 0){let r="";return e.forEach(n=>{this.config.each.required&&ce(n)&&(r=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(n,this.config.each);o!==null&&(r+=` ${o}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return Bf(e)||Ra(e)||Gf(e)||$f(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Qf(e){return Array.isArray(e)}var vl=class{constructor(e){ie(this,"config");ie(this,"value");this.config=e,this.value=new Fe(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Xe(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 Hf(e){return Array.isArray(e)}function Ia(e){return e.trim()===""}var mA=new Set(["1",1,"yes",!0]);function zf(){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=>mA.has(r))}function Wf(e){let t={};for(let[r,n]of e)t[r]=n;return t}function ii(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Ta(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 gA(e){if(Ia(e.openingDelimiter)||Ia(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(ce(e.content)||Ia(e.content))return e.content;if(e.highlights.length===0)return $n(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+=$n(e.content.slice(n,a)),r+=e.openingDelimiter,r+=$n(e.content.slice(a,s)),r+=e.closingDelimiter,n=s}return n!==t&&(r+=$n(e.content.slice(n))),r}function hA(e,t){return e=$n(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?Sl(n,t.notMatchDelimiters):o?Sl(o,t.exactMatchDelimiters):i?Sl(i,t.correctionDelimiters):r)}function Sl(e,t){return t?t.open+e+t.close:e}function $n(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 am=Mt(rm(),1);m();d();f();p();var Gt=new Error("Failed to load reducers."),Qn=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."}},Yr=class extends Error{constructor(r,n){super();ie(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 nm(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function om(e){return typeof e!="object"||!e?!1:Object.values(e).every(BA)}function BA(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function im(e){return e===429}var jt=class e{static call(t){return _asyncToGenerator(function*(){let r=GA(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 l=yield w(i,a);if(im(l.status))throw l;return l});return function s(){return _ref.apply(this,arguments)}}();try{let l=yield(0,am.backOff)(s,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(c){let g=c&&im(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(l.status){case 419:case 401:throw n.info("Platform renewing token"),new Qn;case 404:throw new Yr(i,l.status);default:return n.info({response:l,requestInfo:o},"Platform response"),l}}catch(l){return l.message==="Failed to fetch"?new Yr(i):l}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:s,...l}=t,c=ii(l);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 Et(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Hn(e,t,r="prod"){return e??Et(t,r)}function br(e,t="prod"){return`${Et(e,t)}/rest/search/v2`}function ka(e,t="prod"){return`${Et(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function GA(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,s=e.method==="POST"||e.method==="PUT",l=$A(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(s&&{body:l}),signal:a}}function $A(e,t){return t==="application/x-www-form-urlencoded"?om(e)?nm(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();var Oa=e=>e;m();d();f();p();m();d();f();p();function Pa(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function $t(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Pa(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Pa(),extendedResults:{},searchAction:void 0}}m();d();f();p();function wr(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Ar=e=>{let{response:t}=e;return t.body?QA(e):HA(t)},QA=e=>WA(e)?KA(e):zA(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},HA=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function zA(e){return e.body.statusCode!==void 0}function WA(e){return e.body.exception!==void 0}var KA=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();var xr=class{constructor(){ie(this,"currentAbortController",null)}enqueue(t,r){var _this=this;return _asyncToGenerator(function*(){let n=_this.currentAbortController;_this.currentAbortController=new u.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 ci=class{constructor(t){ie(this,"_basePath");ie(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 sm(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var or=(e,t,r,n)=>{let o=new ci(`${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 cm=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield jt.call({...or(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:wr(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=sm(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return YA(a)?{success:a}:{error:Ar({response:r,body:a})}});return function cm(_x3,_x4){return _ref3.apply(this,arguments)}}();function YA(e){return typeof e=="string"}m();d();f();p();function XA(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function ZA(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Na(e,t){if(t&&e.name==="AbortError")return{error:ZA(e)};if(e instanceof Yr)return{error:XA(e)};throw e}var Fa=class{constructor(t){ie(this,"options",t);ie(this,"apiCallsQueues",{unknown:new xr,mainSearch:new xr,facetValues:new xr,foldingCollection:new xr,instantResults:new xr})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield jt.call({...or(t,"POST","application/json","/plan"),requestParams:wr(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return Na(r);let n=yield r.json();return ex(n)?{success:n}:{error:Ar({response:r,body:n})}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield jt.call({...or(t,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:wr(t),..._this3.options});if(r instanceof Error)return Na(r);let n=yield r.json(),o={response:r,body:n};return JA(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:Ar(o)}})()}search(t,r){var _this4=this;return _asyncToGenerator(function*(){let n=r?.origin??"unknown",o=yield _this4.apiCallsQueues[n].enqueue(s=>jt.call({...or(t,"POST","application/json",""),requestParams:wr(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 Na(o,r?.disableAbortWarning);let i=yield o.json(),a={response:o,body:i};return um(i)?(a.body=lm(i),{success:(yield _this4.options.postprocessSearchResponseMiddleware(a)).body}):{error:Ar(a)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield jt.call({...or(t,"POST","application/json","/facet"),requestParams:wr(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({...or(t,"POST","application/json",""),requestParams:wr(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if(um(n)){let o={response:r,body:n};return o.body=lm(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:Ar({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return cm(t,{..._this7.options})})()}fieldDescriptions(t){var _this8=this;return _asyncToGenerator(function*(){let r=yield jt.call({...or(t,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},..._this8.options});if(r instanceof Error)throw r;let n=yield r.json();return tx(n)?{success:n}:{error:Ar({response:r,body:n})}})()}},Da=e=>e.success!==void 0,gt=e=>e.error!==void 0;function um(e){return e.results!==void 0}function lm(e){let t=Pa();return ce(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function JA(e){return e.completions!==void 0}function ex(e){return e.preprocessingOutput!==void 0}function tx(e){return e.fields!==void 0}m();d();f();p();var dm=e=>e,pm=e=>e,fm=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();function Ze(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 rx=typeof Symbol=="function"&&Symbol.observable||"@@observable",mm=rx,_l=()=>Math.random().toString(36).substring(7).split("").join("."),nx={INIT:`@@redux/INIT${_l()}`,REPLACE:`@@redux/REPLACE${_l()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${_l()}`},Ma=nx;function Qt(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 kl(e,t,r){if(typeof e!="function")throw new Error(Ze(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ze(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ze(1));return r(kl)(e,t)}let n=e,o=t,i=new Map,a=i,s=0,l=!1;function c(){a===i&&(a=new Map,i.forEach((C,R)=>{a.set(R,C)}))}function g(){if(l)throw new Error(Ze(3));return o}function v(C){if(typeof C!="function")throw new Error(Ze(4));if(l)throw new Error(Ze(5));let R=!0;c();let T=s++;return a.set(T,C),function(){if(R){if(l)throw new Error(Ze(6));R=!1,c(),a.delete(T),i=null}}}function E(C){if(!Qt(C))throw new Error(Ze(7));if(typeof C.type>"u")throw new Error(Ze(8));if(typeof C.type!="string")throw new Error(Ze(17));if(l)throw new Error(Ze(9));try{l=!0,o=n(o,C)}finally{l=!1}return(i=a).forEach(T=>{T()}),C}function h(C){if(typeof C!="function")throw new Error(Ze(10));n=C,E({type:Ma.REPLACE})}function y(){let C=v;return{subscribe(R){if(typeof R!="object"||R===null)throw new Error(Ze(11));function T(){let k=R;k.next&&k.next(g())}return T(),{unsubscribe:C(T)}},[mm](){return this}}}return E({type:Ma.INIT}),{dispatch:E,subscribe:v,getState:g,replaceReducer:h,[mm]:y}}function ox(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Ma.INIT})>"u")throw new Error(Ze(12));if(typeof r(void 0,{type:Ma.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ze(13))})}function zn(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{ox(r)}catch(a){i=a}return function(s={},l){if(i)throw i;let c=!1,g={};for(let v=0;v<n.length;v++){let E=n[v],h=r[E],y=s[E],S=h(y,l);if(typeof S>"u"){let C=l&&l.type;throw new Error(Ze(14))}g[E]=S,c=c||S!==y}return c=c||n.length!==Object.keys(s).length,c?g:s}}function ui(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function gm(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(Ze(15))},a={getState:o.getState,dispatch:(l,...c)=>i(l,...c)},s=e.map(l=>l(a));return i=ui(...s)(o.dispatch),{...o,dispatch:i}}}function li(e){return Qt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var Ll=Symbol.for("immer-nothing"),di=Symbol.for("immer-draftable"),ze=Symbol.for("immer-state");function Je(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var wt=Object,Zr=wt.getPrototypeOf,fi="constructor",vi="prototype",Nl="configurable",Ua="enumerable",qa="writable",mi="value",lt=e=>!!e&&!!e[ze];function dt(e){return e?xm(e)||bi(e)||!!e[di]||!!e[fi]?.[di]||wi(e)||Ai(e):!1}var ix=wt[vi][fi].toString(),hm=new WeakMap;function xm(e){if(!e||!Wn(e))return!1;let t=Zr(e);if(t===null||t===wt[vi])return!0;let r=wt.hasOwnProperty.call(t,fi)&&t[fi];if(r===Object)return!0;if(!Xr(r))return!1;let n=hm.get(r);return n===void 0&&(n=Function.toString.call(r),hm.set(r,n)),n===ix}function Cm(e){return lt(e)||Je(15,e),e[ze].base_}function Si(e,t,r=!0){Jr(e)===0?(r?Reflect.ownKeys(e):wt.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function Jr(e){let t=e[ze];return t?t.type_:bi(e)?1:wi(e)?2:Ai(e)?3:0}var pi=(e,t,r=Jr(e))=>r===2?e.has(t):wt[vi].hasOwnProperty.call(e,t),ir=(e,t,r=Jr(e))=>r===2?e.get(t):e[t],Va=(e,t,r,n=Jr(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function ax(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var bi=Array.isArray,wi=e=>e instanceof Map,Ai=e=>e instanceof Set,Wn=e=>typeof e=="object",Xr=e=>typeof e=="function",Ol=e=>typeof e=="boolean";function sx(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var cx=e=>Wn(e)?e?.[ze]:null,ar=e=>e.copy_||e.base_;var Ul=e=>e.modified_?e.copy_:e.base_;function Fl(e,t){if(wi(e))return new Map(e);if(Ai(e))return new Set(e);if(bi(e))return Array[vi].slice.call(e);let r=xm(e);if(t===!0||t==="class_only"&&!r){let n=wt.getOwnPropertyDescriptors(e);delete n[ze];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],s=n[a];s[qa]===!1&&(s[qa]=!0,s[Nl]=!0),(s.get||s.set)&&(n[a]={[Nl]:!0,[qa]:!0,[Ua]:s[Ua],[mi]:e[a]})}return wt.create(Zr(e),n)}else{let n=Zr(e);if(n!==null&&r)return{...e};let o=wt.create(n);return wt.assign(o,e)}}function Vl(e,t=!1){return za(e)||lt(e)||!dt(e)||(Jr(e)>1&&wt.defineProperties(e,{set:ja,add:ja,clear:ja,delete:ja}),wt.freeze(e),t&&Si(e,(r,n)=>{Vl(n,!0)},!1)),e}function ux(){Je(2)}var ja={[mi]:ux};function za(e){return e===null||!Wn(e)?!0:wt.isFrozen(e)}var Ba="MapSet",Ga="Patches",ym="ArrayMethods",$a={};function en(e){let t=$a[e];return t||Je(0,e),t}var vm=e=>!!$a[e];function lx(e,t){$a[e]||($a[e]=t)}var gi,Em=()=>gi,dx=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:vm(Ba)?en(Ba):void 0,arrayMethodsPlugin_:vm(ym)?en(ym):void 0});function Sm(e,t){t&&(e.patchPlugin_=en(Ga),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Dl(e){Ml(e),e.drafts_.forEach(px),e.drafts_=null}function Ml(e){e===gi&&(gi=e.parent_)}var bm=e=>gi=dx(gi,e);function px(e){let t=e[ze];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function wm(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[ze].modified_&&(Dl(t),Je(4)),dt(e)&&(e=Am(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[ze].base_,e,t)}else e=Am(t,r);return fx(t,e,!0),Dl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ll?e:void 0}function Am(e,t){if(za(t))return t;let r=t[ze];if(!r)return Qa(t,e.handledSet_,e);if(!Wa(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);Tm(r,e)}return r.copy_}function fx(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Vl(t,r)}function Rm(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Wa=(e,t)=>e.scope_===t,mx=[];function Im(e,t,r,n){let o=ar(e),i=e.type_;if(n!==void 0&&ir(o,n,i)===t){Va(o,n,r,i);return}if(!e.draftLocations_){let s=e.draftLocations_=new Map;Si(o,(l,c)=>{if(lt(c)){let g=s.get(c)||[];g.push(l),s.set(c,g)}})}let a=e.draftLocations_.get(t)??mx;for(let s of a)Va(o,s,r,i)}function gx(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!Wa(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let a=Ul(i);Im(e,i.draft_??i,a,r),Tm(i,o)})}function Tm(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)}Rm(e)}}function hx(e,t,r){let{scope_:n}=e;if(lt(r)){let o=r[ze];Wa(o,n)&&o.callbacks_.push(function(){La(e);let a=Ul(o);Im(e,r,a,t)})}else dt(r)&&e.callbacks_.push(function(){let i=ar(e);e.type_===3?i.has(r)&&Qa(r,n.handledSet_,n):ir(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Qa(ir(e.copy_,t,e.type_),n.handledSet_,n)})}function Qa(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||lt(e)||t.has(e)||!dt(e)||za(e)||(t.add(e),Si(e,(n,o)=>{if(lt(o)){let i=o[ze];if(Wa(i,r)){let a=Ul(i);Va(e,n,a,e.type_),Rm(i)}}else dt(o)&&Qa(o,t,r)})),e}function yx(e,t){let r=bi(e),n={type_:r?1:0,scope_:t?t.scope_:Em(),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=Ha;r&&(o=[n],i=hi);let{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,[s,n]}var Ha={get(e,t){if(t===ze)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=ar(e);if(!pi(o,t,e.type_))return vx(e,o,t);let i=o[t];if(e.finalized_||!dt(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&sx(t))return i;if(i===Pl(e.base_,t)){La(e);let a=e.type_===1?+t:t,s=ql(e.scope_,i,e,a);return e.copy_[a]=s}return i},has(e,t){return t in ar(e)},ownKeys(e){return Reflect.ownKeys(ar(e))},set(e,t,r){let n=_m(ar(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Pl(ar(e),t),i=o?.[ze];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(ax(r,o)&&(r!==void 0||pi(e.base_,t,e.type_)))return!0;La(e),jl(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),hx(e,t,r)),!0},deleteProperty(e,t){return La(e),Pl(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),jl(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=ar(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[qa]:!0,[Nl]:e.type_!==1||t!=="length",[Ua]:n[Ua],[mi]:r[t]}},defineProperty(){Je(11)},getPrototypeOf(e){return Zr(e.base_)},setPrototypeOf(){Je(12)}},hi={};for(let e in Ha){let t=Ha[e];hi[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}hi.deleteProperty=function(e,t){return hi.set.call(this,e,t,void 0)};hi.set=function(e,t,r){return Ha.set.call(this,e[0],t,r,e[0])};function Pl(e,t){let r=e[ze];return(r?ar(r):e)[t]}function vx(e,t,r){let n=_m(t,r);return n?mi in n?n[mi]:n.get?.call(e.draft_):void 0}function _m(e,t){if(!(t in e))return;let r=Zr(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Zr(r)}}function jl(e){e.modified_||(e.modified_=!0,e.parent_&&jl(e.parent_))}function La(e){e.copy_||(e.assigned_=new Map,e.copy_=Fl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Sx=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Xr(t)&&!Xr(r)){let i=r;r=t;let a=this;return function(l=i,...c){return a.produce(l,g=>r.call(this,g,...c))}}Xr(r)||Je(6),n!==void 0&&!Xr(n)&&Je(7);let o;if(dt(t)){let i=bm(this),a=ql(i,t,void 0),s=!0;try{o=r(a),s=!1}finally{s?Dl(i):Ml(i)}return Sm(i,n),wm(o,i)}else if(!t||!Wn(t)){if(o=r(t),o===void 0&&(o=t),o===Ll&&(o=void 0),this.autoFreeze_&&Vl(o,!0),n){let i=[],a=[];en(Ga).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:a}),n(i,a)}return o}else Je(1,t)},this.produceWithPatches=(t,r)=>{if(Xr(t))return(a,...s)=>this.produceWithPatches(a,l=>t(l,...s));let n,o;return[this.produce(t,r,(a,s)=>{n=a,o=s}),n,o]},Ol(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Ol(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Ol(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){dt(e)||Je(8),lt(e)&&(e=Ka(e));let t=bm(this),r=ql(t,e,void 0);return r[ze].isManual_=!0,Ml(t),r}finishDraft(e,t){let r=e&&e[ze];(!r||!r.isManual_)&&Je(9);let{scope_:n}=r;return Sm(n,t),wm(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=en(Ga).applyPatches_;return lt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function ql(e,t,r,n){let[o,i]=wi(t)?en(Ba).proxyMap_(t,r):Ai(t)?en(Ba).proxySet_(t,r):yx(t,r);return(r?.scope_??Em()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?gx(r,i,n):i.callbacks_.push(function(l){l.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:c}=l;i.modified_&&c&&c.generatePatches_(i,[],l)}),o}function Ka(e){return lt(e)||Je(10,e),km(e)}function km(e){if(!dt(e)||za(e))return e;let t=e[ze],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Fl(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Fl(e,!0);return Si(r,(o,i)=>{Va(r,o,km(i))},n),t&&(t.finalized_=!1),r}function Om(){function t(y,S=[]){if(y.key_!==void 0){let C=y.parent_.copy_??y.parent_.base_,R=cx(ir(C,y.key_)),T=ir(C,y.key_);if(T===void 0||T!==y.draft_&&T!==y.base_&&T!==y.copy_||R!=null&&R.base_!==y.base_)return null;let I=y.parent_.type_===3,k;if(I){let _=y.parent_;k=Array.from(_.drafts_.keys()).indexOf(y.key_)}else k=y.key_;if(!(I&&C.size>k||pi(C,k)))return null;S.push(k)}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 C=y;for(let R=0;R<S.length-1;R++){let T=S[R];if(C=ir(C,T),!Wn(C)||C===null)throw new Error(`Cannot resolve path at '${S.join("/")}'`)}return C}let n="replace",o="add",i="remove";function a(y,S,C){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:R,inversePatches_:T}=C;switch(y.type_){case 0:case 2:return l(y,S,R,T);case 1:return s(y,S,R,T);case 3:return c(y,S,R,T)}}function s(y,S,C,R){let{base_:T,assigned_:I}=y,k=y.copy_;k.length<T.length&&([T,k]=[k,T],[C,R]=[R,C]);let _=y.allIndicesReassigned_===!0;for(let D=0;D<T.length;D++){let B=k[D],L=T[D];if((_||I?.get(D.toString()))&&B!==L){let V=B?.[ze];if(V&&V.modified_)continue;let j=S.concat([D]);C.push({op:n,path:j,value:h(B)}),R.push({op:n,path:j,value:h(L)})}}for(let D=T.length;D<k.length;D++){let B=S.concat([D]);C.push({op:o,path:B,value:h(k[D])})}for(let D=k.length-1;T.length<=D;--D){let B=S.concat([D]);R.push({op:i,path:B})}}function l(y,S,C,R){let{base_:T,copy_:I,type_:k}=y;Si(y.assigned_,(_,D)=>{let B=ir(T,_,k),L=ir(I,_,k),q=D?pi(T,_)?n:o:i;if(B===L&&q===n)return;let V=S.concat(_);C.push(q===i?{op:q,path:V}:{op:q,path:V,value:h(L)}),R.push(q===o?{op:i,path:V}:q===i?{op:o,path:V,value:h(B)}:{op:n,path:V,value:h(B)})})}function c(y,S,C,R){let{base_:T,copy_:I}=y,k=0;T.forEach(_=>{if(!I.has(_)){let D=S.concat([k]);C.push({op:i,path:D,value:_}),R.unshift({op:o,path:D,value:_})}k++}),k=0,I.forEach(_=>{if(!T.has(_)){let D=S.concat([k]);C.push({op:o,path:D,value:_}),R.unshift({op:i,path:D,value:_})}k++})}function g(y,S,C){let{patches_:R,inversePatches_:T}=C;R.push({op:n,path:[],value:S===Ll?void 0:S}),T.push({op:n,path:[],value:y})}function v(y,S){return S.forEach(C=>{let{path:R,op:T}=C,I=y;for(let B=0;B<R.length-1;B++){let L=Jr(I),q=R[B];typeof q!="string"&&typeof q!="number"&&(q=""+q),(L===0||L===1)&&(q==="__proto__"||q===fi)&&Je(19),Xr(I)&&q===vi&&Je(19),I=ir(I,q),Wn(I)||Je(18,R.join("/"))}let k=Jr(I),_=E(C.value),D=R[R.length-1];switch(T){case n:switch(k){case 2:return I.set(D,_);case 3:Je(16);default:return I[D]=_}case o:switch(k){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(k){case 1:return I.splice(D,1);case 2:return I.delete(D);case 3:return I.delete(C.value);default:return delete I[D]}default:Je(17,T)}}),y}function E(y){if(!dt(y))return y;if(bi(y))return y.map(E);if(wi(y))return new Map(Array.from(y.entries()).map(([C,R])=>[C,E(R)]));if(Ai(y))return new Set(Array.from(y).map(E));let S=Object.create(Zr(y));for(let C in y)S[C]=E(y[C]);return pi(y,di)&&(S[di]=y[di]),S}function h(y){return lt(y)?E(y):y}lx(Ga,{applyPatches_:v,generatePatches_:a,generateReplacementPatches_:g,getPath:t})}var yi=new Sx,tn=yi.produce,Bl=yi.produceWithPatches.bind(yi);var Gl=yi.applyPatches.bind(yi);m();d();f();p();function bx(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function wx(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 Pm=e=>Array.isArray(e)?e:[e];function Ax(e){let t=Array.isArray(e[0])?e[0]:e;return wx(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function xx(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var Cx=class{constructor(e){this.value=e}deref(){return this.value}},Ex=()=>typeof WeakRef>"u"?Cx:WeakRef,Fm=Ex(),Rx=0,Nm=1;function Ya(){return{s:Rx,v:void 0,o:null,p:null}}function Ix(e){return e instanceof Fm?e.deref():e}function xi(e,t={}){let r=Ya(),{resultEqualityCheck:n}=t,o,i=0;function a(){let s=r,{length:l}=arguments;for(let v=0,E=l;v<E;v++){let h=arguments[v];if(typeof h=="function"||typeof h=="object"&&h!==null){let y=s.o;y===null&&(s.o=y=new WeakMap);let S=y.get(h);S===void 0?(s=Ya(),y.set(h,s)):s=S}else{let y=s.p;y===null&&(s.p=y=new Map);let S=y.get(h);S===void 0?(s=Ya(),y.set(h,s)):s=S}}let c=s,g;if(s.s===Nm)g=s.v;else if(g=e.apply(null,arguments),i++,n){let v=Ix(o);v!=null&&n(v,g)&&(g=v,i!==0&&i--),o=typeof g=="object"&&g!==null||typeof g=="function"?new Fm(g):g}return c.s=Nm,c.v=g,g}return a.clearCache=()=>{r=Ya(),a.resetResultsCount()},a.resultsCount=()=>i,a.resetResultsCount=()=>{i=0},a}function Tx(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,a=0,s,l={},c=o.pop();typeof c=="object"&&(l=c,c=o.pop()),bx(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);let g={...r,...l},{memoize:v,memoizeOptions:E=[],argsMemoize:h=xi,argsMemoizeOptions:y=[]}=g,S=Pm(E),C=Pm(y),R=Ax(o),T=v(function(){return i++,c.apply(null,arguments)},...S),I=!0,k=h(function(){a++;let D=xx(R,arguments);return s=T.apply(null,D),s},...C);return Object.assign(k,{resultFunc:c,memoizedResultFunc:T,dependencies:R,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>s,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var Be=Tx(xi);m();d();f();p();function Dm(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var Mm=Dm(),jm=Dm;var _x=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ui:ui.apply(null,arguments)},UM=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},kx=e=>e&&typeof e.match=="function";function N(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(pt(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=>li(n)&&n.type===e,r}var Qm=class Ci extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Ci.prototype)}static get[Symbol.species](){return Ci}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Ci(...t[0].concat(this)):new Ci(...t.concat(this))}};function qm(e){return dt(e)?tn(e,()=>{}):e}function Xa(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function Ox(e){return typeof e=="boolean"}var Px=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new Qm;return r&&(Ox(r)?a.push(Mm):a.push(jm(r.extraArgument))),a},Ei="RTK_autoBatch",Xn=()=>e=>({payload:e,meta:{[Ei]:!0}}),Lm=e=>t=>{setTimeout(t,e)},Nx=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(i),clearTimeout(a),r())},i=e(o),a=setTimeout(o,t)},Fx=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,a=!1,s=new Set,l=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?Nx(window.requestAnimationFrame,100):Lm(10):e.type==="callback"?e.queueNotification:Lm(e.timeout),c=()=>{a=!1,i&&(i=!1,s.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let v=()=>o&&g(),E=n.subscribe(v);return s.add(g),()=>{E(),s.delete(g)}},dispatch(g){try{return o=!g?.meta?.[Ei],i=!o,i&&(a||(a=!0,l(c))),n.dispatch(g)}finally{o=!0}}})},Dx=e=>function(r){let{autoBatch:n=!0}=r??{},o=new Qm(e);return n&&o.push(Fx(typeof n=="object"?n:void 0)),o};function Hm(e){let t=Px(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:a=void 0,enhancers:s=void 0}=e||{},l;if(typeof r=="function")l=r;else if(Qt(r))l=zn(r);else throw new Error(pt(1));let c;typeof n=="function"?c=n(t):c=t();let g=ui;o&&(g=_x({trace:!1,...(typeof o=="object"&&o)}));let v=gm(...c),E=Dx(v),h=typeof s=="function"?s(E):E(),y=g(...h);return kl(l,a,y)}function zm(e){let t={},r=[],n,o={addCase(i,a){let s=typeof i=="string"?i:i.type;if(!s)throw new Error(pt(28));if(s in t)throw new Error(pt(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 Mx(e){return typeof e=="function"}function Le(e,t){let[r,n,o]=zm(t),i;if(Mx(e))i=()=>qm(e());else{let s=qm(e);i=()=>s}function a(s=i(),l){let c=[r[l.type],...n.filter(({matcher:g})=>g(l)).map(({reducer:g})=>g)];return c.filter(g=>!!g).length===0&&(c=[o]),c.reduce((g,v)=>{if(v)if(lt(g)){let h=v(g,l);return h===void 0?g:h}else{if(dt(g))return tn(g,E=>v(E,l));{let E=v(g,l);if(E===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return E}}return g},s)}return a.getInitialState=i,a}var Wm=(e,t)=>kx(e)?e.match(t):e(t);function Ht(...e){return t=>e.some(r=>Wm(r,t))}function Yn(...e){return t=>e.every(r=>Wm(r,t))}function ts(e,t){if(!e||!e.meta)return!1;let r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function Ri(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function rs(...e){return e.length===0?t=>ts(t,["pending"]):Ri(e)?Ht(...e.map(t=>t.pending)):rs()(e[0])}function nn(...e){return e.length===0?t=>ts(t,["rejected"]):Ri(e)?Ht(...e.map(t=>t.rejected)):nn()(e[0])}function Ii(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Yn(nn(...e),t):Ri(e)?Yn(nn(...e),t):Ii()(e[0])}function sr(...e){return e.length===0?t=>ts(t,["fulfilled"]):Ri(e)?Ht(...e.map(t=>t.fulfilled)):sr()(e[0])}function ns(...e){return e.length===0?t=>ts(t,["pending","fulfilled","rejected"]):Ri(e)?Ht(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):ns()(e[0])}var jx="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Ti=(e=21)=>{let t="",r=e;for(;r--;)t+=jx[Math.random()*64|0];return t},qx=["name","message","stack","code"],$l=class{constructor(e,t){ie(this,"payload");ie(this,"meta");ie(this,"_type");this.payload=e,this.meta=t}},Um=class{constructor(e,t){ie(this,"payload");ie(this,"meta");ie(this,"_type");this.payload=e,this.meta=t}},Lx=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of qx)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},Vm="External signal was aborted",Re=(()=>{function e(t,r,n){let o=N(t+"/fulfilled",(l,c,g,v)=>({payload:l,meta:{...(v||{}),arg:g,requestId:c,requestStatus:"fulfilled"}})),i=N(t+"/pending",(l,c,g)=>({payload:void 0,meta:{...(g||{}),arg:c,requestId:l,requestStatus:"pending"}})),a=N(t+"/rejected",(l,c,g,v,E)=>({payload:v,error:(n&&n.serializeError||Lx)(l||"Rejected"),meta:{...(E||{}),arg:g,requestId:c,rejectedWithValue:!!v,requestStatus:"rejected",aborted:l?.name==="AbortError",condition:l?.name==="ConditionError"}}));function s(l,{signal:c}={}){return(g,v,E)=>{let h=n?.idGenerator?n.idGenerator(l):Ti(),y=new u.AbortController,S,C;function R(I){C=I,y.abort()}c&&(c.aborted?R(Vm):c.addEventListener("abort",()=>R(Vm),{once:!0}));let T=_asyncToGenerator(function*(){let I;try{let _=n?.condition?.(l,{getState:v,extra:E});if(Vx(_)&&(_=yield _),_===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let D=new Promise((B,L)=>{S=()=>{L({name:"AbortError",message:C||"Aborted"})},y.signal.addEventListener("abort",S,{once:!0})});g(i(h,l,n?.getPendingMeta?.({requestId:h,arg:l},{getState:v,extra:E}))),I=yield Promise.race([D,Promise.resolve(r(l,{dispatch:g,getState:v,extra:E,requestId:h,signal:y.signal,abort:R,rejectWithValue:(B,L)=>new $l(B,L),fulfillWithValue:(B,L)=>new Um(B,L)})).then(B=>{if(B instanceof $l)throw B;return B instanceof Um?o(B.payload,h,l,B.meta):o(B,h,l)})])}catch(_){I=_ instanceof $l?a(null,h,l,_.payload,_.meta):a(_,h,l)}finally{S&&y.signal.removeEventListener("abort",S)}return n&&!n.dispatchConditionRejection&&a.match(I)&&I.meta.condition||g(I),I})();return Object.assign(T,{abort:R,requestId:h,arg:l,unwrap(){return T.then(Ux)}})}}return Object.assign(s,{pending:i,rejected:a,fulfilled:o,settled:Ht(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function Ux(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Vx(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var Km=Symbol.for("rtk-slice-createasyncthunk"),BM={[Km]:Re};function Bx(e,t){return`${e}/${t}`}function Gx({creators:e}={}){let t=e?.asyncThunk?.[Km];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(pt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(Qx()):n.reducers)||{},s=Object.keys(a),l={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(I,k){let _=typeof I=="string"?I:I.type;if(!_)throw new Error(pt(12));if(_ in l.sliceCaseReducersByType)throw new Error(pt(13));return l.sliceCaseReducersByType[_]=k,c},addMatcher(I,k){return l.sliceMatchers.push({matcher:I,reducer:k}),c},exposeAction(I,k){return l.actionCreators[I]=k,c},exposeCaseReducer(I,k){return l.sliceCaseReducersByName[I]=k,c}};s.forEach(I=>{let k=a[I],_={reducerName:I,type:Bx(o,I),createNotation:typeof n.reducers=="function"};zx(k)?Kx(_,k,c,t):Hx(_,k,c)});function g(){let[I={},k=[],_=void 0]=typeof n.extraReducers=="function"?zm(n.extraReducers):[n.extraReducers],D={...I,...l.sliceCaseReducersByType};return Le(n.initialState,B=>{for(let L in D)B.addCase(L,D[L]);for(let L of l.sliceMatchers)B.addMatcher(L.matcher,L.reducer);for(let L of k)B.addMatcher(L.matcher,L.reducer);_&&B.addDefaultCase(_)})}let v=I=>I,E=new Map,h=new WeakMap,y;function S(I,k){return y||(y=g()),y(I,k)}function C(){return y||(y=g()),y.getInitialState()}function R(I,k=!1){function _(B){let L=B[I];return typeof L>"u"&&k&&(L=Xa(h,_,C)),L}function D(B=v){let L=Xa(E,k,()=>new WeakMap);return Xa(L,B,()=>{let q={};for(let[V,j]of Object.entries(n.selectors??{}))q[V]=$x(j,B,()=>Xa(h,B,C),k);return q})}return{reducerPath:I,getSelectors:D,get selectors(){return D(_)},selectSlice:_}}let T={name:o,reducer:S,actions:l.actionCreators,caseReducers:l.sliceCaseReducersByName,getInitialState:C,...R(i),injectInto(I,{reducerPath:k,..._}={}){let D=k??i;return I.inject({reducerPath:D,reducer:S},_),{...T,...R(D,!0)}}};return T}}function $x(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 on=Gx();function Qx(){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 Hx({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!Wx(n))throw new Error(pt(17));i=n.reducer,a=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?N(e,a):N(e))}function zx(e){return e._reducerDefinitionType==="asyncThunk"}function Wx(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Kx({type:e,reducerName:t},r,n,o){if(!o)throw new Error(pt(18));let{payloadCreator:i,fulfilled:a,pending:s,rejected:l,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),l&&n.addCase(v.rejected,l),c&&n.addMatcher(v.settled,c),n.exposeCaseReducer(t,{fulfilled:a||Za,pending:s||Za,rejected:l||Za,settled:c||Za})}function Za(){}var Yx="task",Ym="listener",Xm="completed",zl="cancelled",Xx=`task-${zl}`,Zx=`task-${Xm}`,Ql=`${Ym}-${zl}`,Jx=`${Ym}-${Xm}`,os=class{constructor(e){ie(this,"code");ie(this,"name","TaskAbortError");ie(this,"message");this.code=e,this.message=`${Yx} ${zl} (reason: ${e})`}},Wl=(e,t)=>{if(typeof e!="function")throw new TypeError(pt(32))},Ja=()=>{},Zm=(e,t=Ja)=>(e.catch(t),e),Jm=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),rn=e=>{if(e.aborted)throw new os(e.reason)};function eg(e,t){let r=Ja;return new Promise((n,o)=>{let i=()=>o(new os(e.reason));if(e.aborted){i();return}r=Jm(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=Ja})}var eC=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof os?"cancelled":"rejected",error:r}}finally{t?.()}});return function eC(_x5,_x6){return _ref5.apply(this,arguments)}}(),es=e=>t=>Zm(eg(e,t).then(r=>(rn(e),r))),tg=e=>{let t=es(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Kn}=Object,Bm={},is="listenerMiddleware",tC=(e,t)=>{let r=n=>Jm(e,()=>n.abort(e.reason));return(n,o)=>{Wl(n,"taskExecutor");let i=new u.AbortController;r(i);let a=eC(/*#__PURE__*/_asyncToGenerator(function*(){rn(e),rn(i.signal);let s=yield n({pause:es(i.signal),delay:tg(i.signal),signal:i.signal});return rn(i.signal),s}),()=>i.abort(Zx));return o?.autoJoin&&t.push(a.catch(Ja)),{result:es(e)(a),cancel(){i.abort(Xx)}}}},rC=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){rn(t);let i=()=>{},s=[new Promise((l,c)=>{let g=e({predicate:n,effect:(v,E)=>{E.unsubscribe(),l([v,E.getState(),E.getOriginalState()])}});i=()=>{g(),c()}})];o!=null&&s.push(new Promise(l=>setTimeout(l,o,null)));try{let l=yield eg(t,Promise.race(s));return rn(t),l}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>Zm(r(n,o))},rg=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=N(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(pt(21));return Wl(i,"options.listener"),{predicate:o,type:t,effect:i}},ng=Kn(e=>{let{type:t,predicate:r,effect:n}=rg(e);return{id:Ti(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(pt(22))}}},{withTypes:()=>ng}),Gm=(e,t)=>{let{type:r,effect:n,predicate:o}=rg(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},Hl=e=>{e.pending.forEach(t=>{t.abort(Ql)})},nC=(e,t)=>()=>{for(let r of t.keys())Hl(r);e.clear()},$m=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},og=Kn(N(`${is}/add`),{withTypes:()=>og}),oC=N(`${is}/removeAll`),ig=Kn(N(`${is}/remove`),{withTypes:()=>ig}),iC=(...e)=>{console.error(`${is}/error`,...e)},ag=(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=iC}=e;Wl(a,"onError");let s=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&Hl(h)}),l=h=>{let y=Gm(t,h)??ng(h);return s(y)};Kn(l,{withTypes:()=>l});let c=h=>{let y=Gm(t,h);return y&&(y.unsubscribe(),h.cancelActive&&Hl(y)),!!y};Kn(c,{withTypes:()=>c});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,S,C){let R=new u.AbortController,T=rC(l,R.signal),I=[];try{h.pending.add(R),n(h),yield Promise.resolve(h.effect(y,Kn({},S,{getOriginalState:C,condition:(k,_)=>T(k,_).then(Boolean),take:T,delay:tg(R.signal),pause:es(R.signal),extra:i,signal:R.signal,fork:tC(R.signal,I),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((k,_,D)=>{k!==R&&(k.abort(Ql),D.delete(k))})},cancel:()=>{R.abort(Ql),h.pending.delete(R)},throwIfCancelled:()=>{rn(R.signal)}})))}catch(k){k instanceof os||$m(a,k,{raisedBy:"effect"})}finally{yield Promise.all(I),R.abort(Jx),o(h),h.pending.delete(R)}});return function g(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),v=nC(t,r);return{middleware:h=>y=>S=>{if(!li(S))return y(S);if(og.match(S))return l(S.payload);if(oC.match(S)){v();return}if(ig.match(S))return c(S.payload);let C=h.getState(),R=()=>{if(C===Bm)throw new Error(pt(23));return C},T;try{if(T=y(S),t.size>0){let I=h.getState(),k=Array.from(t.values());for(let _ of k){let D=!1;try{D=_.predicate(S,I,C)}catch(B){D=!1,$m(a,B,{raisedBy:"predicate"})}D&&g(_,S,h,R)}}}finally{C=Bm}return T},startListening:l,stopListening:c,clearListeners:v}};function pt(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 Z=new z({required:!0,emptyAllowed:!1}),et=new z({required:!1,emptyAllowed:!1}),tt=new z({required:!0,emptyAllowed:!0}),ej=new z({required:!1,emptyAllowed:!0}),as=new ve({each:Z,required:!0}),sg=new z({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),cg=new z({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),tj=new z({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),cr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),Rt=(e,t)=>{if("required"in t)return{payload:new mt({value:t}).validate({value:e}).value};let o=new ne({options:{required:!0},values:t}).validate(e);if(o)throw new oi(o);return{payload:e}},$=(e,t)=>{try{return Rt(e,t)}catch(r){return{payload:e,error:cr(r)}}},ug=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return dg(e,t,r,o,"Controller initialization error")},lg=(e,t,r,n)=>{let o=`Check the options of ${n}`;return dg(e,t,r,o,"Controller initialization error")},dg=(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 Zn="3.51.4",pg=["@coveo/atomic","@coveo/quantic"];var Kl=()=>et,fg=()=>Z,Cr=N("configuration/updateBasicConfiguration",e=>$(e,{accessToken:et,environment:new z({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:et})),zt=N("configuration/updateSearchConfiguration",e=>$(e,{proxyBaseUrl:new z({required:!1,url:!0}),pipeline:new z({required:!1,emptyAllowed:!0}),searchHub:et,timezone:et,locale:et,authenticationProviders:new ve({required:!1,each:Z})})),aC={enabled:new me({default:!0}),originContext:Kl(),originLevel2:Kl(),originLevel3:Kl(),proxyBaseUrl:new z({required:!1,url:!0}),runtimeEnvironment:new Fe,anonymous:new me({default:!1}),deviceId:et,userDisplayName:et,documentLocation:et,trackingId:cg,analyticsMode:new z({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new ne({options:{required:!1},values:pg.reduce((e,t)=>(e[t]=sg,e),{})})},Jn=N("configuration/updateAnalyticsConfiguration",e=>$(e,aC)),eo=N("configuration/analytics/disable"),to=N("configuration/analytics/enable"),ss=N("configuration/analytics/originlevel2",e=>$(e,{originLevel2:fg()})),cs=N("configuration/analytics/originlevel3",e=>$(e,{originLevel3:fg()})),mg=N("knowledge/setAgentId",e=>$(e,new z({required:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var gg={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 Er=N("searchParameters/restore",e=>$(e,gg)),hg=N("searchParameters/restoreTab",e=>$(e,Z));m();d();f();p();var us=N("debug/enable"),ls=N("debug/disable");m();d();f();p();var ds=()=>!1;var ps=Le(ds(),e=>{e.addCase(us,()=>!0).addCase(ls,()=>!1).addCase(Er,(t,r)=>r.payload.debug??t)});m();d();f();p();var ro=N("pipeline/set",e=>$(e,new z({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();var sC=N("history/undo"),cC=N("history/redo"),Wt=N("history/snapshot"),lq=Re("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(sC()),yield t(ht())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),dq=Re("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(cC()),yield t(ht())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),ht=Re("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 no=()=>"";var oo=Le(no(),e=>{e.addCase(ro,(t,r)=>r.payload).addCase(ht.fulfilled,(t,r)=>r.payload?.pipeline??t).addCase(zt,(t,r)=>r.payload.pipeline||t)});m();d();f();p();m();d();f();p();var fs=N("app/setError");m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var io=class e{static set(t,r,n){let o,i,a;n&&(i=new Date,i.setTime(i.getTime()+n));let s=window.location.hostname,l=/^(\d{1,3}\.){3}\d{1,3}$/,c=/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/;l.test(s)||c.test(s)||s.indexOf(".")===-1?Yl(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],Yl(t,r,i,o))}static get(t){let r=t+"=",n=document.cookie.split(";");for(let o=0;o<n.length;o++){let 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 Yl(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}m();d();f();p();function uC(){return typeof navigator<"u"}function yg(){try{return typeof localStorage<"u"}catch{return!1}}function vg(){try{return typeof sessionStorage<"u"}catch{return!1}}function Sg(){return!!(uC()&&navigator.cookieEnabled)}var bg=null;function wg(){return bg||(yg()?localStorage:Sg()?new Xl:vg()?sessionStorage:new Zl)}var ao=class ao{getItem(t){return io.get(`${ao.prefix}${t}`)}removeItem(t){io.erase(`${ao.prefix}${t}`)}setItem(t,r,n){io.set(`${ao.prefix}${t}`,r,n)}};ie(ao,"prefix","coveo_");var Xl=ao;var Zl=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var ms="__coveo.analytics.history",lC=20,dC=1e3*60,pC=75,an=class an{constructor(t){ie(this,"store");this.store=t||wg()}static getInstance(t){return an.instance||(an.instance=new an(t)),an.instance}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!==null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _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(ms);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this1=this;return _asyncToGenerator(function*(){try{let t=yield _this1.store.getItem(ms);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(ms,JSON.stringify(t.slice(0,lC)))}catch{}}clear(){try{this.store.removeItem(ms)}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)>dC:!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))}};ie(an,"instance",null);var Jl=an,It=Jl;m();d();f();p();m();d();f();p();var so=Be(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Zn}`));m();d();f();p();m();d();f();p();function ur(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(g){try{c(n.next(g))}catch(v){a(v)}}function l(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,l)}c((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 rd(){return typeof window<"u"}function gd(){return typeof navigator<"u"}function co(){return typeof document<"u"}function nd(){try{return typeof localStorage<"u"}catch{return!1}}function fC(){try{return typeof sessionStorage<"u"}catch{return!1}}function Dg(){return gd()&&navigator.cookieEnabled}var mC=[Ae.click,Ae.custom,Ae.search,Ae.view],gC=(e,t)=>mC.indexOf(e)!==-1?Object.assign({language:co()?document.documentElement.lang:"unknown",userAgent:gd()?navigator.userAgent:"unknown"},t):t,ki=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?Ag(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],Ag(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 Ag(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function hC(){return nd()?localStorage:Dg()?new Oi:fC()?sessionStorage:new lo}var Oi=class e{getItem(t){return ki.get(`${e.prefix}${t}`)}removeItem(t){ki.erase(`${e.prefix}${t}`)}setItem(t,r,n){ki.set(`${e.prefix}${t}`,r,n)}};Oi.prefix="coveo_";var od=class{constructor(){this.cookieStorage=new Oi}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)}},lo=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},gs="__coveo.analytics.history",yC=20,vC=1e3*60,SC=75,vs=class{constructor(t){this.store=t||hC()}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(gs);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(gs);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(gs,JSON.stringify(t.slice(0,yC)))}catch{}}clear(){try{this.store.removeItem(gs)}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,SC)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>vC:!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 bC=(e,t)=>U(void 0,void 0,void 0,function*(){return e===Ae.view?(yield wC(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),wC=e=>U(void 0,void 0,void 0,function*(){let t=new vs,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),hs,AC=new Uint8Array(16);function xC(){if(!hs&&(hs=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!hs))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return hs(AC)}var CC=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Ss(e){return typeof e=="string"&&CC.test(e)}var rt=[];for(let e=0;e<256;++e)rt.push((e+256).toString(16).slice(1));function Mg(e,t=0){return rt[e[t+0]]+rt[e[t+1]]+rt[e[t+2]]+rt[e[t+3]]+"-"+rt[e[t+4]]+rt[e[t+5]]+"-"+rt[e[t+6]]+rt[e[t+7]]+"-"+rt[e[t+8]]+rt[e[t+9]]+"-"+rt[e[t+10]]+rt[e[t+11]]+rt[e[t+12]]+rt[e[t+13]]+rt[e[t+14]]+rt[e[t+15]]}function EC(e){if(!Ss(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}function RC(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var IC="6ba7b810-9dad-11d1-80b4-00c04fd430c8",TC="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function _C(e,t,r){function n(o,i,a,s){var l;if(typeof o=="string"&&(o=RC(o)),typeof i=="string"&&(i=EC(i)),((l=i)===null||l===void 0?void 0:l.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+o.length);if(c.set(i),c.set(o,i.length),c=r(c),c[6]=c[6]&15|t,c[8]=c[8]&63|128,a){s=s||0;for(let g=0;g<16;++g)a[s+g]=c[g];return a}return Mg(c)}try{n.name=e}catch{}return n.DNS=IC,n.URL=TC,n}var kC=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),xg={randomUUID:kC};function sn(e,t,r){if(xg.randomUUID&&!t&&!e)return xg.randomUUID();e=e||{};let n=e.random||(e.rng||xC)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let o=0;o<16;++o)t[r+o]=n[o];return t}return Mg(n)}function OC(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 ed(e,t){return e<<t|e>>>32-t}function PC(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let a=unescape(encodeURIComponent(e));e=[];for(let s=0;s<a.length;++s)e.push(a.charCodeAt(s))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,o=Math.ceil(n/16),i=new Array(o);for(let a=0;a<o;++a){let s=new Uint32Array(16);for(let l=0;l<16;++l)s[l]=e[a*64+l*4]<<24|e[a*64+l*4+1]<<16|e[a*64+l*4+2]<<8|e[a*64+l*4+3];i[a]=s}i[o-1][14]=(e.length-1)*8/Math.pow(2,32),i[o-1][14]=Math.floor(i[o-1][14]),i[o-1][15]=(e.length-1)*8&4294967295;for(let a=0;a<o;++a){let s=new Uint32Array(80);for(let h=0;h<16;++h)s[h]=i[a][h];for(let h=16;h<80;++h)s[h]=ed(s[h-3]^s[h-8]^s[h-14]^s[h-16],1);let l=r[0],c=r[1],g=r[2],v=r[3],E=r[4];for(let h=0;h<80;++h){let y=Math.floor(h/20),S=ed(l,5)+OC(y,c,g,v)+E+t[y]+s[h]>>>0;E=v,v=g,g=ed(c,30)>>>0,c=l,l=S}r[0]=r[0]+l>>>0,r[1]=r[1]+c>>>0,r[2]=r[2]+g>>>0,r[3]=r[3]+v>>>0,r[4]=r[4]+E>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var NC=_C("v5",80,PC),Cg=NC,jg="2.30.56",Eg=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,_i={pageview:"pageview",event:"event"},bs=class{constructor({client:t,uuidGenerator:r=sn}){this.client=t,this.uuidGenerator=r}},id=class extends bs{constructor({client:t,uuidGenerator:r=sn}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=Eg(window.location),this.lastReferrer=co()?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:co()?document.title:"",encoding:co()?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===_i.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===_i.pageview?this.nextPageViewId:this.pageViewId,referrer:t===_i.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===_i.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 Eg(window.location)}},Rr=class e{constructor(t,r){if(!Ss(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 Ss(i)?new e(i,Number.parseInt(o)*1e3):null}};Rr.cvo_cid="cvo_cid";Rr.expirationTime=120;var ad=class extends bs{constructor({client:t,uuidGenerator:r=sn}){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(Rr.cvo_cid,new Rr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};ad.Id="link";var _t=Object.keys;function ys(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var td=128,qg=192,Rg=224,Ig=240;function FC(e){return(e&248)===Ig?4:(e&Ig)===Rg?3:(e&Rg)===qg?2:1}function DC(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&td)!=td)break;if(r-=3,(n&qg)!=td){t-r>=FC(n)*3&&(r=t);break}}return e.substring(0,r)}var sd={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"},MC=_t(sd).map(e=>sd[e]),jC=[...MC].join("|"),qC=new RegExp(`^(${jC}$)`),LC={svcAction:"svc_action",svcActionData:"svc_action_data"},UC=e=>_t(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=sd[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),VC=e=>qC.test(e),BC=[VC],Tg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},_g={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},st={action:"pa",list:"pal",listSource:"pls"},ws={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},GC=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],cd={id:"quoteId",affiliation:"quoteAffiliation"},ud={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},$C={add:st,bookmark_add:st,bookmark_remove:st,click:st,checkout:st,checkout_option:st,detail:st,impression:st,remove:st,refund:Object.assign(Object.assign({},st),ws),purchase:Object.assign(Object.assign({},st),ws),quickview:st,quote:Object.assign(Object.assign({},st),cd),review:Object.assign(Object.assign({},st),ud)},QC=_t(Tg).map(e=>Tg[e]),HC=_t(_g).map(e=>_g[e]),zC=_t(st).map(e=>st[e]),WC=_t(ws).map(e=>ws[e]),KC=_t(ud).map(e=>ud[e]),YC=_t(cd).map(e=>cd[e]),XC=[...QC,"custom"].join("|"),ZC=[...HC,"custom"].join("|"),Lg="(pr[0-9]+)",Ug="(il[0-9]+pi[0-9]+)",JC=new RegExp(`^${Lg}(${XC})$`),eE=new RegExp(`^(${Ug}(${ZC}))|(il[0-9]+nm)$`),tE=new RegExp(`^(${zC.join("|")})$`),rE=new RegExp(`^(${WC.join("|")})$`),nE=new RegExp(`^${Lg}custom$`),oE=new RegExp(`^${Ug}custom$`),iE=new RegExp(`^(${[...GC,...KC,...YC].join("|")})$`),aE=e=>JC.test(e),sE=e=>eE.test(e),cE=e=>tE.test(e),uE=e=>rE.test(e),lE=e=>iE.test(e),dE=[sE,aE,cE,uE,lE],pE=[nE,oE],fE={anonymizeIp:"aip"},mE={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},gE={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},hE=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],yE=Object.assign(Object.assign(Object.assign(Object.assign({},fE),mE),gE),hE.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),ld=Object.assign(Object.assign({},yE),LC),vE=e=>{let t=!!e.action&&$C[e.action]||{};return _t(e).reduce((r,n)=>{let o=t[n]||ld[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},SE=_t(ld).map(e=>ld[e]),bE=e=>SE.indexOf(e)!==-1,wE=e=>e==="custom",AE=e=>[...dE,...BC,bE,wE].some(t=>t(e)),xE=e=>_t(e).reduce((t,r)=>{let n=CE(r);return n?Object.assign(Object.assign({},t),EE(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),CE=e=>{let t;return[...pE].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},EE=(e,t)=>_t(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),dd=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),l=this.encodeForEventType(t,s),c=new Blob([l],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(a,c)})}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:l}=a;o=s||t;try{i=JSON.parse(l)}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 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}},pd=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()})}},kg=b.fetch,As=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)},l=Object.assign(Object.assign({},s),i?yield i(s,"analyticsFetch"):{}),{url:c}=l,g=ur(l,["url"]),v;try{v=yield kg(c,g)}catch(E){console.error("An error has occured when sending the event.",E);return}if(v.ok){let E=yield v.json();return E.visitorId&&o.setCurrentVisitorId(E.visitorId),E}else{try{v.json()}catch{}throw console.error(`An error has occured when sending the "${t}" event.`,v,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield kg(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"})}},fd=class{constructor(t,r){nd()&&Dg()?this.storage=new od:nd()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new lo),this.client=new As(t),this.beaconClient=new dd(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}},md=class{constructor(t,r){this.storage=r||new lo,this.client=new As(t)}getClientDependingOnEventType(t){return this.client}},xs=class{constructor(){this.storage=new lo,this.client=new pd}getClientDependingOnEventType(t){return this.client}},RE="xx",IE=e=>e?.startsWith(RE)||!1,TE=`
|
|
27
|
+
`;return new oi(r)}var oi=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},mt=class{constructor(e){ie(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 uA(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}},Fe=class{constructor(e={}){ie(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 Xe(e){return e===void 0}function lA(e){return e===null}function ce(e){return Xe(e)||lA(e)}var me=class{constructor(e={}){ie(this,"value");this.value=new Fe(e)}validate(e){let t=this.value.validate(e);return t||(dA(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function dA(e){return Xe(e)||Bf(e)}function Bf(e){return typeof e=="boolean"}var oe=class{constructor(e={}){ie(this,"config");ie(this,"value");this.config=e,this.value=new Fe(e)}validate(e){let t=this.value.validate(e);return t||(pA(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 pA(e){return Xe(e)||Gf(e)}function Gf(e){return typeof e=="number"&&!Number.isNaN(e)}var fA=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,z=class{constructor(e={}){ie(this,"value");ie(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Fe(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(Xe(e))return null;if(!Ra(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&&!(fA.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 Ra(e){return Object.prototype.toString.call(e)==="[object String]"}var ne=class{constructor(e={}){ie(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Xe(e))return this.config.options.required?"value is required and is currently undefined":null;if(!$f(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ce(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],i=n.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function $f(e){return e!==void 0&&typeof e=="object"}var ve=class{constructor(e={}){ie(this,"config");ie(this,"value");this.config=e,this.value=new Fe(this.config)}validate(e){if(!ce(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ce(e))return null;if(this.config.max!==void 0&&e.length>this.config.max)return`value contains more than ${this.config.max}`;if(this.config.min!==void 0&&e.length<this.config.min)return`value contains less than ${this.config.min}`;if(this.config.each!==void 0){let r="";return e.forEach(n=>{this.config.each.required&&ce(n)&&(r=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(n,this.config.each);o!==null&&(r+=` ${o}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return Bf(e)||Ra(e)||Gf(e)||$f(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Qf(e){return Array.isArray(e)}var vl=class{constructor(e){ie(this,"config");ie(this,"value");this.config=e,this.value=new Fe(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Xe(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 Hf(e){return Array.isArray(e)}function Ia(e){return e.trim()===""}var mA=new Set(["1",1,"yes",!0]);function zf(){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=>mA.has(r))}function Wf(e){let t={};for(let[r,n]of e)t[r]=n;return t}function ii(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Ta(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 gA(e){if(Ia(e.openingDelimiter)||Ia(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(ce(e.content)||Ia(e.content))return e.content;if(e.highlights.length===0)return $n(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+=$n(e.content.slice(n,a)),r+=e.openingDelimiter,r+=$n(e.content.slice(a,s)),r+=e.closingDelimiter,n=s}return n!==t&&(r+=$n(e.content.slice(n))),r}function hA(e,t){return e=$n(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?Sl(n,t.notMatchDelimiters):o?Sl(o,t.exactMatchDelimiters):i?Sl(i,t.correctionDelimiters):r)}function Sl(e,t){return t?t.open+e+t.close:e}function $n(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 am=Mt(rm(),1);m();d();f();p();var Gt=new Error("Failed to load reducers."),Qn=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."}},Yr=class extends Error{constructor(r,n){super();ie(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 nm(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function om(e){return typeof e!="object"||!e?!1:Object.values(e).every(BA)}function BA(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function im(e){return e===429}var qt=class e{static call(t){return _asyncToGenerator(function*(){let r=GA(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 l=yield w(i,a);if(im(l.status))throw l;return l});return function s(){return _ref.apply(this,arguments)}}();try{let l=yield(0,am.backOff)(s,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(c){let g=c&&im(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(l.status){case 419:case 401:throw n.info("Platform renewing token"),new Qn;case 404:throw new Yr(i,l.status);default:return n.info({response:l,requestInfo:o},"Platform response"),l}}catch(l){return l.message==="Failed to fetch"?new Yr(i):l}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:s,...l}=t,c=ii(l);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 Et(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Hn(e,t,r="prod"){return e??Et(t,r)}function br(e,t="prod"){return`${Et(e,t)}/rest/search/v2`}function ka(e,t="prod"){return`${Et(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function GA(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,s=e.method==="POST"||e.method==="PUT",l=$A(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(s&&{body:l}),signal:a}}function $A(e,t){return t==="application/x-www-form-urlencoded"?om(e)?nm(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();var Oa=e=>e;m();d();f();p();m();d();f();p();function Pa(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function $t(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Pa(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Pa(),extendedResults:{},searchAction:void 0}}m();d();f();p();function wr(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Ar=e=>{let{response:t}=e;return t.body?QA(e):HA(t)},QA=e=>WA(e)?KA(e):zA(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},HA=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function zA(e){return e.body.statusCode!==void 0}function WA(e){return e.body.exception!==void 0}var KA=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();var xr=class{constructor(){ie(this,"currentAbortController",null)}enqueue(t,r){var _this=this;return _asyncToGenerator(function*(){let n=_this.currentAbortController;_this.currentAbortController=new u.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 ci=class{constructor(t){ie(this,"_basePath");ie(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 sm(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var or=(e,t,r,n)=>{let o=new ci(`${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 cm=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield qt.call({...or(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:wr(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=sm(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return YA(a)?{success:a}:{error:Ar({response:r,body:a})}});return function cm(_x3,_x4){return _ref3.apply(this,arguments)}}();function YA(e){return typeof e=="string"}m();d();f();p();function XA(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function ZA(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Na(e,t){if(t&&e.name==="AbortError")return{error:ZA(e)};if(e instanceof Yr)return{error:XA(e)};throw e}var Fa=class{constructor(t){ie(this,"options",t);ie(this,"apiCallsQueues",{unknown:new xr,mainSearch:new xr,facetValues:new xr,foldingCollection:new xr,instantResults:new xr})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield qt.call({...or(t,"POST","application/json","/plan"),requestParams:wr(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return Na(r);let n=yield r.json();return ex(n)?{success:n}:{error:Ar({response:r,body:n})}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield qt.call({...or(t,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:wr(t),..._this3.options});if(r instanceof Error)return Na(r);let n=yield r.json(),o={response:r,body:n};return JA(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:Ar(o)}})()}search(t,r){var _this4=this;return _asyncToGenerator(function*(){let n=r?.origin??"unknown",o=yield _this4.apiCallsQueues[n].enqueue(s=>qt.call({...or(t,"POST","application/json",""),requestParams:wr(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 Na(o,r?.disableAbortWarning);let i=yield o.json(),a={response:o,body:i};return um(i)?(a.body=lm(i),{success:(yield _this4.options.postprocessSearchResponseMiddleware(a)).body}):{error:Ar(a)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield qt.call({...or(t,"POST","application/json","/facet"),requestParams:wr(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 qt.call({...or(t,"POST","application/json",""),requestParams:wr(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if(um(n)){let o={response:r,body:n};return o.body=lm(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:Ar({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return cm(t,{..._this7.options})})()}fieldDescriptions(t){var _this8=this;return _asyncToGenerator(function*(){let r=yield qt.call({...or(t,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},..._this8.options});if(r instanceof Error)throw r;let n=yield r.json();return tx(n)?{success:n}:{error:Ar({response:r,body:n})}})()}},Da=e=>e.success!==void 0,gt=e=>e.error!==void 0;function um(e){return e.results!==void 0}function lm(e){let t=Pa();return ce(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function JA(e){return e.completions!==void 0}function ex(e){return e.preprocessingOutput!==void 0}function tx(e){return e.fields!==void 0}m();d();f();p();var dm=e=>e,pm=e=>e,fm=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();function Ze(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 rx=typeof Symbol=="function"&&Symbol.observable||"@@observable",mm=rx,_l=()=>Math.random().toString(36).substring(7).split("").join("."),nx={INIT:`@@redux/INIT${_l()}`,REPLACE:`@@redux/REPLACE${_l()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${_l()}`},Ma=nx;function Qt(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 kl(e,t,r){if(typeof e!="function")throw new Error(Ze(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ze(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ze(1));return r(kl)(e,t)}let n=e,o=t,i=new Map,a=i,s=0,l=!1;function c(){a===i&&(a=new Map,i.forEach((C,R)=>{a.set(R,C)}))}function g(){if(l)throw new Error(Ze(3));return o}function v(C){if(typeof C!="function")throw new Error(Ze(4));if(l)throw new Error(Ze(5));let R=!0;c();let T=s++;return a.set(T,C),function(){if(R){if(l)throw new Error(Ze(6));R=!1,c(),a.delete(T),i=null}}}function E(C){if(!Qt(C))throw new Error(Ze(7));if(typeof C.type>"u")throw new Error(Ze(8));if(typeof C.type!="string")throw new Error(Ze(17));if(l)throw new Error(Ze(9));try{l=!0,o=n(o,C)}finally{l=!1}return(i=a).forEach(T=>{T()}),C}function h(C){if(typeof C!="function")throw new Error(Ze(10));n=C,E({type:Ma.REPLACE})}function y(){let C=v;return{subscribe(R){if(typeof R!="object"||R===null)throw new Error(Ze(11));function T(){let k=R;k.next&&k.next(g())}return T(),{unsubscribe:C(T)}},[mm](){return this}}}return E({type:Ma.INIT}),{dispatch:E,subscribe:v,getState:g,replaceReducer:h,[mm]:y}}function ox(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Ma.INIT})>"u")throw new Error(Ze(12));if(typeof r(void 0,{type:Ma.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ze(13))})}function zn(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{ox(r)}catch(a){i=a}return function(s={},l){if(i)throw i;let c=!1,g={};for(let v=0;v<n.length;v++){let E=n[v],h=r[E],y=s[E],S=h(y,l);if(typeof S>"u"){let C=l&&l.type;throw new Error(Ze(14))}g[E]=S,c=c||S!==y}return c=c||n.length!==Object.keys(s).length,c?g:s}}function ui(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function gm(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(Ze(15))},a={getState:o.getState,dispatch:(l,...c)=>i(l,...c)},s=e.map(l=>l(a));return i=ui(...s)(o.dispatch),{...o,dispatch:i}}}function li(e){return Qt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var Ll=Symbol.for("immer-nothing"),di=Symbol.for("immer-draftable"),ze=Symbol.for("immer-state");function Je(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var wt=Object,Zr=wt.getPrototypeOf,fi="constructor",vi="prototype",Nl="configurable",Ua="enumerable",ja="writable",mi="value",lt=e=>!!e&&!!e[ze];function dt(e){return e?xm(e)||bi(e)||!!e[di]||!!e[fi]?.[di]||wi(e)||Ai(e):!1}var ix=wt[vi][fi].toString(),hm=new WeakMap;function xm(e){if(!e||!Wn(e))return!1;let t=Zr(e);if(t===null||t===wt[vi])return!0;let r=wt.hasOwnProperty.call(t,fi)&&t[fi];if(r===Object)return!0;if(!Xr(r))return!1;let n=hm.get(r);return n===void 0&&(n=Function.toString.call(r),hm.set(r,n)),n===ix}function Cm(e){return lt(e)||Je(15,e),e[ze].base_}function Si(e,t,r=!0){Jr(e)===0?(r?Reflect.ownKeys(e):wt.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function Jr(e){let t=e[ze];return t?t.type_:bi(e)?1:wi(e)?2:Ai(e)?3:0}var pi=(e,t,r=Jr(e))=>r===2?e.has(t):wt[vi].hasOwnProperty.call(e,t),ir=(e,t,r=Jr(e))=>r===2?e.get(t):e[t],Va=(e,t,r,n=Jr(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function ax(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var bi=Array.isArray,wi=e=>e instanceof Map,Ai=e=>e instanceof Set,Wn=e=>typeof e=="object",Xr=e=>typeof e=="function",Ol=e=>typeof e=="boolean";function sx(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var cx=e=>Wn(e)?e?.[ze]:null,ar=e=>e.copy_||e.base_;var Ul=e=>e.modified_?e.copy_:e.base_;function Fl(e,t){if(wi(e))return new Map(e);if(Ai(e))return new Set(e);if(bi(e))return Array[vi].slice.call(e);let r=xm(e);if(t===!0||t==="class_only"&&!r){let n=wt.getOwnPropertyDescriptors(e);delete n[ze];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],s=n[a];s[ja]===!1&&(s[ja]=!0,s[Nl]=!0),(s.get||s.set)&&(n[a]={[Nl]:!0,[ja]:!0,[Ua]:s[Ua],[mi]:e[a]})}return wt.create(Zr(e),n)}else{let n=Zr(e);if(n!==null&&r)return{...e};let o=wt.create(n);return wt.assign(o,e)}}function Vl(e,t=!1){return za(e)||lt(e)||!dt(e)||(Jr(e)>1&&wt.defineProperties(e,{set:qa,add:qa,clear:qa,delete:qa}),wt.freeze(e),t&&Si(e,(r,n)=>{Vl(n,!0)},!1)),e}function ux(){Je(2)}var qa={[mi]:ux};function za(e){return e===null||!Wn(e)?!0:wt.isFrozen(e)}var Ba="MapSet",Ga="Patches",ym="ArrayMethods",$a={};function en(e){let t=$a[e];return t||Je(0,e),t}var vm=e=>!!$a[e];function lx(e,t){$a[e]||($a[e]=t)}var gi,Em=()=>gi,dx=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:vm(Ba)?en(Ba):void 0,arrayMethodsPlugin_:vm(ym)?en(ym):void 0});function Sm(e,t){t&&(e.patchPlugin_=en(Ga),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Dl(e){Ml(e),e.drafts_.forEach(px),e.drafts_=null}function Ml(e){e===gi&&(gi=e.parent_)}var bm=e=>gi=dx(gi,e);function px(e){let t=e[ze];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function wm(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[ze].modified_&&(Dl(t),Je(4)),dt(e)&&(e=Am(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[ze].base_,e,t)}else e=Am(t,r);return fx(t,e,!0),Dl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ll?e:void 0}function Am(e,t){if(za(t))return t;let r=t[ze];if(!r)return Qa(t,e.handledSet_,e);if(!Wa(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);Tm(r,e)}return r.copy_}function fx(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Vl(t,r)}function Rm(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Wa=(e,t)=>e.scope_===t,mx=[];function Im(e,t,r,n){let o=ar(e),i=e.type_;if(n!==void 0&&ir(o,n,i)===t){Va(o,n,r,i);return}if(!e.draftLocations_){let s=e.draftLocations_=new Map;Si(o,(l,c)=>{if(lt(c)){let g=s.get(c)||[];g.push(l),s.set(c,g)}})}let a=e.draftLocations_.get(t)??mx;for(let s of a)Va(o,s,r,i)}function gx(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!Wa(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let a=Ul(i);Im(e,i.draft_??i,a,r),Tm(i,o)})}function Tm(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)}Rm(e)}}function hx(e,t,r){let{scope_:n}=e;if(lt(r)){let o=r[ze];Wa(o,n)&&o.callbacks_.push(function(){La(e);let a=Ul(o);Im(e,r,a,t)})}else dt(r)&&e.callbacks_.push(function(){let i=ar(e);e.type_===3?i.has(r)&&Qa(r,n.handledSet_,n):ir(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Qa(ir(e.copy_,t,e.type_),n.handledSet_,n)})}function Qa(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||lt(e)||t.has(e)||!dt(e)||za(e)||(t.add(e),Si(e,(n,o)=>{if(lt(o)){let i=o[ze];if(Wa(i,r)){let a=Ul(i);Va(e,n,a,e.type_),Rm(i)}}else dt(o)&&Qa(o,t,r)})),e}function yx(e,t){let r=bi(e),n={type_:r?1:0,scope_:t?t.scope_:Em(),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=Ha;r&&(o=[n],i=hi);let{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,[s,n]}var Ha={get(e,t){if(t===ze)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=ar(e);if(!pi(o,t,e.type_))return vx(e,o,t);let i=o[t];if(e.finalized_||!dt(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&sx(t))return i;if(i===Pl(e.base_,t)){La(e);let a=e.type_===1?+t:t,s=jl(e.scope_,i,e,a);return e.copy_[a]=s}return i},has(e,t){return t in ar(e)},ownKeys(e){return Reflect.ownKeys(ar(e))},set(e,t,r){let n=_m(ar(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Pl(ar(e),t),i=o?.[ze];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(ax(r,o)&&(r!==void 0||pi(e.base_,t,e.type_)))return!0;La(e),ql(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),hx(e,t,r)),!0},deleteProperty(e,t){return La(e),Pl(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),ql(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=ar(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[ja]:!0,[Nl]:e.type_!==1||t!=="length",[Ua]:n[Ua],[mi]:r[t]}},defineProperty(){Je(11)},getPrototypeOf(e){return Zr(e.base_)},setPrototypeOf(){Je(12)}},hi={};for(let e in Ha){let t=Ha[e];hi[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}hi.deleteProperty=function(e,t){return hi.set.call(this,e,t,void 0)};hi.set=function(e,t,r){return Ha.set.call(this,e[0],t,r,e[0])};function Pl(e,t){let r=e[ze];return(r?ar(r):e)[t]}function vx(e,t,r){let n=_m(t,r);return n?mi in n?n[mi]:n.get?.call(e.draft_):void 0}function _m(e,t){if(!(t in e))return;let r=Zr(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Zr(r)}}function ql(e){e.modified_||(e.modified_=!0,e.parent_&&ql(e.parent_))}function La(e){e.copy_||(e.assigned_=new Map,e.copy_=Fl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Sx=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Xr(t)&&!Xr(r)){let i=r;r=t;let a=this;return function(l=i,...c){return a.produce(l,g=>r.call(this,g,...c))}}Xr(r)||Je(6),n!==void 0&&!Xr(n)&&Je(7);let o;if(dt(t)){let i=bm(this),a=jl(i,t,void 0),s=!0;try{o=r(a),s=!1}finally{s?Dl(i):Ml(i)}return Sm(i,n),wm(o,i)}else if(!t||!Wn(t)){if(o=r(t),o===void 0&&(o=t),o===Ll&&(o=void 0),this.autoFreeze_&&Vl(o,!0),n){let i=[],a=[];en(Ga).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:a}),n(i,a)}return o}else Je(1,t)},this.produceWithPatches=(t,r)=>{if(Xr(t))return(a,...s)=>this.produceWithPatches(a,l=>t(l,...s));let n,o;return[this.produce(t,r,(a,s)=>{n=a,o=s}),n,o]},Ol(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Ol(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Ol(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){dt(e)||Je(8),lt(e)&&(e=Ka(e));let t=bm(this),r=jl(t,e,void 0);return r[ze].isManual_=!0,Ml(t),r}finishDraft(e,t){let r=e&&e[ze];(!r||!r.isManual_)&&Je(9);let{scope_:n}=r;return Sm(n,t),wm(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=en(Ga).applyPatches_;return lt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function jl(e,t,r,n){let[o,i]=wi(t)?en(Ba).proxyMap_(t,r):Ai(t)?en(Ba).proxySet_(t,r):yx(t,r);return(r?.scope_??Em()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?gx(r,i,n):i.callbacks_.push(function(l){l.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:c}=l;i.modified_&&c&&c.generatePatches_(i,[],l)}),o}function Ka(e){return lt(e)||Je(10,e),km(e)}function km(e){if(!dt(e)||za(e))return e;let t=e[ze],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Fl(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Fl(e,!0);return Si(r,(o,i)=>{Va(r,o,km(i))},n),t&&(t.finalized_=!1),r}function Om(){function t(y,S=[]){if(y.key_!==void 0){let C=y.parent_.copy_??y.parent_.base_,R=cx(ir(C,y.key_)),T=ir(C,y.key_);if(T===void 0||T!==y.draft_&&T!==y.base_&&T!==y.copy_||R!=null&&R.base_!==y.base_)return null;let I=y.parent_.type_===3,k;if(I){let _=y.parent_;k=Array.from(_.drafts_.keys()).indexOf(y.key_)}else k=y.key_;if(!(I&&C.size>k||pi(C,k)))return null;S.push(k)}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 C=y;for(let R=0;R<S.length-1;R++){let T=S[R];if(C=ir(C,T),!Wn(C)||C===null)throw new Error(`Cannot resolve path at '${S.join("/")}'`)}return C}let n="replace",o="add",i="remove";function a(y,S,C){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:R,inversePatches_:T}=C;switch(y.type_){case 0:case 2:return l(y,S,R,T);case 1:return s(y,S,R,T);case 3:return c(y,S,R,T)}}function s(y,S,C,R){let{base_:T,assigned_:I}=y,k=y.copy_;k.length<T.length&&([T,k]=[k,T],[C,R]=[R,C]);let _=y.allIndicesReassigned_===!0;for(let D=0;D<T.length;D++){let B=k[D],L=T[D];if((_||I?.get(D.toString()))&&B!==L){let V=B?.[ze];if(V&&V.modified_)continue;let q=S.concat([D]);C.push({op:n,path:q,value:h(B)}),R.push({op:n,path:q,value:h(L)})}}for(let D=T.length;D<k.length;D++){let B=S.concat([D]);C.push({op:o,path:B,value:h(k[D])})}for(let D=k.length-1;T.length<=D;--D){let B=S.concat([D]);R.push({op:i,path:B})}}function l(y,S,C,R){let{base_:T,copy_:I,type_:k}=y;Si(y.assigned_,(_,D)=>{let B=ir(T,_,k),L=ir(I,_,k),j=D?pi(T,_)?n:o:i;if(B===L&&j===n)return;let V=S.concat(_);C.push(j===i?{op:j,path:V}:{op:j,path:V,value:h(L)}),R.push(j===o?{op:i,path:V}:j===i?{op:o,path:V,value:h(B)}:{op:n,path:V,value:h(B)})})}function c(y,S,C,R){let{base_:T,copy_:I}=y,k=0;T.forEach(_=>{if(!I.has(_)){let D=S.concat([k]);C.push({op:i,path:D,value:_}),R.unshift({op:o,path:D,value:_})}k++}),k=0,I.forEach(_=>{if(!T.has(_)){let D=S.concat([k]);C.push({op:o,path:D,value:_}),R.unshift({op:i,path:D,value:_})}k++})}function g(y,S,C){let{patches_:R,inversePatches_:T}=C;R.push({op:n,path:[],value:S===Ll?void 0:S}),T.push({op:n,path:[],value:y})}function v(y,S){return S.forEach(C=>{let{path:R,op:T}=C,I=y;for(let B=0;B<R.length-1;B++){let L=Jr(I),j=R[B];typeof j!="string"&&typeof j!="number"&&(j=""+j),(L===0||L===1)&&(j==="__proto__"||j===fi)&&Je(19),Xr(I)&&j===vi&&Je(19),I=ir(I,j),Wn(I)||Je(18,R.join("/"))}let k=Jr(I),_=E(C.value),D=R[R.length-1];switch(T){case n:switch(k){case 2:return I.set(D,_);case 3:Je(16);default:return I[D]=_}case o:switch(k){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(k){case 1:return I.splice(D,1);case 2:return I.delete(D);case 3:return I.delete(C.value);default:return delete I[D]}default:Je(17,T)}}),y}function E(y){if(!dt(y))return y;if(bi(y))return y.map(E);if(wi(y))return new Map(Array.from(y.entries()).map(([C,R])=>[C,E(R)]));if(Ai(y))return new Set(Array.from(y).map(E));let S=Object.create(Zr(y));for(let C in y)S[C]=E(y[C]);return pi(y,di)&&(S[di]=y[di]),S}function h(y){return lt(y)?E(y):y}lx(Ga,{applyPatches_:v,generatePatches_:a,generateReplacementPatches_:g,getPath:t})}var yi=new Sx,tn=yi.produce,Bl=yi.produceWithPatches.bind(yi);var Gl=yi.applyPatches.bind(yi);m();d();f();p();function bx(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function wx(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 Pm=e=>Array.isArray(e)?e:[e];function Ax(e){let t=Array.isArray(e[0])?e[0]:e;return wx(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function xx(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var Cx=class{constructor(e){this.value=e}deref(){return this.value}},Ex=()=>typeof WeakRef>"u"?Cx:WeakRef,Fm=Ex(),Rx=0,Nm=1;function Ya(){return{s:Rx,v:void 0,o:null,p:null}}function Ix(e){return e instanceof Fm?e.deref():e}function xi(e,t={}){let r=Ya(),{resultEqualityCheck:n}=t,o,i=0;function a(){let s=r,{length:l}=arguments;for(let v=0,E=l;v<E;v++){let h=arguments[v];if(typeof h=="function"||typeof h=="object"&&h!==null){let y=s.o;y===null&&(s.o=y=new WeakMap);let S=y.get(h);S===void 0?(s=Ya(),y.set(h,s)):s=S}else{let y=s.p;y===null&&(s.p=y=new Map);let S=y.get(h);S===void 0?(s=Ya(),y.set(h,s)):s=S}}let c=s,g;if(s.s===Nm)g=s.v;else if(g=e.apply(null,arguments),i++,n){let v=Ix(o);v!=null&&n(v,g)&&(g=v,i!==0&&i--),o=typeof g=="object"&&g!==null||typeof g=="function"?new Fm(g):g}return c.s=Nm,c.v=g,g}return a.clearCache=()=>{r=Ya(),a.resetResultsCount()},a.resultsCount=()=>i,a.resetResultsCount=()=>{i=0},a}function Tx(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,a=0,s,l={},c=o.pop();typeof c=="object"&&(l=c,c=o.pop()),bx(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);let g={...r,...l},{memoize:v,memoizeOptions:E=[],argsMemoize:h=xi,argsMemoizeOptions:y=[]}=g,S=Pm(E),C=Pm(y),R=Ax(o),T=v(function(){return i++,c.apply(null,arguments)},...S),I=!0,k=h(function(){a++;let D=xx(R,arguments);return s=T.apply(null,D),s},...C);return Object.assign(k,{resultFunc:c,memoizedResultFunc:T,dependencies:R,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>s,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var Be=Tx(xi);m();d();f();p();function Dm(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var Mm=Dm(),qm=Dm;var _x=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ui:ui.apply(null,arguments)},UM=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},kx=e=>e&&typeof e.match=="function";function N(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(pt(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=>li(n)&&n.type===e,r}var Qm=class Ci extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Ci.prototype)}static get[Symbol.species](){return Ci}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Ci(...t[0].concat(this)):new Ci(...t.concat(this))}};function jm(e){return dt(e)?tn(e,()=>{}):e}function Xa(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function Ox(e){return typeof e=="boolean"}var Px=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new Qm;return r&&(Ox(r)?a.push(Mm):a.push(qm(r.extraArgument))),a},Ei="RTK_autoBatch",Xn=()=>e=>({payload:e,meta:{[Ei]:!0}}),Lm=e=>t=>{setTimeout(t,e)},Nx=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(i),clearTimeout(a),r())},i=e(o),a=setTimeout(o,t)},Fx=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,a=!1,s=new Set,l=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?Nx(window.requestAnimationFrame,100):Lm(10):e.type==="callback"?e.queueNotification:Lm(e.timeout),c=()=>{a=!1,i&&(i=!1,s.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let v=()=>o&&g(),E=n.subscribe(v);return s.add(g),()=>{E(),s.delete(g)}},dispatch(g){try{return o=!g?.meta?.[Ei],i=!o,i&&(a||(a=!0,l(c))),n.dispatch(g)}finally{o=!0}}})},Dx=e=>function(r){let{autoBatch:n=!0}=r??{},o=new Qm(e);return n&&o.push(Fx(typeof n=="object"?n:void 0)),o};function Hm(e){let t=Px(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:a=void 0,enhancers:s=void 0}=e||{},l;if(typeof r=="function")l=r;else if(Qt(r))l=zn(r);else throw new Error(pt(1));let c;typeof n=="function"?c=n(t):c=t();let g=ui;o&&(g=_x({trace:!1,...(typeof o=="object"&&o)}));let v=gm(...c),E=Dx(v),h=typeof s=="function"?s(E):E(),y=g(...h);return kl(l,a,y)}function zm(e){let t={},r=[],n,o={addCase(i,a){let s=typeof i=="string"?i:i.type;if(!s)throw new Error(pt(28));if(s in t)throw new Error(pt(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 Mx(e){return typeof e=="function"}function Le(e,t){let[r,n,o]=zm(t),i;if(Mx(e))i=()=>jm(e());else{let s=jm(e);i=()=>s}function a(s=i(),l){let c=[r[l.type],...n.filter(({matcher:g})=>g(l)).map(({reducer:g})=>g)];return c.filter(g=>!!g).length===0&&(c=[o]),c.reduce((g,v)=>{if(v)if(lt(g)){let h=v(g,l);return h===void 0?g:h}else{if(dt(g))return tn(g,E=>v(E,l));{let E=v(g,l);if(E===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return E}}return g},s)}return a.getInitialState=i,a}var Wm=(e,t)=>kx(e)?e.match(t):e(t);function Ht(...e){return t=>e.some(r=>Wm(r,t))}function Yn(...e){return t=>e.every(r=>Wm(r,t))}function ts(e,t){if(!e||!e.meta)return!1;let r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function Ri(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function rs(...e){return e.length===0?t=>ts(t,["pending"]):Ri(e)?Ht(...e.map(t=>t.pending)):rs()(e[0])}function nn(...e){return e.length===0?t=>ts(t,["rejected"]):Ri(e)?Ht(...e.map(t=>t.rejected)):nn()(e[0])}function Ii(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Yn(nn(...e),t):Ri(e)?Yn(nn(...e),t):Ii()(e[0])}function sr(...e){return e.length===0?t=>ts(t,["fulfilled"]):Ri(e)?Ht(...e.map(t=>t.fulfilled)):sr()(e[0])}function ns(...e){return e.length===0?t=>ts(t,["pending","fulfilled","rejected"]):Ri(e)?Ht(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):ns()(e[0])}var qx="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Ti=(e=21)=>{let t="",r=e;for(;r--;)t+=qx[Math.random()*64|0];return t},jx=["name","message","stack","code"],$l=class{constructor(e,t){ie(this,"payload");ie(this,"meta");ie(this,"_type");this.payload=e,this.meta=t}},Um=class{constructor(e,t){ie(this,"payload");ie(this,"meta");ie(this,"_type");this.payload=e,this.meta=t}},Lx=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of jx)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},Vm="External signal was aborted",Re=(()=>{function e(t,r,n){let o=N(t+"/fulfilled",(l,c,g,v)=>({payload:l,meta:{...(v||{}),arg:g,requestId:c,requestStatus:"fulfilled"}})),i=N(t+"/pending",(l,c,g)=>({payload:void 0,meta:{...(g||{}),arg:c,requestId:l,requestStatus:"pending"}})),a=N(t+"/rejected",(l,c,g,v,E)=>({payload:v,error:(n&&n.serializeError||Lx)(l||"Rejected"),meta:{...(E||{}),arg:g,requestId:c,rejectedWithValue:!!v,requestStatus:"rejected",aborted:l?.name==="AbortError",condition:l?.name==="ConditionError"}}));function s(l,{signal:c}={}){return(g,v,E)=>{let h=n?.idGenerator?n.idGenerator(l):Ti(),y=new u.AbortController,S,C;function R(I){C=I,y.abort()}c&&(c.aborted?R(Vm):c.addEventListener("abort",()=>R(Vm),{once:!0}));let T=_asyncToGenerator(function*(){let I;try{let _=n?.condition?.(l,{getState:v,extra:E});if(Vx(_)&&(_=yield _),_===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let D=new Promise((B,L)=>{S=()=>{L({name:"AbortError",message:C||"Aborted"})},y.signal.addEventListener("abort",S,{once:!0})});g(i(h,l,n?.getPendingMeta?.({requestId:h,arg:l},{getState:v,extra:E}))),I=yield Promise.race([D,Promise.resolve(r(l,{dispatch:g,getState:v,extra:E,requestId:h,signal:y.signal,abort:R,rejectWithValue:(B,L)=>new $l(B,L),fulfillWithValue:(B,L)=>new Um(B,L)})).then(B=>{if(B instanceof $l)throw B;return B instanceof Um?o(B.payload,h,l,B.meta):o(B,h,l)})])}catch(_){I=_ instanceof $l?a(null,h,l,_.payload,_.meta):a(_,h,l)}finally{S&&y.signal.removeEventListener("abort",S)}return n&&!n.dispatchConditionRejection&&a.match(I)&&I.meta.condition||g(I),I})();return Object.assign(T,{abort:R,requestId:h,arg:l,unwrap(){return T.then(Ux)}})}}return Object.assign(s,{pending:i,rejected:a,fulfilled:o,settled:Ht(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function Ux(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Vx(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var Km=Symbol.for("rtk-slice-createasyncthunk"),BM={[Km]:Re};function Bx(e,t){return`${e}/${t}`}function Gx({creators:e}={}){let t=e?.asyncThunk?.[Km];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(pt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(Qx()):n.reducers)||{},s=Object.keys(a),l={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(I,k){let _=typeof I=="string"?I:I.type;if(!_)throw new Error(pt(12));if(_ in l.sliceCaseReducersByType)throw new Error(pt(13));return l.sliceCaseReducersByType[_]=k,c},addMatcher(I,k){return l.sliceMatchers.push({matcher:I,reducer:k}),c},exposeAction(I,k){return l.actionCreators[I]=k,c},exposeCaseReducer(I,k){return l.sliceCaseReducersByName[I]=k,c}};s.forEach(I=>{let k=a[I],_={reducerName:I,type:Bx(o,I),createNotation:typeof n.reducers=="function"};zx(k)?Kx(_,k,c,t):Hx(_,k,c)});function g(){let[I={},k=[],_=void 0]=typeof n.extraReducers=="function"?zm(n.extraReducers):[n.extraReducers],D={...I,...l.sliceCaseReducersByType};return Le(n.initialState,B=>{for(let L in D)B.addCase(L,D[L]);for(let L of l.sliceMatchers)B.addMatcher(L.matcher,L.reducer);for(let L of k)B.addMatcher(L.matcher,L.reducer);_&&B.addDefaultCase(_)})}let v=I=>I,E=new Map,h=new WeakMap,y;function S(I,k){return y||(y=g()),y(I,k)}function C(){return y||(y=g()),y.getInitialState()}function R(I,k=!1){function _(B){let L=B[I];return typeof L>"u"&&k&&(L=Xa(h,_,C)),L}function D(B=v){let L=Xa(E,k,()=>new WeakMap);return Xa(L,B,()=>{let j={};for(let[V,q]of Object.entries(n.selectors??{}))j[V]=$x(q,B,()=>Xa(h,B,C),k);return j})}return{reducerPath:I,getSelectors:D,get selectors(){return D(_)},selectSlice:_}}let T={name:o,reducer:S,actions:l.actionCreators,caseReducers:l.sliceCaseReducersByName,getInitialState:C,...R(i),injectInto(I,{reducerPath:k,..._}={}){let D=k??i;return I.inject({reducerPath:D,reducer:S},_),{...T,...R(D,!0)}}};return T}}function $x(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 on=Gx();function Qx(){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 Hx({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!Wx(n))throw new Error(pt(17));i=n.reducer,a=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?N(e,a):N(e))}function zx(e){return e._reducerDefinitionType==="asyncThunk"}function Wx(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Kx({type:e,reducerName:t},r,n,o){if(!o)throw new Error(pt(18));let{payloadCreator:i,fulfilled:a,pending:s,rejected:l,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),l&&n.addCase(v.rejected,l),c&&n.addMatcher(v.settled,c),n.exposeCaseReducer(t,{fulfilled:a||Za,pending:s||Za,rejected:l||Za,settled:c||Za})}function Za(){}var Yx="task",Ym="listener",Xm="completed",zl="cancelled",Xx=`task-${zl}`,Zx=`task-${Xm}`,Ql=`${Ym}-${zl}`,Jx=`${Ym}-${Xm}`,os=class{constructor(e){ie(this,"code");ie(this,"name","TaskAbortError");ie(this,"message");this.code=e,this.message=`${Yx} ${zl} (reason: ${e})`}},Wl=(e,t)=>{if(typeof e!="function")throw new TypeError(pt(32))},Ja=()=>{},Zm=(e,t=Ja)=>(e.catch(t),e),Jm=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),rn=e=>{if(e.aborted)throw new os(e.reason)};function eg(e,t){let r=Ja;return new Promise((n,o)=>{let i=()=>o(new os(e.reason));if(e.aborted){i();return}r=Jm(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=Ja})}var eC=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof os?"cancelled":"rejected",error:r}}finally{t?.()}});return function eC(_x5,_x6){return _ref5.apply(this,arguments)}}(),es=e=>t=>Zm(eg(e,t).then(r=>(rn(e),r))),tg=e=>{let t=es(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Kn}=Object,Bm={},is="listenerMiddleware",tC=(e,t)=>{let r=n=>Jm(e,()=>n.abort(e.reason));return(n,o)=>{Wl(n,"taskExecutor");let i=new u.AbortController;r(i);let a=eC(/*#__PURE__*/_asyncToGenerator(function*(){rn(e),rn(i.signal);let s=yield n({pause:es(i.signal),delay:tg(i.signal),signal:i.signal});return rn(i.signal),s}),()=>i.abort(Zx));return o?.autoJoin&&t.push(a.catch(Ja)),{result:es(e)(a),cancel(){i.abort(Xx)}}}},rC=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){rn(t);let i=()=>{},s=[new Promise((l,c)=>{let g=e({predicate:n,effect:(v,E)=>{E.unsubscribe(),l([v,E.getState(),E.getOriginalState()])}});i=()=>{g(),c()}})];o!=null&&s.push(new Promise(l=>setTimeout(l,o,null)));try{let l=yield eg(t,Promise.race(s));return rn(t),l}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>Zm(r(n,o))},rg=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=N(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(pt(21));return Wl(i,"options.listener"),{predicate:o,type:t,effect:i}},ng=Kn(e=>{let{type:t,predicate:r,effect:n}=rg(e);return{id:Ti(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(pt(22))}}},{withTypes:()=>ng}),Gm=(e,t)=>{let{type:r,effect:n,predicate:o}=rg(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},Hl=e=>{e.pending.forEach(t=>{t.abort(Ql)})},nC=(e,t)=>()=>{for(let r of t.keys())Hl(r);e.clear()},$m=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},og=Kn(N(`${is}/add`),{withTypes:()=>og}),oC=N(`${is}/removeAll`),ig=Kn(N(`${is}/remove`),{withTypes:()=>ig}),iC=(...e)=>{console.error(`${is}/error`,...e)},ag=(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=iC}=e;Wl(a,"onError");let s=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&Hl(h)}),l=h=>{let y=Gm(t,h)??ng(h);return s(y)};Kn(l,{withTypes:()=>l});let c=h=>{let y=Gm(t,h);return y&&(y.unsubscribe(),h.cancelActive&&Hl(y)),!!y};Kn(c,{withTypes:()=>c});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,S,C){let R=new u.AbortController,T=rC(l,R.signal),I=[];try{h.pending.add(R),n(h),yield Promise.resolve(h.effect(y,Kn({},S,{getOriginalState:C,condition:(k,_)=>T(k,_).then(Boolean),take:T,delay:tg(R.signal),pause:es(R.signal),extra:i,signal:R.signal,fork:tC(R.signal,I),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((k,_,D)=>{k!==R&&(k.abort(Ql),D.delete(k))})},cancel:()=>{R.abort(Ql),h.pending.delete(R)},throwIfCancelled:()=>{rn(R.signal)}})))}catch(k){k instanceof os||$m(a,k,{raisedBy:"effect"})}finally{yield Promise.all(I),R.abort(Jx),o(h),h.pending.delete(R)}});return function g(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),v=nC(t,r);return{middleware:h=>y=>S=>{if(!li(S))return y(S);if(og.match(S))return l(S.payload);if(oC.match(S)){v();return}if(ig.match(S))return c(S.payload);let C=h.getState(),R=()=>{if(C===Bm)throw new Error(pt(23));return C},T;try{if(T=y(S),t.size>0){let I=h.getState(),k=Array.from(t.values());for(let _ of k){let D=!1;try{D=_.predicate(S,I,C)}catch(B){D=!1,$m(a,B,{raisedBy:"predicate"})}D&&g(_,S,h,R)}}}finally{C=Bm}return T},startListening:l,stopListening:c,clearListeners:v}};function pt(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 Z=new z({required:!0,emptyAllowed:!1}),et=new z({required:!1,emptyAllowed:!1}),tt=new z({required:!0,emptyAllowed:!0}),eq=new z({required:!1,emptyAllowed:!0}),as=new ve({each:Z,required:!0}),sg=new z({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),cg=new z({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),tq=new z({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),cr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),Rt=(e,t)=>{if("required"in t)return{payload:new mt({value:t}).validate({value:e}).value};let o=new ne({options:{required:!0},values:t}).validate(e);if(o)throw new oi(o);return{payload:e}},$=(e,t)=>{try{return Rt(e,t)}catch(r){return{payload:e,error:cr(r)}}},ug=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return dg(e,t,r,o,"Controller initialization error")},lg=(e,t,r,n)=>{let o=`Check the options of ${n}`;return dg(e,t,r,o,"Controller initialization error")},dg=(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 Zn="3.51.5",pg=["@coveo/atomic","@coveo/quantic"];var Kl=()=>et,fg=()=>Z,Cr=N("configuration/updateBasicConfiguration",e=>$(e,{accessToken:et,environment:new z({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:et})),zt=N("configuration/updateSearchConfiguration",e=>$(e,{proxyBaseUrl:new z({required:!1,url:!0}),pipeline:new z({required:!1,emptyAllowed:!0}),searchHub:et,timezone:et,locale:et,authenticationProviders:new ve({required:!1,each:Z})})),aC={enabled:new me({default:!0}),originContext:Kl(),originLevel2:Kl(),originLevel3:Kl(),proxyBaseUrl:new z({required:!1,url:!0}),runtimeEnvironment:new Fe,anonymous:new me({default:!1}),deviceId:et,userDisplayName:et,documentLocation:et,trackingId:cg,analyticsMode:new z({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new ne({options:{required:!1},values:pg.reduce((e,t)=>(e[t]=sg,e),{})})},Jn=N("configuration/updateAnalyticsConfiguration",e=>$(e,aC)),eo=N("configuration/analytics/disable"),to=N("configuration/analytics/enable"),ss=N("configuration/analytics/originlevel2",e=>$(e,{originLevel2:fg()})),cs=N("configuration/analytics/originlevel3",e=>$(e,{originLevel3:fg()})),mg=N("knowledge/setAgentId",e=>$(e,new z({required:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var gg={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 Er=N("searchParameters/restore",e=>$(e,gg)),hg=N("searchParameters/restoreTab",e=>$(e,Z));m();d();f();p();var us=N("debug/enable"),ls=N("debug/disable");m();d();f();p();var ds=()=>!1;var ps=Le(ds(),e=>{e.addCase(us,()=>!0).addCase(ls,()=>!1).addCase(Er,(t,r)=>r.payload.debug??t)});m();d();f();p();var ro=N("pipeline/set",e=>$(e,new z({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();var sC=N("history/undo"),cC=N("history/redo"),Wt=N("history/snapshot"),lj=Re("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(sC()),yield t(ht())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),dj=Re("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(cC()),yield t(ht())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),ht=Re("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 no=()=>"";var oo=Le(no(),e=>{e.addCase(ro,(t,r)=>r.payload).addCase(ht.fulfilled,(t,r)=>r.payload?.pipeline??t).addCase(zt,(t,r)=>r.payload.pipeline||t)});m();d();f();p();m();d();f();p();var fs=N("app/setError");m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var io=class e{static set(t,r,n){let o,i,a;n&&(i=new Date,i.setTime(i.getTime()+n));let s=window.location.hostname,l=/^(\d{1,3}\.){3}\d{1,3}$/,c=/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/;l.test(s)||c.test(s)||s.indexOf(".")===-1?Yl(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],Yl(t,r,i,o))}static get(t){let r=t+"=",n=document.cookie.split(";");for(let o=0;o<n.length;o++){let 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 Yl(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}m();d();f();p();function uC(){return typeof navigator<"u"}function yg(){try{return typeof localStorage<"u"}catch{return!1}}function vg(){try{return typeof sessionStorage<"u"}catch{return!1}}function Sg(){return!!(uC()&&navigator.cookieEnabled)}var bg=null;function wg(){return bg||(yg()?localStorage:Sg()?new Xl:vg()?sessionStorage:new Zl)}var ao=class ao{getItem(t){return io.get(`${ao.prefix}${t}`)}removeItem(t){io.erase(`${ao.prefix}${t}`)}setItem(t,r,n){io.set(`${ao.prefix}${t}`,r,n)}};ie(ao,"prefix","coveo_");var Xl=ao;var Zl=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var ms="__coveo.analytics.history",lC=20,dC=1e3*60,pC=75,an=class an{constructor(t){ie(this,"store");this.store=t||wg()}static getInstance(t){return an.instance||(an.instance=new an(t)),an.instance}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!==null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _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(ms);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this1=this;return _asyncToGenerator(function*(){try{let t=yield _this1.store.getItem(ms);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(ms,JSON.stringify(t.slice(0,lC)))}catch{}}clear(){try{this.store.removeItem(ms)}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)>dC:!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))}};ie(an,"instance",null);var Jl=an,It=Jl;m();d();f();p();m();d();f();p();var so=Be(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Zn}`));m();d();f();p();m();d();f();p();function ur(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(g){try{c(n.next(g))}catch(v){a(v)}}function l(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,l)}c((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 rd(){return typeof window<"u"}function gd(){return typeof navigator<"u"}function co(){return typeof document<"u"}function nd(){try{return typeof localStorage<"u"}catch{return!1}}function fC(){try{return typeof sessionStorage<"u"}catch{return!1}}function Dg(){return gd()&&navigator.cookieEnabled}var mC=[Ae.click,Ae.custom,Ae.search,Ae.view],gC=(e,t)=>mC.indexOf(e)!==-1?Object.assign({language:co()?document.documentElement.lang:"unknown",userAgent:gd()?navigator.userAgent:"unknown"},t):t,ki=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?Ag(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],Ag(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 Ag(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function hC(){return nd()?localStorage:Dg()?new Oi:fC()?sessionStorage:new lo}var Oi=class e{getItem(t){return ki.get(`${e.prefix}${t}`)}removeItem(t){ki.erase(`${e.prefix}${t}`)}setItem(t,r,n){ki.set(`${e.prefix}${t}`,r,n)}};Oi.prefix="coveo_";var od=class{constructor(){this.cookieStorage=new Oi}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)}},lo=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},gs="__coveo.analytics.history",yC=20,vC=1e3*60,SC=75,vs=class{constructor(t){this.store=t||hC()}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(gs);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(gs);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(gs,JSON.stringify(t.slice(0,yC)))}catch{}}clear(){try{this.store.removeItem(gs)}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,SC)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>vC:!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 bC=(e,t)=>U(void 0,void 0,void 0,function*(){return e===Ae.view?(yield wC(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),wC=e=>U(void 0,void 0,void 0,function*(){let t=new vs,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),hs,AC=new Uint8Array(16);function xC(){if(!hs&&(hs=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!hs))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return hs(AC)}var CC=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Ss(e){return typeof e=="string"&&CC.test(e)}var rt=[];for(let e=0;e<256;++e)rt.push((e+256).toString(16).slice(1));function Mg(e,t=0){return rt[e[t+0]]+rt[e[t+1]]+rt[e[t+2]]+rt[e[t+3]]+"-"+rt[e[t+4]]+rt[e[t+5]]+"-"+rt[e[t+6]]+rt[e[t+7]]+"-"+rt[e[t+8]]+rt[e[t+9]]+"-"+rt[e[t+10]]+rt[e[t+11]]+rt[e[t+12]]+rt[e[t+13]]+rt[e[t+14]]+rt[e[t+15]]}function EC(e){if(!Ss(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}function RC(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var IC="6ba7b810-9dad-11d1-80b4-00c04fd430c8",TC="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function _C(e,t,r){function n(o,i,a,s){var l;if(typeof o=="string"&&(o=RC(o)),typeof i=="string"&&(i=EC(i)),((l=i)===null||l===void 0?void 0:l.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+o.length);if(c.set(i),c.set(o,i.length),c=r(c),c[6]=c[6]&15|t,c[8]=c[8]&63|128,a){s=s||0;for(let g=0;g<16;++g)a[s+g]=c[g];return a}return Mg(c)}try{n.name=e}catch{}return n.DNS=IC,n.URL=TC,n}var kC=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),xg={randomUUID:kC};function sn(e,t,r){if(xg.randomUUID&&!t&&!e)return xg.randomUUID();e=e||{};let n=e.random||(e.rng||xC)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let o=0;o<16;++o)t[r+o]=n[o];return t}return Mg(n)}function OC(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 ed(e,t){return e<<t|e>>>32-t}function PC(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let a=unescape(encodeURIComponent(e));e=[];for(let s=0;s<a.length;++s)e.push(a.charCodeAt(s))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,o=Math.ceil(n/16),i=new Array(o);for(let a=0;a<o;++a){let s=new Uint32Array(16);for(let l=0;l<16;++l)s[l]=e[a*64+l*4]<<24|e[a*64+l*4+1]<<16|e[a*64+l*4+2]<<8|e[a*64+l*4+3];i[a]=s}i[o-1][14]=(e.length-1)*8/Math.pow(2,32),i[o-1][14]=Math.floor(i[o-1][14]),i[o-1][15]=(e.length-1)*8&4294967295;for(let a=0;a<o;++a){let s=new Uint32Array(80);for(let h=0;h<16;++h)s[h]=i[a][h];for(let h=16;h<80;++h)s[h]=ed(s[h-3]^s[h-8]^s[h-14]^s[h-16],1);let l=r[0],c=r[1],g=r[2],v=r[3],E=r[4];for(let h=0;h<80;++h){let y=Math.floor(h/20),S=ed(l,5)+OC(y,c,g,v)+E+t[y]+s[h]>>>0;E=v,v=g,g=ed(c,30)>>>0,c=l,l=S}r[0]=r[0]+l>>>0,r[1]=r[1]+c>>>0,r[2]=r[2]+g>>>0,r[3]=r[3]+v>>>0,r[4]=r[4]+E>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var NC=_C("v5",80,PC),Cg=NC,qg="2.30.56",Eg=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,_i={pageview:"pageview",event:"event"},bs=class{constructor({client:t,uuidGenerator:r=sn}){this.client=t,this.uuidGenerator=r}},id=class extends bs{constructor({client:t,uuidGenerator:r=sn}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=Eg(window.location),this.lastReferrer=co()?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:co()?document.title:"",encoding:co()?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===_i.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===_i.pageview?this.nextPageViewId:this.pageViewId,referrer:t===_i.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===_i.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 Eg(window.location)}},Rr=class e{constructor(t,r){if(!Ss(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 Ss(i)?new e(i,Number.parseInt(o)*1e3):null}};Rr.cvo_cid="cvo_cid";Rr.expirationTime=120;var ad=class extends bs{constructor({client:t,uuidGenerator:r=sn}){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(Rr.cvo_cid,new Rr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};ad.Id="link";var _t=Object.keys;function ys(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var td=128,jg=192,Rg=224,Ig=240;function FC(e){return(e&248)===Ig?4:(e&Ig)===Rg?3:(e&Rg)===jg?2:1}function DC(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&td)!=td)break;if(r-=3,(n&jg)!=td){t-r>=FC(n)*3&&(r=t);break}}return e.substring(0,r)}var sd={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"},MC=_t(sd).map(e=>sd[e]),qC=[...MC].join("|"),jC=new RegExp(`^(${qC}$)`),LC={svcAction:"svc_action",svcActionData:"svc_action_data"},UC=e=>_t(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=sd[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),VC=e=>jC.test(e),BC=[VC],Tg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},_g={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},st={action:"pa",list:"pal",listSource:"pls"},ws={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},GC=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],cd={id:"quoteId",affiliation:"quoteAffiliation"},ud={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},$C={add:st,bookmark_add:st,bookmark_remove:st,click:st,checkout:st,checkout_option:st,detail:st,impression:st,remove:st,refund:Object.assign(Object.assign({},st),ws),purchase:Object.assign(Object.assign({},st),ws),quickview:st,quote:Object.assign(Object.assign({},st),cd),review:Object.assign(Object.assign({},st),ud)},QC=_t(Tg).map(e=>Tg[e]),HC=_t(_g).map(e=>_g[e]),zC=_t(st).map(e=>st[e]),WC=_t(ws).map(e=>ws[e]),KC=_t(ud).map(e=>ud[e]),YC=_t(cd).map(e=>cd[e]),XC=[...QC,"custom"].join("|"),ZC=[...HC,"custom"].join("|"),Lg="(pr[0-9]+)",Ug="(il[0-9]+pi[0-9]+)",JC=new RegExp(`^${Lg}(${XC})$`),eE=new RegExp(`^(${Ug}(${ZC}))|(il[0-9]+nm)$`),tE=new RegExp(`^(${zC.join("|")})$`),rE=new RegExp(`^(${WC.join("|")})$`),nE=new RegExp(`^${Lg}custom$`),oE=new RegExp(`^${Ug}custom$`),iE=new RegExp(`^(${[...GC,...KC,...YC].join("|")})$`),aE=e=>JC.test(e),sE=e=>eE.test(e),cE=e=>tE.test(e),uE=e=>rE.test(e),lE=e=>iE.test(e),dE=[sE,aE,cE,uE,lE],pE=[nE,oE],fE={anonymizeIp:"aip"},mE={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},gE={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},hE=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],yE=Object.assign(Object.assign(Object.assign(Object.assign({},fE),mE),gE),hE.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),ld=Object.assign(Object.assign({},yE),LC),vE=e=>{let t=!!e.action&&$C[e.action]||{};return _t(e).reduce((r,n)=>{let o=t[n]||ld[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},SE=_t(ld).map(e=>ld[e]),bE=e=>SE.indexOf(e)!==-1,wE=e=>e==="custom",AE=e=>[...dE,...BC,bE,wE].some(t=>t(e)),xE=e=>_t(e).reduce((t,r)=>{let n=CE(r);return n?Object.assign(Object.assign({},t),EE(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),CE=e=>{let t;return[...pE].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},EE=(e,t)=>_t(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),dd=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),l=this.encodeForEventType(t,s),c=new Blob([l],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(a,c)})}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:l}=a;o=s||t;try{i=JSON.parse(l)}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 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}},pd=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()})}},kg=b.fetch,As=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)},l=Object.assign(Object.assign({},s),i?yield i(s,"analyticsFetch"):{}),{url:c}=l,g=ur(l,["url"]),v;try{v=yield kg(c,g)}catch(E){console.error("An error has occured when sending the event.",E);return}if(v.ok){let E=yield v.json();return E.visitorId&&o.setCurrentVisitorId(E.visitorId),E}else{try{v.json()}catch{}throw console.error(`An error has occured when sending the "${t}" event.`,v,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield kg(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"})}},fd=class{constructor(t,r){nd()&&Dg()?this.storage=new od:nd()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new lo),this.client=new As(t),this.beaconClient=new dd(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}},md=class{constructor(t,r){this.storage=r||new lo,this.client=new As(t)}getClientDependingOnEventType(t){return this.client}},xs=class{constructor(){this.storage=new lo,this.client=new pd}getClientDependingOnEventType(t){return this.client}},RE="xx",IE=e=>e?.startsWith(RE)||!1,TE=`
|
|
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 _E(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var kE=["1",1,"yes",!0];function Cs(){let e=[];return rd()&&e.push(window.doNotTrack),gd()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>kE.indexOf(t)!==-1)}var Vg="v15",Bg={default:"https://analytics.cloud.coveo.com/rest/ua",production:"https://analytics.cloud.coveo.com/rest/ua",hipaa:"https://analyticshipaa.cloud.coveo.com/rest/ua"};function OE(e=Bg.default,t=Vg,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 PE="38824e1f-37f5-42d3-8372-a4b8fa9df946",Kt=class{get defaultOptions(){return{endpoint:Bg.default,isCustomEndpoint:!1,token:"",version:Vg,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=[bC,gC].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};let r={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};Cs()?this.runtime=new xs: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 rd()&&co()?new fd(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(_E()&&console.warn(TE),new md(t))}get storage(){return this.runtime.storage}determineVisitorId(){return U(this,void 0,void 0,function*(){try{return rd()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||sn()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),sn()}})}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(Ss(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(Cg(t,Cg(r,PE)))}})}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(sn()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(Cs())return null;try{let r=new URL(t).searchParams.get(Rr.cvo_cid);if(r==null)return null;let n=Rr.fromString(r);return!n||!co()||!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[h=>n.length>0?this.parseVariableArgumentsPayload(n,h):h[0],h=>U(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>U(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,S)=>U(this,void 0,void 0,function*(){let C=yield y;return yield S(t,C)}),h)].reduce((h,y)=>U(this,void 0,void 0,function*(){let S=yield h;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?vE(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,E)=>U(this,void 0,void 0,function*(){let h=yield v;return yield E(h)}),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 vs().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=ur(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=ur(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=ur(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 w(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return U(this,void 0,void 0,function*(){return yield(yield w(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,r){this.eventTypeMapping[t]=r}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(r=>typeof r=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,r){let n={};for(let 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(AE(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=ur(t,["custom"]),o={};r&&ys(r)&&(o=this.lowercaseKeys(r));let i=xE(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=ur(t,["custom"]);if(r&&ys(r)){let o=this.lowercaseKeys(r);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},o),t.customData)})}else return t}lowercaseKeys(t){let r=Object.keys(t),n={};return r.forEach(o=>{n[o.toLowerCase()]=t[o]}),n}validateParams(t,r){let{anonymizeIp:n}=t,o=ur(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=ur(t,["userId"]);return IE(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=ur(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&ys(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&ys(n.customData)&&(n.customData.hasOwnProperty("context_website")||n.customData.hasOwnProperty("siteName"))&&(n.trackingId=n.customData.context_website||n.customData.siteName),n)}limit(t,r){return typeof t=="string"?DC(t,r):t}get baseUrl(){return OE(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},lr;(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"})(lr||(lr={}));var G;(function(e){e.interfaceLoad="interfaceLoad",e.interfaceChange="interfaceChange",e.didyoumeanAutomatic="didyoumeanAutomatic",e.didyoumeanClick="didyoumeanClick",e.resultsSort="resultsSort",e.searchboxSubmit="searchboxSubmit",e.searchboxClear="searchboxClear",e.searchboxAsYouType="searchboxAsYouType",e.breadcrumbFacet="breadcrumbFacet",e.breadcrumbResetAll="breadcrumbResetAll",e.documentQuickview="documentQuickview",e.documentOpen="documentOpen",e.omniboxAnalytics="omniboxAnalytics",e.omniboxFromLink="omniboxFromLink",e.searchFromLink="searchFromLink",e.triggerNotify="notify",e.triggerExecute="execute",e.triggerQuery="query",e.undoTriggerQuery="undoQuery",e.triggerRedirect="redirect",e.pagerResize="pagerResize",e.pagerNumber="pagerNumber",e.pagerNext="pagerNext",e.pagerPrevious="pagerPrevious",e.pagerScrolling="pagerScrolling",e.staticFilterClearAll="staticFilterClearAll",e.staticFilterSelect="staticFilterSelect",e.staticFilterDeselect="staticFilterDeselect",e.facetClearAll="facetClearAll",e.facetSearch="facetSearch",e.facetSelect="facetSelect",e.facetSelectAll="facetSelectAll",e.facetDeselect="facetDeselect",e.facetExclude="facetExclude",e.facetUnexclude="facetUnexclude",e.facetUpdateSort="facetUpdateSort",e.facetShowMore="showMoreFacetResults",e.facetShowLess="showLessFacetResults",e.queryError="query",e.queryErrorBack="errorBack",e.queryErrorClear="errorClearQuery",e.queryErrorRetry="errorRetry",e.recommendation="recommendation",e.recommendationInterfaceLoad="recommendationInterfaceLoad",e.recommendationOpen="recommendationOpen",e.likeSmartSnippet="likeSmartSnippet",e.dislikeSmartSnippet="dislikeSmartSnippet",e.expandSmartSnippet="expandSmartSnippet",e.collapseSmartSnippet="collapseSmartSnippet",e.openSmartSnippetFeedbackModal="openSmartSnippetFeedbackModal",e.closeSmartSnippetFeedbackModal="closeSmartSnippetFeedbackModal",e.sendSmartSnippetReason="sendSmartSnippetReason",e.expandSmartSnippetSuggestion="expandSmartSnippetSuggestion",e.collapseSmartSnippetSuggestion="collapseSmartSnippetSuggestion",e.showMoreSmartSnippetSuggestion="showMoreSmartSnippetSuggestion",e.showLessSmartSnippetSuggestion="showLessSmartSnippetSuggestion",e.openSmartSnippetSource="openSmartSnippetSource",e.openSmartSnippetSuggestionSource="openSmartSnippetSuggestionSource",e.openSmartSnippetInlineLink="openSmartSnippetInlineLink",e.openSmartSnippetSuggestionInlineLink="openSmartSnippetSuggestionInlineLink",e.recentQueryClick="recentQueriesClick",e.clearRecentQueries="clearRecentQueries",e.recentResultClick="recentResultClick",e.clearRecentResults="clearRecentResults",e.noResultsBack="noResultsBack",e.showMoreFoldedResults="showMoreFoldedResults",e.showLessFoldedResults="showLessFoldedResults",e.copyToClipboard="copyToClipboard",e.caseSendEmail="Case.SendEmail",e.feedItemTextPost="FeedItem.TextPost",e.caseAttach="caseAttach",e.caseDetach="caseDetach",e.retryGeneratedAnswer="retryGeneratedAnswer",e.likeGeneratedAnswer="likeGeneratedAnswer",e.dislikeGeneratedAnswer="dislikeGeneratedAnswer",e.openGeneratedAnswerSource="openGeneratedAnswerSource",e.generatedAnswerOpenInlineLink="generatedAnswerOpenInlineLink",e.generatedAnswerStreamEnd="generatedAnswerStreamEnd",e.generatedAnswerSourceHover="generatedAnswerSourceHover",e.generatedAnswerCopyToClipboard="generatedAnswerCopyToClipboard",e.generatedAnswerHideAnswers="generatedAnswerHideAnswers",e.generatedAnswerShowAnswers="generatedAnswerShowAnswers",e.generatedAnswerExpand="generatedAnswerExpand",e.generatedAnswerCollapse="generatedAnswerCollapse",e.generatedAnswerFeedbackSubmit="generatedAnswerFeedbackSubmit",e.rephraseGeneratedAnswer="rephraseGeneratedAnswer",e.generatedAnswerFeedbackSubmitV2="generatedAnswerFeedbackSubmitV2",e.generatedAnswerCitationClick="generatedAnswerCitationClick",e.generatedAnswerFollowupOpenSource="generatedAnswerFollowupOpenSource",e.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})(G||(G={}));var Og={[G.triggerNotify]:"queryPipelineTriggers",[G.triggerExecute]:"queryPipelineTriggers",[G.triggerQuery]:"queryPipelineTriggers",[G.triggerRedirect]:"queryPipelineTriggers",[G.queryErrorBack]:"errors",[G.queryErrorClear]:"errors",[G.queryErrorRetry]:"errors",[G.pagerNext]:"getMoreResults",[G.pagerPrevious]:"getMoreResults",[G.pagerNumber]:"getMoreResults",[G.pagerResize]:"getMoreResults",[G.pagerScrolling]:"getMoreResults",[G.facetSearch]:"facet",[G.facetShowLess]:"facet",[G.facetShowMore]:"facet",[G.recommendation]:"recommendation",[G.likeSmartSnippet]:"smartSnippet",[G.dislikeSmartSnippet]:"smartSnippet",[G.expandSmartSnippet]:"smartSnippet",[G.collapseSmartSnippet]:"smartSnippet",[G.openSmartSnippetFeedbackModal]:"smartSnippet",[G.closeSmartSnippetFeedbackModal]:"smartSnippet",[G.sendSmartSnippetReason]:"smartSnippet",[G.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[G.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[G.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[G.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[G.clearRecentQueries]:"recentQueries",[G.recentResultClick]:"recentlyClickedDocuments",[G.clearRecentResults]:"recentlyClickedDocuments",[G.showLessFoldedResults]:"folding",[G.caseDetach]:"case",[G.likeGeneratedAnswer]:"generatedAnswer",[G.dislikeGeneratedAnswer]:"generatedAnswer",[G.openGeneratedAnswerSource]:"generatedAnswer",[G.generatedAnswerOpenInlineLink]:"generatedAnswer",[G.generatedAnswerFollowupOpenSource]:"generatedAnswer",[G.generatedAnswerStreamEnd]:"generatedAnswer",[G.generatedAnswerSourceHover]:"generatedAnswer",[G.generatedAnswerCopyToClipboard]:"generatedAnswer",[G.generatedAnswerHideAnswers]:"generatedAnswer",[G.generatedAnswerShowAnswers]:"generatedAnswer",[G.generatedAnswerExpand]:"generatedAnswer",[G.generatedAnswerCollapse]:"generatedAnswer",[G.generatedAnswerFeedbackSubmit]:"generatedAnswer",[G.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[lr.expandToFullUI]:"interface",[lr.openUserActions]:"User Actions",[lr.showPrecedingSessions]:"User Actions",[lr.showFollowingSessions]:"User Actions",[lr.clickViewedDocument]:"User Actions",[lr.clickPageView]:"User Actions",[lr.createArticle]:"createArticle"},po=class{constructor(){this.runtime=new xs,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 jg}};function NE(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function FE(e){return e.map(t=>t.replace(/;/g,""))}function Gg(e){let r=e.join(";");return r.length<=256?r:Gg(e.slice(1))}var Pg=e=>{let t=FE(e),r=NE(t);return Gg(r)};function Ng(e){let t=typeof e.partialQueries=="string"?e.partialQueries:Pg(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:Pg(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Es=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Cs();this.coveoAnalyticsClient=n?new po:new Kt(t)}disable(){this.coveoAnalyticsClient=new po}enable(){this.coveoAnalyticsClient=new Kt(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(G.interfaceLoad)}logInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(G.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(G.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(G.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(G.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(G.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(G.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(G.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(G.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(G.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(G.didyoumeanClick)}logDidYouMeanClick(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(G.resultsSort,t)}logResultsSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(G.searchboxSubmit)}logSearchboxSubmit(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(G.searchboxClear)}logSearchboxClear(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(G.searchboxAsYouType)}logSearchboxAsYouType(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(G.breadcrumbFacet,t)}logBreadcrumbFacet(t){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(G.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(G.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(G.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(G.omniboxAnalytics,Ng(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(G.omniboxFromLink,Ng(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(G.searchFromLink)}logSearchFromLink(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(G.triggerNotify,t)}logTriggerNotify(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(G.triggerExecute,t)}logTriggerExecute(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(G.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(G.undoTriggerQuery,t)}logUndoTriggerQuery(t){return U(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(G.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(G.pagerResize,t)}logPagerResize(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(G.pagerNumber,t)}logPagerNumber(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(G.pagerNext,t)}logPagerNext(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(G.pagerPrevious,t)}logPagerPrevious(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(G.pagerScrolling)}logPagerScrolling(){return U(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(G.facetClearAll,t)}logFacetClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(G.facetSearch,t)}logFacetSearch(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(G.facetSelect,t)}logFacetSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(G.facetDeselect,t)}logFacetDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(G.facetExclude,t)}logFacetExclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(G.facetUnexclude,t)}logFacetUnexclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(G.facetSelectAll,t)}logFacetSelectAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(G.facetUpdateSort,t)}logFacetUpdateSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(G.facetShowMore,t)}logFacetShowMore(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(G.facetShowLess,t)}logFacetShowLess(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(G.queryError,t)}logQueryError(t){return 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(G.queryErrorBack);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(G.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(G.queryErrorRetry);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(G.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(G.queryErrorClear);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(G.queryErrorClear)})}})}logQueryErrorClear(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(G.likeSmartSnippet)}logLikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(G.dislikeSmartSnippet)}logDislikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(G.expandSmartSnippet)}logExpandSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(G.collapseSmartSnippet)}logCollapseSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(G.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(G.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(G.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(G.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(G.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(G.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(G.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(G.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(G.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(G.copyToClipboard,t,r)}logCopyToClipboard(t,r){return 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(G.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(G.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(G.recentQueryClick)}logRecentQueryClick(){return U(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(G.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(G.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(G.clearRecentResults)}logClearRecentResults(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(G.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(G.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(G.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=Og[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}),l=yield this.coveoAnalyticsClient.makeCustomEvent(s);return{description:this.makeEventDescription(l,n),log:({searchUID:c})=>l.log({lastSearchQueryUid:c})}})}logCustomEvent(t,r){return U(this,arguments,void 0,function*(n,o,i=Og[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 Kt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getSplitTestRun(){let t=this.provider.getSplitTestRunName?this.provider.getSplitTestRunName():"",r=this.provider.getSplitTestRunVersion?this.provider.getSplitTestRunVersion():"";return Object.assign(Object.assign({},t&&{splitTestRunName:t}),r&&{splitTestRunVersion:r})}makeLikeGeneratedAnswer(t){return this.makeCustomEvent(G.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(G.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(G.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent(G.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(G.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent(G.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(G.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(G.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(G.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(G.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(G.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(G.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(G.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(G.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(G.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(G.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return U(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(G.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Rs=Object.assign({},_i),Fg=Object.keys(Rs).map(e=>Rs[e]),uo=class extends id{constructor({client:t,uuidGenerator:r=sn}){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])=>Fg.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Fg.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Rs.pageview,{newEventType:Ae.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Rs.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 UC(this.ticket)}};uo.Id="svc";var Is;(function(e){e.click="click",e.flowStart="flowStart"})(Is||(Is={}));var Tt;(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"})(Tt||(Tt={}));var Ts;(function(e){e.quit="Quit",e.solved="Solved"})(Ts||(Ts={}));var _s=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!Cs();this.coveoAnalyticsClient=o?new Kt(t):new po,this.svc=new uo({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new po,this.svc=new uo({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Kt(this.options),this.svc=new uo({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(Tt.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(Tt.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(Tt.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(Tt.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(Tt.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(Tt.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(Tt.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(Tt.caseCancelled,{reason:Ts.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(Tt.caseSolved,{reason:Ts.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(Tt.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Is.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Is.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 Kt?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 $g=e=>new Kt(e).getCurrentVisitorId(),Pi=(e,t)=>typeof t=="function"?(...r)=>{let n=ii(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,Ni=(e,t)=>(...r)=>{let n=ii(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 ks(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function Qg(e){let{activeValue:t,ancestryMap:r}=DE(e);return t?ME(t,r):[]}function DE(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 ME(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var jE=(e,t)=>e.categoryFacetSet[t]?.request;var vd=(e,t)=>{let r=jE(e,t);return Qg(r?.currentValues??[])};m();d();f();p();function Os(){return{}}m();d();f();p();function Ps(){return{}}m();d();f();p();function Ns(){return{}}m();d();f();p();function Fs(){return{}}function Sd(e){return{facetSet:e.facetSet??Fs(),categoryFacetSet:e.categoryFacetSet??Os(),dateFacetSet:e.dateFacetSet??Ps(),numericFacetSet:e.numericFacetSet??Ns(),automaticFacetSet:e.automaticFacetSet??ks()}}var bd=e=>{let t=[];return UE(e).forEach((r,n)=>{let o=WE(e,r.facetId),i=HE(r,n+1);if(LE(r)){if(!!!vd(e,r.facetId).length)return;t.push({...i,...$E(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((a,s)=>{if(a.state==="idle")return;let l=Hg(a,s+1,o),c=qE(r)?zg(a):BE(a);t.push({...i,...l,...c})})}),VE(e).forEach((r,n)=>{let o=QE(r,n+1);r.values.forEach((i,a)=>{if(i.state==="idle")return;let s=Hg(i,a+1,"specific"),l=zg(i);t.push({...o,...s,...l})})}),t},qE=e=>e.type==="specific",LE=e=>e.type==="hierarchical",UE=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),VE=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),Hg=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),BE=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}),GE=(e,t)=>vd(e,t).map(n=>n.value).join(";"),$E=(e,t)=>{let n=GE(e,t);return{value:n,valuePosition:1,displayValue:n}},QE=(e,t)=>({title:Wg(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),HE=(e,t)=>({title:Wg(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),Wg=(e,t)=>`${e}_${t}`,zE=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,WE=(e,t)=>{let r=zE(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var wd=e=>e.configuration.search.locale,Kg=e=>e.configuration.search.timezone,Yg=e=>e.configuration.accessToken,Xg=e=>e.configuration.organizationId,Zg=e=>e.configuration.environment,Ds=e=>e.configuration?.knowledge?.agentId,Jg=e=>e.configuration.knowledge.debugAgentSession;var cn=e=>{if(KE(e)||Ad(e))return e.generatedAnswer?.answerId;if(YE(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},KE=e=>"answer"in e&&"generatedAnswer"in e&&!ce(e.generatedAnswer?.answerConfigurationId),Ad=e=>{let t=Ds(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},YE=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",xd=e=>e.generatedAnswer?.fieldsToIncludeInCitations,eh=e=>e.followUpAnswers?.conversationId,XE=e=>e.generatedAnswer?.citations,ZE=e=>e.followUpAnswers?.followUpAnswers,JE=Be(ZE,e=>e?.flatMap(t=>t.citations)),eR=(e,t)=>t,tR=Be(XE,JE,eR,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));m();d();f();p();var At=()=>({q:"",enableQuerySyntax:!1});m();d();f();p();m();d();f();p();var th=(r=>(r.Ascending="ascending",r.Descending="descending",r))(th||{}),rh=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(rh||{}),Cd=e=>{if(Qf(e))return e.map(t=>Cd(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""}},nh=()=>({by:"relevancy"});var JU=new ne({values:{by:new vl({enum:rh,required:!0}),order:new vl({enum:th}),field:new z}});function Ms(){return Cd(nh())}m();d();f();p();m();d();f();p();var fo=()=>"default";var rR=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},dr=class{constructor(t){ie(this,"getState",t);ie(this,"state");this.state=t()}getLanguage(){return rR(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=Zn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||fo()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};var Fi=class Fi extends dr{constructor(){super(...arguments);ie(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 bd(Sd(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Fi.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||$t().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Fi.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=cn(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??Ms()}}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]||"",l=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(n),partialQuery:s,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:i.length>0?i:"",querySuggestResponseId:l}}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||At().q}get responseTime(){return this.state.search?.duration||$t().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||$t().response.totalCountFiltered}};ie(Fi,"fallbackPipelineName","default");var Ir=Fi,oh=({logger:e,getState:t,analyticsClientMiddleware:r=(i,a)=>a,preprocessRequest:n,provider:o})=>{let i=t(),a=i.configuration.accessToken,s=i.configuration.analytics.apiBaseUrl??Et(i.configuration.organizationId,i.configuration.environment,"analytics"),l=i.configuration.analytics.runtimeEnvironment,c=i.configuration.analytics.enabled,g=new Es({token:a,endpoint:s,runtimeEnvironment:l,preprocessRequest:Pi(e,n),beforeSendHooks:[Ni(e,r),(v,E)=>(e.info({...E,type:v,endpoint:s,token:a},"Analytics request"),E)]},o);return c||g.disable(),g},Ed=()=>{let t=It.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};var js=/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield $g(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}),...(Ed()&&{pageId:Ed()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:so(e)})}}});return function js(_x17,_x18){return _ref10.apply(this,arguments)}}();m();d();f();p();m();d();f();p();m();d();f();p();var mo=()=>({duration:0,error:null,isLoading:!1,id:"Recommendation",recommendations:[],searchUid:"",splitTestRun:"",pipeline:""});var Di=class extends dr{getPipeline(){return this.state.pipeline||this.state.recommendation?.pipeline||"default"}getSearchEventRequestPayload(){return{queryText:At().q,responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getSearchUID(){return this.getState().recommendation?.searchUid||mo().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||mo().duration}mapResultsToAnalyticsDocument(){return this.state.recommendation?.recommendations.map(t=>({documentUri:t.uri,documentUriHash:t.raw.urihash}))}get numberOfResults(){return this.state.recommendation?.recommendations.length||mo().recommendations.length}};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function ih(){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 nR(e){return typeof e=="string"&&ah.test(e)}var Rd=nR;m();d();f();p();var nt=[];for(let e=0;e<256;++e)nt.push((e+256).toString(16).slice(1));function sh(e,t=0){return(nt[e[t+0]]+nt[e[t+1]]+nt[e[t+2]]+nt[e[t+3]]+"-"+nt[e[t+4]]+nt[e[t+5]]+"-"+nt[e[t+6]]+nt[e[t+7]]+"-"+nt[e[t+8]]+nt[e[t+9]]+"-"+nt[e[t+10]]+nt[e[t+11]]+nt[e[t+12]]+nt[e[t+13]]+nt[e[t+14]]+nt[e[t+15]]).toLowerCase()}m();d();f();p();var Id,oR=new Uint8Array(16);function Td(){if(!Id){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Id=crypto.getRandomValues.bind(crypto)}return Id(oR)}m();d();f();p();m();d();f();p();var iR=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),_d={randomUUID:iR};function aR(e,t,r){e=e||{};let n=e.random??e.rng?.()??Td();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 sh(n)}function sR(e,t,r){return _d.randomUUID&&!t&&!e?_d.randomUUID():aR(e,t,r)}var kd=sR;function cR(_x19){return _cR.apply(this,arguments)}function _cR(){_cR=_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 _cR.apply(this,arguments)}var fh="2.1.1",Od=128,mh=192,ch=224,uh=240,uR=248;function lR(e){return(e&uR)===uh?4:(e&uh)===ch?3:(e&ch)===mh?2:1}function dR(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&Od)!=Od)break;if(r-=3,(n&mh)!=Od){t-r>=lR(n)*3&&(r=t);break}}return e.substring(0,r)}function pR(e){let{trackingId:t}=e;return{trackingId:t}}function fR(e){return(e.source||[]).concat([`relay@${fh}`])}function gh(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,a=pR(t),s=r.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:fR(t),clientId:s,userAgent:i(),referrer:lh(n()),location:lh(o())})}function lh(e){return e!==null?dR(e,1024):null}function mR(e,t,r,n){return{...t,meta:gh(e,r,n)}}var gR="*";function hR(){let e=[];function t({type:l,callback:c}){return e.findIndex(g=>g.type===l&&g.callback===c)}function r(l,c){return l.type==="*"||c===l.type}function n(l){return t(l)<0&&e.push(l),()=>s(l.type,l.callback)}function o(l){e.forEach(c=>{if(r(c,l.meta.type))try{c.callback(l)}catch(g){console.error(g)}})}function i(l){if(l===gR)e.length=0;else for(let c=e.length-1;c>=0;c--)e[c].type===l&&e.splice(c,1)}function a(l){let c=t(l);c>=0&&e.splice(c,1)}function s(l,c){c?a({type:l,callback:c}):i(l)}return{add:n,call:o,remove:s}}function dh({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 yR(e){let t=dh(e);return{get:()=>t,update:r=>{t=dh({...t,...r})}}}var Pd=vR();function vR(){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 SR(){return{getItem(e){return Pd.getItem(e)||localStorage.getItem(e)},removeItem(e){Pd.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Pd.setItem(e,t,31556952e3)}}}var ph="visitorId";function bR(){let e=document.referrer;return e===""?null:e}function Nd(){let e=SR();return{runtime:"browser",send:function(){var _ref11=_asyncToGenerator(function*(t,r,n){let o=w(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});ih().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 l of s.events)if(!l.accepted)throw new Error(`Received event was rejected for processing: ${l.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:()=>bR(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(ph);if(t&&Rd(t))return t;let r=kd();return e.setItem(ph,r),r}}}function wR(){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 AR(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function xR(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=AR();return t&&r?{...r,runtime:"custom"}:t&&CR()&&wR()?Nd():n}function CR(){try{return typeof window=="object"}catch{return!1}}function ER(e){return{get:()=>Object.freeze(xR(e))}}function hh(e){let t=yR(e),r=hR(),n=ER(t);return{emit:function(){var _ref12=_asyncToGenerator(function*(o,i){let a=t.get(),s=n.get(),l=mR(o,i,a,s);return cR({config:a,environment:s,event:l,listenerManager:r})});return function emit(_x23,_x24){return _ref12.apply(this,arguments)}}(),getMeta:o=>gh(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:fh}}m();d();f();p();function yh(){return typeof window<"u"&&typeof document<"u"}var Mi=Be(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>so(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},a,s)=>{let l=IR(s);return hh({mode:i?"emit":"disabled",url:o??ka(e,t),token:r,trackingId:n??null,source:a,environment:l})}),RR={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref13=_asyncToGenerator(function*(){});return function send(){return _ref13.apply(this,arguments)}}()},IR=e=>{if(!e)return;let t=e();return{...(yh()?Nd():RR),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();var ji=class extends dr{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},vh=({logger:e,getState:t,analyticsClientMiddleware:r=(i,a)=>a,preprocessRequest:n,provider:o=new ji(t)})=>{let i=t(),a=i.configuration.accessToken,s=i.configuration.analytics.apiBaseUrl??Et(i.configuration.organizationId,i.configuration.environment,"analytics"),l=i.configuration.analytics.runtimeEnvironment,c=i.configuration.analytics.enabled,g=new _s({enableAnalytics:c,token:a,endpoint:s,runtimeEnvironment:l,preprocessRequest:Pi(e,n),beforeSendHooks:[Ni(e,r),(v,E)=>(e.info({...E,type:v,endpoint:s,token:a},"Analytics request"),E)]},o);return c||g.disable(),g};m();d();f();p();m();d();f();p();function bh(e,t){return{...new Ir(t).getBaseMetadata(),actionCause:e,type:e}}function TR(e){return Object.assign(e,{instantlyCallable:!0})}function _R(e,t){let r=i=>{let a=Re(e,i);return TR(Object.assign(a,{type:a.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(i,{getState:a,extra:s}){let{analyticsClientMiddleware:l,preprocessRequest:c,logger:g}=s;return yield(yield t({getState:a,analyticsClientMiddleware:l,preprocessRequest:c,logger:g})).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:l}){let{description:c,log:g}=yield t({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:l});return{description:c,action:r(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(v,{getState:E,extra:h}){return yield g({state:E(),extra:h})});return function(_x28,_x29){return _ref16.apply(this,arguments)}}())}});return function prepare(_x27){return _ref15.apply(this,arguments)}}()}),n}var wh=(e,t,r)=>{function n(...o){let i=o.length===1?{...o[0],__legacy__getBuilder:t(o[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:r}:{prefix:o[0],__legacy__getBuilder:t(o[1]),__legacy__provider:o[2],analyticsConfigurator:e,providerClass:r};return PR(i)}return n},kR=e=>e.configuration.analytics.analyticsMode==="legacy",OR=e=>e.configuration.analytics.analyticsMode==="next",PR=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:a})=>(r??(r=s=>new a(s)),_R(e,/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*({getState:s,analyticsClientMiddleware:l,preprocessRequest:c,logger:g}){let v=[],E={log:function(){var _ref18=_asyncToGenerator(function*({state:R}){for(let T of v)yield T(R)});return function log(_x31){return _ref18.apply(this,arguments)}}()},h=s(),y=i({getState:s,logger:g,analyticsClientMiddleware:l,preprocessRequest:c,provider:r(s)}),S=yield t(y,s());E.description=S?.description,v.push(/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(R){kR(R)&&(yield NR(S,r,R,g,y.coveoAnalyticsClient))});return function(_x32){return _ref19.apply(this,arguments)}}());let{emit:C}=Mi(h);return v.push(/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(R){if(OR(R)&&o&&n){let T=n(R);yield UR(C,o,T)}});return function(_x33){return _ref20.apply(this,arguments)}}()),E});return function(_x30){return _ref17.apply(this,arguments)}}()));function NR(_x34,_x35,_x36,_x37,_x38){return _NR.apply(this,arguments)}function _NR(){_NR=_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 _NR.apply(this,arguments)}var FR=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)}}()}),ft=wh(e=>oh({...e,provider:e.provider||new Ir(e.getState)}),e=>e,Ir),uB=wh(vh,FR("caseAssist"),ji);var Fd=(e,t)=>{let r=t.recommendation?.recommendations.findIndex(({uniqueId:n})=>e.uniqueId===n)||0;return DR(e,r,t)};function DR(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:qR(e),...(Sh(e)?{documentCategory:Sh(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:LR(e),queryPipeline:r.pipeline||no()}}function Sh(e){return e.raw?.objecttype||void 0}var qs=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||""}),Ah={urihash:new z,sourcetype:new z,permanentid:new z},xh={uniqueId:Z,raw:new ne({values:Ah}),title:Z,uri:Z,clickUri:Z,rankingModifier:new z({required:!1,emptyAllowed:!0})};function MR(e){return Object.assign({},...Object.keys(Ah).map(t=>({[t]:e[t]})))}function jR(e){return Object.assign({},...Object.keys(xh).map(t=>({[t]:e[t]})),{raw:MR(e.raw)})}function qR(e){let t=e.raw.author;return ce(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function LR(e){let t=e.raw.source;return ce(t)?"unknown":t}var Dd=e=>new mt(xh).validate(jR(e));function UR(_x40,_x41,_x42){return _UR.apply(this,arguments)}function _UR(){_UR=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _UR.apply(this,arguments)}m();d();f();p();var Ch=()=>ft("analytics/recommendation/update",e=>e.makeRecommendationInterfaceLoad(),e=>new Di(e)),Eh=()=>({actionCause:"recommendationInterfaceLoad"}),Us=e=>ft({prefix:"analytics/recommendation/open",__legacy__getBuilder:(t,r)=>(Dd(e),t.makeRecommendationOpen(Fd(e,r),qs(e))),__legacy__provider:t=>new Di(t),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=Fd(e,t),n=qs(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 go=N("recommendation/set",e=>$(e,{id:Z})),Tr=Re("recommendation/get",/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=Date.now(),a=yield VR(o),s=yield n.recommendations(a),l=Date.now()-i;return gt(s)?r(s.error):{recommendations:s.success.results,analyticsAction:Ch(),duration:l,searchUid:s.success.searchUid,splitTestRun:s.success.splitTestRun,pipeline:s.success.pipeline}});return function(_x43,_x44){return _ref22.apply(this,arguments)}}()),VR=/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??br(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?It.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 BR(e,Eh()))),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}),...(e.pagination&&{numberOfResults:e.pagination.numberOfResults})}});return function VR(_x45){return _ref23.apply(this,arguments)}}(),BR=/*#__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 js(e.configuration.analytics,r)});return function BR(_x46,_x47){return _ref24.apply(this,arguments)}}();var ho=Le(mo(),e=>{e.addCase(go,(t,r)=>{t.id=r.payload.id}).addCase(Tr.rejected,(t,r)=>{t.error=r.payload?r.payload:null,t.isLoading=!1}).addCase(Tr.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(Tr.pending,t=>{t.isLoading=!0}).addCase(fs,(t,r)=>{t.error=r.payload,t.isLoading=!1})});m();d();f();p();var yo=N("searchHub/set",e=>$(e,new z({required:!0,emptyAllowed:!0})));m();d();f();p();var vo=Le(fo(),e=>{e.addCase(yo,(t,r)=>r.payload).addCase(ht.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(zt,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Rh=class extends Error{constructor(t){super(t[0].message);ie(this,"issues");this.name="SchemaError",this.issues=t}};var fr="uninitialized",qd="pending",Li="fulfilled",Ui="rejected";function Ih(e){return{status:e,isUninitialized:e===fr,isLoading:e===qd,isSuccess:e===Li,isError:e===Ui}}var Th=Qt;function Bh(e,t){if(e===t||!(Th(e)&&Th(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]=Bh(e[a],t[a]),o&&(o=e[a]===i[a]);return o?e:i}function Ld(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function GR(e){return new RegExp("(^|:)//").test(e)}function $R(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Gd(e){return e!=null}function _h(e){return[...(e?.values()??[])].filter(Gd)}function QR(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var HR=e=>e.replace(/\/$/,""),zR=e=>e.replace(/^\//,"");function WR(e,t){if(!e)return t;if(!t)return e;if(GR(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=HR(e),t=zR(t),`${e}${r}${t}`}function Gs(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var Ud=()=>new Map,KR=e=>{let t=new u.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},YR=(...e)=>{for(let r of e)if(r.aborted)return u.AbortSignal.abort(r.reason);let t=new u.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},kh=(...e)=>w(...e),XR=e=>e.status>=200&&e.status<=299,ZR=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Oh(e){if(!Qt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var JR=e=>typeof e=="object"&&(Qt(e)||Array.isArray(e)||typeof e.toJSON=="function");function Gh({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=kh,paramsSerializer:n,isJsonContentType:o=ZR,jsonContentType:i="application/json",jsonReplacer:a,timeout:s,responseHandler:l,validateStatus:c,...g}={}){return typeof w>"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*(E,h,y){let{getState:S,extra:C,endpoint:R,forced:T,type:I}=h,k,{url:_,headers:D=new x(g.headers),params:B=void 0,responseHandler:L=l??"json",validateStatus:q=c??XR,timeout:V=s,...j}=typeof E=="string"?{url:E}:E,O={...g,signal:V?YR(h.signal,KR(V)):h.signal,...j};D=new x(Oh(D)),O.headers=(yield t(D,{getState:S,arg:E,extra:C,endpoint:R,forced:T,type:I,extraOptions:y}))||D;let P=JR(O.body);if(O.body!=null&&!P&&typeof O.body!="string"&&O.headers.delete("content-type"),!O.headers.has("content-type")&&P&&O.headers.set("content-type",i),P&&o(O.headers)&&(O.body=JSON.stringify(O.body,a)),O.headers.has("accept")||(L==="json"?O.headers.set("accept","application/json"):L==="text"&&O.headers.set("accept","text/plain, text/html, */*")),B){let te=~_.indexOf("?")?"&":"?",se=n?n(B):new URLSearchParams(Oh(B));_+=te+se}_=WR(e,_);let F=new Request(_,O);k={request:new Request(_,O)};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:k}}let X=Q.clone();k.response=X;let Y,W="";try{let te;if(yield Promise.all([v(Q,L).then(se=>Y=se,se=>te=se),X.text().then(se=>W=se,()=>{})]),te)throw te}catch(te){return{error:{status:"PARSING_ERROR",originalStatus:Q.status,data:W,error:String(te)},meta:k}}return q(Q,Y)?{data:Y,meta:k}:{error:{status:Q.status,data:Y},meta:k}});return function(_x48,_x49,_x50){return _ref25.apply(this,arguments)}}());function v(_x51,_x52){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(E,h){if(typeof h=="function")return h(E);if(h==="content-type"&&(h=o(E.headers)?"json":"text"),h==="json"){let y=yield E.text();return y.length?JSON.parse(y):null}return E.text()});return _v2.apply(this,arguments)}}var So=class{constructor(e,t=void 0){ie(this,"value");ie(this,"meta");this.value=e,this.meta=t}};function eI(){return _eI.apply(this,arguments)}function _eI(){_eI=_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 l=()=>{clearTimeout(s),a(new Error("Aborted"))};r.aborted?(clearTimeout(s),a(new Error("Aborted"))):r.addEventListener("abort",l,{once:!0})}})});return _eI.apply(this,arguments)}function $h(e,t){throw Object.assign(new So({error:e,meta:t}),{throwImmediately:!0})}function Md(e){e.aborted&&$h({status:"CUSTOM_ERROR",error:"Aborted"})}var Ph={},tI=(e,t)=>(/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(r,n,o){let i=[5,(t||Ph).maxRetries,(o||Ph).maxRetries].filter(g=>g!==void 0),[a]=i.slice(-1),l={maxRetries:a,backoff:eI,retryCondition:(g,v,{attempt:E})=>E<=a,...t,...o},c=0;for(;;){Md(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new So(g);return g}catch(g){if(c++,g.throwImmediately){if(g instanceof So)return g.value;throw g}if(g instanceof So){if(!l.retryCondition(g.value.error,r,{attempt:c,baseQueryApi:n,extraOptions:o}))return g.value}else if(c>l.maxRetries)return{error:g};Md(n.signal);try{yield l.backoff(c,l.maxRetries,n.signal)}catch(v){throw Md(n.signal),v}}}});return function(_x53,_x54,_x55){return _ref26.apply(this,arguments)}}()),Qh=Object.assign(tI,{fail:$h}),Qs="__rtkq/",rI="online",nI="offline";var Hh="focused";var $d=N(`${Qs}${Hh}`),zh=N(`${Qs}un${Hh}`),Qd=N(`${Qs}${rI}`),Wh=N(`${Qs}${nI}`);var Gi="query",Kh="mutation",Yh="infinitequery";function Hs(e){return e.type===Gi}function oI(e){return e.type===Kh}function zs(e){return e.type===Yh}function $s(e){return Hs(e)||zs(e)}function Hd(e,t,r,n,o,i){let a=iI(e)?e(t,r,n,o):e;return a?Ld(a,Gd,s=>i(Xh(s))):[]}function iI(e){return typeof e=="function"}function Xh(e){return typeof e=="string"?{type:e}:e}function aI(e,t){return e.catch(t)}var bo=(e,t)=>e.endpointDefinitions[t],Vi=Symbol("forceQueryFn"),Vd=e=>typeof e[Vi]=="function";function sI({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:a}){let s=_=>a(_)?.runningQueries,l=_=>a(_)?.runningMutations,{unsubscribeQueryResult:c,removeMutationResult:g,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:T,buildInitiateInfiniteQuery:I,buildInitiateMutation:k,getRunningQueryThunk:E,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:S};function E(_,D){return B=>{let L=bo(i,_),q=e({queryArgs:D,endpointDefinition:L,endpointName:_});return s(B)?.get(q)}}function h(_,D){return B=>l(B)?.get(D)}function y(){return _=>_h(s(_))}function S(){return _=>_h(l(_))}function C(_){}function R(_,D){let B=(L,{subscribe:q=!0,forceRefetch:V,subscriptionOptions:j,[Vi]:O,...P}={})=>(F,H)=>{let Q=e({queryArgs:L,endpointDefinition:D,endpointName:_}),X,Y={...P,type:Gi,subscribe:q,forceRefetch:V,subscriptionOptions:j,endpointName:_,originalArgs:L,queryCacheKey:Q,[Vi]:O};if(Hs(D))X=t(Y);else{let{direction:fe,initialPageParam:Se,refetchCachedPages:he}=P;X=r({...Y,direction:fe,initialPageParam:Se,refetchCachedPages:he})}let W=o.endpoints[_].select(L),te=F(X),se=W(H());let{requestId:Ee,abort:Me}=te,ke=se.requestId!==Ee,Pe=s(F)?.get(Q),Ne=()=>W(H()),ge=Object.assign(O?te.then(Ne):ke&&!Pe?Promise.resolve(se):Promise.all([Pe,te]).then(Ne),{arg:L,requestId:Ee,subscriptionOptions:j,queryCacheKey:Q,abort:Me,unwrap(){return _asyncToGenerator(function*(){let fe=yield ge;if(fe.isError)throw fe.error;return fe.data})()},refetch:fe=>F(B(L,{subscribe:!1,forceRefetch:!0,...fe})),unsubscribe(){q&&F(c({queryCacheKey:Q,requestId:Ee}))},updateSubscriptionOptions(fe){ge.subscriptionOptions=fe,F(v({endpointName:_,requestId:Ee,queryCacheKey:Q,options:fe}))}});if(!Pe&&!ke&&!O){let fe=s(F);fe.set(Q,ge),ge.then(()=>{fe.delete(Q)})}return ge};return B}function T(_,D){return R(_,D)}function I(_,D){return R(_,D)}function k(_){return(D,{track:B=!0,fixedCacheKey:L}={})=>(q,V)=>{let j=n({type:"mutation",endpointName:_,originalArgs:D,track:B,fixedCacheKey:L}),O=q(j);let{requestId:P,abort:F,unwrap:H}=O,Q=aI(O.unwrap().then(te=>({data:te})),te=>({error:te})),X=()=>{q(g({requestId:P,fixedCacheKey:L}))},Y=Object.assign(Q,{arg:O.arg,requestId:P,abort:F,unwrap:H,reset:X}),W=l(q);return W.set(P,Y),Y.then(()=>{W.delete(P)}),L&&(W.set(L,Y),Y.then(()=>{W.get(L)===Y&&W.delete(L)})),Y}}}var Zh=class extends Rh{constructor(t,r,n,o){super(t);ie(this,"value");ie(this,"schemaName");ie(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},un=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function ln(_x56,_x57,_x58,_x59){return _ln.apply(this,arguments)}function _ln(){_ln=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new Zh(o.issues,t,r,n);return o.value});return _ln.apply(this,arguments)}function Nh(e){return e}var qi=(e={})=>({...e,[Ei]:!0});function cI({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:a,onSchemaFailure:s,catchSchemaFailure:l,skipSchemaValidation:c}){let g=(j,O,P,F)=>(H,Q)=>{let X=r[j],Y=n({queryArgs:O,endpointDefinition:X,endpointName:j});if(H(o.internalActions.queryResultPatched({queryCacheKey:Y,patches:P})),!F)return;let W=o.endpoints[j].select(O)(Q()),te=Hd(X.providesTags,W.data,void 0,O,{},i);H(o.internalActions.updateProvidedBy([{queryCacheKey:Y,providedTags:te}]))};function v(j,O,P=0){let F=[O,...j];return P&&F.length>P?F.slice(0,-1):F}function E(j,O,P=0){let F=[...j,O];return P&&F.length>P?F.slice(1):F}let h=(j,O,P,F=!0)=>(H,Q)=>{let Y=o.endpoints[j].select(O)(Q()),W={patches:[],inversePatches:[],undo:()=>H(o.util.patchQueryData(j,O,W.inversePatches,F))};if(Y.status===fr)return W;let te;if("data"in Y)if(dt(Y.data)){let[se,Ee,Me]=Bl(Y.data,P);W.patches.push(...Ee),W.inversePatches.push(...Me),te=se}else te=P(Y.data),W.patches.push({op:"replace",path:[],value:te}),W.inversePatches.push({op:"replace",path:[],value:Y.data});return W.patches.length===0||H(o.util.patchQueryData(j,O,W.patches,F)),W},y=(j,O,P)=>F=>F(o.endpoints[j].initiate(O,{subscribe:!1,forceRefetch:!0,[Vi]:()=>({data:P})})),S=(j,O)=>j.query&&j[O]?j[O]:Nh,C=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(j,{signal:O,abort:P,rejectWithValue:F,fulfillWithValue:H,dispatch:Q,getState:X,extra:Y}){let W=r[j.endpointName],{metaSchema:te,skipSchemaValidation:se=c}=W,Ee=j.type===Gi;try{let Me=Nh,ke={signal:O,abort:P,dispatch:Q,getState:X,extra:Y,endpoint:j.endpointName,type:j.type,forced:Ee?R(j,X()):void 0,queryCacheKey:Ee?j.queryCacheKey:void 0},Pe=Ee?j[Vi]:void 0,Ne,ge=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(Se,he,$e,He){if(he==null&&Se.pages.length)return Promise.resolve({data:Se});let Ft={queryArg:j.originalArgs,pageParam:he},bt=yield fe(Ft),Bt=He?v:E;return{data:{pages:Bt(Se.pages,bt.data,$e),pageParams:Bt(Se.pageParams,he,$e)},meta:bt.meta}});return function ge(_x62,_x63,_x64,_x65){return _ref28.apply(this,arguments)}}();function fe(_x66){return _fe.apply(this,arguments)}function _fe(){_fe=_asyncToGenerator(function*(Se){let he,{extraOptions:$e,argSchema:He,rawResponseSchema:Ft,responseSchema:bt}=W;if(He&&!un(se,"arg")&&(Se=yield ln(He,Se,"argSchema",{})),Pe?he=Pe():W.query?(Me=S(W,"transformResponse"),he=yield t(W.query(Se),ke,$e)):he=yield W.queryFn(Se,ke,$e,Dt=>t(Dt,ke,$e)),typeof process<"u",he.error)throw new So(he.error,he.meta);let{data:Bt}=he;Ft&&!un(se,"rawResponse")&&(Bt=yield ln(Ft,he.data,"rawResponseSchema",he.meta));let Ct=yield Me(Bt,he.meta,Se);return bt&&!un(se,"response")&&(Ct=yield ln(bt,Ct,"responseSchema",he.meta)),{...he,data:Ct}});return _fe.apply(this,arguments)}if(Ee&&"infiniteQueryOptions"in W){let{infiniteQueryOptions:Se}=W,{maxPages:he=1/0}=Se,$e=j.refetchCachedPages??Se.refetchCachedPages??!0,He,Ft={pages:[],pageParams:[]},bt=a.selectQueryEntry(X(),j.queryCacheKey)?.data,Ct=R(j,X())&&!j.direction||!bt?Ft:bt;if("direction"in j&&j.direction&&Ct.pages.length){let Dt=j.direction==="backward",wa=(Dt?Jh:Bd)(Se,Ct,j.originalArgs);He=yield ge(Ct,wa,he,Dt)}else{let{initialPageParam:Dt=Se.initialPageParam}=j,Zo=bt?.pageParams??[],wa=Zo[0]??Dt,Nw=Zo.length;if(He=yield ge(Ct,wa,he),Pe&&(He={data:He.data.pages[0]}),$e)for(let Rf=1;Rf<Nw;Rf++){let Fw=Bd(Se,He.data,j.originalArgs);He=yield ge(He.data,Fw,he)}}Ne=He}else Ne=yield fe(j.originalArgs);return te&&!un(se,"meta")&&Ne.meta&&(Ne.meta=yield ln(te,Ne.meta,"metaSchema",Ne.meta)),H(Ne.data,qi({fulfilledTimeStamp:Date.now(),baseQueryMeta:Ne.meta}))}catch(Me){let ke=Me;if(ke instanceof So){let Pe=S(W,"transformErrorResponse"),{rawErrorResponseSchema:Ne,errorResponseSchema:ge}=W,{value:fe,meta:Se}=ke;try{Ne&&!un(se,"rawErrorResponse")&&(fe=yield ln(Ne,fe,"rawErrorResponseSchema",Se)),te&&!un(se,"meta")&&(Se=yield ln(te,Se,"metaSchema",Se));let he=yield Pe(fe,Se,j.originalArgs);return ge&&!un(se,"errorResponse")&&(he=yield ln(ge,he,"errorResponseSchema",Se)),F(he,qi({baseQueryMeta:Se}))}catch(he){ke=he}}try{if(ke instanceof Zh){let Pe={endpoint:j.endpointName,arg:j.originalArgs,type:j.type,queryCacheKey:Ee?j.queryCacheKey:void 0};W.onSchemaFailure?.(ke,Pe),s?.(ke,Pe);let{catchSchemaFailure:Ne=l}=W;if(Ne)return F(Ne(ke,Pe),qi({baseQueryMeta:ke._bqMeta}))}}catch(Pe){ke=Pe}throw typeof process<"u",console.error(ke),ke}});return function C(_x60,_x61){return _ref27.apply(this,arguments)}}();function R(j,O){let P=a.selectQueryEntry(O,j.queryCacheKey),F=a.selectConfig(O).refetchOnMountOrArgChange,H=P?.fulfilledTimeStamp,Q=j.forceRefetch??(j.subscribe&&F);return Q?Q===!0||(Number(new Date)-Number(H))/1e3>=Q:!1}let T=()=>Re(`${e}/executeQuery`,C,{getPendingMeta({arg:O}){let P=r[O.endpointName];return qi({startedTimeStamp:Date.now(),...(zs(P)?{direction:O.direction}:{})})},condition(O,{getState:P}){let F=P(),H=a.selectQueryEntry(F,O.queryCacheKey),Q=H?.fulfilledTimeStamp,X=O.originalArgs,Y=H?.originalArgs,W=r[O.endpointName],te=O.direction;return Vd(O)?!0:H?.status==="pending"?!1:R(O,F)||Hs(W)&&W?.forceRefetch?.({currentArg:X,previousArg:Y,endpointState:H,state:F})?!0:!(Q&&!te)},dispatchConditionRejection:!0}),I=T(),k=T(),_=Re(`${e}/executeMutation`,C,{getPendingMeta(){return qi({startedTimeStamp:Date.now()})}}),D=j=>"force"in j,B=j=>"ifOlderThan"in j,L=(j,O,P={})=>(F,H)=>{let Q=D(P)&&P.force,X=B(P)&&P.ifOlderThan,Y=(te=!0)=>{let se={forceRefetch:te,subscribe:!1};return o.endpoints[j].initiate(O,se)},W=o.endpoints[j].select(O)(H());if(Q)F(Y());else if(X){let te=W?.fulfilledTimeStamp;if(!te){F(Y());return}(Number(new Date)-Number(new Date(te)))/1e3>=X&&F(Y())}else F(Y(!1))};function q(j){return O=>O?.meta?.arg?.endpointName===j}function V(j,O){return{matchPending:Yn(rs(j),q(O)),matchFulfilled:Yn(sr(j),q(O)),matchRejected:Yn(nn(j),q(O))}}return{queryThunk:I,mutationThunk:_,infiniteQueryThunk:k,prefetch:L,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:V}}function Bd(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function Jh(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function ey(e,t,r,n){return Hd(r[e.meta.arg.endpointName][t],sr(e)?e.payload:void 0,Ii(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function Fh(e){return lt(e)?Ka(e):e}function Vs(e,t,r){let n=e[t];n&&r(n)}function Bi(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function Dh(e,t,r){let n=e[Bi(t)];n&&r(n)}var Bs={};function uI({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:a,hasRehydrationInfo:s},assertTagType:l,config:c}){let g=N(`${e}/resetApiState`);function v(q,V,j,O){var P;q[P=V.queryCacheKey]??(q[P]={status:fr,endpointName:V.endpointName}),Vs(q,V.queryCacheKey,F=>{F.status=qd,F.requestId=j&&F.requestId?F.requestId:O.requestId,V.originalArgs!==void 0&&(F.originalArgs=V.originalArgs),F.startedTimeStamp=O.startedTimeStamp;let H=o[O.arg.endpointName];zs(H)&&"direction"in V&&(F.direction=V.direction)})}function E(q,V,j,O){Vs(q,V.arg.queryCacheKey,P=>{if(P.requestId!==V.requestId&&!O)return;let{merge:F}=o[V.arg.endpointName];if(P.status=Li,F){if(P.data!==void 0){let{fulfilledTimeStamp:H,arg:Q,baseQueryMeta:X,requestId:Y}=V,W=tn(P.data,te=>F(te,j,{arg:Q.originalArgs,baseQueryMeta:X,fulfilledTimeStamp:H,requestId:Y}));P.data=W}else P.data=j;}else P.data=o[V.arg.endpointName].structuralSharing??!0?Bh(lt(P.data)?Cm(P.data):P.data,j):j;delete P.error,P.fulfilledTimeStamp=V.fulfilledTimeStamp})}let h=on({name:`${e}/queries`,initialState:Bs,reducers:{removeQueryResult:{reducer(q,{payload:{queryCacheKey:V}}){delete q[V]},prepare:Xn()},cacheEntriesUpserted:{reducer(q,V){for(let j of V.payload){let{queryDescription:O,value:P}=j;v(q,O,!0,{arg:O,requestId:V.meta.requestId,startedTimeStamp:V.meta.timestamp}),E(q,{arg:O,requestId:V.meta.requestId,fulfilledTimeStamp:V.meta.timestamp,baseQueryMeta:{}},P,!0)}},prepare:q=>({payload:q.map(O=>{let{endpointName:P,arg:F,value:H}=O,Q=o[P];return{queryDescription:{type:Gi,endpointName:P,originalArgs:O.arg,queryCacheKey:n({queryArgs:F,endpointDefinition:Q,endpointName:P})},value:H}}),meta:{[Ei]:!0,requestId:Ti(),timestamp:Date.now()}})},queryResultPatched:{reducer(q,{payload:{queryCacheKey:V,patches:j}}){Vs(q,V,O=>{O.data=Gl(O.data,j.concat())})},prepare:Xn()}},extraReducers(q){q.addCase(t.pending,(V,{meta:j,meta:{arg:O}})=>{let P=Vd(O);v(V,O,P,j)}).addCase(t.fulfilled,(V,{meta:j,payload:O})=>{let P=Vd(j.arg);E(V,j,O,P)}).addCase(t.rejected,(V,{meta:{condition:j,arg:O,requestId:P},error:F,payload:H})=>{Vs(V,O.queryCacheKey,Q=>{if(!j){if(Q.requestId!==P)return;Q.status=Ui,Q.error=H??F}})}).addMatcher(s,(V,j)=>{let{queries:O}=a(j);for(let[P,F]of Object.entries(O))(F?.status===Li||F?.status===Ui)&&(V[P]=F)})}}),y=on({name:`${e}/mutations`,initialState:Bs,reducers:{removeMutationResult:{reducer(q,{payload:V}){let j=Bi(V);j in q&&delete q[j]},prepare:Xn()}},extraReducers(q){q.addCase(r.pending,(V,{meta:j,meta:{requestId:O,arg:P,startedTimeStamp:F}})=>{P.track&&(V[Bi(j)]={requestId:O,status:qd,endpointName:P.endpointName,startedTimeStamp:F})}).addCase(r.fulfilled,(V,{payload:j,meta:O})=>{O.arg.track&&Dh(V,O,P=>{P.requestId===O.requestId&&(P.status=Li,P.data=j,P.fulfilledTimeStamp=O.fulfilledTimeStamp)})}).addCase(r.rejected,(V,{payload:j,error:O,meta:P})=>{P.arg.track&&Dh(V,P,F=>{F.requestId===P.requestId&&(F.status=Ui,F.error=j??O)})}).addMatcher(s,(V,j)=>{let{mutations:O}=a(j);for(let[P,F]of Object.entries(O))(F?.status===Li||F?.status===Ui)&&P!==F?.requestId&&(V[P]=F)})}}),S={tags:{},keys:{}},C=on({name:`${e}/invalidation`,initialState:S,reducers:{updateProvidedBy:{reducer(q,V){var j,O,P;for(let{queryCacheKey:F,providedTags:H}of V.payload){R(q,F);for(let{type:Q,id:X}of H){let Y=(O=(j=q.tags)[Q]??(j[Q]={}))[P=X||"__internal_without_id"]??(O[P]=[]);Y.includes(F)||Y.push(F)}q.keys[F]=H}},prepare:Xn()}},extraReducers(q){q.addCase(h.actions.removeQueryResult,(V,{payload:{queryCacheKey:j}})=>{R(V,j)}).addMatcher(s,(V,j)=>{var P,F,H;let{provided:O}=a(j);for(let[Q,X]of Object.entries(O.tags??{}))for(let[Y,W]of Object.entries(X)){let te=(F=(P=V.tags)[Q]??(P[Q]={}))[H=Y||"__internal_without_id"]??(F[H]=[]);for(let se of W)te.includes(se)||te.push(se),V.keys[se]=O.keys[se]}}).addMatcher(Ht(sr(t),Ii(t)),(V,j)=>{T(V,[j])}).addMatcher(h.actions.cacheEntriesUpserted.match,(V,j)=>{let O=j.payload.map(({queryDescription:P,value:F})=>({type:"UNKNOWN",payload:F,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:P}}));T(V,O)})}});function R(q,V){let j=Fh(q.keys[V]??[]);for(let O of j){let P=O.type,F=O.id??"__internal_without_id",H=q.tags[P]?.[F];H&&(q.tags[P][F]=Fh(H).filter(Q=>Q!==V))}delete q.keys[V]}function T(q,V){let j=V.map(O=>{let P=ey(O,"providesTags",o,l),{queryCacheKey:F}=O.meta.arg;return{queryCacheKey:F,providedTags:P}});C.caseReducers.updateProvidedBy(q,C.actions.updateProvidedBy(j))}let I=on({name:`${e}/subscriptions`,initialState:Bs,reducers:{updateSubscriptionOptions(q,V){},unsubscribeQueryResult(q,V){},internal_getRTKQSubscriptions(){}}}),k=on({name:`${e}/internalSubscriptions`,initialState:Bs,reducers:{subscriptionsUpdated:{reducer(q,V){return Gl(q,V.payload)},prepare:Xn()}}}),_=on({name:`${e}/config`,initialState:{online:QR(),focused:$R(),middlewareRegistered:!1,...c},reducers:{middlewareRegistered(q,{payload:V}){q.middlewareRegistered=q.middlewareRegistered==="conflict"||i!==V?"conflict":!0}},extraReducers:q=>{q.addCase(Qd,V=>{V.online=!0}).addCase(Wh,V=>{V.online=!1}).addCase($d,V=>{V.focused=!0}).addCase(zh,V=>{V.focused=!1}).addMatcher(s,V=>({...V}))}}),D=zn({queries:h.reducer,mutations:y.reducer,provided:C.reducer,subscriptions:k.reducer,config:_.reducer}),B=(q,V)=>D(g.match(V)?void 0:q,V),L={..._.actions,...h.actions,...I.actions,...k.actions,...y.actions,...C.actions,resetApiState:g};return{reducer:B,actions:L}}var jd=Symbol.for("RTKQ/skipToken"),ty={status:fr},Mh=tn(ty,()=>{}),jh=tn(ty,()=>{});function lI({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=I=>Mh,o=I=>jh;return{buildQuerySelector:E,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:S,selectCachedArgsForQuery:C,selectApiState:a,selectQueries:s,selectMutations:c,selectQueryEntry:l,selectConfig:g};function i(I){return{...I,...Ih(I.status)}}function a(I){return I[t]}function s(I){return a(I)?.queries}function l(I,k){return s(I)?.[k]}function c(I){return a(I)?.mutations}function g(I){return a(I)?.config}function v(I,k,_){return D=>{if(D===jd)return r(n,_);let B=e({queryArgs:D,endpointDefinition:k,endpointName:I});return r(q=>l(q,B)??Mh,_)}}function E(I,k){return v(I,k,i)}function h(I,k){let{infiniteQueryOptions:_}=k;function D(B){let L={...B,...Ih(B.status)},{isLoading:q,isError:V,direction:j}=L,O=j==="forward",P=j==="backward";return{...L,hasNextPage:R(_,L.data,L.originalArgs),hasPreviousPage:T(_,L.data,L.originalArgs),isFetchingNextPage:q&&O,isFetchingPreviousPage:q&&P,isFetchNextPageError:V&&O,isFetchPreviousPageError:V&&P}}return v(I,k,D)}function y(){return I=>{let k;return typeof I=="object"?k=Bi(I)??jd:k=I,r(k===jd?o:B=>a(B)?.mutations?.[k]??jh,i)}}function S(I,k){let _=I[t],D=new Set,B=Ld(k,Gd,Xh);for(let L of B){let q=_.provided.tags[L.type];if(!q)continue;let V=(L.id!==void 0?q[L.id]:Object.values(q).flat())??[];for(let j of V)D.add(j)}return Array.from(D.values()).flatMap(L=>{let q=_.queries[L];return q?{queryCacheKey:L,endpointName:q.endpointName,originalArgs:q.originalArgs}:[]})}function C(I,k){return Ld(Object.values(s(I)),_=>_?.endpointName===k&&_.status!==fr,_=>_.originalArgs)}function R(I,k,_){return k?Bd(I,k,_)!=null:!1}function T(I,k,_){return!k||!I.getPreviousPageParam?!1:Jh(I,k,_)!=null}}var qh=WeakMap?new WeakMap:void 0,Lh=({endpointName:e,queryArgs:t})=>{let r="",n=qh?.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=Qt(a)?Object.keys(a).sort().reduce((s,l)=>(s[l]=a[l],s),{}):a,a));Qt(t)&&qh?.set(t,o),r=o}return`${e}(${r})`};function dI(...e){return function(r){let n=xi(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=Lh;if("serializeQueryArgs"in c.endpointDefinition){let v=c.endpointDefinition.serializeQueryArgs;g=E=>{let h=v(E);return typeof h=="string"?h:Lh({...E,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(c)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(c){c()},apiUid:Ti(),extractRehydrationInfo:n,hasRehydrationInfo:xi(c=>n(c)!=null)},a={injectEndpoints:l,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,E]of Object.entries(g))typeof E=="function"?E(bo(i,v)):Object.assign(bo(i,v)||{},E);return a}},s=e.map(c=>c.init(a,o,i));function l(c){let g=c.endpoints({query:v=>({...v,type:Gi}),mutation:v=>({...v,type:Kh}),infiniteQuery:v=>({...v,type:Yh})});for(let[v,E]of Object.entries(g)){if(c.overrideExisting!==!0&&v in i.endpointDefinitions){if(c.overrideExisting==="throw")throw new Error(pt(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[v]=E;for(let h of s)h.injectEndpoint(v,E)}return a}return a.injectEndpoints({endpoints:r.endpoints})}}function pr(e,...t){return Object.assign(e,...t)}var pI=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,i=null,a=null,{updateSubscriptionOptions:s,unsubscribeQueryResult:l}=e.internalActions,c=(S,C)=>{if(s.match(C)){let{queryCacheKey:T,requestId:I,options:k}=C.payload,_=S.get(T);return _?.has(I)&&_.set(I,k),!0}if(l.match(C)){let{queryCacheKey:T,requestId:I}=C.payload,k=S.get(T);return k&&k.delete(I),!0}if(e.internalActions.removeQueryResult.match(C))return S.delete(C.payload.queryCacheKey),!0;if(t.pending.match(C)){let{meta:{arg:T,requestId:I}}=C,k=Gs(S,T.queryCacheKey,Ud);return T.subscribe&&k.set(I,T.subscriptionOptions??k.get(I)??{}),!0}let R=!1;if(t.rejected.match(C)){let{meta:{condition:T,arg:I,requestId:k}}=C;if(T&&I.subscribe){let _=Gs(S,I.queryCacheKey,Ud);_.set(k,I.subscriptionOptions??_.get(k)??{}),R=!0}}return R},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:S=>g().get(S)?.size??0,isRequestSubscribed:(S,C)=>!!g()?.get(S)?.get(C)};function y(S){return JSON.parse(JSON.stringify(Object.fromEntries([...S].map(([C,R])=>[C,Object.fromEntries(R)]))))}return(S,C)=>{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,h];let R=c(r.currentSubscriptions,S),T=!0;if(R){a||(a=setTimeout(()=>{let _=y(r.currentSubscriptions),[,D]=Bl(i,()=>_);C.next(e.internalActions.subscriptionsUpdated(D)),i=_,a=null},500));let I=typeof S.type=="string"&&!!S.type.startsWith(o),k=t.rejected.match(S)&&S.meta.condition&&!!S.meta.arg.subscribe;T=!I&&!k}return[T,!1]}},fI=2147483647/1e3-1,mI=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:a},getRunningQueryThunk:s,mwApi:l})=>{let{removeQueryResult:c,unsubscribeQueryResult:g,cacheEntriesUpserted:v}=t.internalActions,E=Ht(g.match,r.fulfilled,r.rejected,v.match);function h(I){let k=o.currentSubscriptions.get(I);return k?k.size>0:!1}let y={};function S(I){for(let k of I.values())k?.abort?.()}let C=(I,k)=>{let _=k.getState(),D=a(_);if(E(I)){let B;if(v.match(I))B=I.payload.map(L=>L.queryDescription.queryCacheKey);else{let{queryCacheKey:L}=g.match(I)?I.payload:I.meta.arg;B=[L]}R(B,k,D)}if(t.util.resetApiState.match(I)){for(let[B,L]of Object.entries(y))L&&clearTimeout(L),delete y[B];S(o.runningQueries),S(o.runningMutations)}if(n.hasRehydrationInfo(I)){let{queries:B}=n.extractRehydrationInfo(I);R(Object.keys(B),k,D)}};function R(I,k,_){let D=k.getState();for(let B of I){let L=i(D,B);L?.endpointName&&T(B,L.endpointName,k,_)}}function T(I,k,_,D){let L=bo(n,k)?.keepUnusedDataFor??D.keepUnusedDataFor;if(L===1/0)return;let q=Math.max(0,Math.min(L,fI));if(!h(I)){let V=y[I];V&&clearTimeout(V),y[I]=setTimeout(()=>{if(!h(I)){let j=i(_.getState(),I);j?.endpointName&&_.dispatch(s(j.endpointName,j.originalArgs))?.abort(),_.dispatch(c({queryCacheKey:I}))}delete y[I]},q*1e3)}}return C},Uh=new Error("Promise never resolved before cacheEntryRemoved."),gI=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:a,selectApiState:s}})=>{let l=ns(n),c=ns(o),g=sr(n,o),v={},{removeQueryResult:E,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function S(_,D,B){let L=v[_];L?.valueResolved&&(L.valueResolved({data:D,meta:B}),delete L.valueResolved)}function C(_){let D=v[_];D&&(delete v[_],D.cacheEntryRemoved())}function R(_){let{arg:D,requestId:B}=_.meta,{endpointName:L,originalArgs:q}=D;return[L,q,B]}let T=(_,D,B)=>{let L=I(_);function q(V,j,O,P){let F=a(B,j),H=a(D.getState(),j);!F&&H&&k(V,P,j,D,O)}if(n.pending.match(_)){let[V,j,O]=R(_);q(V,L,O,j)}else if(y.match(_))for(let{queryDescription:V,value:j}of _.payload){let{endpointName:O,originalArgs:P,queryCacheKey:F}=V;q(O,F,_.meta.requestId,P),S(F,j,{})}else if(o.pending.match(_)){if(D.getState()[t].mutations[L]){let[j,O,P]=R(_);k(j,O,L,D,P)}}else if(g(_))S(L,_.payload,_.meta.baseQueryMeta);else if(E.match(_)||h.match(_))C(L);else if(e.util.resetApiState.match(_))for(let V of Object.keys(v))C(V)};function I(_){return l(_)?_.meta.arg.queryCacheKey:c(_)?_.meta.arg.fixedCacheKey??_.meta.requestId:E.match(_)?_.payload.queryCacheKey:h.match(_)?Bi(_.payload):""}function k(_,D,B,L,q){let V=bo(r,_),j=V?.onCacheEntryAdded;if(!j)return;let O={},P=new Promise(W=>{O.cacheEntryRemoved=W}),F=Promise.race([new Promise(W=>{O.valueResolved=W}),P.then(()=>{throw Uh})]);F.catch(()=>{}),v[B]=O;let H=e.endpoints[_].select($s(V)?D:B),Q=L.dispatch((W,te,se)=>se),X={...L,getCacheEntry:()=>H(L.getState()),requestId:q,extra:Q,updateCachedData:$s(V)?W=>L.dispatch(e.util.updateQueryData(_,D,W)):void 0,cacheDataLoaded:F,cacheEntryRemoved:P},Y=j(D,X);Promise.resolve(Y).catch(W=>{if(W!==Uh)throw W})}return T},hI=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},yI=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:a,refetchQuery:s,internalState:l})=>{let{removeQueryResult:c}=i.internalActions,g=Ht(sr(n),Ii(n)),v=Ht(sr(o,n),nn(o,n)),E=[],h=0,y=(R,T)=>{(o.pending.match(R)||n.pending.match(R))&&h++,v(R)&&(h=Math.max(0,h-1)),g(R)?C(ey(R,"invalidatesTags",r,a),T):v(R)?C([],T):i.util.invalidateTags.match(R)&&C(Hd(R.payload,void 0,void 0,void 0,void 0,a),T)};function S(){return h>0}function C(R,T){let I=T.getState(),k=I[e];if(E.push(...R),k.config.invalidationBehavior==="delayed"&&S())return;let _=E;if(E=[],_.length===0)return;let D=i.util.selectInvalidatedBy(I,_);t.batch(()=>{let B=Array.from(D.values());for(let{queryCacheKey:L}of B){let q=k.queries[L],V=Gs(l.currentSubscriptions,L,Ud);q&&(V.size===0?T.dispatch(c({queryCacheKey:L})):q.status!==fr&&T.dispatch(s(q)))}})}return y},vI=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:a}=o,s=new Set,l=null,c=(C,R)=>{(r.internalActions.updateSubscriptionOptions.match(C)||r.internalActions.unsubscribeQueryResult.match(C))&&g(C.payload.queryCacheKey,R),(t.pending.match(C)||t.rejected.match(C)&&C.meta.condition)&&g(C.meta.arg.queryCacheKey,R),(t.fulfilled.match(C)||t.rejected.match(C)&&!C.meta.condition)&&v(C.meta.arg,R),r.util.resetApiState.match(C)&&(y(),l&&(clearTimeout(l),l=null),s.clear())};function g(C,R){s.add(C),l||(l=setTimeout(()=>{for(let T of s)E({queryCacheKey:T},R);s.clear(),l=null},0))}function v({queryCacheKey:C},R){let T=R.getState()[e],I=T.queries[C],k=a.get(C);if(!I||I.status===fr)return;let{lowestPollingInterval:_,skipPollingIfUnfocused:D}=S(k);if(!Number.isFinite(_))return;let B=i.get(C);B?.timeout&&(clearTimeout(B.timeout),B.timeout=void 0);let L=Date.now()+_;i.set(C,{nextPollTimestamp:L,pollingInterval:_,timeout:setTimeout(()=>{(T.config.focused||!D)&&R.dispatch(n(I)),v({queryCacheKey:C},R)},_)})}function E({queryCacheKey:C},R){let I=R.getState()[e].queries[C],k=a.get(C);if(!I||I.status===fr)return;let{lowestPollingInterval:_}=S(k);if(!Number.isFinite(_)){h(C);return}let D=i.get(C),B=Date.now()+_;(!D||B<D.nextPollTimestamp)&&v({queryCacheKey:C},R)}function h(C){let R=i.get(C);R?.timeout&&clearTimeout(R.timeout),i.delete(C)}function y(){for(let C of i.keys())h(C)}function S(C=new Map){let R=!1,T=Number.POSITIVE_INFINITY;for(let I of C.values())I.pollingInterval&&(T=Math.min(I.pollingInterval,T),R=I.skipPollingIfUnfocused||R);return{lowestPollingInterval:T,skipPollingIfUnfocused:R}}return c},SI=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=rs(r,n),i=nn(r,n),a=sr(r,n),s={};return(c,g)=>{if(o(c)){let{requestId:v,arg:{endpointName:E,originalArgs:h}}=c.meta,y=bo(t,E),S=y?.onQueryStarted;if(S){let C={},R=new Promise((_,D)=>{C.resolve=_,C.reject=D});R.catch(()=>{}),s[v]=C;let T=e.endpoints[E].select($s(y)?h:v),I=g.dispatch((_,D,B)=>B),k={...g,getCacheEntry:()=>T(g.getState()),requestId:v,extra:I,updateCachedData:$s(y)?_=>g.dispatch(e.util.updateQueryData(E,h,_)):void 0,queryFulfilled:R};S(h,k)}}else if(a(c)){let{requestId:v,baseQueryMeta:E}=c.meta;s[v]?.resolve({data:c.payload,meta:E}),delete s[v]}else if(i(c)){let{requestId:v,rejectedWithValue:E,baseQueryMeta:h}=c.meta;s[v]?.reject({error:c.payload??c.error,isUnhandledError:!E,meta:h}),delete s[v]}}},bI=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,a=(l,c)=>{$d.match(l)&&s(c,"refetchOnFocus"),Qd.match(l)&&s(c,"refetchOnReconnect")};function s(l,c){let g=l.getState()[e],v=g.queries,E=o.currentSubscriptions;t.batch(()=>{for(let h of E.keys()){let y=v[h],S=E.get(h);if(!S||!y)continue;let C=[...S.values()];(C.some(T=>T[c]===!0)||C.every(T=>T[c]===void 0)&&g.config[c])&&(S.size===0?l.dispatch(i({queryCacheKey:h})):y.status!==fr&&l.dispatch(n(y)))}})}return a};function wI(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:a}=o,s={invalidateTags:N(`${t}/invalidateTags`)},l=E=>E.type.startsWith(`${t}/`),c=[hI,mI,yI,vI,gI,SI];return{middleware:E=>{let h=!1,y=i(E.dispatch),S={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:l,mwApi:E},C=c.map(I=>I(S)),R=pI(S),T=bI(S);return I=>k=>{if(!li(k))return I(k);h||(h=!0,E.dispatch(n.internalActions.middlewareRegistered(a)));let _={...E,next:I},D=E.getState(),[B,L]=R(k,_,D),q;if(B?q=I(k):q=L,E.getState()[t]&&(T(k,_,D),l(k)||o.hasRehydrationInfo(k)))for(let V of C)V(k,_,D);return q}},actions:s};function v(E){return e.api.endpoints[E.endpointName].initiate(E.originalArgs,{subscribe:!1,forceRefetch:!0})}}var Vh=Symbol(),AI=({createSelector:e=Be}={})=>({name:Vh,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:a,refetchOnMountOrArgChange:s,refetchOnFocus:l,refetchOnReconnect:c,invalidationBehavior:g,onSchemaFailure:v,catchSchemaFailure:E,skipSchemaValidation:h},y){Om();let S=ge=>(typeof process<"u",ge);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:Qd,onOffline:Wh,onFocus:$d,onFocusLost:zh},util:{}});let C=lI({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:R,selectCachedArgsForQuery:T,buildQuerySelector:I,buildInfiniteQuerySelector:k,buildMutationSelector:_}=C;pr(t.util,{selectInvalidatedBy:R,selectCachedArgsForQuery:T});let{queryThunk:D,infiniteQueryThunk:B,mutationThunk:L,patchQueryData:q,updateQueryData:V,upsertQueryData:j,prefetch:O,buildMatchThunkActions:P}=cI({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:S,selectors:C,onSchemaFailure:v,catchSchemaFailure:E,skipSchemaValidation:h}),{reducer:F,actions:H}=uI({context:y,queryThunk:D,infiniteQueryThunk:B,mutationThunk:L,serializeQueryArgs:i,reducerPath:o,assertTagType:S,config:{refetchOnFocus:l,refetchOnReconnect:c,refetchOnMountOrArgChange:s,keepUnusedDataFor:a,reducerPath:o,invalidationBehavior:g}});pr(t.util,{patchQueryData:q,updateQueryData:V,upsertQueryData:j,prefetch:O,resetApiState:H.resetApiState,upsertQueryEntries:H.cacheEntriesUpserted}),pr(t.internalActions,H);let Q=new WeakMap,X=ge=>Gs(Q,ge,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:Y,buildInitiateInfiniteQuery:W,buildInitiateMutation:te,getRunningMutationThunk:se,getRunningMutationsThunk:Ee,getRunningQueriesThunk:Me,getRunningQueryThunk:ke}=sI({queryThunk:D,mutationThunk:L,infiniteQueryThunk:B,api:t,serializeQueryArgs:i,context:y,getInternalState:X});pr(t.util,{getRunningMutationThunk:se,getRunningMutationsThunk:Ee,getRunningQueryThunk:ke,getRunningQueriesThunk:Me});let{middleware:Pe,actions:Ne}=wI({reducerPath:o,context:y,queryThunk:D,mutationThunk:L,infiniteQueryThunk:B,api:t,assertTagType:S,selectors:C,getRunningQueryThunk:ke,getInternalState:X});return pr(t.util,Ne),pr(t,{reducer:F,middleware:Pe}),{name:Vh,injectEndpoint(ge,fe){var $e;let he=($e=t.endpoints)[ge]??($e[ge]={});Hs(fe)&&pr(he,{name:ge,select:I(ge,fe),initiate:Y(ge,fe)},P(D,ge)),oI(fe)&&pr(he,{name:ge,select:_(),initiate:te(ge)},P(L,ge)),zs(fe)&&pr(he,{name:ge,select:k(ge,fe),initiate:W(ge,fe)},P(D,ge))}}}}),ry=dI(AI());m();d();f();p();m();d();f();p();var dn=e=>e.query,ny=e=>e.query?.enableQuerySyntax;var BG=Be(e=>dn(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})),xI=Be(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();var wo=(e,t,r)=>ft({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let i=t??cn(o);if(!i)return null;let a=eh(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:r,...(a&&{conversationId:a})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??cn(n)??"",answerGenerated:e??!1})}),Ao=e=>ft({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??cn(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})});m();d();f();p();m();d();f();p();var oy=Be(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:o}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(o&&{lq:o})}});m();d();f();p();var $i=(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:so(e)}});m();d();f();p();var zd=e=>e.context;m();d();f();p();var Wd=e=>e.pipeline;m();d();f();p();m();d();f();p();var Qi=Mt(Ws(),1),ly=Mt(iy(),1);m();d();f();p();var Ks=Mt(Ws(),1),sy=Mt(ay(),1);Ks.default.extend(sy.default);var cy="YYYY/MM/DD@HH:mm:ss",CI="1401-01-01";function xo(e,t){let r=(0,Ks.default)(e,t);return!r.isValid()&&!t?(0,Ks.default)(e,cy):r}function Ys(e){return e.format(cy)}function uy(e,t){let r=xo(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}`)}tp(r)}function tp(e){if(e.isBefore(CI))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}Qi.default.extend(ly.default);var dy=["past","now","next"],py=["minute","hour","day","week","month","quarter","year"],EI=e=>{let t=e==="now";return{amount:new oe({required:!t,min:1}),unit:new z({required:!t,constrainTo:py}),period:new z({required:!0,constrainTo:dy})}};function rp(e){if(typeof e=="string"&&!_r(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?yy(e):e;new mt(EI(t.period)).validate(t);let r=my(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);tp(r)}function fy(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function my(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Qi.default)().subtract(r,n);case"next":return(0,Qi.default)().add(r,n);case"now":return(0,Qi.default)()}}function Hi(e){return Ys(my(yy(e)))}function gy(e){return e.toLocaleLowerCase().split("-")}function _r(e){let[t,r,n]=gy(e);if(t==="now")return!0;if(!dy.includes(t)||!py.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function hy(e){return!!e&&typeof e=="object"&&"period"in e}function yy(e){let[t,r,n]=gy(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function vy(e){return e.type==="dateRange"}function Sy(e){return`start${e}`}function by(e){return`end${e}`}var np=()=>({dateFacetValueMap:{}});function RI(e,t,r){let n=e.start,o=e.end;return _r(n)&&(n=Hi(n),r.dateFacetValueMap[t][Sy(n)]=e.start),_r(o)&&(o=Hi(o),r.dateFacetValueMap[t][by(o)]=e.end),{...e,start:n,end:o}}function op(e,t){if(vy(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>RI(o,r,t))}}return e}function kr(e){let t=np();return{request:{...e,facets:e.facets?.map(n=>op(n,t))},mappings:t}}function II(e,t,r){return{...e,start:r.dateFacetValueMap[t][Sy(e.start)]||e.start,end:r.dateFacetValueMap[t][by(e.end)]||e.end}}function TI(e,t){return e.facetId in t.dateFacetValueMap}function _I(e,t){return TI(e,t)?{...e,values:e.values.map(r=>II(r,e.facetId,t))}:e}function Xs(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>_I(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function Or(e){return Object.values(e).map(t=>t.request)}function ip(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 wy(e){return Or(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var ap={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function kI(e){return Or(e).map(t=>{let r=ap[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function OI(e){return[...kI(e.facetSet??{}),...wy(e.numericFacetSet??{}),...wy(e.dateFacetSet??{}),...Or(e.categoryFacetSet??{})]}function PI(e){return OI(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function Zs(e){return ip(PI(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();var Pr=/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??br(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:It.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 js(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 Pr(_x67,_x68){return _ref29.apply(this,arguments)}}();m();d();f();p();var Co=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??br(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&&$i(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 Ay=Be(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o}));var Nr=/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t,r){let n=cp(e),o=NI(e),i=FI(e),a=e.configuration.analytics.analyticsMode==="legacy"?yield Pr(e,r):Co(e,t,r);return kr({...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:sp(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 Nr(_x69,_x70,_x71){return _ref30.apply(this,arguments)}}();function sp(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function NI(e){return ip(MI(e),e.facetOrder??[])}function FI(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(DI).filter(r=>r.currentValues.length>0):void 0}function DI(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function MI(e){return jI(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function jI(e){return[...qI(e.facetSet??{}),...xy(e.numericFacetSet??{}),...xy(e.dateFacetSet??{}),...Or(e.categoryFacetSet??{})]}function qI(e){return Or(e).map(t=>{let r=ap[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function xy(e){return Or(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 cp(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=Ay(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();f();p();m();d();f();p();var zi=(e,t)=>{let r=e;return ce(r[t])?ce(e.raw[t])?null:e.raw[t]:r[t]},LI=e=>t=>e.every(r=>!ce(zi(t,r))),UI=e=>t=>e.every(r=>ce(zi(t,r))),VI=(e,t)=>r=>{let n=Cy(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},BI=(e,t)=>r=>{let n=Cy(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},Cy=(e,t)=>{let r=zi(t,e);return Hf(r)?r:[r]},Ey={getResultProperty:zi,fieldsMustBeDefined:LI,fieldsMustNotBeDefined:UI,fieldMustMatch:VI,fieldMustNotMatch:BI};var up=Be(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var lp=e=>e.searchHub;m();d();f();p();var Js=Be(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),EQ=Be(e=>e,e=>{let t=Js(e);return t&&e?e[t].expression:""});m();d();f();p();var Ry=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var Iy=e=>e.excerptLength?.length;m();d();f();p();var Ty=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var _y=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 Oy=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Hn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function Oy(_x72){return _ref31.apply(this,arguments)}}(),Py=(e,t)=>{let r=dn(e)?.q,{aq:n,cq:o,dq:i,lq:a}=Dy(e),s=zd(e),l=$i(e.configuration.analytics,t,{actionCause:up(e)}),c=lp(e),g=Wd(e),v=xd(e)??[],E=Fy(e),h=Js(e.tabSet)||"default",y=wd(e),S=Kg(e),C=t.referrer||"",R=Ty(e),T=ky(e),I=GI(e),k=Iy(e),_=_y(e),D=Ry(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(a&&{lq:a}),...(e.query&&{enableQuerySyntax:ny(e)}),...(s?.contextValues&&{context:s.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(c?.length&&{searchHub:c}),...(g?.length&&{pipeline:g}),...(E.length&&{facets:E}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(e.pagination&&{numberOfResults:sp(e),firstResult:e.pagination.firstResult}),tab:h,locale:y,timezone:S,...(e.debug!==void 0&&{debug:e.debug}),referrer:C,...I,...(_??{}),...(k&&{excerptLength:k}),...(D&&{dictionaryFieldContext:D}),sortCriteria:T,...(R&&{facetOptions:R}),...l,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Ny=(e,t)=>{let r=dn(e)?.q,n=Fy(e),o=$i(e.configuration.analytics,t,{actionCause:up(e)}),i=wd(e),a=Js(e.tabSet)||"default",s=t.referrer,{aq:l,cq:c}=Dy(e),g=lp(e),v=Wd(e),E=zd(e),h=xd(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(v?.length&&{pipeline:v}),...(E?.contextValues&&{context:E.contextValues}),...(l&&{aq:l}),...(c&&{cq:c}),tab:a,referrer:s,...o,locale:i}},Fy=e=>Zs(e)?.map(t=>op(t,np())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),GI=e=>({actionsHistory:e.configuration.analytics.enabled?It.getInstance().getHistory():[]}),Dy=e=>{let t=oy(e),r=cp(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var ec=["searching","thinking","answering"];function tc(e){return e.toLowerCase()}m();d();f();p();var My=["text/plain","text/markdown"];var Eo=new z({required:!0}),jy=new z,Ro=new me({required:!0}),dp={id:Eo,title:Eo,uri:Eo,permanentid:Eo,clickUri:jy},rc=new z({required:!0,constrainTo:My}),qy=new z({required:!0,constrainTo:ec}),Ly=e=>({...e,name:tc(e.name)}),QH=N("generatedAnswer/setIsVisible",e=>$(e,Ro)),nc=N("generatedAnswer/setAnswerId",e=>$(e,Z)),HH=N("generatedAnswer/setAnswerGenerationMode",e=>$(e,new z({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),zH=N("generatedAnswer/setIsEnabled",e=>$(e,Ro)),Ki=N("generatedAnswer/updateMessage",e=>$(e,{textDelta:Eo})),Yi=N("generatedAnswer/updateCitations",e=>$(e,{citations:new ve({required:!0,each:new ne({values:dp})})})),Xi=N("generatedAnswer/updateError",e=>$(e,{message:jy,code:new oe({min:0})})),oc=N("generatedAnswer/resetAnswer"),WH=N("generatedAnswer/like"),KH=N("generatedAnswer/dislike"),YH=N("generatedAnswer/feedbackModal/open"),XH=N("generatedAnswer/expand"),ZH=N("generatedAnswer/collapse"),JH=N("generatedAnswer/setId",e=>$(e,{id:new z({required:!0})})),ez=N("generatedAnswer/feedbackModal/close"),tz=N("generatedAnswer/sendFeedback"),Fr=N("generatedAnswer/setIsLoading",e=>$(e,Ro)),Wi=N("generatedAnswer/setIsStreaming",e=>$(e,Ro)),Zi=N("generatedAnswer/setAnswerContentFormat",e=>$(e,rc)),rz=N("generatedAnswer/updateResponseFormat",e=>$(e,{contentFormat:new ve({each:rc,default:["text/plain"]})})),nz=N("knowledge/updateAnswerConfigurationId",e=>$(e,Eo)),oz=N("generatedAnswer/registerFieldsToIncludeInCitations",e=>$(e,as)),pp=N("generatedAnswer/setIsAnswerGenerated",e=>$(e,Ro)),Ji=N("generatedAnswer/setCannotAnswer",e=>$(e,Ro)),$I=N("generatedAnswer/setAnswerApiQueryParams",e=>$(e,new ne({}))),Uy=N("generatedAnswer/startStep",e=>$(Ly(e),{name:qy,startedAt:new oe({min:0,required:!0})})),Vy=N("generatedAnswer/finishStep",e=>$(Ly(e),{name:qy,finishedAt:new oe({min:0,required:!0})})),iz=Re("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:i}=t,{search:a}=i(),{queryExecuted:s}=a,{setAbortControllerRef:l}=e,c=yield Oy(r),g=(h,y)=>{switch(h){case"genqa.headerMessageType":{let S=JSON.parse(y);n(Zi(S.contentFormat));break}case"genqa.messageType":n(Ki(JSON.parse(y)));break;case"genqa.citationsType":n(Yi(JSON.parse(y)));break;case"genqa.endOfStreamType":{let S=JSON.parse(y).answerGenerated,{answerId:C,answer:R}=i().generatedAnswer,I=s.length!==0&&!S,k=!R?.trim();n(Ji(I)),n(Wi(!1)),n(pp(S)),n(wo(S,C,S?k:void 0)),n(Ao());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${h}"`)}};n(Fr(!0));let v=h=>h.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,E=o.streamingClient?.streamGeneratedAnswer(c,{write:h=>{v(c)&&(n(Fr(!1)),h.payload&&h.payloadType&&g(h.payloadType,h.payload))},abort:h=>{v(c)&&n(Xi(h))},close:()=>{v(c)&&n(Wi(!1))},resetAnswer:()=>{v(c)&&n(oc())}});E?l(E):n(Fr(!1))});return function(_x73,_x74){return _ref32.apply(this,arguments)}}()),az=Re("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(oc());let i=t();if(i.generatedAnswer.answerConfigurationId){let a=Py(i,n);r($I(a)),yield r(By(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 $y(_x77,_x78){return _$y.apply(this,arguments)}function _$y(){_$y=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _$y.apply(this,arguments)}function Qy(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=HI(t,a);let s=t.length,l=0;for(;r<s;){o&&(t[r]===10&&(l=++r),o=!1);let c=-1;for(;r<s&&c===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-l);break;case 13:o=!0,c=r;break;case 10:c=r;break}if(c===-1)break;e(t.subarray(l,c),n),l=r,n=-1}l===s?t=void 0:l!==0&&(t=t.subarray(l),r-=l)}}function Hy(e,t,r){let n=Gy(),o=new TextDecoder;return function(a,s){if(a.length===0)r?.(n),n=Gy();else if(s>0){let l=o.decode(a.subarray(0,s)),c=s+(a[s+1]===32?2:1),g=o.decode(a.subarray(c));switch(l){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":QI(g,n,t);break}}}}function QI(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function HI(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function Gy(){return{data:"",event:"",id:"",retry:void 0}}var fp="text/event-stream",zI=1e3,zy="last-event-id";function Wy(){return typeof window<"u"}function Ky(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:a,openWhenHidden:s,fetch:l,...c}){return new Promise((g,v)=>{let E={...r};E.accept||(E.accept=fp);let h;function y(){h?.abort(),document.hidden||k()}!s&&Wy()&&document.addEventListener("visibilitychange",y);let S=zI,C;function R(){Wy()&&document.removeEventListener("visibilitychange",y),clearTimeout(C),h?.abort()}t?.addEventListener("abort",()=>{R(),g()});let T=l??w,I=n??WI;function k(){return _k2.apply(this,arguments)}function _k2(){_k2=_asyncToGenerator(function*(){h=u.AbortController?new u.AbortController:null;try{let _=yield T(e,{...c,headers:E,signal:h?.signal});yield I(_),yield $y(_.body,Qy(Hy(D=>{D?E[zy]=D:delete E[zy]},D=>{S=D},o))),i?.(),R(),g()}catch(_){if(!h?.signal?.aborted)try{let D=a?.(_)??S;clearTimeout(C),C=setTimeout(k,D)}catch(D){R(),v(D)}}});return _k2.apply(this,arguments)}k()})}function WI(e){let t=e.headers.get("content-type");if(!t?.startsWith(fp))throw new Error(`Expected content-type to be ${fp}, Actual: ${t}`)}m();d();f();p();var KI=/*#__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,l={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let c=Hn(n.configuration.search?.apiBaseUrl,a,i);return Gh({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,E={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{E[h]=g[h]}),E.duplex="half",E.body=yield g.text(),w(v,E)});return function fetchFn(_x82){return _ref35.apply(this,arguments)}}()})(l,{...t,signal:null},r)}catch(c){return{error:c}}});return function KI(_x79,_x80,_x81){return _ref34.apply(this,arguments)}}(),Yy=ry({reducerPath:"answer",baseQuery:Qh(KI,{maxRetries:3}),endpoints:()=>({})});var YI=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},XI=(e,t)=>{let{textDelta:r}=t;if(typeof r!="string")return;let n=e.answer;!n?.trim()&&!r.trim()||(e.answer=n?.trim()?n.concat(r):r)},ZI=(e,t)=>{e.citations=t.citations},JI=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},eT=(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})`)},tT=(e,t,r)=>{let n=JSON.parse(e.data);n.finishReason==="ERROR"&&n.errorMessage&&eT(t,n);let o=n.payload.length?JSON.parse(n.payload):{};switch(n.payloadType){case"genqa.headerMessageType":o.contentFormat&&(YI(t,o),r(Zi(o.contentFormat)));break;case"genqa.messageType":typeof o.textDelta=="string"&&(XI(t,o),r(Ki({textDelta:o.textDelta})));break;case"genqa.citationsType":o.citations&&(ZI(t,o),r(Yi({citations:o.citations})));break;case"genqa.endOfStreamType":{JI(t,o);let i=t.answerId,a=o.answerGenerated??!1,s=a?!t.answer?.trim():void 0;r(wo(a,i,s)),r(Ao());break}}},rT=(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`},mp=Yy.injectEndpoints({overrideExisting:!0,endpoints:e=>({getAnswer:e.query({queryFn:()=>({data:{contentFormat:void 0,answer:void 0,citations:void 0,error:void 0,generated:!1,isStreaming:!0,isLoading:!0}}),serializeQueryArgs:({endpointName:t,queryArgs:r})=>{let{analytics:n,...o}=r;return`${t}(${JSON.stringify(o)})`},onCacheEntryAdded(_x83,_x84){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:i}){yield n;let{configuration:a,generatedAnswer:s,insightConfiguration:l}=r(),{organizationId:c,environment:g,accessToken:v}=a,E=Hn(a.search.apiBaseUrl,c,g),h=rT(E,c,s.answerConfigurationId,l?.insightId);yield Ky(h,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${v}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:w,onopen:function(){var _ref36=_asyncToGenerator(function*(y){let S=y.headers.get("x-answer-id");S&&o(C=>{C.answerId=S,i(nc(S))})});return function onopen(_x85){return _ref36.apply(this,arguments)}}(),onmessage:y=>{o(S=>{tT(y,S,i)})},onerror:y=>{throw y},onclose:()=>{o(y=>{i(Ji(!y.generated))})}})}).apply(this,arguments)}})})}),By=e=>mp.endpoints.getAnswer.initiate(e);m();d();f();p();var Xy=Le(Zn,e=>e);m();d();f();p();function nT(e){let t=e.payload?.analyticsAction;return Zy(e)&&!ce(t)}function Zy(e){return"type"in e}var Jy=e=>t=>r=>{let n;nT(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return Zy(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 n4=N("tab/register",e=>{let t=new ne({values:{id:Z,expression:tt}});return $(e,t)}),ic=N("tab/updateActiveTab",e=>$(e,Z));m();d();f();p();var ac=Mt(Ws(),1),rv=Mt(ev(),1),nv=Mt(tv(),1);ac.default.extend(nv.default);ac.default.extend(rv.default);var ov=()=>({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 oT=/(^|; )Coveo-Pendragon=([^;]*)/,iT=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function iv(){return typeof window>"u"?!1:oT.exec(document.cookie)?.pop()||null}function av(){return typeof window>"u"?!1:iT.test(document.cookie)}var sv=Le(ov(),e=>e.addCase(Cr,(t,r)=>{aT(t,r.payload)}).addCase(zt,(t,r)=>{sT(t,r.payload)}).addCase(Jn,(t,r)=>{cT(t,r.payload)}).addCase(eo,t=>{t.analytics.enabled=!1}).addCase(to,t=>{t.analytics.enabled=!0}).addCase(ss,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(cs,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(ic,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(hg,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Er,(t,r)=>{ce(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(mg,(t,{payload:r})=>{uT(t,r)}));function aT(e,t){ce(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ce(t.organizationId)||(e.organizationId=t.organizationId)}function sT(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 cT(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=iv();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 uT(e,t){e.knowledge.agentId=t;try{let r=av();ce(r)||(e.knowledge.debugAgentSession=!0)}catch{}}var qt=sv;m();d();f();p();function lT(e){return e.instantlyCallable}var cv=()=>e=>t=>e(lT(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 ot=[];for(let e=0;e<256;++e)ot.push((e+256).toString(16).slice(1));function uv(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()}m();d();f();p();var Sp,dT=new Uint8Array(16);function bp(){if(!Sp){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Sp=crypto.getRandomValues.bind(crypto)}return Sp(dT)}m();d();f();p();m();d();f();p();var pT=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),wp={randomUUID:pT};function fT(e,t,r){if(wp.randomUUID&&!t&&!e)return wp.randomUUID();e=e||{};let n=e.random??e.rng?.()??bp();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 uv(n)}var Dr=fT;m();d();f();p();m();d();f();p();var A={};ei(A,{BRAND:()=>LT,DIRTY:()=>fn,EMPTY_PATH:()=>yT,INVALID:()=>le,NEVER:()=>x_,OK:()=>ct,ParseStatus:()=>it,Schema:()=>be,ZodAny:()=>qr,ZodArray:()=>yr,ZodBigInt:()=>gn,ZodBoolean:()=>hn,ZodBranded:()=>ta,ZodCatch:()=>In,ZodDate:()=>yn,ZodDefault:()=>Rn,ZodDiscriminatedUnion:()=>uc,ZodEffects:()=>Pt,ZodEnum:()=>Cn,ZodError:()=>yt,ZodFirstPartyTypeKind:()=>de,ZodFunction:()=>dc,ZodIntersection:()=>wn,ZodIssueCode:()=>K,ZodLazy:()=>An,ZodLiteral:()=>xn,ZodMap:()=>Po,ZodNaN:()=>Fo,ZodNativeEnum:()=>En,ZodNever:()=>Lt,ZodNull:()=>Sn,ZodNullable:()=>Zt,ZodNumber:()=>mn,ZodObject:()=>vt,ZodOptional:()=>kt,ZodParsedType:()=>re,ZodPipeline:()=>ra,ZodPromise:()=>Lr,ZodReadonly:()=>Tn,ZodRecord:()=>lc,ZodSchema:()=>be,ZodSet:()=>No,ZodString:()=>jr,ZodSymbol:()=>ko,ZodTransformer:()=>Pt,ZodTuple:()=>Xt,ZodType:()=>be,ZodUndefined:()=>vn,ZodUnion:()=>bn,ZodUnknown:()=>hr,ZodVoid:()=>Oo,addIssueToContext:()=>ee,any:()=>WT,array:()=>ZT,bigint:()=>GT,boolean:()=>bv,coerce:()=>A_,custom:()=>yv,date:()=>$T,datetimeRegex:()=>gv,defaultErrorMap:()=>mr,discriminatedUnion:()=>r_,effect:()=>m_,enum:()=>d_,function:()=>c_,getErrorMap:()=>Io,getParsedType:()=>Yt,instanceof:()=>VT,intersection:()=>n_,isAborted:()=>sc,isAsync:()=>To,isDirty:()=>cc,isValid:()=>Mr,late:()=>UT,lazy:()=>u_,literal:()=>l_,makeIssue:()=>ea,map:()=>a_,nan:()=>BT,nativeEnum:()=>p_,never:()=>YT,null:()=>zT,nullable:()=>h_,number:()=>Sv,object:()=>JT,objectUtil:()=>Ap,oboolean:()=>w_,onumber:()=>b_,optional:()=>g_,ostring:()=>S_,pipeline:()=>v_,preprocess:()=>y_,promise:()=>f_,quotelessJson:()=>mT,record:()=>i_,set:()=>s_,setErrorMap:()=>hT,strictObject:()=>e_,string:()=>vv,symbol:()=>QT,transformer:()=>m_,tuple:()=>o_,undefined:()=>HT,union:()=>t_,unknown:()=>KT,util:()=>Ce,void:()=>XT});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 Ap;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Ap||(Ap={}));var re=Ce.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yt=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"]),mT=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),yt=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,l=0;for(;l<a.path.length;){let c=a.path[l];l===a.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(r(a))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};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()}};yt.create=e=>new yt(e);var gT=(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}},mr=gT;var lv=mr;function hT(e){lv=e}function Io(){return lv}m();d();f();p();var ea=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="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)s=c(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}},yT=[];function ee(e,t){let r=Io(),n=ea({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===mr?void 0:mr].filter(o=>!!o)});e.common.issues.push(n)}var it=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 le;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 le;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}}},le=Object.freeze({status:"aborted"}),fn=e=>({status:"dirty",value:e}),ct=e=>({status:"valid",value:e}),sc=e=>e.status==="aborted",cc=e=>e.status==="dirty",Mr=e=>e.status==="valid",To=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 Ot=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}},dv=(e,t)=>{if(Mr(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 yt(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:l}=e;return a.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:l??r??s.defaultError}},description:o}}var be=class{get description(){return this._def.description}_getType(t){return Yt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Yt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new it,ctx:{common:t.parent.common,data:t.data,parsedType:Yt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(To(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:Yt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return dv(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Mr(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=>Mr(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:Yt(t)},o=_this11._parse({data:t,path:n.path,parent:n}),i=yield To(o)?o:Promise.resolve(o);return dv(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(l=>l?!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 Pt({schema:this,typeName:de.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 kt.create(this,this._def)}nullable(){return Zt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return yr.create(this)}promise(){return Lr.create(this,this._def)}or(t){return bn.create([this,t],this._def)}and(t){return wn.create(this,t,this._def)}transform(t){return new Pt({...ye(this._def),schema:this,typeName:de.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Rn({...ye(this._def),innerType:this,defaultValue:r,typeName:de.ZodDefault})}brand(){return new ta({typeName:de.ZodBranded,type:this,...ye(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new In({...ye(this._def),innerType:this,catchValue:r,typeName:de.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return ra.create(this,t)}readonly(){return Tn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},vT=/^c[^\s-]{8,}$/i,ST=/^[0-9a-z]+$/,bT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wT=/^[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,AT=/^[a-z0-9_-]{21}$/i,xT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,CT=/^[-+]?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)?)??$/,ET=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,RT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",xp,IT=/^(?:(?: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])$/,TT=/^(?:(?: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])$/,_T=/^(([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]))$/,kT=/^(([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])$/,OT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,PT=/^([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])))",NT=new RegExp(`^${fv}$`);function mv(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function FT(e){return new RegExp(`^${mv(e)}$`)}function gv(e){let t=`${fv}T${mv(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 DT(e,t){return!!((t==="v4"||!t)&&IT.test(e)||(t==="v6"||!t)&&_T.test(e))}function MT(e,t){if(!xT.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 jT(e,t){return!!((t==="v4"||!t)&&TT.test(e)||(t==="v6"||!t)&&kT.test(e))}var jr=class e extends be{_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}),le}let n=new it,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")ET.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")xp||(xp=new RegExp(RT,"u")),xp.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")wT.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")AT.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")vT.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")ST.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")bT.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"?gv(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"?NT.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?FT(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"?CT.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"duration",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?DT(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"?MT(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"?jT(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"?OT.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"base64",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?PT.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,...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}};jr.create=e=>new jr({checks:[],typeName:de.ZodString,coerce:e?.coerce??!1,...ye(e)});function qT(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 mn=class e extends be{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}),le}let n,o=new it;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"?qT(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,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"&&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)}};mn.create=e=>new mn({checks:[],typeName:de.ZodNumber,coerce:e?.coerce||!1,...ye(e)});var gn=class e extends be{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 it;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}),le}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}};gn.create=e=>new gn({checks:[],typeName:de.ZodBigInt,coerce:e?.coerce??!1,...ye(e)});var hn=class extends be{_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}),le}return ct(t.data)}};hn.create=e=>new hn({typeName:de.ZodBoolean,coerce:e?.coerce||!1,...ye(e)});var yn=class e extends be{_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}),le}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_date}),le}let n=new it,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: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}};yn.create=e=>new yn({checks:[],coerce:e?.coerce||!1,typeName:de.ZodDate,...ye(e)});var ko=class extends be{_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}),le}return ct(t.data)}};ko.create=e=>new ko({typeName:de.ZodSymbol,...ye(e)});var vn=class extends be{_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}),le}return ct(t.data)}};vn.create=e=>new vn({typeName:de.ZodUndefined,...ye(e)});var Sn=class extends be{_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}),le}return ct(t.data)}};Sn.create=e=>new Sn({typeName:de.ZodNull,...ye(e)});var qr=class extends be{constructor(){super(...arguments),this._any=!0}_parse(t){return ct(t.data)}};qr.create=e=>new qr({typeName:de.ZodAny,...ye(e)});var hr=class extends be{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ct(t.data)}};hr.create=e=>new hr({typeName:de.ZodUnknown,...ye(e)});var Lt=class extends be{_parse(t){let r=this._getOrReturnCtx(t);return ee(r,{code:K.invalid_type,expected:re.never,received:r.parsedType}),le}};Lt.create=e=>new Lt({typeName:de.ZodNever,...ye(e)});var Oo=class extends be{_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}),le}return ct(t.data)}};Oo.create=e=>new Oo({typeName:de.ZodVoid,...ye(e)});var yr=class e extends be{_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}),le;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 Ot(r,a,r.path,s)))).then(a=>it.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Ot(r,a,r.path,s)));return it.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)}};yr.create=(e,t)=>new yr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:de.ZodArray,...ye(t)});function _o(e){if(e instanceof vt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=kt.create(_o(n))}return new vt({...e._def,shape:()=>t})}else return e instanceof yr?new yr({...e._def,type:_o(e.element)}):e instanceof kt?kt.create(_o(e.unwrap())):e instanceof Zt?Zt.create(_o(e.unwrap())):e instanceof Xt?Xt.create(e.items.map(t=>_o(t))):e}var vt=class e extends be{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 c=this._getOrReturnCtx(t);return ee(c,{code:K.invalid_type,expected:re.object,received:c.parsedType}),le}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Lt&&this._def.unknownKeys==="strip"))for(let c in o.data)a.includes(c)||s.push(c);let l=[];for(let c of a){let g=i[c],v=o.data[c];l.push({key:{status:"valid",value:c},value:g._parse(new Ot(o,v,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Lt){let c=this._def.unknownKeys;if(c==="passthrough")for(let g of s)l.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];l.push({key:{status:"valid",value:g},value:c._parse(new Ot(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 l){let v=yield g.key,E=yield g.value;c.push({key:v,value:E,alwaysSet:g.alwaysSet})}return c})).then(c=>it.mergeObjectSync(n,c)):it.mergeObjectSync(n,l)}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:de.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 _o(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 kt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return hv(Ce.objectKeys(this.shape))}};vt.create=(e,t)=>new vt({shape:()=>e,unknownKeys:"strip",catchall:Lt.create(),typeName:de.ZodObject,...ye(t)});vt.strictCreate=(e,t)=>new vt({shape:()=>e,unknownKeys:"strict",catchall:Lt.create(),typeName:de.ZodObject,...ye(t)});vt.lazycreate=(e,t)=>new vt({shape:e,unknownKeys:"strip",catchall:Lt.create(),typeName:de.ZodObject,...ye(t)});var bn=class extends be{_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 yt(s.ctx.common.issues));return ee(r,{code:K.invalid_union,unionErrors:a}),le}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 l of n){let c={...r,common:{...r.common,issues:[]},parent:null},g=l._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(l=>new yt(l));return ee(r,{code:K.invalid_union,unionErrors:s}),le}}get options(){return this._def.options}};bn.create=(e,t)=>new bn({options:e,typeName:de.ZodUnion,...ye(t)});var gr=e=>e instanceof An?gr(e.schema):e instanceof Pt?gr(e.innerType()):e instanceof xn?[e.value]:e instanceof Cn?e.options:e instanceof En?Ce.objectValues(e.enum):e instanceof Rn?gr(e._def.innerType):e instanceof vn?[void 0]:e instanceof Sn?[null]:e instanceof kt?[void 0,...gr(e.unwrap())]:e instanceof Zt?[null,...gr(e.unwrap())]:e instanceof ta||e instanceof Tn?gr(e.unwrap()):e instanceof In?gr(e._def.innerType):[],uc=class e extends be{_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}),le;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]}),le)}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=gr(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:de.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...ye(n)})}};function Cp(e,t){let r=Yt(e),n=Yt(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 l=Cp(e[s],t[s]);if(!l.valid)return{valid:!1};a[s]=l.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],l=Cp(a,s);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return r===re.date&&n===re.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var wn=class extends be{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(sc(i)||sc(a))return le;let s=Cp(i.value,a.value);return s.valid?((cc(i)||cc(a))&&r.dirty(),{status:r.value,value:s.data}):(ee(n,{code:K.invalid_intersection_types}),le)};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}))}};wn.create=(e,t,r)=>new wn({left:e,right:t,typeName:de.ZodIntersection,...ye(r)});var Xt=class e extends be{_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}),le;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"}),le;!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 l=this._def.items[s]||this._def.rest;return l?l._parse(new Ot(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>it.mergeArray(r,a)):it.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Xt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xt({items:e,typeName:de.ZodTuple,rest:null,...ye(t)})};var lc=class e extends be{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}),le;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Ot(n,s,n.path,s)),value:a._parse(new Ot(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?it.mergeObjectAsync(r,o):it.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof be?new e({keyType:t,valueType:r,typeName:de.ZodRecord,...ye(n)}):new e({keyType:jr.create(),valueType:t,typeName:de.ZodRecord,...ye(r)})}},Po=class extends be{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}),le;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,l],c)=>({key:o._parse(new Ot(n,s,n.path,[c,"key"])),value:i._parse(new Ot(n,l,n.path,[c,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let l of a){let c=yield l.key,g=yield l.value;if(c.status==="aborted"||g.status==="aborted")return le;(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 l of a){let c=l.key,g=l.value;if(c.status==="aborted"||g.status==="aborted")return le;(c.status==="dirty"||g.status==="dirty")&&r.dirty(),s.set(c.value,g.value)}return{status:r.value,value:s}}}};Po.create=(e,t,r)=>new Po({valueType:t,keyType:e,typeName:de.ZodMap,...ye(r)});var No=class e extends be{_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}),le;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(l){let c=new Set;for(let g of l){if(g.status==="aborted")return le;g.status==="dirty"&&r.dirty(),c.add(g.value)}return{status:r.value,value:c}}let s=[...n.data.values()].map((l,c)=>i._parse(new Ot(n,l,n.path,c)));return n.common.async?Promise.all(s).then(l=>a(l)):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)}};No.create=(e,t)=>new No({valueType:e,minSize:null,maxSize:null,typeName:de.ZodSet,...ye(t)});var dc=class e extends be{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}),le;function n(s,l){return ea({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Io(),mr].filter(c=>!!c),issueData:{code:K.invalid_arguments,argumentsError:l}})}function o(s,l){return ea({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Io(),mr].filter(c=>!!c),issueData:{code:K.invalid_return_type,returnTypeError:l}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Lr){let s=this;return ct(/*#__PURE__*/_asyncToGenerator(function*(...l){let c=new yt([]),g=yield s._def.args.parseAsync(l,i).catch(h=>{throw c.addIssue(n(l,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 ct(function(...l){let c=s._def.args.safeParse(l,i);if(!c.success)throw new yt([n(l,c.error)]);let g=Reflect.apply(a,this,c.data),v=s._def.returns.safeParse(g,i);if(!v.success)throw new yt([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:Xt.create(t).rest(hr.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||Xt.create([]).rest(hr.create()),returns:r||hr.create(),typeName:de.ZodFunction,...ye(n)})}},An=class extends be{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})}};An.create=(e,t)=>new An({getter:e,typeName:de.ZodLazy,...ye(t)});var xn=class extends be{_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}),le}return{status:"valid",value:t.data}}get value(){return this._def.value}};xn.create=(e,t)=>new xn({value:e,typeName:de.ZodLiteral,...ye(t)});function hv(e,t){return new Cn({values:e,typeName:de.ZodEnum,...ye(t)})}var Cn=class e extends be{_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}),le}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}),le}return ct(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})}};Cn.create=hv;var En=class extends be{_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}),le}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}),le}return ct(t.data)}get enum(){return this._def.values}};En.create=(e,t)=>new En({values:e,typeName:de.ZodNativeEnum,...ye(t)});var Lr=class extends be{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}),le;let n=r.parsedType===re.promise?r.data:Promise.resolve(r.data);return ct(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Lr.create=(e,t)=>new Lr({type:e,typeName:de.ZodPromise,...ye(t)});var Pt=class extends be{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===de.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 le;let l=yield _this12._def.schema._parseAsync({data:s,path:n.path,parent:n});return l.status==="aborted"?le:l.status==="dirty"?fn(l.value):r.value==="dirty"?fn(l.value):l});return function(_x87){return _ref41.apply(this,arguments)}}());{if(r.value==="aborted")return le;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?le:s.status==="dirty"?fn(s.value):r.value==="dirty"?fn(s.value):s}}if(o.type==="refinement"){let a=s=>{let l=o.refinement(s,i);if(n.common.async)return Promise.resolve(l);if(l 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"?le:(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"?le:(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(!Mr(a))return le;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=>Mr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):le);Ce.assertNever(o)}};Pt.create=(e,t,r)=>new Pt({schema:e,typeName:de.ZodEffects,effect:t,...ye(r)});Pt.createWithPreprocess=(e,t,r)=>new Pt({schema:t,effect:{type:"preprocess",transform:e},typeName:de.ZodEffects,...ye(r)});var kt=class extends be{_parse(t){return this._getType(t)===re.undefined?ct(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};kt.create=(e,t)=>new kt({innerType:e,typeName:de.ZodOptional,...ye(t)});var Zt=class extends be{_parse(t){return this._getType(t)===re.null?ct(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Zt.create=(e,t)=>new Zt({innerType:e,typeName:de.ZodNullable,...ye(t)});var Rn=class extends be{_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}};Rn.create=(e,t)=>new Rn({innerType:e,typeName:de.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ye(t)});var In=class extends be{_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 To(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new yt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new yt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};In.create=(e,t)=>new In({innerType:e,typeName:de.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ye(t)});var Fo=class extends be{_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}),le}return{status:"valid",value:t.data}}};Fo.create=e=>new Fo({typeName:de.ZodNaN,...ye(e)});var LT=Symbol("zod_brand"),ta=class extends be{_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}},ra=class e extends be{_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"?le:i.status==="dirty"?(r.dirty(),fn(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"?le: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:de.ZodPipeline})}},Tn=class extends be{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Mr(o)&&(o.value=Object.freeze(o.value)),o);return To(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Tn.create=(e,t)=>new Tn({innerType:e,typeName:de.ZodReadonly,...ye(t)});function pv(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function yv(e,t={},r){return e?qr.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=pv(t,n),l=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:l})}});if(!i){let a=pv(t,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):qr.create()}var UT={object:vt.lazycreate},de;(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"})(de||(de={}));var VT=(e,t={message:`Input not instance of ${e.name}`})=>yv(r=>r instanceof e,t),vv=jr.create,Sv=mn.create,BT=Fo.create,GT=gn.create,bv=hn.create,$T=yn.create,QT=ko.create,HT=vn.create,zT=Sn.create,WT=qr.create,KT=hr.create,YT=Lt.create,XT=Oo.create,ZT=yr.create,JT=vt.create,e_=vt.strictCreate,t_=bn.create,r_=uc.create,n_=wn.create,o_=Xt.create,i_=lc.create,a_=Po.create,s_=No.create,c_=dc.create,u_=An.create,l_=xn.create,d_=Cn.create,p_=En.create,f_=Lr.create,m_=Pt.create,g_=kt.create,h_=Zt.create,y_=Pt.createWithPreprocess,v_=ra.create,S_=()=>vv().optional(),b_=()=>Sv().optional(),w_=()=>bv().optional(),A_={string:e=>jr.create({...e,coerce:!0}),number:e=>mn.create({...e,coerce:!0}),boolean:e=>hn.create({...e,coerce:!0}),bigint:e=>gn.create({...e,coerce:!0}),date:e=>yn.create({...e,coerce:!0})};var x_=le;var C_=A.object({name:A.string(),arguments:A.string()}),E_=A.object({id:A.string(),type:A.literal("function"),function:C_,encryptedValue:A.string().optional()}),pc=A.object({id:A.string(),role:A.string(),content:A.string().optional(),name:A.string().optional(),encryptedValue:A.string().optional()}),R_=A.object({type:A.literal("text"),text:A.string()}),I_=A.object({type:A.literal("data"),value:A.string(),mimeType:A.string()}),T_=A.object({type:A.literal("url"),value:A.string(),mimeType:A.string().optional()}),fc=A.discriminatedUnion("type",[I_,T_]),__=A.object({type:A.literal("image"),source:fc,metadata:A.unknown().optional()}),k_=A.object({type:A.literal("audio"),source:fc,metadata:A.unknown().optional()}),O_=A.object({type:A.literal("video"),source:fc,metadata:A.unknown().optional()}),P_=A.object({type:A.literal("document"),source:fc,metadata:A.unknown().optional()});var wv=A.object({type:A.literal("binary"),mimeType:A.string(),id:A.string().optional(),url:A.string().optional(),data:A.string().optional(),filename:A.string().optional()}),Av=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:A.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},F6=wv.superRefine((e,t)=>{Av(e,t)}),N_=A.discriminatedUnion("type",[R_,__,k_,O_,P_,wv]),F_=N_.superRefine((e,t)=>{e.type==="binary"&&Av(e,t)}),D_=pc.extend({role:A.literal("developer"),content:A.string()}),M_=pc.extend({role:A.literal("system"),content:A.string()}),j_=pc.extend({role:A.literal("assistant"),content:A.string().optional(),toolCalls:A.array(E_).optional()}),q_=pc.extend({role:A.literal("user"),content:A.union([A.string(),A.array(F_)])}),L_=A.object({id:A.string(),content:A.string(),role:A.literal("tool"),toolCallId:A.string(),error:A.string().optional(),encryptedValue:A.string().optional()}),U_=A.object({id:A.string(),role:A.literal("activity"),activityType:A.string(),content:A.record(A.any())}),V_=A.object({id:A.string(),role:A.literal("reasoning"),content:A.string(),encryptedValue:A.string().optional()}),xv=A.discriminatedUnion("role",[D_,M_,j_,q_,L_,U_,V_]),D6=A.union([A.literal("developer"),A.literal("system"),A.literal("assistant"),A.literal("user"),A.literal("tool"),A.literal("activity"),A.literal("reasoning")]),B_=A.object({description:A.string(),value:A.string()}),Cv=A.object({name:A.string(),description:A.string(),parameters:A.any(),metadata:A.record(A.any()).optional()}),G_=A.object({threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),state:A.any(),messages:A.array(xv),tools:A.array(Cv),context:A.array(B_),forwardedProps:A.any()}),$_=A.any(),Ue=class extends Error{constructor(e){super(e)}},Ep=class extends Ue{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},Q_=A.object({name:A.string(),description:A.string().optional()}),H_=A.object({name:A.string().optional(),type:A.string().optional(),description:A.string().optional(),version:A.string().optional(),provider:A.string().optional(),documentationUrl:A.string().optional(),metadata:A.record(A.unknown()).optional()}),z_=A.object({streaming:A.boolean().optional(),websocket:A.boolean().optional(),httpBinary:A.boolean().optional(),pushNotifications:A.boolean().optional(),resumable:A.boolean().optional()}),W_=A.object({supported:A.boolean().optional(),items:A.array(Cv).optional(),parallelCalls:A.boolean().optional(),clientProvided:A.boolean().optional()}),K_=A.object({structuredOutput:A.boolean().optional(),supportedMimeTypes:A.array(A.string()).optional()}),Y_=A.object({snapshots:A.boolean().optional(),deltas:A.boolean().optional(),memory:A.boolean().optional(),persistentState:A.boolean().optional()}),X_=A.object({supported:A.boolean().optional(),delegation:A.boolean().optional(),handoffs:A.boolean().optional(),subAgents:A.array(Q_).optional()}),Z_=A.object({supported:A.boolean().optional(),streaming:A.boolean().optional(),encrypted:A.boolean().optional()}),J_=A.object({image:A.boolean().optional(),audio:A.boolean().optional(),video:A.boolean().optional(),pdf:A.boolean().optional(),file:A.boolean().optional()}),e0=A.object({image:A.boolean().optional(),audio:A.boolean().optional()}),t0=A.object({input:J_.optional(),output:e0.optional()}),r0=A.object({codeExecution:A.boolean().optional(),sandboxed:A.boolean().optional(),maxIterations:A.number().optional(),maxExecutionTime:A.number().optional()}),n0=A.object({supported:A.boolean().optional(),approvals:A.boolean().optional(),interventions:A.boolean().optional(),feedback:A.boolean().optional()}),M6=A.object({identity:H_.optional(),transport:z_.optional(),tools:W_.optional(),output:K_.optional(),state:Y_.optional(),multiAgent:X_.optional(),reasoning:Z_.optional(),multimodal:t0.optional(),execution:r0.optional(),humanInTheLoop:n0.optional(),custom:A.record(A.unknown()).optional()}),Ev=A.union([A.literal("developer"),A.literal("system"),A.literal("assistant"),A.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}({}),Ie=A.object({type:A.nativeEnum(M),timestamp:A.number().optional(),rawEvent:A.any().optional()}).passthrough(),o0=Ie.extend({type:A.literal(M.TEXT_MESSAGE_START),messageId:A.string(),role:Ev.default("assistant"),name:A.string().optional()}),Rv=Ie.extend({type:A.literal(M.TEXT_MESSAGE_CONTENT),messageId:A.string(),delta:A.string()}),i0=Ie.extend({type:A.literal(M.TEXT_MESSAGE_END),messageId:A.string()}),a0=Ie.extend({type:A.literal(M.TEXT_MESSAGE_CHUNK),messageId:A.string().optional(),role:Ev.optional(),delta:A.string().optional(),name:A.string().optional()}),s0=Ie.extend({type:A.literal(M.THINKING_TEXT_MESSAGE_START)}),c0=Rv.omit({messageId:!0,type:!0}).extend({type:A.literal(M.THINKING_TEXT_MESSAGE_CONTENT)}),u0=Ie.extend({type:A.literal(M.THINKING_TEXT_MESSAGE_END)}),l0=Ie.extend({type:A.literal(M.TOOL_CALL_START),toolCallId:A.string(),toolCallName:A.string(),parentMessageId:A.string().optional()}),d0=Ie.extend({type:A.literal(M.TOOL_CALL_ARGS),toolCallId:A.string(),delta:A.string()}),p0=Ie.extend({type:A.literal(M.TOOL_CALL_END),toolCallId:A.string()}),f0=Ie.extend({messageId:A.string(),type:A.literal(M.TOOL_CALL_RESULT),toolCallId:A.string(),content:A.string(),role:A.literal("tool").optional()}),m0=Ie.extend({type:A.literal(M.TOOL_CALL_CHUNK),toolCallId:A.string().optional(),toolCallName:A.string().optional(),parentMessageId:A.string().optional(),delta:A.string().optional()}),g0=Ie.extend({type:A.literal(M.THINKING_START),title:A.string().optional()}),h0=Ie.extend({type:A.literal(M.THINKING_END)}),y0=Ie.extend({type:A.literal(M.STATE_SNAPSHOT),snapshot:$_}),v0=Ie.extend({type:A.literal(M.STATE_DELTA),delta:A.array(A.any())}),S0=Ie.extend({type:A.literal(M.MESSAGES_SNAPSHOT),messages:A.array(xv)}),b0=Ie.extend({type:A.literal(M.ACTIVITY_SNAPSHOT),messageId:A.string(),activityType:A.string(),content:A.record(A.any()),replace:A.boolean().optional().default(!0)}),w0=Ie.extend({type:A.literal(M.ACTIVITY_DELTA),messageId:A.string(),activityType:A.string(),patch:A.array(A.any())}),A0=Ie.extend({type:A.literal(M.RAW),event:A.any(),source:A.string().optional()}),x0=Ie.extend({type:A.literal(M.CUSTOM),name:A.string(),value:A.any()}),C0=Ie.extend({type:A.literal(M.RUN_STARTED),threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),input:G_.optional()}),E0=Ie.extend({type:A.literal(M.RUN_FINISHED),threadId:A.string(),runId:A.string(),result:A.any().optional()}),R0=Ie.extend({type:A.literal(M.RUN_ERROR),message:A.string(),code:A.string().optional()}),I0=Ie.extend({type:A.literal(M.STEP_STARTED),stepName:A.string()}),T0=Ie.extend({type:A.literal(M.STEP_FINISHED),stepName:A.string()}),_0=A.union([A.literal("tool-call"),A.literal("message")]),k0=Ie.extend({type:A.literal(M.REASONING_START),messageId:A.string()}),O0=Ie.extend({type:A.literal(M.REASONING_MESSAGE_START),messageId:A.string(),role:A.literal("reasoning")}),P0=Ie.extend({type:A.literal(M.REASONING_MESSAGE_CONTENT),messageId:A.string(),delta:A.string()}),N0=Ie.extend({type:A.literal(M.REASONING_MESSAGE_END),messageId:A.string()}),F0=Ie.extend({type:A.literal(M.REASONING_MESSAGE_CHUNK),messageId:A.string().optional(),delta:A.string().optional()}),D0=Ie.extend({type:A.literal(M.REASONING_END),messageId:A.string()}),M0=Ie.extend({type:A.literal(M.REASONING_ENCRYPTED_VALUE),subtype:_0,entityId:A.string(),encryptedValue:A.string()}),mc=A.discriminatedUnion("type",[o0,Rv,i0,a0,g0,h0,s0,c0,u0,l0,d0,p0,m0,f0,y0,v0,S0,b0,w0,A0,x0,C0,E0,R0,I0,T0,k0,O0,P0,N0,F0,D0,M0]);m();d();f();p();var Rp={};ei(Rp,{JsonPatchError:()=>Ge,_areEquals:()=>ia,applyOperation:()=>_n,applyPatch:()=>wc,applyReducer:()=>V0,deepClone:()=>L0,getValueByPointer:()=>Sc,validate:()=>Tv,validator:()=>bc});m();d();f();p();m();d();f();p();var j0=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),q0=Object.prototype.hasOwnProperty;function hc(e,t){return q0.call(e,t)}function yc(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)hc(e,o)&&n.push(o);return n}function at(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function vc(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 Jt(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function na(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function gc(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(gc(e[t]))return!0}else if(typeof e=="object"){for(var n=yc(e),o=n.length,i=0;i<o;i++)if(gc(e[n[i]]))return!0}}return!1}function Iv(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 oa=function(e){j0(t,e);function t(r,n,o,i,a){var s=this.constructor,l=e.call(this,Iv(r,{name:n,index:o,operation:i,tree:a}))||this;return l.name=n,l.index=o,l.operation=i,l.tree=a,Object.setPrototypeOf(l,s.prototype),l.message=Iv(r,{name:n,index:o,operation:i,tree:a}),l}return t}(Error);var Ge=oa,L0=at,Do={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=Sc(r,this.path);n&&(n=at(n));var o=_n(r,{op:"remove",path:this.from}).removed;return _n(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Sc(r,this.from);return _n(r,{op:"add",path:this.path,value:at(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:ia(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},U0={add:function(e,t,r){return vc(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:Do.move,copy:Do.copy,test:Do.test,_get:Do._get};function Sc(e,t){if(t=="")return e;var r={op:"_get",path:t};return _n(e,r),r.value}function _n(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):bc(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=Sc(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=ia(e,t.value),a.test===!1)throw new Ge("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 Ge("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{n||(e=at(e));var s=t.path||"",l=s.split("/"),c=e,g=1,v=l.length,E=void 0,h=void 0,y=void 0;for(typeof r=="function"?y=r:y=bc;;){if(h=l[g],h&&h.indexOf("~")!=-1&&(h=na(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&l[g-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&E===void 0&&(c[h]===void 0?E=l.slice(0,g).join("/"):g==v-1&&(E=t.path),E!==void 0&&y(t,0,e,E)),g++,Array.isArray(c)){if(h==="-")h=c.length;else{if(r&&!vc(h))throw new Ge("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);vc(h)&&(h=~~h)}if(g>=v){if(r&&t.op==="add"&&h>c.length)throw new Ge("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=U0[t.op].call(t,c,h,e);if(a.test===!1)throw new Ge("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(g>=v){var a=Do[t.op].call(t,c,h,e);if(a.test===!1)throw new Ge("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(c=c[h],r&&g<v&&(!c||typeof c!="object"))throw new Ge("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function wc(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new Ge("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=at(e));for(var i=new Array(t.length),a=0,s=t.length;a<s;a++)i[a]=_n(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function V0(e,t,r){var n=_n(e,t);if(n.test===!1)throw new Ge("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function bc(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Ge("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Do[e.op]){if(typeof e.path!="string")throw new Ge("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Ge("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 Ge("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 Ge("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")&&gc(e.value))throw new Ge("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 Ge("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 Ge("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=Tv([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new Ge("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Ge("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function Tv(e,t,r){try{if(!Array.isArray(e))throw new Ge("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)wc(at(t),at(e),r||!0);else{r=r||bc;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof Ge)return o;throw o}}function ia(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(!ia(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],!ia(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var kp={};ei(kp,{compare:()=>K0,generate:()=>Ip,observe:()=>W0,unobserve:()=>z0});m();d();f();p();var Tp=new WeakMap,B0=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),G0=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function $0(e){return Tp.get(e)}function Q0(e,t){return e.observers.get(t)}function H0(e,t){e.observers.delete(t.callback)}function z0(e,t){t.unobserve()}function W0(e,t){var r=[],n,o=$0(e);if(!o)o=new B0(e),Tp.set(e,o);else{var i=Q0(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=at(e),t){n.callback=t,n.next=null;var a=function(){Ip(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(){Ip(n),clearTimeout(n.next),H0(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 G0(t,n)),n}function Ip(e,t){t===void 0&&(t=!1);var r=Tp.get(e.object);_p(r.value,e.object,e.patches,"",t),e.patches.length&&wc(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function _p(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=yc(t),a=yc(e),s=!1,l=!1,c=a.length-1;c>=0;c--){var g=a[c],v=e[g];if(hc(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var E=t[g];typeof v=="object"&&v!=null&&typeof E=="object"&&E!=null&&Array.isArray(v)===Array.isArray(E)?_p(v,E,r,n+"/"+Jt(g),o):v!==E&&(s=!0,o&&r.push({op:"test",path:n+"/"+Jt(g),value:at(v)}),r.push({op:"replace",path:n+"/"+Jt(g),value:at(E)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+Jt(g),value:at(v)}),r.push({op:"remove",path:n+"/"+Jt(g)}),l=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),s=!0)}if(!(!l&&i.length==a.length))for(var c=0;c<i.length;c++){var g=i[c];!hc(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+Jt(g),value:at(t[g])})}}}function K0(e,t,r){r===void 0&&(r=!1);var n=[];return _p(e,t,n,"",r),n}var Ac=Object.assign({},Rp,kp,{JsonPatchError:oa,deepClone:at,escapePathComponent:Jt,unescapePathComponent:na});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Op=function(e,t){return Op=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])},Op(e,t)};function er(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Op(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function _v(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 l(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,l)}c((n=n.apply(e,t||[])).next())})}function xc(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 l([c,g])}}function l(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 vr(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 Mo(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 jo(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 kn(e){return this instanceof kn?(this.v=e,this):new kn(e)}function kv(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(S){return new Promise(function(C,R){i.push([h,S,C,R])>1||l(h,S)})},y&&(o[h]=y(o[h])))}function l(h,y){try{c(n[h](y))}catch(S){E(i[0][3],S)}}function c(h){h.value instanceof kn?Promise.resolve(h.value.v).then(g,v):E(i[0][2],h)}function g(h){l("next",h)}function v(h){l("throw",h)}function E(h,y){h(y),i.shift(),i.length&&l(i[0][0],i[0][1])}}function Ov(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 vr=="function"?vr(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,l){a=e[i](a),o(s,l,a.done,a.value)})}}function o(i,a,s,l){Promise.resolve(l).then(function(c){i({value:c,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 qo(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 Cc=qo(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
31
|
+
`;function _E(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var kE=["1",1,"yes",!0];function Cs(){let e=[];return rd()&&e.push(window.doNotTrack),gd()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>kE.indexOf(t)!==-1)}var Vg="v15",Bg={default:"https://analytics.cloud.coveo.com/rest/ua",production:"https://analytics.cloud.coveo.com/rest/ua",hipaa:"https://analyticshipaa.cloud.coveo.com/rest/ua"};function OE(e=Bg.default,t=Vg,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 PE="38824e1f-37f5-42d3-8372-a4b8fa9df946",Kt=class{get defaultOptions(){return{endpoint:Bg.default,isCustomEndpoint:!1,token:"",version:Vg,beforeSendHooks:[],afterSendHooks:[]}}get version(){return qg}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=[bC,gC].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};let r={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};Cs()?this.runtime=new xs: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 rd()&&co()?new fd(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(_E()&&console.warn(TE),new md(t))}get storage(){return this.runtime.storage}determineVisitorId(){return U(this,void 0,void 0,function*(){try{return rd()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||sn()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),sn()}})}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(Ss(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(Cg(t,Cg(r,PE)))}})}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(sn()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(Cs())return null;try{let r=new URL(t).searchParams.get(Rr.cvo_cid);if(r==null)return null;let n=Rr.fromString(r);return!n||!co()||!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[h=>n.length>0?this.parseVariableArgumentsPayload(n,h):h[0],h=>U(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>U(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,S)=>U(this,void 0,void 0,function*(){let C=yield y;return yield S(t,C)}),h)].reduce((h,y)=>U(this,void 0,void 0,function*(){let S=yield h;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?vE(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,E)=>U(this,void 0,void 0,function*(){let h=yield v;return yield E(h)}),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 vs().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=ur(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=ur(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=ur(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 w(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return U(this,void 0,void 0,function*(){return yield(yield w(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,r){this.eventTypeMapping[t]=r}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(r=>typeof r=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,r){let n={};for(let 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(AE(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=ur(t,["custom"]),o={};r&&ys(r)&&(o=this.lowercaseKeys(r));let i=xE(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=ur(t,["custom"]);if(r&&ys(r)){let o=this.lowercaseKeys(r);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},o),t.customData)})}else return t}lowercaseKeys(t){let r=Object.keys(t),n={};return r.forEach(o=>{n[o.toLowerCase()]=t[o]}),n}validateParams(t,r){let{anonymizeIp:n}=t,o=ur(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=ur(t,["userId"]);return IE(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=ur(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&ys(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&ys(n.customData)&&(n.customData.hasOwnProperty("context_website")||n.customData.hasOwnProperty("siteName"))&&(n.trackingId=n.customData.context_website||n.customData.siteName),n)}limit(t,r){return typeof t=="string"?DC(t,r):t}get baseUrl(){return OE(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},lr;(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"})(lr||(lr={}));var G;(function(e){e.interfaceLoad="interfaceLoad",e.interfaceChange="interfaceChange",e.didyoumeanAutomatic="didyoumeanAutomatic",e.didyoumeanClick="didyoumeanClick",e.resultsSort="resultsSort",e.searchboxSubmit="searchboxSubmit",e.searchboxClear="searchboxClear",e.searchboxAsYouType="searchboxAsYouType",e.breadcrumbFacet="breadcrumbFacet",e.breadcrumbResetAll="breadcrumbResetAll",e.documentQuickview="documentQuickview",e.documentOpen="documentOpen",e.omniboxAnalytics="omniboxAnalytics",e.omniboxFromLink="omniboxFromLink",e.searchFromLink="searchFromLink",e.triggerNotify="notify",e.triggerExecute="execute",e.triggerQuery="query",e.undoTriggerQuery="undoQuery",e.triggerRedirect="redirect",e.pagerResize="pagerResize",e.pagerNumber="pagerNumber",e.pagerNext="pagerNext",e.pagerPrevious="pagerPrevious",e.pagerScrolling="pagerScrolling",e.staticFilterClearAll="staticFilterClearAll",e.staticFilterSelect="staticFilterSelect",e.staticFilterDeselect="staticFilterDeselect",e.facetClearAll="facetClearAll",e.facetSearch="facetSearch",e.facetSelect="facetSelect",e.facetSelectAll="facetSelectAll",e.facetDeselect="facetDeselect",e.facetExclude="facetExclude",e.facetUnexclude="facetUnexclude",e.facetUpdateSort="facetUpdateSort",e.facetShowMore="showMoreFacetResults",e.facetShowLess="showLessFacetResults",e.queryError="query",e.queryErrorBack="errorBack",e.queryErrorClear="errorClearQuery",e.queryErrorRetry="errorRetry",e.recommendation="recommendation",e.recommendationInterfaceLoad="recommendationInterfaceLoad",e.recommendationOpen="recommendationOpen",e.likeSmartSnippet="likeSmartSnippet",e.dislikeSmartSnippet="dislikeSmartSnippet",e.expandSmartSnippet="expandSmartSnippet",e.collapseSmartSnippet="collapseSmartSnippet",e.openSmartSnippetFeedbackModal="openSmartSnippetFeedbackModal",e.closeSmartSnippetFeedbackModal="closeSmartSnippetFeedbackModal",e.sendSmartSnippetReason="sendSmartSnippetReason",e.expandSmartSnippetSuggestion="expandSmartSnippetSuggestion",e.collapseSmartSnippetSuggestion="collapseSmartSnippetSuggestion",e.showMoreSmartSnippetSuggestion="showMoreSmartSnippetSuggestion",e.showLessSmartSnippetSuggestion="showLessSmartSnippetSuggestion",e.openSmartSnippetSource="openSmartSnippetSource",e.openSmartSnippetSuggestionSource="openSmartSnippetSuggestionSource",e.openSmartSnippetInlineLink="openSmartSnippetInlineLink",e.openSmartSnippetSuggestionInlineLink="openSmartSnippetSuggestionInlineLink",e.recentQueryClick="recentQueriesClick",e.clearRecentQueries="clearRecentQueries",e.recentResultClick="recentResultClick",e.clearRecentResults="clearRecentResults",e.noResultsBack="noResultsBack",e.showMoreFoldedResults="showMoreFoldedResults",e.showLessFoldedResults="showLessFoldedResults",e.copyToClipboard="copyToClipboard",e.caseSendEmail="Case.SendEmail",e.feedItemTextPost="FeedItem.TextPost",e.caseAttach="caseAttach",e.caseDetach="caseDetach",e.retryGeneratedAnswer="retryGeneratedAnswer",e.likeGeneratedAnswer="likeGeneratedAnswer",e.dislikeGeneratedAnswer="dislikeGeneratedAnswer",e.openGeneratedAnswerSource="openGeneratedAnswerSource",e.generatedAnswerOpenInlineLink="generatedAnswerOpenInlineLink",e.generatedAnswerStreamEnd="generatedAnswerStreamEnd",e.generatedAnswerSourceHover="generatedAnswerSourceHover",e.generatedAnswerCopyToClipboard="generatedAnswerCopyToClipboard",e.generatedAnswerHideAnswers="generatedAnswerHideAnswers",e.generatedAnswerShowAnswers="generatedAnswerShowAnswers",e.generatedAnswerExpand="generatedAnswerExpand",e.generatedAnswerCollapse="generatedAnswerCollapse",e.generatedAnswerFeedbackSubmit="generatedAnswerFeedbackSubmit",e.rephraseGeneratedAnswer="rephraseGeneratedAnswer",e.generatedAnswerFeedbackSubmitV2="generatedAnswerFeedbackSubmitV2",e.generatedAnswerCitationClick="generatedAnswerCitationClick",e.generatedAnswerFollowupOpenSource="generatedAnswerFollowupOpenSource",e.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})(G||(G={}));var Og={[G.triggerNotify]:"queryPipelineTriggers",[G.triggerExecute]:"queryPipelineTriggers",[G.triggerQuery]:"queryPipelineTriggers",[G.triggerRedirect]:"queryPipelineTriggers",[G.queryErrorBack]:"errors",[G.queryErrorClear]:"errors",[G.queryErrorRetry]:"errors",[G.pagerNext]:"getMoreResults",[G.pagerPrevious]:"getMoreResults",[G.pagerNumber]:"getMoreResults",[G.pagerResize]:"getMoreResults",[G.pagerScrolling]:"getMoreResults",[G.facetSearch]:"facet",[G.facetShowLess]:"facet",[G.facetShowMore]:"facet",[G.recommendation]:"recommendation",[G.likeSmartSnippet]:"smartSnippet",[G.dislikeSmartSnippet]:"smartSnippet",[G.expandSmartSnippet]:"smartSnippet",[G.collapseSmartSnippet]:"smartSnippet",[G.openSmartSnippetFeedbackModal]:"smartSnippet",[G.closeSmartSnippetFeedbackModal]:"smartSnippet",[G.sendSmartSnippetReason]:"smartSnippet",[G.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[G.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[G.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[G.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[G.clearRecentQueries]:"recentQueries",[G.recentResultClick]:"recentlyClickedDocuments",[G.clearRecentResults]:"recentlyClickedDocuments",[G.showLessFoldedResults]:"folding",[G.caseDetach]:"case",[G.likeGeneratedAnswer]:"generatedAnswer",[G.dislikeGeneratedAnswer]:"generatedAnswer",[G.openGeneratedAnswerSource]:"generatedAnswer",[G.generatedAnswerOpenInlineLink]:"generatedAnswer",[G.generatedAnswerFollowupOpenSource]:"generatedAnswer",[G.generatedAnswerStreamEnd]:"generatedAnswer",[G.generatedAnswerSourceHover]:"generatedAnswer",[G.generatedAnswerCopyToClipboard]:"generatedAnswer",[G.generatedAnswerHideAnswers]:"generatedAnswer",[G.generatedAnswerShowAnswers]:"generatedAnswer",[G.generatedAnswerExpand]:"generatedAnswer",[G.generatedAnswerCollapse]:"generatedAnswer",[G.generatedAnswerFeedbackSubmit]:"generatedAnswer",[G.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[lr.expandToFullUI]:"interface",[lr.openUserActions]:"User Actions",[lr.showPrecedingSessions]:"User Actions",[lr.showFollowingSessions]:"User Actions",[lr.clickViewedDocument]:"User Actions",[lr.clickPageView]:"User Actions",[lr.createArticle]:"createArticle"},po=class{constructor(){this.runtime=new xs,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 qg}};function NE(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function FE(e){return e.map(t=>t.replace(/;/g,""))}function Gg(e){let r=e.join(";");return r.length<=256?r:Gg(e.slice(1))}var Pg=e=>{let t=FE(e),r=NE(t);return Gg(r)};function Ng(e){let t=typeof e.partialQueries=="string"?e.partialQueries:Pg(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:Pg(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Es=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Cs();this.coveoAnalyticsClient=n?new po:new Kt(t)}disable(){this.coveoAnalyticsClient=new po}enable(){this.coveoAnalyticsClient=new Kt(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(G.interfaceLoad)}logInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(G.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(G.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(G.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(G.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(G.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(G.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(G.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(G.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(G.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(G.didyoumeanClick)}logDidYouMeanClick(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(G.resultsSort,t)}logResultsSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(G.searchboxSubmit)}logSearchboxSubmit(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(G.searchboxClear)}logSearchboxClear(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(G.searchboxAsYouType)}logSearchboxAsYouType(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(G.breadcrumbFacet,t)}logBreadcrumbFacet(t){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(G.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(G.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(G.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(G.omniboxAnalytics,Ng(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(G.omniboxFromLink,Ng(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(G.searchFromLink)}logSearchFromLink(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(G.triggerNotify,t)}logTriggerNotify(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(G.triggerExecute,t)}logTriggerExecute(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(G.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(G.undoTriggerQuery,t)}logUndoTriggerQuery(t){return U(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(G.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(G.pagerResize,t)}logPagerResize(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(G.pagerNumber,t)}logPagerNumber(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(G.pagerNext,t)}logPagerNext(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(G.pagerPrevious,t)}logPagerPrevious(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(G.pagerScrolling)}logPagerScrolling(){return U(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(G.facetClearAll,t)}logFacetClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(G.facetSearch,t)}logFacetSearch(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(G.facetSelect,t)}logFacetSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(G.facetDeselect,t)}logFacetDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(G.facetExclude,t)}logFacetExclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(G.facetUnexclude,t)}logFacetUnexclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(G.facetSelectAll,t)}logFacetSelectAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(G.facetUpdateSort,t)}logFacetUpdateSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(G.facetShowMore,t)}logFacetShowMore(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(G.facetShowLess,t)}logFacetShowLess(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(G.queryError,t)}logQueryError(t){return 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(G.queryErrorBack);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(G.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(G.queryErrorRetry);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(G.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(G.queryErrorClear);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(G.queryErrorClear)})}})}logQueryErrorClear(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(G.likeSmartSnippet)}logLikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(G.dislikeSmartSnippet)}logDislikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(G.expandSmartSnippet)}logExpandSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(G.collapseSmartSnippet)}logCollapseSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(G.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(G.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(G.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(G.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(G.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(G.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(G.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(G.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(G.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(G.copyToClipboard,t,r)}logCopyToClipboard(t,r){return 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(G.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(G.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(G.recentQueryClick)}logRecentQueryClick(){return U(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(G.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(G.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(G.clearRecentResults)}logClearRecentResults(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(G.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(G.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(G.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=Og[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}),l=yield this.coveoAnalyticsClient.makeCustomEvent(s);return{description:this.makeEventDescription(l,n),log:({searchUID:c})=>l.log({lastSearchQueryUid:c})}})}logCustomEvent(t,r){return U(this,arguments,void 0,function*(n,o,i=Og[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 Kt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getSplitTestRun(){let t=this.provider.getSplitTestRunName?this.provider.getSplitTestRunName():"",r=this.provider.getSplitTestRunVersion?this.provider.getSplitTestRunVersion():"";return Object.assign(Object.assign({},t&&{splitTestRunName:t}),r&&{splitTestRunVersion:r})}makeLikeGeneratedAnswer(t){return this.makeCustomEvent(G.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(G.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(G.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent(G.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(G.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent(G.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(G.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(G.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(G.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(G.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(G.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(G.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(G.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(G.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(G.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(G.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return U(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(G.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Rs=Object.assign({},_i),Fg=Object.keys(Rs).map(e=>Rs[e]),uo=class extends id{constructor({client:t,uuidGenerator:r=sn}){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])=>Fg.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Fg.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Rs.pageview,{newEventType:Ae.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Rs.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 UC(this.ticket)}};uo.Id="svc";var Is;(function(e){e.click="click",e.flowStart="flowStart"})(Is||(Is={}));var Tt;(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"})(Tt||(Tt={}));var Ts;(function(e){e.quit="Quit",e.solved="Solved"})(Ts||(Ts={}));var _s=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!Cs();this.coveoAnalyticsClient=o?new Kt(t):new po,this.svc=new uo({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new po,this.svc=new uo({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Kt(this.options),this.svc=new uo({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(Tt.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(Tt.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(Tt.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(Tt.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(Tt.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(Tt.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(Tt.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(Tt.caseCancelled,{reason:Ts.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(Tt.caseSolved,{reason:Ts.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(Tt.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Is.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Is.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 Kt?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 $g=e=>new Kt(e).getCurrentVisitorId(),Pi=(e,t)=>typeof t=="function"?(...r)=>{let n=ii(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,Ni=(e,t)=>(...r)=>{let n=ii(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 ks(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function Qg(e){let{activeValue:t,ancestryMap:r}=DE(e);return t?ME(t,r):[]}function DE(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 ME(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var qE=(e,t)=>e.categoryFacetSet[t]?.request;var vd=(e,t)=>{let r=qE(e,t);return Qg(r?.currentValues??[])};m();d();f();p();function Os(){return{}}m();d();f();p();function Ps(){return{}}m();d();f();p();function Ns(){return{}}m();d();f();p();function Fs(){return{}}function Sd(e){return{facetSet:e.facetSet??Fs(),categoryFacetSet:e.categoryFacetSet??Os(),dateFacetSet:e.dateFacetSet??Ps(),numericFacetSet:e.numericFacetSet??Ns(),automaticFacetSet:e.automaticFacetSet??ks()}}var bd=e=>{let t=[];return UE(e).forEach((r,n)=>{let o=WE(e,r.facetId),i=HE(r,n+1);if(LE(r)){if(!!!vd(e,r.facetId).length)return;t.push({...i,...$E(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((a,s)=>{if(a.state==="idle")return;let l=Hg(a,s+1,o),c=jE(r)?zg(a):BE(a);t.push({...i,...l,...c})})}),VE(e).forEach((r,n)=>{let o=QE(r,n+1);r.values.forEach((i,a)=>{if(i.state==="idle")return;let s=Hg(i,a+1,"specific"),l=zg(i);t.push({...o,...s,...l})})}),t},jE=e=>e.type==="specific",LE=e=>e.type==="hierarchical",UE=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),VE=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),Hg=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),BE=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}),GE=(e,t)=>vd(e,t).map(n=>n.value).join(";"),$E=(e,t)=>{let n=GE(e,t);return{value:n,valuePosition:1,displayValue:n}},QE=(e,t)=>({title:Wg(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),HE=(e,t)=>({title:Wg(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),Wg=(e,t)=>`${e}_${t}`,zE=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,WE=(e,t)=>{let r=zE(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var wd=e=>e.configuration.search.locale,Kg=e=>e.configuration.search.timezone,Yg=e=>e.configuration.accessToken,Xg=e=>e.configuration.organizationId,Zg=e=>e.configuration.environment,Ds=e=>e.configuration?.knowledge?.agentId,Jg=e=>e.configuration.knowledge.debugAgentSession;var cn=e=>{if(KE(e)||Ad(e))return e.generatedAnswer?.answerId;if(YE(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},KE=e=>"answer"in e&&"generatedAnswer"in e&&!ce(e.generatedAnswer?.answerConfigurationId),Ad=e=>{let t=Ds(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},YE=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",xd=e=>e.generatedAnswer?.fieldsToIncludeInCitations,eh=e=>e.followUpAnswers?.conversationId,XE=e=>e.generatedAnswer?.citations,ZE=e=>e.followUpAnswers?.followUpAnswers,JE=Be(ZE,e=>e?.flatMap(t=>t.citations)),eR=(e,t)=>t,tR=Be(XE,JE,eR,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));m();d();f();p();var At=()=>({q:"",enableQuerySyntax:!1});m();d();f();p();m();d();f();p();var th=(r=>(r.Ascending="ascending",r.Descending="descending",r))(th||{}),rh=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(rh||{}),Cd=e=>{if(Qf(e))return e.map(t=>Cd(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""}},nh=()=>({by:"relevancy"});var JU=new ne({values:{by:new vl({enum:rh,required:!0}),order:new vl({enum:th}),field:new z}});function Ms(){return Cd(nh())}m();d();f();p();m();d();f();p();var fo=()=>"default";var rR=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},dr=class{constructor(t){ie(this,"getState",t);ie(this,"state");this.state=t()}getLanguage(){return rR(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=Zn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||fo()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};var Fi=class Fi extends dr{constructor(){super(...arguments);ie(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 bd(Sd(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Fi.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||$t().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Fi.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=cn(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??Ms()}}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]||"",l=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(n),partialQuery:s,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:i.length>0?i:"",querySuggestResponseId:l}}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||At().q}get responseTime(){return this.state.search?.duration||$t().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||$t().response.totalCountFiltered}};ie(Fi,"fallbackPipelineName","default");var Ir=Fi,oh=({logger:e,getState:t,analyticsClientMiddleware:r=(i,a)=>a,preprocessRequest:n,provider:o})=>{let i=t(),a=i.configuration.accessToken,s=i.configuration.analytics.apiBaseUrl??Et(i.configuration.organizationId,i.configuration.environment,"analytics"),l=i.configuration.analytics.runtimeEnvironment,c=i.configuration.analytics.enabled,g=new Es({token:a,endpoint:s,runtimeEnvironment:l,preprocessRequest:Pi(e,n),beforeSendHooks:[Ni(e,r),(v,E)=>(e.info({...E,type:v,endpoint:s,token:a},"Analytics request"),E)]},o);return c||g.disable(),g},Ed=()=>{let t=It.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};var qs=/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield $g(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}),...(Ed()&&{pageId:Ed()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:so(e)})}}});return function qs(_x17,_x18){return _ref10.apply(this,arguments)}}();m();d();f();p();m();d();f();p();m();d();f();p();var mo=()=>({duration:0,error:null,isLoading:!1,id:"Recommendation",recommendations:[],searchUid:"",splitTestRun:"",pipeline:""});var Di=class extends dr{getPipeline(){return this.state.pipeline||this.state.recommendation?.pipeline||"default"}getSearchEventRequestPayload(){return{queryText:At().q,responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getSearchUID(){return this.getState().recommendation?.searchUid||mo().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||mo().duration}mapResultsToAnalyticsDocument(){return this.state.recommendation?.recommendations.map(t=>({documentUri:t.uri,documentUriHash:t.raw.urihash}))}get numberOfResults(){return this.state.recommendation?.recommendations.length||mo().recommendations.length}};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function ih(){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 nR(e){return typeof e=="string"&&ah.test(e)}var Rd=nR;m();d();f();p();var nt=[];for(let e=0;e<256;++e)nt.push((e+256).toString(16).slice(1));function sh(e,t=0){return(nt[e[t+0]]+nt[e[t+1]]+nt[e[t+2]]+nt[e[t+3]]+"-"+nt[e[t+4]]+nt[e[t+5]]+"-"+nt[e[t+6]]+nt[e[t+7]]+"-"+nt[e[t+8]]+nt[e[t+9]]+"-"+nt[e[t+10]]+nt[e[t+11]]+nt[e[t+12]]+nt[e[t+13]]+nt[e[t+14]]+nt[e[t+15]]).toLowerCase()}m();d();f();p();var Id,oR=new Uint8Array(16);function Td(){if(!Id){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Id=crypto.getRandomValues.bind(crypto)}return Id(oR)}m();d();f();p();m();d();f();p();var iR=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),_d={randomUUID:iR};function aR(e,t,r){e=e||{};let n=e.random??e.rng?.()??Td();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 sh(n)}function sR(e,t,r){return _d.randomUUID&&!t&&!e?_d.randomUUID():aR(e,t,r)}var kd=sR;function cR(_x19){return _cR.apply(this,arguments)}function _cR(){_cR=_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 _cR.apply(this,arguments)}var fh="2.1.1",Od=128,mh=192,ch=224,uh=240,uR=248;function lR(e){return(e&uR)===uh?4:(e&uh)===ch?3:(e&ch)===mh?2:1}function dR(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&Od)!=Od)break;if(r-=3,(n&mh)!=Od){t-r>=lR(n)*3&&(r=t);break}}return e.substring(0,r)}function pR(e){let{trackingId:t}=e;return{trackingId:t}}function fR(e){return(e.source||[]).concat([`relay@${fh}`])}function gh(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,a=pR(t),s=r.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:fR(t),clientId:s,userAgent:i(),referrer:lh(n()),location:lh(o())})}function lh(e){return e!==null?dR(e,1024):null}function mR(e,t,r,n){return{...t,meta:gh(e,r,n)}}var gR="*";function hR(){let e=[];function t({type:l,callback:c}){return e.findIndex(g=>g.type===l&&g.callback===c)}function r(l,c){return l.type==="*"||c===l.type}function n(l){return t(l)<0&&e.push(l),()=>s(l.type,l.callback)}function o(l){e.forEach(c=>{if(r(c,l.meta.type))try{c.callback(l)}catch(g){console.error(g)}})}function i(l){if(l===gR)e.length=0;else for(let c=e.length-1;c>=0;c--)e[c].type===l&&e.splice(c,1)}function a(l){let c=t(l);c>=0&&e.splice(c,1)}function s(l,c){c?a({type:l,callback:c}):i(l)}return{add:n,call:o,remove:s}}function dh({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 yR(e){let t=dh(e);return{get:()=>t,update:r=>{t=dh({...t,...r})}}}var Pd=vR();function vR(){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 SR(){return{getItem(e){return Pd.getItem(e)||localStorage.getItem(e)},removeItem(e){Pd.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Pd.setItem(e,t,31556952e3)}}}var ph="visitorId";function bR(){let e=document.referrer;return e===""?null:e}function Nd(){let e=SR();return{runtime:"browser",send:function(){var _ref11=_asyncToGenerator(function*(t,r,n){let o=w(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});ih().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 l of s.events)if(!l.accepted)throw new Error(`Received event was rejected for processing: ${l.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:()=>bR(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(ph);if(t&&Rd(t))return t;let r=kd();return e.setItem(ph,r),r}}}function wR(){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 AR(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function xR(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=AR();return t&&r?{...r,runtime:"custom"}:t&&CR()&&wR()?Nd():n}function CR(){try{return typeof window=="object"}catch{return!1}}function ER(e){return{get:()=>Object.freeze(xR(e))}}function hh(e){let t=yR(e),r=hR(),n=ER(t);return{emit:function(){var _ref12=_asyncToGenerator(function*(o,i){let a=t.get(),s=n.get(),l=mR(o,i,a,s);return cR({config:a,environment:s,event:l,listenerManager:r})});return function emit(_x23,_x24){return _ref12.apply(this,arguments)}}(),getMeta:o=>gh(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:fh}}m();d();f();p();function yh(){return typeof window<"u"&&typeof document<"u"}var Mi=Be(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>so(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},a,s)=>{let l=IR(s);return hh({mode:i?"emit":"disabled",url:o??ka(e,t),token:r,trackingId:n??null,source:a,environment:l})}),RR={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref13=_asyncToGenerator(function*(){});return function send(){return _ref13.apply(this,arguments)}}()},IR=e=>{if(!e)return;let t=e();return{...(yh()?Nd():RR),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();var qi=class extends dr{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},vh=({logger:e,getState:t,analyticsClientMiddleware:r=(i,a)=>a,preprocessRequest:n,provider:o=new qi(t)})=>{let i=t(),a=i.configuration.accessToken,s=i.configuration.analytics.apiBaseUrl??Et(i.configuration.organizationId,i.configuration.environment,"analytics"),l=i.configuration.analytics.runtimeEnvironment,c=i.configuration.analytics.enabled,g=new _s({enableAnalytics:c,token:a,endpoint:s,runtimeEnvironment:l,preprocessRequest:Pi(e,n),beforeSendHooks:[Ni(e,r),(v,E)=>(e.info({...E,type:v,endpoint:s,token:a},"Analytics request"),E)]},o);return c||g.disable(),g};m();d();f();p();m();d();f();p();function bh(e,t){return{...new Ir(t).getBaseMetadata(),actionCause:e,type:e}}function TR(e){return Object.assign(e,{instantlyCallable:!0})}function _R(e,t){let r=i=>{let a=Re(e,i);return TR(Object.assign(a,{type:a.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(i,{getState:a,extra:s}){let{analyticsClientMiddleware:l,preprocessRequest:c,logger:g}=s;return yield(yield t({getState:a,analyticsClientMiddleware:l,preprocessRequest:c,logger:g})).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:l}){let{description:c,log:g}=yield t({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:l});return{description:c,action:r(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(v,{getState:E,extra:h}){return yield g({state:E(),extra:h})});return function(_x28,_x29){return _ref16.apply(this,arguments)}}())}});return function prepare(_x27){return _ref15.apply(this,arguments)}}()}),n}var wh=(e,t,r)=>{function n(...o){let i=o.length===1?{...o[0],__legacy__getBuilder:t(o[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:r}:{prefix:o[0],__legacy__getBuilder:t(o[1]),__legacy__provider:o[2],analyticsConfigurator:e,providerClass:r};return PR(i)}return n},kR=e=>e.configuration.analytics.analyticsMode==="legacy",OR=e=>e.configuration.analytics.analyticsMode==="next",PR=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:a})=>(r??(r=s=>new a(s)),_R(e,/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*({getState:s,analyticsClientMiddleware:l,preprocessRequest:c,logger:g}){let v=[],E={log:function(){var _ref18=_asyncToGenerator(function*({state:R}){for(let T of v)yield T(R)});return function log(_x31){return _ref18.apply(this,arguments)}}()},h=s(),y=i({getState:s,logger:g,analyticsClientMiddleware:l,preprocessRequest:c,provider:r(s)}),S=yield t(y,s());E.description=S?.description,v.push(/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(R){kR(R)&&(yield NR(S,r,R,g,y.coveoAnalyticsClient))});return function(_x32){return _ref19.apply(this,arguments)}}());let{emit:C}=Mi(h);return v.push(/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(R){if(OR(R)&&o&&n){let T=n(R);yield UR(C,o,T)}});return function(_x33){return _ref20.apply(this,arguments)}}()),E});return function(_x30){return _ref17.apply(this,arguments)}}()));function NR(_x34,_x35,_x36,_x37,_x38){return _NR.apply(this,arguments)}function _NR(){_NR=_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 _NR.apply(this,arguments)}var FR=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)}}()}),ft=wh(e=>oh({...e,provider:e.provider||new Ir(e.getState)}),e=>e,Ir),uB=wh(vh,FR("caseAssist"),qi);var Fd=(e,t)=>{let r=t.recommendation?.recommendations.findIndex(({uniqueId:n})=>e.uniqueId===n)||0;return DR(e,r,t)};function DR(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:jR(e),...(Sh(e)?{documentCategory:Sh(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:LR(e),queryPipeline:r.pipeline||no()}}function Sh(e){return e.raw?.objecttype||void 0}var js=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||""}),Ah={urihash:new z,sourcetype:new z,permanentid:new z},xh={uniqueId:Z,raw:new ne({values:Ah}),title:Z,uri:Z,clickUri:Z,rankingModifier:new z({required:!1,emptyAllowed:!0})};function MR(e){return Object.assign({},...Object.keys(Ah).map(t=>({[t]:e[t]})))}function qR(e){return Object.assign({},...Object.keys(xh).map(t=>({[t]:e[t]})),{raw:MR(e.raw)})}function jR(e){let t=e.raw.author;return ce(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function LR(e){let t=e.raw.source;return ce(t)?"unknown":t}var Dd=e=>new mt(xh).validate(qR(e));function UR(_x40,_x41,_x42){return _UR.apply(this,arguments)}function _UR(){_UR=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _UR.apply(this,arguments)}m();d();f();p();var Ch=()=>ft("analytics/recommendation/update",e=>e.makeRecommendationInterfaceLoad(),e=>new Di(e)),Eh=()=>({actionCause:"recommendationInterfaceLoad"}),Us=e=>ft({prefix:"analytics/recommendation/open",__legacy__getBuilder:(t,r)=>(Dd(e),t.makeRecommendationOpen(Fd(e,r),js(e))),__legacy__provider:t=>new Di(t),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=Fd(e,t),n=js(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 go=N("recommendation/set",e=>$(e,{id:Z})),Tr=Re("recommendation/get",/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=Date.now(),a=yield VR(o),s=yield n.recommendations(a),l=Date.now()-i;return gt(s)?r(s.error):{recommendations:s.success.results,analyticsAction:Ch(),duration:l,searchUid:s.success.searchUid,splitTestRun:s.success.splitTestRun,pipeline:s.success.pipeline}});return function(_x43,_x44){return _ref22.apply(this,arguments)}}()),VR=/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??br(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?It.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 BR(e,Eh()))),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}),...(e.pagination&&{numberOfResults:e.pagination.numberOfResults})}});return function VR(_x45){return _ref23.apply(this,arguments)}}(),BR=/*#__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 qs(e.configuration.analytics,r)});return function BR(_x46,_x47){return _ref24.apply(this,arguments)}}();var ho=Le(mo(),e=>{e.addCase(go,(t,r)=>{t.id=r.payload.id}).addCase(Tr.rejected,(t,r)=>{t.error=r.payload?r.payload:null,t.isLoading=!1}).addCase(Tr.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(Tr.pending,t=>{t.isLoading=!0}).addCase(fs,(t,r)=>{t.error=r.payload,t.isLoading=!1})});m();d();f();p();var yo=N("searchHub/set",e=>$(e,new z({required:!0,emptyAllowed:!0})));m();d();f();p();var vo=Le(fo(),e=>{e.addCase(yo,(t,r)=>r.payload).addCase(ht.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(zt,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Rh=class extends Error{constructor(t){super(t[0].message);ie(this,"issues");this.name="SchemaError",this.issues=t}};var fr="uninitialized",jd="pending",Li="fulfilled",Ui="rejected";function Ih(e){return{status:e,isUninitialized:e===fr,isLoading:e===jd,isSuccess:e===Li,isError:e===Ui}}var Th=Qt;function Bh(e,t){if(e===t||!(Th(e)&&Th(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]=Bh(e[a],t[a]),o&&(o=e[a]===i[a]);return o?e:i}function Ld(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function GR(e){return new RegExp("(^|:)//").test(e)}function $R(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Gd(e){return e!=null}function _h(e){return[...(e?.values()??[])].filter(Gd)}function QR(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var HR=e=>e.replace(/\/$/,""),zR=e=>e.replace(/^\//,"");function WR(e,t){if(!e)return t;if(!t)return e;if(GR(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=HR(e),t=zR(t),`${e}${r}${t}`}function Gs(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var Ud=()=>new Map,KR=e=>{let t=new u.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},YR=(...e)=>{for(let r of e)if(r.aborted)return u.AbortSignal.abort(r.reason);let t=new u.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},kh=(...e)=>w(...e),XR=e=>e.status>=200&&e.status<=299,ZR=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Oh(e){if(!Qt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var JR=e=>typeof e=="object"&&(Qt(e)||Array.isArray(e)||typeof e.toJSON=="function");function Gh({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=kh,paramsSerializer:n,isJsonContentType:o=ZR,jsonContentType:i="application/json",jsonReplacer:a,timeout:s,responseHandler:l,validateStatus:c,...g}={}){return typeof w>"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*(E,h,y){let{getState:S,extra:C,endpoint:R,forced:T,type:I}=h,k,{url:_,headers:D=new x(g.headers),params:B=void 0,responseHandler:L=l??"json",validateStatus:j=c??XR,timeout:V=s,...q}=typeof E=="string"?{url:E}:E,O={...g,signal:V?YR(h.signal,KR(V)):h.signal,...q};D=new x(Oh(D)),O.headers=(yield t(D,{getState:S,arg:E,extra:C,endpoint:R,forced:T,type:I,extraOptions:y}))||D;let P=JR(O.body);if(O.body!=null&&!P&&typeof O.body!="string"&&O.headers.delete("content-type"),!O.headers.has("content-type")&&P&&O.headers.set("content-type",i),P&&o(O.headers)&&(O.body=JSON.stringify(O.body,a)),O.headers.has("accept")||(L==="json"?O.headers.set("accept","application/json"):L==="text"&&O.headers.set("accept","text/plain, text/html, */*")),B){let te=~_.indexOf("?")?"&":"?",se=n?n(B):new URLSearchParams(Oh(B));_+=te+se}_=WR(e,_);let F=new Request(_,O);k={request:new Request(_,O)};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:k}}let X=Q.clone();k.response=X;let Y,W="";try{let te;if(yield Promise.all([v(Q,L).then(se=>Y=se,se=>te=se),X.text().then(se=>W=se,()=>{})]),te)throw te}catch(te){return{error:{status:"PARSING_ERROR",originalStatus:Q.status,data:W,error:String(te)},meta:k}}return j(Q,Y)?{data:Y,meta:k}:{error:{status:Q.status,data:Y},meta:k}});return function(_x48,_x49,_x50){return _ref25.apply(this,arguments)}}());function v(_x51,_x52){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(E,h){if(typeof h=="function")return h(E);if(h==="content-type"&&(h=o(E.headers)?"json":"text"),h==="json"){let y=yield E.text();return y.length?JSON.parse(y):null}return E.text()});return _v2.apply(this,arguments)}}var So=class{constructor(e,t=void 0){ie(this,"value");ie(this,"meta");this.value=e,this.meta=t}};function eI(){return _eI.apply(this,arguments)}function _eI(){_eI=_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 l=()=>{clearTimeout(s),a(new Error("Aborted"))};r.aborted?(clearTimeout(s),a(new Error("Aborted"))):r.addEventListener("abort",l,{once:!0})}})});return _eI.apply(this,arguments)}function $h(e,t){throw Object.assign(new So({error:e,meta:t}),{throwImmediately:!0})}function Md(e){e.aborted&&$h({status:"CUSTOM_ERROR",error:"Aborted"})}var Ph={},tI=(e,t)=>(/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(r,n,o){let i=[5,(t||Ph).maxRetries,(o||Ph).maxRetries].filter(g=>g!==void 0),[a]=i.slice(-1),l={maxRetries:a,backoff:eI,retryCondition:(g,v,{attempt:E})=>E<=a,...t,...o},c=0;for(;;){Md(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new So(g);return g}catch(g){if(c++,g.throwImmediately){if(g instanceof So)return g.value;throw g}if(g instanceof So){if(!l.retryCondition(g.value.error,r,{attempt:c,baseQueryApi:n,extraOptions:o}))return g.value}else if(c>l.maxRetries)return{error:g};Md(n.signal);try{yield l.backoff(c,l.maxRetries,n.signal)}catch(v){throw Md(n.signal),v}}}});return function(_x53,_x54,_x55){return _ref26.apply(this,arguments)}}()),Qh=Object.assign(tI,{fail:$h}),Qs="__rtkq/",rI="online",nI="offline";var Hh="focused";var $d=N(`${Qs}${Hh}`),zh=N(`${Qs}un${Hh}`),Qd=N(`${Qs}${rI}`),Wh=N(`${Qs}${nI}`);var Gi="query",Kh="mutation",Yh="infinitequery";function Hs(e){return e.type===Gi}function oI(e){return e.type===Kh}function zs(e){return e.type===Yh}function $s(e){return Hs(e)||zs(e)}function Hd(e,t,r,n,o,i){let a=iI(e)?e(t,r,n,o):e;return a?Ld(a,Gd,s=>i(Xh(s))):[]}function iI(e){return typeof e=="function"}function Xh(e){return typeof e=="string"?{type:e}:e}function aI(e,t){return e.catch(t)}var bo=(e,t)=>e.endpointDefinitions[t],Vi=Symbol("forceQueryFn"),Vd=e=>typeof e[Vi]=="function";function sI({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:a}){let s=_=>a(_)?.runningQueries,l=_=>a(_)?.runningMutations,{unsubscribeQueryResult:c,removeMutationResult:g,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:T,buildInitiateInfiniteQuery:I,buildInitiateMutation:k,getRunningQueryThunk:E,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:S};function E(_,D){return B=>{let L=bo(i,_),j=e({queryArgs:D,endpointDefinition:L,endpointName:_});return s(B)?.get(j)}}function h(_,D){return B=>l(B)?.get(D)}function y(){return _=>_h(s(_))}function S(){return _=>_h(l(_))}function C(_){}function R(_,D){let B=(L,{subscribe:j=!0,forceRefetch:V,subscriptionOptions:q,[Vi]:O,...P}={})=>(F,H)=>{let Q=e({queryArgs:L,endpointDefinition:D,endpointName:_}),X,Y={...P,type:Gi,subscribe:j,forceRefetch:V,subscriptionOptions:q,endpointName:_,originalArgs:L,queryCacheKey:Q,[Vi]:O};if(Hs(D))X=t(Y);else{let{direction:fe,initialPageParam:Se,refetchCachedPages:he}=P;X=r({...Y,direction:fe,initialPageParam:Se,refetchCachedPages:he})}let W=o.endpoints[_].select(L),te=F(X),se=W(H());let{requestId:Ee,abort:Me}=te,ke=se.requestId!==Ee,Pe=s(F)?.get(Q),Ne=()=>W(H()),ge=Object.assign(O?te.then(Ne):ke&&!Pe?Promise.resolve(se):Promise.all([Pe,te]).then(Ne),{arg:L,requestId:Ee,subscriptionOptions:q,queryCacheKey:Q,abort:Me,unwrap(){return _asyncToGenerator(function*(){let fe=yield ge;if(fe.isError)throw fe.error;return fe.data})()},refetch:fe=>F(B(L,{subscribe:!1,forceRefetch:!0,...fe})),unsubscribe(){j&&F(c({queryCacheKey:Q,requestId:Ee}))},updateSubscriptionOptions(fe){ge.subscriptionOptions=fe,F(v({endpointName:_,requestId:Ee,queryCacheKey:Q,options:fe}))}});if(!Pe&&!ke&&!O){let fe=s(F);fe.set(Q,ge),ge.then(()=>{fe.delete(Q)})}return ge};return B}function T(_,D){return R(_,D)}function I(_,D){return R(_,D)}function k(_){return(D,{track:B=!0,fixedCacheKey:L}={})=>(j,V)=>{let q=n({type:"mutation",endpointName:_,originalArgs:D,track:B,fixedCacheKey:L}),O=j(q);let{requestId:P,abort:F,unwrap:H}=O,Q=aI(O.unwrap().then(te=>({data:te})),te=>({error:te})),X=()=>{j(g({requestId:P,fixedCacheKey:L}))},Y=Object.assign(Q,{arg:O.arg,requestId:P,abort:F,unwrap:H,reset:X}),W=l(j);return W.set(P,Y),Y.then(()=>{W.delete(P)}),L&&(W.set(L,Y),Y.then(()=>{W.get(L)===Y&&W.delete(L)})),Y}}}var Zh=class extends Rh{constructor(t,r,n,o){super(t);ie(this,"value");ie(this,"schemaName");ie(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},un=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function ln(_x56,_x57,_x58,_x59){return _ln.apply(this,arguments)}function _ln(){_ln=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new Zh(o.issues,t,r,n);return o.value});return _ln.apply(this,arguments)}function Nh(e){return e}var ji=(e={})=>({...e,[Ei]:!0});function cI({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:a,onSchemaFailure:s,catchSchemaFailure:l,skipSchemaValidation:c}){let g=(q,O,P,F)=>(H,Q)=>{let X=r[q],Y=n({queryArgs:O,endpointDefinition:X,endpointName:q});if(H(o.internalActions.queryResultPatched({queryCacheKey:Y,patches:P})),!F)return;let W=o.endpoints[q].select(O)(Q()),te=Hd(X.providesTags,W.data,void 0,O,{},i);H(o.internalActions.updateProvidedBy([{queryCacheKey:Y,providedTags:te}]))};function v(q,O,P=0){let F=[O,...q];return P&&F.length>P?F.slice(0,-1):F}function E(q,O,P=0){let F=[...q,O];return P&&F.length>P?F.slice(1):F}let h=(q,O,P,F=!0)=>(H,Q)=>{let Y=o.endpoints[q].select(O)(Q()),W={patches:[],inversePatches:[],undo:()=>H(o.util.patchQueryData(q,O,W.inversePatches,F))};if(Y.status===fr)return W;let te;if("data"in Y)if(dt(Y.data)){let[se,Ee,Me]=Bl(Y.data,P);W.patches.push(...Ee),W.inversePatches.push(...Me),te=se}else te=P(Y.data),W.patches.push({op:"replace",path:[],value:te}),W.inversePatches.push({op:"replace",path:[],value:Y.data});return W.patches.length===0||H(o.util.patchQueryData(q,O,W.patches,F)),W},y=(q,O,P)=>F=>F(o.endpoints[q].initiate(O,{subscribe:!1,forceRefetch:!0,[Vi]:()=>({data:P})})),S=(q,O)=>q.query&&q[O]?q[O]:Nh,C=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(q,{signal:O,abort:P,rejectWithValue:F,fulfillWithValue:H,dispatch:Q,getState:X,extra:Y}){let W=r[q.endpointName],{metaSchema:te,skipSchemaValidation:se=c}=W,Ee=q.type===Gi;try{let Me=Nh,ke={signal:O,abort:P,dispatch:Q,getState:X,extra:Y,endpoint:q.endpointName,type:q.type,forced:Ee?R(q,X()):void 0,queryCacheKey:Ee?q.queryCacheKey:void 0},Pe=Ee?q[Vi]:void 0,Ne,ge=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(Se,he,$e,He){if(he==null&&Se.pages.length)return Promise.resolve({data:Se});let Ft={queryArg:q.originalArgs,pageParam:he},bt=yield fe(Ft),Bt=He?v:E;return{data:{pages:Bt(Se.pages,bt.data,$e),pageParams:Bt(Se.pageParams,he,$e)},meta:bt.meta}});return function ge(_x62,_x63,_x64,_x65){return _ref28.apply(this,arguments)}}();function fe(_x66){return _fe.apply(this,arguments)}function _fe(){_fe=_asyncToGenerator(function*(Se){let he,{extraOptions:$e,argSchema:He,rawResponseSchema:Ft,responseSchema:bt}=W;if(He&&!un(se,"arg")&&(Se=yield ln(He,Se,"argSchema",{})),Pe?he=Pe():W.query?(Me=S(W,"transformResponse"),he=yield t(W.query(Se),ke,$e)):he=yield W.queryFn(Se,ke,$e,Dt=>t(Dt,ke,$e)),typeof process<"u",he.error)throw new So(he.error,he.meta);let{data:Bt}=he;Ft&&!un(se,"rawResponse")&&(Bt=yield ln(Ft,he.data,"rawResponseSchema",he.meta));let Ct=yield Me(Bt,he.meta,Se);return bt&&!un(se,"response")&&(Ct=yield ln(bt,Ct,"responseSchema",he.meta)),{...he,data:Ct}});return _fe.apply(this,arguments)}if(Ee&&"infiniteQueryOptions"in W){let{infiniteQueryOptions:Se}=W,{maxPages:he=1/0}=Se,$e=q.refetchCachedPages??Se.refetchCachedPages??!0,He,Ft={pages:[],pageParams:[]},bt=a.selectQueryEntry(X(),q.queryCacheKey)?.data,Ct=R(q,X())&&!q.direction||!bt?Ft:bt;if("direction"in q&&q.direction&&Ct.pages.length){let Dt=q.direction==="backward",wa=(Dt?Jh:Bd)(Se,Ct,q.originalArgs);He=yield ge(Ct,wa,he,Dt)}else{let{initialPageParam:Dt=Se.initialPageParam}=q,Zo=bt?.pageParams??[],wa=Zo[0]??Dt,Nw=Zo.length;if(He=yield ge(Ct,wa,he),Pe&&(He={data:He.data.pages[0]}),$e)for(let Rf=1;Rf<Nw;Rf++){let Fw=Bd(Se,He.data,q.originalArgs);He=yield ge(He.data,Fw,he)}}Ne=He}else Ne=yield fe(q.originalArgs);return te&&!un(se,"meta")&&Ne.meta&&(Ne.meta=yield ln(te,Ne.meta,"metaSchema",Ne.meta)),H(Ne.data,ji({fulfilledTimeStamp:Date.now(),baseQueryMeta:Ne.meta}))}catch(Me){let ke=Me;if(ke instanceof So){let Pe=S(W,"transformErrorResponse"),{rawErrorResponseSchema:Ne,errorResponseSchema:ge}=W,{value:fe,meta:Se}=ke;try{Ne&&!un(se,"rawErrorResponse")&&(fe=yield ln(Ne,fe,"rawErrorResponseSchema",Se)),te&&!un(se,"meta")&&(Se=yield ln(te,Se,"metaSchema",Se));let he=yield Pe(fe,Se,q.originalArgs);return ge&&!un(se,"errorResponse")&&(he=yield ln(ge,he,"errorResponseSchema",Se)),F(he,ji({baseQueryMeta:Se}))}catch(he){ke=he}}try{if(ke instanceof Zh){let Pe={endpoint:q.endpointName,arg:q.originalArgs,type:q.type,queryCacheKey:Ee?q.queryCacheKey:void 0};W.onSchemaFailure?.(ke,Pe),s?.(ke,Pe);let{catchSchemaFailure:Ne=l}=W;if(Ne)return F(Ne(ke,Pe),ji({baseQueryMeta:ke._bqMeta}))}}catch(Pe){ke=Pe}throw typeof process<"u",console.error(ke),ke}});return function C(_x60,_x61){return _ref27.apply(this,arguments)}}();function R(q,O){let P=a.selectQueryEntry(O,q.queryCacheKey),F=a.selectConfig(O).refetchOnMountOrArgChange,H=P?.fulfilledTimeStamp,Q=q.forceRefetch??(q.subscribe&&F);return Q?Q===!0||(Number(new Date)-Number(H))/1e3>=Q:!1}let T=()=>Re(`${e}/executeQuery`,C,{getPendingMeta({arg:O}){let P=r[O.endpointName];return ji({startedTimeStamp:Date.now(),...(zs(P)?{direction:O.direction}:{})})},condition(O,{getState:P}){let F=P(),H=a.selectQueryEntry(F,O.queryCacheKey),Q=H?.fulfilledTimeStamp,X=O.originalArgs,Y=H?.originalArgs,W=r[O.endpointName],te=O.direction;return Vd(O)?!0:H?.status==="pending"?!1:R(O,F)||Hs(W)&&W?.forceRefetch?.({currentArg:X,previousArg:Y,endpointState:H,state:F})?!0:!(Q&&!te)},dispatchConditionRejection:!0}),I=T(),k=T(),_=Re(`${e}/executeMutation`,C,{getPendingMeta(){return ji({startedTimeStamp:Date.now()})}}),D=q=>"force"in q,B=q=>"ifOlderThan"in q,L=(q,O,P={})=>(F,H)=>{let Q=D(P)&&P.force,X=B(P)&&P.ifOlderThan,Y=(te=!0)=>{let se={forceRefetch:te,subscribe:!1};return o.endpoints[q].initiate(O,se)},W=o.endpoints[q].select(O)(H());if(Q)F(Y());else if(X){let te=W?.fulfilledTimeStamp;if(!te){F(Y());return}(Number(new Date)-Number(new Date(te)))/1e3>=X&&F(Y())}else F(Y(!1))};function j(q){return O=>O?.meta?.arg?.endpointName===q}function V(q,O){return{matchPending:Yn(rs(q),j(O)),matchFulfilled:Yn(sr(q),j(O)),matchRejected:Yn(nn(q),j(O))}}return{queryThunk:I,mutationThunk:_,infiniteQueryThunk:k,prefetch:L,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:V}}function Bd(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function Jh(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function ey(e,t,r,n){return Hd(r[e.meta.arg.endpointName][t],sr(e)?e.payload:void 0,Ii(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function Fh(e){return lt(e)?Ka(e):e}function Vs(e,t,r){let n=e[t];n&&r(n)}function Bi(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function Dh(e,t,r){let n=e[Bi(t)];n&&r(n)}var Bs={};function uI({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:a,hasRehydrationInfo:s},assertTagType:l,config:c}){let g=N(`${e}/resetApiState`);function v(j,V,q,O){var P;j[P=V.queryCacheKey]??(j[P]={status:fr,endpointName:V.endpointName}),Vs(j,V.queryCacheKey,F=>{F.status=jd,F.requestId=q&&F.requestId?F.requestId:O.requestId,V.originalArgs!==void 0&&(F.originalArgs=V.originalArgs),F.startedTimeStamp=O.startedTimeStamp;let H=o[O.arg.endpointName];zs(H)&&"direction"in V&&(F.direction=V.direction)})}function E(j,V,q,O){Vs(j,V.arg.queryCacheKey,P=>{if(P.requestId!==V.requestId&&!O)return;let{merge:F}=o[V.arg.endpointName];if(P.status=Li,F){if(P.data!==void 0){let{fulfilledTimeStamp:H,arg:Q,baseQueryMeta:X,requestId:Y}=V,W=tn(P.data,te=>F(te,q,{arg:Q.originalArgs,baseQueryMeta:X,fulfilledTimeStamp:H,requestId:Y}));P.data=W}else P.data=q;}else P.data=o[V.arg.endpointName].structuralSharing??!0?Bh(lt(P.data)?Cm(P.data):P.data,q):q;delete P.error,P.fulfilledTimeStamp=V.fulfilledTimeStamp})}let h=on({name:`${e}/queries`,initialState:Bs,reducers:{removeQueryResult:{reducer(j,{payload:{queryCacheKey:V}}){delete j[V]},prepare:Xn()},cacheEntriesUpserted:{reducer(j,V){for(let q of V.payload){let{queryDescription:O,value:P}=q;v(j,O,!0,{arg:O,requestId:V.meta.requestId,startedTimeStamp:V.meta.timestamp}),E(j,{arg:O,requestId:V.meta.requestId,fulfilledTimeStamp:V.meta.timestamp,baseQueryMeta:{}},P,!0)}},prepare:j=>({payload:j.map(O=>{let{endpointName:P,arg:F,value:H}=O,Q=o[P];return{queryDescription:{type:Gi,endpointName:P,originalArgs:O.arg,queryCacheKey:n({queryArgs:F,endpointDefinition:Q,endpointName:P})},value:H}}),meta:{[Ei]:!0,requestId:Ti(),timestamp:Date.now()}})},queryResultPatched:{reducer(j,{payload:{queryCacheKey:V,patches:q}}){Vs(j,V,O=>{O.data=Gl(O.data,q.concat())})},prepare:Xn()}},extraReducers(j){j.addCase(t.pending,(V,{meta:q,meta:{arg:O}})=>{let P=Vd(O);v(V,O,P,q)}).addCase(t.fulfilled,(V,{meta:q,payload:O})=>{let P=Vd(q.arg);E(V,q,O,P)}).addCase(t.rejected,(V,{meta:{condition:q,arg:O,requestId:P},error:F,payload:H})=>{Vs(V,O.queryCacheKey,Q=>{if(!q){if(Q.requestId!==P)return;Q.status=Ui,Q.error=H??F}})}).addMatcher(s,(V,q)=>{let{queries:O}=a(q);for(let[P,F]of Object.entries(O))(F?.status===Li||F?.status===Ui)&&(V[P]=F)})}}),y=on({name:`${e}/mutations`,initialState:Bs,reducers:{removeMutationResult:{reducer(j,{payload:V}){let q=Bi(V);q in j&&delete j[q]},prepare:Xn()}},extraReducers(j){j.addCase(r.pending,(V,{meta:q,meta:{requestId:O,arg:P,startedTimeStamp:F}})=>{P.track&&(V[Bi(q)]={requestId:O,status:jd,endpointName:P.endpointName,startedTimeStamp:F})}).addCase(r.fulfilled,(V,{payload:q,meta:O})=>{O.arg.track&&Dh(V,O,P=>{P.requestId===O.requestId&&(P.status=Li,P.data=q,P.fulfilledTimeStamp=O.fulfilledTimeStamp)})}).addCase(r.rejected,(V,{payload:q,error:O,meta:P})=>{P.arg.track&&Dh(V,P,F=>{F.requestId===P.requestId&&(F.status=Ui,F.error=q??O)})}).addMatcher(s,(V,q)=>{let{mutations:O}=a(q);for(let[P,F]of Object.entries(O))(F?.status===Li||F?.status===Ui)&&P!==F?.requestId&&(V[P]=F)})}}),S={tags:{},keys:{}},C=on({name:`${e}/invalidation`,initialState:S,reducers:{updateProvidedBy:{reducer(j,V){var q,O,P;for(let{queryCacheKey:F,providedTags:H}of V.payload){R(j,F);for(let{type:Q,id:X}of H){let Y=(O=(q=j.tags)[Q]??(q[Q]={}))[P=X||"__internal_without_id"]??(O[P]=[]);Y.includes(F)||Y.push(F)}j.keys[F]=H}},prepare:Xn()}},extraReducers(j){j.addCase(h.actions.removeQueryResult,(V,{payload:{queryCacheKey:q}})=>{R(V,q)}).addMatcher(s,(V,q)=>{var P,F,H;let{provided:O}=a(q);for(let[Q,X]of Object.entries(O.tags??{}))for(let[Y,W]of Object.entries(X)){let te=(F=(P=V.tags)[Q]??(P[Q]={}))[H=Y||"__internal_without_id"]??(F[H]=[]);for(let se of W)te.includes(se)||te.push(se),V.keys[se]=O.keys[se]}}).addMatcher(Ht(sr(t),Ii(t)),(V,q)=>{T(V,[q])}).addMatcher(h.actions.cacheEntriesUpserted.match,(V,q)=>{let O=q.payload.map(({queryDescription:P,value:F})=>({type:"UNKNOWN",payload:F,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:P}}));T(V,O)})}});function R(j,V){let q=Fh(j.keys[V]??[]);for(let O of q){let P=O.type,F=O.id??"__internal_without_id",H=j.tags[P]?.[F];H&&(j.tags[P][F]=Fh(H).filter(Q=>Q!==V))}delete j.keys[V]}function T(j,V){let q=V.map(O=>{let P=ey(O,"providesTags",o,l),{queryCacheKey:F}=O.meta.arg;return{queryCacheKey:F,providedTags:P}});C.caseReducers.updateProvidedBy(j,C.actions.updateProvidedBy(q))}let I=on({name:`${e}/subscriptions`,initialState:Bs,reducers:{updateSubscriptionOptions(j,V){},unsubscribeQueryResult(j,V){},internal_getRTKQSubscriptions(){}}}),k=on({name:`${e}/internalSubscriptions`,initialState:Bs,reducers:{subscriptionsUpdated:{reducer(j,V){return Gl(j,V.payload)},prepare:Xn()}}}),_=on({name:`${e}/config`,initialState:{online:QR(),focused:$R(),middlewareRegistered:!1,...c},reducers:{middlewareRegistered(j,{payload:V}){j.middlewareRegistered=j.middlewareRegistered==="conflict"||i!==V?"conflict":!0}},extraReducers:j=>{j.addCase(Qd,V=>{V.online=!0}).addCase(Wh,V=>{V.online=!1}).addCase($d,V=>{V.focused=!0}).addCase(zh,V=>{V.focused=!1}).addMatcher(s,V=>({...V}))}}),D=zn({queries:h.reducer,mutations:y.reducer,provided:C.reducer,subscriptions:k.reducer,config:_.reducer}),B=(j,V)=>D(g.match(V)?void 0:j,V),L={..._.actions,...h.actions,...I.actions,...k.actions,...y.actions,...C.actions,resetApiState:g};return{reducer:B,actions:L}}var qd=Symbol.for("RTKQ/skipToken"),ty={status:fr},Mh=tn(ty,()=>{}),qh=tn(ty,()=>{});function lI({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=I=>Mh,o=I=>qh;return{buildQuerySelector:E,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:S,selectCachedArgsForQuery:C,selectApiState:a,selectQueries:s,selectMutations:c,selectQueryEntry:l,selectConfig:g};function i(I){return{...I,...Ih(I.status)}}function a(I){return I[t]}function s(I){return a(I)?.queries}function l(I,k){return s(I)?.[k]}function c(I){return a(I)?.mutations}function g(I){return a(I)?.config}function v(I,k,_){return D=>{if(D===qd)return r(n,_);let B=e({queryArgs:D,endpointDefinition:k,endpointName:I});return r(j=>l(j,B)??Mh,_)}}function E(I,k){return v(I,k,i)}function h(I,k){let{infiniteQueryOptions:_}=k;function D(B){let L={...B,...Ih(B.status)},{isLoading:j,isError:V,direction:q}=L,O=q==="forward",P=q==="backward";return{...L,hasNextPage:R(_,L.data,L.originalArgs),hasPreviousPage:T(_,L.data,L.originalArgs),isFetchingNextPage:j&&O,isFetchingPreviousPage:j&&P,isFetchNextPageError:V&&O,isFetchPreviousPageError:V&&P}}return v(I,k,D)}function y(){return I=>{let k;return typeof I=="object"?k=Bi(I)??qd:k=I,r(k===qd?o:B=>a(B)?.mutations?.[k]??qh,i)}}function S(I,k){let _=I[t],D=new Set,B=Ld(k,Gd,Xh);for(let L of B){let j=_.provided.tags[L.type];if(!j)continue;let V=(L.id!==void 0?j[L.id]:Object.values(j).flat())??[];for(let q of V)D.add(q)}return Array.from(D.values()).flatMap(L=>{let j=_.queries[L];return j?{queryCacheKey:L,endpointName:j.endpointName,originalArgs:j.originalArgs}:[]})}function C(I,k){return Ld(Object.values(s(I)),_=>_?.endpointName===k&&_.status!==fr,_=>_.originalArgs)}function R(I,k,_){return k?Bd(I,k,_)!=null:!1}function T(I,k,_){return!k||!I.getPreviousPageParam?!1:Jh(I,k,_)!=null}}var jh=WeakMap?new WeakMap:void 0,Lh=({endpointName:e,queryArgs:t})=>{let r="",n=jh?.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=Qt(a)?Object.keys(a).sort().reduce((s,l)=>(s[l]=a[l],s),{}):a,a));Qt(t)&&jh?.set(t,o),r=o}return`${e}(${r})`};function dI(...e){return function(r){let n=xi(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=Lh;if("serializeQueryArgs"in c.endpointDefinition){let v=c.endpointDefinition.serializeQueryArgs;g=E=>{let h=v(E);return typeof h=="string"?h:Lh({...E,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(c)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(c){c()},apiUid:Ti(),extractRehydrationInfo:n,hasRehydrationInfo:xi(c=>n(c)!=null)},a={injectEndpoints:l,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,E]of Object.entries(g))typeof E=="function"?E(bo(i,v)):Object.assign(bo(i,v)||{},E);return a}},s=e.map(c=>c.init(a,o,i));function l(c){let g=c.endpoints({query:v=>({...v,type:Gi}),mutation:v=>({...v,type:Kh}),infiniteQuery:v=>({...v,type:Yh})});for(let[v,E]of Object.entries(g)){if(c.overrideExisting!==!0&&v in i.endpointDefinitions){if(c.overrideExisting==="throw")throw new Error(pt(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[v]=E;for(let h of s)h.injectEndpoint(v,E)}return a}return a.injectEndpoints({endpoints:r.endpoints})}}function pr(e,...t){return Object.assign(e,...t)}var pI=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,i=null,a=null,{updateSubscriptionOptions:s,unsubscribeQueryResult:l}=e.internalActions,c=(S,C)=>{if(s.match(C)){let{queryCacheKey:T,requestId:I,options:k}=C.payload,_=S.get(T);return _?.has(I)&&_.set(I,k),!0}if(l.match(C)){let{queryCacheKey:T,requestId:I}=C.payload,k=S.get(T);return k&&k.delete(I),!0}if(e.internalActions.removeQueryResult.match(C))return S.delete(C.payload.queryCacheKey),!0;if(t.pending.match(C)){let{meta:{arg:T,requestId:I}}=C,k=Gs(S,T.queryCacheKey,Ud);return T.subscribe&&k.set(I,T.subscriptionOptions??k.get(I)??{}),!0}let R=!1;if(t.rejected.match(C)){let{meta:{condition:T,arg:I,requestId:k}}=C;if(T&&I.subscribe){let _=Gs(S,I.queryCacheKey,Ud);_.set(k,I.subscriptionOptions??_.get(k)??{}),R=!0}}return R},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:S=>g().get(S)?.size??0,isRequestSubscribed:(S,C)=>!!g()?.get(S)?.get(C)};function y(S){return JSON.parse(JSON.stringify(Object.fromEntries([...S].map(([C,R])=>[C,Object.fromEntries(R)]))))}return(S,C)=>{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,h];let R=c(r.currentSubscriptions,S),T=!0;if(R){a||(a=setTimeout(()=>{let _=y(r.currentSubscriptions),[,D]=Bl(i,()=>_);C.next(e.internalActions.subscriptionsUpdated(D)),i=_,a=null},500));let I=typeof S.type=="string"&&!!S.type.startsWith(o),k=t.rejected.match(S)&&S.meta.condition&&!!S.meta.arg.subscribe;T=!I&&!k}return[T,!1]}},fI=2147483647/1e3-1,mI=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:a},getRunningQueryThunk:s,mwApi:l})=>{let{removeQueryResult:c,unsubscribeQueryResult:g,cacheEntriesUpserted:v}=t.internalActions,E=Ht(g.match,r.fulfilled,r.rejected,v.match);function h(I){let k=o.currentSubscriptions.get(I);return k?k.size>0:!1}let y={};function S(I){for(let k of I.values())k?.abort?.()}let C=(I,k)=>{let _=k.getState(),D=a(_);if(E(I)){let B;if(v.match(I))B=I.payload.map(L=>L.queryDescription.queryCacheKey);else{let{queryCacheKey:L}=g.match(I)?I.payload:I.meta.arg;B=[L]}R(B,k,D)}if(t.util.resetApiState.match(I)){for(let[B,L]of Object.entries(y))L&&clearTimeout(L),delete y[B];S(o.runningQueries),S(o.runningMutations)}if(n.hasRehydrationInfo(I)){let{queries:B}=n.extractRehydrationInfo(I);R(Object.keys(B),k,D)}};function R(I,k,_){let D=k.getState();for(let B of I){let L=i(D,B);L?.endpointName&&T(B,L.endpointName,k,_)}}function T(I,k,_,D){let L=bo(n,k)?.keepUnusedDataFor??D.keepUnusedDataFor;if(L===1/0)return;let j=Math.max(0,Math.min(L,fI));if(!h(I)){let V=y[I];V&&clearTimeout(V),y[I]=setTimeout(()=>{if(!h(I)){let q=i(_.getState(),I);q?.endpointName&&_.dispatch(s(q.endpointName,q.originalArgs))?.abort(),_.dispatch(c({queryCacheKey:I}))}delete y[I]},j*1e3)}}return C},Uh=new Error("Promise never resolved before cacheEntryRemoved."),gI=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:a,selectApiState:s}})=>{let l=ns(n),c=ns(o),g=sr(n,o),v={},{removeQueryResult:E,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function S(_,D,B){let L=v[_];L?.valueResolved&&(L.valueResolved({data:D,meta:B}),delete L.valueResolved)}function C(_){let D=v[_];D&&(delete v[_],D.cacheEntryRemoved())}function R(_){let{arg:D,requestId:B}=_.meta,{endpointName:L,originalArgs:j}=D;return[L,j,B]}let T=(_,D,B)=>{let L=I(_);function j(V,q,O,P){let F=a(B,q),H=a(D.getState(),q);!F&&H&&k(V,P,q,D,O)}if(n.pending.match(_)){let[V,q,O]=R(_);j(V,L,O,q)}else if(y.match(_))for(let{queryDescription:V,value:q}of _.payload){let{endpointName:O,originalArgs:P,queryCacheKey:F}=V;j(O,F,_.meta.requestId,P),S(F,q,{})}else if(o.pending.match(_)){if(D.getState()[t].mutations[L]){let[q,O,P]=R(_);k(q,O,L,D,P)}}else if(g(_))S(L,_.payload,_.meta.baseQueryMeta);else if(E.match(_)||h.match(_))C(L);else if(e.util.resetApiState.match(_))for(let V of Object.keys(v))C(V)};function I(_){return l(_)?_.meta.arg.queryCacheKey:c(_)?_.meta.arg.fixedCacheKey??_.meta.requestId:E.match(_)?_.payload.queryCacheKey:h.match(_)?Bi(_.payload):""}function k(_,D,B,L,j){let V=bo(r,_),q=V?.onCacheEntryAdded;if(!q)return;let O={},P=new Promise(W=>{O.cacheEntryRemoved=W}),F=Promise.race([new Promise(W=>{O.valueResolved=W}),P.then(()=>{throw Uh})]);F.catch(()=>{}),v[B]=O;let H=e.endpoints[_].select($s(V)?D:B),Q=L.dispatch((W,te,se)=>se),X={...L,getCacheEntry:()=>H(L.getState()),requestId:j,extra:Q,updateCachedData:$s(V)?W=>L.dispatch(e.util.updateQueryData(_,D,W)):void 0,cacheDataLoaded:F,cacheEntryRemoved:P},Y=q(D,X);Promise.resolve(Y).catch(W=>{if(W!==Uh)throw W})}return T},hI=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},yI=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:a,refetchQuery:s,internalState:l})=>{let{removeQueryResult:c}=i.internalActions,g=Ht(sr(n),Ii(n)),v=Ht(sr(o,n),nn(o,n)),E=[],h=0,y=(R,T)=>{(o.pending.match(R)||n.pending.match(R))&&h++,v(R)&&(h=Math.max(0,h-1)),g(R)?C(ey(R,"invalidatesTags",r,a),T):v(R)?C([],T):i.util.invalidateTags.match(R)&&C(Hd(R.payload,void 0,void 0,void 0,void 0,a),T)};function S(){return h>0}function C(R,T){let I=T.getState(),k=I[e];if(E.push(...R),k.config.invalidationBehavior==="delayed"&&S())return;let _=E;if(E=[],_.length===0)return;let D=i.util.selectInvalidatedBy(I,_);t.batch(()=>{let B=Array.from(D.values());for(let{queryCacheKey:L}of B){let j=k.queries[L],V=Gs(l.currentSubscriptions,L,Ud);j&&(V.size===0?T.dispatch(c({queryCacheKey:L})):j.status!==fr&&T.dispatch(s(j)))}})}return y},vI=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:a}=o,s=new Set,l=null,c=(C,R)=>{(r.internalActions.updateSubscriptionOptions.match(C)||r.internalActions.unsubscribeQueryResult.match(C))&&g(C.payload.queryCacheKey,R),(t.pending.match(C)||t.rejected.match(C)&&C.meta.condition)&&g(C.meta.arg.queryCacheKey,R),(t.fulfilled.match(C)||t.rejected.match(C)&&!C.meta.condition)&&v(C.meta.arg,R),r.util.resetApiState.match(C)&&(y(),l&&(clearTimeout(l),l=null),s.clear())};function g(C,R){s.add(C),l||(l=setTimeout(()=>{for(let T of s)E({queryCacheKey:T},R);s.clear(),l=null},0))}function v({queryCacheKey:C},R){let T=R.getState()[e],I=T.queries[C],k=a.get(C);if(!I||I.status===fr)return;let{lowestPollingInterval:_,skipPollingIfUnfocused:D}=S(k);if(!Number.isFinite(_))return;let B=i.get(C);B?.timeout&&(clearTimeout(B.timeout),B.timeout=void 0);let L=Date.now()+_;i.set(C,{nextPollTimestamp:L,pollingInterval:_,timeout:setTimeout(()=>{(T.config.focused||!D)&&R.dispatch(n(I)),v({queryCacheKey:C},R)},_)})}function E({queryCacheKey:C},R){let I=R.getState()[e].queries[C],k=a.get(C);if(!I||I.status===fr)return;let{lowestPollingInterval:_}=S(k);if(!Number.isFinite(_)){h(C);return}let D=i.get(C),B=Date.now()+_;(!D||B<D.nextPollTimestamp)&&v({queryCacheKey:C},R)}function h(C){let R=i.get(C);R?.timeout&&clearTimeout(R.timeout),i.delete(C)}function y(){for(let C of i.keys())h(C)}function S(C=new Map){let R=!1,T=Number.POSITIVE_INFINITY;for(let I of C.values())I.pollingInterval&&(T=Math.min(I.pollingInterval,T),R=I.skipPollingIfUnfocused||R);return{lowestPollingInterval:T,skipPollingIfUnfocused:R}}return c},SI=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=rs(r,n),i=nn(r,n),a=sr(r,n),s={};return(c,g)=>{if(o(c)){let{requestId:v,arg:{endpointName:E,originalArgs:h}}=c.meta,y=bo(t,E),S=y?.onQueryStarted;if(S){let C={},R=new Promise((_,D)=>{C.resolve=_,C.reject=D});R.catch(()=>{}),s[v]=C;let T=e.endpoints[E].select($s(y)?h:v),I=g.dispatch((_,D,B)=>B),k={...g,getCacheEntry:()=>T(g.getState()),requestId:v,extra:I,updateCachedData:$s(y)?_=>g.dispatch(e.util.updateQueryData(E,h,_)):void 0,queryFulfilled:R};S(h,k)}}else if(a(c)){let{requestId:v,baseQueryMeta:E}=c.meta;s[v]?.resolve({data:c.payload,meta:E}),delete s[v]}else if(i(c)){let{requestId:v,rejectedWithValue:E,baseQueryMeta:h}=c.meta;s[v]?.reject({error:c.payload??c.error,isUnhandledError:!E,meta:h}),delete s[v]}}},bI=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,a=(l,c)=>{$d.match(l)&&s(c,"refetchOnFocus"),Qd.match(l)&&s(c,"refetchOnReconnect")};function s(l,c){let g=l.getState()[e],v=g.queries,E=o.currentSubscriptions;t.batch(()=>{for(let h of E.keys()){let y=v[h],S=E.get(h);if(!S||!y)continue;let C=[...S.values()];(C.some(T=>T[c]===!0)||C.every(T=>T[c]===void 0)&&g.config[c])&&(S.size===0?l.dispatch(i({queryCacheKey:h})):y.status!==fr&&l.dispatch(n(y)))}})}return a};function wI(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:a}=o,s={invalidateTags:N(`${t}/invalidateTags`)},l=E=>E.type.startsWith(`${t}/`),c=[hI,mI,yI,vI,gI,SI];return{middleware:E=>{let h=!1,y=i(E.dispatch),S={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:l,mwApi:E},C=c.map(I=>I(S)),R=pI(S),T=bI(S);return I=>k=>{if(!li(k))return I(k);h||(h=!0,E.dispatch(n.internalActions.middlewareRegistered(a)));let _={...E,next:I},D=E.getState(),[B,L]=R(k,_,D),j;if(B?j=I(k):j=L,E.getState()[t]&&(T(k,_,D),l(k)||o.hasRehydrationInfo(k)))for(let V of C)V(k,_,D);return j}},actions:s};function v(E){return e.api.endpoints[E.endpointName].initiate(E.originalArgs,{subscribe:!1,forceRefetch:!0})}}var Vh=Symbol(),AI=({createSelector:e=Be}={})=>({name:Vh,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:a,refetchOnMountOrArgChange:s,refetchOnFocus:l,refetchOnReconnect:c,invalidationBehavior:g,onSchemaFailure:v,catchSchemaFailure:E,skipSchemaValidation:h},y){Om();let S=ge=>(typeof process<"u",ge);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:Qd,onOffline:Wh,onFocus:$d,onFocusLost:zh},util:{}});let C=lI({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:R,selectCachedArgsForQuery:T,buildQuerySelector:I,buildInfiniteQuerySelector:k,buildMutationSelector:_}=C;pr(t.util,{selectInvalidatedBy:R,selectCachedArgsForQuery:T});let{queryThunk:D,infiniteQueryThunk:B,mutationThunk:L,patchQueryData:j,updateQueryData:V,upsertQueryData:q,prefetch:O,buildMatchThunkActions:P}=cI({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:S,selectors:C,onSchemaFailure:v,catchSchemaFailure:E,skipSchemaValidation:h}),{reducer:F,actions:H}=uI({context:y,queryThunk:D,infiniteQueryThunk:B,mutationThunk:L,serializeQueryArgs:i,reducerPath:o,assertTagType:S,config:{refetchOnFocus:l,refetchOnReconnect:c,refetchOnMountOrArgChange:s,keepUnusedDataFor:a,reducerPath:o,invalidationBehavior:g}});pr(t.util,{patchQueryData:j,updateQueryData:V,upsertQueryData:q,prefetch:O,resetApiState:H.resetApiState,upsertQueryEntries:H.cacheEntriesUpserted}),pr(t.internalActions,H);let Q=new WeakMap,X=ge=>Gs(Q,ge,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:Y,buildInitiateInfiniteQuery:W,buildInitiateMutation:te,getRunningMutationThunk:se,getRunningMutationsThunk:Ee,getRunningQueriesThunk:Me,getRunningQueryThunk:ke}=sI({queryThunk:D,mutationThunk:L,infiniteQueryThunk:B,api:t,serializeQueryArgs:i,context:y,getInternalState:X});pr(t.util,{getRunningMutationThunk:se,getRunningMutationsThunk:Ee,getRunningQueryThunk:ke,getRunningQueriesThunk:Me});let{middleware:Pe,actions:Ne}=wI({reducerPath:o,context:y,queryThunk:D,mutationThunk:L,infiniteQueryThunk:B,api:t,assertTagType:S,selectors:C,getRunningQueryThunk:ke,getInternalState:X});return pr(t.util,Ne),pr(t,{reducer:F,middleware:Pe}),{name:Vh,injectEndpoint(ge,fe){var $e;let he=($e=t.endpoints)[ge]??($e[ge]={});Hs(fe)&&pr(he,{name:ge,select:I(ge,fe),initiate:Y(ge,fe)},P(D,ge)),oI(fe)&&pr(he,{name:ge,select:_(),initiate:te(ge)},P(L,ge)),zs(fe)&&pr(he,{name:ge,select:k(ge,fe),initiate:W(ge,fe)},P(D,ge))}}}}),ry=dI(AI());m();d();f();p();m();d();f();p();var dn=e=>e.query,ny=e=>e.query?.enableQuerySyntax;var BG=Be(e=>dn(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})),xI=Be(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();var wo=(e,t,r)=>ft({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let i=t??cn(o);if(!i)return null;let a=eh(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:r,...(a&&{conversationId:a})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??cn(n)??"",answerGenerated:e??!1})}),Ao=e=>ft({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??cn(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})});m();d();f();p();m();d();f();p();var oy=Be(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:o}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(o&&{lq:o})}});m();d();f();p();var $i=(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:so(e)}});m();d();f();p();var zd=e=>e.context;m();d();f();p();var Wd=e=>e.pipeline;m();d();f();p();m();d();f();p();var Qi=Mt(Ws(),1),ly=Mt(iy(),1);m();d();f();p();var Ks=Mt(Ws(),1),sy=Mt(ay(),1);Ks.default.extend(sy.default);var cy="YYYY/MM/DD@HH:mm:ss",CI="1401-01-01";function xo(e,t){let r=(0,Ks.default)(e,t);return!r.isValid()&&!t?(0,Ks.default)(e,cy):r}function Ys(e){return e.format(cy)}function uy(e,t){let r=xo(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}`)}tp(r)}function tp(e){if(e.isBefore(CI))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}Qi.default.extend(ly.default);var dy=["past","now","next"],py=["minute","hour","day","week","month","quarter","year"],EI=e=>{let t=e==="now";return{amount:new oe({required:!t,min:1}),unit:new z({required:!t,constrainTo:py}),period:new z({required:!0,constrainTo:dy})}};function rp(e){if(typeof e=="string"&&!_r(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?yy(e):e;new mt(EI(t.period)).validate(t);let r=my(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);tp(r)}function fy(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function my(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Qi.default)().subtract(r,n);case"next":return(0,Qi.default)().add(r,n);case"now":return(0,Qi.default)()}}function Hi(e){return Ys(my(yy(e)))}function gy(e){return e.toLocaleLowerCase().split("-")}function _r(e){let[t,r,n]=gy(e);if(t==="now")return!0;if(!dy.includes(t)||!py.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function hy(e){return!!e&&typeof e=="object"&&"period"in e}function yy(e){let[t,r,n]=gy(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function vy(e){return e.type==="dateRange"}function Sy(e){return`start${e}`}function by(e){return`end${e}`}var np=()=>({dateFacetValueMap:{}});function RI(e,t,r){let n=e.start,o=e.end;return _r(n)&&(n=Hi(n),r.dateFacetValueMap[t][Sy(n)]=e.start),_r(o)&&(o=Hi(o),r.dateFacetValueMap[t][by(o)]=e.end),{...e,start:n,end:o}}function op(e,t){if(vy(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>RI(o,r,t))}}return e}function kr(e){let t=np();return{request:{...e,facets:e.facets?.map(n=>op(n,t))},mappings:t}}function II(e,t,r){return{...e,start:r.dateFacetValueMap[t][Sy(e.start)]||e.start,end:r.dateFacetValueMap[t][by(e.end)]||e.end}}function TI(e,t){return e.facetId in t.dateFacetValueMap}function _I(e,t){return TI(e,t)?{...e,values:e.values.map(r=>II(r,e.facetId,t))}:e}function Xs(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>_I(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function Or(e){return Object.values(e).map(t=>t.request)}function ip(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 wy(e){return Or(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var ap={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function kI(e){return Or(e).map(t=>{let r=ap[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function OI(e){return[...kI(e.facetSet??{}),...wy(e.numericFacetSet??{}),...wy(e.dateFacetSet??{}),...Or(e.categoryFacetSet??{})]}function PI(e){return OI(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function Zs(e){return ip(PI(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();var Pr=/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??br(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:It.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 qs(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 Pr(_x67,_x68){return _ref29.apply(this,arguments)}}();m();d();f();p();var Co=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??br(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&&$i(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 Ay=Be(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o}));var Nr=/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t,r){let n=cp(e),o=NI(e),i=FI(e),a=e.configuration.analytics.analyticsMode==="legacy"?yield Pr(e,r):Co(e,t,r);return kr({...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:sp(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 Nr(_x69,_x70,_x71){return _ref30.apply(this,arguments)}}();function sp(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function NI(e){return ip(MI(e),e.facetOrder??[])}function FI(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(DI).filter(r=>r.currentValues.length>0):void 0}function DI(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function MI(e){return qI(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function qI(e){return[...jI(e.facetSet??{}),...xy(e.numericFacetSet??{}),...xy(e.dateFacetSet??{}),...Or(e.categoryFacetSet??{})]}function jI(e){return Or(e).map(t=>{let r=ap[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function xy(e){return Or(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 cp(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=Ay(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();f();p();m();d();f();p();var zi=(e,t)=>{let r=e;return ce(r[t])?ce(e.raw[t])?null:e.raw[t]:r[t]},LI=e=>t=>e.every(r=>!ce(zi(t,r))),UI=e=>t=>e.every(r=>ce(zi(t,r))),VI=(e,t)=>r=>{let n=Cy(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},BI=(e,t)=>r=>{let n=Cy(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},Cy=(e,t)=>{let r=zi(t,e);return Hf(r)?r:[r]},Ey={getResultProperty:zi,fieldsMustBeDefined:LI,fieldsMustNotBeDefined:UI,fieldMustMatch:VI,fieldMustNotMatch:BI};var up=Be(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var lp=e=>e.searchHub;m();d();f();p();var Js=Be(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),RQ=Be(e=>e,e=>{let t=Js(e);return t&&e?e[t].expression:""});m();d();f();p();var Ry=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var Iy=e=>e.excerptLength?.length;m();d();f();p();var Ty=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var _y=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 Oy=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Hn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function Oy(_x72){return _ref31.apply(this,arguments)}}(),Py=(e,t)=>{let r=dn(e)?.q,{aq:n,cq:o,dq:i,lq:a}=Dy(e),s=zd(e),l=$i(e.configuration.analytics,t,{actionCause:up(e)}),c=lp(e),g=Wd(e),v=xd(e)??[],E=Fy(e),h=Js(e.tabSet)||"default",y=wd(e),S=Kg(e),C=t.referrer||"",R=Ty(e),T=ky(e),I=GI(e),k=Iy(e),_=_y(e),D=Ry(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(a&&{lq:a}),...(e.query&&{enableQuerySyntax:ny(e)}),...(s?.contextValues&&{context:s.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(c?.length&&{searchHub:c}),...(g?.length&&{pipeline:g}),...(E.length&&{facets:E}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(e.pagination&&{numberOfResults:sp(e),firstResult:e.pagination.firstResult}),tab:h,locale:y,timezone:S,...(e.debug!==void 0&&{debug:e.debug}),referrer:C,...I,...(_??{}),...(k&&{excerptLength:k}),...(D&&{dictionaryFieldContext:D}),sortCriteria:T,...(R&&{facetOptions:R}),...l,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Ny=(e,t)=>{let r=dn(e)?.q,n=Fy(e),o=$i(e.configuration.analytics,t,{actionCause:up(e)}),i=wd(e),a=Js(e.tabSet)||"default",s=t.referrer,{aq:l,cq:c}=Dy(e),g=lp(e),v=Wd(e),E=zd(e),h=xd(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(v?.length&&{pipeline:v}),...(E?.contextValues&&{context:E.contextValues}),...(l&&{aq:l}),...(c&&{cq:c}),tab:a,referrer:s,...o,locale:i}},Fy=e=>Zs(e)?.map(t=>op(t,np())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),GI=e=>({actionsHistory:e.configuration.analytics.enabled?It.getInstance().getHistory():[]}),Dy=e=>{let t=oy(e),r=cp(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var ec=["searching","thinking","answering"];function tc(e){return e.toLowerCase()}m();d();f();p();var My=["text/plain","text/markdown"];var Eo=new z({required:!0}),qy=new z,Ro=new me({required:!0}),dp={id:Eo,title:Eo,uri:Eo,permanentid:Eo,clickUri:qy},rc=new z({required:!0,constrainTo:My}),jy=new z({required:!0,constrainTo:ec}),Ly=e=>({...e,name:tc(e.name)}),HH=N("generatedAnswer/setIsVisible",e=>$(e,Ro)),nc=N("generatedAnswer/setAnswerId",e=>$(e,Z)),zH=N("generatedAnswer/setAnswerGenerationMode",e=>$(e,new z({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),WH=N("generatedAnswer/setIsEnabled",e=>$(e,Ro)),Ki=N("generatedAnswer/updateMessage",e=>$(e,{textDelta:Eo})),Yi=N("generatedAnswer/updateCitations",e=>$(e,{citations:new ve({required:!0,each:new ne({values:dp})})})),Xi=N("generatedAnswer/updateError",e=>$(e,{message:qy,code:new oe({min:0})})),oc=N("generatedAnswer/resetAnswer"),KH=N("generatedAnswer/like"),YH=N("generatedAnswer/dislike"),XH=N("generatedAnswer/feedbackModal/open"),ZH=N("generatedAnswer/expand"),JH=N("generatedAnswer/collapse"),ez=N("generatedAnswer/setId",e=>$(e,{id:new z({required:!0})})),tz=N("generatedAnswer/feedbackModal/close"),rz=N("generatedAnswer/sendFeedback"),Fr=N("generatedAnswer/setIsLoading",e=>$(e,Ro)),Wi=N("generatedAnswer/setIsStreaming",e=>$(e,Ro)),Zi=N("generatedAnswer/setAnswerContentFormat",e=>$(e,rc)),nz=N("generatedAnswer/updateResponseFormat",e=>$(e,{contentFormat:new ve({each:rc,default:["text/plain"]})})),oz=N("knowledge/updateAnswerConfigurationId",e=>$(e,Eo)),iz=N("generatedAnswer/registerFieldsToIncludeInCitations",e=>$(e,as)),pp=N("generatedAnswer/setIsAnswerGenerated",e=>$(e,Ro)),Ji=N("generatedAnswer/setCannotAnswer",e=>$(e,Ro)),$I=N("generatedAnswer/setAnswerApiQueryParams",e=>$(e,new ne({}))),Uy=N("generatedAnswer/startStep",e=>$(Ly(e),{name:jy,startedAt:new oe({min:0,required:!0})})),Vy=N("generatedAnswer/finishStep",e=>$(Ly(e),{name:jy,finishedAt:new oe({min:0,required:!0})})),az=Re("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:i}=t,{search:a}=i(),{queryExecuted:s}=a,{setAbortControllerRef:l}=e,c=yield Oy(r),g=(h,y)=>{switch(h){case"genqa.headerMessageType":{let S=JSON.parse(y);n(Zi(S.contentFormat));break}case"genqa.messageType":n(Ki(JSON.parse(y)));break;case"genqa.citationsType":n(Yi(JSON.parse(y)));break;case"genqa.endOfStreamType":{let S=JSON.parse(y).answerGenerated,{answerId:C,answer:R}=i().generatedAnswer,I=s.length!==0&&!S,k=!R?.trim();n(Ji(I)),n(Wi(!1)),n(pp(S)),n(wo(S,C,S?k:void 0)),n(Ao());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${h}"`)}};n(Fr(!0));let v=h=>h.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,E=o.streamingClient?.streamGeneratedAnswer(c,{write:h=>{v(c)&&(n(Fr(!1)),h.payload&&h.payloadType&&g(h.payloadType,h.payload))},abort:h=>{v(c)&&n(Xi(h))},close:()=>{v(c)&&n(Wi(!1))},resetAnswer:()=>{v(c)&&n(oc())}});E?l(E):n(Fr(!1))});return function(_x73,_x74){return _ref32.apply(this,arguments)}}()),sz=Re("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(oc());let i=t();if(i.generatedAnswer.answerConfigurationId){let a=Py(i,n);r($I(a)),yield r(By(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 $y(_x77,_x78){return _$y.apply(this,arguments)}function _$y(){_$y=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _$y.apply(this,arguments)}function Qy(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=HI(t,a);let s=t.length,l=0;for(;r<s;){o&&(t[r]===10&&(l=++r),o=!1);let c=-1;for(;r<s&&c===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-l);break;case 13:o=!0,c=r;break;case 10:c=r;break}if(c===-1)break;e(t.subarray(l,c),n),l=r,n=-1}l===s?t=void 0:l!==0&&(t=t.subarray(l),r-=l)}}function Hy(e,t,r){let n=Gy(),o=new TextDecoder;return function(a,s){if(a.length===0)r?.(n),n=Gy();else if(s>0){let l=o.decode(a.subarray(0,s)),c=s+(a[s+1]===32?2:1),g=o.decode(a.subarray(c));switch(l){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":QI(g,n,t);break}}}}function QI(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function HI(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function Gy(){return{data:"",event:"",id:"",retry:void 0}}var fp="text/event-stream",zI=1e3,zy="last-event-id";function Wy(){return typeof window<"u"}function Ky(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:a,openWhenHidden:s,fetch:l,...c}){return new Promise((g,v)=>{let E={...r};E.accept||(E.accept=fp);let h;function y(){h?.abort(),document.hidden||k()}!s&&Wy()&&document.addEventListener("visibilitychange",y);let S=zI,C;function R(){Wy()&&document.removeEventListener("visibilitychange",y),clearTimeout(C),h?.abort()}t?.addEventListener("abort",()=>{R(),g()});let T=l??w,I=n??WI;function k(){return _k2.apply(this,arguments)}function _k2(){_k2=_asyncToGenerator(function*(){h=u.AbortController?new u.AbortController:null;try{let _=yield T(e,{...c,headers:E,signal:h?.signal});yield I(_),yield $y(_.body,Qy(Hy(D=>{D?E[zy]=D:delete E[zy]},D=>{S=D},o))),i?.(),R(),g()}catch(_){if(!h?.signal?.aborted)try{let D=a?.(_)??S;clearTimeout(C),C=setTimeout(k,D)}catch(D){R(),v(D)}}});return _k2.apply(this,arguments)}k()})}function WI(e){let t=e.headers.get("content-type");if(!t?.startsWith(fp))throw new Error(`Expected content-type to be ${fp}, Actual: ${t}`)}m();d();f();p();var KI=/*#__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,l={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let c=Hn(n.configuration.search?.apiBaseUrl,a,i);return Gh({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,E={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{E[h]=g[h]}),E.duplex="half",E.body=yield g.text(),w(v,E)});return function fetchFn(_x82){return _ref35.apply(this,arguments)}}()})(l,{...t,signal:null},r)}catch(c){return{error:c}}});return function KI(_x79,_x80,_x81){return _ref34.apply(this,arguments)}}(),Yy=ry({reducerPath:"answer",baseQuery:Qh(KI,{maxRetries:3}),endpoints:()=>({})});var YI=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},XI=(e,t)=>{let{textDelta:r}=t;if(typeof r!="string")return;let n=e.answer;!n?.trim()&&!r.trim()||(e.answer=n?.trim()?n.concat(r):r)},ZI=(e,t)=>{e.citations=t.citations},JI=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},eT=(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})`)},tT=(e,t,r)=>{let n=JSON.parse(e.data);n.finishReason==="ERROR"&&n.errorMessage&&eT(t,n);let o=n.payload.length?JSON.parse(n.payload):{};switch(n.payloadType){case"genqa.headerMessageType":o.contentFormat&&(YI(t,o),r(Zi(o.contentFormat)));break;case"genqa.messageType":typeof o.textDelta=="string"&&(XI(t,o),r(Ki({textDelta:o.textDelta})));break;case"genqa.citationsType":o.citations&&(ZI(t,o),r(Yi({citations:o.citations})));break;case"genqa.endOfStreamType":{JI(t,o);let i=t.answerId,a=o.answerGenerated??!1,s=a?!t.answer?.trim():void 0;r(wo(a,i,s)),r(Ao());break}}},rT=(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`},mp=Yy.injectEndpoints({overrideExisting:!0,endpoints:e=>({getAnswer:e.query({queryFn:()=>({data:{contentFormat:void 0,answer:void 0,citations:void 0,error:void 0,generated:!1,isStreaming:!0,isLoading:!0}}),serializeQueryArgs:({endpointName:t,queryArgs:r})=>{let{analytics:n,...o}=r;return`${t}(${JSON.stringify(o)})`},onCacheEntryAdded(_x83,_x84){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:i}){yield n;let{configuration:a,generatedAnswer:s,insightConfiguration:l}=r(),{organizationId:c,environment:g,accessToken:v}=a,E=Hn(a.search.apiBaseUrl,c,g),h=rT(E,c,s.answerConfigurationId,l?.insightId);yield Ky(h,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${v}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:w,onopen:function(){var _ref36=_asyncToGenerator(function*(y){let S=y.headers.get("x-answer-id");S&&o(C=>{C.answerId=S,i(nc(S))})});return function onopen(_x85){return _ref36.apply(this,arguments)}}(),onmessage:y=>{o(S=>{tT(y,S,i)})},onerror:y=>{throw y},onclose:()=>{o(y=>{i(Ji(!y.generated))})}})}).apply(this,arguments)}})})}),By=e=>mp.endpoints.getAnswer.initiate(e);m();d();f();p();var Xy=Le(Zn,e=>e);m();d();f();p();function nT(e){let t=e.payload?.analyticsAction;return Zy(e)&&!ce(t)}function Zy(e){return"type"in e}var Jy=e=>t=>r=>{let n;nT(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return Zy(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 o4=N("tab/register",e=>{let t=new ne({values:{id:Z,expression:tt}});return $(e,t)}),ic=N("tab/updateActiveTab",e=>$(e,Z));m();d();f();p();var ac=Mt(Ws(),1),rv=Mt(ev(),1),nv=Mt(tv(),1);ac.default.extend(nv.default);ac.default.extend(rv.default);var ov=()=>({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 oT=/(^|; )Coveo-Pendragon=([^;]*)/,iT=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function iv(){return typeof window>"u"?!1:oT.exec(document.cookie)?.pop()||null}function av(){return typeof window>"u"?!1:iT.test(document.cookie)}var sv=Le(ov(),e=>e.addCase(Cr,(t,r)=>{aT(t,r.payload)}).addCase(zt,(t,r)=>{sT(t,r.payload)}).addCase(Jn,(t,r)=>{cT(t,r.payload)}).addCase(eo,t=>{t.analytics.enabled=!1}).addCase(to,t=>{t.analytics.enabled=!0}).addCase(ss,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(cs,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(ic,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(hg,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Er,(t,r)=>{ce(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(mg,(t,{payload:r})=>{uT(t,r)}));function aT(e,t){ce(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ce(t.organizationId)||(e.organizationId=t.organizationId)}function sT(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 cT(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=iv();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 uT(e,t){e.knowledge.agentId=t;try{let r=av();ce(r)||(e.knowledge.debugAgentSession=!0)}catch{}}var jt=sv;m();d();f();p();function lT(e){return e.instantlyCallable}var cv=()=>e=>t=>e(lT(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 ot=[];for(let e=0;e<256;++e)ot.push((e+256).toString(16).slice(1));function uv(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()}m();d();f();p();var Sp,dT=new Uint8Array(16);function bp(){if(!Sp){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Sp=crypto.getRandomValues.bind(crypto)}return Sp(dT)}m();d();f();p();m();d();f();p();var pT=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),wp={randomUUID:pT};function fT(e,t,r){if(wp.randomUUID&&!t&&!e)return wp.randomUUID();e=e||{};let n=e.random??e.rng?.()??bp();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 uv(n)}var Dr=fT;m();d();f();p();m();d();f();p();var A={};ei(A,{BRAND:()=>LT,DIRTY:()=>fn,EMPTY_PATH:()=>yT,INVALID:()=>le,NEVER:()=>x_,OK:()=>ct,ParseStatus:()=>it,Schema:()=>be,ZodAny:()=>jr,ZodArray:()=>yr,ZodBigInt:()=>gn,ZodBoolean:()=>hn,ZodBranded:()=>ta,ZodCatch:()=>In,ZodDate:()=>yn,ZodDefault:()=>Rn,ZodDiscriminatedUnion:()=>uc,ZodEffects:()=>Pt,ZodEnum:()=>Cn,ZodError:()=>yt,ZodFirstPartyTypeKind:()=>de,ZodFunction:()=>dc,ZodIntersection:()=>wn,ZodIssueCode:()=>K,ZodLazy:()=>An,ZodLiteral:()=>xn,ZodMap:()=>Po,ZodNaN:()=>Fo,ZodNativeEnum:()=>En,ZodNever:()=>Lt,ZodNull:()=>Sn,ZodNullable:()=>Zt,ZodNumber:()=>mn,ZodObject:()=>vt,ZodOptional:()=>kt,ZodParsedType:()=>re,ZodPipeline:()=>ra,ZodPromise:()=>Lr,ZodReadonly:()=>Tn,ZodRecord:()=>lc,ZodSchema:()=>be,ZodSet:()=>No,ZodString:()=>qr,ZodSymbol:()=>ko,ZodTransformer:()=>Pt,ZodTuple:()=>Xt,ZodType:()=>be,ZodUndefined:()=>vn,ZodUnion:()=>bn,ZodUnknown:()=>hr,ZodVoid:()=>Oo,addIssueToContext:()=>ee,any:()=>WT,array:()=>ZT,bigint:()=>GT,boolean:()=>bv,coerce:()=>A_,custom:()=>yv,date:()=>$T,datetimeRegex:()=>gv,defaultErrorMap:()=>mr,discriminatedUnion:()=>r_,effect:()=>m_,enum:()=>d_,function:()=>c_,getErrorMap:()=>Io,getParsedType:()=>Yt,instanceof:()=>VT,intersection:()=>n_,isAborted:()=>sc,isAsync:()=>To,isDirty:()=>cc,isValid:()=>Mr,late:()=>UT,lazy:()=>u_,literal:()=>l_,makeIssue:()=>ea,map:()=>a_,nan:()=>BT,nativeEnum:()=>p_,never:()=>YT,null:()=>zT,nullable:()=>h_,number:()=>Sv,object:()=>JT,objectUtil:()=>Ap,oboolean:()=>w_,onumber:()=>b_,optional:()=>g_,ostring:()=>S_,pipeline:()=>v_,preprocess:()=>y_,promise:()=>f_,quotelessJson:()=>mT,record:()=>i_,set:()=>s_,setErrorMap:()=>hT,strictObject:()=>e_,string:()=>vv,symbol:()=>QT,transformer:()=>m_,tuple:()=>o_,undefined:()=>HT,union:()=>t_,unknown:()=>KT,util:()=>Ce,void:()=>XT});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 Ap;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Ap||(Ap={}));var re=Ce.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yt=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"]),mT=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),yt=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,l=0;for(;l<a.path.length;){let c=a.path[l];l===a.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(r(a))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};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()}};yt.create=e=>new yt(e);var gT=(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}},mr=gT;var lv=mr;function hT(e){lv=e}function Io(){return lv}m();d();f();p();var ea=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="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)s=c(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}},yT=[];function ee(e,t){let r=Io(),n=ea({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===mr?void 0:mr].filter(o=>!!o)});e.common.issues.push(n)}var it=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 le;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 le;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}}},le=Object.freeze({status:"aborted"}),fn=e=>({status:"dirty",value:e}),ct=e=>({status:"valid",value:e}),sc=e=>e.status==="aborted",cc=e=>e.status==="dirty",Mr=e=>e.status==="valid",To=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 Ot=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}},dv=(e,t)=>{if(Mr(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 yt(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:l}=e;return a.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:l??r??s.defaultError}},description:o}}var be=class{get description(){return this._def.description}_getType(t){return Yt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Yt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new it,ctx:{common:t.parent.common,data:t.data,parsedType:Yt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(To(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:Yt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return dv(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Mr(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=>Mr(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:Yt(t)},o=_this11._parse({data:t,path:n.path,parent:n}),i=yield To(o)?o:Promise.resolve(o);return dv(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(l=>l?!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 Pt({schema:this,typeName:de.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 kt.create(this,this._def)}nullable(){return Zt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return yr.create(this)}promise(){return Lr.create(this,this._def)}or(t){return bn.create([this,t],this._def)}and(t){return wn.create(this,t,this._def)}transform(t){return new Pt({...ye(this._def),schema:this,typeName:de.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Rn({...ye(this._def),innerType:this,defaultValue:r,typeName:de.ZodDefault})}brand(){return new ta({typeName:de.ZodBranded,type:this,...ye(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new In({...ye(this._def),innerType:this,catchValue:r,typeName:de.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return ra.create(this,t)}readonly(){return Tn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},vT=/^c[^\s-]{8,}$/i,ST=/^[0-9a-z]+$/,bT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wT=/^[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,AT=/^[a-z0-9_-]{21}$/i,xT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,CT=/^[-+]?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)?)??$/,ET=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,RT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",xp,IT=/^(?:(?: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])$/,TT=/^(?:(?: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])$/,_T=/^(([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]))$/,kT=/^(([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])$/,OT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,PT=/^([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])))",NT=new RegExp(`^${fv}$`);function mv(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function FT(e){return new RegExp(`^${mv(e)}$`)}function gv(e){let t=`${fv}T${mv(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 DT(e,t){return!!((t==="v4"||!t)&&IT.test(e)||(t==="v6"||!t)&&_T.test(e))}function MT(e,t){if(!xT.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 qT(e,t){return!!((t==="v4"||!t)&&TT.test(e)||(t==="v6"||!t)&&kT.test(e))}var qr=class e extends be{_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}),le}let n=new it,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")ET.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")xp||(xp=new RegExp(RT,"u")),xp.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")wT.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")AT.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")vT.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")ST.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")bT.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"?gv(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"?NT.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?FT(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"?CT.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"duration",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?DT(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"?MT(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"?qT(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"?OT.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"base64",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?PT.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,...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}};qr.create=e=>new qr({checks:[],typeName:de.ZodString,coerce:e?.coerce??!1,...ye(e)});function jT(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 mn=class e extends be{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}),le}let n,o=new it;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"?jT(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,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"&&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)}};mn.create=e=>new mn({checks:[],typeName:de.ZodNumber,coerce:e?.coerce||!1,...ye(e)});var gn=class e extends be{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 it;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}),le}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}};gn.create=e=>new gn({checks:[],typeName:de.ZodBigInt,coerce:e?.coerce??!1,...ye(e)});var hn=class extends be{_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}),le}return ct(t.data)}};hn.create=e=>new hn({typeName:de.ZodBoolean,coerce:e?.coerce||!1,...ye(e)});var yn=class e extends be{_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}),le}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_date}),le}let n=new it,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: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}};yn.create=e=>new yn({checks:[],coerce:e?.coerce||!1,typeName:de.ZodDate,...ye(e)});var ko=class extends be{_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}),le}return ct(t.data)}};ko.create=e=>new ko({typeName:de.ZodSymbol,...ye(e)});var vn=class extends be{_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}),le}return ct(t.data)}};vn.create=e=>new vn({typeName:de.ZodUndefined,...ye(e)});var Sn=class extends be{_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}),le}return ct(t.data)}};Sn.create=e=>new Sn({typeName:de.ZodNull,...ye(e)});var jr=class extends be{constructor(){super(...arguments),this._any=!0}_parse(t){return ct(t.data)}};jr.create=e=>new jr({typeName:de.ZodAny,...ye(e)});var hr=class extends be{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ct(t.data)}};hr.create=e=>new hr({typeName:de.ZodUnknown,...ye(e)});var Lt=class extends be{_parse(t){let r=this._getOrReturnCtx(t);return ee(r,{code:K.invalid_type,expected:re.never,received:r.parsedType}),le}};Lt.create=e=>new Lt({typeName:de.ZodNever,...ye(e)});var Oo=class extends be{_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}),le}return ct(t.data)}};Oo.create=e=>new Oo({typeName:de.ZodVoid,...ye(e)});var yr=class e extends be{_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}),le;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 Ot(r,a,r.path,s)))).then(a=>it.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Ot(r,a,r.path,s)));return it.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)}};yr.create=(e,t)=>new yr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:de.ZodArray,...ye(t)});function _o(e){if(e instanceof vt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=kt.create(_o(n))}return new vt({...e._def,shape:()=>t})}else return e instanceof yr?new yr({...e._def,type:_o(e.element)}):e instanceof kt?kt.create(_o(e.unwrap())):e instanceof Zt?Zt.create(_o(e.unwrap())):e instanceof Xt?Xt.create(e.items.map(t=>_o(t))):e}var vt=class e extends be{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 c=this._getOrReturnCtx(t);return ee(c,{code:K.invalid_type,expected:re.object,received:c.parsedType}),le}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Lt&&this._def.unknownKeys==="strip"))for(let c in o.data)a.includes(c)||s.push(c);let l=[];for(let c of a){let g=i[c],v=o.data[c];l.push({key:{status:"valid",value:c},value:g._parse(new Ot(o,v,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Lt){let c=this._def.unknownKeys;if(c==="passthrough")for(let g of s)l.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];l.push({key:{status:"valid",value:g},value:c._parse(new Ot(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 l){let v=yield g.key,E=yield g.value;c.push({key:v,value:E,alwaysSet:g.alwaysSet})}return c})).then(c=>it.mergeObjectSync(n,c)):it.mergeObjectSync(n,l)}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:de.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 _o(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 kt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return hv(Ce.objectKeys(this.shape))}};vt.create=(e,t)=>new vt({shape:()=>e,unknownKeys:"strip",catchall:Lt.create(),typeName:de.ZodObject,...ye(t)});vt.strictCreate=(e,t)=>new vt({shape:()=>e,unknownKeys:"strict",catchall:Lt.create(),typeName:de.ZodObject,...ye(t)});vt.lazycreate=(e,t)=>new vt({shape:e,unknownKeys:"strip",catchall:Lt.create(),typeName:de.ZodObject,...ye(t)});var bn=class extends be{_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 yt(s.ctx.common.issues));return ee(r,{code:K.invalid_union,unionErrors:a}),le}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 l of n){let c={...r,common:{...r.common,issues:[]},parent:null},g=l._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(l=>new yt(l));return ee(r,{code:K.invalid_union,unionErrors:s}),le}}get options(){return this._def.options}};bn.create=(e,t)=>new bn({options:e,typeName:de.ZodUnion,...ye(t)});var gr=e=>e instanceof An?gr(e.schema):e instanceof Pt?gr(e.innerType()):e instanceof xn?[e.value]:e instanceof Cn?e.options:e instanceof En?Ce.objectValues(e.enum):e instanceof Rn?gr(e._def.innerType):e instanceof vn?[void 0]:e instanceof Sn?[null]:e instanceof kt?[void 0,...gr(e.unwrap())]:e instanceof Zt?[null,...gr(e.unwrap())]:e instanceof ta||e instanceof Tn?gr(e.unwrap()):e instanceof In?gr(e._def.innerType):[],uc=class e extends be{_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}),le;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]}),le)}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=gr(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:de.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...ye(n)})}};function Cp(e,t){let r=Yt(e),n=Yt(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 l=Cp(e[s],t[s]);if(!l.valid)return{valid:!1};a[s]=l.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],l=Cp(a,s);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return r===re.date&&n===re.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var wn=class extends be{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(sc(i)||sc(a))return le;let s=Cp(i.value,a.value);return s.valid?((cc(i)||cc(a))&&r.dirty(),{status:r.value,value:s.data}):(ee(n,{code:K.invalid_intersection_types}),le)};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}))}};wn.create=(e,t,r)=>new wn({left:e,right:t,typeName:de.ZodIntersection,...ye(r)});var Xt=class e extends be{_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}),le;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"}),le;!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 l=this._def.items[s]||this._def.rest;return l?l._parse(new Ot(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>it.mergeArray(r,a)):it.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Xt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xt({items:e,typeName:de.ZodTuple,rest:null,...ye(t)})};var lc=class e extends be{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}),le;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Ot(n,s,n.path,s)),value:a._parse(new Ot(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?it.mergeObjectAsync(r,o):it.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof be?new e({keyType:t,valueType:r,typeName:de.ZodRecord,...ye(n)}):new e({keyType:qr.create(),valueType:t,typeName:de.ZodRecord,...ye(r)})}},Po=class extends be{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}),le;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,l],c)=>({key:o._parse(new Ot(n,s,n.path,[c,"key"])),value:i._parse(new Ot(n,l,n.path,[c,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let l of a){let c=yield l.key,g=yield l.value;if(c.status==="aborted"||g.status==="aborted")return le;(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 l of a){let c=l.key,g=l.value;if(c.status==="aborted"||g.status==="aborted")return le;(c.status==="dirty"||g.status==="dirty")&&r.dirty(),s.set(c.value,g.value)}return{status:r.value,value:s}}}};Po.create=(e,t,r)=>new Po({valueType:t,keyType:e,typeName:de.ZodMap,...ye(r)});var No=class e extends be{_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}),le;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(l){let c=new Set;for(let g of l){if(g.status==="aborted")return le;g.status==="dirty"&&r.dirty(),c.add(g.value)}return{status:r.value,value:c}}let s=[...n.data.values()].map((l,c)=>i._parse(new Ot(n,l,n.path,c)));return n.common.async?Promise.all(s).then(l=>a(l)):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)}};No.create=(e,t)=>new No({valueType:e,minSize:null,maxSize:null,typeName:de.ZodSet,...ye(t)});var dc=class e extends be{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}),le;function n(s,l){return ea({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Io(),mr].filter(c=>!!c),issueData:{code:K.invalid_arguments,argumentsError:l}})}function o(s,l){return ea({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Io(),mr].filter(c=>!!c),issueData:{code:K.invalid_return_type,returnTypeError:l}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Lr){let s=this;return ct(/*#__PURE__*/_asyncToGenerator(function*(...l){let c=new yt([]),g=yield s._def.args.parseAsync(l,i).catch(h=>{throw c.addIssue(n(l,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 ct(function(...l){let c=s._def.args.safeParse(l,i);if(!c.success)throw new yt([n(l,c.error)]);let g=Reflect.apply(a,this,c.data),v=s._def.returns.safeParse(g,i);if(!v.success)throw new yt([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:Xt.create(t).rest(hr.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||Xt.create([]).rest(hr.create()),returns:r||hr.create(),typeName:de.ZodFunction,...ye(n)})}},An=class extends be{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})}};An.create=(e,t)=>new An({getter:e,typeName:de.ZodLazy,...ye(t)});var xn=class extends be{_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}),le}return{status:"valid",value:t.data}}get value(){return this._def.value}};xn.create=(e,t)=>new xn({value:e,typeName:de.ZodLiteral,...ye(t)});function hv(e,t){return new Cn({values:e,typeName:de.ZodEnum,...ye(t)})}var Cn=class e extends be{_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}),le}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}),le}return ct(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})}};Cn.create=hv;var En=class extends be{_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}),le}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}),le}return ct(t.data)}get enum(){return this._def.values}};En.create=(e,t)=>new En({values:e,typeName:de.ZodNativeEnum,...ye(t)});var Lr=class extends be{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}),le;let n=r.parsedType===re.promise?r.data:Promise.resolve(r.data);return ct(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Lr.create=(e,t)=>new Lr({type:e,typeName:de.ZodPromise,...ye(t)});var Pt=class extends be{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===de.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 le;let l=yield _this12._def.schema._parseAsync({data:s,path:n.path,parent:n});return l.status==="aborted"?le:l.status==="dirty"?fn(l.value):r.value==="dirty"?fn(l.value):l});return function(_x87){return _ref41.apply(this,arguments)}}());{if(r.value==="aborted")return le;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?le:s.status==="dirty"?fn(s.value):r.value==="dirty"?fn(s.value):s}}if(o.type==="refinement"){let a=s=>{let l=o.refinement(s,i);if(n.common.async)return Promise.resolve(l);if(l 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"?le:(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"?le:(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(!Mr(a))return le;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=>Mr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):le);Ce.assertNever(o)}};Pt.create=(e,t,r)=>new Pt({schema:e,typeName:de.ZodEffects,effect:t,...ye(r)});Pt.createWithPreprocess=(e,t,r)=>new Pt({schema:t,effect:{type:"preprocess",transform:e},typeName:de.ZodEffects,...ye(r)});var kt=class extends be{_parse(t){return this._getType(t)===re.undefined?ct(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};kt.create=(e,t)=>new kt({innerType:e,typeName:de.ZodOptional,...ye(t)});var Zt=class extends be{_parse(t){return this._getType(t)===re.null?ct(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Zt.create=(e,t)=>new Zt({innerType:e,typeName:de.ZodNullable,...ye(t)});var Rn=class extends be{_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}};Rn.create=(e,t)=>new Rn({innerType:e,typeName:de.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ye(t)});var In=class extends be{_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 To(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new yt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new yt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};In.create=(e,t)=>new In({innerType:e,typeName:de.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ye(t)});var Fo=class extends be{_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}),le}return{status:"valid",value:t.data}}};Fo.create=e=>new Fo({typeName:de.ZodNaN,...ye(e)});var LT=Symbol("zod_brand"),ta=class extends be{_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}},ra=class e extends be{_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"?le:i.status==="dirty"?(r.dirty(),fn(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"?le: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:de.ZodPipeline})}},Tn=class extends be{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Mr(o)&&(o.value=Object.freeze(o.value)),o);return To(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Tn.create=(e,t)=>new Tn({innerType:e,typeName:de.ZodReadonly,...ye(t)});function pv(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function yv(e,t={},r){return e?jr.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=pv(t,n),l=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:l})}});if(!i){let a=pv(t,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):jr.create()}var UT={object:vt.lazycreate},de;(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"})(de||(de={}));var VT=(e,t={message:`Input not instance of ${e.name}`})=>yv(r=>r instanceof e,t),vv=qr.create,Sv=mn.create,BT=Fo.create,GT=gn.create,bv=hn.create,$T=yn.create,QT=ko.create,HT=vn.create,zT=Sn.create,WT=jr.create,KT=hr.create,YT=Lt.create,XT=Oo.create,ZT=yr.create,JT=vt.create,e_=vt.strictCreate,t_=bn.create,r_=uc.create,n_=wn.create,o_=Xt.create,i_=lc.create,a_=Po.create,s_=No.create,c_=dc.create,u_=An.create,l_=xn.create,d_=Cn.create,p_=En.create,f_=Lr.create,m_=Pt.create,g_=kt.create,h_=Zt.create,y_=Pt.createWithPreprocess,v_=ra.create,S_=()=>vv().optional(),b_=()=>Sv().optional(),w_=()=>bv().optional(),A_={string:e=>qr.create({...e,coerce:!0}),number:e=>mn.create({...e,coerce:!0}),boolean:e=>hn.create({...e,coerce:!0}),bigint:e=>gn.create({...e,coerce:!0}),date:e=>yn.create({...e,coerce:!0})};var x_=le;var C_=A.object({name:A.string(),arguments:A.string()}),E_=A.object({id:A.string(),type:A.literal("function"),function:C_,encryptedValue:A.string().optional()}),pc=A.object({id:A.string(),role:A.string(),content:A.string().optional(),name:A.string().optional(),encryptedValue:A.string().optional()}),R_=A.object({type:A.literal("text"),text:A.string()}),I_=A.object({type:A.literal("data"),value:A.string(),mimeType:A.string()}),T_=A.object({type:A.literal("url"),value:A.string(),mimeType:A.string().optional()}),fc=A.discriminatedUnion("type",[I_,T_]),__=A.object({type:A.literal("image"),source:fc,metadata:A.unknown().optional()}),k_=A.object({type:A.literal("audio"),source:fc,metadata:A.unknown().optional()}),O_=A.object({type:A.literal("video"),source:fc,metadata:A.unknown().optional()}),P_=A.object({type:A.literal("document"),source:fc,metadata:A.unknown().optional()});var wv=A.object({type:A.literal("binary"),mimeType:A.string(),id:A.string().optional(),url:A.string().optional(),data:A.string().optional(),filename:A.string().optional()}),Av=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:A.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},D6=wv.superRefine((e,t)=>{Av(e,t)}),N_=A.discriminatedUnion("type",[R_,__,k_,O_,P_,wv]),F_=N_.superRefine((e,t)=>{e.type==="binary"&&Av(e,t)}),D_=pc.extend({role:A.literal("developer"),content:A.string()}),M_=pc.extend({role:A.literal("system"),content:A.string()}),q_=pc.extend({role:A.literal("assistant"),content:A.string().optional(),toolCalls:A.array(E_).optional()}),j_=pc.extend({role:A.literal("user"),content:A.union([A.string(),A.array(F_)])}),L_=A.object({id:A.string(),content:A.string(),role:A.literal("tool"),toolCallId:A.string(),error:A.string().optional(),encryptedValue:A.string().optional()}),U_=A.object({id:A.string(),role:A.literal("activity"),activityType:A.string(),content:A.record(A.any())}),V_=A.object({id:A.string(),role:A.literal("reasoning"),content:A.string(),encryptedValue:A.string().optional()}),xv=A.discriminatedUnion("role",[D_,M_,q_,j_,L_,U_,V_]),M6=A.union([A.literal("developer"),A.literal("system"),A.literal("assistant"),A.literal("user"),A.literal("tool"),A.literal("activity"),A.literal("reasoning")]),B_=A.object({description:A.string(),value:A.string()}),Cv=A.object({name:A.string(),description:A.string(),parameters:A.any(),metadata:A.record(A.any()).optional()}),G_=A.object({threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),state:A.any(),messages:A.array(xv),tools:A.array(Cv),context:A.array(B_),forwardedProps:A.any()}),$_=A.any(),Ue=class extends Error{constructor(e){super(e)}},Ep=class extends Ue{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},Q_=A.object({name:A.string(),description:A.string().optional()}),H_=A.object({name:A.string().optional(),type:A.string().optional(),description:A.string().optional(),version:A.string().optional(),provider:A.string().optional(),documentationUrl:A.string().optional(),metadata:A.record(A.unknown()).optional()}),z_=A.object({streaming:A.boolean().optional(),websocket:A.boolean().optional(),httpBinary:A.boolean().optional(),pushNotifications:A.boolean().optional(),resumable:A.boolean().optional()}),W_=A.object({supported:A.boolean().optional(),items:A.array(Cv).optional(),parallelCalls:A.boolean().optional(),clientProvided:A.boolean().optional()}),K_=A.object({structuredOutput:A.boolean().optional(),supportedMimeTypes:A.array(A.string()).optional()}),Y_=A.object({snapshots:A.boolean().optional(),deltas:A.boolean().optional(),memory:A.boolean().optional(),persistentState:A.boolean().optional()}),X_=A.object({supported:A.boolean().optional(),delegation:A.boolean().optional(),handoffs:A.boolean().optional(),subAgents:A.array(Q_).optional()}),Z_=A.object({supported:A.boolean().optional(),streaming:A.boolean().optional(),encrypted:A.boolean().optional()}),J_=A.object({image:A.boolean().optional(),audio:A.boolean().optional(),video:A.boolean().optional(),pdf:A.boolean().optional(),file:A.boolean().optional()}),e0=A.object({image:A.boolean().optional(),audio:A.boolean().optional()}),t0=A.object({input:J_.optional(),output:e0.optional()}),r0=A.object({codeExecution:A.boolean().optional(),sandboxed:A.boolean().optional(),maxIterations:A.number().optional(),maxExecutionTime:A.number().optional()}),n0=A.object({supported:A.boolean().optional(),approvals:A.boolean().optional(),interventions:A.boolean().optional(),feedback:A.boolean().optional()}),q6=A.object({identity:H_.optional(),transport:z_.optional(),tools:W_.optional(),output:K_.optional(),state:Y_.optional(),multiAgent:X_.optional(),reasoning:Z_.optional(),multimodal:t0.optional(),execution:r0.optional(),humanInTheLoop:n0.optional(),custom:A.record(A.unknown()).optional()}),Ev=A.union([A.literal("developer"),A.literal("system"),A.literal("assistant"),A.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}({}),Ie=A.object({type:A.nativeEnum(M),timestamp:A.number().optional(),rawEvent:A.any().optional()}).passthrough(),o0=Ie.extend({type:A.literal(M.TEXT_MESSAGE_START),messageId:A.string(),role:Ev.default("assistant"),name:A.string().optional()}),Rv=Ie.extend({type:A.literal(M.TEXT_MESSAGE_CONTENT),messageId:A.string(),delta:A.string()}),i0=Ie.extend({type:A.literal(M.TEXT_MESSAGE_END),messageId:A.string()}),a0=Ie.extend({type:A.literal(M.TEXT_MESSAGE_CHUNK),messageId:A.string().optional(),role:Ev.optional(),delta:A.string().optional(),name:A.string().optional()}),s0=Ie.extend({type:A.literal(M.THINKING_TEXT_MESSAGE_START)}),c0=Rv.omit({messageId:!0,type:!0}).extend({type:A.literal(M.THINKING_TEXT_MESSAGE_CONTENT)}),u0=Ie.extend({type:A.literal(M.THINKING_TEXT_MESSAGE_END)}),l0=Ie.extend({type:A.literal(M.TOOL_CALL_START),toolCallId:A.string(),toolCallName:A.string(),parentMessageId:A.string().optional()}),d0=Ie.extend({type:A.literal(M.TOOL_CALL_ARGS),toolCallId:A.string(),delta:A.string()}),p0=Ie.extend({type:A.literal(M.TOOL_CALL_END),toolCallId:A.string()}),f0=Ie.extend({messageId:A.string(),type:A.literal(M.TOOL_CALL_RESULT),toolCallId:A.string(),content:A.string(),role:A.literal("tool").optional()}),m0=Ie.extend({type:A.literal(M.TOOL_CALL_CHUNK),toolCallId:A.string().optional(),toolCallName:A.string().optional(),parentMessageId:A.string().optional(),delta:A.string().optional()}),g0=Ie.extend({type:A.literal(M.THINKING_START),title:A.string().optional()}),h0=Ie.extend({type:A.literal(M.THINKING_END)}),y0=Ie.extend({type:A.literal(M.STATE_SNAPSHOT),snapshot:$_}),v0=Ie.extend({type:A.literal(M.STATE_DELTA),delta:A.array(A.any())}),S0=Ie.extend({type:A.literal(M.MESSAGES_SNAPSHOT),messages:A.array(xv)}),b0=Ie.extend({type:A.literal(M.ACTIVITY_SNAPSHOT),messageId:A.string(),activityType:A.string(),content:A.record(A.any()),replace:A.boolean().optional().default(!0)}),w0=Ie.extend({type:A.literal(M.ACTIVITY_DELTA),messageId:A.string(),activityType:A.string(),patch:A.array(A.any())}),A0=Ie.extend({type:A.literal(M.RAW),event:A.any(),source:A.string().optional()}),x0=Ie.extend({type:A.literal(M.CUSTOM),name:A.string(),value:A.any()}),C0=Ie.extend({type:A.literal(M.RUN_STARTED),threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),input:G_.optional()}),E0=Ie.extend({type:A.literal(M.RUN_FINISHED),threadId:A.string(),runId:A.string(),result:A.any().optional()}),R0=Ie.extend({type:A.literal(M.RUN_ERROR),message:A.string(),code:A.string().optional()}),I0=Ie.extend({type:A.literal(M.STEP_STARTED),stepName:A.string()}),T0=Ie.extend({type:A.literal(M.STEP_FINISHED),stepName:A.string()}),_0=A.union([A.literal("tool-call"),A.literal("message")]),k0=Ie.extend({type:A.literal(M.REASONING_START),messageId:A.string()}),O0=Ie.extend({type:A.literal(M.REASONING_MESSAGE_START),messageId:A.string(),role:A.literal("reasoning")}),P0=Ie.extend({type:A.literal(M.REASONING_MESSAGE_CONTENT),messageId:A.string(),delta:A.string()}),N0=Ie.extend({type:A.literal(M.REASONING_MESSAGE_END),messageId:A.string()}),F0=Ie.extend({type:A.literal(M.REASONING_MESSAGE_CHUNK),messageId:A.string().optional(),delta:A.string().optional()}),D0=Ie.extend({type:A.literal(M.REASONING_END),messageId:A.string()}),M0=Ie.extend({type:A.literal(M.REASONING_ENCRYPTED_VALUE),subtype:_0,entityId:A.string(),encryptedValue:A.string()}),mc=A.discriminatedUnion("type",[o0,Rv,i0,a0,g0,h0,s0,c0,u0,l0,d0,p0,m0,f0,y0,v0,S0,b0,w0,A0,x0,C0,E0,R0,I0,T0,k0,O0,P0,N0,F0,D0,M0]);m();d();f();p();var Rp={};ei(Rp,{JsonPatchError:()=>Ge,_areEquals:()=>ia,applyOperation:()=>_n,applyPatch:()=>wc,applyReducer:()=>V0,deepClone:()=>L0,getValueByPointer:()=>Sc,validate:()=>Tv,validator:()=>bc});m();d();f();p();m();d();f();p();var q0=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)}}(),j0=Object.prototype.hasOwnProperty;function hc(e,t){return j0.call(e,t)}function yc(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)hc(e,o)&&n.push(o);return n}function at(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function vc(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 Jt(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function na(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function gc(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(gc(e[t]))return!0}else if(typeof e=="object"){for(var n=yc(e),o=n.length,i=0;i<o;i++)if(gc(e[n[i]]))return!0}}return!1}function Iv(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 oa=function(e){q0(t,e);function t(r,n,o,i,a){var s=this.constructor,l=e.call(this,Iv(r,{name:n,index:o,operation:i,tree:a}))||this;return l.name=n,l.index=o,l.operation=i,l.tree=a,Object.setPrototypeOf(l,s.prototype),l.message=Iv(r,{name:n,index:o,operation:i,tree:a}),l}return t}(Error);var Ge=oa,L0=at,Do={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=Sc(r,this.path);n&&(n=at(n));var o=_n(r,{op:"remove",path:this.from}).removed;return _n(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Sc(r,this.from);return _n(r,{op:"add",path:this.path,value:at(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:ia(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},U0={add:function(e,t,r){return vc(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:Do.move,copy:Do.copy,test:Do.test,_get:Do._get};function Sc(e,t){if(t=="")return e;var r={op:"_get",path:t};return _n(e,r),r.value}function _n(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):bc(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=Sc(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=ia(e,t.value),a.test===!1)throw new Ge("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 Ge("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{n||(e=at(e));var s=t.path||"",l=s.split("/"),c=e,g=1,v=l.length,E=void 0,h=void 0,y=void 0;for(typeof r=="function"?y=r:y=bc;;){if(h=l[g],h&&h.indexOf("~")!=-1&&(h=na(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&l[g-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&E===void 0&&(c[h]===void 0?E=l.slice(0,g).join("/"):g==v-1&&(E=t.path),E!==void 0&&y(t,0,e,E)),g++,Array.isArray(c)){if(h==="-")h=c.length;else{if(r&&!vc(h))throw new Ge("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);vc(h)&&(h=~~h)}if(g>=v){if(r&&t.op==="add"&&h>c.length)throw new Ge("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=U0[t.op].call(t,c,h,e);if(a.test===!1)throw new Ge("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(g>=v){var a=Do[t.op].call(t,c,h,e);if(a.test===!1)throw new Ge("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(c=c[h],r&&g<v&&(!c||typeof c!="object"))throw new Ge("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function wc(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new Ge("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=at(e));for(var i=new Array(t.length),a=0,s=t.length;a<s;a++)i[a]=_n(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function V0(e,t,r){var n=_n(e,t);if(n.test===!1)throw new Ge("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function bc(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Ge("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Do[e.op]){if(typeof e.path!="string")throw new Ge("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Ge("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 Ge("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 Ge("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")&&gc(e.value))throw new Ge("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 Ge("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 Ge("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=Tv([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new Ge("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Ge("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function Tv(e,t,r){try{if(!Array.isArray(e))throw new Ge("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)wc(at(t),at(e),r||!0);else{r=r||bc;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof Ge)return o;throw o}}function ia(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(!ia(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],!ia(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var kp={};ei(kp,{compare:()=>K0,generate:()=>Ip,observe:()=>W0,unobserve:()=>z0});m();d();f();p();var Tp=new WeakMap,B0=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),G0=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function $0(e){return Tp.get(e)}function Q0(e,t){return e.observers.get(t)}function H0(e,t){e.observers.delete(t.callback)}function z0(e,t){t.unobserve()}function W0(e,t){var r=[],n,o=$0(e);if(!o)o=new B0(e),Tp.set(e,o);else{var i=Q0(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=at(e),t){n.callback=t,n.next=null;var a=function(){Ip(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(){Ip(n),clearTimeout(n.next),H0(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 G0(t,n)),n}function Ip(e,t){t===void 0&&(t=!1);var r=Tp.get(e.object);_p(r.value,e.object,e.patches,"",t),e.patches.length&&wc(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function _p(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=yc(t),a=yc(e),s=!1,l=!1,c=a.length-1;c>=0;c--){var g=a[c],v=e[g];if(hc(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var E=t[g];typeof v=="object"&&v!=null&&typeof E=="object"&&E!=null&&Array.isArray(v)===Array.isArray(E)?_p(v,E,r,n+"/"+Jt(g),o):v!==E&&(s=!0,o&&r.push({op:"test",path:n+"/"+Jt(g),value:at(v)}),r.push({op:"replace",path:n+"/"+Jt(g),value:at(E)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+Jt(g),value:at(v)}),r.push({op:"remove",path:n+"/"+Jt(g)}),l=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),s=!0)}if(!(!l&&i.length==a.length))for(var c=0;c<i.length;c++){var g=i[c];!hc(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+Jt(g),value:at(t[g])})}}}function K0(e,t,r){r===void 0&&(r=!1);var n=[];return _p(e,t,n,"",r),n}var Ac=Object.assign({},Rp,kp,{JsonPatchError:oa,deepClone:at,escapePathComponent:Jt,unescapePathComponent:na});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Op=function(e,t){return Op=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])},Op(e,t)};function er(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Op(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function _v(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 l(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,l)}c((n=n.apply(e,t||[])).next())})}function xc(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 l([c,g])}}function l(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 vr(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 Mo(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 qo(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 kn(e){return this instanceof kn?(this.v=e,this):new kn(e)}function kv(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(S){return new Promise(function(C,R){i.push([h,S,C,R])>1||l(h,S)})},y&&(o[h]=y(o[h])))}function l(h,y){try{c(n[h](y))}catch(S){E(i[0][3],S)}}function c(h){h.value instanceof kn?Promise.resolve(h.value.v).then(g,v):E(i[0][2],h)}function g(h){l("next",h)}function v(h){l("throw",h)}function E(h,y){h(y),i.shift(),i.length&&l(i[0][0],i[0][1])}}function Ov(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 vr=="function"?vr(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,l){a=e[i](a),o(s,l,a.done,a.value)})}}function o(i,a,s,l){Promise.resolve(l).then(function(c){i({value:c,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 jo(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 Cc=jo(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 aa(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Lo=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=vr(a),l=s.next();!l.done;l=s.next()){var c=l.value;c.remove(this)}}catch(S){t={error:S}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}else a.remove(this);var g=this.initialTeardown;if(xe(g))try{g()}catch(S){i=S instanceof Cc?S.errors:[S]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var E=vr(v),h=E.next();!h.done;h=E.next()){var y=h.value;try{Pv(y)}catch(S){i=i??[],S instanceof Cc?i=jo(jo([],Mo(i)),Mo(S.errors)):i.push(S)}}}catch(S){n={error:S}}finally{try{h&&!h.done&&(o=E.return)&&o.call(E)}finally{if(n)throw n.error}}}if(i)throw new Cc(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Pv(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)&&aa(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&aa(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Pp=Lo.EMPTY;function Ec(e){return e instanceof Lo||e&&"closed"in e&&xe(e.remove)&&xe(e.add)&&xe(e.unsubscribe)}function Pv(e){xe(e)?e():e.unsubscribe()}m();d();f();p();var Ut={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var Uo={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Uo.delegate;return o?.setTimeout?o.setTimeout.apply(o,jo([e,t],Mo(r))):setTimeout.apply(void 0,jo([e,t],Mo(r)))},clearTimeout:function(e){var t=Uo.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Rc(e){Uo.setTimeout(function(){var t=Ut.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function sa(){}m();d();f();p();var Nv=function(){return Np("C",void 0,void 0)}();function Fv(e){return Np("E",void 0,e)}function Dv(e){return Np("N",e,void 0)}function Np(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var On=null;function Vo(e){if(Ut.useDeprecatedSynchronousErrorHandling){var t=!On;if(t&&(On={errorThrown:!1,error:null}),e(),t){var r=On,n=r.errorThrown,o=r.error;if(On=null,n)throw o}}else e()}function Mv(e){Ut.useDeprecatedSynchronousErrorHandling&&On&&(On.errorThrown=!0,On.error=e)}var ca=function(e){er(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Ec(r)&&r.add(n)):n.destination=J0,n}return t.create=function(r,n,o){return new Tc(r,n,o)},t.prototype.next=function(r){this.isStopped?Dp(Dv(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Dp(Fv(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Dp(Nv,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}(Lo);var Y0=Function.prototype.bind;function Fp(e,t){return Y0.call(e,t)}var X0=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){Ic(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Ic(n)}else Ic(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Ic(r)}},e}(),Tc=function(e){er(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&&Ut.useDeprecatedNextContext?(s=Object.create(r),s.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&Fp(r.next,s),error:r.error&&Fp(r.error,s),complete:r.complete&&Fp(r.complete,s)}):a=r}return i.destination=new X0(a),i}return t}(ca);function Ic(e){Ut.useDeprecatedSynchronousErrorHandling?Mv(e):Rc(e)}function Z0(e){throw e}function Dp(e,t){var r=Ut.onStoppedNotification;r&&Uo.setTimeout(function(){return r(e,t)})}var J0={closed:!0,next:sa,error:Z0,complete:sa};m();d();f();p();var Bo=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function Go(e){return e}function _c(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Mp(e)}function Mp(e){return e.length===0?Go:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var je=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=tk(t)?t:new Tc(t,r,n);return Vo(function(){var a=o,s=a.operator,l=a.source;i.add(s?s.call(i,l):l?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=jv(r),new r(function(o,i){var a=new Tc({next:function(s){try{t(s)}catch(l){i(l),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[Bo]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Mp(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=jv(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 jv(e){var t;return(t=e??Ut.Promise)!==null&&t!==void 0?t:Promise}function ek(e){return e&&xe(e.next)&&xe(e.error)&&xe(e.complete)}function tk(e){return e&&e instanceof ca||ek(e)&&Ec(e)}m();d();f();p();function rk(e){return xe(e?.lift)}function Qe(e){return function(t){if(rk(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 nk(e,t,r,n,o)}var nk=function(e){er(t,e);function t(r,n,o,i,a,s){var l=e.call(this,r)||this;return l.onFinalize=a,l.shouldUnsubscribe=s,l._next=n?function(c){try{n(c)}catch(g){r.error(g)}}:e.prototype._next,l._error=i?function(c){try{i(c)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,l._complete=o?function(){try{o()}catch(c){r.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,l}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}(ca);m();d();f();p();m();d();f();p();var qv=qo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var tr=function(e){er(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new Lv(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new qv},t.prototype.next=function(r){var n=this;Vo(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=vr(n.currentObservers),s=a.next();!s.done;s=a.next()){var l=s.value;l.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;Vo(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;Vo(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?Pp:(this.currentObservers=null,s.push(r),new Lo(function(){n.currentObservers=null,aa(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 je;return r.source=this,r},t.create=function(r,n){return new Lv(r,n)},t}(je);var Lv=function(e){er(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:Pp},t}(tr);m();d();f();p();m();d();f();p();var jp={now:function(){return(jp.delegate||Date).now()},delegate:void 0};var kc=function(e){er(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=jp);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,l=n._windowTime;o||(i.push(r),!a&&i.push(s.now()+l)),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(),l=0;l<s.length&&!r.closed;l+=i?1:2)r.next(s[l]);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 l=o.now(),c=0,g=1;g<i.length&&i[g]<=l;g+=2)c=g;c&&i.splice(0,c+1)}},t}(tr);m();d();f();p();var Oc=new je(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function Uv(e){return e&&xe(e.schedule)}function ok(e){return e[e.length-1]}function Vv(e){return Uv(ok(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 Pc=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function Nc(e){return xe(e?.then)}m();d();f();p();function Fc(e){return xe(e[Bo])}m();d();f();p();function Dc(e){return Symbol.asyncIterator&&xe(e?.[Symbol.asyncIterator])}m();d();f();p();function Mc(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 ik(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var jc=ik();function qc(e){return xe(e?.[jc])}m();d();f();p();function Lc(e){return kv(this,arguments,function(){var r,n,o,i;return xc(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,kn(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,kn(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,kn(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 Uc(e){return xe(e?.getReader)}function Ke(e){if(e instanceof je)return e;if(e!=null){if(Fc(e))return ak(e);if(Pc(e))return sk(e);if(Nc(e))return ck(e);if(Dc(e))return Bv(e);if(qc(e))return uk(e);if(Uc(e))return lk(e)}throw Mc(e)}function ak(e){return new je(function(t){var r=e[Bo]();if(xe(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function sk(e){return new je(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function ck(e){return new je(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Rc)})}function uk(e){return new je(function(t){var r,n;try{for(var o=vr(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 Bv(e){return new je(function(t){dk(e,t).catch(function(r){return t.error(r)})})}function lk(e){return Bv(Lc(e))}function dk(e,t){var r,n,o,i;return _v(this,void 0,void 0,function(){var a,s;return xc(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),r=Ov(e),l.label=1;case 1:return[4,r.next()];case 2:if(n=l.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),t.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=l.sent(),o={error:s},[3,11];case 6:return l.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:l.sent(),l.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 Nt(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!o)return i}function Vc(e,t){return t===void 0&&(t=0),Qe(function(r,n){r.subscribe(We(n,function(o){return Nt(n,e,function(){return n.next(o)},t)},function(){return Nt(n,e,function(){return n.complete()},t)},function(o){return Nt(n,e,function(){return n.error(o)},t)}))})}m();d();f();p();function Bc(e,t){return t===void 0&&(t=0),Qe(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function Gv(e,t){return Ke(e).pipe(Bc(t),Vc(t))}m();d();f();p();function $v(e,t){return Ke(e).pipe(Bc(t),Vc(t))}m();d();f();p();function Qv(e,t){return new je(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 Hv(e,t){return new je(function(r){var n;return Nt(r,t,function(){n=e[jc](),Nt(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 Gc(e,t){if(!e)throw new Error("Iterable cannot be null");return new je(function(r){Nt(r,t,function(){var n=e[Symbol.asyncIterator]();Nt(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}m();d();f();p();function zv(e,t){return Gc(Lc(e),t)}function Wv(e,t){if(e!=null){if(Fc(e))return Gv(e,t);if(Pc(e))return Qv(e,t);if(Nc(e))return $v(e,t);if(Dc(e))return Gc(e,t);if(qc(e))return Hv(e,t);if(Uc(e))return zv(e,t)}throw Mc(e)}function Pn(e,t){return t?Wv(e,t):Ke(e)}function Ve(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Vv(e);return Pn(e,r)}m();d();f();p();function qe(e,t){var r=xe(e)?e:function(){return e},n=function(o){return o.error(r())};return new je(t?function(o){return t.schedule(n,0,o)}:n)}m();d();f();p();m();d();f();p();var Kv=qo(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function $c(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 Kv)}})})}m();d();f();p();function Nn(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 Yv(e,t,r,n,o,i,a,s){var l=[],c=0,g=0,v=!1,E=function(){v&&!l.length&&!c&&t.complete()},h=function(S){return c<n?y(S):l.push(S)},y=function(S){i&&t.next(S),c++;var C=!1;Ke(r(S,g++)).subscribe(We(t,function(R){o?.(R),i?h(R):t.next(R)},function(){C=!0},void 0,function(){if(C)try{c--;for(var R=function(){var T=l.shift();a?Nt(t,a,function(){return y(T)}):y(T)};l.length&&c<n;)R();E()}catch(T){t.error(T)}}))};return e.subscribe(We(t,h,function(){v=!0,E()})),function(){s?.()}}function St(e,t,r){return r===void 0&&(r=1/0),xe(t)?St(function(n,o){return Nn(function(i,a){return t(n,i,o,a)})(Ke(e(n,o)))},r):(typeof t=="number"&&(r=t),Qe(function(n,o){return Yv(n,o,e,r)}))}function qp(e){return e===void 0&&(e=1/0),St(Go,e)}m();d();f();p();function Qc(e){return new je(function(t){Ke(e()).subscribe(t)})}m();d();f();p();function ua(e){return Qe(function(t,r){var n=null,o=!1,i;n=t.subscribe(We(r,void 0,void 0,function(a){i=Ke(e(a,ua(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 Hc(e,t){return xe(t)?St(e,t,1):St(e,1)}m();d();f();p();function Lp(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 Fn(e){return Qe(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function Up(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(l){o?.unsubscribe();var c=0,g=i++;Ke(e(l,g)).subscribe(o=We(n,function(v){return n.next(t?t(l,v,g,c++):v)},function(){o=null,s()}))},function(){a=!0,s()}))})}m();d();f();p();function zc(e){return Qe(function(t,r){Ke(e).subscribe(We(r,function(){return r.complete()},sa)),!r.closed&&t.subscribe(r)})}m();d();f();p();function Vp(e,t,r){var n=xe(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(l){var c;(c=n.next)===null||c===void 0||c.call(n,l),i.next(l)},function(){var l;s=!1,(l=n.complete)===null||l===void 0||l.call(n),i.complete()},function(l){var c;s=!1,(c=n.error)===null||c===void 0||c.call(n,l),i.error(l)},function(){var l,c;s&&((l=n.unsubscribe)===null||l===void 0||l.call(n)),(c=n.finalize)===null||c===void 0||c.call(n)}))}):Go}m();d();f();p();m();d();f();p();function Xv(e){return` \r
|
|
36
|
-
`.indexOf(e)>=0}function Wc(e){for(var t=["topLevel"],r=0,n,o,i,a=function(T){return t.push(T)},s=function(T){return t[t.length-1]=T},l=function(T){n==null&&(n=r,o=t.length,i=T)},c=function(T){T===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},E=function(T){if("0"<=T&&T<="9"){a("number");return}switch(T){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":E(y);break;case"string":switch(y){case"\"":g();break;case"\\":l("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():Xv(y)||(c("collectionItem"),s("arrayNeedsComma"),E(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(l("collectionItem"),s("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(l("collectionItem"),s("objectNeedsColon"),a("string"));break;case"objectNeedsColon":y===":"&&s("objectNeedsValue");break;case"objectNeedsValue":Xv(y)||(c("collectionItem"),s("objectNeedsComma"),E(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(l("collectionItem"),s("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var S=[n!=null?e.slice(0,n):e],C=function(T){return S.push(T.slice(e.length-e.lastIndexOf(T[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":C("true");break;case"false":C("false");break;case"null":C("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 Jv(){let e=0,t=0;for(let n=0;n<28;n+=7){let o=this.buf[this.pos++];if(e|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}let r=this.buf[this.pos++];if(e|=(r&15)<<28,t=(r&112)>>4,(r&128)==0)return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let o=this.buf[this.pos++];if(t|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function Yc(e,t,r){for(let i=0;i<28;i=i+7){let a=e>>>i,s=!(!(a>>>7)&&t==0),l=(s?a|128:a)&255;if(r.push(l),!s)return}let n=e>>>28&15|(t&7)<<4,o=t>>3!=0;if(r.push((o?n|128:n)&255),!!o){for(let i=3;i<31;i=i+7){let a=t>>>i,s=!!(a>>>7),l=(s?a|128:a)&255;if(r.push(l),!s)return}r.push(t>>>31&1)}}var Kc=4294967296;function Bp(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(a,s){let l=Number(e.slice(a,s));o*=r,n=n*r+l,n>=Kc&&(o=o+(n/Kc|0),n=n%Kc)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?tS(n,o):$p(n,o)}function eS(e,t){let r=$p(e,t),n=r.hi&2147483648;n&&(r=tS(r.lo,r.hi));let o=Gp(r.lo,r.hi);return n?"-"+o:o}function Gp(e,t){if({lo:e,hi:t}=pk(e,t),t<=2097151)return String(Kc*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,l=1e7;return i>=l&&(a+=Math.floor(i/l),i%=l),a>=l&&(s+=Math.floor(a/l),a%=l),s.toString()+Zv(a)+Zv(i)}function pk(e,t){return{lo:e>>>0,hi:t>>>0}}function $p(e,t){return{lo:e|0,hi:t|0}}function tS(e,t){return t=~t,e?e=~e+1:t+=1,$p(e,t)}var Zv=e=>{let t=String(e);return"0000000".slice(t.length)+t};function Qp(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let r=0;r<9;r++)t.push(e&127|128),e=e>>7;t.push(1)}}function rS(){let e=this.buf[this.pos++],t=e&127;if((e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)==0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!=0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();f();p();var Vt=fk();function fk(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!b.Deno||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()),nS(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),oS(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),nS(r),Bp(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),oS(r),Bp(r)},dec(r,n){return eS(r,n)},uDec(r,n){return Gp(r,n)}}}function nS(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function oS(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var Hp=Symbol.for("@bufbuild/protobuf/text-encoding");function zp(){if(b[Hp]==null){let e=new b.TextEncoder,t=new b.TextDecoder,r;b[Hp]={encodeUtf8(n){return e.encode(n)},decodeUtf8(n,o){return o?(r===void 0&&(r=new b.TextDecoder("utf-8",{fatal:!0})),r.decode(n)):t.decode(n)},checkUtf8(n){try{return encodeURIComponent(n),!0}catch{return!1}}}}return b[Hp]}var Ur;(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"})(Ur||(Ur={}));var mk=34028234663852886e22,gk=-34028234663852886e22,hk=4294967295,yk=2147483647,vk=-2147483648,we=class{constructor(t=zp().encodeUtf8){this.encodeUtf8=t,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let t=0;for(let o=0;o<this.chunks.length;o++)t+=this.chunks[o].length;let r=new Uint8Array(t),n=0;for(let o=0;o<this.chunks.length;o++)r.set(this.chunks[o],n),n+=this.chunks[o].length;return this.chunks=[],r}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let t=this.finish(),r=this.stack.pop();if(!r)throw new Error("invalid state, fork stack empty");return this.chunks=r.chunks,this.buf=r.buf,this.uint32(t.byteLength),this.raw(t)}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(iS(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return Wp(t),Qp(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let r=this.encodeUtf8(t);return this.uint32(r.byteLength),this.raw(r)}float(t){Sk(t);let r=new Uint8Array(4);return new DataView(r.buffer).setFloat32(0,t,!0),this.raw(r)}double(t){let r=new Uint8Array(8);return new DataView(r.buffer).setFloat64(0,t,!0),this.raw(r)}fixed32(t){iS(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){Wp(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return Wp(t),t=(t<<1^t>>31)>>>0,Qp(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Vt.enc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}fixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Vt.uEnc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}int64(t){let r=Vt.enc(t);return Yc(r.lo,r.hi,this.buf),this}sint64(t){let r=Vt.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return Yc(o,i,this.buf),this}uint64(t){let r=Vt.uEnc(t);return Yc(r.lo,r.hi,this.buf),this}},J=class{constructor(t,r=zp().decodeUtf8){this.decodeUtf8=r,this.varint64=Jv,this.uint32=rS,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){let n=this.pos;switch(t){case Ur.Varint:for(;this.buf[this.pos++]&128;);break;case Ur.Bit64:this.pos+=4;case Ur.Bit32:this.pos+=4;break;case Ur.LengthDelimited:let o=this.uint32();this.pos+=o;break;case Ur.StartGroup:for(;;){let[i,a]=this.tag();if(a===Ur.EndGroup){if(r!==void 0&&i!==r)throw new Error("invalid end group tag");break}this.skip(a,i)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return Vt.dec(...this.varint64())}uint64(){return Vt.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Vt.dec(t,r)}bool(){let[t,r]=this.varint64();return t!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Vt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Vt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){return this.decodeUtf8(this.bytes(),t)}};function Wp(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>yk||e<vk)throw new Error("invalid int32: "+e)}function iS(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>hk||e<0)throw new Error("invalid uint32: "+e)}function Sk(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>mk||e<gk))throw new Error("invalid float32: "+e)}var bk=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Kp(){return{fields:{}}}var la={encode(e,t=new we){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&Zp.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=Kp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=Zp.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 la.fromPartial(e??{})},fromPartial(e){let t=Kp();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=Kp();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 aS(){return{key:"",value:void 0}}var Zp={encode(e,t=new we){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&pe.encode(pe.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=aS();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=pe.unwrap(pe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Zp.fromPartial(e??{})},fromPartial(e){let t=aS();return t.key=e.key??"",t.value=e.value??void 0,t}};function Yp(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var pe={encode(e,t=new we){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&&la.encode(la.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&da.encode(da.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=Yp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.nullValue=r.int32();continue;case 2:if(i!==17)break;o.numberValue=r.double();continue;case 3:if(i!==26)break;o.stringValue=r.string();continue;case 4:if(i!==32)break;o.boolValue=r.bool();continue;case 5:if(i!==42)break;o.structValue=la.unwrap(la.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=da.unwrap(da.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return pe.fromPartial(e??{})},fromPartial(e){let t=Yp();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=Yp();if(e===null)t.nullValue=bk.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(b.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new b.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function Xp(){return{values:[]}}var da={encode(e,t=new we){for(let r of e.values)pe.encode(pe.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=Xp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(pe.unwrap(pe.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return da.fromPartial(e??{})},fromPartial(e){let t=Xp();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=Xp();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&b.Array.isArray(e.values)?e.values:e}},wk=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 sS(){return{op:0,path:"",from:void 0,value:void 0}}var Zc={encode(e,t=new we){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&&pe.encode(pe.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=sS();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=pe.unwrap(pe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Zc.fromPartial(e??{})},fromPartial(e){let t=sS();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function cS(){return{id:"",type:"",function:void 0}}var Jc={encode(e,t=new we){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&eu.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=cS();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=eu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Jc.fromPartial(e??{})},fromPartial(e){let t=cS();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?eu.fromPartial(e.function):void 0,t}};function uS(){return{name:"",arguments:""}}var eu={encode(e,t=new we){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=uS();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 eu.fromPartial(e??{})},fromPartial(e){let t=uS();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function lS(){return{value:"",mimeType:""}}var tu={encode(e,t=new we){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=lS();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 tu.fromPartial(e??{})},fromPartial(e){let t=lS();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function dS(){return{value:"",mimeType:void 0}}var ru={encode(e,t=new we){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=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 ru.fromPartial(e??{})},fromPartial(e){let t=dS();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function pS(){return{data:void 0,url:void 0}}var xt={encode(e,t=new we){return e.data!==void 0&&tu.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&ru.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=pS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=tu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=ru.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xt.fromPartial(e??{})},fromPartial(e){let t=pS();return t.data=e.data!==void 0&&e.data!==null?tu.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?ru.fromPartial(e.url):void 0,t}};function fS(){return{text:""}}var nu={encode(e,t=new we){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=fS();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 nu.fromPartial(e??{})},fromPartial(e){let t=fS();return t.text=e.text??"",t}};function mS(){return{source:void 0,metadata:void 0}}var ou={encode(e,t=new we){return e.source!==void 0&&xt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&pe.encode(pe.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=mS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=xt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=pe.unwrap(pe.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=mS();return t.source=e.source!==void 0&&e.source!==null?xt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function gS(){return{source:void 0,metadata:void 0}}var iu={encode(e,t=new we){return e.source!==void 0&&xt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&pe.encode(pe.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=gS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=xt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=pe.unwrap(pe.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.source=e.source!==void 0&&e.source!==null?xt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function hS(){return{source:void 0,metadata:void 0}}var au={encode(e,t=new we){return e.source!==void 0&&xt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&pe.encode(pe.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=hS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=xt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=pe.unwrap(pe.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=hS();return t.source=e.source!==void 0&&e.source!==null?xt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function yS(){return{source:void 0,metadata:void 0}}var su={encode(e,t=new we){return e.source!==void 0&&xt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&pe.encode(pe.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=yS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=xt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=pe.unwrap(pe.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=yS();return t.source=e.source!==void 0&&e.source!==null?xt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function vS(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var cu={encode(e,t=new we){return e.text!==void 0&&nu.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&ou.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&iu.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&&su.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=vS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=nu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=ou.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=iu.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=su.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return cu.fromPartial(e??{})},fromPartial(e){let t=vS();return t.text=e.text!==void 0&&e.text!==null?nu.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?ou.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?iu.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?su.fromPartial(e.document):void 0,t}};function SS(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var uu={encode(e,t=new we){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)Jc.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)cu.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=SS();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(Jc.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(cu.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return uu.fromPartial(e??{})},fromPartial(e){let t=SS();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=>Jc.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>cu.fromPartial(r))||[],t}},Ak=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 bS(){return{type:0,timestamp:void 0,rawEvent:void 0}}var ue={encode(e,t=new we){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&pe.encode(pe.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=bS();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=xk(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=pe.unwrap(pe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ue.fromPartial(e??{})},fromPartial(e){let t=bS();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function wS(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var lu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=wS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 lu.fromPartial(e??{})},fromPartial(e){let t=wS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function AS(){return{baseEvent:void 0,messageId:"",delta:""}}var du={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=AS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 du.fromPartial(e??{})},fromPartial(e){let t=AS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function xS(){return{baseEvent:void 0,messageId:""}}var pu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=xS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 pu.fromPartial(e??{})},fromPartial(e){let t=xS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function CS(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var fu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=CS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 fu.fromPartial(e??{})},fromPartial(e){let t=CS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function ES(){return{baseEvent:void 0,toolCallId:"",delta:""}}var mu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=ES();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 mu.fromPartial(e??{})},fromPartial(e){let t=ES();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function RS(){return{baseEvent:void 0,toolCallId:""}}var gu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=RS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 gu.fromPartial(e??{})},fromPartial(e){let t=RS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function IS(){return{baseEvent:void 0,snapshot:void 0}}var hu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&pe.encode(pe.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=IS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=pe.unwrap(pe.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=IS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function TS(){return{baseEvent:void 0,delta:[]}}var yu={encode(e,t=new we){e.baseEvent!==void 0&&ue.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)Zc.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=TS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(Zc.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=TS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>Zc.fromPartial(r))||[],t}};function _S(){return{baseEvent:void 0,messages:[]}}var vu={encode(e,t=new we){e.baseEvent!==void 0&&ue.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)uu.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=_S();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(uu.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=_S();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>uu.fromPartial(r))||[],t}};function kS(){return{baseEvent:void 0,event:void 0,source:void 0}}var Su={encode(e,t=new we){return e.baseEvent!==void 0&&ue.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&pe.encode(pe.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=kS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=pe.unwrap(pe.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 Su.fromPartial(e??{})},fromPartial(e){let t=kS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function OS(){return{baseEvent:void 0,name:"",value:void 0}}var bu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&pe.encode(pe.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=OS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=pe.unwrap(pe.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=OS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function PS(){return{baseEvent:void 0,threadId:"",runId:""}}var wu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=PS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 wu.fromPartial(e??{})},fromPartial(e){let t=PS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function NS(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0}}var Au={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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&&pe.encode(pe.wrap(e.result),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=NS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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=pe.unwrap(pe.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=NS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t}};function FS(){return{baseEvent:void 0,code:void 0,message:""}}var xu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message),t},decode(e,t){let r=e instanceof 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!==10)break;o.baseEvent=ue.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.code=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xu.fromPartial(e??{})},fromPartial(e){let t=FS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function DS(){return{baseEvent:void 0,stepName:""}}var Cu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=DS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 Cu.fromPartial(e??{})},fromPartial(e){let t=DS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function MS(){return{baseEvent:void 0,stepName:""}}var Eu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=MS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Eu.fromPartial(e??{})},fromPartial(e){let t=MS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function jS(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var Ru={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=jS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 Ru.fromPartial(e??{})},fromPartial(e){let t=jS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.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 qS(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var Iu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=qS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 Iu.fromPartial(e??{})},fromPartial(e){let t=qS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function LS(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0}}var US={encode(e,t=new we){return e.textMessageStart!==void 0&&lu.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&du.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&pu.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&fu.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&mu.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&gu.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&hu.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&yu.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&vu.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Su.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&bu.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&wu.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Au.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&xu.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Cu.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Eu.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Ru.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Iu.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=LS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=lu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=du.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=pu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=fu.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=mu.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=gu.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=hu.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=yu.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=vu.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Su.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=bu.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=wu.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Au.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=xu.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Cu.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=Eu.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=Ru.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Iu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return US.fromPartial(e??{})},fromPartial(e){let t=LS();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?lu.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?du.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?pu.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?fu.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?mu.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?gu.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?hu.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?yu.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?vu.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Su.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?bu.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?wu.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Au.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?xu.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Cu.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Eu.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Ru.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Iu.fromPartial(e.toolCallChunk):void 0,t}};function xk(e){let t=b.Number(e.toString());if(t>b.Number.MAX_SAFE_INTEGER)throw new b.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<b.Number.MIN_SAFE_INTEGER)throw new b.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var Xc=e=>{if(!(!e||typeof e!="object")){if(e.data)return{type:"data",value:e.data.value,mimeType:e.data.mimeType};if(e.url)return{type:"url",value:e.url.value,mimeType:e.url.mimeType}}},Ck=e=>{if(!(!e||typeof e!="object")){if(e.text)return{type:"text",text:e.text.text};if(e.image)return{type:"image",source:Xc(e.image.source),metadata:e.image.metadata};if(e.audio)return{type:"audio",source:Xc(e.audio.source),metadata:e.audio.metadata};if(e.video)return{type:"video",source:Xc(e.video.source),metadata:e.video.metadata};if(e.document)return{type:"document",source:Xc(e.document.source),metadata:e.document.metadata}}};function VS(e){let t=US.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=Ak[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,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=>Ck(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.STATE_DELTA)for(let n of r.delta)n.op=wk[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]}),mc.parse(r)}var Jp="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var Rk=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,ef=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(Rk);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},BS=e=>e==="*"||e==="x"||e==="X",GS=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},Ik=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],Tk=(e,t)=>{if(BS(e)||BS(t))return 0;let[r,n]=Ik(GS(e),GS(t));return r>n?1:r<n?-1:0},tf=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=Tk(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var pa=(e,t)=>{let r=ef(e),n=ef(t),o=r.pop(),i=n.pop(),a=tf(r,n);return a!==0?a:o&&i?tf(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 fa(){return Dr()}function of(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&of(t);return e}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=Te(t),l=Te(r),c=s,g=l,v;for(let E of e)try{a&&(of(c),of(g));let h=yield n(E,c,g);if(h===void 0)continue;if(h.messages!==void 0&&h.messages!==c&&(c=Te(h.messages)),h.state!==void 0&&h.state!==g&&(g=Te(h.state)),v=h.stopPropagation,v===!0)break}catch(h){if(a&&h instanceof TypeError){if(i)throw h;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",h)}else i||console.error("Subscriber error:",h);continue}return{...(c===s?{}:{messages:a&&Object.isFrozen(c)?Te(c):c}),...(g===l?{}:{state:a&&Object.isFrozen(g)?Te(g):g}),...(v===void 0?{}:{stopPropagation:v})}});return _Oe.apply(this,arguments)}function Tu(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 ma(e){if(e instanceof af)return e;if(e===!0)return new af(Tu(!0))}var af=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 rf(e){return e.enabled?new af(e):void 0}function _k(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 KS=(e,t,r,n,o)=>{let i=ma(o),a=Te(r.messages),s=Te(e.state),l={},c=v=>{v.messages!==void 0&&(a=v.messages,l.messages=v.messages),v.state!==void 0&&(s=v.state,l.state=v.state)},g=()=>{let v=Te(l);return l={},v.messages!==void 0||v.state!==void 0?Ve(v):Oc};return t.pipe(Hc(/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(v){let E=yield Oe(n,a,s,(h,y,S)=>h.onEvent?.({event:v,agent:r,input:e,messages:y,state:S}));if(c(E),E.stopPropagation===!0?i?.event("APPLY","Event dropped:",v,{type:v.type,reason:"stopPropagation by subscriber"}):i?.event("APPLY","Event applied:",v,{type:v.type,subscribers:n.length}),E.stopPropagation===!0)return g();switch(v.type){case M.TEXT_MESSAGE_START:{let h=yield Oe(n,a,s,(y,S,C)=>y.onTextMessageStartEvent?.({event:v,messages:S,state:C,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,role:S="assistant",name:C}=v;if(!a.find(R=>R.id===y)){let R={id:y,role:S,content:"",...(C!==void 0&&{name:C})};a.push(R),c({messages:a})}}return g()}case M.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,S=a.find(R=>R.id===h);if(!S)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let C=yield Oe(n,a,s,(R,T,I)=>R.onTextMessageContentEvent?.({event:v,messages:T,state:I,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}));return c(C),C.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${y}`,c({messages:a})),g()}case M.TEXT_MESSAGE_END:{let{messageId:h}=v,y=a.find(S=>S.id===h);return y?(c(yield Oe(n,a,s,(S,C,R)=>S.onTextMessageEndEvent?.({event:v,messages:C,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})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g())}case M.TOOL_CALL_START:{let h=yield Oe(n,a,s,(y,S,C)=>y.onToolCallStartEvent?.({event:v,messages:S,state:C,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:S,parentMessageId:C}=v,R=_k(a,C,y);R.toolCalls??(R.toolCalls=[]),R.toolCalls.push({id:y,type:"function",function:{name:S,arguments:""}}),c({messages:a})}return g()}case M.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=v,S=a.find(T=>T.toolCalls?.some(I=>I.id===h));if(!S)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let C=S.toolCalls?.find(T=>T.id===h);if(!C)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let R=yield Oe(n,a,s,(T,I,k)=>{let _=C.function.arguments,D=C.function.name,B={};try{B=Wc(_)}catch{}return T.onToolCallArgsEvent?.({event:v,messages:I,state:k,agent:r,input:e,toolCallBuffer:_,toolCallName:D,partialToolCallArgs:B})});return c(R),R.stopPropagation!==!0&&(C.function.arguments+=y,c({messages:a})),g()}case M.TOOL_CALL_END:{let{toolCallId:h}=v,y=a.find(C=>C.toolCalls?.some(R=>R.id===h));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let S=y.toolCalls?.find(C=>C.id===h);return S?(c(yield Oe(n,a,s,(C,R,T)=>{let I=S.function.arguments,k=S.function.name,_={};try{_=JSON.parse(I)}catch{}return C.onToolCallEndEvent?.({event:v,messages:R,state:T,agent:r,input:e,toolCallName:k,toolCallArgs:_})})),yield Promise.all(n.map(C=>{C.onNewToolCall?.({toolCall:S,messages:a,state:s,agent:r,input:e})})),g()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g())}case M.TOOL_CALL_RESULT:{let h=yield Oe(n,a,s,(y,S,C)=>y.onToolCallResultEvent?.({event:v,messages:S,state:C,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:S,content:C,role:R}=v,T={id:y,toolCallId:S,role:R||"tool",content:C};a.push(T),yield Promise.all(n.map(I=>{I.onNewMessage?.({message:T,messages:a,state:s,agent:r,input:e})})),c({messages:a})}return g()}case M.STATE_SNAPSHOT:{let h=yield Oe(n,a,s,(y,S,C)=>y.onStateSnapshotEvent?.({event:v,messages:S,state:C,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{snapshot:y}=v;s=y,c({state:s})}return g()}case M.STATE_DELTA:{let h=yield Oe(n,a,s,(y,S,C)=>y.onStateDeltaEvent?.({event:v,messages:S,state:C,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{delta:y}=v;try{s=Ac.applyPatch(s,y,!0,!1).newDocument,c({state:s})}catch(S){let C=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 aa(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Lo=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=vr(a),l=s.next();!l.done;l=s.next()){var c=l.value;c.remove(this)}}catch(S){t={error:S}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}else a.remove(this);var g=this.initialTeardown;if(xe(g))try{g()}catch(S){i=S instanceof Cc?S.errors:[S]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var E=vr(v),h=E.next();!h.done;h=E.next()){var y=h.value;try{Pv(y)}catch(S){i=i??[],S instanceof Cc?i=qo(qo([],Mo(i)),Mo(S.errors)):i.push(S)}}}catch(S){n={error:S}}finally{try{h&&!h.done&&(o=E.return)&&o.call(E)}finally{if(n)throw n.error}}}if(i)throw new Cc(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Pv(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)&&aa(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&aa(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Pp=Lo.EMPTY;function Ec(e){return e instanceof Lo||e&&"closed"in e&&xe(e.remove)&&xe(e.add)&&xe(e.unsubscribe)}function Pv(e){xe(e)?e():e.unsubscribe()}m();d();f();p();var Ut={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var Uo={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Uo.delegate;return o?.setTimeout?o.setTimeout.apply(o,qo([e,t],Mo(r))):setTimeout.apply(void 0,qo([e,t],Mo(r)))},clearTimeout:function(e){var t=Uo.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Rc(e){Uo.setTimeout(function(){var t=Ut.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function sa(){}m();d();f();p();var Nv=function(){return Np("C",void 0,void 0)}();function Fv(e){return Np("E",void 0,e)}function Dv(e){return Np("N",e,void 0)}function Np(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var On=null;function Vo(e){if(Ut.useDeprecatedSynchronousErrorHandling){var t=!On;if(t&&(On={errorThrown:!1,error:null}),e(),t){var r=On,n=r.errorThrown,o=r.error;if(On=null,n)throw o}}else e()}function Mv(e){Ut.useDeprecatedSynchronousErrorHandling&&On&&(On.errorThrown=!0,On.error=e)}var ca=function(e){er(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Ec(r)&&r.add(n)):n.destination=J0,n}return t.create=function(r,n,o){return new Tc(r,n,o)},t.prototype.next=function(r){this.isStopped?Dp(Dv(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Dp(Fv(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Dp(Nv,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}(Lo);var Y0=Function.prototype.bind;function Fp(e,t){return Y0.call(e,t)}var X0=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){Ic(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Ic(n)}else Ic(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Ic(r)}},e}(),Tc=function(e){er(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&&Ut.useDeprecatedNextContext?(s=Object.create(r),s.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&Fp(r.next,s),error:r.error&&Fp(r.error,s),complete:r.complete&&Fp(r.complete,s)}):a=r}return i.destination=new X0(a),i}return t}(ca);function Ic(e){Ut.useDeprecatedSynchronousErrorHandling?Mv(e):Rc(e)}function Z0(e){throw e}function Dp(e,t){var r=Ut.onStoppedNotification;r&&Uo.setTimeout(function(){return r(e,t)})}var J0={closed:!0,next:sa,error:Z0,complete:sa};m();d();f();p();var Bo=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function Go(e){return e}function _c(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Mp(e)}function Mp(e){return e.length===0?Go:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var qe=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=tk(t)?t:new Tc(t,r,n);return Vo(function(){var a=o,s=a.operator,l=a.source;i.add(s?s.call(i,l):l?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=qv(r),new r(function(o,i){var a=new Tc({next:function(s){try{t(s)}catch(l){i(l),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[Bo]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Mp(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=qv(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 qv(e){var t;return(t=e??Ut.Promise)!==null&&t!==void 0?t:Promise}function ek(e){return e&&xe(e.next)&&xe(e.error)&&xe(e.complete)}function tk(e){return e&&e instanceof ca||ek(e)&&Ec(e)}m();d();f();p();function rk(e){return xe(e?.lift)}function Qe(e){return function(t){if(rk(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 nk(e,t,r,n,o)}var nk=function(e){er(t,e);function t(r,n,o,i,a,s){var l=e.call(this,r)||this;return l.onFinalize=a,l.shouldUnsubscribe=s,l._next=n?function(c){try{n(c)}catch(g){r.error(g)}}:e.prototype._next,l._error=i?function(c){try{i(c)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,l._complete=o?function(){try{o()}catch(c){r.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,l}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}(ca);m();d();f();p();m();d();f();p();var jv=jo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var tr=function(e){er(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new Lv(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new jv},t.prototype.next=function(r){var n=this;Vo(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=vr(n.currentObservers),s=a.next();!s.done;s=a.next()){var l=s.value;l.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;Vo(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;Vo(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?Pp:(this.currentObservers=null,s.push(r),new Lo(function(){n.currentObservers=null,aa(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 qe;return r.source=this,r},t.create=function(r,n){return new Lv(r,n)},t}(qe);var Lv=function(e){er(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:Pp},t}(tr);m();d();f();p();m();d();f();p();var qp={now:function(){return(qp.delegate||Date).now()},delegate:void 0};var kc=function(e){er(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=qp);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,l=n._windowTime;o||(i.push(r),!a&&i.push(s.now()+l)),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(),l=0;l<s.length&&!r.closed;l+=i?1:2)r.next(s[l]);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 l=o.now(),c=0,g=1;g<i.length&&i[g]<=l;g+=2)c=g;c&&i.splice(0,c+1)}},t}(tr);m();d();f();p();var Oc=new qe(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function Uv(e){return e&&xe(e.schedule)}function ok(e){return e[e.length-1]}function Vv(e){return Uv(ok(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 Pc=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function Nc(e){return xe(e?.then)}m();d();f();p();function Fc(e){return xe(e[Bo])}m();d();f();p();function Dc(e){return Symbol.asyncIterator&&xe(e?.[Symbol.asyncIterator])}m();d();f();p();function Mc(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 ik(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var qc=ik();function jc(e){return xe(e?.[qc])}m();d();f();p();function Lc(e){return kv(this,arguments,function(){var r,n,o,i;return xc(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,kn(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,kn(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,kn(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 Uc(e){return xe(e?.getReader)}function Ke(e){if(e instanceof qe)return e;if(e!=null){if(Fc(e))return ak(e);if(Pc(e))return sk(e);if(Nc(e))return ck(e);if(Dc(e))return Bv(e);if(jc(e))return uk(e);if(Uc(e))return lk(e)}throw Mc(e)}function ak(e){return new qe(function(t){var r=e[Bo]();if(xe(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function sk(e){return new qe(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function ck(e){return new qe(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Rc)})}function uk(e){return new qe(function(t){var r,n;try{for(var o=vr(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 Bv(e){return new qe(function(t){dk(e,t).catch(function(r){return t.error(r)})})}function lk(e){return Bv(Lc(e))}function dk(e,t){var r,n,o,i;return _v(this,void 0,void 0,function(){var a,s;return xc(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),r=Ov(e),l.label=1;case 1:return[4,r.next()];case 2:if(n=l.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),t.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=l.sent(),o={error:s},[3,11];case 6:return l.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:l.sent(),l.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 Nt(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!o)return i}function Vc(e,t){return t===void 0&&(t=0),Qe(function(r,n){r.subscribe(We(n,function(o){return Nt(n,e,function(){return n.next(o)},t)},function(){return Nt(n,e,function(){return n.complete()},t)},function(o){return Nt(n,e,function(){return n.error(o)},t)}))})}m();d();f();p();function Bc(e,t){return t===void 0&&(t=0),Qe(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function Gv(e,t){return Ke(e).pipe(Bc(t),Vc(t))}m();d();f();p();function $v(e,t){return Ke(e).pipe(Bc(t),Vc(t))}m();d();f();p();function Qv(e,t){return new qe(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 Hv(e,t){return new qe(function(r){var n;return Nt(r,t,function(){n=e[qc](),Nt(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 Gc(e,t){if(!e)throw new Error("Iterable cannot be null");return new qe(function(r){Nt(r,t,function(){var n=e[Symbol.asyncIterator]();Nt(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}m();d();f();p();function zv(e,t){return Gc(Lc(e),t)}function Wv(e,t){if(e!=null){if(Fc(e))return Gv(e,t);if(Pc(e))return Qv(e,t);if(Nc(e))return $v(e,t);if(Dc(e))return Gc(e,t);if(jc(e))return Hv(e,t);if(Uc(e))return zv(e,t)}throw Mc(e)}function Pn(e,t){return t?Wv(e,t):Ke(e)}function Ve(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Vv(e);return Pn(e,r)}m();d();f();p();function je(e,t){var r=xe(e)?e:function(){return e},n=function(o){return o.error(r())};return new qe(t?function(o){return t.schedule(n,0,o)}:n)}m();d();f();p();m();d();f();p();var Kv=jo(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function $c(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 Kv)}})})}m();d();f();p();function Nn(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 Yv(e,t,r,n,o,i,a,s){var l=[],c=0,g=0,v=!1,E=function(){v&&!l.length&&!c&&t.complete()},h=function(S){return c<n?y(S):l.push(S)},y=function(S){i&&t.next(S),c++;var C=!1;Ke(r(S,g++)).subscribe(We(t,function(R){o?.(R),i?h(R):t.next(R)},function(){C=!0},void 0,function(){if(C)try{c--;for(var R=function(){var T=l.shift();a?Nt(t,a,function(){return y(T)}):y(T)};l.length&&c<n;)R();E()}catch(T){t.error(T)}}))};return e.subscribe(We(t,h,function(){v=!0,E()})),function(){s?.()}}function St(e,t,r){return r===void 0&&(r=1/0),xe(t)?St(function(n,o){return Nn(function(i,a){return t(n,i,o,a)})(Ke(e(n,o)))},r):(typeof t=="number"&&(r=t),Qe(function(n,o){return Yv(n,o,e,r)}))}function jp(e){return e===void 0&&(e=1/0),St(Go,e)}m();d();f();p();function Qc(e){return new qe(function(t){Ke(e()).subscribe(t)})}m();d();f();p();function ua(e){return Qe(function(t,r){var n=null,o=!1,i;n=t.subscribe(We(r,void 0,void 0,function(a){i=Ke(e(a,ua(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 Hc(e,t){return xe(t)?St(e,t,1):St(e,1)}m();d();f();p();function Lp(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 Fn(e){return Qe(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function Up(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(l){o?.unsubscribe();var c=0,g=i++;Ke(e(l,g)).subscribe(o=We(n,function(v){return n.next(t?t(l,v,g,c++):v)},function(){o=null,s()}))},function(){a=!0,s()}))})}m();d();f();p();function zc(e){return Qe(function(t,r){Ke(e).subscribe(We(r,function(){return r.complete()},sa)),!r.closed&&t.subscribe(r)})}m();d();f();p();function Vp(e,t,r){var n=xe(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(l){var c;(c=n.next)===null||c===void 0||c.call(n,l),i.next(l)},function(){var l;s=!1,(l=n.complete)===null||l===void 0||l.call(n),i.complete()},function(l){var c;s=!1,(c=n.error)===null||c===void 0||c.call(n,l),i.error(l)},function(){var l,c;s&&((l=n.unsubscribe)===null||l===void 0||l.call(n)),(c=n.finalize)===null||c===void 0||c.call(n)}))}):Go}m();d();f();p();m();d();f();p();function Xv(e){return` \r
|
|
36
|
+
`.indexOf(e)>=0}function Wc(e){for(var t=["topLevel"],r=0,n,o,i,a=function(T){return t.push(T)},s=function(T){return t[t.length-1]=T},l=function(T){n==null&&(n=r,o=t.length,i=T)},c=function(T){T===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},E=function(T){if("0"<=T&&T<="9"){a("number");return}switch(T){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":E(y);break;case"string":switch(y){case"\"":g();break;case"\\":l("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():Xv(y)||(c("collectionItem"),s("arrayNeedsComma"),E(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(l("collectionItem"),s("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(l("collectionItem"),s("objectNeedsColon"),a("string"));break;case"objectNeedsColon":y===":"&&s("objectNeedsValue");break;case"objectNeedsValue":Xv(y)||(c("collectionItem"),s("objectNeedsComma"),E(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(l("collectionItem"),s("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var S=[n!=null?e.slice(0,n):e],C=function(T){return S.push(T.slice(e.length-e.lastIndexOf(T[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":C("true");break;case"false":C("false");break;case"null":C("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 Jv(){let e=0,t=0;for(let n=0;n<28;n+=7){let o=this.buf[this.pos++];if(e|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}let r=this.buf[this.pos++];if(e|=(r&15)<<28,t=(r&112)>>4,(r&128)==0)return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let o=this.buf[this.pos++];if(t|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function Yc(e,t,r){for(let i=0;i<28;i=i+7){let a=e>>>i,s=!(!(a>>>7)&&t==0),l=(s?a|128:a)&255;if(r.push(l),!s)return}let n=e>>>28&15|(t&7)<<4,o=t>>3!=0;if(r.push((o?n|128:n)&255),!!o){for(let i=3;i<31;i=i+7){let a=t>>>i,s=!!(a>>>7),l=(s?a|128:a)&255;if(r.push(l),!s)return}r.push(t>>>31&1)}}var Kc=4294967296;function Bp(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(a,s){let l=Number(e.slice(a,s));o*=r,n=n*r+l,n>=Kc&&(o=o+(n/Kc|0),n=n%Kc)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?tS(n,o):$p(n,o)}function eS(e,t){let r=$p(e,t),n=r.hi&2147483648;n&&(r=tS(r.lo,r.hi));let o=Gp(r.lo,r.hi);return n?"-"+o:o}function Gp(e,t){if({lo:e,hi:t}=pk(e,t),t<=2097151)return String(Kc*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,l=1e7;return i>=l&&(a+=Math.floor(i/l),i%=l),a>=l&&(s+=Math.floor(a/l),a%=l),s.toString()+Zv(a)+Zv(i)}function pk(e,t){return{lo:e>>>0,hi:t>>>0}}function $p(e,t){return{lo:e|0,hi:t|0}}function tS(e,t){return t=~t,e?e=~e+1:t+=1,$p(e,t)}var Zv=e=>{let t=String(e);return"0000000".slice(t.length)+t};function Qp(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let r=0;r<9;r++)t.push(e&127|128),e=e>>7;t.push(1)}}function rS(){let e=this.buf[this.pos++],t=e&127;if((e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)==0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!=0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();f();p();var Vt=fk();function fk(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!b.Deno||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()),nS(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),oS(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),nS(r),Bp(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),oS(r),Bp(r)},dec(r,n){return eS(r,n)},uDec(r,n){return Gp(r,n)}}}function nS(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function oS(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var Hp=Symbol.for("@bufbuild/protobuf/text-encoding");function zp(){if(b[Hp]==null){let e=new b.TextEncoder,t=new b.TextDecoder,r;b[Hp]={encodeUtf8(n){return e.encode(n)},decodeUtf8(n,o){return o?(r===void 0&&(r=new b.TextDecoder("utf-8",{fatal:!0})),r.decode(n)):t.decode(n)},checkUtf8(n){try{return encodeURIComponent(n),!0}catch{return!1}}}}return b[Hp]}var Ur;(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"})(Ur||(Ur={}));var mk=34028234663852886e22,gk=-34028234663852886e22,hk=4294967295,yk=2147483647,vk=-2147483648,we=class{constructor(t=zp().encodeUtf8){this.encodeUtf8=t,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let t=0;for(let o=0;o<this.chunks.length;o++)t+=this.chunks[o].length;let r=new Uint8Array(t),n=0;for(let o=0;o<this.chunks.length;o++)r.set(this.chunks[o],n),n+=this.chunks[o].length;return this.chunks=[],r}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let t=this.finish(),r=this.stack.pop();if(!r)throw new Error("invalid state, fork stack empty");return this.chunks=r.chunks,this.buf=r.buf,this.uint32(t.byteLength),this.raw(t)}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(iS(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return Wp(t),Qp(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let r=this.encodeUtf8(t);return this.uint32(r.byteLength),this.raw(r)}float(t){Sk(t);let r=new Uint8Array(4);return new DataView(r.buffer).setFloat32(0,t,!0),this.raw(r)}double(t){let r=new Uint8Array(8);return new DataView(r.buffer).setFloat64(0,t,!0),this.raw(r)}fixed32(t){iS(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){Wp(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return Wp(t),t=(t<<1^t>>31)>>>0,Qp(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Vt.enc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}fixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Vt.uEnc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}int64(t){let r=Vt.enc(t);return Yc(r.lo,r.hi,this.buf),this}sint64(t){let r=Vt.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return Yc(o,i,this.buf),this}uint64(t){let r=Vt.uEnc(t);return Yc(r.lo,r.hi,this.buf),this}},J=class{constructor(t,r=zp().decodeUtf8){this.decodeUtf8=r,this.varint64=Jv,this.uint32=rS,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){let n=this.pos;switch(t){case Ur.Varint:for(;this.buf[this.pos++]&128;);break;case Ur.Bit64:this.pos+=4;case Ur.Bit32:this.pos+=4;break;case Ur.LengthDelimited:let o=this.uint32();this.pos+=o;break;case Ur.StartGroup:for(;;){let[i,a]=this.tag();if(a===Ur.EndGroup){if(r!==void 0&&i!==r)throw new Error("invalid end group tag");break}this.skip(a,i)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return Vt.dec(...this.varint64())}uint64(){return Vt.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Vt.dec(t,r)}bool(){let[t,r]=this.varint64();return t!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Vt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Vt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){return this.decodeUtf8(this.bytes(),t)}};function Wp(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>yk||e<vk)throw new Error("invalid int32: "+e)}function iS(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>hk||e<0)throw new Error("invalid uint32: "+e)}function Sk(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>mk||e<gk))throw new Error("invalid float32: "+e)}var bk=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Kp(){return{fields:{}}}var la={encode(e,t=new we){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&Zp.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=Kp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=Zp.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 la.fromPartial(e??{})},fromPartial(e){let t=Kp();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=Kp();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 aS(){return{key:"",value:void 0}}var Zp={encode(e,t=new we){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&pe.encode(pe.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=aS();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=pe.unwrap(pe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Zp.fromPartial(e??{})},fromPartial(e){let t=aS();return t.key=e.key??"",t.value=e.value??void 0,t}};function Yp(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var pe={encode(e,t=new we){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&&la.encode(la.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&da.encode(da.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=Yp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.nullValue=r.int32();continue;case 2:if(i!==17)break;o.numberValue=r.double();continue;case 3:if(i!==26)break;o.stringValue=r.string();continue;case 4:if(i!==32)break;o.boolValue=r.bool();continue;case 5:if(i!==42)break;o.structValue=la.unwrap(la.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=da.unwrap(da.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return pe.fromPartial(e??{})},fromPartial(e){let t=Yp();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=Yp();if(e===null)t.nullValue=bk.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(b.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new b.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function Xp(){return{values:[]}}var da={encode(e,t=new we){for(let r of e.values)pe.encode(pe.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=Xp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(pe.unwrap(pe.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return da.fromPartial(e??{})},fromPartial(e){let t=Xp();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=Xp();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&b.Array.isArray(e.values)?e.values:e}},wk=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 sS(){return{op:0,path:"",from:void 0,value:void 0}}var Zc={encode(e,t=new we){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&&pe.encode(pe.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=sS();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=pe.unwrap(pe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Zc.fromPartial(e??{})},fromPartial(e){let t=sS();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function cS(){return{id:"",type:"",function:void 0}}var Jc={encode(e,t=new we){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&eu.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=cS();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=eu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Jc.fromPartial(e??{})},fromPartial(e){let t=cS();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?eu.fromPartial(e.function):void 0,t}};function uS(){return{name:"",arguments:""}}var eu={encode(e,t=new we){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=uS();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 eu.fromPartial(e??{})},fromPartial(e){let t=uS();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function lS(){return{value:"",mimeType:""}}var tu={encode(e,t=new we){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=lS();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 tu.fromPartial(e??{})},fromPartial(e){let t=lS();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function dS(){return{value:"",mimeType:void 0}}var ru={encode(e,t=new we){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=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 ru.fromPartial(e??{})},fromPartial(e){let t=dS();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function pS(){return{data:void 0,url:void 0}}var xt={encode(e,t=new we){return e.data!==void 0&&tu.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&ru.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=pS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=tu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=ru.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xt.fromPartial(e??{})},fromPartial(e){let t=pS();return t.data=e.data!==void 0&&e.data!==null?tu.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?ru.fromPartial(e.url):void 0,t}};function fS(){return{text:""}}var nu={encode(e,t=new we){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=fS();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 nu.fromPartial(e??{})},fromPartial(e){let t=fS();return t.text=e.text??"",t}};function mS(){return{source:void 0,metadata:void 0}}var ou={encode(e,t=new we){return e.source!==void 0&&xt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&pe.encode(pe.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=mS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=xt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=pe.unwrap(pe.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=mS();return t.source=e.source!==void 0&&e.source!==null?xt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function gS(){return{source:void 0,metadata:void 0}}var iu={encode(e,t=new we){return e.source!==void 0&&xt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&pe.encode(pe.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=gS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=xt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=pe.unwrap(pe.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.source=e.source!==void 0&&e.source!==null?xt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function hS(){return{source:void 0,metadata:void 0}}var au={encode(e,t=new we){return e.source!==void 0&&xt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&pe.encode(pe.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=hS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=xt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=pe.unwrap(pe.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=hS();return t.source=e.source!==void 0&&e.source!==null?xt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function yS(){return{source:void 0,metadata:void 0}}var su={encode(e,t=new we){return e.source!==void 0&&xt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&pe.encode(pe.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=yS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=xt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=pe.unwrap(pe.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=yS();return t.source=e.source!==void 0&&e.source!==null?xt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function vS(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var cu={encode(e,t=new we){return e.text!==void 0&&nu.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&ou.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&iu.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&&su.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=vS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=nu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=ou.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=iu.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=su.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return cu.fromPartial(e??{})},fromPartial(e){let t=vS();return t.text=e.text!==void 0&&e.text!==null?nu.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?ou.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?iu.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?su.fromPartial(e.document):void 0,t}};function SS(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var uu={encode(e,t=new we){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)Jc.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)cu.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=SS();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(Jc.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(cu.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return uu.fromPartial(e??{})},fromPartial(e){let t=SS();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=>Jc.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>cu.fromPartial(r))||[],t}},Ak=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 bS(){return{type:0,timestamp:void 0,rawEvent:void 0}}var ue={encode(e,t=new we){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&pe.encode(pe.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=bS();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=xk(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=pe.unwrap(pe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ue.fromPartial(e??{})},fromPartial(e){let t=bS();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function wS(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var lu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=wS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 lu.fromPartial(e??{})},fromPartial(e){let t=wS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function AS(){return{baseEvent:void 0,messageId:"",delta:""}}var du={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=AS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 du.fromPartial(e??{})},fromPartial(e){let t=AS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function xS(){return{baseEvent:void 0,messageId:""}}var pu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=xS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 pu.fromPartial(e??{})},fromPartial(e){let t=xS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function CS(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var fu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=CS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 fu.fromPartial(e??{})},fromPartial(e){let t=CS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function ES(){return{baseEvent:void 0,toolCallId:"",delta:""}}var mu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=ES();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 mu.fromPartial(e??{})},fromPartial(e){let t=ES();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function RS(){return{baseEvent:void 0,toolCallId:""}}var gu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=RS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 gu.fromPartial(e??{})},fromPartial(e){let t=RS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function IS(){return{baseEvent:void 0,snapshot:void 0}}var hu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&pe.encode(pe.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=IS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=pe.unwrap(pe.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=IS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function TS(){return{baseEvent:void 0,delta:[]}}var yu={encode(e,t=new we){e.baseEvent!==void 0&&ue.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)Zc.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=TS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(Zc.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=TS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>Zc.fromPartial(r))||[],t}};function _S(){return{baseEvent:void 0,messages:[]}}var vu={encode(e,t=new we){e.baseEvent!==void 0&&ue.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)uu.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=_S();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(uu.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=_S();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>uu.fromPartial(r))||[],t}};function kS(){return{baseEvent:void 0,event:void 0,source:void 0}}var Su={encode(e,t=new we){return e.baseEvent!==void 0&&ue.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&pe.encode(pe.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=kS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=pe.unwrap(pe.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 Su.fromPartial(e??{})},fromPartial(e){let t=kS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function OS(){return{baseEvent:void 0,name:"",value:void 0}}var bu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&pe.encode(pe.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=OS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=pe.unwrap(pe.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=OS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function PS(){return{baseEvent:void 0,threadId:"",runId:""}}var wu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=PS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 wu.fromPartial(e??{})},fromPartial(e){let t=PS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function NS(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0}}var Au={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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&&pe.encode(pe.wrap(e.result),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=NS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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=pe.unwrap(pe.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=NS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t}};function FS(){return{baseEvent:void 0,code:void 0,message:""}}var xu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message),t},decode(e,t){let r=e instanceof 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!==10)break;o.baseEvent=ue.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.code=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xu.fromPartial(e??{})},fromPartial(e){let t=FS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function DS(){return{baseEvent:void 0,stepName:""}}var Cu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=DS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 Cu.fromPartial(e??{})},fromPartial(e){let t=DS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function MS(){return{baseEvent:void 0,stepName:""}}var Eu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=MS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Eu.fromPartial(e??{})},fromPartial(e){let t=MS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function qS(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var Ru={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=qS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ue.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 Ru.fromPartial(e??{})},fromPartial(e){let t=qS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.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 Iu={encode(e,t=new we){return e.baseEvent!==void 0&&ue.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=ue.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 Iu.fromPartial(e??{})},fromPartial(e){let t=jS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ue.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function LS(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0}}var US={encode(e,t=new we){return e.textMessageStart!==void 0&&lu.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&du.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&pu.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&fu.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&mu.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&gu.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&hu.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&yu.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&vu.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Su.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&bu.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&wu.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Au.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&xu.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Cu.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Eu.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Ru.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Iu.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=LS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=lu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=du.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=pu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=fu.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=mu.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=gu.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=hu.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=yu.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=vu.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Su.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=bu.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=wu.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Au.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=xu.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Cu.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=Eu.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=Ru.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Iu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return US.fromPartial(e??{})},fromPartial(e){let t=LS();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?lu.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?du.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?pu.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?fu.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?mu.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?gu.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?hu.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?yu.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?vu.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Su.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?bu.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?wu.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Au.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?xu.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Cu.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Eu.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Ru.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Iu.fromPartial(e.toolCallChunk):void 0,t}};function xk(e){let t=b.Number(e.toString());if(t>b.Number.MAX_SAFE_INTEGER)throw new b.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<b.Number.MIN_SAFE_INTEGER)throw new b.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var Xc=e=>{if(!(!e||typeof e!="object")){if(e.data)return{type:"data",value:e.data.value,mimeType:e.data.mimeType};if(e.url)return{type:"url",value:e.url.value,mimeType:e.url.mimeType}}},Ck=e=>{if(!(!e||typeof e!="object")){if(e.text)return{type:"text",text:e.text.text};if(e.image)return{type:"image",source:Xc(e.image.source),metadata:e.image.metadata};if(e.audio)return{type:"audio",source:Xc(e.audio.source),metadata:e.audio.metadata};if(e.video)return{type:"video",source:Xc(e.video.source),metadata:e.video.metadata};if(e.document)return{type:"document",source:Xc(e.document.source),metadata:e.document.metadata}}};function VS(e){let t=US.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=Ak[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,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=>Ck(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.STATE_DELTA)for(let n of r.delta)n.op=wk[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]}),mc.parse(r)}var Jp="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var Rk=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,ef=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(Rk);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},BS=e=>e==="*"||e==="x"||e==="X",GS=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},Ik=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],Tk=(e,t)=>{if(BS(e)||BS(t))return 0;let[r,n]=Ik(GS(e),GS(t));return r>n?1:r<n?-1:0},tf=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=Tk(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var pa=(e,t)=>{let r=ef(e),n=ef(t),o=r.pop(),i=n.pop(),a=tf(r,n);return a!==0?a:o&&i?tf(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 fa(){return Dr()}function of(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&of(t);return e}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=Te(t),l=Te(r),c=s,g=l,v;for(let E of e)try{a&&(of(c),of(g));let h=yield n(E,c,g);if(h===void 0)continue;if(h.messages!==void 0&&h.messages!==c&&(c=Te(h.messages)),h.state!==void 0&&h.state!==g&&(g=Te(h.state)),v=h.stopPropagation,v===!0)break}catch(h){if(a&&h instanceof TypeError){if(i)throw h;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",h)}else i||console.error("Subscriber error:",h);continue}return{...(c===s?{}:{messages:a&&Object.isFrozen(c)?Te(c):c}),...(g===l?{}:{state:a&&Object.isFrozen(g)?Te(g):g}),...(v===void 0?{}:{stopPropagation:v})}});return _Oe.apply(this,arguments)}function Tu(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 ma(e){if(e instanceof af)return e;if(e===!0)return new af(Tu(!0))}var af=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 rf(e){return e.enabled?new af(e):void 0}function _k(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 KS=(e,t,r,n,o)=>{let i=ma(o),a=Te(r.messages),s=Te(e.state),l={},c=v=>{v.messages!==void 0&&(a=v.messages,l.messages=v.messages),v.state!==void 0&&(s=v.state,l.state=v.state)},g=()=>{let v=Te(l);return l={},v.messages!==void 0||v.state!==void 0?Ve(v):Oc};return t.pipe(Hc(/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(v){let E=yield Oe(n,a,s,(h,y,S)=>h.onEvent?.({event:v,agent:r,input:e,messages:y,state:S}));if(c(E),E.stopPropagation===!0?i?.event("APPLY","Event dropped:",v,{type:v.type,reason:"stopPropagation by subscriber"}):i?.event("APPLY","Event applied:",v,{type:v.type,subscribers:n.length}),E.stopPropagation===!0)return g();switch(v.type){case M.TEXT_MESSAGE_START:{let h=yield Oe(n,a,s,(y,S,C)=>y.onTextMessageStartEvent?.({event:v,messages:S,state:C,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,role:S="assistant",name:C}=v;if(!a.find(R=>R.id===y)){let R={id:y,role:S,content:"",...(C!==void 0&&{name:C})};a.push(R),c({messages:a})}}return g()}case M.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,S=a.find(R=>R.id===h);if(!S)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let C=yield Oe(n,a,s,(R,T,I)=>R.onTextMessageContentEvent?.({event:v,messages:T,state:I,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}));return c(C),C.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${y}`,c({messages:a})),g()}case M.TEXT_MESSAGE_END:{let{messageId:h}=v,y=a.find(S=>S.id===h);return y?(c(yield Oe(n,a,s,(S,C,R)=>S.onTextMessageEndEvent?.({event:v,messages:C,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})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g())}case M.TOOL_CALL_START:{let h=yield Oe(n,a,s,(y,S,C)=>y.onToolCallStartEvent?.({event:v,messages:S,state:C,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:S,parentMessageId:C}=v,R=_k(a,C,y);R.toolCalls??(R.toolCalls=[]),R.toolCalls.push({id:y,type:"function",function:{name:S,arguments:""}}),c({messages:a})}return g()}case M.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=v,S=a.find(T=>T.toolCalls?.some(I=>I.id===h));if(!S)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let C=S.toolCalls?.find(T=>T.id===h);if(!C)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let R=yield Oe(n,a,s,(T,I,k)=>{let _=C.function.arguments,D=C.function.name,B={};try{B=Wc(_)}catch{}return T.onToolCallArgsEvent?.({event:v,messages:I,state:k,agent:r,input:e,toolCallBuffer:_,toolCallName:D,partialToolCallArgs:B})});return c(R),R.stopPropagation!==!0&&(C.function.arguments+=y,c({messages:a})),g()}case M.TOOL_CALL_END:{let{toolCallId:h}=v,y=a.find(C=>C.toolCalls?.some(R=>R.id===h));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let S=y.toolCalls?.find(C=>C.id===h);return S?(c(yield Oe(n,a,s,(C,R,T)=>{let I=S.function.arguments,k=S.function.name,_={};try{_=JSON.parse(I)}catch{}return C.onToolCallEndEvent?.({event:v,messages:R,state:T,agent:r,input:e,toolCallName:k,toolCallArgs:_})})),yield Promise.all(n.map(C=>{C.onNewToolCall?.({toolCall:S,messages:a,state:s,agent:r,input:e})})),g()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g())}case M.TOOL_CALL_RESULT:{let h=yield Oe(n,a,s,(y,S,C)=>y.onToolCallResultEvent?.({event:v,messages:S,state:C,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:S,content:C,role:R}=v,T={id:y,toolCallId:S,role:R||"tool",content:C};a.push(T),yield Promise.all(n.map(I=>{I.onNewMessage?.({message:T,messages:a,state:s,agent:r,input:e})})),c({messages:a})}return g()}case M.STATE_SNAPSHOT:{let h=yield Oe(n,a,s,(y,S,C)=>y.onStateSnapshotEvent?.({event:v,messages:S,state:C,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{snapshot:y}=v;s=y,c({state:s})}return g()}case M.STATE_DELTA:{let h=yield Oe(n,a,s,(y,S,C)=>y.onStateDeltaEvent?.({event:v,messages:S,state:C,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{delta:y}=v;try{s=Ac.applyPatch(s,y,!0,!1).newDocument,c({state:s})}catch(S){let C=S instanceof Error?S.message:String(S);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: ${C}`)}}return g()}case M.MESSAGES_SNAPSHOT:{let h=yield Oe(n,a,s,(y,S,C)=>y.onMessagesSnapshotEvent?.({event:v,messages:S,state:C,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messages:y}=v,S=new Map(y.map(T=>[T.id,T])),C=T=>T==="activity"||T==="reasoning";a=a.filter(T=>C(T.role)||S.has(T.id)).map(T=>C(T.role)?T:S.get(T.id));let R=new Set(a.map(T=>T.id));for(let T of y)R.has(T.id)||a.push(T);c({messages:a})}return g()}case M.ACTIVITY_SNAPSHOT:{let h=v,y=a.findIndex(I=>I.id===h.messageId),S=y>=0?a[y]:void 0,C=S?.role==="activity"?S:void 0,R=h.replace??!0,T=yield Oe(n,a,s,(I,k,_)=>I.onActivitySnapshotEvent?.({event:h,messages:k,state:_,agent:r,input:e,activityMessage:C,existingMessage:S}));if(c(T),T.stopPropagation!==!0){let I={id:h.messageId,role:"activity",activityType:h.activityType,content:Te(h.content)},k;y===-1?(a.push(I),k=I):C?R&&(a[y]={...C,activityType:h.activityType,content:Te(h.content)}):R&&(a[y]=I,k=I),c({messages:a}),k&&(yield Promise.all(n.map(_=>_.onNewMessage?.({message:k,messages:a,state:s,agent:r,input:e}))))}return g()}case M.ACTIVITY_DELTA:{let h=v,y=a.findIndex(T=>T.id===h.messageId);if(y===-1)return g();let S=a[y];if(S.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let C=S,R=yield Oe(n,a,s,(T,I,k)=>T.onActivityDeltaEvent?.({event:h,messages:I,state:k,agent:r,input:e,activityMessage:C}));if(c(R),R.stopPropagation!==!0)try{let T=Te(C.content??{}),I=Ac.applyPatch(T,h.patch??[],!0,!1).newDocument;a[y]={...C,content:Te(I),activityType:h.activityType},c({messages:a})}catch(T){let I=T instanceof Error?T.message:String(T);console.warn(`Failed to apply activity patch for '${h.messageId}': ${I}`)}return g()}case M.RAW:return c(yield Oe(n,a,s,(h,y,S)=>h.onRawEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case M.CUSTOM:return c(yield Oe(n,a,s,(h,y,S)=>h.onCustomEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case M.RUN_STARTED:{let h=yield Oe(n,a,s,(y,S,C)=>y.onRunStartedEvent?.({event:v,messages:S,state:C,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let y=v;if(y.input?.messages){for(let S of y.input.messages)a.find(C=>C.id===S.id)||a.push(S);c({messages:a})}}return g()}case M.RUN_FINISHED:return c(yield Oe(n,a,s,(h,y,S)=>h.onRunFinishedEvent?.({event:v,messages:y,state:S,agent:r,input:e,result:v.result}))),g();case M.RUN_ERROR:return c(yield Oe(n,a,s,(h,y,S)=>h.onRunErrorEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case M.STEP_STARTED:return c(yield Oe(n,a,s,(h,y,S)=>h.onStepStartedEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case M.STEP_FINISHED:return c(yield Oe(n,a,s,(h,y,S)=>h.onStepFinishedEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();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 g();case M.THINKING_END:return g();case M.THINKING_TEXT_MESSAGE_START:return g();case M.THINKING_TEXT_MESSAGE_CONTENT:return g();case M.THINKING_TEXT_MESSAGE_END:return g();case M.REASONING_START:return c(yield Oe(n,a,s,(h,y,S)=>h.onReasoningStartEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case M.REASONING_MESSAGE_START:{let h=yield Oe(n,a,s,(y,S,C)=>y.onReasoningMessageStartEvent?.({event:v,messages:S,state:C,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y}=v;if(!a.find(S=>S.id===y)){let S={id:y,role:"reasoning",content:""};a.push(S),c({messages:a})}}return g()}case M.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,S=a.find(R=>R.id===h);if(!S)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let C=yield Oe(n,a,s,(R,T,I)=>R.onReasoningMessageContentEvent?.({event:v,messages:T,state:I,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}));return c(C),C.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${y}`,c({messages:a})),g()}case M.REASONING_MESSAGE_END:{let{messageId:h}=v,y=a.find(S=>S.id===h);return y?(c(yield Oe(n,a,s,(S,C,R)=>S.onReasoningMessageEndEvent?.({event:v,messages:C,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})})),g()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g())}case M.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case M.REASONING_END:return c(yield Oe(n,a,s,(h,y,S)=>h.onReasoningEndEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case M.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:y,encryptedValue:S}=v,C=yield Oe(n,a,s,(R,T,I)=>R.onReasoningEncryptedValueEvent?.({event:v,messages:T,state:I,agent:r,input:e}));if(c(C),C.stopPropagation!==!0){let R=!1;if(h==="tool-call"){for(let T of a)if(T.role==="assistant"&&T.toolCalls){let I=T.toolCalls.find(k=>k.id===y);if(I){I.encryptedValue=S,R=!0;break}}}else{let T=a.find(I=>I.id===y);T?.role!=="activity"&&T&&(T.encryptedValue=S,R=!0)}R&&(l.messages=a)}return g()}}return v.type,g()});return function(_x92){return _ref43.apply(this,arguments)}}()),qp(),n.length>0?Lp({}):v=>v)},nf=e=>t=>{let r=ma(e),n=new Map,o=new Map,i=!1,a=!1,s=!1,l=new Map,c=!1,g=!1,v=!1,E=()=>{n.clear(),o.clear(),l.clear(),c=!1,g=!1,i=!1,a=!1,v=!0};return t.pipe(St(h=>{let y=h.type;if(r?.event("VERIFY","Event:",h,{type:h.type}),a)return qe(()=>new Ue(`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 qe(()=>new Ue(`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 qe(()=>new Ue("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));i&&E()}}else if(s=!0,y!==M.RUN_STARTED&&y!==M.RUN_ERROR)return qe(()=>new Ue("First event must be 'RUN_STARTED'"));switch(y){case M.TEXT_MESSAGE_START:{let S=h.messageId;return n.has(S)?qe(()=>new Ue(`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),Ve(h))}case M.TEXT_MESSAGE_CONTENT:{let S=h.messageId;return n.has(S)?Ve(h):qe(()=>new Ue(`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=h.messageId;return n.has(S)?(n.delete(S),Ve(h)):qe(()=>new Ue(`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=h.toolCallId;return o.has(S)?qe(()=>new Ue(`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),Ve(h))}case M.TOOL_CALL_ARGS:{let S=h.toolCallId;return o.has(S)?Ve(h):qe(()=>new Ue(`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=h.toolCallId;return o.has(S)?(o.delete(S),Ve(h)):qe(()=>new Ue(`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=h.stepName;return l.has(S)?qe(()=>new Ue(`Step "${S}" is already active for 'STEP_STARTED'`)):(l.set(S,!0),Ve(h))}case M.STEP_FINISHED:{let S=h.stepName;return l.has(S)?(l.delete(S),Ve(h)):qe(()=>new Ue(`Cannot send 'STEP_FINISHED' for step "${S}" that was not started`))}case M.RUN_STARTED:return v=!0,Ve(h);case M.RUN_FINISHED:if(l.size>0){let S=Array.from(l.keys()).join(", ");return qe(()=>new Ue(`Cannot send 'RUN_FINISHED' while steps are still active: ${S}`))}if(n.size>0){let S=Array.from(n.keys()).join(", ");return qe(()=>new Ue(`Cannot send 'RUN_FINISHED' while text messages are still active: ${S}`))}if(o.size>0){let S=Array.from(o.keys()).join(", ");return qe(()=>new Ue(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${S}`))}return i=!0,Ve(h);case M.RUN_ERROR:return a=!0,Ve(h);case M.CUSTOM:return Ve(h);case M.THINKING_TEXT_MESSAGE_START:return c?g?qe(()=>new Ue("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(g=!0,Ve(h)):qe(()=>new Ue("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 g?Ve(h):qe(()=>new Ue("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 g?(g=!1,Ve(h)):qe(()=>new Ue("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 c?qe(()=>new Ue("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(c=!0,Ve(h));case M.THINKING_END:return c?(c=!1,Ve(h)):qe(()=>new Ue("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Ve(h)}}))},Dn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),kk=(e,t)=>Qc(()=>Pn(w(e,t))).pipe(Up(r=>{if(!r.ok){let i=r.headers.get("content-type")||"";return Pn(r.text()).pipe(St(a=>{let s=a;if(i.includes("application/json"))try{s=JSON.parse(a)}catch{}let l=Error(`HTTP ${r.status}: ${typeof s=="string"?s:JSON.stringify(s)}`);return l.status=r.status,l.payload=s,qe(()=>l)}))}let n={type:Dn.HEADERS,status:r.status,headers:r.headers},o=r.body?.getReader();return o?new je(i=>(i.next(n),_asyncToGenerator(function*(){try{for(;;){let{done:a,value:s}=yield o.read();if(a)break;let l={type:Dn.DATA,data:s};i.next(l)}i.complete()}catch(a){i.error(a)}})(),()=>{o.cancel().catch(a=>{if(a?.name!=="AbortError")throw a})})):qe(()=>Error("Failed to getReader() from response"))})),Ok=(e,t)=>{let r=ma(t),n=new tr,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:s=>{if(s.type!==Dn.HEADERS&&s.type===Dn.DATA&&s.data){let l=o.decode(s.data,{stream:!0});i+=l;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 l=s.split(`
|
|
39
|
+
Error: ${C}`)}}return g()}case M.MESSAGES_SNAPSHOT:{let h=yield Oe(n,a,s,(y,S,C)=>y.onMessagesSnapshotEvent?.({event:v,messages:S,state:C,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messages:y}=v,S=new Map(y.map(T=>[T.id,T])),C=T=>T==="activity"||T==="reasoning";a=a.filter(T=>C(T.role)||S.has(T.id)).map(T=>C(T.role)?T:S.get(T.id));let R=new Set(a.map(T=>T.id));for(let T of y)R.has(T.id)||a.push(T);c({messages:a})}return g()}case M.ACTIVITY_SNAPSHOT:{let h=v,y=a.findIndex(I=>I.id===h.messageId),S=y>=0?a[y]:void 0,C=S?.role==="activity"?S:void 0,R=h.replace??!0,T=yield Oe(n,a,s,(I,k,_)=>I.onActivitySnapshotEvent?.({event:h,messages:k,state:_,agent:r,input:e,activityMessage:C,existingMessage:S}));if(c(T),T.stopPropagation!==!0){let I={id:h.messageId,role:"activity",activityType:h.activityType,content:Te(h.content)},k;y===-1?(a.push(I),k=I):C?R&&(a[y]={...C,activityType:h.activityType,content:Te(h.content)}):R&&(a[y]=I,k=I),c({messages:a}),k&&(yield Promise.all(n.map(_=>_.onNewMessage?.({message:k,messages:a,state:s,agent:r,input:e}))))}return g()}case M.ACTIVITY_DELTA:{let h=v,y=a.findIndex(T=>T.id===h.messageId);if(y===-1)return g();let S=a[y];if(S.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let C=S,R=yield Oe(n,a,s,(T,I,k)=>T.onActivityDeltaEvent?.({event:h,messages:I,state:k,agent:r,input:e,activityMessage:C}));if(c(R),R.stopPropagation!==!0)try{let T=Te(C.content??{}),I=Ac.applyPatch(T,h.patch??[],!0,!1).newDocument;a[y]={...C,content:Te(I),activityType:h.activityType},c({messages:a})}catch(T){let I=T instanceof Error?T.message:String(T);console.warn(`Failed to apply activity patch for '${h.messageId}': ${I}`)}return g()}case M.RAW:return c(yield Oe(n,a,s,(h,y,S)=>h.onRawEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case M.CUSTOM:return c(yield Oe(n,a,s,(h,y,S)=>h.onCustomEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case M.RUN_STARTED:{let h=yield Oe(n,a,s,(y,S,C)=>y.onRunStartedEvent?.({event:v,messages:S,state:C,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let y=v;if(y.input?.messages){for(let S of y.input.messages)a.find(C=>C.id===S.id)||a.push(S);c({messages:a})}}return g()}case M.RUN_FINISHED:return c(yield Oe(n,a,s,(h,y,S)=>h.onRunFinishedEvent?.({event:v,messages:y,state:S,agent:r,input:e,result:v.result}))),g();case M.RUN_ERROR:return c(yield Oe(n,a,s,(h,y,S)=>h.onRunErrorEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case M.STEP_STARTED:return c(yield Oe(n,a,s,(h,y,S)=>h.onStepStartedEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case M.STEP_FINISHED:return c(yield Oe(n,a,s,(h,y,S)=>h.onStepFinishedEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();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 g();case M.THINKING_END:return g();case M.THINKING_TEXT_MESSAGE_START:return g();case M.THINKING_TEXT_MESSAGE_CONTENT:return g();case M.THINKING_TEXT_MESSAGE_END:return g();case M.REASONING_START:return c(yield Oe(n,a,s,(h,y,S)=>h.onReasoningStartEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case M.REASONING_MESSAGE_START:{let h=yield Oe(n,a,s,(y,S,C)=>y.onReasoningMessageStartEvent?.({event:v,messages:S,state:C,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y}=v;if(!a.find(S=>S.id===y)){let S={id:y,role:"reasoning",content:""};a.push(S),c({messages:a})}}return g()}case M.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,S=a.find(R=>R.id===h);if(!S)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let C=yield Oe(n,a,s,(R,T,I)=>R.onReasoningMessageContentEvent?.({event:v,messages:T,state:I,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}));return c(C),C.stopPropagation!==!0&&(S.content=`${typeof S.content=="string"?S.content:""}${y}`,c({messages:a})),g()}case M.REASONING_MESSAGE_END:{let{messageId:h}=v,y=a.find(S=>S.id===h);return y?(c(yield Oe(n,a,s,(S,C,R)=>S.onReasoningMessageEndEvent?.({event:v,messages:C,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})})),g()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g())}case M.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case M.REASONING_END:return c(yield Oe(n,a,s,(h,y,S)=>h.onReasoningEndEvent?.({event:v,messages:y,state:S,agent:r,input:e}))),g();case M.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:y,encryptedValue:S}=v,C=yield Oe(n,a,s,(R,T,I)=>R.onReasoningEncryptedValueEvent?.({event:v,messages:T,state:I,agent:r,input:e}));if(c(C),C.stopPropagation!==!0){let R=!1;if(h==="tool-call"){for(let T of a)if(T.role==="assistant"&&T.toolCalls){let I=T.toolCalls.find(k=>k.id===y);if(I){I.encryptedValue=S,R=!0;break}}}else{let T=a.find(I=>I.id===y);T?.role!=="activity"&&T&&(T.encryptedValue=S,R=!0)}R&&(l.messages=a)}return g()}}return v.type,g()});return function(_x92){return _ref43.apply(this,arguments)}}()),jp(),n.length>0?Lp({}):v=>v)},nf=e=>t=>{let r=ma(e),n=new Map,o=new Map,i=!1,a=!1,s=!1,l=new Map,c=!1,g=!1,v=!1,E=()=>{n.clear(),o.clear(),l.clear(),c=!1,g=!1,i=!1,a=!1,v=!0};return t.pipe(St(h=>{let y=h.type;if(r?.event("VERIFY","Event:",h,{type:h.type}),a)return je(()=>new Ue(`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 je(()=>new Ue(`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 je(()=>new Ue("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));i&&E()}}else if(s=!0,y!==M.RUN_STARTED&&y!==M.RUN_ERROR)return je(()=>new Ue("First event must be 'RUN_STARTED'"));switch(y){case M.TEXT_MESSAGE_START:{let S=h.messageId;return n.has(S)?je(()=>new Ue(`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),Ve(h))}case M.TEXT_MESSAGE_CONTENT:{let S=h.messageId;return n.has(S)?Ve(h):je(()=>new Ue(`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=h.messageId;return n.has(S)?(n.delete(S),Ve(h)):je(()=>new Ue(`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=h.toolCallId;return o.has(S)?je(()=>new Ue(`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),Ve(h))}case M.TOOL_CALL_ARGS:{let S=h.toolCallId;return o.has(S)?Ve(h):je(()=>new Ue(`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=h.toolCallId;return o.has(S)?(o.delete(S),Ve(h)):je(()=>new Ue(`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=h.stepName;return l.has(S)?je(()=>new Ue(`Step "${S}" is already active for 'STEP_STARTED'`)):(l.set(S,!0),Ve(h))}case M.STEP_FINISHED:{let S=h.stepName;return l.has(S)?(l.delete(S),Ve(h)):je(()=>new Ue(`Cannot send 'STEP_FINISHED' for step "${S}" that was not started`))}case M.RUN_STARTED:return v=!0,Ve(h);case M.RUN_FINISHED:if(l.size>0){let S=Array.from(l.keys()).join(", ");return je(()=>new Ue(`Cannot send 'RUN_FINISHED' while steps are still active: ${S}`))}if(n.size>0){let S=Array.from(n.keys()).join(", ");return je(()=>new Ue(`Cannot send 'RUN_FINISHED' while text messages are still active: ${S}`))}if(o.size>0){let S=Array.from(o.keys()).join(", ");return je(()=>new Ue(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${S}`))}return i=!0,Ve(h);case M.RUN_ERROR:return a=!0,Ve(h);case M.CUSTOM:return Ve(h);case M.THINKING_TEXT_MESSAGE_START:return c?g?je(()=>new Ue("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(g=!0,Ve(h)):je(()=>new Ue("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 g?Ve(h):je(()=>new Ue("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 g?(g=!1,Ve(h)):je(()=>new Ue("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 c?je(()=>new Ue("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(c=!0,Ve(h));case M.THINKING_END:return c?(c=!1,Ve(h)):je(()=>new Ue("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Ve(h)}}))},Dn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),kk=(e,t)=>Qc(()=>Pn(w(e,t))).pipe(Up(r=>{if(!r.ok){let i=r.headers.get("content-type")||"";return Pn(r.text()).pipe(St(a=>{let s=a;if(i.includes("application/json"))try{s=JSON.parse(a)}catch{}let l=Error(`HTTP ${r.status}: ${typeof s=="string"?s:JSON.stringify(s)}`);return l.status=r.status,l.payload=s,je(()=>l)}))}let n={type:Dn.HEADERS,status:r.status,headers:r.headers},o=r.body?.getReader();return o?new qe(i=>(i.next(n),_asyncToGenerator(function*(){try{for(;;){let{done:a,value:s}=yield o.read();if(a)break;let l={type:Dn.DATA,data:s};i.next(l)}i.complete()}catch(a){i.error(a)}})(),()=>{o.cancel().catch(a=>{if(a?.name!=="AbortError")throw a})})):je(()=>Error("Failed to getReader() from response"))})),Ok=(e,t)=>{let r=ma(t),n=new tr,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:s=>{if(s.type!==Dn.HEADERS&&s.type===Dn.DATA&&s.data){let l=o.decode(s.data,{stream:!0});i+=l;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 l=s.split(`
|
|
40
40
|
`),c=[];for(let g of l)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()},Pk=e=>{let t=new tr,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==Dn.HEADERS&&o.type===Dn.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=VS(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()},Nk=(e,t)=>{let r=ma(t),n=new tr,o=new kc,i=!1;return e.subscribe({next:a=>{if(o.next(a),a.type===Dn.HEADERS&&!i){i=!0;let s=a.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:s,parser:s===Jp?"protobuf":"sse"}),s===Jp?Pk(o).subscribe({next:l=>n.next(l),error:l=>n.error(l),complete:()=>n.complete()}):Ok(o,r).subscribe({next:l=>{try{let c=mc.parse(l);r?.event("HTTP","Event validated:",c,{type:c.type,valid:!0}),n.next(c)}catch(c){r?.event("HTTP","Event invalid:",{json:l,error:String(c)}),n.error(c)}},error:l=>{if(l?.name==="AbortError"){n.next({type:M.RUN_ERROR,message:l.message||"Request aborted",code:"abort",rawEvent:l}),n.complete();return}return n.error(l)},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()},De=A.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),Fk=A.enum(["LangGraphInterruptEvent","PredictState","Exit"]),Dk=A.object({type:A.literal(De.enum.TextMessageStart),messageId:A.string(),parentMessageId:A.string().optional(),role:A.string().optional()}),Mk=A.object({type:A.literal(De.enum.TextMessageContent),messageId:A.string(),content:A.string()}),
|
|
42
|
-
`)},Hk=(e,t,r)=>n=>{let o={},i=!0,a=!0,s="",l=null,c=null,g=[],v={},E=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(St(h=>{switch(h.type){case M.TEXT_MESSAGE_START:{let y=h;return[{type:De.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case M.TEXT_MESSAGE_CONTENT:{let y=h;return[{type:De.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case M.TEXT_MESSAGE_END:{let y=h;return[{type:De.enum.TextMessageEnd,messageId:y.messageId}]}case M.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:De.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case M.TOOL_CALL_ARGS:{let y=h,S=g.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 C=!1;if(c){let R=c.find(T=>T.tool==S.function.name);if(R)try{let T=JSON.parse(Wc(S.function.arguments));R.tool_argument&&R.tool_argument in T?(E({...o,[R.state_key]:T[R.tool_argument]}),C=!0):R.tool_argument||(E({...o,[R.state_key]:T}),C=!0)}catch{}}return[{type:De.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(C?[{type:De.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=h;return[{type:De.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case M.TOOL_CALL_RESULT:{let y=h;return[{type:De.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:v[y.toolCallId]||"unknown"}]}case M.RAW:return[];case M.CUSTOM:{let y=h;switch(y.name){case"Exit":i=!1;break;case"PredictState":c=y.value;break}return[{type:De.enum.MetaEvent,name:y.name,value:y.value}]}case M.STATE_SNAPSHOT:return E(h.snapshot),[{type:De.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=h,S=Ac.applyPatch(o,y.delta,!0,!1);return S?(E(S.newDocument),[{type:De.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 l=h.messages,[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(l?{messages:l}:{})}),active:!0}];case M.RUN_STARTED:return[];case M.RUN_FINISHED:return l&&(o.messages=l),Object.keys(o).length===0?[]:[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(l?{messages:zk(l)}:{})}),active:!1}];case M.RUN_ERROR:{let y=h;return[{type:De.enum.RunError,message:y.message,code:y.code}]}case M.STEP_STARTED:return s=h.stepName,g=[],c=null,[{type:De.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 g=[],c=null,[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function zk(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=Qk(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 _u=e=>t=>{let r=ma(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},l=()=>{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},c=()=>{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},g=()=>a==="text"?[s()]:a==="tool"?[l()]:a==="reasoning"?[c()]:[];return t.pipe(St(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[...g(),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 E=v,h=[];if((a!=="text"||E.messageId!==void 0&&E.messageId!==n?.messageId)&&h.push(...g()),a!=="text"){if(E.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");n={messageId:E.messageId,name:E.name},a="text";let T={type:M.TEXT_MESSAGE_START,messageId:E.messageId,role:E.role||"assistant",...(E.name!==void 0&&{name:E.name})};h.push(T),r?.event("TRANSFORM","TEXT_MESSAGE_START",T,{messageId:E.messageId})}if(E.delta!==void 0){let T={type:M.TEXT_MESSAGE_CONTENT,messageId:n.messageId,delta:E.delta};h.push(T),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",T,{messageId:n.messageId})}return h;case M.TOOL_CALL_CHUNK:let y=v,S=[];if((a!=="tool"||y.toolCallId!==void 0&&y.toolCallId!==o?.toolCallId)&&S.push(...g()),a!=="tool"){if(y.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(y.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");o={toolCallId:y.toolCallId,toolCallName:y.toolCallName,parentMessageId:y.parentMessageId},a="tool";let T={type:M.TOOL_CALL_START,toolCallId:y.toolCallId,toolCallName:y.toolCallName,parentMessageId:y.parentMessageId};S.push(T),r?.event("TRANSFORM","TOOL_CALL_START",T,{toolCallId:y.toolCallId,toolCallName:y.toolCallName})}if(y.delta!==void 0){let T={type:M.TOOL_CALL_ARGS,toolCallId:o.toolCallId,delta:y.delta};S.push(T),r?.event("TRANSFORM","TOOL_CALL_ARGS",T,{toolCallId:o.toolCallId})}return S;case M.REASONING_MESSAGE_CHUNK:let C=v,R=[];if((a!=="reasoning"||C.messageId&&C.messageId!==i?.messageId)&&R.push(...g()),a!=="reasoning"){if(C.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");i={messageId:C.messageId},a="reasoning";let T={type:M.REASONING_MESSAGE_START,messageId:C.messageId};R.push(T),r?.event("TRANSFORM","REASONING_MESSAGE_START",T,{messageId:C.messageId})}if(C.delta!==void 0){let T={type:M.REASONING_MESSAGE_CONTENT,messageId:i.messageId,delta:C.delta};R.push(T),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",T,{messageId:i.messageId})}return R}return v.type,[]}),Fn(()=>{g()}))},ku=class{runNext(e,t){return t.run(e).pipe(_u(!1))}runNextWithState(e,t){let r=Te(e.messages||[]),n=Te(e.state||{}),o=new kc;return KS(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(Hc(/*#__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)}}()))}},Wk=class extends ku{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function Kk(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 Yk=class extends ku{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(Kk)};return this.runNext(o,t)}},$S="THINKING_START",QS="THINKING_END",HS="THINKING_TEXT_MESSAGE_START",zS="THINKING_TEXT_MESSAGE_CONTENT",WS="THINKING_TEXT_MESSAGE_END",Xk=class extends ku{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(Nn(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case $S:{this.currentReasoningId=fa();let{title:t,...r}=e;return this.warnAboutTransformation($S,M.REASONING_START),{...r,type:M.REASONING_START,messageId:this.currentReasoningId}}case HS:return this.currentMessageId=fa(),this.warnAboutTransformation(HS,M.REASONING_MESSAGE_START),{...e,type:M.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case zS:{let{delta:t,...r}=e;return this.warnAboutTransformation(zS,M.REASONING_MESSAGE_CONTENT),{...r,type:M.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??fa(),delta:t}}case WS:{let t=this.currentMessageId??fa();return this.warnAboutTransformation(WS,M.REASONING_MESSAGE_END),{...e,type:M.REASONING_MESSAGE_END,messageId:t}}case QS:{let t=this.currentReasoningId??fa();return this.warnAboutTransformation(QS,M.REASONING_END),{...e,type:M.REASONING_END,messageId:t}}default:return e}}};function Zk(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function Jk(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function eO(e){let t=Zk(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 tO(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>Jk(n)?eO(n):n);return{...e,content:r}}var rO=class extends ku{run(e,t){let r={...e,messages:e.messages.map(tO)};return this.runNext(r,t)}},nO="0.0.53",oO=class{get maxVersion(){return nO}get debug(){return this._debug}set debug(e){this._debug=Tu(e),this._debugLogger=rf(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?rf(Tu(!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.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??Dr(),this.messages=Te(n??[]),this.state=Te(o??{}),this._debug=Tu(i),this._debugLogger=rf(this._debug),pa(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new Yk),pa(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new Xk),pa(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new rO)}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 Wk(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??Dr();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(l=>l.id)),i=[{onRunFinishedEvent:l=>{n=l.result}},..._this14.subscribers,t??{}];yield _this14.onInitialize(r,i),_this14.activeRunDetach$=new tr;let a;_this14.activeRunCompletionPromise=new Promise(l=>{a=l}),yield $c(_c(()=>_this14.middlewares.length===0?_this14.run(r):_this14.middlewares.reduceRight((l,c)=>({run:g=>c.run(g,l),get messages(){return l.messages},get state(){return l.state}}),_this14).run(r),_u(_this14.debugLogger),nf(_this14.debugLogger),l=>l.pipe(zc(_this14.activeRunDetach$)),l=>_this14.apply(r,l,i),l=>_this14.processApplyEvents(r,l,i),ua(l=>(_this14.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this14.agentId,error:l instanceof Error?l.message:String(l)}),_this14.isRunning=!1,_this14.onError(r,l,i))),Fn(()=>{_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}))(Ve(null)));let s=Te(_this14.messages).filter(l=>!o.has(l.id));return{result:n,newMessages:s}}finally{_this14.isRunning=!1}})()}connect(e){throw new Ep}connectAgent(e,t){var _this15=this;return _asyncToGenerator(function*(){try{_this15.isRunning=!0,_this15.agentId=_this15.agentId??Dr();let r=_this15.prepareRunAgentInput(e),n,o=new Set(_this15.messages.map(l=>l.id)),i=[{onRunFinishedEvent:l=>{n=l.result}},..._this15.subscribers,t??{}];yield _this15.onInitialize(r,i),_this15.activeRunDetach$=new tr;let a;_this15.activeRunCompletionPromise=new Promise(l=>{a=l}),yield $c(_c(()=>Qc(()=>_this15.connect(r)),_u(_this15.debugLogger),nf(_this15.debugLogger),l=>l.pipe(zc(_this15.activeRunDetach$)),l=>_this15.apply(r,l,i),l=>_this15.processApplyEvents(r,l,i),ua(l=>(_this15.isRunning=!1,l instanceof Ep?Oc:_this15.onError(r,l,i))),Fn(()=>{_this15.isRunning=!1,_this15.onFinalize(r,i),a?.(),a=void 0,_this15.activeRunCompletionPromise=void 0,_this15.activeRunDetach$=void 0}))(Ve(null)),{defaultValue:void 0});let s=Te(_this15.messages).filter(l=>!o.has(l.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 KS(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(Vp(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).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Dr(),tools:Te(e?.tools??[]),context:Te(e?.context??[]),forwardedProps:Te(e?.forwardedProps??{}),state:Te(this.state),messages:t}}onInitialize(e,t){var _this17=this;return _asyncToGenerator(function*(){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 Pn(Oe(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(Nn(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=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}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??Dr();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(_u(this.debugLogger),nf(this.debugLogger),Hk(this.threadId,t.runId,this.agentId),r=>r.pipe(Nn(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}},YS=class extends oO{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 u.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new u.AbortController,this.url=e.url,this.headers=Te(e.headers??{})}run(e){return Nk(kk(this.url,this.requestInit(e)),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Te(this.headers??{});let t=new u.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};m();d();f();p();var XS=(e,t,r)=>{let n=Et(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let i=`/api/preview/organizations/${t}/agents`;return`${n}${i}/${o}`};var sf=class extends YS{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}}},ZS=(e,t,r)=>new sf({url:`${XS(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var iO=new z({required:!0}),JS=new z({required:!0,constrainTo:ec}),eb=e=>({...e,name:tc(e.name)}),tb=N("followUpAnswers/setIsEnabled",e=>$(e,new me({required:!0}))),rb=N("followUpAnswers/setFollowUpAnswersConversationId",e=>$(e,Z)),nb=N("followUpAnswers/setFollowUpAnswersConversationToken",e=>$(e,Z)),ob=N("followUpAnswers/clearFollowUpAnswersConversationToken"),Hte=N("followUpAnswers/createFollowUpAnswer",e=>$(e,{question:Z})),zte=N("followUpAnswers/setActiveFollowUpAnswerId",e=>$(e,Z)),Wte=N("followUpAnswers/setFollowUpAnswerContentFormat",e=>$(e,{contentFormat:rc,answerId:Z})),Kte=N("followUpAnswers/setFollowUpIsLoading",e=>$(e,{isLoading:new me({required:!0}),answerId:Z})),Yte=N("followUpAnswers/setFollowUpIsStreaming",e=>$(e,{isStreaming:new me({required:!0}),answerId:Z})),Xte=N("followUpAnswers/followUpMessageChunkReceived",e=>$(e,{textDelta:iO,answerId:Z})),Zte=N("followUpAnswers/followUpCitationsReceived",e=>$(e,{citations:new ve({required:!0,each:new ne({values:dp})}),answerId:Z})),Jte=N("followUpAnswers/followUpCompleted",e=>$(e,{answerId:Z,cannotAnswer:new me({required:!1})})),ere=N("followUpAnswers/followUpFailed",e=>$(e,{message:new z,code:new oe({min:0}),answerId:Z})),tre=N("followUpAnswers/activeFollowUpStartFailed",e=>$(e,{message:new z})),rre=N("followUpAnswers/likeFollowUp",e=>$(e,{answerId:Z})),nre=N("followUpAnswers/dislikeFollowUp",e=>$(e,{answerId:Z})),ore=N("followUpAnswers/submitFollowUpFeedback",e=>$(e,{answerId:Z})),ib=N("followUpAnswers/resetFollowUpAnswers"),ire=N("followUpAnswers/stepStarted",e=>$(eb(e),{answerId:Z,name:JS,startedAt:new oe({min:0,required:!0})})),are=N("followUpAnswers/stepFinished",e=>$(eb(e),{answerId:Z,name:JS,finishedAt:new oe({min:0,required:!0})}));m();d();f();p();var aO={"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 ab(e){return e?aO[e]??1004:1004}var sb=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(nc(n.runId)),e(Fr(!1)),e(Wi(!0)),e(rb(n.threadId)),e(ob())},onStepStartedEvent:({event:n})=>{e(Uy({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n})=>{e(Vy({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onTextMessageContentEvent:({event:n})=>{n.delta.length>0&&(r=!0),e(Ki({textDelta:n.delta}))},onCustomEvent:({event:n})=>{let{name:o,value:i}=n;switch(o){case"header":{i?.contentFormat&&e(Zi(i.contentFormat)),typeof i?.followUpEnabled=="boolean"&&e(tb(i.followUpEnabled)),i?.conversationToken&&e(nb(i.conversationToken));return}case"citations":{e(Yi({citations:i.citations}));return}}},onRunErrorEvent:({event:n})=>{let o=ab(n.code);e(Xi({message:n.message,code:o}))},onRunFinishedEvent:({event:n})=>{let o=n.result?.completionReason==="ANSWERED",i=o?!r:void 0;e(pp(o)),e(Ji(!o)),e(Wi(!1)),e(wo(o,t,i)),e(Ao())}}};var cb=()=>{let e,t=()=>{e?.abortRun(),e=void 0};return{run:function(){var _ref50=_asyncToGenerator(function*(n,o,i){t();let a=Ds(n),s=Xg(n),l=Zg(n),c=Yg(n),g=Jg(n),v=ZS(a,s,l);e=v;let E=sb(o),h=Ny(n,i());try{o(Fr(!0)),yield v.runAgent({forwardedProps:{params:h,accessToken:c,recordDebugSession:g}},E)}catch(y){o(Fr(!1)),o(Xi({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 Ou=N("breadcrumb/deselectAll"),ub=N("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var lb=N("facet/updateFacetAutoSelection",e=>$(e,{allow:new me({required:!0})}));m();d();f();p();m();d();f();p();var Pu=class extends Ir{constructor(r){super(r);ie(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??At().q}get responseTime(){return this.activeInstantResultCache?.duration??$t().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??$t().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var db=()=>ft("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Pu(e)),pb=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var cf={id:Z},sO={...cf,q:tt},hne=N("instantResults/register",e=>$(e,cf)),Nu=N("instantResults/updateQuery",e=>$(e,sO)),yne=N("instantResults/clearExpired",e=>$(e,cf));m();d();f();p();var Fu=new oe({required:!0,min:0}),Du=N("pagination/registerNumberOfResults",e=>$(e,Fu)),Mu=N("pagination/updateNumberOfResults",e=>$(e,Fu)),ju=N("pagination/registerPage",e=>$(e,Fu)),$o=N("pagination/updatePage",e=>$(e,Fu)),qu=N("pagination/nextPage"),Lu=N("pagination/previousPage");m();d();f();p();var Qo=N("query/updateQuery",e=>$(e,{q:new z,enableQuerySyntax:new me}));m();d();f();p();m();d();f();p();m();d();f();p();var Vr=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var uf=()=>ft("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),Br=e=>ft("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||At().q,aq:r.advancedSearchQueries?.aq||Vr().aq,cq:r.advancedSearchQueries?.cq||Vr().cq,dq:r.advancedSearchQueries?.dq||Vr().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();var toe=N("didYouMean/enable"),roe=N("didYouMean/disable"),noe=N("didYouMean/automaticCorrections/disable"),ooe=N("didYouMean/automaticCorrections/enable"),Uu=N("didYouMean/correction",e=>$(e,Z)),ioe=N("didYouMean/automaticCorrections/mode",e=>$(e,new z({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var lf=()=>ft("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var fb=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function Vu(){return{contextValues:{}}}m();d();f();p();function Bu(){return{contextValues:{}}}m();d();f();p();function mb(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function gb(){return[]}m();d();f();p();function ga(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function hb(){return{}}m();d();f();p();function yb(){return{}}m();d();f();p();function vb(){return{}}function rr(e){return{context:e.context||Vu(),dictionaryFieldContext:e.dictionaryFieldContext||Bu(),facetSet:e.facetSet||Fs(),numericFacetSet:e.numericFacetSet||Ns(),dateFacetSet:e.dateFacetSet||Ps(),categoryFacetSet:e.categoryFacetSet||Os(),automaticFacetSet:e.automaticFacetSet??ks(),pagination:e.pagination||ga(),query:e.query||At(),tabSet:e.tabSet||vb(),advancedSearchQueries:e.advancedSearchQueries||Vr(),staticFilterSet:e.staticFilterSet||yb(),querySet:e.querySet||hb(),sortCriteria:e.sortCriteria||Ms(),pipeline:e.pipeline||no(),searchHub:e.searchHub||fo(),facetOptions:e.facetOptions||mb(),facetOrder:e.facetOrder??gb(),debug:e.debug??ds()}}m();d();f();p();var Oie=new ne({values:{undoneQuery:tt},options:{required:!0}}),Sb=()=>ft("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var Gu=N("trigger/query/ignore",e=>$(e,new z({emptyAllowed:!0,required:!0}))),$u=N("trigger/query/modification",e=>$(e,new ne({values:{originalQuery:et,modification:et}})));m();d();f();p();var Gr=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=lO(e),n=Zs(e),o=cO(e),i=yield Pr(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return kr({...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 Gr(_x97,_x98){return _ref51.apply(this,arguments)}}();function cO(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(uO).filter(r=>r.currentValues.length>0):void 0}function uO(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function lO(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=dO(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function dO(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 $r=class{constructor(t,r=n=>{this.dispatch(Qo({q:n}))}){ie(this,"config",t);ie(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x99,_x100){var _this23=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Xs(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 gt(t.response)?(this.dispatch(Br(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:l}=n;if(!o||!i)return null;let c=a.length===0&&s&&s.length!==0,g=!ce(l)&&!ce(l.correctedQuery);if(!c&&!g)return null;let E=c?yield _this25.processLegacyDidYouMeanAutoCorrection(t):_this25.processModernDidYouMeanAutoCorrection(t);return _this25.dispatch(Wt(rr(_this25.getState()))),E})()}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 gt(i.response)?(_this26.dispatch(Br(i.response.error)),_this26.rejectWithValue(i.response.error)):(_this26.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this26.dispatch(Wt(rr(_this26.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:lf()})})()}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:lf()}}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(Gu("")),null;_this27.analyticsAction&&(yield _this27.dispatch(_this27.analyticsAction));let i=_this27.getCurrentQuery(),a=yield _this27.automaticallyRetryQueryWithTriggerModification(n);return gt(a.response)?(_this27.dispatch(Br(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(Wt(rr(_this27.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:Sb()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??At().enableQuerySyntax},search:{...$t(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Wt(rr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Da(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this28=this;return _asyncToGenerator(function*(){_this28.onUpdateQueryForCorrection(t);let r=yield _this28.fetchFromAPI(yield Gr(_this28.getState()),{origin:"mainSearch"});return _this28.dispatch(Uu(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this29=this;return _asyncToGenerator(function*(){return _this29.dispatch($u({newQuery:t,originalQuery:_this29.getCurrentQuery()})),_this29.onUpdateQueryForCorrection(t),yield _this29.fetchFromAPI(yield Gr(_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 Oae=Re("search/executeSearch",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Qu(r,t,e)});return function(_x101,_x102){return _ref52.apply(this,arguments)}}()),Pae=Re("search/fetchPage",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();return yield pf(r,t,e)});return function(_x103,_x104){return _ref53.apply(this,arguments)}}()),Nae=Re("search/fetchMoreResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();return yield ff(t,r)});return function(_x105,_x106){return _ref54.apply(this,arguments)}}()),Fae=Re("search/fetchFacetValues",/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t){let r=t.getState();return yield gO(t,e,r)});return function(_x107,_x108){return _ref55.apply(this,arguments)}}()),Dae=Re("search/fetchInstantResults",/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){return df(e,t)});return function(_x109,_x110){return _ref56.apply(this,arguments)}}()),pO=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=yield Gr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function pO(_x111,_x112){return _ref57.apply(this,arguments)}}(),fO=/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t,r){let n=yield Pr(e);return kr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function fO(_x113,_x114,_x115){return _ref58.apply(this,arguments)}}(),mO=/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=yield Gr(e,t);return r.request.numberOfResults=0,r});return function mO(_x116,_x117){return _ref59.apply(this,arguments)}}(),bb=e=>{e.configuration.analytics.enabled&&It.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function df(_x118,_x119){return _df.apply(this,arguments)}function _df(){_df=_asyncToGenerator(function*(e,t){$(e,{id:Z,q:Z,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new $r({...t,analyticsAction:db()},c=>{t.dispatch(Nu({q:c,id:e.id}))}),a=yield fO(o,r,n),s=yield i.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),l=yield i.process(s);return"response"in l?{results:l.response.results,searchUid:l.response.searchUid,analyticsAction:l.analyticsAction,totalCountFiltered:l.response.totalCountFiltered,duration:l.duration}:l});return _df.apply(this,arguments)}function pf(_x120,_x121,_x122){return _pf.apply(this,arguments)}function _pf(){_pf=_asyncToGenerator(function*(e,t,r){bb(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 $r({...t,analyticsAction:r}),l=yield Gr(e,a),c=yield s.fetchFromAPI(l,{origin:"mainSearch"});return yield s.process(c)});return _pf.apply(this,arguments)}function ff(_x123,_x124){return _ff.apply(this,arguments)}function _ff(){_ff=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield uf().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new $r({...e,analyticsAction:uf()}),s=yield pO(t,i),l=yield a.fetchFromAPI(s,{origin:"mainSearch"});return yield a.process(l)});return _ff.apply(this,arguments)}function gO(_x125,_x126,_x127){return _gO.apply(this,arguments)}function _gO(){_gO=_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 $r({...e,analyticsAction:t}),l=yield mO(r,a),c=yield s.fetchFromAPI(l,{origin:"facetValues"});return yield s.process(c)});return _gO.apply(this,arguments)}function Qu(_x128,_x129,_x130){return _Qu.apply(this,arguments)}function _Qu(){_Qu=_asyncToGenerator(function*(e,t,r){bb(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 Gr(e,a),l=new $r({...t,analyticsAction:r}),c=yield l.fetchFromAPI(s,{origin:"mainSearch"});return yield l.process(c)});return _Qu.apply(this,arguments)}m();d();f();p();var Qr=class{constructor(t,r=n=>{this.dispatch(Qo({q:n}))}){ie(this,"config",t);ie(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x131,_x132){var _this30=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Xs(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 gt(t.response)?(this.dispatch(Br(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:l}=n;if(!o||!i)return null;let c=a.length===0&&s&&s.length!==0,g=!ce(l)&&!ce(l.correctedQuery);if(!c&&!g)return null;let E=c?yield _this32.processLegacyDidYouMeanAutoCorrection(t):_this32.processModernDidYouMeanAutoCorrection(t);return _this32.dispatch(Wt(rr(_this32.getState()))),E})()}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 gt(i.response)?(_this33.dispatch(Br(i.response.error)),_this33.rejectWithValue(i.response.error)):(_this33.dispatch(Wt(rr(_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(Gu("")),null;let i=_this34.getCurrentQuery(),a=yield _this34.automaticallyRetryQueryWithTriggerModification(n);return gt(a.response)?(_this34.dispatch(Br(a.response.error)),_this34.rejectWithValue(a.response.error)):(_this34.dispatch(Wt(rr(_this34.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Wt(rr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Da(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this35=this;return _asyncToGenerator(function*(){_this35.onUpdateQueryForCorrection(t);let r=_this35.getState(),{actionCause:n}=fb(),o=yield _this35.fetchFromAPI(yield Nr(r,_this35.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this35.dispatch(Uu(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this36=this;return _asyncToGenerator(function*(){return _this36.dispatch($u({newQuery:t,originalQuery:_this36.getCurrentQuery()})),_this36.onUpdateQueryForCorrection(t),yield _this36.fetchFromAPI(yield Nr(_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 wse=Re("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;$(e,{q:new z,enableQuerySyntax:new me,clearFilters:new me}),e.clearFilters&&(r(Ou()),r(ub())),r(lb({allow:!0})),r(Qo({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r($o(1))}),Ase=N("search/updateSearchAction"),Hu=Re("search/executeSearch",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Qu(r,t,e.legacy);Ab(r);let n=e.next?xb(e.next):void 0,o=yield Nr(r,t.extra.navigatorContext,n),i=new Qr({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x133,_x134){return _ref60.apply(this,arguments)}}()),wb=Re("search/fetchPage",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(Ab(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return pf(r,t,e.legacy);let n=new Qr({...t,analyticsAction:e.next}),o=yield Nr(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)}}()),xse=Re("search/fetchMoreResults",/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return ff(t,r);let n=bh("browseResults",t.getState),o=new Qr({...t,analyticsAction:n}),i=yield hO(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)}}()),Cse=Re("search/fetchFacetValues",/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Qu(r,t,e.legacy);let n=new Qr({...t,analyticsAction:{}}),o=yield vO(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)}}()),Ese=Re("search/fetchInstantResults",/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return df(e,t);$(e,{id:Z,q:Z,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:n,maxResultsPerQuery:o}=e,i=xb(pb()),a=yield yO(r,t.extra.navigatorContext,n,o,i),s=new Qr({...t,analyticsAction:i},g=>{t.dispatch(Nu({q:g,id:e.id}))}),l=yield s.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),c=yield s.process(l);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)}}()),hO=/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t,r){let n=yield Nr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function hO(_x143,_x144,_x145){return _ref65.apply(this,arguments)}}(),yO=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(e,t,r,n,o){let i=Co(e,t,o);return kr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function yO(_x146,_x147,_x148,_x149,_x150){return _ref66.apply(this,arguments)}}(),vO=/*#__PURE__*/function(){var _ref67=_asyncToGenerator(function*(e,t,r){let n=yield Nr(e,t,r);return n.request.numberOfResults=0,n});return function vO(_x151,_x152,_x153){return _ref67.apply(this,arguments)}}(),Ab=e=>{e.configuration.analytics.enabled&&It.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},xb=e=>({actionCause:e.actionCause,type:e.actionCause});var Cb=e=>{let t=ag({extra:e}),r=cb();return t.startListening({actionCreator:Hu.pending,effect:function(){var _ref68=_asyncToGenerator(function*(n,o){let i=o.getState();if(!Ad(i))return;r.abortRun(),o.dispatch(oc()),o.dispatch(ib());let a=dn(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 Eb=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)},Rb=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var mf=(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 Ib(e,t){let r={...e},n,o=i=>(a,s)=>{let l=i(a,s);return n?n(l,s):l};return{get combinedReducer(){let i=Wf(Object.entries(t).filter(([a])=>!(a in r)).map(([a,s])=>[a,()=>s]));return o(zn({...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 SO(e){if(!e||!bO(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 Tb(e,t=60){if(!e)return!1;let r=SO(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function bO(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function kb(e,t){let r=0,n=null,o=Ta(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(l,c=!1){let g=!n;g&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(E){if(!c)throw E;return null}})().finally(()=>{n=null}));let v=yield n;return g&&v&&l.dispatch(Cr({accessToken:v})),v});return function i(_x156){return _ref69.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(l){let c=l.getState(),g=AO(c);if(!(!g||!Tb(g))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(l))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(v){e.warn(v,"Access token renewal failed. A retry will occur if necessary.")}}});return function a(_x157){return _ref71.apply(this,arguments)}}(),s=/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(l,c,g){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),_b(l,c.error),c;!n&&(r++,o());try{yield i(l,!0)}catch(E){e.debug(E,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}l.dispatch(g)});return function s(_x158,_x159,_x160){return _ref72.apply(this,arguments)}}();return l=>c=>(/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(g){let v=typeof g=="function",E=typeof t=="function";if(!v)return c(g);E&&(yield a(l));let h=yield c(g);return wO(h)?E?yield s(l,h,g):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),_b(l,h.error),h):h});return function(_x161){return _ref73.apply(this,arguments)}}())}function wO(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Qn().name}function _b(e,t){e.dispatch(fs({status:401,statusCode:401,message:t.message,type:t.name}))}function AO(e){return e.configuration.accessToken}m();d();f();p();function Ob({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return Hm({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(Rb(n.logger))})}function xO(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...o}=r??{},i={...o,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return i.analyticsMode!=="next"&&zf()?(t.info("Analytics disabled since doNotTrack is active."),{...i,enabled:!1}):i}function Pb(e,t){let r={...e.reducers,configuration:qt,version:Xy},n=CO({...e,reducers:r},t,qt),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(Cr({accessToken:o,environment:i,organizationId:a}));let s=xO(e.configuration,n.logger);return s&&n.dispatch(Jn(s)),n}function CO(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=Ib({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,s={...t,get relay(){return Mi(c.state,o)},get navigatorContext(){return mf(this.relay,o)}},l=EO(e,s,i),c={addReducers(g){i.containsAll(g)||(i.add(g),l.replaceReducer(i.combinedReducer))},dispatch:l.dispatch,subscribe:l.subscribe,enableAnalytics(){l.dispatch(to())},disableAnalytics(){l.dispatch(eo())},get state(){return l.getState()},get relay(){return Mi(this.state,o)},get navigatorContext(){return mf(this.relay,o)},logger:a,store:l};return c}function EO(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=RO(e,t.logger,()=>t.navigatorContext);return Ob({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function RO(e,t,r){let{renewAccessToken:n}=e.configuration,o=kb(t,n),i=Cb({getNavigatorContext:r});return[cv,o,Eb(t),Jy].concat(mp.middleware,i.middleware,e.middlewares||[])}m();d();f();p();var Bb=Mt(Vb(),1);function Gb(e){return(0,Bb.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function $b(e,t){let r=$O(e),n=Rt,o=QO(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t}}function $O(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function QO(e){return e.preprocessRequest||Oa}m();d();f();p();m();d();f();p();var Qb={organizationId:Z,accessToken:Z,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}$/})}}),environment:new z({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function Hb(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var zb=new mt({...Qb,pipeline:new z({required:!1,emptyAllowed:!0}),searchHub:et,locale:et,timezone:et});function bf(){return{...Hb(),searchHub:"default"}}var HO={debug:ps,pipeline:oo,searchHub:vo,recommendation:ho};function Wb(e){let t=Gb(e.loggerOptions);zO(e.configuration,t);let r=WO(e.configuration,t),n={...$b(e.configuration,t),apiClient:r},o={...e,reducers:HO},i=Pb(o,n),{pipeline:a,searchHub:s,timezone:l,locale:c,proxyBaseUrl:g}=e.configuration;return i.dispatch(zt({timezone:l,locale:c,proxyBaseUrl:g})),ce(a)||i.dispatch(ro(a)),ce(s)||i.dispatch(yo(s)),{...i,get state(){return i.state}}}function zO(e,t){try{zb.validate(e)}catch(r){throw t.error(r,"Recommendation engine configuration error"),r}}function WO(e,t){return new Fa({logger:t,preprocessRequest:e.preprocessRequest||Oa,postprocessSearchResponseMiddleware:e.preprocessSearchResponseMiddleware||dm,postprocessFacetSearchResponseMiddleware:pm,postprocessQuerySuggestResponseMiddleware:fm})}m();d();f();p();m();d();f();p();m();d();f();p();var KO=new ve({each:Z,required:!0}),Kb=(e,t)=>($(e,Z),Ra(t)?$(t,Z):$(t,KO),{payload:{contextKey:e,contextValue:t}}),jn=N("context/set",e=>{for(let[t,r]of Object.entries(e))Kb(t,r);return{payload:e}}),qn=N("context/add",e=>Kb(e.contextKey,e.contextValue)),Ln=N("context/remove",e=>$(e,Z));m();d();f();p();var Ku=Le(Vu(),e=>{e.addCase(jn,(t,r)=>{t.contextValues=r.payload}).addCase(qn,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Ln,(t,r)=>{delete t.contextValues[r.payload]}).addCase(ht.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});m();d();f();p();function zr(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(l=>l())})),r.set(a,i),()=>{r.delete(a),n()&&s?.()}},get state(){return{}}}}m();d();f();p();var YO=["caseId","caseNumber"],XO={caseId:"caseContext",caseNumber:"caseContext"},ya=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${XO[t]} to set this value.}`)}};function wf(e){return YO.includes(e)}var ZO=new mt({values:new ne({options:{required:!1}})});function Yb(e,t={}){if(!tP(e))throw Gt;let r=zr(e),{dispatch:n}=e,o=()=>e.state,i=ug(e,ZO,t.initialState,"buildContext");return i.values&&n(jn(i.values)),{...r,get state(){return{values:o().context.contextValues}},set(a){n(jn(a))},...(o().configuration.analytics.analyticsMode==="legacy"?JO(n):eP(n))}}var JO=e=>({add(t,r){e(qn({contextKey:t,contextValue:r}))},remove(t){e(Ln(t))}}),eP=e=>({add(t,r){if(wf(t))throw new ya(t);e(qn({contextKey:t,contextValue:r}))},remove(t){if(wf(t))throw new ya(t);e(Ln(t))}});function tP(e){return e.addReducers({context:Ku}),!0}function Xb(e,t){return Yb(e,t)}m();d();f();p();m();d();f();p();var zo=N("dictionaryFieldContext/set",e=>{let t=new ne({options:{required:!0}}),r=$(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new ve({each:tt}),i=$(n,o).error;return i?{payload:e,error:i}:{payload:e}}),Wo=N("dictionaryFieldContext/add",e=>{let t=new ne({options:{required:!0},values:{field:tt,key:tt}});return $(e,t)}),Ko=N("dictionaryFieldContext/remove",e=>$(e,tt));m();d();f();p();var Yu=Le(Bu(),e=>{e.addCase(zo,(t,r)=>{t.contextValues=r.payload}).addCase(Wo,(t,r)=>{let{field:n,key:o}=r.payload;t.contextValues[n]=o}).addCase(Ko,(t,r)=>{delete t.contextValues[r.payload]}).addCase(ht.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.dictionaryFieldContext.contextValues)})});function Zb(e){if(!rP(e))throw Gt;let t=zr(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return{values:n().dictionaryFieldContext.contextValues}},set(o){r(zo(o))},add(o,i){r(Wo({field:o,key:i}))},remove(o){r(Ko(o))}}}function rP(e){return e.addReducers({dictionaryFieldContext:Yu}),!0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var va={value:Z,numberOfResults:new oe({min:0}),state:Z};m();d();f();p();var _e=Z;var aP=new oe({min:1,default:8,required:!1}),sP=new oe({min:1,max:20,default:5,required:!1}),cP={desiredCount:sP,numberOfValues:aP},Pde=N("automaticFacet/setOptions",e=>$(e,cP)),Nde=N("automaticFacet/deselectAll",e=>$(e,_e)),uP=Z,Jb=N("automaticFacet/toggleSelectValue",e=>$(e,{field:uP,selection:new ne({values:va})}));m();d();f();p();m();d();f();p();var lP={state:new Fe({required:!0}),numberOfResults:new oe({required:!0,min:0}),value:new z({required:!0,emptyAllowed:!0}),path:new ve({required:!0,each:Z}),moreValuesAvailable:new me({required:!1})};function Af(e){e.children.forEach(t=>{Af(t)}),Rt({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},lP)}var Yo={facetId:_e,field:Z,tabs:new ne({options:{required:!1},values:{included:new ve({each:new z}),excluded:new ve({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 Fe({required:!1}),basePath:new ve({required:!1,each:Z}),filterByBasePath:new me({required:!1})};var Xde=N("categoryFacet/register",e=>$(e,Yo)),ew=N("categoryFacet/toggleSelectValue",e=>{try{return Rt(e.facetId,Z),Af(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:cr(t)}}}),tw=N("categoryFacet/deselectAll",e=>$(e,Yo.facetId)),Zde=N("categoryFacet/updateNumberOfValues",e=>$(e,{facetId:Yo.facetId,numberOfValues:Yo.numberOfValues})),Jde=N("categoryFacet/updateSortCriterion",e=>$(e,{facetId:Yo.facetId,criterion:new Fe})),epe=N("categoryFacet/updateBasePath",e=>$(e,{facetId:Yo.facetId,basePath:new ve({each:Z})}));m();d();f();p();m();d();f();p();var Sa={facetId:_e,captions:new ne({options:{required:!1}}),numberOfValues:new oe({required:!1,min:1}),query:new z({required:!1,emptyAllowed:!0})};var dP={path:new ve({required:!0,each:Z}),displayValue:tt,rawValue:tt,count:new oe({required:!0,min:0})},rw=N("categoryFacet/selectSearchResult",e=>$(e,{facetId:_e,value:new ne({values:dP})})),vpe=N("categoryFacetSearch/register",e=>$(e,Sa));m();d();f();p();var nw={facetId:_e,value:new ne({values:{displayValue:tt,rawValue:tt,count:new oe({required:!0,min:0})}})},_pe=N("facetSearch/register",e=>$(e,Sa)),kpe=N("facetSearch/update",e=>$(e,Sa)),ow=N("facetSearch/toggleSelectValue",e=>$(e,nw)),iw=N("facetSearch/toggleExcludeValue",e=>$(e,nw));m();d();f();p();m();d();f();p();var jpe=new z({regex:/^[a-zA-Z0-9-_]+$/}),qpe=new z({required:!0}),Lpe=new ve({each:new z}),Upe=new z,Vpe=new me,Bpe=new me,Gpe=new oe({min:0}),pP=new oe({min:1}),$pe=new me({required:!0}),fP=new ne,mP=new z,gP={captions:fP,numberOfValues:pP,query:mP},Qpe=new ne({values:gP}),aw=new ne({options:{required:!1},values:{type:new z({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new ve({required:!0,max:25,each:new z({emptyAllowed:!1,required:!0})})}}),Hpe=new me,sw=new ve({min:1,max:25,required:!1,each:new z({emptyAllowed:!1,required:!0})});var hP={facetId:_e,field:new z({required:!0,emptyAllowed:!0}),tabs:new ne({options:{required:!1},values:{included:new ve({each:new z}),excluded:new ve({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 Fe({required:!1}),resultsMustMatch:new Fe({required:!1}),allowedValues:aw,customSort:sw},ofe=N("facet/register",e=>$(e,hP)),cw=N("facet/toggleSelectValue",e=>$(e,{facetId:_e,selection:new ne({values:va})})),uw=N("facet/toggleExcludeValue",e=>$(e,{facetId:_e,selection:new ne({values:va})})),Xu=N("facet/deselectAll",e=>$(e,_e)),ife=N("facet/updateSortCriterion",e=>$(e,{facetId:_e,criterion:new Fe({required:!0})})),afe=N("facet/updateNumberOfValues",e=>$(e,{facetId:_e,numberOfValues:new oe({required:!0,min:1})})),sfe=N("facet/updateIsFieldExpanded",e=>$(e,{facetId:_e,isFieldExpanded:new me({required:!0})})),cfe=N("facet/updateFreezeCurrentValues",e=>$(e,{facetId:_e,freezeCurrentValues:new me({required:!0})}));m();d();f();p();m();d();f();p();function dw(e){let t=lw(e.start,e),r=lw(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function lw(e,t){let{dateFormat:r}=t;return hy(e)?(rp(e),fy(e)):typeof e=="string"&&_r(e)?(rp(e),e):(uy(e,r),Ys(xo(e,r)))}m();d();f();p();var pw=N("rangeFacet/updateSortCriterion",e=>$(e,{facetId:_e,criterion:new Fe({required:!0})}));m();d();f();p();var Zu={state:Z,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new me({required:!0}),numberOfResults:new oe({required:!0,min:0})},Ju={start:Z,end:Z,endInclusive:new me({required:!0}),state:Z,numberOfResults:new oe({required:!0,min:0})};var yP={start:Z,end:Z,endInclusive:new me({required:!0}),state:Z},vP={facetId:_e,field:Z,tabs:new ne({options:{required:!1},values:{included:new ve({each:new z}),excluded:new ve({each:new z})}}),activeTab:new z({required:!1}),currentValues:new ve({required:!1,each:new ne({values:yP})}),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 Fe({required:!1}),rangeAlgorithm:new Fe({required:!1})};function fw(e){return _r(e)?Hi(e):e}function mw(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=dw(t);if(xo(fw(r)).isAfter(xo(fw(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var Wfe=N("dateFacet/register",e=>{try{return Rt(e,vP),mw(e),{payload:e,error:null}}catch(t){return{payload:e,error:cr(t)}}}),gw=N("dateFacet/toggleSelectValue",e=>$(e,{facetId:_e,selection:new ne({values:Ju})})),hw=N("dateFacet/toggleExcludeValue",e=>$(e,{facetId:_e,selection:new ne({values:Ju})})),yw=N("dateFacet/updateFacetValues",e=>{try{return Rt(e,{facetId:_e,values:new ve({each:new ne({values:Ju})})}),mw({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:cr(t)}}});m();d();f();p();var SP={state:Z,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new me({required:!0})},bP={facetId:_e,field:Z,tabs:new ne({options:{required:!1},values:{included:new ve({each:new z}),excluded:new ve({each:new z})}}),activeTab:new z({required:!1}),currentValues:new ve({required:!1,each:new ne({values:SP})}),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 Fe({required:!1}),rangeAlgorithm:new Fe({required:!1})};function vw(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 sme=N("numericFacet/register",e=>{try{return $(e,bP),vw(e),{payload:e,error:null}}catch(t){return{payload:e,error:cr(t)}}}),Sw=N("numericFacet/toggleSelectValue",e=>$(e,{facetId:_e,selection:new ne({values:Zu})})),bw=N("numericFacet/toggleExcludeValue",e=>$(e,{facetId:_e,selection:new ne({values:Zu})})),ww=N("numericFacet/updateFacetValues",e=>{try{return Rt(e,{facetId:_e,values:new ve({each:new ne({values:Zu})})}),vw({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:cr(t)}}});var Aw=Le(ga(),e=>{e.addCase(Du,(t,r)=>{let n=xf(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=ba(n,o)}).addCase(Mu,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(ic,t=>{t.firstResult=0}).addCase(ju,(t,r)=>{let n=r.payload;t.firstResult=ba(n,t.numberOfResults)}).addCase($o,(t,r)=>{let n=r.payload;t.firstResult=ba(n,t.numberOfResults)}).addCase(Lu,t=>{let r=xf(t),n=Math.max(r-1,1);t.firstResult=ba(n,t.numberOfResults)}).addCase(qu,t=>{let r=xf(t),n=AP(t),o=Math.min(r+1,n);t.firstResult=ba(o,t.numberOfResults)}).addCase(ht.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(Er,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(Hu.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(wb.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Xu,t=>{ut(t)}).addCase(hw,t=>{ut(t)}).addCase(uw,t=>{ut(t)}).addCase(bw,t=>{ut(t)}).addCase(iw,t=>{ut(t)}).addCase(cw,t=>{ut(t)}).addCase(tw,t=>{ut(t)}).addCase(ew,t=>{ut(t)}).addCase(rw,t=>{ut(t)}).addCase(gw,t=>{ut(t)}).addCase(Sw,t=>{ut(t)}).addCase(Ou,t=>{ut(t)}).addCase(yw,t=>{ut(t)}).addCase(ww,t=>{ut(t)}).addCase(ow,t=>{ut(t)}).addCase(Jb,t=>{ut(t)})});function ut(e){e.firstResult=ga().firstResult}function xf(e){let{firstResult:t,numberOfResults:r}=e;return xP(t,r)}function AP(e){let{totalCountFiltered:t,numberOfResults:r}=e;return CP(t,r)}function ba(e,t){return(e-1)*t}function xP(e,t){return Math.round(e/t)+1}function CP(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function Cf(e){return e.addReducers({pagination:Aw}),{nextPage:qu,previousPage:Lu,registerNumberOfResults:Du,registerPage:ju,updateNumberOfResults:Mu,updatePage:$o}}var EP=new mt({id:new z({emptyAllowed:!0,required:!1,default:""}),numberOfRecommendations:new oe({min:0})});function xw(e,t={}){if(!RP(e))throw Gt;let r=zr(e),{dispatch:n}=e,o=()=>e.state,i=lg(e,EP,t.options,"buildRecommendationList");return i.id!==""&&n(go({id:i.id})),i.numberOfRecommendations&&n(Cf(e).updateNumberOfResults(i.numberOfRecommendations)),{...r,refresh(){n(Tr())},get state(){let a=o();return{recommendations:a.recommendation.recommendations,error:a.recommendation.error,isLoading:a.recommendation.isLoading,searchResponseId:a.recommendation.searchUid}}}}function RP(e){return e.addReducers({recommendation:ho,configuration:qt}),!0}m();d();f();p();m();d();f();p();function Cw(e,t,r){if(!IP(e))throw Gt;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:Ta(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function IP(e){return e.addReducers({configuration:qt}),!0}function Ew(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(Us(t.options.result)))};return Cw(e,t,()=>{n()})}m();d();f();p();m();d();f();p();m();d();f();p();var Wr=()=>new z({required:!1,emptyAllowed:!0}),el=N("advancedSearchQueries/update",e=>$(e,{aq:Wr(),cq:Wr(),lq:Wr(),dq:Wr()})),tl=N("advancedSearchQueries/register",e=>$(e,{aq:Wr(),cq:Wr(),lq:Wr(),dq:Wr()}));var Rw=Le(Vr(),e=>{e.addCase(el,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Xe(n)||(t.aq=n,t.aqWasSet=!0),Xe(o)||(t.cq=o,t.cqWasSet=!0),Xe(i)||(t.lq=i,t.lqWasSet=!0),Xe(a)||(t.dq=a,t.dqWasSet=!0)}).addCase(tl,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Xe(n)||(t.defaultFilters.aq=n,t.aqWasSet||(t.aq=n)),Xe(o)||(t.defaultFilters.cq=o,t.cqWasSet||(t.cq=o)),Xe(i)||(t.defaultFilters.lq=i,t.lqWasSet||(t.lq=i)),Xe(a)||(t.defaultFilters.dq=a,t.dqWasSet||(t.dq=a))}).addCase(ht.fulfilled,(t,r)=>r.payload?.advancedSearchQueries??t).addCase(Er,(t,r)=>{let{aq:n,cq:o}=r.payload;Xe(n)||(t.aq=n,t.aqWasSet=!0),Xe(o)||(t.cq=o,t.cqWasSet=!0)})});function TP(e){return e.addReducers({advancedSearchQueries:Rw}),{updateAdvancedSearchQueries:el,registerAdvancedSearchQueries:tl}}m();d();f();p();function _P(e){return e.addReducers({configuration:qt}),{disableAnalytics:eo,enableAnalytics:to,setOriginLevel2:ss,setOriginLevel3:cs,updateAnalyticsConfiguration:Jn,updateBasicConfiguration:Cr}}m();d();f();p();function kP(e){return e.addReducers({configuration:qt,pipeline:oo,searchHub:vo}),{updateSearchConfiguration:zt}}m();d();f();p();function OP(e){return e.addReducers({context:Ku}),{addContext:qn,removeContext:Ln,setContext:jn}}m();d();f();p();function PP(e){return e.addReducers({debug:ps}),{disableDebug:ls,enableDebug:us}}m();d();f();p();function NP(e){return e.addReducers({dictionaryFieldContext:Yu}),{addContext:Wo,removeContext:Ko,setContext:zo}}m();d();f();p();m();d();f();p();m();d();f();p();var FP={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})},Iw=N("folding/register",e=>$(e,FP)),khe=Re("folding/loadCollection",/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),a=i.configuration.analytics.analyticsMode==="legacy"?yield Pr(i):Co(i,o),s=yield n.search({...a,q:DP(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 gt(s)?r(s.error):{collectionId:e,results:s.success.results,searchUid:s.success.searchUid,rootResult:i.folding.collections[e].result}});return function(_x162,_x163){return _ref74.apply(this,arguments)}}());function DP(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}m();d();f();p();var Tw=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});m();d();f();p();var Xo=N("fields/registerFieldsToInclude",e=>$(e,as)),rl=N("fields/fetchall/enable"),nl=N("fields/fetchall/disable"),ol=Re("fields/fetchDescription",/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:i,environment:a,organizationId:s}=o.configuration,{apiBaseUrl:l}=o.configuration.search,c=yield t.apiClient.fieldDescriptions({accessToken:i,organizationId:s,url:l??br(s,a)});return gt(c)?n(c.error):c.success.fields});return function(_x164,_x165){return _ref75.apply(this,arguments)}}());m();d();f();p();var il=["author","language","urihash","objecttype","collection","source","permanentid"],Ef=[...il,"date","filetype","parents"],_w=[...Ef,"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"],kw=()=>({fieldsToInclude:il,fetchAllFields:!1,fieldsDescription:[]});var al=Le(kw(),e=>e.addCase(Xo,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(rl,t=>{t.fetchAllFields=!0}).addCase(nl,t=>{t.fetchAllFields=!1}).addCase(ol.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(Iw,(t,{payload:r})=>{let n=Tw().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));function MP(e){return e.addReducers({fields:al}),{registerFieldsToInclude:Xo,enableFetchAllFields:rl,disableFetchAllFields:nl,fetchFieldsDescription:ol}}m();d();f();p();function jP(e){return e.addReducers({pipeline:oo}),{setPipeline:ro}}m();d();f();p();function qP(e){return e.addReducers({recommendation:ho}),{getRecommendations:Tr,setRecommendationId:go}}m();d();f();p();function LP(e){return e.addReducers({}),{logRecommendationOpen:Us}}m();d();f();p();m();d();f();p();var UP=new mt({content:new Fe({required:!0}),conditions:new Fe({required:!0}),priority:new oe({required:!1,default:0,min:0}),fields:new ve({required:!1,each:Z})});function Ow(){let e=[],t=r=>{let n=UP.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new oi("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 Pw(e){if(!VP(e))throw Gt;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=Ow();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(Xo(i))},selectTemplate:r,selectLinkTemplate:n}}function VP(e){return e.addReducers({fields:al}),!0}m();d();f();p();function BP(e){return e.addReducers({searchHub:vo}),{setSearchHub:yo}}/**
|
|
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()},Pk=e=>{let t=new tr,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==Dn.HEADERS&&o.type===Dn.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=VS(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()},Nk=(e,t)=>{let r=ma(t),n=new tr,o=new kc,i=!1;return e.subscribe({next:a=>{if(o.next(a),a.type===Dn.HEADERS&&!i){i=!0;let s=a.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:s,parser:s===Jp?"protobuf":"sse"}),s===Jp?Pk(o).subscribe({next:l=>n.next(l),error:l=>n.error(l),complete:()=>n.complete()}):Ok(o,r).subscribe({next:l=>{try{let c=mc.parse(l);r?.event("HTTP","Event validated:",c,{type:c.type,valid:!0}),n.next(c)}catch(c){r?.event("HTTP","Event invalid:",{json:l,error:String(c)}),n.error(c)}},error:l=>{if(l?.name==="AbortError"){n.next({type:M.RUN_ERROR,message:l.message||"Request aborted",code:"abort",rawEvent:l}),n.complete();return}return n.error(l)},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()},De=A.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),Fk=A.enum(["LangGraphInterruptEvent","PredictState","Exit"]),Dk=A.object({type:A.literal(De.enum.TextMessageStart),messageId:A.string(),parentMessageId:A.string().optional(),role:A.string().optional()}),Mk=A.object({type:A.literal(De.enum.TextMessageContent),messageId:A.string(),content:A.string()}),qk=A.object({type:A.literal(De.enum.TextMessageEnd),messageId:A.string()}),jk=A.object({type:A.literal(De.enum.ActionExecutionStart),actionExecutionId:A.string(),actionName:A.string(),parentMessageId:A.string().optional()}),Lk=A.object({type:A.literal(De.enum.ActionExecutionArgs),actionExecutionId:A.string(),args:A.string()}),Uk=A.object({type:A.literal(De.enum.ActionExecutionEnd),actionExecutionId:A.string()}),Vk=A.object({type:A.literal(De.enum.ActionExecutionResult),actionName:A.string(),actionExecutionId:A.string(),result:A.string()}),Bk=A.object({type:A.literal(De.enum.AgentStateMessage),threadId:A.string(),agentName:A.string(),nodeName:A.string(),runId:A.string(),active:A.boolean(),role:A.string(),state:A.string(),running:A.boolean()}),Gk=A.object({type:A.literal(De.enum.MetaEvent),name:Fk,value:A.any()}),$k=A.object({type:A.literal(De.enum.RunError),message:A.string(),code:A.string().optional()});A.discriminatedUnion("type",[Dk,Mk,qk,jk,Lk,Uk,Vk,Bk,Gk,$k]),A.object({id:A.string(),role:A.string(),content:A.string(),parentMessageId:A.string().optional()}),A.object({id:A.string(),name:A.string(),arguments:A.any(),parentMessageId:A.string().optional()}),A.object({id:A.string(),result:A.any(),actionExecutionId:A.string(),actionName:A.string()});var Qk=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
|
+
`)},Hk=(e,t,r)=>n=>{let o={},i=!0,a=!0,s="",l=null,c=null,g=[],v={},E=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(St(h=>{switch(h.type){case M.TEXT_MESSAGE_START:{let y=h;return[{type:De.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case M.TEXT_MESSAGE_CONTENT:{let y=h;return[{type:De.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case M.TEXT_MESSAGE_END:{let y=h;return[{type:De.enum.TextMessageEnd,messageId:y.messageId}]}case M.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:De.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case M.TOOL_CALL_ARGS:{let y=h,S=g.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 C=!1;if(c){let R=c.find(T=>T.tool==S.function.name);if(R)try{let T=JSON.parse(Wc(S.function.arguments));R.tool_argument&&R.tool_argument in T?(E({...o,[R.state_key]:T[R.tool_argument]}),C=!0):R.tool_argument||(E({...o,[R.state_key]:T}),C=!0)}catch{}}return[{type:De.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(C?[{type:De.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=h;return[{type:De.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case M.TOOL_CALL_RESULT:{let y=h;return[{type:De.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:v[y.toolCallId]||"unknown"}]}case M.RAW:return[];case M.CUSTOM:{let y=h;switch(y.name){case"Exit":i=!1;break;case"PredictState":c=y.value;break}return[{type:De.enum.MetaEvent,name:y.name,value:y.value}]}case M.STATE_SNAPSHOT:return E(h.snapshot),[{type:De.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=h,S=Ac.applyPatch(o,y.delta,!0,!1);return S?(E(S.newDocument),[{type:De.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 l=h.messages,[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(l?{messages:l}:{})}),active:!0}];case M.RUN_STARTED:return[];case M.RUN_FINISHED:return l&&(o.messages=l),Object.keys(o).length===0?[]:[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(l?{messages:zk(l)}:{})}),active:!1}];case M.RUN_ERROR:{let y=h;return[{type:De.enum.RunError,message:y.message,code:y.code}]}case M.STEP_STARTED:return s=h.stepName,g=[],c=null,[{type:De.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 g=[],c=null,[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function zk(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=Qk(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 _u=e=>t=>{let r=ma(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},l=()=>{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},c=()=>{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},g=()=>a==="text"?[s()]:a==="tool"?[l()]:a==="reasoning"?[c()]:[];return t.pipe(St(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[...g(),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 E=v,h=[];if((a!=="text"||E.messageId!==void 0&&E.messageId!==n?.messageId)&&h.push(...g()),a!=="text"){if(E.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");n={messageId:E.messageId,name:E.name},a="text";let T={type:M.TEXT_MESSAGE_START,messageId:E.messageId,role:E.role||"assistant",...(E.name!==void 0&&{name:E.name})};h.push(T),r?.event("TRANSFORM","TEXT_MESSAGE_START",T,{messageId:E.messageId})}if(E.delta!==void 0){let T={type:M.TEXT_MESSAGE_CONTENT,messageId:n.messageId,delta:E.delta};h.push(T),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",T,{messageId:n.messageId})}return h;case M.TOOL_CALL_CHUNK:let y=v,S=[];if((a!=="tool"||y.toolCallId!==void 0&&y.toolCallId!==o?.toolCallId)&&S.push(...g()),a!=="tool"){if(y.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(y.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");o={toolCallId:y.toolCallId,toolCallName:y.toolCallName,parentMessageId:y.parentMessageId},a="tool";let T={type:M.TOOL_CALL_START,toolCallId:y.toolCallId,toolCallName:y.toolCallName,parentMessageId:y.parentMessageId};S.push(T),r?.event("TRANSFORM","TOOL_CALL_START",T,{toolCallId:y.toolCallId,toolCallName:y.toolCallName})}if(y.delta!==void 0){let T={type:M.TOOL_CALL_ARGS,toolCallId:o.toolCallId,delta:y.delta};S.push(T),r?.event("TRANSFORM","TOOL_CALL_ARGS",T,{toolCallId:o.toolCallId})}return S;case M.REASONING_MESSAGE_CHUNK:let C=v,R=[];if((a!=="reasoning"||C.messageId&&C.messageId!==i?.messageId)&&R.push(...g()),a!=="reasoning"){if(C.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");i={messageId:C.messageId},a="reasoning";let T={type:M.REASONING_MESSAGE_START,messageId:C.messageId};R.push(T),r?.event("TRANSFORM","REASONING_MESSAGE_START",T,{messageId:C.messageId})}if(C.delta!==void 0){let T={type:M.REASONING_MESSAGE_CONTENT,messageId:i.messageId,delta:C.delta};R.push(T),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",T,{messageId:i.messageId})}return R}return v.type,[]}),Fn(()=>{g()}))},ku=class{runNext(e,t){return t.run(e).pipe(_u(!1))}runNextWithState(e,t){let r=Te(e.messages||[]),n=Te(e.state||{}),o=new kc;return KS(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(Hc(/*#__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)}}()))}},Wk=class extends ku{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function Kk(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 Yk=class extends ku{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(Kk)};return this.runNext(o,t)}},$S="THINKING_START",QS="THINKING_END",HS="THINKING_TEXT_MESSAGE_START",zS="THINKING_TEXT_MESSAGE_CONTENT",WS="THINKING_TEXT_MESSAGE_END",Xk=class extends ku{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(Nn(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case $S:{this.currentReasoningId=fa();let{title:t,...r}=e;return this.warnAboutTransformation($S,M.REASONING_START),{...r,type:M.REASONING_START,messageId:this.currentReasoningId}}case HS:return this.currentMessageId=fa(),this.warnAboutTransformation(HS,M.REASONING_MESSAGE_START),{...e,type:M.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case zS:{let{delta:t,...r}=e;return this.warnAboutTransformation(zS,M.REASONING_MESSAGE_CONTENT),{...r,type:M.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??fa(),delta:t}}case WS:{let t=this.currentMessageId??fa();return this.warnAboutTransformation(WS,M.REASONING_MESSAGE_END),{...e,type:M.REASONING_MESSAGE_END,messageId:t}}case QS:{let t=this.currentReasoningId??fa();return this.warnAboutTransformation(QS,M.REASONING_END),{...e,type:M.REASONING_END,messageId:t}}default:return e}}};function Zk(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function Jk(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function eO(e){let t=Zk(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 tO(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>Jk(n)?eO(n):n);return{...e,content:r}}var rO=class extends ku{run(e,t){let r={...e,messages:e.messages.map(tO)};return this.runNext(r,t)}},nO="0.0.53",oO=class{get maxVersion(){return nO}get debug(){return this._debug}set debug(e){this._debug=Tu(e),this._debugLogger=rf(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?rf(Tu(!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.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??Dr(),this.messages=Te(n??[]),this.state=Te(o??{}),this._debug=Tu(i),this._debugLogger=rf(this._debug),pa(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new Yk),pa(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new Xk),pa(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new rO)}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 Wk(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??Dr();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(l=>l.id)),i=[{onRunFinishedEvent:l=>{n=l.result}},..._this14.subscribers,t??{}];yield _this14.onInitialize(r,i),_this14.activeRunDetach$=new tr;let a;_this14.activeRunCompletionPromise=new Promise(l=>{a=l}),yield $c(_c(()=>_this14.middlewares.length===0?_this14.run(r):_this14.middlewares.reduceRight((l,c)=>({run:g=>c.run(g,l),get messages(){return l.messages},get state(){return l.state}}),_this14).run(r),_u(_this14.debugLogger),nf(_this14.debugLogger),l=>l.pipe(zc(_this14.activeRunDetach$)),l=>_this14.apply(r,l,i),l=>_this14.processApplyEvents(r,l,i),ua(l=>(_this14.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this14.agentId,error:l instanceof Error?l.message:String(l)}),_this14.isRunning=!1,_this14.onError(r,l,i))),Fn(()=>{_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}))(Ve(null)));let s=Te(_this14.messages).filter(l=>!o.has(l.id));return{result:n,newMessages:s}}finally{_this14.isRunning=!1}})()}connect(e){throw new Ep}connectAgent(e,t){var _this15=this;return _asyncToGenerator(function*(){try{_this15.isRunning=!0,_this15.agentId=_this15.agentId??Dr();let r=_this15.prepareRunAgentInput(e),n,o=new Set(_this15.messages.map(l=>l.id)),i=[{onRunFinishedEvent:l=>{n=l.result}},..._this15.subscribers,t??{}];yield _this15.onInitialize(r,i),_this15.activeRunDetach$=new tr;let a;_this15.activeRunCompletionPromise=new Promise(l=>{a=l}),yield $c(_c(()=>Qc(()=>_this15.connect(r)),_u(_this15.debugLogger),nf(_this15.debugLogger),l=>l.pipe(zc(_this15.activeRunDetach$)),l=>_this15.apply(r,l,i),l=>_this15.processApplyEvents(r,l,i),ua(l=>(_this15.isRunning=!1,l instanceof Ep?Oc:_this15.onError(r,l,i))),Fn(()=>{_this15.isRunning=!1,_this15.onFinalize(r,i),a?.(),a=void 0,_this15.activeRunCompletionPromise=void 0,_this15.activeRunDetach$=void 0}))(Ve(null)),{defaultValue:void 0});let s=Te(_this15.messages).filter(l=>!o.has(l.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 KS(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(Vp(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).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Dr(),tools:Te(e?.tools??[]),context:Te(e?.context??[]),forwardedProps:Te(e?.forwardedProps??{}),state:Te(this.state),messages:t}}onInitialize(e,t){var _this17=this;return _asyncToGenerator(function*(){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 Pn(Oe(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(Nn(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=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}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??Dr();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(_u(this.debugLogger),nf(this.debugLogger),Hk(this.threadId,t.runId,this.agentId),r=>r.pipe(Nn(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}},YS=class extends oO{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 u.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new u.AbortController,this.url=e.url,this.headers=Te(e.headers??{})}run(e){return Nk(kk(this.url,this.requestInit(e)),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Te(this.headers??{});let t=new u.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};m();d();f();p();var XS=(e,t,r)=>{let n=Et(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let i=`/api/preview/organizations/${t}/agents`;return`${n}${i}/${o}`};var sf=class extends YS{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}}},ZS=(e,t,r)=>new sf({url:`${XS(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var iO=new z({required:!0}),JS=new z({required:!0,constrainTo:ec}),eb=e=>({...e,name:tc(e.name)}),tb=N("followUpAnswers/setIsEnabled",e=>$(e,new me({required:!0}))),rb=N("followUpAnswers/setFollowUpAnswersConversationId",e=>$(e,Z)),nb=N("followUpAnswers/setFollowUpAnswersConversationToken",e=>$(e,Z)),ob=N("followUpAnswers/clearFollowUpAnswersConversationToken"),zte=N("followUpAnswers/createFollowUpAnswer",e=>$(e,{question:Z})),Wte=N("followUpAnswers/setActiveFollowUpAnswerId",e=>$(e,Z)),Kte=N("followUpAnswers/setFollowUpAnswerContentFormat",e=>$(e,{contentFormat:rc,answerId:Z})),Yte=N("followUpAnswers/setFollowUpIsLoading",e=>$(e,{isLoading:new me({required:!0}),answerId:Z})),Xte=N("followUpAnswers/setFollowUpIsStreaming",e=>$(e,{isStreaming:new me({required:!0}),answerId:Z})),Zte=N("followUpAnswers/followUpMessageChunkReceived",e=>$(e,{textDelta:iO,answerId:Z})),Jte=N("followUpAnswers/followUpCitationsReceived",e=>$(e,{citations:new ve({required:!0,each:new ne({values:dp})}),answerId:Z})),ere=N("followUpAnswers/followUpCompleted",e=>$(e,{answerId:Z,cannotAnswer:new me({required:!1})})),tre=N("followUpAnswers/followUpFailed",e=>$(e,{message:new z,code:new oe({min:0}),answerId:Z})),rre=N("followUpAnswers/activeFollowUpStartFailed",e=>$(e,{message:new z})),nre=N("followUpAnswers/likeFollowUp",e=>$(e,{answerId:Z})),ore=N("followUpAnswers/dislikeFollowUp",e=>$(e,{answerId:Z})),ire=N("followUpAnswers/submitFollowUpFeedback",e=>$(e,{answerId:Z})),ib=N("followUpAnswers/resetFollowUpAnswers"),are=N("followUpAnswers/stepStarted",e=>$(eb(e),{answerId:Z,name:JS,startedAt:new oe({min:0,required:!0})})),sre=N("followUpAnswers/stepFinished",e=>$(eb(e),{answerId:Z,name:JS,finishedAt:new oe({min:0,required:!0})}));m();d();f();p();var aO={"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 ab(e){return e?aO[e]??1004:1004}var sb=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(nc(n.runId)),e(Fr(!1)),e(Wi(!0)),e(rb(n.threadId)),e(ob())},onStepStartedEvent:({event:n})=>{e(Uy({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n})=>{e(Vy({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onTextMessageContentEvent:({event:n})=>{n.delta.length>0&&(r=!0),e(Ki({textDelta:n.delta}))},onCustomEvent:({event:n})=>{let{name:o,value:i}=n;switch(o){case"header":{i?.contentFormat&&e(Zi(i.contentFormat)),typeof i?.followUpEnabled=="boolean"&&e(tb(i.followUpEnabled)),i?.conversationToken&&e(nb(i.conversationToken));return}case"citations":{e(Yi({citations:i.citations}));return}}},onRunErrorEvent:({event:n})=>{let o=ab(n.code);e(Xi({message:n.message,code:o}))},onRunFinishedEvent:({event:n})=>{let o=n.result?.completionReason==="ANSWERED",i=o?!r:void 0;e(pp(o)),e(Ji(!o)),e(Wi(!1)),e(wo(o,t,i)),e(Ao())}}};var cb=()=>{let e,t=()=>{e?.abortRun(),e=void 0};return{run:function(){var _ref50=_asyncToGenerator(function*(n,o,i){t();let a=Ds(n),s=Xg(n),l=Zg(n),c=Yg(n),g=Jg(n),v=ZS(a,s,l);e=v;let E=sb(o),h=Ny(n,i());try{o(Fr(!0)),yield v.runAgent({forwardedProps:{params:h,accessToken:c,recordDebugSession:g}},E)}catch(y){o(Fr(!1)),o(Xi({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 Ou=N("breadcrumb/deselectAll"),ub=N("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var lb=N("facet/updateFacetAutoSelection",e=>$(e,{allow:new me({required:!0})}));m();d();f();p();m();d();f();p();var Pu=class extends Ir{constructor(r){super(r);ie(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??At().q}get responseTime(){return this.activeInstantResultCache?.duration??$t().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??$t().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var db=()=>ft("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Pu(e)),pb=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var cf={id:Z},sO={...cf,q:tt},yne=N("instantResults/register",e=>$(e,cf)),Nu=N("instantResults/updateQuery",e=>$(e,sO)),vne=N("instantResults/clearExpired",e=>$(e,cf));m();d();f();p();var Fu=new oe({required:!0,min:0}),Du=N("pagination/registerNumberOfResults",e=>$(e,Fu)),Mu=N("pagination/updateNumberOfResults",e=>$(e,Fu)),qu=N("pagination/registerPage",e=>$(e,Fu)),$o=N("pagination/updatePage",e=>$(e,Fu)),ju=N("pagination/nextPage"),Lu=N("pagination/previousPage");m();d();f();p();var Qo=N("query/updateQuery",e=>$(e,{q:new z,enableQuerySyntax:new me}));m();d();f();p();m();d();f();p();m();d();f();p();var Vr=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var uf=()=>ft("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),Br=e=>ft("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||At().q,aq:r.advancedSearchQueries?.aq||Vr().aq,cq:r.advancedSearchQueries?.cq||Vr().cq,dq:r.advancedSearchQueries?.dq||Vr().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();var roe=N("didYouMean/enable"),noe=N("didYouMean/disable"),ooe=N("didYouMean/automaticCorrections/disable"),ioe=N("didYouMean/automaticCorrections/enable"),Uu=N("didYouMean/correction",e=>$(e,Z)),aoe=N("didYouMean/automaticCorrections/mode",e=>$(e,new z({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var lf=()=>ft("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var fb=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function Vu(){return{contextValues:{}}}m();d();f();p();function Bu(){return{contextValues:{}}}m();d();f();p();function mb(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function gb(){return[]}m();d();f();p();function ga(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function hb(){return{}}m();d();f();p();function yb(){return{}}m();d();f();p();function vb(){return{}}function rr(e){return{context:e.context||Vu(),dictionaryFieldContext:e.dictionaryFieldContext||Bu(),facetSet:e.facetSet||Fs(),numericFacetSet:e.numericFacetSet||Ns(),dateFacetSet:e.dateFacetSet||Ps(),categoryFacetSet:e.categoryFacetSet||Os(),automaticFacetSet:e.automaticFacetSet??ks(),pagination:e.pagination||ga(),query:e.query||At(),tabSet:e.tabSet||vb(),advancedSearchQueries:e.advancedSearchQueries||Vr(),staticFilterSet:e.staticFilterSet||yb(),querySet:e.querySet||hb(),sortCriteria:e.sortCriteria||Ms(),pipeline:e.pipeline||no(),searchHub:e.searchHub||fo(),facetOptions:e.facetOptions||mb(),facetOrder:e.facetOrder??gb(),debug:e.debug??ds()}}m();d();f();p();var Pie=new ne({values:{undoneQuery:tt},options:{required:!0}}),Sb=()=>ft("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var Gu=N("trigger/query/ignore",e=>$(e,new z({emptyAllowed:!0,required:!0}))),$u=N("trigger/query/modification",e=>$(e,new ne({values:{originalQuery:et,modification:et}})));m();d();f();p();var Gr=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=lO(e),n=Zs(e),o=cO(e),i=yield Pr(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return kr({...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 Gr(_x97,_x98){return _ref51.apply(this,arguments)}}();function cO(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(uO).filter(r=>r.currentValues.length>0):void 0}function uO(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function lO(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=dO(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function dO(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 $r=class{constructor(t,r=n=>{this.dispatch(Qo({q:n}))}){ie(this,"config",t);ie(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x99,_x100){var _this23=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Xs(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 gt(t.response)?(this.dispatch(Br(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:l}=n;if(!o||!i)return null;let c=a.length===0&&s&&s.length!==0,g=!ce(l)&&!ce(l.correctedQuery);if(!c&&!g)return null;let E=c?yield _this25.processLegacyDidYouMeanAutoCorrection(t):_this25.processModernDidYouMeanAutoCorrection(t);return _this25.dispatch(Wt(rr(_this25.getState()))),E})()}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 gt(i.response)?(_this26.dispatch(Br(i.response.error)),_this26.rejectWithValue(i.response.error)):(_this26.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this26.dispatch(Wt(rr(_this26.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:lf()})})()}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:lf()}}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(Gu("")),null;_this27.analyticsAction&&(yield _this27.dispatch(_this27.analyticsAction));let i=_this27.getCurrentQuery(),a=yield _this27.automaticallyRetryQueryWithTriggerModification(n);return gt(a.response)?(_this27.dispatch(Br(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(Wt(rr(_this27.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:Sb()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??At().enableQuerySyntax},search:{...$t(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Wt(rr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Da(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this28=this;return _asyncToGenerator(function*(){_this28.onUpdateQueryForCorrection(t);let r=yield _this28.fetchFromAPI(yield Gr(_this28.getState()),{origin:"mainSearch"});return _this28.dispatch(Uu(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this29=this;return _asyncToGenerator(function*(){return _this29.dispatch($u({newQuery:t,originalQuery:_this29.getCurrentQuery()})),_this29.onUpdateQueryForCorrection(t),yield _this29.fetchFromAPI(yield Gr(_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 Pae=Re("search/executeSearch",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Qu(r,t,e)});return function(_x101,_x102){return _ref52.apply(this,arguments)}}()),Nae=Re("search/fetchPage",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();return yield pf(r,t,e)});return function(_x103,_x104){return _ref53.apply(this,arguments)}}()),Fae=Re("search/fetchMoreResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();return yield ff(t,r)});return function(_x105,_x106){return _ref54.apply(this,arguments)}}()),Dae=Re("search/fetchFacetValues",/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t){let r=t.getState();return yield gO(t,e,r)});return function(_x107,_x108){return _ref55.apply(this,arguments)}}()),Mae=Re("search/fetchInstantResults",/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){return df(e,t)});return function(_x109,_x110){return _ref56.apply(this,arguments)}}()),pO=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=yield Gr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function pO(_x111,_x112){return _ref57.apply(this,arguments)}}(),fO=/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t,r){let n=yield Pr(e);return kr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function fO(_x113,_x114,_x115){return _ref58.apply(this,arguments)}}(),mO=/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=yield Gr(e,t);return r.request.numberOfResults=0,r});return function mO(_x116,_x117){return _ref59.apply(this,arguments)}}(),bb=e=>{e.configuration.analytics.enabled&&It.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function df(_x118,_x119){return _df.apply(this,arguments)}function _df(){_df=_asyncToGenerator(function*(e,t){$(e,{id:Z,q:Z,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new $r({...t,analyticsAction:db()},c=>{t.dispatch(Nu({q:c,id:e.id}))}),a=yield fO(o,r,n),s=yield i.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),l=yield i.process(s);return"response"in l?{results:l.response.results,searchUid:l.response.searchUid,analyticsAction:l.analyticsAction,totalCountFiltered:l.response.totalCountFiltered,duration:l.duration}:l});return _df.apply(this,arguments)}function pf(_x120,_x121,_x122){return _pf.apply(this,arguments)}function _pf(){_pf=_asyncToGenerator(function*(e,t,r){bb(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 $r({...t,analyticsAction:r}),l=yield Gr(e,a),c=yield s.fetchFromAPI(l,{origin:"mainSearch"});return yield s.process(c)});return _pf.apply(this,arguments)}function ff(_x123,_x124){return _ff.apply(this,arguments)}function _ff(){_ff=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield uf().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new $r({...e,analyticsAction:uf()}),s=yield pO(t,i),l=yield a.fetchFromAPI(s,{origin:"mainSearch"});return yield a.process(l)});return _ff.apply(this,arguments)}function gO(_x125,_x126,_x127){return _gO.apply(this,arguments)}function _gO(){_gO=_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 $r({...e,analyticsAction:t}),l=yield mO(r,a),c=yield s.fetchFromAPI(l,{origin:"facetValues"});return yield s.process(c)});return _gO.apply(this,arguments)}function Qu(_x128,_x129,_x130){return _Qu.apply(this,arguments)}function _Qu(){_Qu=_asyncToGenerator(function*(e,t,r){bb(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 Gr(e,a),l=new $r({...t,analyticsAction:r}),c=yield l.fetchFromAPI(s,{origin:"mainSearch"});return yield l.process(c)});return _Qu.apply(this,arguments)}m();d();f();p();var Qr=class{constructor(t,r=n=>{this.dispatch(Qo({q:n}))}){ie(this,"config",t);ie(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x131,_x132){var _this30=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Xs(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 gt(t.response)?(this.dispatch(Br(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:l}=n;if(!o||!i)return null;let c=a.length===0&&s&&s.length!==0,g=!ce(l)&&!ce(l.correctedQuery);if(!c&&!g)return null;let E=c?yield _this32.processLegacyDidYouMeanAutoCorrection(t):_this32.processModernDidYouMeanAutoCorrection(t);return _this32.dispatch(Wt(rr(_this32.getState()))),E})()}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 gt(i.response)?(_this33.dispatch(Br(i.response.error)),_this33.rejectWithValue(i.response.error)):(_this33.dispatch(Wt(rr(_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(Gu("")),null;let i=_this34.getCurrentQuery(),a=yield _this34.automaticallyRetryQueryWithTriggerModification(n);return gt(a.response)?(_this34.dispatch(Br(a.response.error)),_this34.rejectWithValue(a.response.error)):(_this34.dispatch(Wt(rr(_this34.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Wt(rr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Da(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this35=this;return _asyncToGenerator(function*(){_this35.onUpdateQueryForCorrection(t);let r=_this35.getState(),{actionCause:n}=fb(),o=yield _this35.fetchFromAPI(yield Nr(r,_this35.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this35.dispatch(Uu(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this36=this;return _asyncToGenerator(function*(){return _this36.dispatch($u({newQuery:t,originalQuery:_this36.getCurrentQuery()})),_this36.onUpdateQueryForCorrection(t),yield _this36.fetchFromAPI(yield Nr(_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 Ase=Re("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;$(e,{q:new z,enableQuerySyntax:new me,clearFilters:new me}),e.clearFilters&&(r(Ou()),r(ub())),r(lb({allow:!0})),r(Qo({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r($o(1))}),xse=N("search/updateSearchAction"),Hu=Re("search/executeSearch",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Qu(r,t,e.legacy);Ab(r);let n=e.next?xb(e.next):void 0,o=yield Nr(r,t.extra.navigatorContext,n),i=new Qr({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x133,_x134){return _ref60.apply(this,arguments)}}()),wb=Re("search/fetchPage",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(Ab(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return pf(r,t,e.legacy);let n=new Qr({...t,analyticsAction:e.next}),o=yield Nr(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)}}()),Cse=Re("search/fetchMoreResults",/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return ff(t,r);let n=bh("browseResults",t.getState),o=new Qr({...t,analyticsAction:n}),i=yield hO(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)}}()),Ese=Re("search/fetchFacetValues",/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Qu(r,t,e.legacy);let n=new Qr({...t,analyticsAction:{}}),o=yield vO(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)}}()),Rse=Re("search/fetchInstantResults",/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return df(e,t);$(e,{id:Z,q:Z,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:n,maxResultsPerQuery:o}=e,i=xb(pb()),a=yield yO(r,t.extra.navigatorContext,n,o,i),s=new Qr({...t,analyticsAction:i},g=>{t.dispatch(Nu({q:g,id:e.id}))}),l=yield s.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),c=yield s.process(l);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)}}()),hO=/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t,r){let n=yield Nr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function hO(_x143,_x144,_x145){return _ref65.apply(this,arguments)}}(),yO=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(e,t,r,n,o){let i=Co(e,t,o);return kr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function yO(_x146,_x147,_x148,_x149,_x150){return _ref66.apply(this,arguments)}}(),vO=/*#__PURE__*/function(){var _ref67=_asyncToGenerator(function*(e,t,r){let n=yield Nr(e,t,r);return n.request.numberOfResults=0,n});return function vO(_x151,_x152,_x153){return _ref67.apply(this,arguments)}}(),Ab=e=>{e.configuration.analytics.enabled&&It.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},xb=e=>({actionCause:e.actionCause,type:e.actionCause});var Cb=e=>{let t=ag({extra:e}),r=cb();return t.startListening({actionCreator:Hu.pending,effect:function(){var _ref68=_asyncToGenerator(function*(n,o){let i=o.getState();if(!Ad(i))return;r.abortRun(),o.dispatch(oc()),o.dispatch(ib());let a=dn(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 Eb=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)},Rb=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var mf=(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 Ib(e,t){let r={...e},n,o=i=>(a,s)=>{let l=i(a,s);return n?n(l,s):l};return{get combinedReducer(){let i=Wf(Object.entries(t).filter(([a])=>!(a in r)).map(([a,s])=>[a,()=>s]));return o(zn({...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 SO(e){if(!e||!bO(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 Tb(e,t=60){if(!e)return!1;let r=SO(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function bO(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function kb(e,t){let r=0,n=null,o=Ta(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(l,c=!1){let g=!n;g&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(E){if(!c)throw E;return null}})().finally(()=>{n=null}));let v=yield n;return g&&v&&l.dispatch(Cr({accessToken:v})),v});return function i(_x156){return _ref69.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(l){let c=l.getState(),g=AO(c);if(!(!g||!Tb(g))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(l))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(v){e.warn(v,"Access token renewal failed. A retry will occur if necessary.")}}});return function a(_x157){return _ref71.apply(this,arguments)}}(),s=/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(l,c,g){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),_b(l,c.error),c;!n&&(r++,o());try{yield i(l,!0)}catch(E){e.debug(E,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}l.dispatch(g)});return function s(_x158,_x159,_x160){return _ref72.apply(this,arguments)}}();return l=>c=>(/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(g){let v=typeof g=="function",E=typeof t=="function";if(!v)return c(g);E&&(yield a(l));let h=yield c(g);return wO(h)?E?yield s(l,h,g):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),_b(l,h.error),h):h});return function(_x161){return _ref73.apply(this,arguments)}}())}function wO(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Qn().name}function _b(e,t){e.dispatch(fs({status:401,statusCode:401,message:t.message,type:t.name}))}function AO(e){return e.configuration.accessToken}m();d();f();p();function Ob({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return Hm({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(Rb(n.logger))})}function xO(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...o}=r??{},i={...o,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return i.analyticsMode!=="next"&&zf()?(t.info("Analytics disabled since doNotTrack is active."),{...i,enabled:!1}):i}function Pb(e,t){let r={...e.reducers,configuration:jt,version:Xy},n=CO({...e,reducers:r},t,jt),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(Cr({accessToken:o,environment:i,organizationId:a}));let s=xO(e.configuration,n.logger);return s&&n.dispatch(Jn(s)),n}function CO(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=Ib({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,s={...t,get relay(){return Mi(c.state,o)},get navigatorContext(){return mf(this.relay,o)}},l=EO(e,s,i),c={addReducers(g){i.containsAll(g)||(i.add(g),l.replaceReducer(i.combinedReducer))},dispatch:l.dispatch,subscribe:l.subscribe,enableAnalytics(){l.dispatch(to())},disableAnalytics(){l.dispatch(eo())},get state(){return l.getState()},get relay(){return Mi(this.state,o)},get navigatorContext(){return mf(this.relay,o)},logger:a,store:l};return c}function EO(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=RO(e,t.logger,()=>t.navigatorContext);return Ob({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function RO(e,t,r){let{renewAccessToken:n}=e.configuration,o=kb(t,n),i=Cb({getNavigatorContext:r});return[cv,o,Eb(t),Jy].concat(mp.middleware,i.middleware,e.middlewares||[])}m();d();f();p();var Bb=Mt(Vb(),1);function Gb(e){return(0,Bb.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function $b(e,t){let r=$O(e),n=Rt,o=QO(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t}}function $O(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function QO(e){return e.preprocessRequest||Oa}m();d();f();p();m();d();f();p();var Qb={organizationId:Z,accessToken:Z,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}$/})}}),environment:new z({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function Hb(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var zb=new mt({...Qb,pipeline:new z({required:!1,emptyAllowed:!0}),searchHub:et,locale:et,timezone:et});function bf(){return{...Hb(),searchHub:"default"}}var HO={debug:ps,pipeline:oo,searchHub:vo,recommendation:ho};function Wb(e){let t=Gb(e.loggerOptions);zO(e.configuration,t);let r=WO(e.configuration,t),n={...$b(e.configuration,t),apiClient:r},o={...e,reducers:HO},i=Pb(o,n),{pipeline:a,searchHub:s,timezone:l,locale:c,proxyBaseUrl:g}=e.configuration;return i.dispatch(zt({timezone:l,locale:c,proxyBaseUrl:g})),ce(a)||i.dispatch(ro(a)),ce(s)||i.dispatch(yo(s)),{...i,get state(){return i.state}}}function zO(e,t){try{zb.validate(e)}catch(r){throw t.error(r,"Recommendation engine configuration error"),r}}function WO(e,t){return new Fa({logger:t,preprocessRequest:e.preprocessRequest||Oa,postprocessSearchResponseMiddleware:e.preprocessSearchResponseMiddleware||dm,postprocessFacetSearchResponseMiddleware:pm,postprocessQuerySuggestResponseMiddleware:fm})}m();d();f();p();m();d();f();p();m();d();f();p();var KO=new ve({each:Z,required:!0}),Kb=(e,t)=>($(e,Z),Ra(t)?$(t,Z):$(t,KO),{payload:{contextKey:e,contextValue:t}}),qn=N("context/set",e=>{for(let[t,r]of Object.entries(e))Kb(t,r);return{payload:e}}),jn=N("context/add",e=>Kb(e.contextKey,e.contextValue)),Ln=N("context/remove",e=>$(e,Z));m();d();f();p();var Ku=Le(Vu(),e=>{e.addCase(qn,(t,r)=>{t.contextValues=r.payload}).addCase(jn,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Ln,(t,r)=>{delete t.contextValues[r.payload]}).addCase(ht.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});m();d();f();p();function zr(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(l=>l())})),r.set(a,i),()=>{r.delete(a),n()&&s?.()}},get state(){return{}}}}m();d();f();p();var YO=["caseId","caseNumber"],XO={caseId:"caseContext",caseNumber:"caseContext"},ya=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${XO[t]} to set this value.}`)}};function wf(e){return YO.includes(e)}var ZO=new mt({values:new ne({options:{required:!1}})});function Yb(e,t={}){if(!tP(e))throw Gt;let r=zr(e),{dispatch:n}=e,o=()=>e.state,i=ug(e,ZO,t.initialState,"buildContext");return i.values&&n(qn(i.values)),{...r,get state(){return{values:o().context.contextValues}},set(a){n(qn(a))},...(o().configuration.analytics.analyticsMode==="legacy"?JO(n):eP(n))}}var JO=e=>({add(t,r){e(jn({contextKey:t,contextValue:r}))},remove(t){e(Ln(t))}}),eP=e=>({add(t,r){if(wf(t))throw new ya(t);e(jn({contextKey:t,contextValue:r}))},remove(t){if(wf(t))throw new ya(t);e(Ln(t))}});function tP(e){return e.addReducers({context:Ku}),!0}function Xb(e,t){return Yb(e,t)}m();d();f();p();m();d();f();p();var zo=N("dictionaryFieldContext/set",e=>{let t=new ne({options:{required:!0}}),r=$(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new ve({each:tt}),i=$(n,o).error;return i?{payload:e,error:i}:{payload:e}}),Wo=N("dictionaryFieldContext/add",e=>{let t=new ne({options:{required:!0},values:{field:tt,key:tt}});return $(e,t)}),Ko=N("dictionaryFieldContext/remove",e=>$(e,tt));m();d();f();p();var Yu=Le(Bu(),e=>{e.addCase(zo,(t,r)=>{t.contextValues=r.payload}).addCase(Wo,(t,r)=>{let{field:n,key:o}=r.payload;t.contextValues[n]=o}).addCase(Ko,(t,r)=>{delete t.contextValues[r.payload]}).addCase(ht.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.dictionaryFieldContext.contextValues)})});function Zb(e){if(!rP(e))throw Gt;let t=zr(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return{values:n().dictionaryFieldContext.contextValues}},set(o){r(zo(o))},add(o,i){r(Wo({field:o,key:i}))},remove(o){r(Ko(o))}}}function rP(e){return e.addReducers({dictionaryFieldContext:Yu}),!0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var va={value:Z,numberOfResults:new oe({min:0}),state:Z};m();d();f();p();var _e=Z;var aP=new oe({min:1,default:8,required:!1}),sP=new oe({min:1,max:20,default:5,required:!1}),cP={desiredCount:sP,numberOfValues:aP},Nde=N("automaticFacet/setOptions",e=>$(e,cP)),Fde=N("automaticFacet/deselectAll",e=>$(e,_e)),uP=Z,Jb=N("automaticFacet/toggleSelectValue",e=>$(e,{field:uP,selection:new ne({values:va})}));m();d();f();p();m();d();f();p();var lP={state:new Fe({required:!0}),numberOfResults:new oe({required:!0,min:0}),value:new z({required:!0,emptyAllowed:!0}),path:new ve({required:!0,each:Z}),moreValuesAvailable:new me({required:!1})};function Af(e){e.children.forEach(t=>{Af(t)}),Rt({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},lP)}var Yo={facetId:_e,field:Z,tabs:new ne({options:{required:!1},values:{included:new ve({each:new z}),excluded:new ve({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 Fe({required:!1}),basePath:new ve({required:!1,each:Z}),filterByBasePath:new me({required:!1})};var Zde=N("categoryFacet/register",e=>$(e,Yo)),ew=N("categoryFacet/toggleSelectValue",e=>{try{return Rt(e.facetId,Z),Af(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:cr(t)}}}),tw=N("categoryFacet/deselectAll",e=>$(e,Yo.facetId)),Jde=N("categoryFacet/updateNumberOfValues",e=>$(e,{facetId:Yo.facetId,numberOfValues:Yo.numberOfValues})),epe=N("categoryFacet/updateSortCriterion",e=>$(e,{facetId:Yo.facetId,criterion:new Fe})),tpe=N("categoryFacet/updateBasePath",e=>$(e,{facetId:Yo.facetId,basePath:new ve({each:Z})}));m();d();f();p();m();d();f();p();var Sa={facetId:_e,captions:new ne({options:{required:!1}}),numberOfValues:new oe({required:!1,min:1}),query:new z({required:!1,emptyAllowed:!0})};var dP={path:new ve({required:!0,each:Z}),displayValue:tt,rawValue:tt,count:new oe({required:!0,min:0})},rw=N("categoryFacet/selectSearchResult",e=>$(e,{facetId:_e,value:new ne({values:dP})})),Spe=N("categoryFacetSearch/register",e=>$(e,Sa));m();d();f();p();var nw={facetId:_e,value:new ne({values:{displayValue:tt,rawValue:tt,count:new oe({required:!0,min:0})}})},kpe=N("facetSearch/register",e=>$(e,Sa)),Ope=N("facetSearch/update",e=>$(e,Sa)),ow=N("facetSearch/toggleSelectValue",e=>$(e,nw)),iw=N("facetSearch/toggleExcludeValue",e=>$(e,nw));m();d();f();p();m();d();f();p();var jpe=new z({regex:/^[a-zA-Z0-9-_]+$/}),Lpe=new z({required:!0}),Upe=new ve({each:new z}),Vpe=new z,Bpe=new me,Gpe=new me,$pe=new oe({min:0}),pP=new oe({min:1}),Qpe=new me({required:!0}),fP=new ne,mP=new z,gP={captions:fP,numberOfValues:pP,query:mP},Hpe=new ne({values:gP}),aw=new ne({options:{required:!1},values:{type:new z({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new ve({required:!0,max:25,each:new z({emptyAllowed:!1,required:!0})})}}),zpe=new me,sw=new ve({min:1,max:25,required:!1,each:new z({emptyAllowed:!1,required:!0})});var hP={facetId:_e,field:new z({required:!0,emptyAllowed:!0}),tabs:new ne({options:{required:!1},values:{included:new ve({each:new z}),excluded:new ve({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 Fe({required:!1}),resultsMustMatch:new Fe({required:!1}),allowedValues:aw,customSort:sw},ife=N("facet/register",e=>$(e,hP)),cw=N("facet/toggleSelectValue",e=>$(e,{facetId:_e,selection:new ne({values:va})})),uw=N("facet/toggleExcludeValue",e=>$(e,{facetId:_e,selection:new ne({values:va})})),Xu=N("facet/deselectAll",e=>$(e,_e)),afe=N("facet/updateSortCriterion",e=>$(e,{facetId:_e,criterion:new Fe({required:!0})})),sfe=N("facet/updateNumberOfValues",e=>$(e,{facetId:_e,numberOfValues:new oe({required:!0,min:1})})),cfe=N("facet/updateIsFieldExpanded",e=>$(e,{facetId:_e,isFieldExpanded:new me({required:!0})})),ufe=N("facet/updateFreezeCurrentValues",e=>$(e,{facetId:_e,freezeCurrentValues:new me({required:!0})}));m();d();f();p();m();d();f();p();function dw(e){let t=lw(e.start,e),r=lw(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function lw(e,t){let{dateFormat:r}=t;return hy(e)?(rp(e),fy(e)):typeof e=="string"&&_r(e)?(rp(e),e):(uy(e,r),Ys(xo(e,r)))}m();d();f();p();var pw=N("rangeFacet/updateSortCriterion",e=>$(e,{facetId:_e,criterion:new Fe({required:!0})}));m();d();f();p();var Zu={state:Z,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new me({required:!0}),numberOfResults:new oe({required:!0,min:0})},Ju={start:Z,end:Z,endInclusive:new me({required:!0}),state:Z,numberOfResults:new oe({required:!0,min:0})};var yP={start:Z,end:Z,endInclusive:new me({required:!0}),state:Z},vP={facetId:_e,field:Z,tabs:new ne({options:{required:!1},values:{included:new ve({each:new z}),excluded:new ve({each:new z})}}),activeTab:new z({required:!1}),currentValues:new ve({required:!1,each:new ne({values:yP})}),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 Fe({required:!1}),rangeAlgorithm:new Fe({required:!1})};function fw(e){return _r(e)?Hi(e):e}function mw(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=dw(t);if(xo(fw(r)).isAfter(xo(fw(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var Kfe=N("dateFacet/register",e=>{try{return Rt(e,vP),mw(e),{payload:e,error:null}}catch(t){return{payload:e,error:cr(t)}}}),gw=N("dateFacet/toggleSelectValue",e=>$(e,{facetId:_e,selection:new ne({values:Ju})})),hw=N("dateFacet/toggleExcludeValue",e=>$(e,{facetId:_e,selection:new ne({values:Ju})})),yw=N("dateFacet/updateFacetValues",e=>{try{return Rt(e,{facetId:_e,values:new ve({each:new ne({values:Ju})})}),mw({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:cr(t)}}});m();d();f();p();var SP={state:Z,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new me({required:!0})},bP={facetId:_e,field:Z,tabs:new ne({options:{required:!1},values:{included:new ve({each:new z}),excluded:new ve({each:new z})}}),activeTab:new z({required:!1}),currentValues:new ve({required:!1,each:new ne({values:SP})}),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 Fe({required:!1}),rangeAlgorithm:new Fe({required:!1})};function vw(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 cme=N("numericFacet/register",e=>{try{return $(e,bP),vw(e),{payload:e,error:null}}catch(t){return{payload:e,error:cr(t)}}}),Sw=N("numericFacet/toggleSelectValue",e=>$(e,{facetId:_e,selection:new ne({values:Zu})})),bw=N("numericFacet/toggleExcludeValue",e=>$(e,{facetId:_e,selection:new ne({values:Zu})})),ww=N("numericFacet/updateFacetValues",e=>{try{return Rt(e,{facetId:_e,values:new ve({each:new ne({values:Zu})})}),vw({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:cr(t)}}});var Aw=Le(ga(),e=>{e.addCase(Du,(t,r)=>{let n=xf(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=ba(n,o)}).addCase(Mu,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(ic,t=>{t.firstResult=0}).addCase(qu,(t,r)=>{let n=r.payload;t.firstResult=ba(n,t.numberOfResults)}).addCase($o,(t,r)=>{let n=r.payload;t.firstResult=ba(n,t.numberOfResults)}).addCase(Lu,t=>{let r=xf(t),n=Math.max(r-1,1);t.firstResult=ba(n,t.numberOfResults)}).addCase(ju,t=>{let r=xf(t),n=AP(t),o=Math.min(r+1,n);t.firstResult=ba(o,t.numberOfResults)}).addCase(ht.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(Er,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(Hu.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(wb.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Xu,t=>{ut(t)}).addCase(hw,t=>{ut(t)}).addCase(uw,t=>{ut(t)}).addCase(bw,t=>{ut(t)}).addCase(iw,t=>{ut(t)}).addCase(cw,t=>{ut(t)}).addCase(tw,t=>{ut(t)}).addCase(ew,t=>{ut(t)}).addCase(rw,t=>{ut(t)}).addCase(gw,t=>{ut(t)}).addCase(Sw,t=>{ut(t)}).addCase(Ou,t=>{ut(t)}).addCase(yw,t=>{ut(t)}).addCase(ww,t=>{ut(t)}).addCase(ow,t=>{ut(t)}).addCase(Jb,t=>{ut(t)})});function ut(e){e.firstResult=ga().firstResult}function xf(e){let{firstResult:t,numberOfResults:r}=e;return xP(t,r)}function AP(e){let{totalCountFiltered:t,numberOfResults:r}=e;return CP(t,r)}function ba(e,t){return(e-1)*t}function xP(e,t){return Math.round(e/t)+1}function CP(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function Cf(e){return e.addReducers({pagination:Aw}),{nextPage:ju,previousPage:Lu,registerNumberOfResults:Du,registerPage:qu,updateNumberOfResults:Mu,updatePage:$o}}var EP=new mt({id:new z({emptyAllowed:!0,required:!1,default:""}),numberOfRecommendations:new oe({min:0})});function xw(e,t={}){if(!RP(e))throw Gt;let r=zr(e),{dispatch:n}=e,o=()=>e.state,i=lg(e,EP,t.options,"buildRecommendationList");return i.id!==""&&n(go({id:i.id})),i.numberOfRecommendations&&n(Cf(e).updateNumberOfResults(i.numberOfRecommendations)),{...r,refresh(){n(Tr())},get state(){let a=o();return{recommendations:a.recommendation.recommendations,error:a.recommendation.error,isLoading:a.recommendation.isLoading,searchResponseId:a.recommendation.searchUid}}}}function RP(e){return e.addReducers({recommendation:ho,configuration:jt}),!0}m();d();f();p();m();d();f();p();function Cw(e,t,r){if(!IP(e))throw Gt;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:Ta(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function IP(e){return e.addReducers({configuration:jt}),!0}function Ew(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(Us(t.options.result)))};return Cw(e,t,()=>{n()})}m();d();f();p();m();d();f();p();m();d();f();p();var Wr=()=>new z({required:!1,emptyAllowed:!0}),el=N("advancedSearchQueries/update",e=>$(e,{aq:Wr(),cq:Wr(),lq:Wr(),dq:Wr()})),tl=N("advancedSearchQueries/register",e=>$(e,{aq:Wr(),cq:Wr(),lq:Wr(),dq:Wr()}));var Rw=Le(Vr(),e=>{e.addCase(el,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Xe(n)||(t.aq=n,t.aqWasSet=!0),Xe(o)||(t.cq=o,t.cqWasSet=!0),Xe(i)||(t.lq=i,t.lqWasSet=!0),Xe(a)||(t.dq=a,t.dqWasSet=!0)}).addCase(tl,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Xe(n)||(t.defaultFilters.aq=n,t.aqWasSet||(t.aq=n)),Xe(o)||(t.defaultFilters.cq=o,t.cqWasSet||(t.cq=o)),Xe(i)||(t.defaultFilters.lq=i,t.lqWasSet||(t.lq=i)),Xe(a)||(t.defaultFilters.dq=a,t.dqWasSet||(t.dq=a))}).addCase(ht.fulfilled,(t,r)=>r.payload?.advancedSearchQueries??t).addCase(Er,(t,r)=>{let{aq:n,cq:o}=r.payload;Xe(n)||(t.aq=n,t.aqWasSet=!0),Xe(o)||(t.cq=o,t.cqWasSet=!0)})});function TP(e){return e.addReducers({advancedSearchQueries:Rw}),{updateAdvancedSearchQueries:el,registerAdvancedSearchQueries:tl}}m();d();f();p();function _P(e){return e.addReducers({configuration:jt}),{disableAnalytics:eo,enableAnalytics:to,setOriginLevel2:ss,setOriginLevel3:cs,updateAnalyticsConfiguration:Jn,updateBasicConfiguration:Cr}}m();d();f();p();function kP(e){return e.addReducers({configuration:jt,pipeline:oo,searchHub:vo}),{updateSearchConfiguration:zt}}m();d();f();p();function OP(e){return e.addReducers({context:Ku}),{addContext:jn,removeContext:Ln,setContext:qn}}m();d();f();p();function PP(e){return e.addReducers({debug:ps}),{disableDebug:ls,enableDebug:us}}m();d();f();p();function NP(e){return e.addReducers({dictionaryFieldContext:Yu}),{addContext:Wo,removeContext:Ko,setContext:zo}}m();d();f();p();m();d();f();p();m();d();f();p();var FP={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})},Iw=N("folding/register",e=>$(e,FP)),Ohe=Re("folding/loadCollection",/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),a=i.configuration.analytics.analyticsMode==="legacy"?yield Pr(i):Co(i,o),s=yield n.search({...a,q:DP(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 gt(s)?r(s.error):{collectionId:e,results:s.success.results,searchUid:s.success.searchUid,rootResult:i.folding.collections[e].result}});return function(_x162,_x163){return _ref74.apply(this,arguments)}}());function DP(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}m();d();f();p();var Tw=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});m();d();f();p();var Xo=N("fields/registerFieldsToInclude",e=>$(e,as)),rl=N("fields/fetchall/enable"),nl=N("fields/fetchall/disable"),ol=Re("fields/fetchDescription",/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:i,environment:a,organizationId:s}=o.configuration,{apiBaseUrl:l}=o.configuration.search,c=yield t.apiClient.fieldDescriptions({accessToken:i,organizationId:s,url:l??br(s,a)});return gt(c)?n(c.error):c.success.fields});return function(_x164,_x165){return _ref75.apply(this,arguments)}}());m();d();f();p();var il=["author","language","urihash","objecttype","collection","source","permanentid"],Ef=[...il,"date","filetype","parents"],_w=[...Ef,"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"],kw=()=>({fieldsToInclude:il,fetchAllFields:!1,fieldsDescription:[]});var al=Le(kw(),e=>e.addCase(Xo,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(rl,t=>{t.fetchAllFields=!0}).addCase(nl,t=>{t.fetchAllFields=!1}).addCase(ol.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(Iw,(t,{payload:r})=>{let n=Tw().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));function MP(e){return e.addReducers({fields:al}),{registerFieldsToInclude:Xo,enableFetchAllFields:rl,disableFetchAllFields:nl,fetchFieldsDescription:ol}}m();d();f();p();function qP(e){return e.addReducers({pipeline:oo}),{setPipeline:ro}}m();d();f();p();function jP(e){return e.addReducers({recommendation:ho}),{getRecommendations:Tr,setRecommendationId:go}}m();d();f();p();function LP(e){return e.addReducers({}),{logRecommendationOpen:Us}}m();d();f();p();m();d();f();p();var UP=new mt({content:new Fe({required:!0}),conditions:new Fe({required:!0}),priority:new oe({required:!1,default:0,min:0}),fields:new ve({required:!1,each:Z})});function Ow(){let e=[],t=r=>{let n=UP.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new oi("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 Pw(e){if(!VP(e))throw Gt;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=Ow();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(Xo(i))},selectTemplate:r,selectLinkTemplate:n}}function VP(e){return e.addReducers({fields:al}),!0}m();d();f();p();function BP(e){return e.addReducers({searchHub:vo}),{setSearchHub:yo}}/**
|
|
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.41.0';
|